Revert incorrect RCL_3 drop: RCL_3 PDK_3.0.2
authorPat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:29:57 +0100
branchRCL_3
changeset 22 d38647835c2e
parent 21 f742655b05bf
child 23 755430a7d64b
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035
callcontinuity/group/bld.inf
callcontinuity/nsmldmvccadapter/data/2000E5BD.rss
callcontinuity/nsmldmvccadapter/group/bld.inf
callcontinuity/nsmldmvccadapter/group/nsmldmvccadapter.mmp
callcontinuity/nsmldmvccadapter/inc/nsmldmvccadapter.h
callcontinuity/nsmldmvccadapter/inc/vccunittesting.h
callcontinuity/nsmldmvccadapter/src/nsmldmvccadapter.cpp
callcontinuity/nsmldmvccadapter/src/proxy.cpp
callcontinuity/nsmldmvccadapter/src/rubydebug.cpp
callcontinuity/rom/vcc.iby
callcontinuity/rom/vccresources.iby
callcontinuity/settingsreader/group/bld.inf
callcontinuity/settingsreader/group/test_mover.make
callcontinuity/settingsreader/inc/rubydebug.h
callcontinuity/settingsreader/inc/rubydebug.inl
callcontinuity/settingsreader/inc/rubydebugcfg.h
callcontinuity/settingsreader/inc/rubydebugconfigselector.h
callcontinuity/settingsreader/inc/vccsettingsreader.h
callcontinuity/settingsreader/src/rubydebug.cpp
callcontinuity/settingsreader/src/vccsettingsreader.cpp
callcontinuity/vcc/bwins/t_vccu.def
callcontinuity/vcc/bwins/vccperformeru.def
callcontinuity/vcc/data/2000CFA9.rss
callcontinuity/vcc/eabi/t_vccu.def
callcontinuity/vcc/group/bld.inf
callcontinuity/vcc/group/test_mover.make
callcontinuity/vcc/group/vcc.mmp
callcontinuity/vcc/inc/cvccconferencecall.h
callcontinuity/vcc/inc/cvccdirector.h
callcontinuity/vcc/inc/cvccdtmfprovider.h
callcontinuity/vcc/inc/cvcctransferprovider.h
callcontinuity/vcc/inc/mvccengpspropertylistenerobserver.h
callcontinuity/vcc/inc/rubydebug.h
callcontinuity/vcc/inc/rubydebug.inl
callcontinuity/vcc/inc/rubydebugcfg.h
callcontinuity/vcc/inc/rubydebugconfigselector.h
callcontinuity/vcc/inc/tvccstate.h
callcontinuity/vcc/inc/tvccstatecalling.h
callcontinuity/vcc/inc/tvccstatefailing.h
callcontinuity/vcc/inc/tvccstateinit.h
callcontinuity/vcc/inc/tvccstatereleasing.h
callcontinuity/vcc/inc/vccdefinitions.h
callcontinuity/vcc/inc/vccengpsproperty.h
callcontinuity/vcc/inc/vccengpspropertylistener.h
callcontinuity/vcc/inc/vccunittesting.h
callcontinuity/vcc/sis/vcc_stub.SIS
callcontinuity/vcc/src/cvccconferencecall.cpp
callcontinuity/vcc/src/cvccdirector.cpp
callcontinuity/vcc/src/cvccdtmfprovider.cpp
callcontinuity/vcc/src/cvccperformer.cpp
callcontinuity/vcc/src/cvccproxy.cpp
callcontinuity/vcc/src/cvcctransferprovider.cpp
callcontinuity/vcc/src/rubydebug.cpp
callcontinuity/vcc/src/tvccstate.cpp
callcontinuity/vcc/src/tvccstatecalling.cpp
callcontinuity/vcc/src/tvccstatefailing.cpp
callcontinuity/vcc/src/tvccstateinit.cpp
callcontinuity/vcc/src/tvccstatereleasing.cpp
callcontinuity/vcc/src/vccengpsproperty.cpp
callcontinuity/vcc/src/vccengpspropertylistener.cpp
callcontinuity/vccclientprovisioningadapter/data/2000CFAC.rss
callcontinuity/vccclientprovisioningadapter/data/wpvccadapterrsc.rss
callcontinuity/vccclientprovisioningadapter/group/bld.inf
callcontinuity/vccclientprovisioningadapter/group/test_mover.make
callcontinuity/vccclientprovisioningadapter/group/wpvccadapter.mmp
callcontinuity/vccclientprovisioningadapter/inc/vccunittesting.h
callcontinuity/vccclientprovisioningadapter/inc/wpvccadapter.h
callcontinuity/vccclientprovisioningadapter/inc/wpvccadapteruids.h
callcontinuity/vccclientprovisioningadapter/loc/wpvccadapter.loc
callcontinuity/vccclientprovisioningadapter/src/rubydebug.cpp
callcontinuity/vccclientprovisioningadapter/src/wpvccadapter.cpp
callcontinuity/vccclientprovisioningadapter/src/wpvccadaptergroupproxy.cpp
callcontinuity/vccclientprovisioningadapter/src/wpvccadaptermain.cpp
callcontinuity/vcchotrigger/EABI/vcchotriggerU.DEF
callcontinuity/vcchotrigger/bwins/vcchotriggeru.def
callcontinuity/vcchotrigger/group/bld.inf
callcontinuity/vcchotrigger/group/test_mover.make
callcontinuity/vcchotrigger/group/vcchotrigger.mmp
callcontinuity/vcchotrigger/inc/vcccchmonitor.h
callcontinuity/vcchotrigger/inc/vcccchobserver.h
callcontinuity/vcchotrigger/inc/vccgsmnotifications.h
callcontinuity/vcchotrigger/inc/vccgsmsignallevelhandler.h
callcontinuity/vcchotrigger/inc/vcchopolicy.h
callcontinuity/vcchotrigger/inc/vcchopolicyreader.h
callcontinuity/vcchotrigger/inc/vcchotrigger.h
callcontinuity/vcchotrigger/inc/vccsignallevelhandler.h
callcontinuity/vcchotrigger/inc/vccsignallevelobserver.h
callcontinuity/vcchotrigger/inc/vccsignallevelparams.h
callcontinuity/vcchotrigger/inc/vccwlansignallevelhandler.h
callcontinuity/vcchotrigger/src/rubydebug.cpp
callcontinuity/vcchotrigger/src/vcccchmonitor.cpp
callcontinuity/vcchotrigger/src/vccgsmnotifications.cpp
callcontinuity/vcchotrigger/src/vccgsmsignallevelhandler.cpp
callcontinuity/vcchotrigger/src/vcchopolicy.cpp
callcontinuity/vcchotrigger/src/vcchopolicyreader.cpp
callcontinuity/vcchotrigger/src/vcchotrigger.cpp
callcontinuity/vcchotrigger/src/vccsignallevelhandler.cpp
callcontinuity/vcchotrigger/src/vccwlansignallevelhandler.cpp
callcontinuity/vccpropertyhandler/bwins/vccuipropertyhandler.def
callcontinuity/vccpropertyhandler/eabi/vccuipropertyhandler.DEF
callcontinuity/vccpropertyhandler/group/bld.inf
callcontinuity/vccpropertyhandler/group/test_mover.make
callcontinuity/vccpropertyhandler/group/vccuipropertyhandler.mmp
callcontinuity/vccpropertyhandler/inc/vccuipropertyhandler.pan
callcontinuity/vccpropertyhandler/sis/vccpropertyhandler.pkg
callcontinuity/vccpropertyhandler/src/Rubydebug.cpp
callcontinuity/vccpropertyhandler/src/vccuipropertyhandlerdllmain.cpp
callcontinuity/vccpropertyhandler/src/vccuipsproperty.cpp
callcontinuity/vccpropertyhandler/src/vccuipspropertylistener.cpp
callcontinuity/vccutils/bwins/vccutilsu.def
callcontinuity/vccutils/eabi/vccutilsU.DEF
callcontinuity/vccutils/group/bld.inf
callcontinuity/vccutils/group/test_mover.make
callcontinuity/vccutils/group/vccutils.mmp
callcontinuity/vccutils/inc/vccmiscutils.h
callcontinuity/vccutils/inc/vccspsettings.h
callcontinuity/vccutils/inc/vccunittesting.h
callcontinuity/vccutils/src/rubydebug.cpp
callcontinuity/vccutils/src/vccmiscutils.cpp
callcontinuity/vccutils/src/vccspsettings.cpp
commsconfig/cscapplicationui/aif/csc_caption.rss
commsconfig/cscapplicationui/aif/cscaif.rss
commsconfig/cscapplicationui/bitmaps/qgn_prop_download_serv_voip.svg
commsconfig/cscapplicationui/bitmaps/qgn_prop_set_service.svg
commsconfig/cscapplicationui/bitmaps/qgn_prop_set_voip.svg
commsconfig/cscapplicationui/bitmaps/qgn_prop_set_voip_advanced.svg
commsconfig/cscapplicationui/bitmaps/qgn_prop_voip_new_service.svg
commsconfig/cscapplicationui/data/csc.rss
commsconfig/cscapplicationui/data/csc_reg.rss
commsconfig/cscapplicationui/group/Icons_dc.mk
commsconfig/cscapplicationui/group/bld.inf
commsconfig/cscapplicationui/group/cscappui.mmp
commsconfig/cscapplicationui/group/icons_aif_csc.mk
commsconfig/cscapplicationui/inc/csc.hrh
commsconfig/cscapplicationui/inc/cscapplication.h
commsconfig/cscapplicationui/inc/cscappui.h
commsconfig/cscapplicationui/inc/cscconstants.h
commsconfig/cscapplicationui/inc/cscdialog.h
commsconfig/cscapplicationui/inc/cscdocument.h
commsconfig/cscapplicationui/inc/csclogger.h
commsconfig/cscapplicationui/inc/cscnoteutilities.h
commsconfig/cscapplicationui/inc/cscservicecontainer.h
commsconfig/cscapplicationui/inc/cscserviceview.h
commsconfig/cscapplicationui/inc/mcscservicecontainerobserver.h
commsconfig/cscapplicationui/loc/csc.loc
commsconfig/cscapplicationui/src/cscapplication.cpp
commsconfig/cscapplicationui/src/cscappui.cpp
commsconfig/cscapplicationui/src/cscdialog.cpp
commsconfig/cscapplicationui/src/cscdocument.cpp
commsconfig/cscapplicationui/src/cscnoteutilities.cpp
commsconfig/cscapplicationui/src/cscservicecontainer.cpp
commsconfig/cscapplicationui/src/cscserviceview.cpp
commsconfig/cscengine/bwins/cscengineU.DEF
commsconfig/cscengine/data/cscengine.rss
commsconfig/cscengine/eabi/cscengineU.DEF
commsconfig/cscengine/group/bld.inf
commsconfig/cscengine/group/cscengine.mmp
commsconfig/cscengine/inc/cscengbrandinghandler.h
commsconfig/cscengine/inc/cscengcchhandler.h
commsconfig/cscengine/inc/cscengconnectionhandler.h
commsconfig/cscengine/inc/cscengdestinationshandler.h
commsconfig/cscengine/inc/cscengecommonitor.h
commsconfig/cscengine/inc/cscenglogger.h
commsconfig/cscengine/inc/cscengservicehandler.h
commsconfig/cscengine/inc/cscengservicepluginhandler.h
commsconfig/cscengine/inc/cscengsettingscleanupplugininterface.h
commsconfig/cscengine/inc/cscengsettingscleanupplugininterface.inl
commsconfig/cscengine/inc/cscengstartuphandler.h
commsconfig/cscengine/inc/cscengtimer.h
commsconfig/cscengine/inc/cscenguiextensionpluginhandler.h
commsconfig/cscengine/inc/mcscengcchobserver.h
commsconfig/cscengine/inc/mcscengconnectionobserver.h
commsconfig/cscengine/inc/mcscengecomobserver.h
commsconfig/cscengine/inc/mcscengprovisioningobserver.h
commsconfig/cscengine/inc/mcscengserviceobserver.h
commsconfig/cscengine/inc/mcscengtimerobserver.h
commsconfig/cscengine/inc/mcscenguiextensionobserver.h
commsconfig/cscengine/src/cscengbrandinghandler.cpp
commsconfig/cscengine/src/cscengcchhandler.cpp
commsconfig/cscengine/src/cscengconnectionhandler.cpp
commsconfig/cscengine/src/cscengdestinationshandler.cpp
commsconfig/cscengine/src/cscengecommonitor.cpp
commsconfig/cscengine/src/cscengservicehandler.cpp
commsconfig/cscengine/src/cscengservicepluginhandler.cpp
commsconfig/cscengine/src/cscengstartuphandler.cpp
commsconfig/cscengine/src/cscengtimer.cpp
commsconfig/cscengine/src/cscenguiextensionpluginhandler.cpp
commsconfig/cscgsplugin/data/2001E639.rss
commsconfig/cscgsplugin/data/cscgspluginrsc.rss
commsconfig/cscgsplugin/group/bld.inf
commsconfig/cscgsplugin/group/cscgsplugin.mmp
commsconfig/cscgsplugin/inc/cscgsplugin.h
commsconfig/cscgsplugin/src/cscgsplugin.cpp
commsconfig/cscgsplugin/src/cscgspluginimplementationtable.cpp
commsconfig/cscsettingsui/bwins/cscsettingsuiu.def
commsconfig/cscsettingsui/data/cscsettingsui.rss
commsconfig/cscsettingsui/eabi/cscsettingsuiu.def
commsconfig/cscsettingsui/group/bld.inf
commsconfig/cscsettingsui/group/cscsettingsui.mmp
commsconfig/cscsettingsui/inc/cscsettingsui.hrh
commsconfig/cscsettingsui/inc/cscsettingsuiconstants.h
commsconfig/cscsettingsui/inc/cscsettingsuidialog.h
commsconfig/cscsettingsui/inc/cscsettingsuiimpl.h
commsconfig/cscsettingsui/inc/cscsettingsuilogger.h
commsconfig/cscsettingsui/inc/cscsettingsuimaincontainer.h
commsconfig/cscsettingsui/inc/cscsettingsuimainview.h
commsconfig/cscsettingsui/inc/cscsettingsuimodel.h
commsconfig/cscsettingsui/inc/mcscsettingsuidialogobserver.h
commsconfig/cscsettingsui/inc/mcscsettingsuimodelobserver.h
commsconfig/cscsettingsui/loc/cscsettingsui.loc
commsconfig/cscsettingsui/src/cscsettingsui.cpp
commsconfig/cscsettingsui/src/cscsettingsuidialog.cpp
commsconfig/cscsettingsui/src/cscsettingsuiimpl.cpp
commsconfig/cscsettingsui/src/cscsettingsuimaincontainer.cpp
commsconfig/cscsettingsui/src/cscsettingsuimainview.cpp
commsconfig/cscsettingsui/src/cscsettingsuimodel.cpp
commsconfig/cscsipvoipcleanupplugin/data/2000B007.rss
commsconfig/cscsipvoipcleanupplugin/group/bld.inf
commsconfig/cscsipvoipcleanupplugin/group/cscsipvoipcleanupplugin.mmp
commsconfig/cscsipvoipcleanupplugin/inc/cscsvcplugin.h
commsconfig/cscsipvoipcleanupplugin/inc/cscsvcplugincenrephandler.h
commsconfig/cscsipvoipcleanupplugin/inc/cscsvcpluginhandler.h
commsconfig/cscsipvoipcleanupplugin/inc/cscsvcpluginlogger.h
commsconfig/cscsipvoipcleanupplugin/inc/cscsvcpluginrcsehandler.h
commsconfig/cscsipvoipcleanupplugin/inc/cscsvcpluginsiphandler.h
commsconfig/cscsipvoipcleanupplugin/inc/cscsvcpluginuids.hrh
commsconfig/cscsipvoipcleanupplugin/src/cscsvcplugin.cpp
commsconfig/cscsipvoipcleanupplugin/src/cscsvcplugincenrephandler.cpp
commsconfig/cscsipvoipcleanupplugin/src/cscsvcpluginhandler.cpp
commsconfig/cscsipvoipcleanupplugin/src/cscsvcpluginimplementationtable.cpp
commsconfig/cscsipvoipcleanupplugin/src/cscsvcpluginrcsehandler.cpp
commsconfig/cscsipvoipcleanupplugin/src/cscsvcpluginsiphandler.cpp
commsconfig/group/bld.inf
commsconfig/group/iconlist.txt
commsconfig/help/data/xhtml.zip
commsconfig/help/group/bld.inf
commsconfig/help/inc/voip.hlp.hrh
commsconfig/help/rom/cscapplicationuihelps_variant.iby
commsconfig/rom/csc.iby
commsconfig/rom/cscresources.iby
commsconfig/sis/commsconfig_stub.pkg
commsconfig/sis/commsconfig_stub.sis
commsconfig/sis/commsconfig_upgrade.pkg
convergedconnectionhandler/cchclient/bwins/cchclientU.DEF
convergedconnectionhandler/cchclient/eabi/cchclientU.DEF
convergedconnectionhandler/cchclient/group/bld.inf
convergedconnectionhandler/cchclient/group/cchclient.mmp
convergedconnectionhandler/cchclient/src/cchclient.cpp
convergedconnectionhandler/cchclient/src/cchserver.cpp
convergedconnectionhandler/cchclientapi/bwins/cchu.def
convergedconnectionhandler/cchclientapi/cchuinotif/bwins/cchuinotifu.def
convergedconnectionhandler/cchclientapi/cchuinotif/data/cchuinotif.rss
convergedconnectionhandler/cchclientapi/cchuinotif/eabi/cchuinotifu.def
convergedconnectionhandler/cchclientapi/cchuinotif/ecom/200195A6.rss
convergedconnectionhandler/cchclientapi/cchuinotif/ecom/cchuinotifwrapper.cpp
convergedconnectionhandler/cchclientapi/cchuinotif/ecom/cchuinotifwrapper.mmp
convergedconnectionhandler/cchclientapi/cchuinotif/group/bld.inf
convergedconnectionhandler/cchclientapi/cchuinotif/group/cchuinotif.mmp
convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuicallstatelistener.h
convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuicallstateobserver.h
convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuinotifconnectionhandler.h
convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuinotifier.h
convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuinotifierimpl.h
convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuipluginbrandinghandler.h
convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuipluginiconfileprovider.h
convergedconnectionhandler/cchclientapi/cchuinotif/loc/cchui.loc
convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuicallstatelistener.cpp
convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuiiconfileprovider.cpp
convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuinotifconnectionhandler.cpp
convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuinotifier.cpp
convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuinotifierimpl.cpp
convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuinotifiermain.cpp
convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuipluginbrandinghandler.cpp
convergedconnectionhandler/cchclientapi/eabi/cchu.def
convergedconnectionhandler/cchclientapi/group/bld.inf
convergedconnectionhandler/cchclientapi/group/cch.mmp
convergedconnectionhandler/cchclientapi/inc/cchclientobserver.h
convergedconnectionhandler/cchclientapi/inc/cchimpl.h
convergedconnectionhandler/cchclientapi/inc/cchserviceimpl.h
convergedconnectionhandler/cchclientapi/inc/cchserviceimplasynchroniser.h
convergedconnectionhandler/cchclientapi/inc/cchuiapiimpl.h
convergedconnectionhandler/cchclientapi/inc/cchuicchhandler.h
convergedconnectionhandler/cchclientapi/inc/cchuiclientobserver.h
convergedconnectionhandler/cchclientapi/inc/cchuicommon.hrh
convergedconnectionhandler/cchclientapi/inc/cchuiconnectionhandler.h
convergedconnectionhandler/cchclientapi/inc/cchuiglobalqueryhandler.h
convergedconnectionhandler/cchclientapi/inc/cchuilogger.h
convergedconnectionhandler/cchclientapi/inc/cchuinotehandler.h
convergedconnectionhandler/cchclientapi/inc/cchuiprivateapi.h
convergedconnectionhandler/cchclientapi/inc/cchuispshandler.h
convergedconnectionhandler/cchclientapi/inc/cchuitimer.h
convergedconnectionhandler/cchclientapi/inc/mcchuinoteresultobserver.h
convergedconnectionhandler/cchclientapi/inc/mcchuitimerobserver.h
convergedconnectionhandler/cchclientapi/src/cch.cpp
convergedconnectionhandler/cchclientapi/src/cchclientobserver.cpp
convergedconnectionhandler/cchclientapi/src/cchimpl.cpp
convergedconnectionhandler/cchclientapi/src/cchserviceimpl.cpp
convergedconnectionhandler/cchclientapi/src/cchserviceimplasynchroniser.cpp
convergedconnectionhandler/cchclientapi/src/cchtypes.cpp
convergedconnectionhandler/cchclientapi/src/cchuiapiimpl.cpp
convergedconnectionhandler/cchclientapi/src/cchuicchhandler.cpp
convergedconnectionhandler/cchclientapi/src/cchuiclientobserver.cpp
convergedconnectionhandler/cchclientapi/src/cchuiconnectionhandler.cpp
convergedconnectionhandler/cchclientapi/src/cchuiglobalqueryhandler.cpp
convergedconnectionhandler/cchclientapi/src/cchuinotehandler.cpp
convergedconnectionhandler/cchclientapi/src/cchuiprivateapi.cpp
convergedconnectionhandler/cchclientapi/src/cchuispshandler.cpp
convergedconnectionhandler/cchclientapi/src/cchuitimer.cpp
convergedconnectionhandler/cchserver/cenrep/10282CE5.txt
convergedconnectionhandler/cchserver/cenrep/cchprivatecrkeys.h
convergedconnectionhandler/cchserver/cenrep/keys_cch.xls
convergedconnectionhandler/cchserver/conf/cch.confml
convergedconnectionhandler/cchserver/conf/cch_10282CE5.crml
convergedconnectionhandler/cchserver/data/cch.rss
convergedconnectionhandler/cchserver/group/bld.inf
convergedconnectionhandler/cchserver/group/cchserver.mmp
convergedconnectionhandler/cchserver/inc/cchactivescheduler.h
convergedconnectionhandler/cchserver/inc/cchcommdbwatcher.h
convergedconnectionhandler/cchserver/inc/cchcommdbwatcherobserver.h
convergedconnectionhandler/cchserver/inc/cchconnmonhandler.h
convergedconnectionhandler/cchserver/inc/cchconnmonhandlernotifier.h
convergedconnectionhandler/cchserver/inc/cchetelnetworkstatusnotifier.h
convergedconnectionhandler/cchserver/inc/cchetelnetworkstatusobserver.h
convergedconnectionhandler/cchserver/inc/cchfeaturemanager.h
convergedconnectionhandler/cchserver/inc/cchnotehandler.h
convergedconnectionhandler/cchserver/inc/cchplugin.h
convergedconnectionhandler/cchserver/inc/cchpluginhandler.h
convergedconnectionhandler/cchserver/inc/cchrequeststorage.h
convergedconnectionhandler/cchserver/inc/cchsecondarydisplayapi.h
convergedconnectionhandler/cchserver/inc/cchserverbase.h
convergedconnectionhandler/cchserver/inc/cchservicehandler.h
convergedconnectionhandler/cchserver/inc/cchserviceinfo.h
convergedconnectionhandler/cchserver/inc/cchservicenotifier.h
convergedconnectionhandler/cchserver/inc/cchsession.h
convergedconnectionhandler/cchserver/inc/cchspshandler.h
convergedconnectionhandler/cchserver/inc/cchspsnotifier.h
convergedconnectionhandler/cchserver/inc/cchstartupcounter.h
convergedconnectionhandler/cchserver/inc/cchsubserviceinfo.h
convergedconnectionhandler/cchserver/inc/cchsubsession.h
convergedconnectionhandler/cchserver/inc/cchuihandler.h
convergedconnectionhandler/cchserver/inc/cchwakeupeventnotifier.h
convergedconnectionhandler/cchserver/inc/cchwakeupeventobserver.h
convergedconnectionhandler/cchserver/inc/cchwlanextension.h
convergedconnectionhandler/cchserver/inc/mcchnotehandler.h
convergedconnectionhandler/cchserver/loc/cch.loc
convergedconnectionhandler/cchserver/src/cchactivescheduler.cpp
convergedconnectionhandler/cchserver/src/cchcommdbwatcher.cpp
convergedconnectionhandler/cchserver/src/cchconnmonhandler.cpp
convergedconnectionhandler/cchserver/src/cchetelnetworkstatusnotifier.cpp
convergedconnectionhandler/cchserver/src/cchfeaturemanager.cpp
convergedconnectionhandler/cchserver/src/cchnotehandler.cpp
convergedconnectionhandler/cchserver/src/cchplugin.cpp
convergedconnectionhandler/cchserver/src/cchpluginhandler.cpp
convergedconnectionhandler/cchserver/src/cchrequeststorage.cpp
convergedconnectionhandler/cchserver/src/cchserverbase.cpp
convergedconnectionhandler/cchserver/src/cchservicehandler.cpp
convergedconnectionhandler/cchserver/src/cchserviceinfo.cpp
convergedconnectionhandler/cchserver/src/cchsession.cpp
convergedconnectionhandler/cchserver/src/cchspshandler.cpp
convergedconnectionhandler/cchserver/src/cchstartupcounter.cpp
convergedconnectionhandler/cchserver/src/cchsubserviceinfo.cpp
convergedconnectionhandler/cchserver/src/cchsubsession.cpp
convergedconnectionhandler/cchserver/src/cchuihandler.cpp
convergedconnectionhandler/cchserver/src/cchwakeupeventnotifier.cpp
convergedconnectionhandler/cchserver/src/cchwlanextension.cpp
convergedconnectionhandler/group/bld.inf
convergedconnectionhandler/inc/cchclientserverinternal.h
convergedconnectionhandler/inc/cchlogger.h
convergedconnectionhandler/rom/cch.iby
convergedconnectionhandler/rom/cchresources.iby
group/bld.inf
iptel_plat/cch_client_api/group/bld.inf
iptel_plat/cch_client_api/inc/cch.h
iptel_plat/cch_client_api/inc/cchclient.h
iptel_plat/cch_client_api/inc/cchclientserver.h
iptel_plat/cch_client_api/inc/cchclientserver.inl
iptel_plat/cch_client_api/inc/ccherror.h
iptel_plat/cch_client_api/inc/cchserver.h
iptel_plat/cch_client_api/inc/cchtypes.h
iptel_plat/cch_client_api/inc/cchui.h
iptel_plat/cch_client_api/inc/cchuiobserver.h
iptel_plat/cch_server_api/group/bld.inf
iptel_plat/cch_server_api/inc/cchservice.h
iptel_plat/cch_server_api/inc/cchservice.inl
iptel_plat/cch_server_api/inc/cchserviceobserver.h
iptel_plat/csc_settingsui_api/group/bld.inf
iptel_plat/csc_settingsui_api/inc/cscsettingsui.h
iptel_plat/group/bld.inf
iptel_plat/richcallsettingsengine_api/group/bld.inf
iptel_plat/richcallsettingsengine_api/inc/crcseprofileentry.h
iptel_plat/richcallsettingsengine_api/inc/crcseprofileregistry.h
iptel_plat/richcallsettingsengine_api/inc/crcsesccpentry.h
iptel_plat/richcallsettingsengine_api/inc/mrcsebackupobserver.h
iptel_plat/richcallsettingsengine_api/inc/rcsedefaultdbnames.h
iptel_plat/richcallsettingsengine_api/inc/rcseregistrybase.h
iptel_plat/vcc_api/group/bld.inf
iptel_plat/vcc_api/inc/cvccperformer.h
iptel_plat/vcc_api/inc/vccsubscribekeys.h
iptel_plat/vccpropertyhandler_api/group/bld.inf
iptel_plat/vccpropertyhandler_api/inc/mvccpspropertylistenerobserver.h
iptel_plat/vccpropertyhandler_api/inc/vccuipsproperty.h
iptel_plat/vccpropertyhandler_api/inc/vccuipspropertylistener.h
layers.sysdef.xml
richcallsettingsengine/group/bld.inf
richcallsettingsengine/rcse2/bwins/rcseu.def
richcallsettingsengine/rcse2/cenrep/200100FD.txt
richcallsettingsengine/rcse2/cenrep/2001B26B.txt
richcallsettingsengine/rcse2/cenrep/keys_rcse.xls
richcallsettingsengine/rcse2/conf/rcse.confml
richcallsettingsengine/rcse2/conf/rcse_200100fd.crml
richcallsettingsengine/rcse2/conf/rcse_2001b26b.crml
richcallsettingsengine/rcse2/data/10202869.SPD
richcallsettingsengine/rcse2/data/backup_registration.xml
richcallsettingsengine/rcse2/data/dbms_backup_registration.xml
richcallsettingsengine/rcse2/data/voip_profile_db_security_policy.txt
richcallsettingsengine/rcse2/eabi/rcseu.def
richcallsettingsengine/rcse2/group/bld.inf
richcallsettingsengine/rcse2/group/make_db_security_policy_file.bat
richcallsettingsengine/rcse2/group/rcse.mmp
richcallsettingsengine/rcse2/inc/crcseaudiocodecentry.h
richcallsettingsengine/rcse2/inc/crcseaudiocodecregistry.h
richcallsettingsengine/rcse2/inc/crcsechangenotifier.h
richcallsettingsengine/rcse2/inc/rcsebackupobserver.h
richcallsettingsengine/rcse2/inc/rcseconstants.h
richcallsettingsengine/rcse2/inc/rcsedbimporter.h
richcallsettingsengine/rcse2/inc/rcsedefaults.h
richcallsettingsengine/rcse2/inc/rcselogger.h
richcallsettingsengine/rcse2/inc/rcsepanic.h
richcallsettingsengine/rcse2/inc/rcseprivatecrkeys.h
richcallsettingsengine/rcse2/inc/stubs/crcsecreatetable.h
richcallsettingsengine/rcse2/inc/stubs/crcsesccpsettingregistry.h
richcallsettingsengine/rcse2/inc/stubs/crcsesipsettingentry.h
richcallsettingsengine/rcse2/inc/stubs/crcsesipsettingregistry.h
richcallsettingsengine/rcse2/rom/rcse2.iby
richcallsettingsengine/rcse2/src/crcseaudiocodecentry.cpp
richcallsettingsengine/rcse2/src/crcseaudiocodecregistry.cpp
richcallsettingsengine/rcse2/src/crcsechangenotifier.cpp
richcallsettingsengine/rcse2/src/crcseprofileentry.cpp
richcallsettingsengine/rcse2/src/crcseprofileregistry.cpp
richcallsettingsengine/rcse2/src/rcsebackupobserver.cpp
richcallsettingsengine/rcse2/src/rcsedbimporter.cpp
richcallsettingsengine/rcse2/src/rcsepanic.cpp
richcallsettingsengine/rcse2/src/rcseregistrybase.cpp
richcallsettingsengine/rcse2/src/stubs/s_crcsecreatetable.cpp
richcallsettingsengine/rcse2/src/stubs/s_crcsesccpentry.cpp
richcallsettingsengine/rcse2/src/stubs/s_crcsesccpsettingregistry.cpp
richcallsettingsengine/rcse2/src/stubs/s_crcsesipsettingentry.cpp
richcallsettingsengine/rcse2/src/stubs/s_crcsesipsettingregistry.cpp
sipvoipprovider/data/10282587.RSS
sipvoipprovider/group/bld.inf
sipvoipprovider/group/svpcontroller.mmp
sipvoipprovider/inc/svpaudioutility.h
sipvoipprovider/inc/svpcleanupresetanddestroy.h
sipvoipprovider/inc/svpconsts.h
sipvoipprovider/inc/svpcontroller.h
sipvoipprovider/inc/svpdtmfeventgenerator.h
sipvoipprovider/inc/svpdtmfeventobserver.h
sipvoipprovider/inc/svpemergencyconnection.h
sipvoipprovider/inc/svpemergencyconnectionobserver.h
sipvoipprovider/inc/svpemergencyiapprovider.h
sipvoipprovider/inc/svpemergencysession.h
sipvoipprovider/inc/svpforwardprovider.h
sipvoipprovider/inc/svplanguagetagconsts.h
sipvoipprovider/inc/svplogger.h
sipvoipprovider/inc/svpmosession.h
sipvoipprovider/inc/svpmtsession.h
sipvoipprovider/inc/svppositioningprovider.h
sipvoipprovider/inc/svppositioningproviderobserver.h
sipvoipprovider/inc/svppropertywatch.h
sipvoipprovider/inc/svppropertywatchobserver.h
sipvoipprovider/inc/svprtpobserver.h
sipvoipprovider/inc/svprtpobserverrequest.h
sipvoipprovider/inc/svpsessionbase.h
sipvoipprovider/inc/svpsessionobserver.h
sipvoipprovider/inc/svpsettings.h
sipvoipprovider/inc/svpsipconsts.h
sipvoipprovider/inc/svpsslogcall.h
sipvoipprovider/inc/svpsupplementaryservices.h
sipvoipprovider/inc/svptimer.h
sipvoipprovider/inc/svptimerobserver.h
sipvoipprovider/inc/svpuriparser.h
sipvoipprovider/inc/svputdefs.h
sipvoipprovider/inc/svputility.h
sipvoipprovider/inc/svpvolumeobserver.h
sipvoipprovider/inc/svpvolumeupdateobserver.h
sipvoipprovider/rom/svp.iby
sipvoipprovider/src/svpaudioutility.cpp
sipvoipprovider/src/svpcontroller.cpp
sipvoipprovider/src/svpdtmfeventgenerator.cpp
sipvoipprovider/src/svpemergencyconnection.cpp
sipvoipprovider/src/svpemergencyiapprovider.cpp
sipvoipprovider/src/svpemergencysession.cpp
sipvoipprovider/src/svpforwardprovider.cpp
sipvoipprovider/src/svpmosession.cpp
sipvoipprovider/src/svpmtsession.cpp
sipvoipprovider/src/svppositioningprovider.cpp
sipvoipprovider/src/svppropertywatch.cpp
sipvoipprovider/src/svpproxy.cpp
sipvoipprovider/src/svprtpobserver.cpp
sipvoipprovider/src/svprtpobserverrequest.cpp
sipvoipprovider/src/svpsessionbase.cpp
sipvoipprovider/src/svpsettings.cpp
sipvoipprovider/src/svpsslogcall.cpp
sipvoipprovider/src/svpsupplementaryservices.cpp
sipvoipprovider/src/svptimer.cpp
sipvoipprovider/src/svpuriparser.cpp
sipvoipprovider/src/svputility.cpp
sipvoipprovider/src/svpvolumeobserver.cpp
sipvoipprovider/svphold/inc/svpholdattributehandler.h
sipvoipprovider/svphold/inc/svpholdconnectedstate.h
sipvoipprovider/svphold/inc/svpholdcontext.h
sipvoipprovider/svphold/inc/svpholdcontroller.h
sipvoipprovider/svphold/inc/svpholddhstate.h
sipvoipprovider/svphold/inc/svpholdinestablishingstate.h
sipvoipprovider/svphold/inc/svpholdinstate.h
sipvoipprovider/svphold/inc/svpholdmediahandler.h
sipvoipprovider/svphold/inc/svpholdobserver.h
sipvoipprovider/svphold/inc/svpholdoutestablishingstate.h
sipvoipprovider/svphold/inc/svpholdoutstate.h
sipvoipprovider/svphold/inc/svpholdstatebase.h
sipvoipprovider/svphold/src/svpholdattributehandler.cpp
sipvoipprovider/svphold/src/svpholdconnectedstate.cpp
sipvoipprovider/svphold/src/svpholdcontext.cpp
sipvoipprovider/svphold/src/svpholdcontroller.cpp
sipvoipprovider/svphold/src/svpholddhstate.cpp
sipvoipprovider/svphold/src/svpholdinestablishingstate.cpp
sipvoipprovider/svphold/src/svpholdinstate.cpp
sipvoipprovider/svphold/src/svpholdmediahandler.cpp
sipvoipprovider/svphold/src/svpholdoutestablishingstate.cpp
sipvoipprovider/svphold/src/svpholdoutstate.cpp
sipvoipprovider/svphold/src/svpholdstatebase.cpp
sipvoipprovider/svptransfer/inc/svptransferacceptedstate.h
sipvoipprovider/svptransfer/inc/svptransfercontroller.h
sipvoipprovider/svptransfer/inc/svptransferidlestate.h
sipvoipprovider/svptransfer/inc/svptransferobserver.h
sipvoipprovider/svptransfer/inc/svptransferpendingstate.h
sipvoipprovider/svptransfer/inc/svptransferstatebase.h
sipvoipprovider/svptransfer/inc/svptransferstatecontext.h
sipvoipprovider/svptransfer/inc/svptransferterminatedstate.h
sipvoipprovider/svptransfer/inc/svptransferterminatingstate.h
sipvoipprovider/svptransfer/src/svptransferacceptedstate.cpp
sipvoipprovider/svptransfer/src/svptransfercontroller.cpp
sipvoipprovider/svptransfer/src/svptransferidlestate.cpp
sipvoipprovider/svptransfer/src/svptransferpendingstate.cpp
sipvoipprovider/svptransfer/src/svptransferstatebase.cpp
sipvoipprovider/svptransfer/src/svptransferstatecontext.cpp
sipvoipprovider/svptransfer/src/svptransferterminatedstate.cpp
sipvoipprovider/svptransfer/src/svptransferterminatingstate.cpp
sysdef_1_4_0.dtd
voipplugins/accountcreationplugin/BWINS/accountcreationpluginU.DEF
voipplugins/accountcreationplugin/EABI/accountcreationpluginU.DEF
voipplugins/accountcreationplugin/conf/accountcreationplugin.confml
voipplugins/accountcreationplugin/conf/accountcreationplugin_2001e321.crml
voipplugins/accountcreationplugin/data/2000bef1.rss
voipplugins/accountcreationplugin/data/accountcreationplugin.rss
voipplugins/accountcreationplugin/data/xmlfile.xml
voipplugins/accountcreationplugin/engine/BWINS/accountcreationengineu.def
voipplugins/accountcreationplugin/engine/EABI/accountcreationengineU.DEF
voipplugins/accountcreationplugin/engine/group/accountcreationengine.mmp
voipplugins/accountcreationplugin/engine/group/accountcreationengine.xml
voipplugins/accountcreationplugin/engine/inc/accountcreationengineconstants.h
voipplugins/accountcreationplugin/engine/inc/accountcreationplugin.hrh
voipplugins/accountcreationplugin/engine/inc/accountcreationpluginlogger.h
voipplugins/accountcreationplugin/engine/inc/accountcreationpluginuids.hrh
voipplugins/accountcreationplugin/engine/inc/acpbrowserparams.h
voipplugins/accountcreationplugin/engine/inc/acpcontroller.h
voipplugins/accountcreationplugin/engine/inc/acphttphandler.h
voipplugins/accountcreationplugin/engine/inc/acpimagehandler.h
voipplugins/accountcreationplugin/engine/inc/acpprivatecrkeys.h
voipplugins/accountcreationplugin/engine/inc/acpprovider.h
voipplugins/accountcreationplugin/engine/inc/acpproviderfield.h
voipplugins/accountcreationplugin/engine/inc/acpxmlhandler.h
voipplugins/accountcreationplugin/engine/inc/macpcontrollerobserver.h
voipplugins/accountcreationplugin/engine/inc/macphttphandlerobserver.h
voipplugins/accountcreationplugin/engine/inc/macpimagehandlerobserver.h
voipplugins/accountcreationplugin/engine/inc/macpxmlhandlerobserver.h
voipplugins/accountcreationplugin/engine/src/acpbrowserparams.cpp
voipplugins/accountcreationplugin/engine/src/acpcontroller.cpp
voipplugins/accountcreationplugin/engine/src/acphttphandler.cpp
voipplugins/accountcreationplugin/engine/src/acpimagehandler.cpp
voipplugins/accountcreationplugin/engine/src/acpprovider.cpp
voipplugins/accountcreationplugin/engine/src/acpproviderfield.cpp
voipplugins/accountcreationplugin/engine/src/acpxmlhandler.cpp
voipplugins/accountcreationplugin/group/accountcreationplugin.mmp
voipplugins/accountcreationplugin/group/accountcreationplugin.xml
voipplugins/accountcreationplugin/group/acpicons_dc.mk
voipplugins/accountcreationplugin/group/bld.inf
voipplugins/accountcreationplugin/inc/accountcreationplugin.h
voipplugins/accountcreationplugin/inc/accountcreationplugin.hrh
voipplugins/accountcreationplugin/inc/accountcreationpluginconstants.h
voipplugins/accountcreationplugin/inc/accountcreationpluginlogger.h
voipplugins/accountcreationplugin/inc/accountcreationpluginuids.hrh
voipplugins/accountcreationplugin/inc/acpdialog.h
voipplugins/accountcreationplugin/inc/acpproviderlistcontainer.h
voipplugins/accountcreationplugin/inc/acpproviderlistview.h
voipplugins/accountcreationplugin/inc/acpproviderspecificcontainer.h
voipplugins/accountcreationplugin/inc/acpproviderspecificview.h
voipplugins/accountcreationplugin/inc/acpquerycontainer.h
voipplugins/accountcreationplugin/inc/acpqueryview.h
voipplugins/accountcreationplugin/inc/acptimer.h
voipplugins/accountcreationplugin/inc/maccountcreationpluginobserver.h
voipplugins/accountcreationplugin/inc/macpdialogobserver.h
voipplugins/accountcreationplugin/inc/macptimerobserver.h
voipplugins/accountcreationplugin/loc/accountcreationplugin.loc
voipplugins/accountcreationplugin/rom/accountcreationplugin.iby
voipplugins/accountcreationplugin/rom/accountcreationpluginresources.iby
voipplugins/accountcreationplugin/sis/Accountcreationplugin.SIS
voipplugins/accountcreationplugin/sis/Accountcreationplugin.pkg
voipplugins/accountcreationplugin/src/accountcreationplugin.cpp
voipplugins/accountcreationplugin/src/accountcreationpluginGroupProxy.cpp
voipplugins/accountcreationplugin/src/acpdialog.cpp
voipplugins/accountcreationplugin/src/acpproviderlistcontainer.cpp
voipplugins/accountcreationplugin/src/acpproviderlistview.cpp
voipplugins/accountcreationplugin/src/acpproviderspecificcontainer.cpp
voipplugins/accountcreationplugin/src/acpproviderspecificview.cpp
voipplugins/accountcreationplugin/src/acpquerycontainer.cpp
voipplugins/accountcreationplugin/src/acpqueryview.cpp
voipplugins/accountcreationplugin/src/acptimer.cpp
voipplugins/dhcppositionprovider/cenrep/10283114.txt
voipplugins/dhcppositionprovider/cenrep/keys_dhcppsy.xls
voipplugins/dhcppositionprovider/conf/dhcppsy.confml
voipplugins/dhcppositionprovider/conf/dhcppsy_10283114.crml
voipplugins/dhcppositionprovider/data/dhcppositionprovider.rls
voipplugins/dhcppositionprovider/data/dhcppositionprovider.rss
voipplugins/dhcppositionprovider/group/bld.inf
voipplugins/dhcppositionprovider/group/blddhcppppsysignx.mk
voipplugins/dhcppositionprovider/group/dhcppositionprovider.mmp
voipplugins/dhcppositionprovider/inc/dhcpconnectionengine.h
voipplugins/dhcppositionprovider/inc/dhcpconnectionprogressnotifier.h
voipplugins/dhcppositionprovider/inc/dhcpconnectionstateobserver.h
voipplugins/dhcppositionprovider/inc/dhcpconstants.h
voipplugins/dhcppositionprovider/inc/dhcpdatalocationrequest.h
voipplugins/dhcppositionprovider/inc/dhcpdatapacket.h
voipplugins/dhcppositionprovider/inc/dhcpdataresponsepacket.h
voipplugins/dhcppositionprovider/inc/dhcpdatasender.h
voipplugins/dhcppositionprovider/inc/dhcplocationinformationparser.h
voipplugins/dhcppositionprovider/inc/dhcppsy.h
voipplugins/dhcppositionprovider/inc/dhcppsy.hrh
voipplugins/dhcppositionprovider/inc/dhcppsylogging.h
voipplugins/dhcppositionprovider/inc/dhcppsypanic.h
voipplugins/dhcppositionprovider/inc/dhcppsypositioner.h
voipplugins/dhcppositionprovider/inc/dhcppsyrequester.h
voipplugins/dhcppositionprovider/inc/dhcppsyrequesterprogressobserver.h
voipplugins/dhcppositionprovider/inc/dhcppsysingletonhandler.h
voipplugins/dhcppositionprovider/inc/dhcpserveripaddressresolver.h
voipplugins/dhcppositionprovider/inc/dhcpsocketlistener.h
voipplugins/dhcppositionprovider/inc/dhcpwlanqueryhandler.h
voipplugins/dhcppositionprovider/install/dhcppppsy.pkg
voipplugins/dhcppositionprovider/install/dhcppppsy_cenrep.pkg
voipplugins/dhcppositionprovider/install/dhcppppsy_udeb.pkg
voipplugins/dhcppositionprovider/rom/dhcppositionproviderpsy.iby
voipplugins/dhcppositionprovider/src/dhcpconnectionengine.cpp
voipplugins/dhcppositionprovider/src/dhcpconnectionprogressnotifier.cpp
voipplugins/dhcppositionprovider/src/dhcpdatalocationrequest.cpp
voipplugins/dhcppositionprovider/src/dhcpdatapacket.cpp
voipplugins/dhcppositionprovider/src/dhcpdataresponsepacket.cpp
voipplugins/dhcppositionprovider/src/dhcpdatasender.cpp
voipplugins/dhcppositionprovider/src/dhcpocationinformationparser.cpp
voipplugins/dhcppositionprovider/src/dhcppsypositioner.cpp
voipplugins/dhcppositionprovider/src/dhcppsyrequester.cpp
voipplugins/dhcppositionprovider/src/dhcppsysingletonhandler.cpp
voipplugins/dhcppositionprovider/src/dhcpserveripaddressresolver.cpp
voipplugins/dhcppositionprovider/src/dhcpsocketlistener.cpp
voipplugins/dhcppositionprovider/src/dhcpwlanqueryhandler.cpp
voipplugins/dhcppositionprovider/src/proxy.cpp
voipplugins/group/bld.inf
voipplugins/ipapputils/EABI/ipapputilsU.DEF
voipplugins/ipapputils/bwins/ipapputilsu.def
voipplugins/ipapputils/group/bld.inf
voipplugins/ipapputils/group/ipapputils.mmp
voipplugins/ipapputils/inc/cipappphoneutils.h
voipplugins/ipapputils/inc/cipapputilsaddressresolver.h
voipplugins/ipapputils/inc/csipclientresolverutils.h
voipplugins/ipapputils/rom/ipapputils.iby
voipplugins/ipapputils/src/cipappphoneutils.cpp
voipplugins/ipapputils/src/cipapputilsaddressresolver.cpp
voipplugins/ipapputils/src/csipclientresolverutils.cpp
voipplugins/ipapputils/voipeventlog/bwins/voipeventlogu.def
voipplugins/ipapputils/voipeventlog/cenrep/keys_voipeventlog.xls
voipplugins/ipapputils/voipeventlog/conf/voipeventlog.confml
voipplugins/ipapputils/voipeventlog/conf/voipeventlog_2000b608.crml
voipplugins/ipapputils/voipeventlog/eabi/voipeventlogU.DEF
voipplugins/ipapputils/voipeventlog/group/bld.inf
voipplugins/ipapputils/voipeventlog/group/voipeventlog.mmp
voipplugins/ipapputils/voipeventlog/inc/voiperrorentry.h
voipplugins/ipapputils/voipeventlog/inc/voipeventlog.h
voipplugins/ipapputils/voipeventlog/inc/voipeventlogconstants.h
voipplugins/ipapputils/voipeventlog/inc/voipeventlogengine.h
voipplugins/ipapputils/voipeventlog/inc/voipeventloglogger.h
voipplugins/ipapputils/voipeventlog/rom/voipeventlog.iby
voipplugins/ipapputils/voipeventlog/src/voiperrorentry.cpp
voipplugins/ipapputils/voipeventlog/src/voipeventlog.cpp
voipplugins/ipapputils/voipeventlog/src/voipeventlogengine.cpp
voipplugins/sipconnectionprovider/data/1027545B.rss
voipplugins/sipconnectionprovider/group/bld.inf
voipplugins/sipconnectionprovider/group/sipconnectionprovider.mmp
voipplugins/sipconnectionprovider/inc/scpalrobserver.h
voipplugins/sipconnectionprovider/inc/scpconnectingservice.h
voipplugins/sipconnectionprovider/inc/scpdefs.h
voipplugins/sipconnectionprovider/inc/scpdisabled.h
voipplugins/sipconnectionprovider/inc/scpdisconnecting.h
voipplugins/sipconnectionprovider/inc/scpenabled.h
voipplugins/sipconnectionprovider/inc/scpimhandler.h
voipplugins/sipconnectionprovider/inc/scplogger.h
voipplugins/sipconnectionprovider/inc/scpplugin.h
voipplugins/sipconnectionprovider/inc/scppresencehandler.h
voipplugins/sipconnectionprovider/inc/scppresencehandlerrequest.h
voipplugins/sipconnectionprovider/inc/scppresencehandlerrequest.inl
voipplugins/sipconnectionprovider/inc/scpprofilehandler.h
voipplugins/sipconnectionprovider/inc/scppropertynotifier.h
voipplugins/sipconnectionprovider/inc/scppropertyobserver.h
voipplugins/sipconnectionprovider/inc/scpservice.h
voipplugins/sipconnectionprovider/inc/scpservicehandlerbase.h
voipplugins/sipconnectionprovider/inc/scpservicemanager.h
voipplugins/sipconnectionprovider/inc/scpservicestorage.h
voipplugins/sipconnectionprovider/inc/scpsettinghandler.h
voipplugins/sipconnectionprovider/inc/scpsipconnection.h
voipplugins/sipconnectionprovider/inc/scpsipconnectionobserver.h
voipplugins/sipconnectionprovider/inc/scpstatecontainer.h
voipplugins/sipconnectionprovider/inc/scpsubservice.h
voipplugins/sipconnectionprovider/inc/scpsubserviceobserver.h
voipplugins/sipconnectionprovider/inc/scpsubservicestate.h
voipplugins/sipconnectionprovider/inc/scputility.h
voipplugins/sipconnectionprovider/inc/scpvmbxhandler.h
voipplugins/sipconnectionprovider/inc/scpvoiphandler.h
voipplugins/sipconnectionprovider/inc/sipconnectionprovideruids.hrh
voipplugins/sipconnectionprovider/ipvoicemailengine/bwins/ipvoicemailengineu.def
voipplugins/sipconnectionprovider/ipvoicemailengine/eabi/ipvoicemailengineu.def
voipplugins/sipconnectionprovider/ipvoicemailengine/group/bld.inf
voipplugins/sipconnectionprovider/ipvoicemailengine/group/ipvoicemailengine.mmp
voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxbase.h
voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxconstants.h
voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxengine.h
voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxeventmonitor.h
voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxinterface.h
voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxlogger.h
voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxobserver.h
voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxpanic.h
voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxparsetype.h
voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxparsetype.inl
voipplugins/sipconnectionprovider/ipvoicemailengine/loc/ipvoicemailengine.loc
voipplugins/sipconnectionprovider/ipvoicemailengine/rom/ipvoicemailengine.iby
voipplugins/sipconnectionprovider/ipvoicemailengine/rom/ipvoicemailengine_resources.iby
voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvmbxbase.cpp
voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvmbxengine.cpp
voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvmbxeventmonitor.cpp
voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvmbxinterface.cpp
voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvmbxparsetype.cpp
voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvoicemailengine.rss
voipplugins/sipconnectionprovider/rom/sipconnectionprovider.iby
voipplugins/sipconnectionprovider/src/scpconnectingservice.cpp
voipplugins/sipconnectionprovider/src/scpdisabled.cpp
voipplugins/sipconnectionprovider/src/scpdisconnecting.cpp
voipplugins/sipconnectionprovider/src/scpenabled.cpp
voipplugins/sipconnectionprovider/src/scpimhandler.cpp
voipplugins/sipconnectionprovider/src/scpplugin.cpp
voipplugins/sipconnectionprovider/src/scppresencehandler.cpp
voipplugins/sipconnectionprovider/src/scpprofilehandler.cpp
voipplugins/sipconnectionprovider/src/scppropertynotifier.cpp
voipplugins/sipconnectionprovider/src/scpservice.cpp
voipplugins/sipconnectionprovider/src/scpservicehandlerbase.cpp
voipplugins/sipconnectionprovider/src/scpservicemanager.cpp
voipplugins/sipconnectionprovider/src/scpservicestorage.cpp
voipplugins/sipconnectionprovider/src/scpsettinghandler.cpp
voipplugins/sipconnectionprovider/src/scpsipconnection.cpp
voipplugins/sipconnectionprovider/src/scpstatecontainer.cpp
voipplugins/sipconnectionprovider/src/scpsubservice.cpp
voipplugins/sipconnectionprovider/src/scpsubservicestate.cpp
voipplugins/sipconnectionprovider/src/scputility.cpp
voipplugins/sipconnectionprovider/src/scpvmbxhandler.cpp
voipplugins/sipconnectionprovider/src/scpvoiphandler.cpp
voipplugins/sipimresolver/data/2002133c.rss
voipplugins/sipimresolver/group/bld.inf
voipplugins/sipimresolver/group/sipimresolver.mmp
voipplugins/sipimresolver/inc/sipimresolver.h
voipplugins/sipimresolver/inc/sipimresolverdebug.h
voipplugins/sipimresolver/inc/sipimresolveruids.hrh
voipplugins/sipimresolver/rom/sipimresolver.iby
voipplugins/sipimresolver/src/sipimresolver.cpp
voipplugins/sipimresolver/src/sipimresolverimplementationproxy.cpp
voipplugins/sipmxresolver/data/10283140.rss
voipplugins/sipmxresolver/group/bld.inf
voipplugins/sipmxresolver/group/sipmxresolver.mmp
voipplugins/sipmxresolver/group/sipmxresolveruids.h
voipplugins/sipmxresolver/inc/sipmxresolver.h
voipplugins/sipmxresolver/inc/sipmxresolverdebug.h
voipplugins/sipmxresolver/rom/sipmxresolver.iby
voipplugins/sipmxresolver/src/sipmxresolver.cpp
voipplugins/sipmxresolver/src/sipmxresolverimplementationproxy.cpp
voipplugins/svtcallmenu/data/2001E2C7.rss
voipplugins/svtcallmenu/group/bld.inf
voipplugins/svtcallmenu/group/svtcallmenu.mmp
voipplugins/svtcallmenu/inc/svtcallmenu.h
voipplugins/svtcallmenu/inc/svtcallstatehandler.h
voipplugins/svtcallmenu/rom/svtcallmenu.iby
voipplugins/svtcallmenu/src/csvtcallmenuimplementationproxy.cpp
voipplugins/svtcallmenu/src/svtcallmenu.cpp
voipplugins/svtcallmenu/src/svtcallstatehandler.cpp
voipplugins/svtlogging/data/2001E2C8.rss
voipplugins/svtlogging/group/bld.inf
voipplugins/svtlogging/group/svtlogging.mmp
voipplugins/svtlogging/inc/csvtlogging.h
voipplugins/svtlogging/inc/csvtsettingshandler.h
voipplugins/svtlogging/inc/csvtsipuriparser.h
voipplugins/svtlogging/inc/svtphonenumbervalidator.h
voipplugins/svtlogging/rom/svtlogging.iby
voipplugins/svtlogging/src/csvtlogging.cpp
voipplugins/svtlogging/src/csvtloggingimplementationproxy.cpp
voipplugins/svtlogging/src/csvtsettingshandler.cpp
voipplugins/svtlogging/src/csvtsipuriparser.cpp
voipplugins/svtlogging/src/svtphonenumbervalidator.cpp
voipplugins/svtmatching/data/2001E2C9.rss
voipplugins/svtmatching/group/bld.inf
voipplugins/svtmatching/group/svtmatching.mmp
voipplugins/svtmatching/inc/svtcleanup.h
voipplugins/svtmatching/inc/svtmatching.h
voipplugins/svtmatching/inc/svtsettingshandler.h
voipplugins/svtmatching/inc/svturiparser.h
voipplugins/svtmatching/rom/svtmatching.iby
voipplugins/svtmatching/src/svtmatching.cpp
voipplugins/svtmatching/src/svtsettingshandler.cpp
voipplugins/svtmatching/src/svturiparser.cpp
voipplugins/voipadapters/cpgenvoipsettings/data/10275411.rss
voipplugins/voipadapters/cpgenvoipsettings/data/WPGeneralVoIPSettingsAdapter.rss
voipplugins/voipadapters/cpgenvoipsettings/group/bld.inf
voipplugins/voipadapters/cpgenvoipsettings/group/wpgeneralvoipsettingsadapter.mmp
voipplugins/voipadapters/cpgenvoipsettings/inc/cwpgeneralvoipsettingsadapter.h
voipplugins/voipadapters/cpgenvoipsettings/inc/wpgeneralvoipsettingsadapteruids.h
voipplugins/voipadapters/cpgenvoipsettings/loc/wpgeneralvoipsettingsadapter.loc
voipplugins/voipadapters/cpgenvoipsettings/rom/wpgeneralvoipsettingsadapter.iby
voipplugins/voipadapters/cpgenvoipsettings/rom/wpgeneralvoipsettingsadapterresources.iby
voipplugins/voipadapters/cpgenvoipsettings/src/cwpgeneralvoipsettingsadapter.cpp
voipplugins/voipadapters/cpgenvoipsettings/src/wpgeneralvoipsettingsadaptergroupproxy.cpp
voipplugins/voipadapters/cpgenvoipsettings/src/wpgeneralvoipsettingsadaptermain.cpp
voipplugins/voipadapters/cpvoipadapter/data/10201F9A.rss
voipplugins/voipadapters/cpvoipadapter/data/WPVoIPAdapter.rss
voipplugins/voipadapters/cpvoipadapter/group/bld.inf
voipplugins/voipadapters/cpvoipadapter/group/wpvoipadapter.mmp
voipplugins/voipadapters/cpvoipadapter/inc/CSIPProfileRegistryObserver.h
voipplugins/voipadapters/cpvoipadapter/inc/CWPSIPSpecificSettingsItem.h
voipplugins/voipadapters/cpvoipadapter/inc/CWPVoIPAdapter.h
voipplugins/voipadapters/cpvoipadapter/inc/CWPVoIPCodec.h
voipplugins/voipadapters/cpvoipadapter/inc/CWPVoIPItem.h
voipplugins/voipadapters/cpvoipadapter/inc/WPVoIPAdapterUIDs.h
voipplugins/voipadapters/cpvoipadapter/inc/cpvoipadapter.rls
voipplugins/voipadapters/cpvoipadapter/loc/wpvoipadapter.loc
voipplugins/voipadapters/cpvoipadapter/rom/wpvoipadapter.iby
voipplugins/voipadapters/cpvoipadapter/rom/wpvoipadapterresources.iby
voipplugins/voipadapters/cpvoipadapter/src/CSIPProfileRegistryObserver.cpp
voipplugins/voipadapters/cpvoipadapter/src/CWPSIPSpecificSettingsItem.cpp
voipplugins/voipadapters/cpvoipadapter/src/CWPVoIPAdapter.cpp
voipplugins/voipadapters/cpvoipadapter/src/CWPVoIPCodec.cpp
voipplugins/voipadapters/cpvoipadapter/src/CWPVoIPItem.cpp
voipplugins/voipadapters/cpvoipadapter/src/WPVoIPAdapterGroupProxy.cpp
voipplugins/voipadapters/cpvoipadapter/src/WPVoIPAdapterMain.cpp
voipplugins/voipadapters/dmgenvoipsettings/group/NSmlDmGeneralVoIPSettingsAdapter.mmp
voipplugins/voipadapters/dmgenvoipsettings/group/bld.inf
voipplugins/voipadapters/dmgenvoipsettings/inc/NSmlDmGeneralVoIPSettingsAdapter.h
voipplugins/voipadapters/dmgenvoipsettings/rom/dmgeneralvoipsettingsadapter.iby
voipplugins/voipadapters/dmgenvoipsettings/src/NSmlDmGeneralVoIPSettingsAdapter.cpp
voipplugins/voipadapters/dmgenvoipsettings/src/NSmlDmGeneralVoIPSettingsAdapter.rss
voipplugins/voipadapters/dmvoipadapter/group/bld.inf
voipplugins/voipadapters/dmvoipadapter/group/nsmldmvoipadapter.mmp
voipplugins/voipadapters/dmvoipadapter/inc/CSIPProfileRegistryObserver.h
voipplugins/voipadapters/dmvoipadapter/inc/cdmvoipspsettings.h
voipplugins/voipadapters/dmvoipadapter/inc/nsmldmvoipadapter.h
voipplugins/voipadapters/dmvoipadapter/inc/smldmvoipdebug.h
voipplugins/voipadapters/dmvoipadapter/rom/dmvoipadapter.iby
voipplugins/voipadapters/dmvoipadapter/src/CSIPProfileRegistryObserver.cpp
voipplugins/voipadapters/dmvoipadapter/src/cdmvoipspsettings.cpp
voipplugins/voipadapters/dmvoipadapter/src/nsmldmvoipadapter.cpp
voipplugins/voipadapters/dmvoipadapter/src/nsmldmvoipadapter.rss
voipplugins/voipadapters/dmvoipadapter/src/nsmldmvoipadaptergroupproxy.cpp
voipplugins/voipadapters/group/bld.inf
voipplugins/voipadapters/provisioningfile/BWINS/ProvisioningFileU.DEF
voipplugins/voipadapters/provisioningfile/EABI/ProvisioningFileU.DEF
voipplugins/voipadapters/provisioningfile/group/ProvisioningFile.mmp
voipplugins/voipadapters/provisioningfile/group/bld.inf
voipplugins/voipadapters/provisioningfile/inc/WPOMAMsgHandler.h
voipplugins/voipadapters/provisioningfile/inc/WPProtocolProfileHandlerSIP.h
voipplugins/voipadapters/provisioningfile/inc/WPProvisioningFile.h
voipplugins/voipadapters/provisioningfile/inc/wpprovisioningfileconst.h
voipplugins/voipadapters/provisioningfile/inc/wpprovisioningfiledebug.h
voipplugins/voipadapters/provisioningfile/rom/provisioningfile.iby
voipplugins/voipadapters/provisioningfile/src/WPOMAMsgHandler.cpp
voipplugins/voipadapters/provisioningfile/src/WPProtocolProfileHandlerSIP.cpp
voipplugins/voipadapters/provisioningfile/src/WPProvisioningFile.cpp
voipplugins/voipadapters/voipxmlprovisioning/group/bld.inf
voipplugins/voipadapters/voipxmlprovisioning/install/RD_RootCA/rd-key.pem
voipplugins/voipadapters/voipxmlprovisioning/install/RD_RootCA/rd.cer
voipplugins/voipadapters/voipxmlprovisioning/install/create_sis_udeb.bat
voipplugins/voipadapters/voipxmlprovisioning/install/settings.pkg
voipplugins/voipadapters/voipxmlprovisioning/install/settings_for_MCL.SIS
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Aif/VoIPProvisioningAppAif.rss
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Aif/VoIPProvisioningApp_caption.rss
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/VoIPProvisioningApp.rss
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/VoIPProvisioningApp_reg.rss
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/tempbranddatapackage.zip
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningApp.h
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningAppUi.h
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningDocument.h
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/voipprovisioningapp.loc
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningApp.cpp
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningAppUi.cpp
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningDocument.cpp
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/group/VoIPProvisioningApp.mmp
voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/group/bld.inf
voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/data/20026FE1.rss
voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/group/VoIPProvisioningRecognizer.mmp
voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/group/bld.inf
voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/inc/VoIPProvisioningRecognizer.h
voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/src/VoIPProvisioningRecognizer.cpp
voipplugins/voipadapters/voipxmlprovisioning/rom/voipxmlprovisioning.iby
voipplugins/voipadapters/voipxmlprovisioning/rom/voipxmlprovisioningresources.iby
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/EABI/voipxmlprocessoru.def
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/bwins/voipxmlprocessoru.def
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/group/bld.inf
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/group/voipxmlprocessor.mmp
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmliaphandler.h
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlnatfwhandler.h
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlparamhandler.h
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlparser.h
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlpresencehandler.h
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlprocessordefaults.h
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlprocessorlogger.h
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlsiphandler.h
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlutils.h
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlutils.inl
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlvoiphandler.h
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlxdmhandler.h
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/rom/provisioningapi.iby
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmliaphandler.cpp
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlnatfwhandler.cpp
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlparamhandler.cpp
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlparser.cpp
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlpresencehandler.cpp
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlsiphandler.cpp
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlutils.cpp
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlvoiphandler.cpp
voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlxdmhandler.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,38 @@
+/*
+* 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:   callcontinuity build definition file
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// iby file
+../rom/vcc.iby            CORE_APP_LAYER_IBY_EXPORT_PATH( vcc.iby )
+../rom/vccresources.iby   LANGUAGE_APP_LAYER_IBY_EXPORT_PATH( vccresources.iby )
+
+PRJ_MMPFILES
+#include "../vccutils/group/bld.inf"
+#include "../nsmldmvccadapter/group/bld.inf"
+#include "../vccclientprovisioningadapter/group/bld.inf"
+#include "../vccpropertyhandler/group/bld.inf"
+#include "../vcchotrigger/group/bld.inf"
+#include "../vcc/group/bld.inf"
+
+PRJ_TESTMMPFILES
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/nsmldmvccadapter/data/2000E5BD.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   Resource definitions for project ?myapp
+*
+*/
+
+
+
+
+//NAME DMAI
+
+#include <ecom/registryinfov2.rh>
+
+//RESOURCE RSS_SIGNATURE { }
+//RESOURCE TBUF { buf=""; }
+
+//#define ?constant ?value
+
+// ---------------------------------------------------------------------------
+// ?resource_name
+// ?description
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theRegistryInfo
+  {
+  // use resource format version 2 to enable ROM only plugins
+  resource_format_version = RESOURCE_FORMAT_VERSION_2;
+
+  dll_uid = 0x2000E5BD; //The DLL's 3rd UID.
+  interfaces =
+      {
+      INTERFACE_INFO
+          {
+          interface_uid = 0x102018B4; // DM interface UID
+          implementations =
+            {
+            IMPLEMENTATION_INFO
+                {
+                implementation_uid = 0x2000E5BE; // DM VCC implementation UID
+                version_no = 1;
+                display_name = "DM VCC Adapter";
+                default_data = "";
+                opaque_data = "";
+                rom_only = 0; // This is not a ROM only plugin
+                }
+            };
+          }
+      };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/nsmldmvccadapter/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* 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 info file for VCC device management adapter
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+nsmldmvccadapter.mmp
+
+PRJ_TESTMMPFILES
+//../internal/tsrc/group/t_nsmldmvccadapter.mmp
+
+//GNUMAKEFILE ../internal/tsrc/group/test_mover.make
+
+PRJ_TESTEXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/nsmldmvccadapter/group/nsmldmvccadapter.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* 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 nsmldmvccadapter
+*
+*/
+
+#include <platform_paths.hrh>
+#include <defaultcaps.hrh>
+
+TARGET                  nsmldmvccadapter.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009d8d 0x2000e5bd
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  proxy.cpp
+SOURCE                  nsmldmvccadapter.cpp
+SOURCE                  rubydebug.cpp
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../vcc/inc
+USERINCLUDE             ../../vccutils/inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+
+SOURCEPATH              ../data
+START RESOURCE          2000E5BD.rss
+TARGET                  nsmldmvccadapter.rsc
+END
+
+LIBRARY                 euser.lib 
+LIBRARY                 charconv.lib 
+LIBRARY                 ecom.lib
+LIBRARY                 bafl.lib
+LIBRARY                 inetprotutil.lib 
+LIBRARY                 serviceprovidersettings.lib
+LIBRARY                 vccutils.lib
+LIBRARY                 efsrv.lib //rubydebug
+LIBRARY                 nsmldmclientserverutils.lib
+LIBRARY                 rcse.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/nsmldmvccadapter/inc/nsmldmvccadapter.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,530 @@
+/*
+* 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:   DM Adapter class definition
+*
+*/
+
+
+
+#ifndef C_NSMLDMVCCADAPTER_H
+#define C_NSMLDMVCCADAPTER_H
+
+
+#include <smldmadapter.h>
+#include <msvapi.h>
+
+#include "vccunittesting.h"
+
+class CVccSPSettings;
+
+/**
+ *  The main class of the OMA PoC DM adapter. 
+ *  Handles requests of fetching and updating settings sets and settings items.
+ * 
+ *  @lib nsmldmvccadapter.dll
+ *  @since S60 ?S60_version
+ */
+class CNSmlDmVCCAdapter : public CSmlDmAdapter
+    {
+public:
+
+  /**
+   * Two-phased constructor.
+   *
+   * @since S60 3.2
+   * @param aDmCallback The pointer to callback to return results and 
+   *                    status to codes for completed commands to the 
+   *                    DM framework. The interface also has 
+   *                    functionality for mapping LUIDs and fetching 
+   *                    from other parts of the DM Tree.
+   * @return A pointer to the newly created object.
+   */
+    static CNSmlDmVCCAdapter* NewL( MSmlDmCallback* aDmCallback );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 3.2
+     * @param aDmCallback The pointer to callback to return results and 
+     *                    status to codes for completed commands to the 
+     *                    DM framework. The interface also has 
+     *                    functionality for mapping LUIDs and fetching 
+     *                    from other parts of the DM Tree.
+     * @return A pointer to the newly created object.
+     */
+    static CNSmlDmVCCAdapter* NewLC( MSmlDmCallback* aDmCallback );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CNSmlDmVCCAdapter();
+  
+//from base class MSmlDmAdapter
+
+    /**
+    * From MSmlDmAdapter.
+    * Returns current version of the DDF.
+    * This function is always called after DDFStructureL.
+    *
+    * @since S60 3.2
+    * @param aVersion DDF version of the adapter. 
+    */
+    void DDFVersionL( CBufBase& aVersion );
+
+    /**
+    * From MSmlDmAdapter.
+    * Fills the DDF structure of the adapter. The  adapter starts to 
+    * fill the data structure by calling AddChildObjectL to the root
+    * object and so describes the DDF of the adapter. 
+    *
+    * @since S60 3.2
+    * @param aDDFObject Reference to the root object. 
+    */
+    void DDFStructureL( MSmlDmDDFObject& aDDF );
+
+    /**
+    * From MSmlDmAdapter.
+    * Creates new leaf objects, or replaces data in existing
+    * leaf objects. The information about the success of the command 
+    * should be returned by calling SetStatusL function of MSmlDmCallback 
+    * callback interface. This makes it possible to buffer the commands. 
+    * However, all the status codes for buffered commands must be returned
+    * at the latest when the adapter's CompleteOutstandingCmdsL() is 
+    * called.
+    *
+    * @since S60 3.2
+    * @param aURI   URI of the object
+    * @param aLUID    LUID of the object (if the adapter has earlier 
+    *                   returned a LUID to the DM Module). For new 
+    *                   objects, this is the LUID inherited through the
+    *                   parent node.
+    * @param aObject  Data of the object.
+    * @param aType    MIME type of the object
+    * @param aStatusRef Reference to correct command, i.e. this reference
+    *           must be used when calling the SetStatusL of this 
+    *                   command
+    */
+    void UpdateLeafObjectL( const TDesC8& aURI,
+                            const TDesC8& aLUID,
+                      const TDesC8& aObject,
+                      const TDesC8& aType,
+                      TInt aStatusRef );
+  
+    /**
+    * From MSmlDmAdapter.
+    * The function creates new leaf objects, or replaces data in existing 
+    * leaf objects, in the case where data is large enough to be streamed.
+    * SetStatusL function of MSmlDmCallback callback interface should be 
+    * called to inform about the success of the command. This makes it 
+    * possible to buffer the commands.  All the  status codes for buffered
+    * commands must be returned at the latest 
+    * when the CompleteOutstandingCmdsL() of adapter is called.
+    *
+    * @since S60 3.2
+    * @param aURI   URI of the object
+    * @param aLUID    LUID of the object (if the adapter has earlier 
+    *                   returned a LUID to the DM Module). 
+    *                   For new objects, this is the LUID inherited 
+    *                   through the parent node.
+    * @param aStream  Data of the object. Adapter should create write 
+    *                   stream and return, when data is written to stream
+    *                   by DM agent, StreamCommittedL() is called by DM 
+    *                   engine
+    * @param aType    MIME type of the object
+    * @param aStatusRef Reference to correct command, i.e. this reference
+    *           must be used when calling the SetStatusL of this
+    *           command.
+    */
+    void UpdateLeafObjectL( const TDesC8& aURI,
+                            const TDesC8& aLUID,
+                            RWriteStream*& aStream,
+                            const TDesC8& aType,
+                            TInt aStatusRef );
+
+    /**
+    * From MSmlDmAdapter.
+    * Deletes an object and its child objects. The information about the 
+    * success of the command should be returned by calling SetStatusL 
+    * function of MSmlDmCallback callback interface.
+    * This makes it possible to buffer the commands.  All the 
+    * status codes for buffered commands must be returned at the latest 
+    * when the CompleteOutstandingCmdsL() of adapter is called.
+    *
+    * @since S60 3.2
+    * @param aURI   URI of the object
+    * @param aLUID    LUID of the object (if the adapter have earlier 
+    *                   returned LUID to the DM Module).
+    * @param aStatusRef Reference to correct command, i.e. this reference 
+    *                   must be used when calling the SetStatusL of this 
+    *                   command.
+    */
+    void DeleteObjectL( const TDesC8& aURI,
+                        const TDesC8& aLUID,
+                        TInt aStatusRef );
+
+    /**
+    * From MSmlDmAdapter.
+    * Fetches the data of a leaf object. The SetStatusL should be used as
+    * described in UpdateLeafObjectL(). The data is returned by using the
+    * SetResultsL function of MSmlCallback callback interface, and may be
+    * streamed.
+    *
+    * @since S60 3.2
+    * @param aURI     URI of the object
+    * @param aLUID      LUID of the object (if the adapter have 
+    *                       earlier returned LUID to the DM Module).   
+    * @param aType      MIME type of the object
+    * @param aResultsRef  Reference to correct results, i.e. this 
+    *                       reference must be used when returning the 
+    *                       result by calling the SetResultsL.
+    * @param aStatusRef   Reference to correct command, i.e. this 
+    *                       reference must be used when calling the 
+    *                       SetStatusL of this command.
+    */
+    void FetchLeafObjectL( const TDesC8& aURI,
+                           const TDesC8& aLUID,
+                           const TDesC8& aType, 
+                           TInt aResultsRef,
+                           TInt aStatusRef );
+
+    /**
+    * From MSmlDmAdapter.
+    * The function fetches the size of the data of a leaf object. The size
+    * is in bytes, and must reflect the number of bytes that will be 
+    * transferred when the framework calls FetchLeafObjectL. The 
+    * SetStatusL should be used as described in FetchLeafObjectL(). The 
+    * size value is returned by using the SetResultsL function of 
+    * MSmlCallback callback interface, and must be a decimal integer 
+    * expressed as a string, eg. "1234". Results from this call MUST NOT 
+    * be streamed.
+    *
+    * @since S60 3.2
+    * @param aURI     URI of the object
+    * @param aLUID      LUID of the object (if the adapter have 
+    *                       earlier returned LUID to the DM Module).   
+    * @param aType      MIME type of the object
+    * @param aResultsRef  Reference to correct results, i.e. this 
+    *                       reference must be used when returning the 
+    *                       result by calling the SetResultsL.
+    * @param aStatusRef   Reference to correct command, i.e. this 
+    *                       reference must be used when calling the 
+    *                       SetStatusL of this command.
+    */
+    void FetchLeafObjectSizeL( const TDesC8& aURI,
+                               const TDesC8& aLUID,
+                               const TDesC8& aType,
+                               TInt aResultsRef,
+                               TInt aStatusRef );
+    /**
+    * From MSmlDmAdapter.
+    * Fetches URI list. The adapter returns the list of URI segments under
+    * the given URI be separated by slash ("/"). The URI segment names for
+    * new objects must be given by the adapter. The list is returned by 
+    * calling the SetResultsL function of MSmlCallback callback interface.
+    * Results from this call MUST NOT be streamed.
+    *
+    * @since S60 3.2
+    * @param aParentURI        URI of the parent object
+    * @param aParentLUID       LUID of the parent object (if the
+    *                  adapter have earlier returned LUID
+    *                                to the DM Module).   
+    * @param aPreviousURISegmentList URI list with mapping LUID 
+    *                                information, which is known by DM 
+    *                                engine. An adapter can use this 
+    *                                information when verifying if old 
+    *                                objects still exists. An adapter also
+    *                                knows what objects are new to DM
+    *                engine and can provide LUID mapping
+    *                                for them. aPreviousURISegmentList 
+    *                                parameter (see above) helps to 
+    *                                recognise new objects.
+    * @param aResultsRef         Reference to correct results, i.e. 
+    *                                this reference must be used when 
+    *                                returning the result by calling the
+    *                                SetResultsL.
+    * @param aStatusRef        Reference to correct command, i.e. 
+    *                                this reference must be used when 
+    *                                calling the SetStatusL of this 
+    *                                command.
+    */
+    void ChildURIListL( const TDesC8& aURI,
+                        const TDesC8& aLUID,
+                        const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList,
+                        TInt aResultsRef,
+                        TInt aStatusRef );
+
+    /**
+    * From MSmlDmAdapter.
+    * The function adds node object. In some cases an implementation of 
+    * the function may be empty function, if the node object does not need
+    * concrete database update. Still this function may be helpful to an 
+    * adapter, i.e. in passing mapping LUID of the node to DM Module. The 
+    * SetStatusL should be used as described in UpdateLeafObjectL().
+    *
+    * @since S60 3.2
+    * @param aURI     URI of the object
+    * @param aParentLUID  LUID of the parent object (if the adapter have
+    *             earlier returned LUID to the DM Module).   
+    * @param aStatusRef   Reference to correct command, i.e. this 
+    *                       reference must be used when calling the 
+    *                       SetStatusL of this command.
+    */
+    void AddNodeObjectL( const TDesC8& aURI,
+                     const TDesC8& aParentLUID,
+                     TInt aStatusRef );
+
+    /**
+    * From MSmlDmAdapter.
+    * The function implements execute command. The information about the 
+    * success of the command should be returned by calling SetStatusL 
+    * function of MSmlDmCallback callback interface. This makes it 
+    * possible to buffer the commands. However, all the status codes for 
+    * buffered commands must be returned at the latest when the 
+    * CompleteOutstandingCmdsL() of adapter is called.
+    *
+    * @since S60 3.2
+    * @param aURI     URI of the command
+    * @param aLUID      LUID of the object (if the adapter have 
+    *                       earlier returned LUID to the DM Module).   
+    * @param aArgument    Argument for the command
+    * @param aType      MIME type of the object 
+    * @param aStatusRef   Reference to correct command, i.e. this 
+    *                       reference must be used when calling the 
+    *                       SetStatusL of this command.
+    */
+    void ExecuteCommandL( const TDesC8& aURI,
+                      const TDesC8& aLUID,
+                      const TDesC8& aArgument,
+                      const TDesC8& aType,
+                      TInt aStatusRef );
+
+    /**
+    * From MSmlDmAdapter.
+    * The function implements execute command. The information about the
+    * success of the command should be returned by calling SetStatusL 
+    * function of MSmlDmCallback callback interface. This makes it 
+    * possible to buffer the commands.
+    * However, all the status codes for buffered commands must be returned
+    * at the latest when the CompleteOutstandingCmdsL() of adapter is 
+    * called.
+    *
+    * @since S60 3.2
+    * @param aURI     URI of the command
+    * @param aLUID      LUID of the object (if the adapter have 
+    *                       earlier returned LUID to the DM Module).   
+    * @param aStream    Argument for the command. Adapter should 
+    *                       create write stream and return, when data is 
+    *                       written to stream by DM agent,StreamCommittedL
+    *                       is called by DM engine
+    * @param aType      MIME type of the object 
+    * @param aStatusRef   Reference to correct command, i.e. this 
+    *                       reference must be used when calling the 
+    *                       SetStatusL of this command.
+    */
+    void ExecuteCommandL( const TDesC8& aURI,
+                          const TDesC8& aLUID,
+                          RWriteStream*& aStream,
+                          const TDesC8& aType,
+                          TInt aStatusRef );
+                          
+    /**
+    * From MSmlDmAdapter.
+    * The function implements copy command. The information about the 
+    * success of the command should be returned by calling SetStatusL 
+    * function of MSmlDmCallback callback interface. This makes it 
+    * possible to buffer the commands.
+    * However, all the status codes for buffered commands must be returned
+    * at the latest when the CompleteOutstandingCmdsL() of adapter is 
+    * called.
+    *
+    * @since S60 3.2
+    * @param aTargetURI   Target URI for the command
+    * @param aSourceLUID  LUID of the target object (if one exists, and 
+    *                       if the adapter has  earlier returned a LUID to
+    *                       the DM Module).   
+    * @param aSourceURI   Source URI for the command
+    * @param aSourceLUID  LUID of the source object (if the adapter has
+    *             earlier returned a LUID to the DM Module).   
+    * @param aType      MIME type of the objects
+    * @param aStatusRef   Reference to correct command, i.e. this 
+    *                       reference must be used when calling the 
+    *                       SetStatusL of this command.
+    */
+    void CopyCommandL( const TDesC8& aTargetURI,
+                       const TDesC8& aTargetLUID,
+                       const TDesC8& aSourceURI,
+                       const TDesC8& aSourceLUID,
+                       const TDesC8& aType,
+                       TInt aStatusRef );
+    
+    /**
+    * From MSmlDmAdapter.
+    * The function indicates start of Atomic command.
+    *
+    * @since S60 3.2
+    */
+    void StartAtomicL();
+
+    /**
+    * From MSmlDmAdapter.
+    * The function indicates successful end of Atomic command. The adapter
+    * should commit all changes issued between StartAtomicL and
+    * CommitAtomicL
+    *
+    * @since S60 3.2
+    */
+    void CommitAtomicL();
+    
+    /**
+    * From MSmlDmAdapter.
+    * The function indicates unsuccessful end of Atomic command. The 
+    * adapter should rollback all changes issued between StartAtomicL() 
+    * and RollbackAtomicL(). If rollback fails for a command, adapter 
+    * should use SetStatusL() to indicate it.
+    *
+    * @since S60 3.2
+    */
+    void RollbackAtomicL();
+    
+    /**
+    * From MSmlDmAdapter.
+    * Returns ETrue if adapter supports streaming otherwise EFalse.
+    *
+    * @since S60 3.2
+    * @param aItemSize size limit for stream usage
+    * @return TBool ETrue for streaming support
+    */
+    TBool StreamingSupport( TInt& aItemSize );
+
+    /**
+    * From MSmlDmAdapter.
+    * Called when stream returned from UpdateLeafObjectL or 
+    * ExecuteCommandL has been written to and committed. Not called when
+    * fetching item.
+    *
+    * @since S60 3.2
+    */
+    void StreamCommittedL();
+    
+    /**
+    * From MSmlDmAdapter.
+    * The function tells the adapter that all the commands of the message
+    * that can be passed to the adapter have now been passed.  This 
+    * indciates that the adapter must supply status codes and results to 
+    * any buffered commands. This must be done at latest by the time this 
+    * function returns. This function is used at the end of SyncML 
+    * messages, and during processing of Atomic.   In the case of Atomic 
+    * processing, the function will be followed by a call to CommitAtomicL
+    * or RollbackAtomicL.
+    *
+    * @since S60 3.2
+    */
+    void CompleteOutstandingCmdsL();
+
+ 	/**
+    * Implementation for cleanup item.
+    * Resets and destroys array of the RCSE
+    * entries. 
+    * @param anArray RPointerArray pointer.
+    */
+    static void ResetAndDestroyEntries( TAny* anArray );
+
+protected:
+
+private:
+
+    /**
+    * Constructor.
+    *
+    * @param aEcomArguments 
+    */
+    CNSmlDmVCCAdapter( TAny* aEcomArguments );
+  
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+  
+    /**
+     * Gets last uri segment.
+     *
+     * @since S60 3.2
+     * @param aURI Descriptor to handle
+     * @return integer
+     */
+     const TPtrC8 LastURISeg( const TDesC8& aURI );
+     
+     /**
+      * Gets last uri segment.
+      *
+      * @since S60 3.2
+      * @param aURI Descriptor to handle
+      * @param aResult Object data.
+      * @return Error status enumeration
+      */
+     CSmlDmAdapter::TError FetchObjectL( const TDesC8& aURI, 
+                       CBufBase& aResult );
+     
+     /**
+      * Converts Utf8 to Unicode.
+      *
+      * @since S60 3.2
+      * @param aSource Descriptor to handle containing UTF8 data
+      * @return Handle to Unicode data
+      */
+     HBufC* ConvertToUnicodeL( const TDesC8& aSource );
+     
+     /**
+      * Fetches Voip profile reference
+      * @param aUri Uri of the wanted object
+      * @param aObject The result is inserted to this buffer
+      * @return Error code
+      */
+     CSmlDmAdapter::TError FetchVoipConRefL( const TDesC8& aUri, 
+                                             CBufBase& aObject );
+     
+     /**
+      * Updates Voip profile reference (ServiceId)
+      * @param aUri Uri of the wanted object
+      * @param aObject The result is inserted to this buffer
+      * @return Error code
+      */
+     CSmlDmAdapter::TError UpdateVoipConRefL( const TDesC8& aUri, 
+                                              const TDesC8& aObject);
+     
+     /**
+      * Removes separator from the end of URI.
+      * @param aURI Reference to the URI.
+      */
+     static void RemoveLastSeparator( TPtr8& aURI );
+
+private: // data
+
+    VCC_UNITTEST( T_CNSmlDmVCCAdapter )
+
+    /**
+     * VCC SP Settings object 
+     * own
+     * @see VccUtils
+     */
+    CVccSPSettings* iVCCSettings;
+    
+    /**
+     * Temporary object for converting Utf8 string to Unicode 
+     * own
+     */
+    HBufC* iTempBuf;
+    };
+
+#endif // C_NSMLDMVCCADAPTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/nsmldmvccadapter/inc/vccunittesting.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Unit testing definitions for VCC
+*
+*/
+
+
+
+#ifndef _VCCUNITTESTING_H_
+#define _VCCUNITTESTING_H_
+
+#ifdef UNIT_TESTING // if unit testing
+
+    #define VCC_UNITTEST( aClassName ) friend class aClassName;
+
+#else
+
+    #define VCC_UNITTEST( aClassName ) 
+
+#endif // UNIT_TESTING
+
+
+#endif // _VCCUNITTESTING_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/nsmldmvccadapter/src/nsmldmvccadapter.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1478 @@
+/*
+* 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 file for nsmldmvccadapter
+*
+*/
+
+
+#include <e32std.h>
+#include <escapeutils.h>
+#include <spentry.h>
+#include <spproperty.h>
+#include <nsmldmuri.h>
+#include <crcseprofileentry.h>
+#include <crcseprofileregistry.h>
+
+#include "nsmldmvccadapter.h"
+#include "vccspsettings.h"
+#include "vccmiscutils.h"
+#include "rubydebug.h"
+
+
+const TInt KNSmlDMVCC_DefaultResultSize = 255;
+
+/** VCC DDF keywords */
+_LIT8( KNSmlDMVCC_DDFVersion,               "1.0" );
+_LIT8( KNSmlDMVCC_Node,                     "VCC001" );
+_LIT( KNSmlDMVCC_ServiceName,               "VCC" );
+
+/** VCC */ 
+_LIT8( KNSmlDMVCC_Name,                     "Name" );
+_LIT8( KNSmlDMVCC_VDI,                      "VDI" );
+_LIT8( KNSmlDMVCC_VDN,                      "VDN" );
+_LIT8( KNSmlDMVCC_PreferredDomain,          "Preferred Domain" );
+_LIT8( KNSmlDMVCC_ImmediateDT,              "Immediate DT" );
+_LIT8( KNSmlDMVCC_DTCsToIM,                 "DT CS-to-IM CN direction" );
+_LIT8( KNSmlDMVCC_DTIMToCs,                 "DT IM CN-to-CS direction" );
+_LIT8( KNSmlDMVCC_DTHeldWaitingCalls,       "DT in held_waiting calls" );
+
+_LIT8( KNSmlDMVCC_WlanHOTreshold, 			"WLAN HO Treshold" );
+_LIT8( KNSmlDMVCC_WlanHOHysteresis,			"WLAN HO Hysteresis" );
+_LIT8( KNSmlDMVCC_WlanHysteresisTimerLow, 	"WLAN Hysteresis Timer Low" );
+_LIT8( KNSmlDMVCC_WlanHysteresisTimerHigh, 	"WLAN Hysteresis Timer High" );
+_LIT8( KNSmlDMVCC_CSHOTreshold, 			"CS HO Treshold" );
+_LIT8( KNSmlDMVCC_CSHOHysteresis, 			"CS HO Hysteresis" );
+_LIT8( KNSmlDMVCC_CSHysteresisTimerLow,		"CS Hysteresis Timer Low" );
+_LIT8( KNSmlDMVCC_CSHysteresisTimerHigh, 	"CS Hysteresis Timer High" );
+_LIT8( KNSmlDMVCC_VoipServiceId, 			"VoIP" );
+_LIT8( KNSmlDMVCC_DtAllowedWhenCsOriginated,"DT Allowed When CS Originated" );
+
+_LIT8( KNSmlDMVCC_NodeExp,                  "Main node for VCC settings" );
+_LIT8( KNSmlDMVCC_NameExp,                  "Name for the Communication Continuity settings" );
+_LIT8( KNSmlDMVCC_VDIExp,                   "VCC Transfer URI " );
+_LIT8( KNSmlDMVCC_VDNExp,                   "VCC Transfer Number" );
+_LIT8( KNSmlDMVCC_PreferredDomainExp,       "Preferred domain for UE originated calls/sessions" );
+_LIT8( KNSmlDMVCC_ImmediateDTExp,           "Initiate a VCC DT immediately when domain available or not" );
+_LIT8( KNSmlDMVCC_DTCsToIMExp,              "DT from CS domain to PS is restricted or not" );
+_LIT8( KNSmlDMVCC_DTIMToCsExp,              "DT from PS domain to CS is restricted or not" );
+_LIT8( KNSmlDMVCC_DTHeldWaitingCallsExp,    "DT restricted during active and a held/waiting call/session" );
+_LIT8( KNSmlDMVCC_WlanHOTresholdExp, 		"Handover signal strength treshold value for WLAN" );
+_LIT8( KNSmlDMVCC_WlanHOHysteresisExp,		"Handover hysteresis value for WLAN" );
+_LIT8( KNSmlDMVCC_WlanHysteresisTimerLowExp,"Handover hysteresis timer value for WLAN used below treshold" );
+_LIT8( KNSmlDMVCC_WlanHysteresisTimerHighExp, 	"Handover hysteresis timer value for WLAN used above treshold" );
+_LIT8( KNSmlDMVCC_CSHOTresholdExp, 			"Handover signal strength treshold value for CS" );
+_LIT8( KNSmlDMVCC_CSHOHysteresisExp, 		"Handover hysteresis value for CS" );
+_LIT8( KNSmlDMVCC_CSHysteresisTimerLowExp,	"Handover hysteresis timer value for CS used below treshold" );
+_LIT8( KNSmlDMVCC_CSHysteresisTimerHighExp, "Handover hysteresis timer value for CS used above treshold" );
+_LIT8( KNSmlDMVCC_VoipServiceIdExp, 		"VoIP Service Id to be associated with VCC" );
+_LIT8( KNSmlDMVCC_DmToConRef, 				"ToConRef" );
+_LIT8( KNSmlDMVCC_DmConRef, 				"ConRef" );
+_LIT8( KNSmlDMVCC_DmToConRefExp, 			"Refers to a collection of connectivity definitions" );
+_LIT8( KNSmlDMVCC_DmConRefExp,		 		"Indicates the linkage to connectivity parameters" );
+
+_LIT8( KNSmlDMVCC_DmVoipLinkPrefix, 			"./VoIP");
+_LIT8( KNSmlDMVCC_DmVoipId,					"VoIPId");
+_LIT8( KNSmlDMVCC_DmVoip,					"VoIP");
+_LIT( KVccServiceName,               		"VCC" );
+
+
+/** Others */
+_LIT8( KNSmlDMVCCTextPlain,                 "text/plain" );
+_LIT8( KNSmlDMVCCSeparator,                 "/" );
+_LIT( KNSmlDMVCCValueNullDesc,              "" );
+_LIT( KNSmlDMVCCValueZero,                 "0" );
+
+const TInt KNSmlDMVCCSeparatorChar            = '/';
+const TInt KNSmlDMVCCDefaultResultSize        = 64;
+const TInt KNSmlDMVCCMaxResultLength          = 256;
+const TInt  KNSmlDMVCCMaxUriLength            = 100;
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ Constructor
+// ---------------------------------------------------------------------------
+//
+CNSmlDmVCCAdapter::CNSmlDmVCCAdapter( TAny* aEcomArguments )
+: CSmlDmAdapter( aEcomArguments )
+    {
+    RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::CNSmlDmVCCAdapter" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Second phase constructor
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CNSmlDmVCCAdapter::ConstructL" );
+    iVCCSettings = CVccSPSettings::NewL();
+    iVCCSettings->SetServiceNameL( KNSmlDMVCC_ServiceName );
+    iVCCSettings->ReadSettingsL( KVccServiceName );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CNSmlDmVCCAdapter* CNSmlDmVCCAdapter::NewL( MSmlDmCallback* aDmCallback )
+    {
+    RUBY_DEBUG_BLOCKL( "CNSmlDmVCCAdapter::NewL" );
+    CNSmlDmVCCAdapter* self = CNSmlDmVCCAdapter::NewLC( aDmCallback );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CNSmlDmVCCAdapter* CNSmlDmVCCAdapter::NewLC( MSmlDmCallback* aDmCallback )
+    {
+    RUBY_DEBUG0( "CNSmlDmVCCAdapter::NewLC --Start" );
+    CNSmlDmVCCAdapter* self = new( ELeave ) CNSmlDmVCCAdapter( aDmCallback );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    RUBY_DEBUG0( "CNSmlDmVCCAdapter::NewLC --End" );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CNSmlDmVCCAdapter::~CNSmlDmVCCAdapter()
+    {
+    RUBY_DEBUG0( "CNSmlDmVCCAdapter::~CNSmlDmVCCAdapter() - ENTER" );
+    delete iVCCSettings;
+    delete iTempBuf;
+    RUBY_DEBUG0( "CNSmlDmVCCAdapter::~CNSmlDmVCCAdapter() - EXIT" );
+    }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::DDFVersionL( CBufBase& aVersion )
+    {
+    RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::DDFVersionL" );
+    aVersion.InsertL( 0,KNSmlDMVCC_DDFVersion );
+    }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
+    {
+    RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::DDFStructureL" );
+  
+    TSmlDmAccessTypes accessTypesGet;
+    accessTypesGet.SetGet();
+
+    TSmlDmAccessTypes accessTypesGetReplace;
+    accessTypesGetReplace.SetGet();
+    accessTypesGetReplace.SetReplace();
+     
+    
+    // Main node
+    MSmlDmDDFObject& vccNode = aDDF.AddChildObjectL( KNSmlDMVCC_Node );
+    vccNode.SetAccessTypesL( accessTypesGet );
+    vccNode.SetOccurenceL( MSmlDmDDFObject::EOneOrMore );
+    vccNode.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccNode.SetDFFormatL( MSmlDmDDFObject::ENode );
+    vccNode.SetDescriptionL( KNSmlDMVCC_NodeExp );
+    
+    // Name leaf -read only
+    MSmlDmDDFObject& vccName = vccNode.AddChildObjectL( KNSmlDMVCC_Name );    
+    vccName.SetAccessTypesL( accessTypesGet );
+    vccName.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
+    vccName.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccName.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccName.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccName.SetDescriptionL( KNSmlDMVCC_NameExp );
+    
+    // VDI leaf
+    MSmlDmDDFObject& vccVDI = vccNode.AddChildObjectL( KNSmlDMVCC_VDI );    
+    vccVDI.SetAccessTypesL( accessTypesGetReplace );
+    vccVDI.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccVDI.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccVDI.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccVDI.SetDescriptionL( KNSmlDMVCC_VDIExp );
+    
+    // VDN leaf
+    MSmlDmDDFObject& vccVDN = vccNode.AddChildObjectL( KNSmlDMVCC_VDN );
+    vccVDN.SetAccessTypesL( accessTypesGetReplace );
+    vccVDN.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccVDN.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccVDN.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccVDN.SetDescriptionL( KNSmlDMVCC_VDNExp );
+    
+    // Preferred domain leaf
+    MSmlDmDDFObject& vccPD = 
+                          vccNode.AddChildObjectL( KNSmlDMVCC_PreferredDomain );
+    vccPD.SetAccessTypesL( accessTypesGetReplace );
+    vccPD.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccPD.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccPD.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccPD.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccPD.SetDescriptionL( KNSmlDMVCC_PreferredDomainExp );
+    
+    // Immediate DT leaf
+    MSmlDmDDFObject& vccIDT = vccNode.AddChildObjectL( KNSmlDMVCC_ImmediateDT );
+    vccIDT.SetAccessTypesL( accessTypesGetReplace );
+    vccIDT.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccIDT.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccIDT.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccIDT.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccIDT.SetDescriptionL( KNSmlDMVCC_ImmediateDTExp );
+    
+    // CS to PS leaf
+    MSmlDmDDFObject& vccDTCS = vccNode.AddChildObjectL( KNSmlDMVCC_DTCsToIM );
+    vccDTCS.SetAccessTypesL( accessTypesGetReplace );
+    vccDTCS.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccDTCS.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccDTCS.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccDTCS.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccDTCS.SetDescriptionL( KNSmlDMVCC_DTCsToIMExp );
+    
+    // PS to CS leaf
+    MSmlDmDDFObject& vccDTIM = vccNode.AddChildObjectL( KNSmlDMVCC_DTIMToCs );
+    vccDTIM.SetAccessTypesL( accessTypesGetReplace );
+    vccDTIM.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccDTIM.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccDTIM.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccDTIM.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccDTIM.SetDescriptionL( KNSmlDMVCC_DTIMToCsExp );
+    
+    // DT restricted while held or waiting calls leaf
+    MSmlDmDDFObject& vccDTHeld = 
+                       vccNode.AddChildObjectL( KNSmlDMVCC_DTHeldWaitingCalls );
+    vccDTHeld.SetAccessTypesL( accessTypesGetReplace );
+    vccDTHeld.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccDTHeld.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccDTHeld.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccDTHeld.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccDTHeld.SetDescriptionL( KNSmlDMVCC_DTHeldWaitingCallsExp );
+    
+    // DT Allowed when CS Originated Call
+    MSmlDmDDFObject& vccDTAllowedWhenCsOrig = 
+               vccNode.AddChildObjectL( KNSmlDMVCC_DtAllowedWhenCsOriginated );
+    vccDTAllowedWhenCsOrig.SetAccessTypesL( accessTypesGetReplace );
+    vccDTAllowedWhenCsOrig.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccDTAllowedWhenCsOrig.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccDTAllowedWhenCsOrig.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccDTAllowedWhenCsOrig.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccDTAllowedWhenCsOrig.SetDescriptionL( KNSmlDMVCC_DtAllowedWhenCsOriginated );
+        
+    
+    // WLAN HO treshold leaf
+    MSmlDmDDFObject& vccWLANHotreshold = 
+                       vccNode.AddChildObjectL( KNSmlDMVCC_WlanHOTreshold );
+    vccWLANHotreshold.SetAccessTypesL( accessTypesGetReplace );
+    vccWLANHotreshold.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccWLANHotreshold.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccWLANHotreshold.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccWLANHotreshold.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccWLANHotreshold.SetDescriptionL( KNSmlDMVCC_WlanHOTresholdExp );
+    
+    // WLAN HO hysteresis leaf
+    MSmlDmDDFObject& vccWLANHoHysteresis = 
+                       vccNode.AddChildObjectL( KNSmlDMVCC_WlanHOHysteresis );
+    vccWLANHoHysteresis.SetAccessTypesL( accessTypesGetReplace );
+    vccWLANHoHysteresis.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccWLANHoHysteresis.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccWLANHoHysteresis.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccWLANHoHysteresis.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccWLANHoHysteresis.SetDescriptionL( KNSmlDMVCC_WlanHOHysteresisExp );
+    
+    // WLAN HO hysteresis timer low leaf
+    MSmlDmDDFObject& vccWLANHoHysteresisTimerLow = 
+                       vccNode.AddChildObjectL( KNSmlDMVCC_WlanHysteresisTimerLow );
+    vccWLANHoHysteresisTimerLow.SetAccessTypesL( accessTypesGetReplace );
+    vccWLANHoHysteresisTimerLow.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccWLANHoHysteresisTimerLow.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccWLANHoHysteresisTimerLow.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccWLANHoHysteresisTimerLow.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccWLANHoHysteresisTimerLow.SetDescriptionL( KNSmlDMVCC_WlanHysteresisTimerLowExp );
+    
+    // WLAN HO hysteresis timer high leaf
+    MSmlDmDDFObject& vccWLANHoHysteresisTimerHigh = 
+                       vccNode.AddChildObjectL( KNSmlDMVCC_WlanHysteresisTimerHigh );
+    vccWLANHoHysteresisTimerHigh.SetAccessTypesL( accessTypesGetReplace );
+    vccWLANHoHysteresisTimerHigh.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccWLANHoHysteresisTimerHigh.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccWLANHoHysteresisTimerHigh.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccWLANHoHysteresisTimerHigh.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccWLANHoHysteresisTimerHigh.SetDescriptionL( KNSmlDMVCC_WlanHysteresisTimerHighExp );
+    
+    // CS HO treshold leaf
+    MSmlDmDDFObject& vccCSHotreshold = 
+                       vccNode.AddChildObjectL( KNSmlDMVCC_CSHOTreshold );
+    vccCSHotreshold.SetAccessTypesL( accessTypesGetReplace );
+    vccCSHotreshold.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccCSHotreshold.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccCSHotreshold.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccCSHotreshold.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccCSHotreshold.SetDescriptionL( KNSmlDMVCC_CSHOTresholdExp );
+    
+    // CS HO hysteresis leaf
+    MSmlDmDDFObject& vccCSHoHysteresis = 
+                       vccNode.AddChildObjectL( KNSmlDMVCC_CSHOHysteresis );
+    vccCSHoHysteresis.SetAccessTypesL( accessTypesGetReplace );
+    vccCSHoHysteresis.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccCSHoHysteresis.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccCSHoHysteresis.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccCSHoHysteresis.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccCSHoHysteresis.SetDescriptionL( KNSmlDMVCC_CSHOHysteresisExp );
+    
+    // CS HO hysteresis timer low leaf
+    MSmlDmDDFObject& vccCSHoHysteresisTimerLow = 
+                       vccNode.AddChildObjectL( KNSmlDMVCC_CSHysteresisTimerLow );
+    vccCSHoHysteresisTimerLow.SetAccessTypesL( accessTypesGetReplace );
+    vccCSHoHysteresisTimerLow.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccCSHoHysteresisTimerLow.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccCSHoHysteresisTimerLow.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccCSHoHysteresisTimerLow.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccCSHoHysteresisTimerLow.SetDescriptionL( KNSmlDMVCC_CSHysteresisTimerLowExp );
+    
+    // CS HO hysteresis timer high leaf
+    MSmlDmDDFObject& vccCSHoHysteresisTimerHigh = 
+                       vccNode.AddChildObjectL( KNSmlDMVCC_CSHysteresisTimerHigh );
+    vccCSHoHysteresisTimerHigh.SetAccessTypesL( accessTypesGetReplace );
+    vccCSHoHysteresisTimerHigh.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vccCSHoHysteresisTimerHigh.SetScopeL( MSmlDmDDFObject::EPermanent );
+    vccCSHoHysteresisTimerHigh.SetDFFormatL( MSmlDmDDFObject::EChr );
+    vccCSHoHysteresisTimerHigh.AddDFTypeMimeTypeL( KNSmlDMVCCTextPlain );
+    vccCSHoHysteresisTimerHigh.SetDescriptionL( KNSmlDMVCC_CSHysteresisTimerHighExp );
+    
+    // ./VCC001/ToConRef/
+    
+    MSmlDmDDFObject& toConRefNode = vccNode.AddChildObjectL(KNSmlDMVCC_DmToConRef);
+    toConRefNode.SetAccessTypesL( accessTypesGet );
+    toConRefNode.SetOccurenceL( MSmlDmDDFObject::EOne );
+    toConRefNode.SetScopeL( MSmlDmDDFObject::EDynamic );
+    toConRefNode.SetDFFormatL( MSmlDmDDFObject::ENode );
+    toConRefNode.SetDescriptionL( KNSmlDMVCC_DmToConRefExp );
+    
+    // ./VCC001/ToConRef/VoIP
+        
+    MSmlDmDDFObject& voipNode = toConRefNode.AddChildObjectL( KNSmlDMVCC_VoipServiceId );
+    voipNode.SetAccessTypesL( accessTypesGet );
+    voipNode.SetOccurenceL( MSmlDmDDFObject::EOne );
+    voipNode.SetScopeL( MSmlDmDDFObject::EDynamic );
+    voipNode.SetDFFormatL( MSmlDmDDFObject::ENode );
+    voipNode.SetDescriptionL( KNSmlDMVCC_VoipServiceIdExp );
+    
+    // ./VCC001/ToConRef/VoIP/ConRef
+    
+    MSmlDmDDFObject& conRefVoipNode = voipNode.AddChildObjectL(KNSmlDMVCC_DmConRef);
+    conRefVoipNode.SetAccessTypesL( accessTypesGetReplace );
+    conRefVoipNode.SetOccurenceL( MSmlDmDDFObject::EOne );
+    conRefVoipNode.SetScopeL( MSmlDmDDFObject::EDynamic );
+    conRefVoipNode.SetDFFormatL( MSmlDmDDFObject::EChr );
+    conRefVoipNode.SetDescriptionL( KNSmlDMVCC_DmConRefExp );
+        
+    // !NOTE! Ext node not inserted yet
+  }
+
+// ---------------------------------------------------------------------------
+//  Note: HBufC* buf points to member iTempBuf that is deleted every time 
+//  ConvertToUnicodeL is called and in class' destructor.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::UpdateLeafObjectL( const TDesC8& aURI, 
+            const TDesC8& /*aLUID*/, const TDesC8& aObject, 
+            const TDesC8& /*aType*/, TInt aStatusRef )
+    {
+    RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::UpdateLeafObjectL" );
+  	RUBY_DEBUG0( "ReadSPSettings" );
+  	iVCCSettings->ReadSettingsL( KVccServiceName );
+    CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+    HBufC* buf = ConvertToUnicodeL( aObject );
+    
+    // Find the last leaf in URI
+    TPtrC8 uriSeg( LastURISeg( aURI ) );
+  
+    if ( KNSmlDMVCC_Name() == uriSeg )
+        {
+        // Don't do anything at the moment
+        //iVCCSettings->SetNameL( aObject );
+        }
+    else if ( KNSmlDMVCC_VDI() == uriSeg )
+        {
+        if ( KErrNone != iVCCSettings->SetVdiL( buf->Des() ) )
+            {
+            retValue = CSmlDmAdapter::EInvalidObject;
+            }
+        }
+    else if ( KNSmlDMVCC_VDN() == uriSeg )
+        {
+        if ( !( iVCCSettings->SetVdnL( buf->Des() ) ) )
+            {
+            retValue = CSmlDmAdapter::EInvalidObject;
+            }
+        }
+    else if ( KNSmlDMVCC_PreferredDomain() == uriSeg )
+        {
+        TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
+    
+        switch ( value )
+            {
+            case 0:
+            case 1:
+            case 2:
+            case 3:
+                iVCCSettings->SetPreferredDomainL( buf->Des() );
+                break;
+            default:
+                retValue = CSmlDmAdapter::EInvalidObject;
+                break;
+          }
+        }
+    else if ( KNSmlDMVCC_ImmediateDT() == uriSeg )
+        {
+        TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
+    
+        switch ( value )
+            {
+            case 0:
+            case 1:
+                iVCCSettings->SetImmediateDtL( buf->Des() );
+                break;
+            default:
+                retValue = CSmlDmAdapter::EInvalidObject;
+                break;
+            }
+        }
+    else if ( KNSmlDMVCC_DTCsToIM() == uriSeg )
+        {
+        TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
+        
+        switch ( value )
+            {
+            case 0:
+            case 1:
+                iVCCSettings->SetDtCsToPsAllowedL( buf->Des() );
+                break;
+            default:
+                retValue = CSmlDmAdapter::EInvalidObject;
+                break;
+            }
+        }
+    else if ( KNSmlDMVCC_DTIMToCs() == uriSeg )
+        {
+        TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
+    
+        switch ( value )
+            {
+            case 0:
+            case 1:
+                iVCCSettings->SetDtPsToCsAllowedL( buf->Des() );
+                break;
+            default:
+                retValue = CSmlDmAdapter::EInvalidObject;
+                break;
+            }
+        }
+    else if ( KNSmlDMVCC_DtAllowedWhenCsOriginated() == uriSeg )
+        {
+        TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
+        
+        switch ( value )
+            {
+            case 0:
+            case 1:
+                iVCCSettings->SetDtAllowedWhenCsOriginated( buf->Des() );
+                break;
+            default:
+                retValue = CSmlDmAdapter::EInvalidObject;
+                break;
+            }
+        }
+    
+    else if ( KNSmlDMVCC_DTHeldWaitingCalls() == uriSeg )
+        {
+        TInt value = iVCCSettings->ConvertToIntL( buf->Des() );
+
+        switch ( value )
+            {
+            case 0:
+            case 1:
+                iVCCSettings->SetDtHeldWaitingCallsAllowedL( buf->Des() );
+                break;
+            default:
+                retValue = CSmlDmAdapter::EInvalidObject;
+                break;
+            }
+        }
+           
+    else if ( KNSmlDMVCC_WlanHOTreshold() == uriSeg )
+        {
+        iVCCSettings->SetDtWlanHoTresholdL( buf->Des() );
+        }
+    else if ( KNSmlDMVCC_WlanHOHysteresis() == uriSeg )
+        {
+        iVCCSettings->SetDtWlanHoHysteresisL( buf->Des() );
+        }
+    else if ( KNSmlDMVCC_WlanHysteresisTimerLow() == uriSeg )
+        {
+        iVCCSettings->SetDtWlanHoHysteresisTimerLowL( buf->Des() );
+        }
+    else if ( KNSmlDMVCC_WlanHysteresisTimerHigh() == uriSeg )
+        {
+        iVCCSettings->SetDtWlanHoHysteresisTimerHighL( buf->Des() );
+        }
+    
+    else if ( KNSmlDMVCC_CSHOTreshold() == uriSeg )
+        {
+        iVCCSettings->SetDtCsHoTresholdL( buf->Des() );
+        }
+    else if ( KNSmlDMVCC_CSHOHysteresis() == uriSeg )
+        {
+        iVCCSettings->SetDtCsHoHysteresisL( buf->Des() );
+        }
+    else if ( KNSmlDMVCC_CSHysteresisTimerLow() == uriSeg )
+        {
+        iVCCSettings->SetDtCsHoHysteresisTimerLowL( buf->Des() );
+        }
+    else if ( KNSmlDMVCC_CSHysteresisTimerHigh() == uriSeg )
+        {
+        iVCCSettings->SetDtCsHoHysteresisTimerHighL( buf->Des() );
+        }
+    else if ( KNSmlDMVCC_DmConRef() == uriSeg )
+        {
+        retValue = UpdateVoipConRefL(aURI, aObject);
+        }
+        
+    else
+        { // No recognized leaf object found
+        retValue = CSmlDmAdapter::EInvalidObject;
+        }
+  
+    if ( CSmlDmAdapter::EOk == retValue )
+        {
+        RUBY_DEBUG0( "StoreSPSettings" );
+        // Set operation successfull, store changes into SP Settings table
+        iVCCSettings->StoreL();
+        }
+  
+    Callback().SetStatusL( aStatusRef, retValue ); 
+    }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::UpdateLeafObjectL( const TDesC8& /*aURI*/, 
+            const TDesC8& /*aLUID*/,
+                  RWriteStream*& /*aStream*/, const TDesC8& /*aType*/,
+                  TInt aStatusRef )
+    {
+    RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::UpdateLeafObjectL -stream" );
+    Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
+    }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::DeleteObjectL( const TDesC8& aURI,
+                                       const TDesC8& /*aLUID*/, 
+                                       TInt aStatusRef )
+    {
+    RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::DeleteObjectL" );
+   	iVCCSettings->ReadSettingsL( KVccServiceName );
+    
+    CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+    TPtrC8 uriSeg( LastURISeg( aURI ) );
+  
+    if ( KNSmlDMVCC_Name() == uriSeg )
+        {
+        // Don't do anything at the moment
+        //iVCCSettings->SetNameL( KNSmlDMVCCValueNullDesc );
+        }
+    else if ( KNSmlDMVCC_VDI() == uriSeg )
+        {
+        iVCCSettings->SetVdiL( KNSmlDMVCCValueNullDesc );
+        }
+    else if ( KNSmlDMVCC_VDN() == uriSeg )
+        {
+        iVCCSettings->SetVdnL( KNSmlDMVCCValueNullDesc );
+        }
+    else if ( KNSmlDMVCC_PreferredDomain() == uriSeg )
+        {
+        iVCCSettings->SetPreferredDomainL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_ImmediateDT() == uriSeg )
+        {
+        iVCCSettings->SetImmediateDtL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_DTCsToIM() == uriSeg )
+        {
+        iVCCSettings->SetDtCsToPsAllowedL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_DTIMToCs() == uriSeg )
+        {
+        iVCCSettings->SetDtPsToCsAllowedL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_DTHeldWaitingCalls() == uriSeg )
+        {
+        iVCCSettings->SetDtHeldWaitingCallsAllowedL( KNSmlDMVCCValueZero );
+        }
+     else if ( KNSmlDMVCC_WlanHOTreshold() == uriSeg )
+        {
+        iVCCSettings->SetDtWlanHoTresholdL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_WlanHOHysteresis() == uriSeg )
+        {
+        iVCCSettings->SetDtWlanHoHysteresisL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_WlanHysteresisTimerLow() == uriSeg )
+        {
+        iVCCSettings->SetDtWlanHoHysteresisTimerLowL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_WlanHysteresisTimerHigh() == uriSeg )
+        {
+        iVCCSettings->SetDtWlanHoHysteresisTimerHighL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_CSHOTreshold() == uriSeg )
+        {
+        iVCCSettings->SetDtCsHoTresholdL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_CSHOHysteresis() == uriSeg )
+        {
+        iVCCSettings->SetDtCsHoHysteresisL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_CSHysteresisTimerLow() == uriSeg )
+        {
+        iVCCSettings->SetDtCsHoHysteresisTimerLowL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_CSHysteresisTimerHigh() == uriSeg )
+        {
+        iVCCSettings->SetDtCsHoHysteresisTimerHighL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_DmConRef() == uriSeg )
+        {
+        iVCCSettings->SetVoipServiceIdL( KNSmlDMVCCValueZero );
+        }
+    else if ( KNSmlDMVCC_DtAllowedWhenCsOriginated() == uriSeg )
+        {
+        iVCCSettings->SetDtAllowedWhenCsOriginated( KNSmlDMVCCValueZero );
+        }
+    else
+        {
+        retValue = CSmlDmAdapter::EInvalidObject;
+        }
+  
+    if ( CSmlDmAdapter::EOk == retValue )
+        {
+        iVCCSettings->StoreL();
+        }
+  
+    Callback().SetStatusL( aStatusRef, retValue ); 
+    }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::FetchLeafObjectL( const TDesC8& aURI, 
+             const TDesC8& /*aLUID*/, const TDesC8& aType, 
+             TInt aResultsRef, TInt aStatusRef )
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::FetchLeafObjectL" );
+  
+    CBufBase* result = CBufFlat::NewL( KNSmlDMVCCDefaultResultSize );
+    CleanupStack::PushL( result );
+    CSmlDmAdapter::TError status = FetchObjectL( aURI, *result );
+
+    if ( status == CSmlDmAdapter::EOk )
+        {
+        Callback().SetResultsL( aResultsRef, *result, aType );
+        }
+    
+    Callback().SetStatusL( aStatusRef, status );
+
+    CleanupStack::PopAndDestroy( result );
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::FetchLeafObjectSizeL( const TDesC8& /*aURI*/, 
+               const TDesC8& /*aLUID*/, const TDesC8& /*aType*/, 
+               TInt /*aResultsRef*/, TInt aStatusRef )
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::FetchLeafObjectSizeL" );
+  
+  // Not supported 
+  Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::ChildURIListL( const TDesC8& aURI, 
+                                       const TDesC8& /*aLUID*/,
+              const CArrayFix<TSmlDmMappingInfo>& /*aPreviousURISegmentList*/,
+              TInt aResultsRef, TInt aStatusRef )
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::ChildURIListL" );
+  
+    CSmlDmAdapter::TError status = CSmlDmAdapter::EError;
+
+    CBufBase *currentURISegmentList = CBufFlat::NewL( KNSmlDMVCCDefaultResultSize );
+    CleanupStack::PushL( currentURISegmentList );
+    TBuf8<KNSmlDMVCCMaxUriLength> mappingInfo( KNullDesC8 );
+    TBuf8<KNSmlDMVCCMaxUriLength> uri = aURI;
+    TBuf8<KSmlMaxURISegLen> segmentName;
+    
+     if ( KNSmlDMVCC_Node() == LastURISeg( aURI ) )
+        {
+        // Name
+        segmentName.Copy( KNSmlDMVCC_Name );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+        // VDI
+        segmentName.Copy( KNSmlDMVCC_VDI );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+        // VDN
+        segmentName.Copy( KNSmlDMVCC_VDN );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+        // Preferred domain
+        segmentName.Copy( KNSmlDMVCC_PreferredDomain );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+        // Immediate dt
+        segmentName.Copy( KNSmlDMVCC_ImmediateDT );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+        // DT CS to PS
+        segmentName.Copy( KNSmlDMVCC_DTCsToIM );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+        // DT PS to CS
+        segmentName.Copy( KNSmlDMVCC_DTIMToCs );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+        // DT Held waiting calls
+        segmentName.Copy( KNSmlDMVCC_DTHeldWaitingCalls );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+            
+        // Wlan Ho Treshold
+        segmentName.Copy( KNSmlDMVCC_WlanHOTreshold );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+        
+         // Wlan Ho Hysteresis
+        segmentName.Copy( KNSmlDMVCC_WlanHOHysteresis );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+            
+         // Wlan Ho Hysteresis Timer Low
+        segmentName.Copy( KNSmlDMVCC_WlanHysteresisTimerLow );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+            
+         // Wlan Ho Hysteresis Timer High
+        segmentName.Copy( KNSmlDMVCC_WlanHysteresisTimerHigh );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+        
+        // CS Ho Treshold
+        segmentName.Copy( KNSmlDMVCC_CSHOTreshold );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+        
+         // CS Ho Hysteresis
+        segmentName.Copy( KNSmlDMVCC_CSHOHysteresis );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+            
+         // CS Ho Hysteresis Timer Low
+        segmentName.Copy( KNSmlDMVCC_CSHysteresisTimerLow );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+            
+         // CS Ho Hysteresis Timer High
+        segmentName.Copy( KNSmlDMVCC_CSHysteresisTimerHigh );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+        
+        // DT Allowed When CS Originated
+        segmentName.Copy( KNSmlDMVCC_DtAllowedWhenCsOriginated );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVCCSeparator );
+                
+                
+    	status = CSmlDmAdapter::EOk;
+        }
+    else if( KNSmlDMVCC_DmToConRef() == LastURISeg( aURI ) )    // ./VCC001/ToConRef
+      		{
+        	segmentName.Copy( KNSmlDMVCC_VoipServiceId );
+        	currentURISegmentList->InsertL( currentURISegmentList->Size(), segmentName );
+        	currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMVCCSeparator );
+			status = CSmlDmAdapter::EOk;
+	       	}
+    else if( KNSmlDMVCC_VoipServiceId() == LastURISeg( aURI ) )         // ./VCC001/ToConRef/VoIP
+        	{
+        	segmentName.Copy( KNSmlDMVCC_DmConRef );
+        	currentURISegmentList->InsertL( currentURISegmentList->Size(), segmentName );
+        	currentURISegmentList->InsertL( currentURISegmentList->Size(), KNSmlDMVCCSeparator );
+    		status = CSmlDmAdapter::EOk;
+        	}
+         
+    
+    Callback().SetStatusL( aStatusRef, status );
+    Callback().SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 );
+    CleanupStack::PopAndDestroy( currentURISegmentList ); 
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::AddNodeObjectL( const TDesC8& /*aURI*/, 
+           const TDesC8& /*aParentLUID*/, TInt aStatusRef )
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::AddNodeObjectL" );
+  
+  // Not supported 
+  Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EOk );
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, 
+            const TDesC8& /*aLUID*/, const TDesC8& /*aArgument*/, 
+            const TDesC8& /*aType*/, TInt aStatusRef )
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::ExecuteCommandL" );
+  
+  // Not supported 
+  Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); 
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::ExecuteCommandL( const TDesC8& /*aURI*/, 
+            const TDesC8& /*aLUID*/, RWriteStream*& /*aStream*/, 
+            const TDesC8& /*aType*/, TInt aStatusRef )
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::ExecuteCommandL -stream" );
+  
+  // Not supported 
+  Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+  }
+                      
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::CopyCommandL( const TDesC8& /*aTargetURI*/, 
+           const TDesC8& /*aTargetLUID*/, const TDesC8& /*aSourceURI*/, 
+           const TDesC8& /*aSourceLUID*/, const TDesC8& /*aType*/, 
+           TInt aStatusRef )
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::CopyCommandL" );
+  
+  // Not supported 
+  Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError ); 
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::StartAtomicL()
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::StartAtomicL()" );
+  // Not supported 
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::CommitAtomicL()
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::CommitAtomicL()" );
+  // Not supported 
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::RollbackAtomicL()
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::RollbackAtomicL()" );
+  // Not supported 
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+TBool CNSmlDmVCCAdapter::StreamingSupport( TInt& /*aItemSize*/ )
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::StreamingSupport" );
+  return EFalse;
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::StreamCommittedL()
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::StreamCommittedL" );
+  // Not supported 
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::CompleteOutstandingCmdsL()
+  {
+  RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::CompleteOutstandingCmdsL()" );
+  
+  iVCCSettings->StoreL();
+  }
+
+// ---------------------------------------------------------------------------
+// Returns only the last uri segment.
+// ---------------------------------------------------------------------------
+//
+const TPtrC8 CNSmlDmVCCAdapter::LastURISeg( const TDesC8& aURI )
+    {
+    RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::LastURISeg" );
+    TInt offset = aURI.LocateReverse( KNSmlDMVCCSeparatorChar  );
+    
+    RUBY_DEBUG1( " - offset == %d", offset );    
+    
+    TInt i;
+    for ( i=aURI.Length()-1; i >= 0; i-- )
+        {
+        if ( aURI[i]=='/' )
+            {
+            break;
+            }
+        }
+    if ( i==0 )
+        {
+        return aURI;
+        }
+    else
+        {
+        return aURI.Mid( i + 1 );
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CNSmlDmVCCAdapter::FetchObjectL( const TDesC8& aURI, 
+                                                   CBufBase& aResult )
+  {
+    RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::FetchObjectL" );
+    TInt composeResult = ETrue; 
+    iVCCSettings->ReadSettingsL( KVccServiceName );
+    
+    CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; 
+    TInt err( KErrNone );
+    TPtrC8 lastUriSeg = LastURISeg( aURI );
+    CSPEntry* entry = CSPEntry::NewLC();
+    
+    iVCCSettings->FindServiceEntryL( KNSmlDMVCC_ServiceName, *entry );
+    
+    if ( entry->PropertyCount() > 0 )
+      {
+      RUBY_DEBUG0( "- Service Entry found" );
+      TServiceId serviceId = entry->GetServiceId();   
+      CSPProperty* property = CSPProperty::NewLC();
+      
+    if ( KNSmlDMVCC_Name() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- Name" );
+      err = iVCCSettings->FindPropertyL( serviceId, ESubPropertyVccName, 
+                               *property );
+      }
+    else if ( KNSmlDMVCC_VDI() == lastUriSeg )
+          {
+          RUBY_DEBUG0( "- VDI" );
+          err = iVCCSettings->FindPropertyL( serviceId, ESubPropertyVccVDI, 
+                                   *property );
+          }
+    else if ( KNSmlDMVCC_VDN() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- VDN" );
+      err = iVCCSettings->FindPropertyL( serviceId, ESubPropertyVccVDN, 
+                               *property );
+      }
+    else if ( KNSmlDMVCC_PreferredDomain() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- Preferred Domain" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                               ESubPropertyVccPreferredDomain, 
+                               *property );
+      }
+    else if ( KNSmlDMVCC_ImmediateDT() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- Immediate DT" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                               ESubPropertyVccImmediateDomainTransfer, 
+                               *property );
+      }
+    else if ( KNSmlDMVCC_DTCsToIM() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- CS to PS" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                               ESubPropertyVccDtCstoPsAllowed, 
+                               *property );
+      }
+    else if ( KNSmlDMVCC_DTIMToCs() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- PS to CS" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                                     ESubPropertyVccDtPstoCsAllowed, 
+                                     *property );
+      }
+    else if ( KNSmlDMVCC_DTHeldWaitingCalls() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- Held waiting calls" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                             ESubPropertyVccDtHeldWaitingCallsAllowed, 
+                             *property );
+      }
+   
+    else if ( KNSmlDMVCC_WlanHOTreshold() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- WlanHOTreshold" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                             ESubPropertyVccDtWLANHoTriggerLevel, 
+                             *property );
+      }
+    else if ( KNSmlDMVCC_WlanHOHysteresis() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- WlanHOHysteresis" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                             ESubPropertyVccDtWLANHoHysteresis, 
+                             *property );
+      }
+
+    else if ( KNSmlDMVCC_WlanHysteresisTimerLow() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- _WlanHysteresisTimerLow" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                             ESubPropertyVccDtWLANHoHysteresisTimerLow, 
+                             *property );
+      }
+
+    else if ( KNSmlDMVCC_WlanHysteresisTimerHigh() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- WlanHysteresisTimerHigh" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                             ESubPropertyVccDtCSHoHysteresisTimerHigh, 
+                             *property );
+      }
+   
+    else if ( KNSmlDMVCC_CSHOTreshold() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- CSHOTreshold" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                             ESubPropertyVccDtCSHoTriggerLevel, 
+                             *property );
+      }
+    else if ( KNSmlDMVCC_CSHOHysteresis() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- CSHOHysteresis" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                             ESubPropertyVccDtCSHoHysteresis, 
+                             *property );
+      }
+
+    else if ( KNSmlDMVCC_CSHysteresisTimerLow() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- CSHysteresisTimerLow" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                             ESubPropertyVccDtCSHoHysteresisTimerLow, 
+                             *property );
+      }
+
+    else if ( KNSmlDMVCC_CSHysteresisTimerHigh() == lastUriSeg )
+      {
+      RUBY_DEBUG0( "- CSHysteresisTimerHigh" );
+      err = iVCCSettings->FindPropertyL( serviceId, 
+                             ESubPropertyVccDtCSHoHysteresisTimerHigh, 
+                             *property );
+      }
+  
+    else if( KNSmlDMVCC_DmConRef() == lastUriSeg )
+      {
+      TPtrC8 conRefUri = NSmlDmURI::RemoveLastSeg(aURI);
+      TPtrC8 lastConRefSeg = NSmlDmURI::LastURISeg(conRefUri);
+      composeResult = EFalse;  
+      if(KNSmlDMVCC_VoipServiceId() == lastConRefSeg )
+            {
+            // Voip ConRef
+            retValue= FetchVoipConRefL(aURI, aResult);
+            
+            }
+      else
+            {
+             retValue = CSmlDmAdapter::ENotFound;
+            } 
+      }
+    else if ( KNSmlDMVCC_DtAllowedWhenCsOriginated() == lastUriSeg )
+        {
+        RUBY_DEBUG0( "- DT allowed when CS originated" );
+        err = iVCCSettings->FindPropertyL( serviceId, 
+                             ESubPropertyVccDtAllowedWhenCsOriginated,
+                             *property );
+        }
+    else
+      {
+      RUBY_DEBUG0( "- Invalid object" );
+      retValue = CSmlDmAdapter::EInvalidObject;
+      }
+    
+    if ( KErrNone == err && composeResult )
+      {
+      RUBY_DEBUG0( "- Result handling STARTt" );
+      // Get result from property
+      TBuf<KNSmlDMVCCMaxResultLength> buf;
+      err = property->GetValue( buf );
+      
+      // Insert result into result buffer
+      TBuf8<KNSmlDMVCCMaxResultLength> buf8;
+      buf8.Append( buf );
+      aResult.InsertL( 0, buf8 );
+      RUBY_DEBUG0( "- Result handling STOP" );
+      }
+    
+    CleanupStack::PopAndDestroy( property );
+      }
+    else
+      {
+      RUBY_DEBUG0( "- Service not found" );
+      // Service not found
+      retValue = CSmlDmAdapter::ENotFound;
+      }
+    
+  if ( KErrNone != err )
+    {
+    RUBY_DEBUG1( "- Other error occurred [%d]", err );
+    // Other error occurred
+    retValue = CSmlDmAdapter::EError;
+    }
+    
+    CleanupStack::PopAndDestroy( entry );
+    
+    return retValue;
+  }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+HBufC* CNSmlDmVCCAdapter::ConvertToUnicodeL( const TDesC8& aSource )
+    {
+    if ( iTempBuf )
+        {
+        delete iTempBuf;
+        iTempBuf = NULL;
+        }
+
+    HBufC* temp = EscapeUtils::ConvertToUnicodeFromUtf8L( aSource );
+    CleanupStack::PushL( temp );
+    iTempBuf = temp->AllocL();
+    CleanupStack::PopAndDestroy( temp );
+    
+    //return static_cast<const TDesC&>(*iTempPtr);
+    return iTempBuf;
+    }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CNSmlDmVCCAdapter::FetchVoipConRefL( const TDesC8& /*aUri*/,
+                                                              CBufBase& aObject )
+	{
+    RUBY_DEBUG_BLOCK( "CNSmlDmVCCAdapter::FetchVoipConRefL" );
+    CSmlDmAdapter::TError status( CSmlDmAdapter::EOk );
+    
+    iVCCSettings->ReadSettingsL( KVccServiceName );
+        
+    // Fetch correct id here
+    RUBY_DEBUG1( "ServiceId=%d", iVCCSettings->VoipServiceId() );
+    CRCSEProfileRegistry* cRCSEProfileRegistry = CRCSEProfileRegistry::NewLC();   // CS: 1
+    RPointerArray<CRCSEProfileEntry> foundEntries;
+    CleanupStack::PushL( TCleanupItem( ResetAndDestroyEntries, &foundEntries ) ); // CS: 2
+        
+    cRCSEProfileRegistry->FindByServiceIdL( (TUint32)iVCCSettings->VoipServiceId(),
+                                           foundEntries );
+    
+    RUBY_DEBUG1( "ProfileCount=%d", foundEntries.Count() );
+    if ( foundEntries.Count() > 0 )
+    	{
+    	RUBY_DEBUG1( "VoipId=%d", foundEntries[0]->iId );
+    	TInt voipId = foundEntries[0]->iId;
+         
+    	CBufBase* result = CBufFlat::NewL( 1 );
+    	CleanupStack::PushL( result );                      // CS: 3
+        
+    	// Request all VoIP identifiers 
+    	Callback().FetchLinkL( KNSmlDMVCC_DmVoipLinkPrefix, *result, status );
+        
+    	if( status == CSmlDmAdapter::EOk )
+        	{
+        	TInt resultSize( result->Size() );
+        	HBufC8* linkList = HBufC8::NewLC( resultSize ); // CS: 4
+        	TPtr8 linkListPtr( linkList->Des() );
+        	TInt numOfUriSegs( KErrNone );
+            
+        	if( resultSize > 0 )
+            	{
+            	linkListPtr.Copy( result->Ptr(0) );
+            	RemoveLastSeparator( linkListPtr );
+            	numOfUriSegs = NSmlDmURI::NumOfURISegs( linkListPtr );
+            	}
+            
+    		// Find correct VoIP profile
+    		while( numOfUriSegs )
+        		{
+        		TBuf8<KNSmlDMVCC_DefaultResultSize> object; 
+                
+        		// Build URI: ./VoIP/<X>/VoIPId
+        		object.Copy( KNSmlDMVCC_DmVoipLinkPrefix );
+        		object.Append( KNSmlDMVCCSeparator );
+        		object.Append( NSmlDmURI::LastURISeg( linkListPtr ) );
+        		object.Append( KNSmlDMVCCSeparator );
+        		object.Append( KNSmlDMVCC_DmVoipId );
+                
+        		// Fetch VoIPId from URI
+        		result->Reset();
+        		Callback().FetchLinkL( object, *result, status );
+                
+        		if( status == CSmlDmAdapter::EOk )
+            		{
+            		// Check if VoIPId match
+            		TLex8 lex( result->Ptr( 0 ) );
+    				TInt voipIdFromVoipAdapter( KErrNotFound );
+    				lex.Val( voipIdFromVoipAdapter );
+                                      
+            		if( voipId == voipIdFromVoipAdapter )
+                		{
+                		aObject.InsertL( 0, NSmlDmURI::RemoveLastSeg( object ) );
+                		break;
+                		}
+            		}
+                
+        		// VoIPId did not match --> continue
+        		linkListPtr.Copy( NSmlDmURI::RemoveLastSeg( linkListPtr ) );
+         
+        		--numOfUriSegs;
+        		}
+            CleanupStack::PopAndDestroy( linkList );        // CS: 3
+        	} 
+        CleanupStack::PopAndDestroy( result );              // CS: 2
+    	}
+	else
+    	{
+    	RUBY_DEBUG0("Profiles not found");
+    	status = CSmlDmAdapter::ENotFound;
+    	}	
+    CleanupStack::PopAndDestroy();							// CS: 1
+    CleanupStack::PopAndDestroy( cRCSEProfileRegistry ); 	// CS: 0
+    return status;
+	}
+
+// -----------------------------------------------------------------------------
+// CNSmlDmVCCAdapter::UpdateVoipConRefL
+// -----------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CNSmlDmVCCAdapter::UpdateVoipConRefL(const TDesC8& /*aUri*/, 
+                                                         const TDesC8& aObject)
+    {
+    RUBY_DEBUG_BLOCK("CNSmlDmVCCAdapter::UpdateVoipConRefL");
+    
+    CSmlDmAdapter::TError status( CSmlDmAdapter::EOk );
+    
+    CBufBase* result = CBufFlat::NewL(1);
+    CleanupStack::PushL(result);			// CS: 1
+
+    // Request all voip settings identifiers 
+    Callback().FetchLinkL(KNSmlDMVCC_DmVoip, *result, status);
+    
+    if( status == CSmlDmAdapter::EOk )
+        {
+        RUBY_DEBUG0("Voip profiles found");
+        // Fetch VoIP profile id
+        TBuf8<KNSmlDMVCC_DefaultResultSize> object;
+        object.Copy( aObject );
+        object.Append( KNSmlDMVCCSeparator );
+        object.Append( KNSmlDMVCC_DmVoipId );
+        
+        result->Reset();
+        Callback().FetchLinkL( object, *result, status );
+        
+        if( status == CSmlDmAdapter::EOk )
+            {
+         	RUBY_DEBUG0("Voip Link fetched ok");
+        
+            // Convert VoipId to ServiceID
+           	CRCSEProfileRegistry* cRCSEProfileRegistry = CRCSEProfileRegistry::NewLC(); // CS: 2
+    	
+    		TInt voipProfileId;
+       		TLex8 temp( result->Ptr( 0 ) );
+        	TInt res = temp.Val(voipProfileId) ;
+    		
+    		RUBY_DEBUG1( "VoipId=%d", voipProfileId );
+    		if (res == KErrNone )
+    			{
+    			CRCSEProfileEntry* foundEntry = CRCSEProfileEntry::NewLC();		// CS: 3 
+    			TRAP( res, cRCSEProfileRegistry->FindL( voipProfileId, *foundEntry ) );
+    	   	
+    			RUBY_DEBUG1( "ServiceId=%d", foundEntry->iServiceProviderId );
+                if (res==KErrNone)
+                	{
+                	// And save
+    				iVCCSettings->SetVoipServiceIdL(foundEntry->iServiceProviderId);
+    			   	}
+    			else
+    				{
+    				RUBY_DEBUG0("Service id not found");
+        			status = CSmlDmAdapter::EError;
+                    }
+            	CleanupStack::PopAndDestroy( foundEntry );						// CS: 2
+    		   	}
+            else
+                {
+                RUBY_DEBUG0("Voip id fetch failed");
+                status = CSmlDmAdapter::EError;
+                }
+    		CleanupStack::PopAndDestroy( cRCSEProfileRegistry );				// CS: 1
+            }
+        else
+            {
+        	RUBY_DEBUG0("Voip link not found");
+            status = CSmlDmAdapter::EError;
+            }
+        }
+    else
+        {
+        RUBY_DEBUG0("Voip profiles not found");
+        status = CSmlDmAdapter::ENotFound;
+        }
+    
+    CleanupStack::PopAndDestroy(result);										// CS: 0
+    return status;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CNSmlDmVCCAdapter::RemoveLastSeparator
+// -----------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::RemoveLastSeparator( TPtr8& aURI )
+    {
+        
+    if( aURI.Length() > 0 )
+    	{
+    	TChar separator( '/' );
+    	TInt lastchar( aURI.Length() - 1 );
+    	
+    	// Check if last character is separator.
+    	if( aURI[lastchar] == separator )
+    		{
+    		// Delete separator.
+    		aURI.Delete( lastchar, 1 );
+    		}
+    	}
+    }
+	
+// -----------------------------------------------------------------------------
+// CNSmlDmVCCAdapter::ResetAndDestroyEntries
+// -----------------------------------------------------------------------------
+//
+void CNSmlDmVCCAdapter::ResetAndDestroyEntries( TAny* anArray )
+	{
+
+    RPointerArray<CRCSEProfileEntry>* array = 
+        reinterpret_cast<RPointerArray<CRCSEProfileEntry>*>( anArray );
+        
+    if (array)
+        {
+        array->ResetAndDestroy();
+        array->Close();
+        }
+	}
+
+//  End of File  
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/nsmldmvccadapter/src/proxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* 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:   ECOM proxy file for nsmldmvccadapter
+*
+*/
+
+
+
+#include    <e32base.h>
+#include    <ecom/implementationproxy.h>
+#include    "nsmldmvccadapter.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 0x2000E5BE, CNSmlDmVCCAdapter::NewL )
+    };
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    //RDebug::Print(_L("SYNCML UMA ADAPTER - ImplementationGroupProxy"));
+    aTableCount = sizeof( ImplementationTable )
+                        / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/nsmldmvccadapter/src/rubydebug.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,164 @@
+/*
+* 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 nsmldmvccadapter
+*
+*/
+
+
+
+#include "rubydebug.h"
+
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#include <f32file.h>
+#endif
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#ifdef _DEBUG // UDEB version:
+_LIT( KSpace, " " );
+_LIT( KColon, ":" );
+_LIT( KFormat, "%02d" );
+_LIT( KFormat2, "%06d" );
+#endif
+#endif
+
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::PrintToFile
+// Method for writing traces to a file.
+// -----------------------------------------------------------------------------
+//
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+
+#ifdef _DEBUG // UDEB version:
+void RRubyDebug::PrintToFile( TRefByValue<const TDesC> aFmt, ... )
+    {
+    _LIT( KRubyLogFileName, "c:\\Data\\Logs\\RubyTrace_vccdmplugin.txt" );
+
+    const TInt KRubyDebugMaxLineLength = 0x84; // rest will be truncated
+
+    const TInt KRubyDebugOpenFileRetries = 100;
+    const TInt KRubyDebugOpenFileInterval = 1000;
+
+    const TUint16 KRubyDebugLineSep1 = 0x0d;
+    const TUint16 KRubyDebugLineSep2 = 0x0a;
+
+    // Handle variable argument list
+    VA_LIST list;
+  VA_START( list, aFmt );
+  TBuf<KRubyDebugMaxLineLength+2> aBuf;
+    TTruncateOverflow overflow;
+    
+    // Append the time...
+    TTime currentTime;
+    currentTime.HomeTime();
+    TDateTime dateTime = currentTime.DateTime();
+
+    aBuf.AppendFormat( KFormat, dateTime.Hour() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat, dateTime.Minute() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat, dateTime.Second() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat2, dateTime.MicroSecond() );
+    aBuf.Append( KSpace );
+    // time done
+    
+  aBuf.AppendFormatList( aFmt, list, &overflow );
+  if( aBuf.Length() > ( KRubyDebugMaxLineLength - 2 ) )
+    {
+    aBuf.Delete(aBuf.Length() - 2, 2);
+    }
+  
+    // Add linefeed characters
+    aBuf.Append( KRubyDebugLineSep1 );
+    aBuf.Append( KRubyDebugLineSep2 );
+
+    RFs fs;
+    if ( fs.Connect() == KErrNone )
+        {
+        RFile file;
+
+        // Open file in an exclusive mode so that only one thread 
+        // can acess it simultaneously
+        TUint fileMode = EFileWrite | EFileShareExclusive;
+
+        TInt err = file.Open( fs, KRubyLogFileName, fileMode );
+
+        // Create a file if it doesn't exist
+        if ( err == KErrNotFound )
+            {
+            err = file.Create( fs, KRubyLogFileName, fileMode );
+            }
+        else
+            {
+            // Error in opening the file
+            TInt retryCount = KRubyDebugOpenFileRetries;
+            while ( err == KErrInUse && retryCount-- )
+                {
+                // Some other tread is accessing the file, wait a while...
+                User::After( KRubyDebugOpenFileInterval );
+                err = file.Open( fs, KRubyLogFileName, fileMode );
+                }
+            }
+
+        // Check if we have access to a file
+        if ( err == KErrNone )
+            {
+            TInt offset = 0;
+            if ( file.Seek( ESeekEnd, offset ) == KErrNone )
+                {
+                // Append text to the end of file
+                TPtr8 ptr8( (TUint8*)aBuf.Ptr(), aBuf.Size(), aBuf.Size() );
+                file.Write( ptr8 );
+                }
+            file.Close();
+            }
+
+        fs.Close();
+        }
+    }
+
+#else // UREL version:
+void RRubyDebug::PrintToFile( TRefByValue<const TDesC> /*aFmt*/, ... )
+    {
+    }
+#endif
+
+#endif // __RUBY_DEBUG_TRACES_TO_FILE
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/rom/vcc.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* 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:   Call Continuity ROM definition file.
+*
+*/
+
+
+
+#ifndef VCC_IBY
+#define VCC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+file=ABI_DIR/BUILD_DIR/vccutils.dll 			SHARED_LIB_DIR/vccutils.dll
+// Stub sis
+data=ZSYSTEM/install/vcc_stub.sis 			System/Install/vcc_stub.sis
+
+// wpvccprovisioning
+ECOM_PLUGIN(wpvccadapter.dll,wpvccadapter.rsc)
+
+// nsmldmvccadapter
+ECOM_PLUGIN(nsmldmvccadapter.dll,nsmldmvccadapter.rsc)
+
+// vcchotrigger
+file=ABI_DIR/BUILD_DIR/vcchotrigger.dll        		SHARED_LIB_DIR/vcchotrigger.dll
+
+ECOM_PLUGIN( vccperformer.dll, vccperformer.rsc )
+
+file=ABI_DIR/BUILD_DIR/vccuipropertyhandler.dll     	SHARED_LIB_DIR/vccuipropertyhandler.dll
+
+#endif // VCC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/rom/vccresources.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Call Continuity ROM variant definition file.
+*
+*/
+
+
+#ifndef VCCRESOURCES_IBY
+#define VCCRESOURCES_IBY
+
+// wpvccprovisioning
+data=DATAZ_/RESOURCE_FILES_DIR/wpvccadapterrsc.rsc    RESOURCE_FILES_DIR/wpvccadapterrsc.rsc
+
+#endif // VCCRESOURCES_IBY
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/settingsreader/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* 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:   Build information file for project ?myapp
+*
+*/
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+//../internal/tsrc/group/ut_settingsreadertest.mmp
+
+GNUMAKEFILE test_mover.make
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/settingsreader/group/test_mover.make	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,5 @@
+FINAL :
+	echo Copying test DLL to z\sys\bin
+	copy %epocroot%epoc32\release\winscw\udeb\ut_settingsreadertest.dll %epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES CLEAN BLD SAVESPACE :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/settingsreader/inc/rubydebug.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,272 @@
+/*
+* 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 of debugging utilities.
+*      %version: 3 %
+*
+*/
+
+
+
+#ifndef RUBYDEBUG_H
+#define RUBYDEBUG_H
+
+#include "rubydebugcfg.h"
+
+//  INCLUDES
+#include <e32svr.h> // For RDebug
+
+#ifndef RUBY_DISABLE_FUNCTION_NAMES
+    // No sense to store function name longer, than can be printed
+    // 0x100 is the internal RDebug limit
+    const TInt __K_RUBY_FUNCTION_NAME_LENGTH = 0x50;
+
+    // Prepares function name for printing
+    #define __RUBY_PREPARE_FUNCTION_NAME \
+    TBuf<__K_RUBY_FUNCTION_NAME_LENGTH> __ruby_function_name__;\
+    __ruby_function_name__.Copy( TPtrC8( (TText8*)&__PRETTY_FUNCTION__ ).Left( __K_RUBY_FUNCTION_NAME_LENGTH ) ); \
+
+    // Token to paste the function name into
+    #define __K_RUBY_FUNCTION_NAME_TOKEN "%S "
+
+    // Comma and function name
+    #define __RUBY_FUNCTION_NAME __ruby_function_name__
+
+    // A wrapper that prepares and supplies the function name as __ruby_function_name__
+    #define __RUBY_FUNCTION_NAMED( text ) \
+        {\
+        __RUBY_PREPARE_FUNCTION_NAME;\
+        text;\
+        }
+
+    #define __RUBY_FUNCTION_NAME_POINTER8 (TText8*)&__PRETTY_FUNCTION__
+
+
+#else  // RUBY_DISABLE_FUNCTION_NAMES
+
+    #define __RUBY_PREPARE_FUNCTION_NAME
+
+    // Don't print the function name
+    #define __K_RUBY_FUNCTION_NAME_TOKEN ""
+
+    // exclude the whole token, with the comma
+    #define __RUBY_FUNCTION_NAME KNullDesC
+
+    // no wrapping
+    #define __RUBY_FUNCTION_NAMED( text ) text
+
+    #define __RUBY_FUNCTION_NAME_POINTER8 NULL
+
+#endif // RUBY_DISABLE_FUNCTION_NAMES
+
+// Macro for printing filename both in unicode and non-unicode builds
+
+
+#ifdef _UNICODE
+    #define __RUBY_WIDEN2(x) L ## x
+    #define __RUBY_WIDEN(x) __RUBY_WIDEN2(x)
+    #define __RUBY_DBG_FILE__ __RUBY_WIDEN(__FILE__)
+#else
+    #define __RUBY_DBG_FILE__ __FILE__
+#endif//_UNICODE
+
+
+
+// Debugging is enabled only in _DEBUG builds
+//#ifdef _DEBUG
+
+// Select the debug output method
+#ifndef __RUBY_DEBUG_TRACES_TO_FILE
+#define RUBY_DEBUG_METHOD RDebug::Print
+#else
+#define RUBY_DEBUG_METHOD RRubyDebug::PrintToFile
+#endif // __RUBY_DEBUG_TRACES_TO_FILE
+
+//#endif // _DEBUG
+
+#if defined(_DEBUG) && !defined(__RUBY_DEBUG_DISABLED)
+
+//  #define RUBY_DEBUG_BLOCK(text) \
+//      RRubyDebug trace_trace( _S(text), _S("" ## __RUBY_DBG_FILE__) , __LINE__, EFalse ); \
+//      CleanupReleasePushL( trace_trace )
+
+//      #define RUBY_DEBUG_BLOCKL(text) \
+//      RRubyDebug trace_trace( _S(text), _S("" ## __RUBY_DBG_FILE__), __LINE__, ETrue ); \
+//      CleanupReleasePushL( trace_trace )
+// A temporary fix to cope with builds on RVCT 530. It didn't compile with _RUBY_DBG_FILE
+    #define RUBY_DEBUG_BLOCK(text) \
+    RRubyDebug trace_trace( _S(text), _S("") , __LINE__, EFalse, __RUBY_FUNCTION_NAME_POINTER8 ); \
+    CleanupReleasePushL( trace_trace )
+
+    #define RUBY_DEBUG_BLOCKL(text) \
+    RRubyDebug trace_trace( _S(text), _S(""), __LINE__, ETrue, __RUBY_FUNCTION_NAME_POINTER8 ); \
+    CleanupReleasePushL( trace_trace )
+
+    #define RUBY_DEBUG0(text) \
+        __RUBY_FUNCTION_NAMED( RUBY_DEBUG_METHOD( _L("%S %S "L##text L## " [F:%s][L:%d][TId:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, __RUBY_DBG_FILE__, __LINE__, TUint(RThread().Id()) ) )
+
+    #define RUBY_DEBUG1(text, p1) \
+        __RUBY_FUNCTION_NAMED( RUBY_DEBUG_METHOD( _L("%S %S "L##text L## " [F:%s][L:%d][TId:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, p1, __RUBY_DBG_FILE__, __LINE__, TUint(RThread().Id()) ) )
+
+    #define RUBY_DEBUG2(text, p1, p2) \
+        __RUBY_FUNCTION_NAMED( RUBY_DEBUG_METHOD( _L("%S %S "L##text L## " [F:%s][L:%d][TId:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, p1, p2, __RUBY_DBG_FILE__, __LINE__, TUint(RThread().Id()) ) )
+
+#else // Debugging disabled
+
+    // Macros expand to nothing:
+    #define RUBY_DEBUG_BLOCK(text)
+    #define RUBY_DEBUG0(text)
+    #define RUBY_DEBUG1(text, p1)
+    #define RUBY_DEBUG2(text, p1, p2)
+    #define RUBY_DEBUG_BLOCKL(text)
+
+#endif // defined(_DEBUG) && !defined(__RUBY_DEBUG_DISABLED)
+
+#if !defined(RUBY_DISABLE_ERRORS) || defined(_DEBUG)
+    // if error messages are allowed (even for UREL)
+    #define RUBY_ERROR0(text) \
+    __RUBY_FUNCTION_NAMED( \
+        RUBY_DEBUG_METHOD( _L("%S[Error!] %S "L##text L## " [F:%s][L:%d][TId:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, __RUBY_DBG_FILE__, __LINE__, TUint(RThread().Id()) )\
+    )
+
+    #define RUBY_ERROR1(text, p1) \
+    __RUBY_FUNCTION_NAMED( \
+    RUBY_DEBUG_METHOD( _L("%S[Error!] %S "L##text L## " [F:%s][L:%d][TId:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, p1, __RUBY_DBG_FILE__, __LINE__, TUint(RThread().Id()) )\
+    )
+
+    #define RUBY_ERROR2(text, p1, p2) \
+    __RUBY_FUNCTION_NAMED( \
+    RUBY_DEBUG_METHOD( _L("%S[Error!] %S "L##text L## " [F:%s][L:%d][TId:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, p1, p2, __RUBY_DBG_FILE__, __LINE__, TUint(RThread().Id()) )\
+    )
+#else
+    // error reporting disabled
+    // Macros expand to nothing:
+    #define RUBY_ERROR_BLOCK(text)
+    #define RUBY_ERROR0(text)
+    #define RUBY_ERROR1(text, p1)
+    #define RUBY_ERROR2(text, p1, p2)
+#endif  // !defined(RUBY_DISABLE_ERRORS)
+
+#if !defined(RUBY_DISABLE_ASSERT_DEBUG) || defined(_DEBUG)
+    #define RUBY_ASSERT_DEBUG(condition, action) \
+      __RUBY_FUNCTION_NAMED(\
+        __ASSERT_ALWAYS( condition, RUBY_DEBUG_METHOD(  _L("%S[Error!] %S [Assert failed!] "L###condition L## " [F:%s][L:%d][TId:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, __RUBY_DBG_FILE__, __LINE__, TUint(RThread().Id())) ); \
+        __ASSERT_DEBUG( (condition), (action) )\
+      );
+#else
+    // Macro expands to default:
+    #define RUBY_ASSERT_DEBUG(condition, action) __ASSERT_DEBUG(condition,action)
+#endif
+
+// Same as TRAP_IGNORE, but in case of leave, prints the leave code via RUBY_ERROR
+// Can be disabled by RUBY_DISABLE_TRAP_IGNORE or RUBY_DISABLE_ERRORS
+// If disabled, is equivalent to TRAP_IGNORE
+// @see rubydebugcfg.h
+#ifndef RUBY_DISABLE_TRAP_IGNORE
+    #define RUBY_TRAP_IGNORE( s ) \
+        {\
+        TRAPD( err, s );\
+        if( err != KErrNone )\
+            {\
+            RUBY_ERROR1( "RUBY_TRAP_IGNORE leaves with [%d]", err );\
+            }\
+        }
+#else  // RUBY_DISABLE_TRAP_IGNORE
+    #define RUBY_TRAP_IGNORE( s ) TRAP_IGNORE( s )
+#endif  // RUBY_DISABLE_TRAP_IGNORE
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Debug class for printing START, EXIT and LEAVE messages to RDebug in every
+*  code block. Must be placed in the very beginning of a code block and the
+*  code block cannot leave items in the cleanup stack (like NewLC).
+*
+*  @since Series 60 2.8
+*
+*  @note If this object is not the topmost item when a code block is exited,
+*        E32USER-CBase 90 panic is raised (@see CleanupStack::Pop( TAny* )).
+*/
+class RRubyDebug
+    {
+    public:
+        /**
+        * C++ constructor.
+        * @since Series 60 2.8
+        * @param aMsg Debug message.
+        * @param aCalledFromL ETrue if called from RUBY_DEBUG_BLOCK_L
+        */
+        inline RRubyDebug( const TText* aMsg, const TText* aFileName, const TInt aLine, TBool aCalledFromL,
+                           const TText8* aFunctionName = NULL );
+
+        /**
+        * Destructor.
+        */
+        inline ~RRubyDebug();
+
+        /**
+        * Destructor for Cleanup support. Called when a method leaves.
+        */
+        inline void Release();
+
+        /**
+        * Support for writing traces to file.
+        */
+         static void PrintToFile( TRefByValue<const TDesC> aFmt, ... );
+
+    private:
+        /**
+        *  Class for truncating debug messages if they are too long.
+        *  @since Series 60 2.8
+        */
+        class TTruncateOverflow : public TDesOverflow
+            {
+            public: // Methods from TDesOverflow
+
+                inline void Overflow( TDes& aDes );
+            };
+
+    private:
+        // A pointer to the debug message
+        TPtrC iMsg;
+
+        // A pointer to the filename where RUBY_DEBUG_BLOCK is written
+        TPtrC iFileName;
+
+        // Number of the line where RUBY_DEBUG_BLOCK is written
+        TInt iLine;
+
+        // ETrue if we are called from RUBY_DEBUG_BLOCKL
+        TBool iCalledFromL;
+
+        // Flag that is set when a leave occurs
+        TBool iLeave;
+
+    #ifndef RUBY_DISABLE_FUNCTION_NAMES
+        // Used only if aFunctionName is defined in constructor
+        HBufC* iFunctionName;
+    #endif  // RUBY_DISABLE_FUNCTION_NAMES
+
+    };
+
+#include "RubyDebug.inl"
+
+#endif      // RUBYDEBUG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/settingsreader/inc/rubydebug.inl	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,149 @@
+/*
+* 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:   This module contains the implementation of RRubyDebug class 
+*	             member functions.
+*  %version: 3 %
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32base.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+#ifdef _DEBUG
+_LIT( KRubyDebugStart,  "START" );
+_LIT( KRubyDebugStop,   "EXIT" );
+_LIT( KRubyDebugLeave,  "LEAVE!!!" );
+_LIT( KRubyDebugStr,    "%S%S %S [F:%S][L:%d][TId:%d]" );
+#endif
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+#ifdef _DEBUG
+// -----------------------------------------------------------------------------
+// RRubyDebug::RRubyDebug
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+    
+inline RRubyDebug::RRubyDebug( const TText* aMsg, const TText* aFileName, const TInt aLine, TBool aCalledFromL,
+                               const TText8* aFunctionName )
+	: iMsg( aMsg ), iFileName( aFileName ), iLine ( aLine ), iCalledFromL ( aCalledFromL ), iLeave ( EFalse )
+	{
+	#ifndef RUBY_DISABLE_FUNCTION_NAMES
+	iFunctionName = NULL;
+	// If function name is defined, use it instead of aMsg
+	if( aFunctionName )
+	    {
+	    TPtrC8 ptr8Name( aFunctionName );
+	    iFunctionName = HBufC::New( ptr8Name.Length() );
+	    if( iFunctionName )
+	        {
+	        // If memory for a 16-bit copy has been allocated successfully
+	        iFunctionName->Des().Copy( ptr8Name );
+	        iMsg.Set( *iFunctionName );
+	        }
+	    }
+	#endif // RUBY_DISABLE_FUNCTION_NAMES
+	TInt id = RThread().Id();
+    iCalledFromL = aCalledFromL;  
+    if( !iCalledFromL) 
+    	{
+    	RUBY_DEBUG_METHOD( KRubyDebugStr, &__K_RUBY_HEADER, &iMsg, &KRubyDebugStart, &iFileName, iLine, id );
+    	}
+    else {
+    	#ifdef RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+    	// For BLOCKLs show this message only if RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+    	RUBY_DEBUG_METHOD( KRubyDebugStr, &__K_RUBY_HEADER, &iMsg, &KRubyDebugStart, &iFileName, iLine, id );
+    	#endif
+    	}
+	}    
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::~RRubyDebug
+// Destructor
+// -----------------------------------------------------------------------------
+//
+inline RRubyDebug::~RRubyDebug()
+    {
+    if ( !iLeave ) 
+        {
+        // This is done only if destructor is NOT called from Release().
+        // Otherwise the cleanup stack pops this item automatically.
+        TInt id = RThread().Id();
+        if (!iCalledFromL) 
+        	{
+        	RUBY_DEBUG_METHOD( KRubyDebugStr, &__K_RUBY_HEADER, &iMsg, &KRubyDebugStop, &iFileName, iLine, id );
+        	}
+        else
+        	{
+        	#ifdef RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+    		// For BLOCKLs show this message only if RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+    		RUBY_DEBUG_METHOD( KRubyDebugStr, &KRubyDebugPrefix, &iMsg, &KRubyDebugStop, &iFileName, iLine, id );
+    		#endif
+        	}
+        #ifndef RUBY_DISABLE_FUNCTION_NAMES
+        delete iFunctionName;  // if any
+        #endif  // RUBY_DISABLE_FUNCTION_NAMES
+        CleanupStack::Pop( this ); // E32USER-CBase 90 panic is raised if
+                                   // this is not the topmost item
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::Release()
+// Method that makes it possible to push this object into the cleanup stack.
+// -----------------------------------------------------------------------------
+//
+inline void RRubyDebug::Release()
+    {
+    iLeave = ETrue;
+    TInt id = RThread().Id();
+    RUBY_DEBUG_METHOD( KRubyDebugStr, &__K_RUBY_HEADER, &iMsg, &KRubyDebugLeave, &iFileName, iLine, id );
+    #ifndef RUBY_DISABLE_FUNCTION_NAMES
+    delete iFunctionName;  // if any
+    #endif  // RUBY_DISABLE_FUNCTION_NAMES
+    this->~RRubyDebug();
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::TTruncateOverflow::Overflow()
+// Method for ignoring the overflowing part of a debug message.
+// -----------------------------------------------------------------------------
+//
+inline void RRubyDebug::TTruncateOverflow::Overflow( TDes& /*aDes*/ )
+    {
+    // We ignore the overflowing part of the descriptor...
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/settingsreader/inc/rubydebugcfg.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* 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:   Configuration file for RubyDebug macros
+*  %version: 3 %
+*
+*/
+
+
+
+#ifndef RUBYDEBUGCFG_H
+#define RUBYDEBUGCFG_H
+
+
+#include <e32cmn.h> // TLitC
+#include <e32def.h> // _LIT
+
+#include "rubydebugconfigselector.h"
+
+// Common settings
+// Is printed at the beginning of the line
+_LIT( __K_RUBY_HEADER, "[<VCC>] ");
+
+// Is printed after __KRUBY_HEADER for the error messages
+_LIT( __K_RUBY_ERROR, "[Error!] ");
+
+
+#if defined(RUBY_EXTERNAL_VARIANT) && defined(__WINS__)
+// set of options to use when the project is released to the customers
+
+// Uncomment the following line to disable RUBY_DEBUGs.
+// This has no effect on RUBY_ERRORs
+//#define __RUBY_DEBUG_DISABLED
+
+// Uncomment the following line to get traces to C:\Logs\RubyTrace.log
+//#define __RUBY_DEBUG_TRACES_TO_FILE
+
+// Uncomment the following line to stop disable RUBY_ERRORs
+// Error print is always enabled in _DEBUG
+//#define RUBY_DISABLE_ERRORS
+
+// Uncomment the following line to disable extra output for RUBY_ASSERT_DEBUG
+// RUBY_ASSERT_DEBUGs will become usual __ASSERT_DEBUGs
+#define RUBY_DISABLE_ASSERT_DEBUG
+
+// Uncomment the following line to disable automated function name printing
+//#define RUBY_DISABLE_FUNCTION_NAMES
+
+//#define RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+
+// Uncomment the following line to disable leave code printing in RUBY_TRAP_IGNORE
+// macro. It would make it equivalent to TRAP_IGNORE
+// #define RUBY_DISABLE_TRAP_IGNORE
+
+
+#else //  RUBY_EXTERNAL_VARIANT
+// set of options to use in the internal development
+
+// Uncomment the following line to disable RUBY_DEBUGs.
+// This has no effect on RUBY_ERRORs
+//#define __RUBY_DEBUG_DISABLED
+
+// Uncomment the following line to get traces to file defined in rubydegu.cpp
+#define __RUBY_DEBUG_TRACES_TO_FILE
+
+// Uncomment the following line to stop disable RUBY_ERRORs
+// Error print is always enabled in _DEBUG
+#define RUBY_DISABLE_ERRORS
+
+// Uncomment the following line to disable extra output for RUBY_ASSERT_DEBUG
+// RUBY_ASSERT_DEBUGs will become usual __ASSERT_DEBUGs
+#define RUBY_DISABLE_ASSERT_DEBUG
+
+// Uncomment the following line to disable automated function name printing
+//#define RUBY_DISABLE_FUNCTION_NAMES
+
+//#define RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+
+// Uncomment the following line to disable leave code printing in RUBY_TRAP_IGNORE
+// macro. It would make it equivalent to TRAP_IGNORE
+// #define RUBY_DISABLE_TRAP_IGNORE
+
+#endif  //  RUBY_EXTERNAL_VARIANT
+
+#endif // RUBYDEBUGCFG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/settingsreader/inc/rubydebugconfigselector.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   Switches sets of the RubyDebug options. 
+*                @warning DO NOT change the file. At least DO NOT check in the modified version.
+*                Variants should be switched by replacing the whole rubydebugconfigselector.h 
+*                with the help of a Synergy task. 
+*  %version: 3 %
+*
+*/
+
+
+
+#ifndef RUBYDEBUGCONFIGSELECTOR_H
+#define RUBYDEBUGCONFIGSELECTOR_H
+
+
+// CONSTANTS
+
+/** 
+ * If defined, rubydebug will be tuned with a set of options designed for external users
+ * Typically it means showing all the warnings for hardware builds and only errors for the
+ * SW builds
+ *
+ * If not defined, rubydebug will be tuned for the internal Multimodal UI team development.
+ * Typically it means all the warnings always enabled
+ *
+ * The meaning of the variant is defined in the rubydebugcfg.h
+ * @warning DO NOT change the line. At least DO NOT check in the modified version.
+ *          Variants should be switched by replacing the whole rubydebugconfigselector.h 
+ *          with the help of a Synergy task. 
+ *
+ */
+//#define RUBY_EXTERNAL_VARIANT
+
+#endif // RUBYDEBUGCONFIGSELECTOR_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/settingsreader/inc/vccsettingsreader.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 the vccsettingsreader class.
+*
+*/
+
+
+
+
+#ifndef VCCSETTINGSREADER_H
+#define VCCSETTINGSREADER_H
+
+#include <e32base.h>
+#include <spdefinitions.h>
+#include <e32cmn.h>
+
+class CSPSettings;
+class CSPProperty;
+
+/**
+ *  Defines settings reader for VCC
+ *
+ *  @code
+ *   HBufC* domainNumber;
+ *      
+ *   domainNumber = VccSettingsReader::DomainTransferNumber();
+ *   if ( domainNumber->Length() > 0 )
+ *       {
+ *       // Number found, use it
+ *       DoSomethingWithTheNumber( domainNumber );
+ *       }
+ * 
+ *  delete domainNumber;
+ *  ----
+ * 
+ *   HBufC* domainUri;
+ * 
+ *   domainUri = VccSettingsReader::DomainTransferUriL();
+ *   if ( domainUri->Length() > 0 )
+ *       {
+ *       // Uri found, make a call using it
+ *       CallUsingUriL( domainUri );
+ *       }
+ *   
+ *   delete domainUri;
+ *   ---
+ *   TInt csServiceId = VccSettingsReader::CSServiceIdL();
+ *   MakeCSCallL( csServiceId );
+ *   ---
+ *   TInt voipServiceId = VccSettingsReader::VoIPServiceIdL();
+ *   OpenVoIPCallL( voipServiceId );
+ * 
+ *   // Get the voip service id which is vcc enabled and
+ *   // start that service so the use can do handover using
+ *   // that voip service.
+ * 
+ *   TInt vccEnabledVoipId = VccSettingsReader::VoIPServiceIdL();
+ * 
+ *   EnableVoipServiceUsingVccEnabledVoip( vccEnabledVoipId );
+ *   
+ *  @endcode
+ *
+ *  @since S60 v3.2
+ */
+class VccSettingsReader
+ {
+ public:
+
+    /**
+     * Gets the domain transfer number (VDN) from settings
+     * Note that the caller must destroy the object returned
+     * The method leaves if underlying SPSettings leave.
+     * The caller should check if the returned object has length > 0
+     * meaning something was found.
+     * 
+     * @since S60 v3.2
+     * @return Pointer to the buffer containing the VDN. If length
+     * of the returned buffer is zero, VDN was not found.
+     */
+     static HBufC* DomainTransferNumberL();
+
+    /**
+     * Gets the domain transfer URI (VDI) from settings
+     * Note that the caller must destroy the object returned
+     * The method leaves if SPSettings leave.
+     * 
+     * @since S60 v3.2
+     * @return Pointer to the buffer containing the VDI. If length
+     * of the returned buffer is zero, VDI was not found.
+     */
+     static HBufC* DomainTransferUriL();
+
+     /**
+      * Gets the CS service id from the SP-settings table
+      * by searching an entry which has name "CS"
+      * The method leaves if SPSettings leave.
+      * 
+      * @since S60 v3.2
+      * @return Service id if entry is found, otherwise KErrNotFound
+      */     
+     static TInt CSServiceIdL();
+     
+     /**
+      * Gets the VoIP service id from the SP-settings table
+      * The method leaves if SPSettings leave.
+      * The VoIP service id is get from the VCC service (VCC settings
+      * will get the VoIP service id when settings are saved into SP settings
+      * table).
+      * 
+      * @since S60 v3.2
+      * @return Service id if entry is found, otherwise KErrNotFound
+      */     
+     static TInt VoIPServiceIdL();
+     
+     /**
+      * Gets the VCC service id from the SP-settings table
+      * The method leaves if SPSettings leave.
+      * 
+      * @since S60 v3.2
+      * @return Service id if entry is found, otherwise KErrNotFound
+      */     
+     static TInt VccSettingsReader::VccServiceIdL();
+     
+     /**
+      * Gets service id that is mapped for the specified VCC call provider 
+      * plugin from the SP-settings table 
+      * 
+      * The method leaves if SPSettings leave.
+      * 
+      * @since S60 v3.2
+      * @return Service id if entry is found, otherwise KErrNotFound
+      */     
+     static TInt VccSettingsReader::ServiceIdL( TInt aCallProviderPluginUid );
+private:
+
+    /**
+     * Gets property value from SP settings
+     *
+     * @since S60 v3.2
+     * @param aPropertyName Name of the property
+     * @return A pointer to the buffer containing fetched value.
+     * Note that the caller must destroy the object returned
+     */
+    static HBufC* PropertyValueByNameL( TServicePropertyName aPropertyName );
+
+    /**
+     * Gets the service id of given entry name
+     *
+     * @since S60 v3.2
+     * @param aEntryName The name of the entry, e.g. "CS","VCC".
+     * @return Service id if the entry was found, otherwise KErrNotFound
+     */
+    static TInt ServiceIdByNameL( const TDesC& aEntryName );
+
+    /**
+     * Gets the VoIP service id from the SP-settings table
+     * The method leaves if SPSettings leave.
+     * The VoIP service id is get from the VCC service (VCC settings
+     * will get the VoIP service id when settings are saved into SP settings
+     * table).
+     * 
+     * @since S60 v3.2
+     * @param aPropertyName The name of VCC property holding VoIP service id.
+     * @return Service id if property is found, otherwise KErrNotFound
+     */          
+    static TInt DoVoIPServiceIdL( TServicePropertyName aPropertyName );
+    
+    /**
+     * Gets service ids where property is same as given.
+     * 
+     * @since S60 v3.2
+     * @param aServiceIds Array which is filled with service ids
+     * @param aPropertyName The name of the property
+     */              
+    static void GetServiceIdsByPropertyNameL(
+            RIdArray& aServiceIds,
+            TServicePropertyName aPropertyName );
+    
+    
+    // No copy, assigment or creation of this class.
+    
+    /**
+     * Assigment operator
+     * 
+     * @since S60 v3.2
+     */
+    VccSettingsReader& operator = ( const VccSettingsReader& );
+    
+    /**
+     * Default C++ constructor
+     * 
+     * @since S60 v3.2
+     */
+    VccSettingsReader();
+    
+    
+    /**
+     * Copy constructor
+     * 
+     * @since S60 v3.2
+     */
+    VccSettingsReader( const VccSettingsReader& );
+    
+ };
+
+#endif // VCCSETTINGSREADER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/settingsreader/src/rubydebug.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,137 @@
+/*
+* 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:   Debugging utilities implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "RubyDebug.h"
+
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#include <f32file.h>
+#endif
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::PrintToFile
+// Method for writing traces to a file.
+// -----------------------------------------------------------------------------
+//
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+
+#ifdef _DEBUG // UDEB version:
+ void RRubyDebug::PrintToFile( TRefByValue<const TDesC> aFmt, ... )
+    {
+    _LIT( KRubyLogFileName, "c:\\Data\\Logs\\vccsettingsreader.log" );
+
+    const TInt KRubyDebugMaxLineLength = 0x80; // rest will be truncated
+
+    const TInt KRubyDebugOpenFileRetries = 100;
+    const TInt KRubyDebugOpenFileInterval = 1000;
+
+    const TUint16 KRubyDebugLineSep1 = 0x0d;
+    const TUint16 KRubyDebugLineSep2 = 0x0a;
+
+    // Handle variable argument list
+    VA_LIST list;
+    VA_START( list, aFmt );
+    TBuf<KRubyDebugMaxLineLength+2> aBuf;
+    TTruncateOverflow overflow;
+    aBuf.AppendFormatList( aFmt, list, &overflow );
+    if( aBuf.Length() > ( KRubyDebugMaxLineLength - 2 ) )
+        {
+        aBuf.Delete(aBuf.Length() - 2, 2);
+        }
+
+    // Add linefeed characters
+    aBuf.Append( KRubyDebugLineSep1 );
+    aBuf.Append( KRubyDebugLineSep2 );
+
+    RFs fs;
+    if ( fs.Connect() == KErrNone )
+        {
+        RFile file;
+
+        // Open file in an exclusive mode so that only one thread
+        // can acess it simultaneously
+        TUint fileMode = EFileWrite | EFileShareExclusive;
+
+        TInt err = file.Open( fs, KRubyLogFileName, fileMode );
+
+        // Create a file if it doesn't exist
+        if ( err == KErrNotFound )
+            {
+            err = file.Create( fs, KRubyLogFileName, fileMode );
+            }
+        else
+            {
+            // Error in opening the file
+            TInt retryCount = KRubyDebugOpenFileRetries;
+            while ( err == KErrInUse && retryCount-- )
+                {
+                // Some other tread is accessing the file, wait a while...
+                User::After( KRubyDebugOpenFileInterval );
+                err = file.Open( fs, KRubyLogFileName, fileMode );
+                }
+            }
+
+        // Check if we have access to a file
+        if ( err == KErrNone )
+            {
+            TInt offset = 0;
+            if ( file.Seek( ESeekEnd, offset ) == KErrNone )
+                {
+                // Append text to the end of file
+                TPtr8 ptr8( (TUint8*)aBuf.Ptr(), aBuf.Size(), aBuf.Size() );
+                file.Write( ptr8 );
+                }
+            file.Close();
+            }
+
+        fs.Close();
+        }
+    }
+
+#else // UREL version:
+ void RRubyDebug::PrintToFile( TRefByValue<const TDesC> /*aFmt*/, ... )
+    {
+    }
+#endif
+
+#endif // __RUBY_DEBUG_TRACES_TO_FILE
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/settingsreader/src/vccsettingsreader.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 VCC setting reader
+*
+*/
+
+
+
+#include <spsettings.h>
+#include <spproperty.h>
+#include <spdefinitions.h>
+#include <spentry.h>
+
+#include "vccsettingsreader.h"
+#include "vccdefinitions.h"
+
+#include "rubydebug.h"
+
+// CS Service Entry name in SP settings table
+_LIT( KCSEntryName, "CS" );
+
+
+// ---------------------------------------------------------------------------
+// Returns the domain transfer number from sp settings
+// ---------------------------------------------------------------------------
+//
+HBufC* VccSettingsReader::DomainTransferNumberL()
+    {
+    RUBY_DEBUG_BLOCK( "VccSettingsReader::GetDomainTransferNumberL" );
+
+    return VccSettingsReader::PropertyValueByNameL( ESubPropertyVccVDN );
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the domain transfer URI from sp settings
+// ---------------------------------------------------------------------------
+//
+HBufC* VccSettingsReader::DomainTransferUriL()
+    {
+    RUBY_DEBUG_BLOCK( "VccSettingsReader::GetDomainTransferUriL" );
+
+    return VccSettingsReader::PropertyValueByNameL( ESubPropertyVccVDI );
+    }
+
+// ---------------------------------------------------------------------------
+// Returns a VCC property value from SP-settings table by
+// given property name
+// ---------------------------------------------------------------------------
+//
+HBufC* VccSettingsReader::PropertyValueByNameL(
+        TServicePropertyName aPropertyName )
+    {
+    RUBY_DEBUG_BLOCK( "VccSettingsReader::GetValueL" );
+
+    // Create settings object and then the property one
+    CSPSettings* settings = CSPSettings::NewLC();
+
+    CSPProperty* property = CSPProperty::NewLC();
+
+    // First we must find what is our vcc service id in sp-settings table
+    // This is done by searching the vcc entry name.
+    TInt vccServiceId( KErrNone );
+
+     vccServiceId = VccSettingsReader::VccServiceIdL(); 
+    
+    // If the VCC service id was not found, leave.
+    User::LeaveIfError( vccServiceId );
+
+    settings->FindPropertyL( vccServiceId, aPropertyName, *property );
+
+    HBufC* value = HBufC::NewLC( KMaxFileName );
+    TPtr valuePtr = value->Des();
+
+    TInt error = property->GetValue( valuePtr );
+
+    User::LeaveIfError( error );
+
+    // Cleanup and return
+    CleanupStack::Pop( value );
+    CleanupStack::PopAndDestroy( property );
+    CleanupStack::PopAndDestroy( settings );
+
+    RUBY_DEBUG2( "..Value of %d = %S", aPropertyName, value );
+
+    return value;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns service id of the CS service
+// ---------------------------------------------------------------------------
+//
+TInt VccSettingsReader::CSServiceIdL()
+    {
+    RUBY_DEBUG_BLOCK( "VccSettingsReader::CSServiceIdL" );
+
+    // Get the service id by entry name
+    return VccSettingsReader::ServiceIdByNameL( KCSEntryName );
+    }
+
+// ---------------------------------------------------------------------------
+// Returns service id of the VoIP service
+// ---------------------------------------------------------------------------
+//
+TInt VccSettingsReader::VoIPServiceIdL()
+    {
+    RUBY_DEBUG_BLOCK( "VccSettingsReader::VoIPServiceIdL" );
+
+    // Get the VoIP service id.
+    return VccSettingsReader::DoVoIPServiceIdL(
+                    ESubPropertyVccDtVoipServiceId );
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the id of VCC enabled VoIP service.
+// ---------------------------------------------------------------------------
+//
+TInt VccSettingsReader::DoVoIPServiceIdL(
+                TServicePropertyName aPropertyName )
+    {
+    RUBY_DEBUG_BLOCK( "VccSettingsReader::DoVoIPServiceIdL" );
+
+    // Create settings object and then the property one
+    CSPSettings* settings = CSPSettings::NewLC();
+
+    CSPProperty* property = CSPProperty::NewLC();
+
+    // First we must find what is our vcc service id in sp-settings table
+    // This is done by searching the vcc entry name.
+
+    TInt vccServiceId( KErrNone );
+
+    vccServiceId = VccSettingsReader::VccServiceIdL();
+    
+    // If the VCC service id was not found, leave.
+    User::LeaveIfError( vccServiceId );
+
+    // Now get the VCC enabled VoIP service id. The id is
+    // saved into VCC settings.
+    // First, get the property and then use the property to get its value.
+    settings->FindPropertyL( vccServiceId, aPropertyName, *property );
+
+    TInt voipId;
+    TInt error = property->GetValue( voipId );
+
+    User::LeaveIfError( error );
+
+    // Cleanup and return
+    CleanupStack::PopAndDestroy( property );
+    CleanupStack::PopAndDestroy( settings );
+
+    RUBY_DEBUG2( "..Value of %d = %d", aPropertyName, voipId );
+
+    return voipId;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the service id by given service entry name
+// ---------------------------------------------------------------------------
+//
+TInt VccSettingsReader::ServiceIdByNameL( const TDesC& aEntryName )
+    {
+    RUBY_DEBUG_BLOCK( "VccSettingsReader::ServiceIdL" );
+    RUBY_DEBUG1( "..Entry name to search = %S", &aEntryName );
+
+    //  Array of service provider IDs
+    // is defined as: typedef RArray<TServiceId> RIdArray
+    // in spdefinitions.h
+    RIdArray serviceIdArray;
+
+    // KErrNotFound is the default return value if the entry
+    // is not found.
+    TInt serviceId( KErrNotFound );
+
+    CleanupClosePushL( serviceIdArray );
+
+    CSPSettings* settings = CSPSettings::NewLC();
+
+    TInt error( KErrNone );
+
+    // This should leave if error occurs
+    error = settings->FindServiceIdsL( serviceIdArray );
+
+    User::LeaveIfError( error );
+
+    TBool foundEntry( EFalse );
+
+    for ( TInt i( 0 ); i < serviceIdArray.Count() && !foundEntry; i++ )
+        {
+        CSPEntry* entry = CSPEntry::NewLC();
+        error = settings->FindEntryL( serviceIdArray[i], *entry );
+
+        User::LeaveIfError( error );
+
+        if ( entry->GetServiceName() == aEntryName )
+            {
+            serviceId = entry->GetServiceId();
+            foundEntry = ETrue;
+            }
+
+        CleanupStack::PopAndDestroy( entry );
+        }
+    CleanupStack::PopAndDestroy( settings );
+    CleanupStack::PopAndDestroy( &serviceIdArray );
+
+    RUBY_DEBUG1( "..Service id = %d", serviceId );
+
+    return serviceId;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns service id of the VCC service
+// ---------------------------------------------------------------------------
+//
+TInt VccSettingsReader::VccServiceIdL()
+    {
+    RUBY_DEBUG_BLOCK( "VccSettingsReader::VccServiceIdL" );
+
+    TInt vccServiceId( KErrNone );
+    TInt error( KErrNone );
+    
+    //  Array of service provider IDs
+    // is defined as: typedef RArray<TServiceId> RIdArray
+    // in spdefinitions.h
+    RIdArray serviceIdArray;
+    
+    CleanupClosePushL( serviceIdArray );
+    
+    CSPSettings* settings = CSPSettings::NewLC();
+    
+    // This should leave if error occurs
+    error = settings->FindServiceIdsL( serviceIdArray );
+    
+    User::LeaveIfError( error );
+    
+    TBool foundEntry( EFalse );
+    
+    for ( TInt i( 0 ); i < serviceIdArray.Count() && !foundEntry; i++ )
+          {
+          CSPProperty* property = CSPProperty::NewLC(); 
+          error = settings->FindPropertyL( serviceIdArray[i], ESubPropertyVccVDI, *property ); 
+       
+          if( error == KErrNone )
+              {
+              vccServiceId =  serviceIdArray[i];
+              foundEntry = ETrue;
+              }
+             CleanupStack::PopAndDestroy( property );
+          }
+    CleanupStack::PopAndDestroy( settings );
+    CleanupStack::PopAndDestroy( &serviceIdArray );
+    RUBY_DEBUG1( "VccService id = %d", vccServiceId );
+    
+    return vccServiceId;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns service id VCC should use for specified call provider plugin 
+// ---------------------------------------------------------------------------
+//
+TInt VccSettingsReader::ServiceIdL( TInt aCallProviderPluginUid )
+    {
+    RUBY_DEBUG_BLOCK( "VccSettingsReader::ServiceIdL" );
+    TInt id( KErrNone );
+    
+    switch ( aCallProviderPluginUid )
+    	{
+    	case KVccCallProviderPlugId:
+    		{
+    		id = VccSettingsReader::VccServiceIdL();
+    		}break;
+        case KCSCallProviderPlugId:
+            {
+            id = VccSettingsReader::CSServiceIdL();
+            }break;
+        default:
+            {
+            id = VccSettingsReader::VoIPServiceIdL();
+            }break;
+       	}
+    
+    return id;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/bwins/t_vccu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,2 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * __cdecl CreateTestSuiteL(void)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/bwins/vccperformeru.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+	?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/data/2000CFA9.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,56 @@
+/*
+* 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 VCC
+*
+*/
+
+
+
+//  INCLUDES
+#include <ecom/registryinfov2.rh>
+
+//  RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // use resource format version 2 to enable ROM only plugins
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+
+    dll_uid = 0x2000CFA9;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // CCP interface UID
+            interface_uid = 0x10282588;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    // VCC Plug-in implementation UID
+                    implementation_uid = 0x2000CFAA;
+                    version_no = 1;
+                    display_name = "VCC Plug-in";
+                    default_data = "";
+                    // Note : opaque_data MUST have @ least a single byte of data
+                    // in this instance it is an empty string.
+                    opaque_data = " ";
+                    rom_only = 0; // This is not a ROM only plugin
+                    }
+                // Place additional interface implementations here
+                };
+            }
+        // Place additional interfaces here
+        };
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/eabi/t_vccu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z16CreateTestSuiteLv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   VCC build definition file
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+vcc.mmp
+
+PRJ_EXPORTS
+// Sis stub
+../sis/vcc_stub.SIS         /epoc32/data/z/system/install/vcc_stub.sis
+
+
+PRJ_TESTMMPFILES
+//../internal/test/group/T_VCC.mmp
+GNUMAKEFILE test_mover.make
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/group/test_mover.make	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,5 @@
+FINAL :
+	echo Copying test DLL to z\sys\bin
+	copy %epocroot%epoc32\release\winscw\udeb\t_vcc.dll %epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES CLEAN BLD SAVESPACE :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/group/vcc.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,84 @@
+/*
+* 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:   VCC project file
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+
+TARGET          vccperformer.dll
+TARGETTYPE      PLUGIN
+
+// If automatic handover is wanted,
+// define the macro USE_HO_TRIGGER. When macro is defined
+// The hotrigger will trigger handover about every 20 or 30 sec. The
+// value depends on values defined in wlanstub server, method
+// WaitForNetworkSignalLevelL
+// MACRO USE_HO_TRIGGER
+
+// ECOM Dll recognition UID followed by the unique UID for this dll
+UID    0x10009D8D 0x2000CFA9
+CAPABILITY      CAP_ECOM_PLUGIN NetworkControl NetworkServices ReadDeviceData
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../data
+START RESOURCE  2000CFA9.rss
+TARGET vccperformer.rsc
+END
+
+SOURCEPATH      ../src
+
+SOURCE			cvccproxy.cpp
+SOURCE      cvccdirector.cpp
+SOURCE			cvccperformer.cpp		 
+SOURCE			vccengpspropertylistener.cpp
+SOURCE 			vccengpsproperty.cpp
+SOURCE      rubydebug.cpp
+SOURCE 			cvccconferencecall.cpp
+SOURCE 			cvccdtmfprovider.cpp
+//state machine
+SOURCE			tvccstate.cpp
+SOURCE			tvccstateinit.cpp
+SOURCE			tvccstatecalling.cpp
+SOURCE      tvccstatefailing.cpp
+SOURCE			tvccstatereleasing.cpp
+SOURCE 			cvcctransferprovider.cpp
+
+SOURCEPATH 	../../settingsreader/src
+SOURCE			vccsettingsreader.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE	    ../../settingsreader/inc
+USERINCLUDE	    ../../vcchotrigger/inc
+
+SYSTEMINCLUDE	/epoc32/include/ecom
+
+APP_LAYER_SYSTEMINCLUDE 
+
+LIBRARY         euser.lib
+LIBRARY         flogger.lib             
+LIBRARY         centralrepository.lib
+LIBRARY         estor.lib
+LIBRARY         bafl.lib
+LIBRARY         ecom.lib                
+LIBRARY         efsrv.lib               //rubydebug
+LIBRARY			serviceprovidersettings.lib
+LIBRARY			vcchotrigger.lib
+LIBRARY			cce.lib
+LIBRARY			callprovider.lib
+
+LANG            SC
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/cvccconferencecall.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,206 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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
+*
+*/
+
+
+
+
+#ifndef CVCCCONFERENCECALL_H
+#define CVCCCONFERENCECALL_H
+
+#include <e32base.h>
+#include <mccpconferencecall.h>         // CCP API MCCPConferenceCall
+#include <mccpconferencecallobserver.h> //CCP API MCCPConferenceCallObserver
+
+class CVccPerformer;
+class CConvergedCallProvider;
+
+/**  Type definition for call arrays */
+typedef RPointerArray<CVccPerformer> RVccCallArray;
+
+/**
+ *  Internal conference call object
+ *  This object contains logic for VCC conference calls
+ *
+ *  @lib vccperformer.dll
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(CVccConferenceCall) : public CBase,
+                                        public MCCPConferenceCall,
+                                        public MCCPConferenceCallObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aServiceId Service id
+     * @param aObserver Reference to conference call observer in CCE
+     * @param aCallArray Reference to CVccDirector's performer array
+     */
+    static CVccConferenceCall* NewL( const TUint32 aServiceId,
+                               const MCCPConferenceCallObserver& aObserver,
+                               RVccCallArray& aCallArray );
+    
+    /**
+     * Two-phased constructor.
+     * @param aConferenceCall
+     * @param aCallArray Reference to CVccDirector's performer array
+     */
+    static CVccConferenceCall* NewL( MCCPConferenceCall& aConferenceCall, 
+                                    RVccCallArray& aCallArray );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVccConferenceCall();
+    
+    /**
+     * Singnals CS plugin that conference is released
+     *
+     * @since S60 v3.2
+     */
+    void ReleaseConference();
+
+// from base class MCCPConferenceCall
+
+    /** @see MCCPConferenceCall::ServiceId */
+    TUint32 ServiceId() const;
+    
+    /** @see MCCPConferenceCall::HangUp */
+    TInt HangUp();
+    
+    /** @see MCCPConferenceCall::Hold */
+    TInt Hold();
+       
+    /** @see MCCPConferenceCall::Resume */
+    TInt Resume();
+    
+    /** @see MCCPConferenceCall::Swap */
+    TInt Swap();
+    
+    /** @see MCCPConferenceCall::AddCallL */
+    void AddCallL( MCCPCall* aCall );
+
+    /** @see MCCPConferenceCall::RemoveCallL */
+    void RemoveCallL( MCCPCall* aCall );
+
+    /** @see MCCPConferenceCall::CallCount */
+    TInt CallCount() const;
+
+    /** @see MCCPConferenceCall::GoOneToOneL */
+    void GoOneToOneL( MCCPCall& aCall );
+
+    /** @see MCCPConferenceCall::CurrentCallsToConferenceL */
+    void CurrentCallsToConferenceL();
+        
+    /** @see MCCPConferenceCall::AddObserverL */
+    void AddObserverL( const MCCPConferenceCallObserver& aObserver );
+    
+    /** @see MCCPConferenceCall::RemoveObserver */
+    TInt RemoveObserver( const MCCPConferenceCallObserver& aObserver );
+    
+    /** @see MCCPConferenceCall::GetCallArray */
+    TInt GetCallArray( RPointerArray<MCCPCall>& aCallArray );
+    
+// from MCCPConferenceCallObserver
+
+    /** @see MCCPConferenceCallObserver::ErrorOccurred */
+    void ErrorOccurred( TCCPConferenceCallError aError );
+
+    /** @see MCCPConferenceCallObserver::ConferenceCallCapsChanged */
+    void ConferenceCallCapsChanged( const TCCPConferenceCallCaps aCaps );
+
+    /** @see MCCPConferenceCallObserver::ConferenceCallStateChanged */
+    void ConferenceCallStateChanged( const TCCPConferenceCallState aState );
+        
+    /** @see MCCPConferenceCallObserver::ConferenceCallEventOccurred */
+    void ConferenceCallEventOccurred( const TCCPConferenceCallEvent aEvent,
+                                      MCCPCall* aReferredCall = NULL );
+         
+private:
+    
+    /**
+     * Finds the call from call array
+     *
+     * @since S60 v3.2
+     * @param aCall Call to be found from array
+     * @return Pointer to found call or NULL if not found
+     */
+    CVccPerformer* MatchPluginToVccCall( MCCPCall* aCall );
+
+private:
+
+    /** 
+     * C++ Constructor 
+     * 
+     * @param aServiceId Service id
+     * @param aObserver Reference to conference call observer in CCE
+     * @param aCallArray Reference to CVccDirector's performer array
+     * 
+     */
+    CVccConferenceCall( const TUint32 aServiceId,
+                        const MCCPConferenceCallObserver& aObserver,
+                        RVccCallArray& aCallArray );
+
+    /** 
+    * C++ Constructor 
+    * 
+    * @param aConferenceCall Conference call object
+    * @param aCallArray Reference to CVccDirector's performer array
+    * 
+    */
+    CVccConferenceCall( MCCPConferenceCall& aConferenceCall,
+                            RVccCallArray& aCallArray );
+    
+    /** 2nd phase constructor */
+    void ConstructL();
+    
+private: // data
+
+    /**
+     * ServiceId for this conferencecall
+     */
+    TUint32 iServiceId;
+    
+    /**
+     * Reference to conference call observer (CCE)
+     * Not own.
+     */
+    MCCPConferenceCallObserver* iObserver;
+    
+    /**
+     * Reference to CVccDirector's array of calls
+     * Not own.
+     */
+    RVccCallArray& iCallArray;
+
+    /**
+     * Reference to CS plugin's conference object
+     * Own.
+     */
+    MCCPConferenceCall* iConferenceCall;
+    
+    /**
+     * Reference to CS plugin
+     * Not own.
+     */
+    CConvergedCallProvider* iCsProvider;
+
+    friend class T_CVccConferenceCall;
+    };
+
+
+#endif /*CVCCCONFERENCECALL_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/cvccdirector.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,558 @@
+/*
+* 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:   Voice Call Continuity proxy
+*
+*/
+
+#ifndef CVCCDIRECTOR_H
+#define CVCCDIRECTOR_H
+
+
+
+#include <cconvergedcallprovider.h>
+#include <mccpobserver.h>
+#include <mccpcsobserver.h>  // MCCPCSObserver
+#include <mspnotifychangeobserver.h>
+#include <mccpcall.h>
+#include <cccpcallparameters.h>
+
+#include "mvccengpspropertylistenerobserver.h"
+#include "ccpdefs.h"
+
+//state machine, in order to maintain only one instance
+#include "tvccstateinit.h"
+#include "tvccstatecalling.h"
+#include "tvccstatereleasing.h"
+#include "tvccstatefailing.h"
+
+class CVccPerformer;
+class CVccHoTrigger;
+class CVccEngPsPropertyListener;
+class CVccEngPsProperty;
+class CSPNotifyChange;
+class CVccConferenceCall;
+class CVccDtmfProvider;
+
+/**  Service Provider Name */
+_LIT( KCSPName,"VCC" );
+
+/**  VCC implementation UID */
+const TInt KVCCImplementationUidInt = 0x2000CFAA;
+
+/**
+* Implementation uid of VCC Plugin.
+*/
+const TUid KVCCImplementationUid = { KVCCImplementationUidInt };
+
+/**
+ *  
+ *
+ * Proxies all calls to the relevant call providers
+ * and keeps the house hold.
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2 
+ */
+class CVccDirector : public CConvergedCallProvider,
+                     public MCCPCSObserver,
+                     public MVccEngPsPropertyListenerObserver,
+                     public MSPNotifyChangeObserver
+
+    {
+
+
+public:
+
+    /**
+    * Two-phased constructor.
+    */
+    static CVccDirector* NewL();
+  
+    /**
+    * Destructor.
+    */
+    ~CVccDirector();
+       
+    /**
+    * Gets the instance of the MCCPMonitor
+    * @return Reference to MCCPMonitor
+    */
+    const MCCPCSObserver* CPPObserver() const;
+    
+// from base class CConvergedCallProvider 
+    
+   	/**
+    * From CConvergedCallProvider
+    * Initializes plug-in. All required parameters must be passed
+    * with this function in order to use services.
+    * Simplifies pluging construct removing need to pass parameters
+    * to ECom interface
+    * 
+    * @since S60 v3.2
+    * @param aMonitor CCP observer
+    * @param aSsObserver SS observer
+    */
+    void InitializeL( const MCCPObserver& aMonitor,
+                      const MCCPSsObserver& aSsObserver );
+
+    /**
+    * From CConvergedCallProvider
+    * Creates a new session and checks secure status from profile.
+    * 
+    * @since S60 v3.2
+    * @param aParameters Call parameters, SVP uses Service ID parameter
+    * @param aRecipient Recipients address/number
+    * @param aObserver Observer
+    * @return Reference to created MCCPCall object.
+    */
+    MCCPCall* NewCallL( const CCCPCallParameters& aParameters,
+					    const TDesC& aRecipient,
+					    const MCCPCallObserver& aObserver );
+                                
+    /**
+    * From CConvergedCallProvider
+    * Returns Uid of plug-in which is on use.
+    * 
+    * @since S60 v3.2
+    * @return Uid of plug-in
+    */                        
+    const TUid& Uid() const;
+                           
+    /**
+    * From CConvergedCallProvider
+    * Creates a new Emergency call and add user-agent header.
+    * 
+    * @since S60 v3.2
+    * @param aServiceId Service ID, obsolete!
+    * @param aAddress Emergency number
+    * @param aObserver Observer
+    * @return MCCPEmergencyCall
+    */
+    MCCPEmergencyCall* NewEmergencyCallL( const TUint32 aServiceId,
+                                          const TDesC&  aAddress,
+                                          const MCCPCallObserver& aObserver );
+                                          
+    /**
+    * From CConvergedCallProvider
+    * Creates a new conference session.
+    * 
+    * @since S60 v3.2
+    * @param aObserver Observer
+    * @return MCCPConferenceCall
+    */
+    MCCPConferenceCall* NewConferenceL( const TUint32 aServiceId,
+                              const MCCPConferenceCallObserver& aObserver );
+                             
+    /**
+    * From CConvergedCallProvider
+    * Releases call
+    * 
+    * @since S60 v3.2
+    * @param aCall Call to be removed
+    * @return Symbian error code
+    */
+    TInt ReleaseCall( MCCPCall& aCall );
+
+    /**
+    * From CConvergedCallProvider
+    * Releases emergency call
+    * 
+    * @since S60 v3.2
+    * @param aCall Call to be removed
+    * @return Symbian error code
+    */
+    TInt ReleaseEmergencyCall( MCCPEmergencyCall& aCall );
+
+    /**
+    * From CConvergedCallProvider
+    * Releases conference call
+    * 
+    * @since S60 v3.2
+    * @param aCall Call to be removed
+    * @return Symbian error code
+    */
+    TInt ReleaseConferenceCall( MCCPConferenceCall& aCall );
+
+    /**
+    * From CConvergedCallProvider
+    * Get Plug-In capabilities
+    * 
+    * @since Series 60 v3.2
+    * @return TUint32 On return contains the capability flags of plug-In
+    */
+    TUint32 Caps() const;
+    
+	/**
+    * From CConvergedCallProvider
+	* Get DTMF provider
+    * 
+	* @since Series 60 v3.2
+	* @param aObserver CCP Dtmf observer for informing events
+	* @return Pointer to MCCPDTMFProvider if succesfull,
+    * NULL if not available
+	*/
+	MCCPDTMFProvider* DTMFProviderL( const MCCPDTMFObserver& aObserver );
+
+	/**
+    * From CConvergedCallProvider
+	* Get extension provider
+    * 
+	* @since Series 60 v3.2
+    * @param aObserver observer for extension(custom) events
+	* @return Pointer to MCCPExtensionProvider if succesfull,
+    * NULL if not available
+	*/
+	MCCPExtensionProvider* ExtensionProviderL(
+            const MCCPExtensionObserver& aObserver );
+
+    /**
+    * From CConvergedCallProvider
+    * Add an observer for DTMF related events.
+    * Plug-in dependent feature if duplicates or more than one observers 
+    * are allowed or not. Currently CCE will set only one observer.
+    * 
+    * @since S60 v3.2
+    * @param aObserver Observer
+    * @return none
+    * @leave system error if observer adding fails
+    */
+    void AddObserverL( const MCCPDTMFObserver& aObserver );
+
+    /**
+    * From CConvergedCallProvider
+    * Remove an observer.
+    * 
+    * @since S60 v3.2
+    * @param none
+    * @param aObserver Observer
+    * @return KErrNone if removed succesfully. KErrNotFound if observer
+    * was not found.
+    * Any other system error depending on the error.
+    */
+    TInt RemoveObserver( const MCCPDTMFObserver& aObserver );
+
+    /**
+    * @see CConvergedCallProvider::GetLifeTime
+    */ 
+    TBool GetLifeTime( TDes8& aLifeTimeInfo );
+    
+    /**
+    * @see CConvergedCallProvider::GetCSInfo
+    */ 
+    TBool GetCSInfo( CSInfo& aCSInfo );
+    
+// from base class MCCPCSObserver
+
+        
+   
+    
+    
+// from base class MCCPObserver (inhereded by MCCPCSObserver)
+
+    /**
+     * From MCCPObserver (inhereded by MCCPCSObserver)
+     * 
+     * @see MCCPObserver::ErrorOccurred
+     */
+    
+    void ErrorOccurred( TCCPError aError );
+
+    /** From MCCPObserver (inhereded by MCCPCSObserver)
+    * 
+    * @see MCCPObserver::IncomingCall
+    */
+    
+    void IncomingCall( MCCPCall* aCall, MCCPCall& aTempCall );
+
+    /**
+     * From MCCPObserver (inhereded by MCCPCSObserver)
+     * 
+     * 
+     * @see MCCPObserver::IncomingCall
+     */
+    
+    void IncomingCall( MCCPCall* aCall );
+
+    /**
+     * The actual implementation for IncomingCall.
+     */
+
+    void IncomingCallL( MCCPCall* aCall );
+    
+    /**
+     * From MCCPObserver (inhereded by MCCPCSObserver)
+     * 
+     * @see MCCPObserver::CallCreated
+     */
+    
+    void CallCreated( MCCPCall* aCall,
+            MCCPCall* aOriginator,
+            TBool aAttented );
+
+    /**
+     * From MCCPCSObserver
+     * see MCCPCSObserver::PluginInitiatedCSMoCallCreated
+     */
+     //void PluginInitiatedCSMoCallCreated( MCCPCall* aCall ) const;
+     void MoCallCreated( MCCPCall& aCall );
+
+     /**
+      * Notify of conference call that is not requested.
+      * @since S60 3.2
+      * @param aConferenceCall Created conference
+      * @return none
+      */
+     void ConferenceCallCreated( MCCPConferenceCall& aConferenceCall );
+    
+    /**
+     * From MCCPObserver (inhereded by MCCPCSObserver)
+     *
+     * @see MCCPObserver::DataPortName
+     */
+    void DataPortName( TName& aPortName );
+    
+// from base class MVccEngPsPropertyListenerObserver
+    
+    /**
+     * From MVccEngPsPropertyListenerObserver
+     * Observer interface. Called when a P&S property value 
+     * has been updated.
+     * 
+     * @since S60 v3.2
+     * @param aCategoryId The category uid of the property
+     * @param akeyId The key uid of the property
+     * @param aValue Current value of the property.
+     */ 
+    void PropertyChangedL(
+            const TUid aCategoryId,
+            const TUint aKeyId,
+            const TInt aValue );
+
+//from base class MSPNotifyChangeObserver
+    
+    /**
+     * From MSPNotifyChangeObserver.
+     * Handle notify change event from the service provider table observer.
+     * 
+     * @param aServiceId the service ID of added/changed/deleted service
+     * ( only notification about the changes to VCC service are revceived) 
+     */
+    void HandleNotifyChange( TServiceId aServiceId );
+    
+    /**
+     * From MSPNotifyChangeObserver.
+     * Handle error notification received from the service provider table 
+     * observer.
+     * 
+     * @param aError error code
+     * @since S60 3.2
+     */
+    void HandleError( TInt aError );
+    
+    /**
+     * Gets the call type of the currently active call from the performer array.
+     * 
+     * @return Call type of the currently active call, KErrNotFound if no active call
+     * @since S60 3.2
+     */    
+    TInt CurrentCallTypeForDTMF();
+    
+    /**
+     * Gets the call type of the currently active call and returns it's provider.
+     * 
+     * @return CConvergedCallProvider of the active call
+     * @since S60 5.0
+     */   
+    CConvergedCallProvider* GetProvider();
+    
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CVccDirector();
+    
+    /**
+    * Symbian second-phase constructor
+    */    
+    void ConstructL();
+    
+	/**
+	* for destroying an array
+	*/    
+    static void PointerArrayCleanup( TAny* aArray );
+    
+    /**
+ 	* Creates call provider array 
+ 	*/    
+    void FillCallProviderArrayL();
+
+    /**
+  	* Checks if given plugin is used by VCC 
+	* 
+	* @aparam aPluginId	call provider plugin id
+	* @return ETrue if plugin is used by VCC
+  	*/    
+    TBool IsVccOwnedPlugin( TInt aPluginId );
+    
+    /**
+   	* Tries to initialize all call provider plugins VCC uses.  
+ 	* 
+ 	* @param aMonitor CCP observer
+    * @param aSsObserver SS observer
+ 	* @return ETrue if all plugins were initialized
+   	*/  
+    TBool Initialize( const MCCPObserver& aMonitor,
+            const MCCPSsObserver& aSsObserver );
+    
+    /**
+    * Tries to initialize the given call provider plugin. 
+    * Leaves if initialization fails.
+  	* 
+  	* @param aMonitor CCP observer
+    * @param aSsObserver SS observer
+    * @param aPlugin	call provider plugin
+    */  
+    void InitializeL( const MCCPObserver& aMonitor,
+            const MCCPSsObserver& aSsObserver, 
+            CConvergedCallProvider& aPlugin );
+    
+    /**
+     *  for checking state of calls and making handover
+     */
+    void SwitchL( const TInt aValue );
+    
+    /**
+     *  Checks are converged call provider plugins initialized
+    */
+    TBool IsPluginInitialized();
+    
+    /*
+     * Starts notifications from service provider table observer.
+     * Is notified about VCC service settings changes. 
+     */
+    void StartSpNotifierL();
+
+    /*
+     * Stops notifications from service provider table observer. 
+     */
+    void StopSpNotifierL();
+    
+    /*
+     * Triesto initialize call provider plugins used by VCC that
+     * were not initialized .
+     * 
+     * */
+    void RetryInitialization();
+    
+    /*
+     * The leaving-part implementation on ConferenceCallCreated.
+     * @since S60 3.2
+     * @param aConferenceCall Created conference
+     */
+    void CreateConferenceL( MCCPConferenceCall& aConferenceCall );
+    
+   
+    
+private: // data
+
+    /**
+     * Implementation UID
+     */
+    TUid iImplementationUid;
+    
+    /**
+     * Array of Call providers
+     * Own.
+     */    
+    RPointerArray <CConvergedCallProvider> iProviders;
+    
+    /*
+     * VCC needs to handle both cs and ps calls.
+     * MCCPCSObserver can do both
+     * Not own.
+     */ 
+    MCCPCSObserver* iCCPObserver;
+    
+    /*
+     *  Supplementary service observer.
+     * Not own.
+     */
+    MCCPSsObserver* iCCPSsObserver;
+    
+     /*
+     * Handle to handover trigger.
+     * Own.
+     */
+    CVccHoTrigger* iHoTrigger;
+    
+    /**
+     * Array of Performers
+     * Own.
+     */   
+   	RPointerArray<CVccPerformer> iPerfArray;
+    
+    /*
+     * Handle to Conference call object.
+     * Own.
+     */
+    CVccConferenceCall* iConference;
+   	
+    /*
+     * Listener for the hand-over commands
+     * Own.
+     */
+   	CVccEngPsPropertyListener* iPropListener; 
+   	
+   	//VCC state machine implementation
+   	TVccStateInit iStateInit;
+	TVccStateCalling iStateCalling;
+	TVccStateReleasing iStateReleasing;
+	TVccStateFailing iStateFailing;
+    
+	/**
+     * Used for checking in ReleaseCall, that was this ReleaseCall due to
+     * multicall handover situation
+     */ 
+	TInt iHoKeyValue;
+	
+	/**
+     * Notifies service provider setting change
+     * Own
+     */
+    CSPNotifyChange* iSpNotifier;
+    
+    /*
+     * Array of initialized plugins
+     * Own.
+     */    
+    RArray<TInt> iInitialisedPlugins;
+    
+    /**
+     * Proxy object for DTMF providers
+     * Own.
+     */
+    CVccDtmfProvider* iDtmfProvider;
+    
+    /**
+     * Used in initialization logic to inform of
+     * failed converged call provider plugin.
+     */
+    TInt iMandatoryPluginFailedError;
+
+	friend class T_CVccDirector;
+    friend class T_CVccDTMFProvider;
+	};
+
+#endif // CVCCDIRECTOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/cvccdtmfprovider.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Sends and receives DTMF tones
+*
+*/
+
+
+
+#ifndef CVCCDTMFPROVIDER_H
+#define CVCCDTMFPROVIDER_H
+
+
+#include <mccpdtmfprovider.h>
+#include <mccpdtmfobserver.h>
+
+class CConvergedCallProvider;
+class CVccDirector;
+
+/**
+ *  DTMF provider.
+ *  Contains DTMF providers from call providers and forward all requests between
+ *  them and CCE
+ *
+ *  @lib vccperformer.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CVccDtmfProvider ) : public MCCPDTMFProvider,
+						                public MCCPDTMFObserver
+    {
+
+public:
+
+    /**
+	 * Two-phased constructor.
+     * @param aProviders Service providers
+     * @param aObserver
+     * @param aDirector Reference to Director object 
+	 */
+	static CVccDtmfProvider* NewL(
+	        RPointerArray<CConvergedCallProvider>& aProviders, 
+	        const MCCPDTMFObserver& aObserver,
+	        CVccDirector& aDirector );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CVccDtmfProvider(); 
+
+  // From MCCPDTMFObserver
+
+ 	/**
+	* HandleDTMFEvents.
+	* @since S60 3.2
+	* @param aEvent Event type
+	* @param aError Error code
+	* @param aTone Character
+	*/
+	void HandleDTMFEvent( const MCCPDTMFObserver::TCCPDtmfEvent aEvent,
+	                               const TInt aError,
+	                               const TChar aTone ) const;
+	                               
+	// From MCCPDTMFProvider
+
+	/**
+ 	* Cancels asynchronous DTMF string sending.
+ 	* @return KErrNone request was started successfully
+ 	* @return KErrNotFound nothing found to cancel.
+ 	* @since Series 60 3.2
+ 	*/
+ 	TInt CancelDtmfStringSending();
+
+ 	/**
+ 	* Starts the transmission of a single DTMF tone across a connected and active call.
+ 	* @since S60 3.2
+ 	* @param aTone tone to be played.
+ 	* @return KErrNone request was started successfully
+ 	* @return KErrArgument if the specified tone contains illegal dtmf character
+ 	* @return in case of an error system wide error code
+ 	*/
+ 	TInt StartDtmfTone( const TChar aTone );
+
+ 	/**
+ 	* Stops playing current DTMF tone.
+ 	* @since S60 3.2
+ 	* @return KErrNone request was started successfully
+    * @return KErrNotReady not ready to perform the requested action.
+ 	*/
+ 	TInt StopDtmfTone();
+
+ 	/**
+ 	* Plays DTMF string.
+ 	* @since S60 3.2
+ 	* @param aString String to be played.
+ 	* @return KErrNone request was started successfully
+ 	* @return KErrArgument if the specified string contains illegal dtmf characters
+ 	*/
+ 	TInt SendDtmfToneString( const TDesC& aString );
+
+ 	/**
+ 	* Continue or cancel sending DTMF string which was stopped with 'w'-character
+ 	* in string.
+ 	* @since S60 3.2
+ 	* @param aContinue ETrue if sending of the DTMF string should continue,
+ 	* EFalse if the rest of the DTMF string is to be discarded.
+ 	* @return KErrNone request was started successfully
+ 	* @return KErrNotFound no send existed which to continue
+ 	*/
+ 	TInt ContinueDtmfStringSending( const TBool aContinue );
+ 	
+	/**
+	* Add an observer for DTMF related events.
+	* Currently CCE will set only one observer.
+	* @since S60 v3.2
+	* @param aObserver Observer to add.
+	* @leave system error if observer adding fails
+	*/
+	void AddObserverL( const MCCPDTMFObserver& aObserver );
+	
+	/**
+	* Remove an observer.
+	* @since S60 v3.2
+	* @param aObserver Observer to remove.
+	* @return KErrNone if removed succesfully. 
+	* @return KErrNotFound if observer was not found.
+	*/
+	TInt RemoveObserver( const MCCPDTMFObserver& aObserver );
+	
+private:
+
+    /** 
+     * C++ constructor
+     * @param aObserver Reference to DTMF observer
+     * @param aDirector Reference to Director
+     */
+    CVccDtmfProvider( const MCCPDTMFObserver& aObserver, CVccDirector& aDirector );
+
+    /** 
+     * Symbian second-phase constructor
+     */
+    void ConstructL();
+
+private: // data
+
+	/**
+	* DTMF event observers.
+	* Own.
+	*/
+	RPointerArray<MCCPDTMFObserver> iObservers;
+	
+	/**
+	* DTMF providers.
+	* Own
+	*/
+	RPointerArray<MCCPDTMFProvider> iProviders;
+	
+	/**
+	 * VCC director
+	 * Not own.
+	 */
+	CVccDirector* iDirector;
+	
+    friend class T_CVccDTMFProvider;
+    };
+
+#endif // CVCCDTMFPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/cvcctransferprovider.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Sends and receives DTMF tones
+*
+*/
+
+
+
+#ifndef CVCCTRANSFERPROVIDER_H
+#define CVCCTRANSFERPROVIDER_H
+
+class CVccPerformer;
+
+#include <mccptransferprovider.h>           // MCCPTransferProvider
+#include <mccptransferobserver.h>           // MCCPTransferObserver
+
+/**
+ *  DTMF provider.
+ *  Contains DTMF providers from call providers and forward all requests between
+ *  them and CCE
+ *
+ *  @lib vccperformer.lib
+ *  @since S60 v3.2
+ */
+class CVccTransferProvider : public CBase,
+                             public MCCPTransferProvider,
+                             public MCCPTransferObserver
+    {
+
+public:
+
+    /**
+	 * Two-phased constructor.
+     * @param aProviders Service providers
+     * @param aObserver
+     * @param aDirector Reference to Director object 
+	 */
+	static CVccTransferProvider* NewL ( CVccPerformer* aCall );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CVccTransferProvider(); 
+
+    /**
+	* Attended transfer to given call recipient.
+	* There needs to exist two calls. a call between A-B and A-C. A wants to transfer the call to B-C. 
+	* Both calls A-B and A-C will be disconnected after transfer.
+	* In above case C will be the aTransferTargetCall call recipient. B is the recipient of the 
+	* current call between A-B - called on A's call object transfer provider. 
+	* The A-B call is on hold.
+    * Actual request result indication comes via observer classes
+	* @param aTransferTargetCall Call containing the transfer target info.
+    * @return KErrNone if request was started succesfully. 
+    * @return KErrNotReady if call is not in connected or on-hold state.
+    * @return KErrArgument transfer traget address was illegal.
+    * @pre Call state is MCCPCallObserver::ECCPStateConnected or MCCPCallObserver::ECCPStateHold
+	* @since S60 3.2
+	*/
+	TInt AttendedTransfer( MCCPCall& aTransferTargetCall );
+
+    /**
+	* Attended transfer to given address. There does not need to be 
+	* a current call between the given transfer target.
+    * Actual request result indication comes via observer class
+	* @param aTransferTarget Transfer target address
+    * @return KErrNone if request was started succesfully. 
+    * @return KErrNotReady if call is not in connected or on-hold state.
+    * @return KErrArgument transfer address was illegal.
+    * @pre Call state is MCCPCallObserver::ECCPStateConnected or MCCPCallObserver::ECCPStateHold
+	* @since S60 3.2
+	*/
+	TInt AttendedTransfer( const TDesC& aTransferTarget );
+
+	/**
+	* Unattended transfer. Call is requested to be transferred to given address.
+	* After MCCPTransferObserver::ECCPRemoteTransferring event current call will be 
+	* disconnected and no transfer status is checked from the operation. 
+    * Actual request result indication comes via observer classes
+	* @since S60 3.2
+	* @param aTransferTarget Address of the target
+    * @return KErrNone if request was started succesfully. 
+    * @return KErrNotReady if call is not in connected or on-hold state.
+    * @return KErrArgument transfer address was illegal.
+    * @pre Call state is MCCPCallObserver::ECCPStateConnected or MCCPCallObserver::ECCPStateHold
+	*/
+	TInt UnattendedTransfer( const TDesC& aTransferTarget );
+
+	/**
+	* Accept incoming call transfer request from the call remote party.
+    * Actual request result indication comes via observer class
+	* @since Series 60 3.2
+	* @param aAccept ETrue - accept transfer, EFalse do not accept transfer request.
+    * @return KErrNone if request was started succesfully. 
+    * @return KErrNotReady if call is not in connected or on-hold state.
+    * @return KErrArgument transfer address was illegal.
+    * @pre Call state is MCCPCallObserver::ECCPStateConnected or MCCPCallObserver::ECCPStateHold
+	* @pre MCCPObserver::CallCreated is called with the newly created call
+	*/
+	TInt AcceptTransfer( const TBool aAccept );
+	  
+    /**
+    * When the other end of the call has requested call transfer to third party it is notified to 
+    * MCCPTransferObserver::TransferEventOccurred(MCCPTransferObserver::ECCPRemoteTransferring).
+    * The new recipient of the call can be fetched via this method.
+	* @since Series 60 3.2
+	* @param none
+	* @return new recipient for the call after transfer
+	* @return KNullDesC if no transfer target is available
+    * @pre Call state is MCCPCallObserver::ECCPStateConnected or MCCPCallObserver::ECCPStateHold
+	* @pre MCCPObserver::CallCreated is called with the newly created call
+	*/
+	const TDesC& TransferTarget() const;
+	
+    /**
+    * Add an observer for transfer related events.
+    * Currently CCE will set only one observer.
+    * @since S60 v3.2
+    * @param aObserver Observer to add.
+    * @return none
+    * @leave system error if observer adding fails
+    */
+   void AddObserverL( const MCCPTransferObserver& aObserver );
+
+    /**
+    * Remove an observer.
+    * @since S60 v3.2
+    * @param aObserver Observer to remove.
+    * @return KErrNone if removed succesfully. 
+    * @return KErrNotFound if observer was not found.
+    */
+   TInt RemoveObserver( const MCCPTransferObserver& aObserver );
+   
+   void TransferEventOccurred( 
+                   const MCCPTransferObserver::TCCPTransferEvent aEvent );
+    
+   void UpdateL();
+private:
+
+    /** 
+     * C++ constructor
+     * @param aObserver Reference to DTMF observer
+     * @param aDirector Reference to Director
+     */
+    CVccTransferProvider( CVccPerformer* aCall );
+
+    /** 
+     * Symbian second-phase constructor
+     * @param aProviders Reference to array of the Service Providers
+     */
+    void ConstructL( );
+
+private: // data
+
+	/**
+	* DTMF event observers.
+	* Own.
+	*/
+	RPointerArray<MCCPTransferObserver> iObservers;
+    CVccPerformer* iPerfCall;
+    MCCPTransferProvider* iCallTransferProvider;
+	};
+
+#endif // CVCCTRANSFERPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/mvccengpspropertylistenerobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* 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 property listener 
+*
+*/
+
+
+
+#ifndef M_VCCENGPSLISTENEROBSERVER_H
+#define M_VCCENGPSLISTENEROBSERVER_H
+
+/**
+ *  Observer class for CVccEngPsPropertyListener
+ *
+ *  The class that implements this observer interfaces gets notified about 
+ *  the P&S property value changes.
+ *
+ *  @lib hoengine.lib
+ *  @since S60 v3.2
+ */
+class MVccEngPsPropertyListenerObserver 
+    {
+
+public:
+
+	/**
+	 * Observer interface. Called when a P&S property value 
+	 * has been updated.
+	 * 
+	 * @param aCategoryId	the category uid of the property
+	 * @param akeyId the key uid of the property
+	 * @param aValue Current value of the property.
+	 */	
+ 	virtual void PropertyChangedL( 
+ 			const TUid aCategoryId,
+            const TUint aKeyId,
+            const TInt aValue ) = 0;
+    
+    };
+
+
+
+#endif /*M_VCCENGPSLISTENEROBSERVER_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/rubydebug.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,276 @@
+/*
+* 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 of debugging utilities.
+*
+*/
+
+
+
+#ifndef RUBYDEBUG_H
+#define RUBYDEBUG_H
+
+#include "rubydebugcfg.h"
+
+//  INCLUDES
+#include <e32svr.h> // For RDebug
+
+#ifndef RUBY_DISABLE_FUNCTION_NAMES
+    // No sense to store function name longer, than can be printed
+    // 0x100 is the internal RDebug limit
+    const TInt __K_RUBY_FUNCTION_NAME_LENGTH = 0x50;    
+
+    // Prepares function name for printing
+    #define __RUBY_PREPARE_FUNCTION_NAME \
+    TBuf<__K_RUBY_FUNCTION_NAME_LENGTH> __ruby_function_name__;\
+    __ruby_function_name__.Copy( TPtrC8( (TText8*)&__PRETTY_FUNCTION__ ).Left( __K_RUBY_FUNCTION_NAME_LENGTH ) ); \
+
+    // Token to paste the function name into
+    #define __K_RUBY_FUNCTION_NAME_TOKEN "%S "
+    
+    // Comma and function name
+    #define __RUBY_FUNCTION_NAME __ruby_function_name__
+    
+    // A wrapper that prepares and supplies the function name as __ruby_function_name__
+    #define __RUBY_FUNCTION_NAMED( text ) \
+	    {\
+	    __RUBY_PREPARE_FUNCTION_NAME;\
+	    text;\
+	    }
+	    
+	#define __RUBY_FUNCTION_NAME_POINTER8 (TText8*)&__PRETTY_FUNCTION__
+    
+
+#else  // RUBY_DISABLE_FUNCTION_NAMES
+
+    #define __RUBY_PREPARE_FUNCTION_NAME
+    
+    // Don't print the function name
+    #define __K_RUBY_FUNCTION_NAME_TOKEN ""
+    
+    // exclude the whole token, with the comma
+    #define __RUBY_FUNCTION_NAME KNullDesC
+    
+    // no wrapping
+    #define __RUBY_FUNCTION_NAMED( text ) text
+    
+    #define __RUBY_FUNCTION_NAME_POINTER8 NULL
+
+#endif // RUBY_DISABLE_FUNCTION_NAMES
+
+// Macro for printing filename both in unicode and non-unicode builds
+
+
+#ifdef _UNICODE
+	#define __RUBY_WIDEN2(x) L ## x
+	#define __RUBY_WIDEN(x) __RUBY_WIDEN2(x)
+	#define __RUBY_DBG_FILE__ __RUBY_WIDEN(__FILE__)
+#else
+	#define __RUBY_DBG_FILE__ __FILE__
+#endif//_UNICODE
+
+
+
+// Debugging is enabled only in _DEBUG builds
+//#ifdef _DEBUG 
+
+// Select the debug output method
+#ifndef __RUBY_DEBUG_TRACES_TO_FILE
+#define RUBY_DEBUG_METHOD RDebug::Print
+#else
+#define RUBY_DEBUG_METHOD RRubyDebug::PrintToFile
+#endif // __RUBY_DEBUG_TRACES_TO_FILE
+
+//#endif // _DEBUG
+
+#if defined(_DEBUG) && !defined(__RUBY_DEBUG_DISABLED)
+
+//	#define RUBY_DEBUG_BLOCK(text) \
+//  	RRubyDebug trace_trace( _S(text), _S("" ## __RUBY_DBG_FILE__) , __LINE__, EFalse ); \
+//  	CleanupReleasePushL( trace_trace )
+  	
+//  	#define RUBY_DEBUG_BLOCKL(text) \
+//  	RRubyDebug trace_trace( _S(text), _S("" ## __RUBY_DBG_FILE__), __LINE__, ETrue ); \
+//  	CleanupReleasePushL( trace_trace )
+// A temporary fix to cope with builds on RVCT 530. It didn't compile with _RUBY_DBG_FILE
+	#define RUBY_DEBUG_BLOCK(text) \
+  	RRubyDebug trace_trace( _S(text), _S("") , __LINE__, EFalse, __RUBY_FUNCTION_NAME_POINTER8 ); \
+  	CleanupReleasePushL( trace_trace )
+
+  	#define RUBY_DEBUG_BLOCKL(text) \
+  	RRubyDebug trace_trace( _S(text), _S(""), __LINE__, ETrue, __RUBY_FUNCTION_NAME_POINTER8 ); \
+  	CleanupReleasePushL( trace_trace )
+
+	#define RUBY_DEBUG0(text) \
+        __RUBY_FUNCTION_NAMED( RUBY_DEBUG_METHOD( _L("%S %S "L##text L## " [L:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, __LINE__ ) )
+
+    #define RUBY_DEBUG1(text, p1) \
+        __RUBY_FUNCTION_NAMED( RUBY_DEBUG_METHOD( _L("%S %S "L##text L## " [L:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, p1, __LINE__ ) )
+
+    #define RUBY_DEBUG2(text, p1, p2) \
+        __RUBY_FUNCTION_NAMED( RUBY_DEBUG_METHOD( _L("%S %S "L##text L## " [L:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, p1, p2, __LINE__ ) )
+
+    #define RUBY_DEBUG3(text, p1, p2, p3) \
+        __RUBY_FUNCTION_NAMED( RUBY_DEBUG_METHOD( _L("%S %S "L##text L## " [L:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, p1, p2, p3, __LINE__ ) )
+
+
+#else // Debugging disabled
+
+	// Macros expand to nothing:
+	#define RUBY_DEBUG_BLOCK(text)
+	#define RUBY_DEBUG0(text)    
+	#define RUBY_DEBUG1(text, p1)
+	#define RUBY_DEBUG2(text, p1, p2)
+    #define RUBY_DEBUG3(text, p1, p2, p3)
+	#define RUBY_DEBUG_BLOCKL(text)
+
+#endif // defined(_DEBUG) && !defined(__RUBY_DEBUG_DISABLED)
+
+#if !defined(RUBY_DISABLE_ERRORS) || defined(_DEBUG)
+	// if error messages are allowed (even for UREL)
+	#define RUBY_ERROR0(text) \
+	__RUBY_FUNCTION_NAMED( \
+	    RUBY_DEBUG_METHOD( _L("%S[Error!] %S "L##text L## " [F:%s][L:%d][TId:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, __RUBY_DBG_FILE__, __LINE__, TUint(RThread().Id()) )\
+	)
+
+	#define RUBY_ERROR1(text, p1) \
+	__RUBY_FUNCTION_NAMED( \
+	RUBY_DEBUG_METHOD( _L("%S[Error!] %S "L##text L## " [F:%s][L:%d][TId:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, p1, __RUBY_DBG_FILE__, __LINE__, TUint(RThread().Id()) )\
+	)
+
+	#define RUBY_ERROR2(text, p1, p2) \
+	__RUBY_FUNCTION_NAMED( \
+	RUBY_DEBUG_METHOD( _L("%S[Error!] %S "L##text L## " [F:%s][L:%d][TId:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, p1, p2, __RUBY_DBG_FILE__, __LINE__, TUint(RThread().Id()) )\
+	)
+#else
+	// error reporting disabled
+	// Macros expand to nothing:
+	#define RUBY_ERROR_BLOCK(text)
+	#define RUBY_ERROR0(text)    
+	#define RUBY_ERROR1(text, p1)
+	#define RUBY_ERROR2(text, p1, p2)
+#endif  // !defined(RUBY_DISABLE_ERRORS)
+
+#if !defined(RUBY_DISABLE_ASSERT_DEBUG) || defined(_DEBUG)
+	#define RUBY_ASSERT_DEBUG(condition, action) \
+	  __RUBY_FUNCTION_NAMED(\
+		__ASSERT_ALWAYS( condition, RUBY_DEBUG_METHOD(  _L("%S[Error!] %S [Assert failed!] "L###condition L## " [F:%s][L:%d][TId:%d]"), &__K_RUBY_HEADER, &__RUBY_FUNCTION_NAME, __RUBY_DBG_FILE__, __LINE__, TUint(RThread().Id())) ); \
+		__ASSERT_DEBUG( (condition), (action) )\
+	  );
+#else
+	// Macro expands to default:
+	#define RUBY_ASSERT_DEBUG(condition, action) __ASSERT_DEBUG(condition,action)
+#endif
+
+// Same as TRAP_IGNORE, but in case of leave, prints the leave code via RUBY_ERROR
+// Can be disabled by RUBY_DISABLE_TRAP_IGNORE or RUBY_DISABLE_ERRORS
+// If disabled, is equivalent to TRAP_IGNORE
+// @see rubydebugcfg.h
+#ifndef RUBY_DISABLE_TRAP_IGNORE 
+    #define RUBY_TRAP_IGNORE( s ) \
+        {\
+        TRAPD( err, s );\
+        if( err != KErrNone )\
+            {\
+            RUBY_ERROR1( "RUBY_TRAP_IGNORE leaves with [%d]", err );\
+            }\
+        }
+#else  // RUBY_DISABLE_TRAP_IGNORE 
+    #define RUBY_TRAP_IGNORE( s ) TRAP_IGNORE( s )
+#endif  // RUBY_DISABLE_TRAP_IGNORE 
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*  Debug class for printing START, EXIT and LEAVE messages to RDebug in every 
+*  code block. Must be placed in the very beginning of a code block and the
+*  code block cannot leave items in the cleanup stack (like NewLC). 
+*
+*  @since Series 60 2.8
+*
+*  @note If this object is not the topmost item when a code block is exited, 
+*        E32USER-CBase 90 panic is raised (@see CleanupStack::Pop( TAny* )).
+*/
+class RRubyDebug
+    {
+    public:
+        /**
+        * C++ constructor.
+        * @since Series 60 2.8
+        * @param aMsg Debug message.
+        * @param aCalledFromL ETrue if called from RUBY_DEBUG_BLOCK_L
+        */
+        inline RRubyDebug( const TText* aMsg, const TText* aFileName, const TInt aLine, TBool aCalledFromL,
+                           const TText8* aFunctionName = NULL );
+
+        /**
+        * Destructor.
+        */
+        inline ~RRubyDebug();
+
+        /**
+        * Destructor for Cleanup support. Called when a method leaves.
+        */
+        inline void Release();
+
+        /**
+        * Support for writing traces to file.
+        */
+        static void PrintToFile( TRefByValue<const TDesC> aFmt, ... );
+
+    private:
+        /**
+        *  Class for truncating debug messages if they are too long.
+        *  @since Series 60 2.8
+        */
+        class TTruncateOverflow : public TDesOverflow
+            {
+            public: // Methods from TDesOverflow
+
+                inline void Overflow( TDes& aDes );
+            };
+
+    private:
+        // A pointer to the debug message
+        TPtrC iMsg;
+        
+        // A pointer to the filename where RUBY_DEBUG_BLOCK is written
+        TPtrC iFileName;
+        
+        // Number of the line where RUBY_DEBUG_BLOCK is written
+        TInt iLine;
+
+		// ETrue if we are called from RUBY_DEBUG_BLOCKL
+        TBool iCalledFromL;
+
+        // Flag that is set when a leave occurs
+        TBool iLeave;
+
+	#ifndef RUBY_DISABLE_FUNCTION_NAMES        
+        // Used only if aFunctionName is defined in constructor
+        HBufC* iFunctionName;
+   	#endif  // RUBY_DISABLE_FUNCTION_NAMES
+        
+    };
+
+#include "rubydebug.inl"
+
+#endif      // RUBYDEBUG_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/rubydebug.inl	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,149 @@
+/*
+* 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:   This module contains the implementation of RRubyDebug class 
+*	             member functions.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32base.h>
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+#ifdef _DEBUG
+_LIT( KRubyDebugStart,  "START" );
+_LIT( KRubyDebugStop,   "EXIT" );
+_LIT( KRubyDebugLeave,  "LEAVE!!!" );
+_LIT( KRubyDebugStr,    "%S%S %S [F:%S][L:%d][TId:%d]" );
+_LIT( KRubyDebugPrefix, "VCC" );
+#endif
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+#ifdef _DEBUG
+// -----------------------------------------------------------------------------
+// RRubyDebug::RRubyDebug
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+    
+inline RRubyDebug::RRubyDebug( const TText* aMsg, const TText* aFileName, const TInt aLine, TBool aCalledFromL,
+                               const TText8* aFunctionName )
+	: iMsg( aMsg ), iFileName( aFileName ), iLine ( aLine ), iCalledFromL ( aCalledFromL ), iLeave ( EFalse )
+	{
+	#ifndef RUBY_DISABLE_FUNCTION_NAMES
+	iFunctionName = NULL;
+	// If function name is defined, use it instead of aMsg
+	if( aFunctionName )
+	    {
+	    TPtrC8 ptr8Name( aFunctionName );
+	    iFunctionName = HBufC::New( ptr8Name.Length() );
+	    if( iFunctionName )
+	        {
+	        // If memory for a 16-bit copy has been allocated successfully
+	        iFunctionName->Des().Copy( ptr8Name );
+	        iMsg.Set( *iFunctionName );
+	        }
+	    }
+	#endif // RUBY_DISABLE_FUNCTION_NAMES
+	TInt id = RThread().Id();
+    iCalledFromL = aCalledFromL;  
+    if( !iCalledFromL) 
+    	{
+    	RUBY_DEBUG_METHOD( KRubyDebugStr, &__K_RUBY_HEADER, &iMsg, &KRubyDebugStart, &iFileName, iLine, id );
+    	}
+    else {
+    	#ifdef RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+    	// For BLOCKLs show this message only if RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+    	RUBY_DEBUG_METHOD( KRubyDebugStr, &__K_RUBY_HEADER, &iMsg, &KRubyDebugStart, &iFileName, iLine, id );
+    	#endif
+    	}
+	}    
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::~RRubyDebug
+// Destructor
+// -----------------------------------------------------------------------------
+//
+inline RRubyDebug::~RRubyDebug()
+    {
+    if ( !iLeave ) 
+        {
+        // This is done only if destructor is NOT called from Release().
+        // Otherwise the cleanup stack pops this item automatically.
+        TInt id = RThread().Id();
+        if (!iCalledFromL) 
+        	{
+        	RUBY_DEBUG_METHOD( KRubyDebugStr, &__K_RUBY_HEADER, &iMsg, &KRubyDebugStop, &iFileName, iLine, id );
+        	}
+        else
+        	{
+        	#ifdef RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+    		// For BLOCKLs show this message only if RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+    		RUBY_DEBUG_METHOD( KRubyDebugStr, &KRubyDebugPrefix, &iMsg, &KRubyDebugStop, &iFileName, iLine, id );
+    		#endif
+        	}
+        #ifndef RUBY_DISABLE_FUNCTION_NAMES
+        delete iFunctionName;  // if any
+        #endif  // RUBY_DISABLE_FUNCTION_NAMES
+        CleanupStack::Pop( this ); // E32USER-CBase 90 panic is raised if
+                                   // this is not the topmost item
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::Release()
+// Method that makes it possible to push this object into the cleanup stack.
+// -----------------------------------------------------------------------------
+//
+inline void RRubyDebug::Release()
+    {
+    iLeave = ETrue;
+    TInt id = RThread().Id();
+    RUBY_DEBUG_METHOD( KRubyDebugStr, &__K_RUBY_HEADER, &iMsg, &KRubyDebugLeave, &iFileName, iLine, id );
+    #ifndef RUBY_DISABLE_FUNCTION_NAMES
+    delete iFunctionName;  // if any
+    #endif  // RUBY_DISABLE_FUNCTION_NAMES
+    this->~RRubyDebug();
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::TTruncateOverflow::Overflow()
+// Method for ignoring the overflowing part of a debug message.
+// -----------------------------------------------------------------------------
+//
+inline void RRubyDebug::TTruncateOverflow::Overflow( TDes& /*aDes*/ )
+    {
+    // We ignore the overflowing part of the descriptor...
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/rubydebugcfg.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,96 @@
+/*
+* 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:   Configuration file for RubyDebug macros
+*
+*/
+
+
+
+#ifndef RUBYDEBUGCFG_H
+#define RUBYDEBUGCFG_H
+
+
+#include <e32cmn.h> // TLitC
+#include <e32def.h> // _LIT
+
+#include "rubydebugconfigselector.h"
+
+// Common settings
+// Is printed at the beginning of the line
+_LIT( __K_RUBY_HEADER, "[<SRSF>] ");
+
+// Is printed after __KRUBY_HEADER for the error messages
+_LIT( __K_RUBY_ERROR, "[Error!] ");
+
+
+#if defined(RUBY_EXTERNAL_VARIANT) && defined(__WINS__)
+// set of options to use when the project is released to the customers
+
+// Uncomment the following line to disable RUBY_DEBUGs. 
+// This has no effect on RUBY_ERRORs
+//#define __RUBY_DEBUG_DISABLED
+
+// Uncomment the following line to get traces to C:\Logs\RubyTrace.log
+#define __RUBY_DEBUG_TRACES_TO_FILE
+
+// Uncomment the following line to stop disable RUBY_ERRORs
+// Error print is always enabled in _DEBUG
+//#define RUBY_DISABLE_ERRORS
+
+// Uncomment the following line to disable extra output for RUBY_ASSERT_DEBUG
+// RUBY_ASSERT_DEBUGs will become usual __ASSERT_DEBUGs
+#define RUBY_DISABLE_ASSERT_DEBUG
+
+// Uncomment the following line to disable automated function name printing
+//#define RUBY_DISABLE_FUNCTION_NAMES
+
+//#define RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+
+// Uncomment the following line to disable leave code printing in RUBY_TRAP_IGNORE
+// macro. It would make it equivalent to TRAP_IGNORE
+// #define RUBY_DISABLE_TRAP_IGNORE
+
+
+#else //  RUBY_EXTERNAL_VARIANT
+// set of options to use in the internal development
+
+// Uncomment the following line to disable RUBY_DEBUGs. 
+// This has no effect on RUBY_ERRORs
+//#define __RUBY_DEBUG_DISABLED
+
+// Uncomment the following line to get traces to C:\Logs\RubyTrace.log
+//#define __RUBY_DEBUG_TRACES_TO_FILE
+
+// Uncomment the following line to stop disable RUBY_ERRORs
+// Error print is always enabled in _DEBUG
+//#define RUBY_DISABLE_ERRORS
+
+// Uncomment the following line to disable extra output for RUBY_ASSERT_DEBUG
+// RUBY_ASSERT_DEBUGs will become usual __ASSERT_DEBUGs
+//#define RUBY_DISABLE_ASSERT_DEBUG
+
+// Uncomment the following line to disable automated function name printing
+//#define RUBY_DISABLE_FUNCTION_NAMES
+
+#define RUBY_DIDSPLAY_EVERYTHING_FOR_BLOCKL
+
+// Uncomment the following line to disable leave code printing in RUBY_TRAP_IGNORE
+// macro. It would make it equivalent to TRAP_IGNORE
+// #define RUBY_DISABLE_TRAP_IGNORE
+
+#endif  //  RUBY_EXTERNAL_VARIANT
+
+#endif // RUBYDEBUGCFG_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/rubydebugconfigselector.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* 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:   Switches sets of the RubyDebug options. 
+*                @warning DO NOT change the file. At least DO NOT check in the modified version.
+*                Variants should be switched by replacing the whole rubydebugconfigselector.h 
+*                with the help of a Synergy task. 
+*
+*/
+
+
+
+#ifndef RUBYDEBUGCONFIGSELECTOR_H
+#define RUBYDEBUGCONFIGSELECTOR_H
+
+
+// CONSTANTS
+
+/** 
+ * If defined, rubydebug will be tuned with a set of options designed for external users
+ * Typically it means showing all the warnings for hardware builds and only errors for the
+ * SW builds
+ *
+ * If not defined, rubydebug will be tuned for the internal Multimodal UI team development.
+ * Typically it means all the warnings always enabled
+ *
+ * The meaning of the variant is defined in the rubydebugcfg.h
+ * @warning DO NOT change the line. At least DO NOT check in the modified version.
+ *          Variants should be switched by replacing the whole rubydebugconfigselector.h 
+ *          with the help of a Synergy task. 
+ *
+ */
+#define RUBY_EXTERNAL_VARIANT
+
+#endif // RUBYDEBUGCONFIGSELECTOR_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/tvccstate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,442 @@
+/*
+* 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:   The base class for VCC state machine
+*
+*/
+
+
+
+#ifndef TVCCSTATE_H
+#define TVCCSTATE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32cmn.h> // HBufC
+#include <mccpcscall.h>
+#include <cccpcallparameters.h>
+
+#include "vccengpsproperty.h"
+#include "cconvergedcallprovider.h"
+
+//forward declarations
+class CVccPerformer;
+
+/**  Value for indicating unsuccesfull HO */
+const TUint KVccHoNok = 0;
+
+/**  Value for indicating succesfull HO */
+const TUint KVccHoOk = 1;
+
+/**
+* The base class for VCC state machine implementation.
+* Contains default implementations for the functions.
+* 
+*  @lib vccperformer.dll
+*  @since S60 3.2
+* 
+*/
+class TVccState 
+    {
+public:
+    
+    /**
+    * Releases call
+    * @since Series60 3.2
+    * @param aCall Call to be removed
+    * @param aProvs Reference to call provider array
+    * @return Symbian error code
+    */
+    virtual TInt ReleaseCall( MCCPCall& aCall, 
+                              RPointerArray<CConvergedCallProvider>& aProvs );
+  
+    /**
+    * Gets the state name.
+    * @since Series60 3.2 
+    * @return Derived states name.
+    */
+    virtual TUint Name() const = 0;
+    
+    /**
+    * Initiates a handover
+    * @since Series60 3.2
+    * @param aContext Reference to Performer object
+    * @leave Symbian error code in error case. 
+    */
+    virtual void SwitchL( CVccPerformer& aContext );
+     
+// From  MCCPCall - look alikes.    
+    /**
+    * Answers to an incoming call.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return KErrNone if request was started succesfully. In that case plug-in 
+    * must return MCCPCallObserver::ECCPStateAnswering.
+    * @return KErrNotReady if call is not in ringing or queued state.
+    * @return KErrNotSupported if call does not support queueing. Plug-in will 
+    * disconnect the call in this case.
+    */
+    virtual TInt Answer( MCCPCall& aCall );
+      
+    /**
+    * Rejects an incoming call.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return KErrNone if request was started succesfully. 
+    * @return KErrNotReady if call is not in ringing or queued state.
+    */
+    virtual TInt Reject( MCCPCall& aCall );
+
+    /**
+    * Reguests plug-in to queue the call. 
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return KErrNone if request was started succesfully. 
+    * @return KErrNotReady if call is not in ringing state or call waiting is not supported at the moment.
+    */
+    virtual TInt Queue( MCCPCall& aCall );
+
+    /**
+    * Starts dialing to recipient
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return KErrNone if request was started succesfully. In this case plug-in must return 
+    * MCCPCallObserver::ECCPStateDialling.
+    * @return KErrNotReady if call is not in idle state.
+    * @return KErrNotSupported If call is not mobile originated.
+    */
+    virtual TInt Dial( MCCPCall& aCall );
+
+    /**
+    * Call is ringing
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return KErrNone if request was started succesfully.
+    * @return KErrNotReady if call is not in idle state.
+    */
+    virtual TInt Ringing( MCCPCall& aCall );
+      
+    /**
+    * Ends an ongoing call.
+    * @since S60 3.2
+    * @param aContext Reference to a Performer object
+    * @param aCall Reference to a call object
+    * @return KErrNone if request was started succesfully.
+    * @return KErrAlreadyExists if call is already in idle state.
+    */
+    virtual TInt HangUp( CVccPerformer& aContext, MCCPCall& aCall );
+      
+    /**
+    * Cancels the ongoing request
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return KErrNone if request was started succesfully.
+    */
+    virtual TInt Cancel( MCCPCall& aCall );
+      
+    /**
+    * Puts the specified call on hold.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return KErrNone if request was started succesfully. 
+    * @return KErrNotReady if call is not in connected state.
+    * @return KErrAlreadyExists if call is already held 
+    * (MCCPCallObserver::ECCPStateHold).
+    */
+    virtual TInt Hold( MCCPCall& aCall );
+      
+    /**
+    * Resumes the call.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return KErrNone if request was started succesfully.
+    * @return KErrNotReady if call is not in on-hold state.
+    * @return KErrAlreadyExists if call is already in connected state 
+    * MCCPCallObserver::ECCPStateConnected.
+    */
+    virtual TInt Resume( MCCPCall& aCall );
+      
+    /**
+    * Swaps a connected call to its opposite state, either active or on hold
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return KErrNone if request was started succesfully.
+    * @return KErrNotReady if call is not on in holded or connected state.
+    */
+    virtual TInt Swap( MCCPCall& aCall );
+      
+    /**
+    * Returns the remote party of the call.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return remote party address,
+    */
+    virtual const TDesC& RemoteParty( const MCCPCall& aCall ) const;
+
+    /**
+    * Returns the dialled party information.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return dialled party address,
+    */
+    virtual const TDesC& DialledParty( const MCCPCall& aCall ) const;
+      
+    /**
+    * Return boolean value if the incoming call is forwarded or not.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return ETrue if call is forwarded, else EFalse
+    */
+    virtual TBool IsCallForwarded( const MCCPCall& aCall ) const;
+     
+    /**
+    * Returns boolean value if the call is mobile originated or not.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return ETrue if call is mobile originated, otherwise EFalse
+    */
+    virtual TBool IsMobileOriginated( const MCCPCall& aCall ) const;
+      
+    /**
+    * Returns the state of the call.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return TCCPCallState The current state of the call
+    */
+    virtual MCCPCallObserver::TCCPCallState State( const MCCPCall& aCall ) const;
+      
+    /**
+    * Returns call control caps for this call.
+    * This tells for CCE what call can currently do.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return Call control caps defined in MCCPCallObserver::TCCPCallControlCaps.
+    */
+    virtual MCCPCallObserver::TCCPCallControlCaps Caps( const MCCPCall& aCall ) const;     
+    
+    /**
+    * Return if call secure status is specified or not.
+    * @since Series 60 5.0
+    * @param None.
+    * @return TBool ETrue if security is specified, else EFalse.
+    */
+    virtual TBool SecureSpecified( const MCCPCall& aCall ) const;
+    
+    /**
+    * Get call's secure status.
+    * @since Series 60 3.2
+    * @param aCall Reference to a call object
+    * @return TBool ETrue if security is enabled, else EFalse.
+    */
+    virtual TBool IsSecured( const MCCPCall& aCall ) const;
+      
+    /**
+	* Set call parameters.
+	* @since S60 3.2
+	* @param aNewParams New call paramater information.
+	* @return none
+	*/
+    virtual void SetParameters( const CCCPCallParameters& aNewParams );
+
+    /**
+	* Cet call parameters.
+	* @since S60 3.2
+	* @param aCall Reference to a call object
+	* @return Current call paramater information.
+	*/
+    virtual const CCCPCallParameters& Parameters( const MCCPCall& aCall ) const;
+      
+    /**
+    * Returns currently used tone for the call. Used in case tones are needed to be played.
+	* See defenition for TCCPTone.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return TCCPTone Used tone.
+    */
+    virtual TCCPTone Tone( const MCCPCall& aCall ) const;
+      
+    /**
+    * Adds a new observer for MCCECall object. Called in MT call case. In MO 
+    * case observer will be given at call construction.
+    * Plug-in dependent feature if duplicates or more than one observers 
+    * are allowed or not. Currently CCE will set only one observer.
+    * @since S60 v3.2
+    * @param aObserver Observer
+    * @param aCall Reference to a call object
+    * @return none
+    * @leave system error if observer adding fails
+    */
+    virtual void AddObserverL( const MCCPCallObserver& aObserver, 
+                               MCCPCall& aCall );
+
+    /**
+    * Remove an observer.
+    * @since S60 v3.2
+    * @param aObserver Observer
+    * @param aCall Reference to a call object
+    * @return KErrNone if removed succesfully. KErrNotFound if observer was not found.
+    * Any other system error depending on the error.
+    */
+    virtual TInt RemoveObserver( const MCCPCallObserver& aObserver, 
+                                 MCCPCall& aCall );
+    
+//from MCCPCSCall - look alikes.
+
+  /**
+	* Starts dialing to recipient
+	* @since S60 3.2
+	* @param aCallParams The call parameters used by the TSY (a TCallParamsPckg object)
+	* @param aCall Reference to a call object
+    * @return KErrNone if request was started succesfully. 
+    * @return KErrNotReady if call is not in idle state.
+    * @return KErrNotSupported If call is not mobile originated.
+    * @pre Call state is MCCPCallObserver::ECCPStateIdle and call type is MO.
+    * @since S60 3.2
+    */	
+	virtual TInt Dial( const TDesC8& aCallParams, MCCPCSCall& aCall );
+
+	/**
+	* Instruct to do no FDN checking when dialling.
+	* Needs to be called before every dial for each call separately.
+	* If this method is not called at all default is to use FDN. 
+	* Value will be reset to default when call goes back to disconnected state.
+	* @since S60 v3.2
+	* @param aCall Reference to a call object
+	* @return none
+	*/
+	virtual void NoFDNCheck( MCCPCSCall& aCall );
+
+	/**
+	* Returns call information
+	* @since S60 3.2
+	* @param aCallInfo TMobileCallInfoV3
+	* @param aCall Reference to a call object
+	* @return KErrNone if succesfull, otherwise another system wide error code
+	*/
+	virtual TInt GetMobileCallInfo( TDes8& aCallInfo, 
+	                                const MCCPCSCall& aCall  ) const;
+
+	/**
+	* Switch in the alternating call mode of an alternating call
+	* @since S60 3.2
+	* @param aCall Reference to a call object
+    * @return KErrNone or system error code.
+	*/
+	virtual TInt SwitchAlternatingCall( MCCPCSCall& aCall );
+
+	/**
+	* Gets the calls data call capabilities
+	* @since S60 3.2
+	* @param aCaps TMobileCallDataCapsV1
+	* @param aCall Reference to a call object
+	* @return KErrNone if the function member was successful, 
+	* @return KErrNotSupported if call does not support circuit switched data, 
+	* @return KErrNotFound if this call is not a data call
+	*/
+	virtual TInt GetMobileDataCallCaps( TDes8& aCaps, 
+	                                    const MCCPCSCall& aCall ) const;
+	
+    /**
+    * Log dialed  number. SAT related, check if dialed number is to be logged or not.
+    * @since S60 3.2
+    * @param aCall Reference to a call object
+    * @return Log dialed number or not.
+    */
+    virtual TBool LogDialedNumber( const MCCPCSCall& aCall ) const;	
+
+//from MCCPCallObserver - look alikes. 
+    
+ 	/**
+	* An error has occurred concerning a specific call.
+	* @since S60 3.2
+	* @param aContext Reference to Performer object
+	* @param aError Error code.
+	* @param aCall Reference to a call object
+	* @return none
+	*/
+	virtual void ErrorOccurred( CVccPerformer& aContext, 
+	                            const TCCPError aError,
+	                            MCCPCall* aCall );
+
+	/**
+	* The state of the call has changed.
+	* @since S60 3.2
+	* @param aContext Reference to Performer object
+	* @param aState Call state.
+	* @param aCall Reference to a call object
+	* @return none
+	*/
+	virtual void CallStateChanged( CVccPerformer& aContext, 
+	        const MCCPCallObserver::TCCPCallState aState,
+	        MCCPCall* aCall );
+
+	/**
+	* The state of the call has changed with inband tone, meaning network is playing 
+	* the tone relating to the state.
+	* @since S60 3.2
+	* @param aContext Reference to Performer object
+	* @param aState Call state.
+	* @param aCall Reference to a call object
+	* @return none
+	*/
+	virtual void CallStateChangedWithInband( CVccPerformer& aContext, 
+            const MCCPCallObserver::TCCPCallState aState,
+            MCCPCall* aCall );
+
+	/**
+	* An event has occurred concerning a specific call.
+	* @since S60 3.2
+	* @param aContext Reference to Performer object
+	* @param aEvent Occurred event.
+	* @param aCall Reference to a call object
+	* @return none
+	*/
+	virtual void CallEventOccurred( CVccPerformer& aContext, 
+	        const MCCPCallObserver::TCCPCallEvent aEvent,
+	        MCCPCall* aCall );
+
+	/**
+	* Notifies changed call capabilities.
+	* @since S60 3.2
+	* @param aContext Reference to Performer object
+	* @param aCapsFlags New capabilities for the call
+	* @param aCall Reference to a call object
+	* @return none
+	*/
+	virtual void CallCapsChanged( CVccPerformer& aContext, 
+	                const TUint32 aCapsFlags,
+	                MCCPCall* aCall);
+
+protected:
+ 
+    /**
+    * Releases ongoing call.
+    * @since Series60 3.2 
+    * @param aContext Reference to Performer object
+    * @param aCall Reference to a call object
+    * @param aState Next call state
+    * @param aHoValue Was the handover succesfull or not succesfull
+    * @return KErrNone or Symbian error code
+    */
+    TInt ReleaseCall( CVccPerformer& aContext, MCCPCall& aCall, 
+                      TVccState& aState, TUint aHoValue );
+     
+	 /**
+     * C++ Constructor
+     */
+     TVccState();
+    };
+
+#endif      // TVCCSTATE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/tvccstatecalling.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Function definitions for VCC Calling State
+*
+*/
+
+
+
+#ifndef TVCCSTATECALLING_H
+#define TVCCSTATECALLING_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32cmn.h> // HBufC
+
+#include "tvccstate.h"
+
+/**  Calling state name */
+const TUint KVccStateCalling = 1;
+
+//forward declarations
+class CVccPerformer;
+
+/**
+* The base class for VCC state machine implementation.
+* Contains default implementations for the functions.
+* Current state machine is:
+* 
+* init -> calling -> releasing -> init
+* 
+*  @lib vccperformer.dll
+*  @since S60 3.2
+*/
+class TVccStateCalling: public TVccState
+    {
+          
+public:
+	/**
+	* c'tor
+	*/
+	TVccStateCalling();
+	
+    /**
+    * Links the state i.e. provides transition points.
+    * @param aReleasing reference to the realising state
+    * @param aInit reference to the init state
+    * @param afailing reference to the failing state
+    */
+    void LinkState( TVccState& aReleasing, 
+                    TVccState& aInit, 
+                    TVccState& aFailing);
+
+// From base class TVccState
+    
+    /**
+     * @see TVccState::Name()
+     */
+    TUint Name() const;
+	
+	/**
+	* @See TVccState::HangUp()
+	*/	
+	TInt HangUp(CVccPerformer& aContext, MCCPCall& aCall);
+
+    /**
+     * @see TVccState::CallStateChanged()
+     */
+	void CallStateChanged( CVccPerformer& aContext, 
+	                    const MCCPCallObserver::TCCPCallState aState,
+	                    MCCPCall* aCall );
+	
+    /**
+     * @see TVccState::CallStateChangedWithInband()
+     */
+	void CallStateChangedWithInband(CVccPerformer& aContext, 
+	            const MCCPCallObserver::TCCPCallState aState,
+	            MCCPCall* aCall );
+	
+    /**
+     * @see TVccState::CallEventOccurred()
+     */
+	void CallEventOccurred( CVccPerformer& aContext, 
+	            const MCCPCallObserver::TCCPCallEvent aEvent,
+	            MCCPCall* aCall );
+	    
+    /**
+     * @see TVccState::ErrorOccurred()
+     */
+    void ErrorOccurred( CVccPerformer& aContext, 
+                        const TCCPError aError,
+                        MCCPCall* aCall );	
+	
+private:
+    
+    //no copying
+    TVccStateCalling(const TVccStateCalling&);
+    TVccStateCalling operator = (const TVccStateCalling&);
+
+    /**
+    * Inspects the state changed for possible remote disconnect and other
+    * failing hand-over cases.
+    * @param aContext a state context
+    * @param aState a current state value
+    * @param aCall the call leg emetting the event
+    * @param aCallee the object instance calling the callback
+    * @param aCallback a function to call in case event must be emitted and not suppressed.
+    */  
+    void InspectChangedStates( CVccPerformer& aContext, 
+                               const MCCPCallObserver::TCCPCallState aState,
+                               MCCPCall* aCall,
+                               MCCPCallObserver* aCallee,
+                               void( MCCPCallObserver::*aCallback)(const MCCPCallObserver::TCCPCallState, MCCPCall*));
+
+private: // data
+    /**
+     * Reference to Releasing state
+     * Not own.
+     */
+	TVccState* iReleasing;
+
+    /**
+     * Reference to Init state
+     * Not own.
+     */
+	TVccState* iInit;
+	
+    /**
+     * Reference to Failing state
+     * Not own.
+     */
+	TVccState* iFailing;
+    };
+
+#endif      // TVCCSTATECALLING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/tvccstatefailing.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   Function definitions for VCC Failing State
+*
+*/
+
+
+
+#ifndef TVCCSTATEFAILING_H
+#define TVCCSTATEFAILING_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32cmn.h> // HBufC
+
+#include "tvccstate.h"
+
+/**  Failing state name */
+const TUint KVccStateFailing = 3;
+
+//forward declarations
+class CVccPerformer;
+
+/**
+* Failing state. Can be accessed from calling state if some problem
+* occurs.
+*
+* init -> calling -> releasing -> init
+* 
+*  @lib vccperformer.dll
+*  @since S60 3.2
+*/
+class TVccStateFailing: public TVccState
+    {
+          
+public:
+	/**
+	* c'tor
+	*/
+	TVccStateFailing();
+	
+    /**
+    * Links the state i.e. provides transition points.
+    * @param aReleasing a realising state
+    */
+    void LinkState( TVccState& aInit );
+	
+// From base class TVccState
+    
+    /**
+     * @see TVccState::Name()
+     */
+	TUint Name() const;
+	
+    /**
+     * @see TVccState::CallStateChanged()
+     */
+	void CallStateChanged( CVccPerformer& aContext, 
+	                    const MCCPCallObserver::TCCPCallState aState,
+	                    MCCPCall* aCall );
+	
+    /**
+     * @see TVccState::CallStateChangedWithInband()
+     */
+	void CallStateChangedWithInband(CVccPerformer& aContext, 
+	            const MCCPCallObserver::TCCPCallState aState,
+	            MCCPCall* aCall );
+	
+    /**
+     * @see TVccState::CallEventOccurred()
+     */
+	void CallEventOccurred( CVccPerformer& aContext, 
+	            const MCCPCallObserver::TCCPCallEvent aEvent,
+	            MCCPCall* aCall );
+	    
+    /**
+     * @see TVccState::ErrorOccurred()
+     */
+    void ErrorOccurred( CVccPerformer& aContext, 
+                        const TCCPError aError,
+                        MCCPCall* aCall );	
+	
+private:
+    //no copying
+    TVccStateFailing( const TVccStateFailing& );
+    TVccStateFailing operator = ( const TVccStateFailing& );
+    
+    /**
+    * If new leg is cleared, set the state again to init.
+    * param aContext Reference to Performer object
+    */
+    void CheckAndMoveToInit( CVccPerformer& aContext,  MCCPCall* aCall,
+                                        const MCCPCallObserver::TCCPCallState aState );
+    
+    /**
+    * Inspects the state changed for possible remote disconnect and other
+    * failing hand-over cases.
+    * @param aContext a state context
+    * @param aState a current state value
+    * @param aCall the call leg emetting the event
+    * @param aCallee the object instance calling the callback
+    * @param aCallback a function to call in case event must be emitted and not suppressed.
+    */  
+    void InspectChangedStates( CVccPerformer& aContext, 
+                               const MCCPCallObserver::TCCPCallState aState,
+                               MCCPCall* aCall,
+                               MCCPCallObserver* aCallee,
+                               void( MCCPCallObserver::*aCallback)(const MCCPCallObserver::TCCPCallState, MCCPCall*));
+    
+private: // data
+    /**
+     * Reference to Init state
+     * Not own.
+     */
+	TVccState* iInit;
+	
+	};
+
+#endif      // TVCCSTATEFAILING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/tvccstateinit.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Function definitions for VCC Init State
+*
+*/
+
+
+
+#ifndef TVCCSTATEINIT_H
+#define TVCCSTATEINIT_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32cmn.h> // HBufC
+
+#include "tvccstate.h"
+
+/**  Init state name */
+const TUint KVccStateInit = 0;
+
+//forward declarations
+class CVccPerformer;
+
+/**
+* The base class for VCC state machine implementation.
+* Contains default implementations for the functions.
+* 
+*  @lib vccperformer.dll
+*  @since S60 3.2
+*/
+class TVccStateInit: public TVccState
+    {
+          
+public:
+	/**
+	* c'tor
+	*/
+	TVccStateInit();
+	
+    /**
+    * Links the state i.e. provides transition points.
+    * @param aCalling reference to the calling state
+    */	
+	void LinkState( TVccState& aCalling );	
+	
+// From base class TVccState	
+
+    /**
+     * @see TVccState::Name()
+     */
+	TUint Name() const;
+	
+	/**
+	* @see TVccState::Swap()
+	*/
+	TInt Swap(MCCPCall& aCall);
+
+    /**
+     * @see TVccState::ErrorOccurred()
+     */
+	void ErrorOccurred(CVccPerformer& aContext, 
+	                    const TCCPError aError,
+	                    MCCPCall* aCall );
+
+    /**
+     * @see TVccState::CallStateChanged()
+     */
+	void CallStateChanged(CVccPerformer& aContext, 
+	        const MCCPCallObserver::TCCPCallState aState,
+	        MCCPCall* aCall );
+
+    /**
+     * @see TVccState::CallStateChangedWithInband()
+     */
+	void CallStateChangedWithInband(CVccPerformer& aContext, 
+            const MCCPCallObserver::TCCPCallState aState,
+            MCCPCall* aCall );
+
+    /**
+     * @see TVccState::CallEventOccurred()
+     */
+	void CallEventOccurred( CVccPerformer& aContext, 
+	        const MCCPCallObserver::TCCPCallEvent aEvent,
+	        MCCPCall* aCall );
+
+    /**
+     * @see TVccState::CallCapsChanged()
+     */
+	void CallCapsChanged(CVccPerformer& aContext, const TUint32 aCapsFlags );
+	
+    /**
+     * @see TVccState::SwitchL()
+     */
+	void SwitchL(CVccPerformer& aContext); 
+	
+private:
+    //no copying
+    TVccStateInit(const TVccStateInit&);
+    TVccStateInit operator = (const TVccStateInit&);
+
+private: // Data
+
+    /**
+     * Reference to Calling state
+     * Not own.
+     */
+    TVccState* iCalling;
+    };
+
+#endif      // TVCCSTATEINIT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/tvccstatereleasing.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Function definitions for VCC Releasing State
+*
+*/
+
+
+
+#ifndef TVCCSTATERELEASING_H
+#define TVCCSTATERELEASING_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32cmn.h> // HBufC
+
+#include "tvccstate.h"
+
+/**  Releasing state name */
+const TUint KVccStateReleasing = 2;
+
+//forward declarations
+class CVccPerformer;
+
+/**
+* The base class for VCC state machine implementation.
+* Contains default implementations for the functions.
+* 
+*  @lib vccperformer.dll
+*  @since S60 3.2
+*/
+class TVccStateReleasing: public TVccState
+    {
+          
+public:
+	/**
+	* c'tor
+	*/
+	
+	TVccStateReleasing();
+
+    /**
+    * Links the state i.e. provides transition points.
+    * @param aInit an init state
+    */
+    void LinkState( TVccState& aInit );
+	
+// From base class TVccState	
+
+    /**
+     * @see TVccState::Name()
+     */
+	TUint Name() const;
+	
+    /**
+     * @see TVccState::CallStateChanged()
+     */
+	void CallStateChanged( CVccPerformer& aContext, 
+	                        const MCCPCallObserver::TCCPCallState aState,
+	                        MCCPCall* aCall );
+	
+    /**
+     * @see TVccState::CallEventOccurred()
+     */
+	void CallEventOccurred( CVccPerformer& aContext, 
+	            const MCCPCallObserver::TCCPCallEvent aEvent,
+	            MCCPCall* aCall );
+	    
+private:
+    //no copying
+    TVccStateReleasing(const TVccStateReleasing&);
+    TVccStateReleasing operator = (const TVccStateReleasing&);
+
+private:
+    
+    /**
+     * Reference to Init state
+     * Not own.
+     */
+	TVccState* iInit;
+};
+
+#endif      // TVCCSTATERELEASING_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/vccdefinitions.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Vcc application definitions.
+*
+*/
+
+
+
+#ifndef VCCDEFINITIONS_H_
+#define VCCDEFINITIONS_H_
+
+/** VCC Call Provider Plugin uid */
+const TInt32 KVccCallProviderPlugId = 0x2000CFAA; 
+
+/** Sip VoIP Call Provider Plugin uid */
+const TInt32 KSipVoipCallProviderPlugId = 0x10282589; 
+
+/** CS Call Provider Plugin uid */
+const TInt32 KCSCallProviderPlugId = 0x102828E5; 
+
+#endif /*VCCDEFINITIONS_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/vccengpsproperty.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   P&S property writer/reader
+*
+*/
+
+
+
+#ifndef C_VCCENGINEPSPROPERTY_H
+#define C_VCCENGINEPSPROPERTY_H
+
+#include <e32base.h>
+#include <e32std.h>	
+#include <e32property.h>
+
+#include <vccsubscribekeys.h>
+
+/**
+ *  CVccEngPsProperty manages the VCC P&S keys on the VCC HO Engine side.  
+ * 
+ *  This class defines the property keys used by Vcc Ho Engine.
+ *  It provides access to read/write values. Keys are deleted 
+ *  when this class is deleted.
+ * 
+ *  Key KVccPropKeyHoStatus:
+ *   EVccHoStateIdle 			Everything ok   
+ *   EVccCsToPsHoStarted 		CS->PS HO started
+ *   EVccCsToPsHoInprogress 	CS->PS HO in progress.
+ *   EVccCsToPsHoSuccessful		CS->PS HO ended successfully.
+ *   EVccCsToPsHoFailure 		HO server encountered failure.
+ *   EVccHoStateUnknown 		nok, key value could not be fetched
+ *   
+ *  @code
+ * 		CVccEngPsProperty* iVccPsp = CVccEngPsProperty::NewL();
+ * 		...
+ * 		iVccPsp.NotifySubscriberL( EVccCsToPsHoStarted );
+ * 		...
+ * 		iVccPsp.NotifySubscriberL( EVccCsToPsHoSuccessful );
+ * 		...
+ * 		delete iVccPsp;		
+ *  @endcode
+ * 
+ *  @lib vcchoengine.lib
+ *  @since S60 v3.2
+ */
+class CVccEngPsProperty : public CBase
+{
+public:
+	/**
+	 * Two-phased constructor.
+     *
+	 */
+	static CVccEngPsProperty* NewL();
+	
+	/**
+	 * Destructor.
+	 */
+	virtual ~CVccEngPsProperty();
+	
+	/**
+     * Updates the Vcc property keys KVccPropKeyHoStatus and 
+     * KVccPropKeyHoError. Subscribers of these properties will get the 
+     * notification about the changed values.
+     *
+     * @since S60 5.0
+     * @param aStatus The new value of the KVccPropKeyHoStatus key
+     * @param aErrorCode The new value of the KVccPropKeyHoError key
+     */
+    void NotifySubscriberL( TVccHoStatus aStatus, 
+    						TInt aErrorCode );
+
+    /**
+     * Gets the latest value of the Vcc property key KVccPropKeyHoStatus.
+     *
+     * @since S60 5.0
+     * @param aStatus The value of the key
+     * @return KErrNone / KErrPermissionDenied/ KErrNotFound/KErrArgument 
+     */
+    TInt GetCurrentHoStatus( TVccHoStatus& aStatus );
+
+    /**
+     * Gets the latest value of the Vcc property key KVccPropKeyHoError.
+     *
+     * @since S60 5.0
+     * @param aErrorCode The value of the key
+     * @return KErrNone / KErrPermissionDenied/ KErrNotFound/KErrArgument 
+     */
+    TInt GetCurrentErrorCode( TInt& aErrorCode );
+    
+private:
+	/**
+	 * Constructor
+	 */
+	CVccEngPsProperty();
+
+	/**
+	 * Constructor
+	 */
+	void ConstructL();
+
+	/**
+	 * Defines keys used by Vcc Ho engine
+	 */
+	void DefineKeysL();
+	
+	/**
+	 * creates handles to properties
+	 */
+	void CreateHandlesL();
+	
+private: //data
+	
+	/**
+	 * Handle to ho status property 
+	 */
+	RProperty iHoStatusKey;
+	
+	/**
+	 * Handle to error code property 
+	 */
+	RProperty iErrorCodeKey;
+};
+
+#endif /*C_VCCENGPSPROPERTY_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/vccengpspropertylistener.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,168 @@
+/*
+* 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:   Active object that tracks changes on a PS property.
+*
+*/
+
+
+
+#ifndef C_VCCENGPSPROPERTYLISTENER_H
+#define C_VCCENGPSPROPERTYLISTENER_H
+
+#include <e32base.h>
+#include <e32property.h>
+
+#include "mvccengpspropertylistenerobserver.h"
+
+/*
+ *  CVccEngPsPropertyListener subsribes to the given property. It is used to 
+ *  notify its observers about the changed the value of the property.
+ *  
+ *   
+ *  @code
+ *  void CExampleClass::ConstructL()
+ * 	{
+ *   CVccEngPsPropertyListener* iPropListener = 
+ *				CVccEngPsPropertyListener::NewL( KPSVccPropertyCategory, 
+                                                 KVccPropKeyHoRequest );
+ * 	 iPropListener.AddObserver( this );
+ * 	 iPropListener.Start();
+ * 	}	
+ * 
+ * 	void CExampleClass::PropertyChangedL( 
+            const TUid aCategoryId,
+            const TUint aKeyId,
+            const TInt aValue )
+ * 	{
+        
+ *  	if( aKeyId )
+ * 			{
+ * 			switch( aValue )
+ * 				{				
+ * 				case EVccManualStartCsToPsHoRequest:
+ * 					// start CS->PS handover 
+ * 					break;
+ * 				default:
+ * 					break;
+ * 				}			
+ * 			}
+ *  }
+ *   
+ *  @endcode
+ 
+ * 
+ *  @lib hoengine.lib
+ *  @since S60 v3.2
+ */
+class CVccEngPsPropertyListener : public CActive
+    {
+public:
+
+	/**
+	 * Symbian two-phased constructor.
+     *
+     * @param aCategoryId	category uid 
+     * @param aKeyId Id of a key of the property.
+     */
+    static CVccEngPsPropertyListener* NewL( const TUid aCategoryId, 
+    										const TUint aKeyId );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVccEngPsPropertyListener();
+
+    /**
+     * Adds an observer
+     * @param aObserver Reference to observer to be added
+     */
+    void AddObserverL( MVccEngPsPropertyListenerObserver& aObserver );
+
+    /**
+     * Removes an observer
+     * @param aObserver  Reference to observer to be removed
+     */
+    void RemoveObserver( MVccEngPsPropertyListenerObserver& aObserver );
+
+    /**
+     * Get the current value of the property.
+     * @return Current key value
+     */
+    TInt CurrentValue();
+
+    /**
+     * Starts the listener.
+     */
+    void Start();
+
+private: 
+	/**
+	 * Constructor.
+	 * 
+	 * @param aPropertyUid	category uid 
+	 * @param aKeyId Id of a key of the property.
+	 */
+	CVccEngPsPropertyListener( const TUid aCategoryId, const TUint aKeyId );
+    
+	/**
+	 * 2nd phase constructor
+	 */
+ 	void ConstructL();
+ 	
+    /**
+     * Notifies the observers about the property value change.
+     * @leave Symbian error code in error case
+     */
+    void NotifyObserversL();
+
+// from base class CActive.
+
+    /**
+     * @see CActive::RunL()
+     */
+    void RunL();
+     
+    /**
+     * See CActive::DoCancel()
+     */
+    void DoCancel();
+ 
+private: //data
+
+	/**
+	 * Uid of the property category to be watched.
+	 */
+ 	TUid iCategoryId;
+ 
+ 	/**
+ 	 * The property key uid to be watched.
+ 	 */
+ 	TUint iKeyId;
+
+ 	/**
+ 	 * the property category.
+ 	 * Own
+ 	 */
+ 	RProperty iProperty;
+   
+ 	/**
+ 	 * Obsevers for callback from this.
+ 	 * Own
+ 	 */
+ 	RPointerArray<MVccEngPsPropertyListenerObserver> iObservers;
+
+    };
+
+#endif // C_VCCENGPSPROPERTYLISTENER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/inc/vccunittesting.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Unit testing definitions for VCC
+*
+*/
+
+
+
+#ifndef _VCCUNITTESTING_H_
+#define _VCCUNITTESTING_H_
+
+#ifdef UNIT_TESTING // if unit testing
+
+    #define VCC_UNITTEST( aClassName ) friend class aClassName;
+
+#else
+
+    #define VCC_UNITTEST( aClassName ) 
+
+#endif // UNIT_TESTING
+
+
+#endif // _VCCUNITTESTING_H_
+
Binary file callcontinuity/vcc/sis/vcc_stub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/cvccconferencecall.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,418 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 of VCC conference call object
+*
+*/
+
+#include <mccpcscall.h> //CCP API
+
+#include "cvccconferencecall.h"
+#include "cvccperformer.h"
+#include "cconvergedcallprovider.h"
+#include "rubydebug.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C'tor
+// ---------------------------------------------------------------------------
+//
+CVccConferenceCall::CVccConferenceCall( const TUint32 aServiceId,
+                                   const MCCPConferenceCallObserver& aObserver,
+                                   RVccCallArray& aCallArray )
+: iServiceId( aServiceId ), 
+  iObserver( const_cast<MCCPConferenceCallObserver*>( &aObserver ) ),
+  iCallArray( aCallArray )
+    {
+    RUBY_DEBUG_BLOCK("CVccConferenceCall::CVccConferenceCall");
+    }
+
+// ---------------------------------------------------------------------------
+// C'tor
+// ---------------------------------------------------------------------------
+//
+CVccConferenceCall::CVccConferenceCall( MCCPConferenceCall& aConferenceCall,
+                                   RVccCallArray& aCallArray )
+: iServiceId( aConferenceCall.ServiceId() ), 
+  iCallArray( aCallArray )
+    {
+    RUBY_DEBUG_BLOCK("CVccConferenceCall::CVccConferenceCall");
+    RUBY_DEBUG0("CVccConferenceCall::CVccConferenceCall2");
+    iConferenceCall = &aConferenceCall;
+    // Get reference to CS plugin
+    CConvergedCallProvider& csProv = iCallArray[0]->CsProvider();
+    iCsProvider = &csProv;
+    }
+// ---------------------------------------------------------------------------
+// 2nd phase C'tor
+// ---------------------------------------------------------------------------
+//
+void CVccConferenceCall::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccConferenceCall::ConstructL" );
+    
+    __ASSERT_ALWAYS( iCallArray.Count() > 0, User::Leave( KErrArgument ) );
+    
+    // Get reference to CS plugin
+    CConvergedCallProvider& csProv = iCallArray[0]->CsProvider();
+    iCsProvider = &csProv;
+    
+    // Order CS plugin to create new conference
+    iConferenceCall = iCsProvider->NewConferenceL( iServiceId, *this );
+    }
+
+// ---------------------------------------------------------------------------
+// Two phased C'tor
+// ---------------------------------------------------------------------------
+//
+CVccConferenceCall* CVccConferenceCall::NewL( const TUint32 aServiceId,
+                                   const MCCPConferenceCallObserver& aObserver,
+                                   RVccCallArray& aCallArray )
+    {
+    CVccConferenceCall* self = new( ELeave ) CVccConferenceCall( aServiceId,
+                                                                 aObserver,
+                                                                 aCallArray );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two phased C'tor
+// ---------------------------------------------------------------------------
+//
+CVccConferenceCall* CVccConferenceCall::NewL( MCCPConferenceCall& aConferenceCall, 
+                                    RVccCallArray& aCallArray )
+    {
+    RUBY_DEBUG0("CVccConferenceCall::NewL2");
+        
+    CVccConferenceCall* self = new( ELeave ) CVccConferenceCall( 
+                                                aConferenceCall,
+                                                aCallArray );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// D'tor
+// ---------------------------------------------------------------------------
+//
+CVccConferenceCall::~CVccConferenceCall()
+    {
+    RUBY_DEBUG0( "CVccConferenceCall::~CVccConferenceCall() - ENTER" );
+    
+    RUBY_DEBUG0( "CVccConferenceCall::~CVccConferenceCall() - EXIT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Signals CS plugin that conference is released
+// ---------------------------------------------------------------------------
+//
+void CVccConferenceCall::ReleaseConference()
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::ReleaseConference" );
+    iCsProvider->ReleaseConferenceCall( *iConferenceCall );
+    }
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::ServiceId 
+// ---------------------------------------------------------------------------
+//
+TUint32 CVccConferenceCall::ServiceId() const
+    {
+    RUBY_DEBUG_BLOCK("CVccConferenceCall::ServiceId");
+    
+    return iServiceId;
+    }
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::HangUp 
+// ---------------------------------------------------------------------------
+//
+TInt CVccConferenceCall::HangUp()
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::HangUp" );
+    
+    TInt retValue( iConferenceCall->HangUp() );
+    
+    RUBY_DEBUG1( "Error: %d", retValue );
+    
+    return retValue;
+    }
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::Hold 
+// ---------------------------------------------------------------------------
+//
+TInt CVccConferenceCall::Hold()
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::Hold" );
+
+    TInt retValue( iConferenceCall->Hold() );
+    
+    RUBY_DEBUG1( "Error: %d", retValue );
+    
+    return retValue;
+    }
+
+   
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::Resume 
+// ---------------------------------------------------------------------------
+//
+TInt CVccConferenceCall::Resume()
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::Resume" );
+    
+    TInt retValue(  iConferenceCall->Resume() );
+    
+    RUBY_DEBUG1( "Error: %d", retValue );
+    
+    return retValue;
+    }
+
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::Swap 
+// ---------------------------------------------------------------------------
+//
+TInt CVccConferenceCall::Swap()
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::Swap" );
+    
+    TInt retValue( iConferenceCall->Swap() );
+    
+    RUBY_DEBUG1( "Error: %d", retValue );
+    
+    return retValue;
+    }
+
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::AddCallL 
+// ---------------------------------------------------------------------------
+//
+void CVccConferenceCall::AddCallL( MCCPCall* aCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::AddCallL" );
+
+    // NULL pointer
+    __ASSERT_ALWAYS( aCall, User::Leave( KErrArgument ) );
+    RUBY_DEBUG0( "- Not a NULL pointer" );
+    
+    CVccPerformer* call = static_cast<CVccPerformer*>( aCall );
+
+    // Tell CS plugin to add the call in conference and add it to the
+    // local conference array
+    iConferenceCall->AddCallL( call->PrimaryCall() );
+        
+    }
+
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::RemoveCallL 
+// ---------------------------------------------------------------------------
+//
+void CVccConferenceCall::RemoveCallL( MCCPCall* aCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::RemoveCallL" );
+    
+    // NULL pointer
+    __ASSERT_ALWAYS( aCall, User::Leave( KErrArgument ) );
+    RUBY_DEBUG0( "- Not a NULL pointer" );
+    
+    CVccPerformer* call = static_cast<CVccPerformer*>( aCall );
+
+    // Tell CS plugin to remeove call from conference
+    iConferenceCall->RemoveCallL( call->PrimaryCall() );
+    
+    }
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::CallCount 
+// ---------------------------------------------------------------------------
+//
+TInt CVccConferenceCall::CallCount() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::CallCount" );
+    
+    return iConferenceCall->CallCount();
+    }
+
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::GoOneToOneL 
+// ---------------------------------------------------------------------------
+//
+void CVccConferenceCall::GoOneToOneL( MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::GoOneToOneL" );
+    
+    // Find call from conference array
+    CVccPerformer* call = dynamic_cast<CVccPerformer*>( &aCall );
+    
+    // Check that the call was found in conference array
+    __ASSERT_ALWAYS( call, User::Leave( KErrNotFound ) );   
+    
+    // Tell CS plugin to go one-on-one
+    iConferenceCall->GoOneToOneL( *call->PrimaryCall() );
+    }
+
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::CurrentCallsToConferenceL 
+// ---------------------------------------------------------------------------
+//
+void CVccConferenceCall::CurrentCallsToConferenceL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::CurrentCallsToConferenceL" );
+    iConferenceCall->CurrentCallsToConferenceL();
+    }
+  
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::AddObserverL 
+// ---------------------------------------------------------------------------
+//
+void CVccConferenceCall::AddObserverL( 
+                                   const MCCPConferenceCallObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::AddObserverL" );
+    
+    iObserver = const_cast<MCCPConferenceCallObserver*>( &aObserver );
+    }
+
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCall::RemoveObserver 
+// ---------------------------------------------------------------------------
+//
+TInt CVccConferenceCall::RemoveObserver( 
+                                   const MCCPConferenceCallObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::RemoveObserver" );
+    
+    TInt retValue( KErrNone );
+    
+    if ( iObserver ==  &aObserver )
+        {
+        iObserver = NULL;
+        }
+    else
+        {
+        retValue = KErrNotFound;
+        }
+    
+    return retValue;
+    }
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCallObserver::ErrorOccurred 
+// ---------------------------------------------------------------------------
+//
+void CVccConferenceCall::ErrorOccurred( TCCPConferenceCallError aError )
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::ErrorOccurred" );
+    RUBY_DEBUG1( "- Error code [%d]", aError );
+    
+    // Tell CCE level that error occurred
+    iObserver->ErrorOccurred( aError );
+    }
+
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCallObserver::ConferenceCallCapsChanged 
+// ---------------------------------------------------------------------------
+//
+void CVccConferenceCall::ConferenceCallCapsChanged( 
+    const TCCPConferenceCallCaps aCaps )
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::ConferenceCallStateChanged()" );
+    RUBY_DEBUG1( "- Caps = %d", aCaps  );
+    
+    iObserver->ConferenceCallCapsChanged( aCaps );
+    }
+
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCallObserver::ConferenceCallStateChanged 
+// ---------------------------------------------------------------------------
+//
+void CVccConferenceCall::ConferenceCallStateChanged( 
+    const TCCPConferenceCallState aState )
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::ConferenceCallStateChanged" );
+    RUBY_DEBUG1( "- State = %d", aState );
+    iObserver->ConferenceCallStateChanged( aState );
+    }
+
+// ---------------------------------------------------------------------------
+//  @see MCCPConferenceCallObserver::ConferenceCallEventOccurred 
+// ---------------------------------------------------------------------------
+//
+void CVccConferenceCall::ConferenceCallEventOccurred( 
+     const TCCPConferenceCallEvent aEvent, MCCPCall* aReferredCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::ConferenceCallEventOccurred" );
+    iObserver->ConferenceCallEventOccurred( aEvent, 
+            MatchPluginToVccCall( aReferredCall ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Search a specific call from call array
+// ---------------------------------------------------------------------------
+//
+CVccPerformer* CVccConferenceCall::MatchPluginToVccCall( MCCPCall* aPluginCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::FindInCallArray()" );
+    
+    CVccPerformer* call = NULL;
+    
+    if ( aPluginCall )
+        {
+        for ( TInt i = 0; i < iCallArray.Count(); i++ )
+            {
+            // Comparison is made to CVccPerformer and MCCPCall objects
+            // for simplicity sake
+            if ( iCallArray[i]->PrimaryCall() == aPluginCall )
+                {
+                RUBY_DEBUG0( "- Call found" );
+                call = iCallArray[i];
+                break;
+                }
+            }
+        }
+    
+    return call;
+    }
+
+// ---------------------------------------------------------------------------
+// Collect all conference participants into array
+// ---------------------------------------------------------------------------
+//
+TInt CVccConferenceCall::GetCallArray( RPointerArray<MCCPCall>& aCallArray )
+    {
+    RUBY_DEBUG_BLOCK( "CVccConferenceCall::GetCallArray" );
+    RPointerArray<MCCPCall> pluginCalls;
+    iConferenceCall->GetCallArray( pluginCalls );
+    for( TInt i = 0; i < pluginCalls.Count(); i++ )
+        {
+        aCallArray.Append( MatchPluginToVccCall( pluginCalls[i] ) );
+        }
+        
+    pluginCalls.Close();    
+    return KErrNone;
+    }
+   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/cvccdirector.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1008 @@
+/*
+* 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:   Handles all common logic for VCC proxy and handles sessions.
+*
+*/
+
+//cleanup stack operations
+#include <mccpssobserver.h>
+#include <spnotifychange.h>
+#include <spsettings.h>
+#include <spentry.h>
+#include <spproperty.h>
+
+#include "vcchotrigger.h"
+#include "cvccdirector.h"
+#include "cvccconferencecall.h"
+#include "cvccperformer.h"
+#include "vccengpspropertylistener.h"
+#include "vccsubscribekeys.h"
+#include "vccsettingsreader.h"
+#include "vccdefinitions.h"
+#include "rubydebug.h"
+#include "cvccdtmfprovider.h"
+
+// ---------------------------------------------------------------------------
+// CVccDirector::CVccDirector
+// ---------------------------------------------------------------------------
+//
+CVccDirector::CVccDirector(): 
+	iImplementationUid( KVCCImplementationUid )
+	
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::CVccDirector" );
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::PointerArrayCleanup
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::PointerArrayCleanup( TAny* aArray )
+    {
+    static_cast<RPointerArray<CConvergedCallProvider>*>( aArray )->ResetAndDestroy();
+    static_cast<RPointerArray<CConvergedCallProvider>*>( aArray )->Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccDirector::ConstructL" );
+
+    FillCallProviderArrayL();
+    
+    // Create the HO-trigger and connect to the wlan network
+    iHoTrigger = CVccHoTrigger::NewL();
+    
+	iPropListener = CVccEngPsPropertyListener::NewL( KPSVccPropertyCategory, 
+            KVccPropKeyHoRequest );
+	RUBY_DEBUG0( "- Called CVccEngPsPropertyListener::NewL" );
+	iPropListener->AddObserverL( *this );
+	RUBY_DEBUG0( "- Called iPropListener->AddObserverL" );
+	iPropListener->Start();
+	RUBY_DEBUG0( "- Called iPropListener->Start()" );
+	
+	//notifies about the changes to SP table
+	iSpNotifier = CSPNotifyChange::NewL( *this );
+	//start service provider table notifier
+    StartSpNotifierL();
+    
+	//link states
+  	iStateInit.LinkState(iStateCalling);
+  	iStateCalling.LinkState(iStateReleasing, iStateInit, iStateFailing );
+  	iStateReleasing.LinkState(iStateInit);
+  	iStateFailing.LinkState( iStateInit );
+  	
+  	iHoKeyValue = KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::NewL
+// ---------------------------------------------------------------------------
+//
+CVccDirector* CVccDirector::NewL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccDirector::NewL" );
+    CVccDirector* self = new ( ELeave ) CVccDirector();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::~CVccDirector
+// ---------------------------------------------------------------------------
+//
+CVccDirector::~CVccDirector()
+    {
+    RUBY_DEBUG0( "CVccDirector::~CVccDirector() - ENTER" );
+
+    delete iConference;
+    iProviders.ResetAndDestroy();
+    iProviders.Close();
+    iPerfArray.ResetAndDestroy();
+    iPerfArray.Close();
+    iInitialisedPlugins.Close();
+    delete iPropListener;
+    
+    if( iSpNotifier )
+    	{
+    	iSpNotifier->Cancel();
+    	}
+   	delete iSpNotifier;
+    
+    delete iHoTrigger;
+    delete iDtmfProvider;
+    REComSession::FinalClose();
+    
+    RUBY_DEBUG0( "CVccDirector::~CVccDirector() - EXIT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::FillCallProviderArrrayL
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::FillCallProviderArrayL()
+	{
+    //no supplementary services
+    //creating cs and sipvoipproviders
+    
+    //List implementations
+
+    RImplInfoPtrArray implementations;
+    TCleanupItem arrayCleanup( PointerArrayCleanup, &implementations );
+    CleanupStack::PushL( arrayCleanup );
+
+    CConvergedCallProvider::ListImplementationsL( implementations );
+ 
+    for( TInt i = 0; i<implementations.Count(); i++ )
+        {
+        RUBY_DEBUG1( "- for loop counter value: %d", i );
+        CImplementationInformation *info = implementations[i];
+        if ( IsVccOwnedPlugin ( info->ImplementationUid().iUid ) )
+            {
+            CConvergedCallProvider* provider =
+                CConvergedCallProvider::NewL( info->ImplementationUid() );
+            CleanupStack::PushL( provider );
+           
+            User::LeaveIfError( iProviders.Append( provider ) );
+            
+            CleanupStack::Pop( provider ); //aProvider
+            }
+        }
+    
+    CleanupStack::PopAndDestroy();//implementations
+	}
+
+// ---------------------------------------------------------------------------
+// CVccDirector::IsVccOwnedPlugin
+// Checks is the given call provider plugin used by VCC 
+// ---------------------------------------------------------------------------
+//
+TBool CVccDirector::IsVccOwnedPlugin( TInt aPluginId )
+	{
+	if( aPluginId == KSipVoipCallProviderPlugId || 
+		aPluginId == KCSCallProviderPlugId	)
+			return ETrue;
+	
+	return EFalse;
+	}
+
+// ---------------------------------------------------------------------------
+// CVccDirector::InitializeL
+// Tries to initialize all call provider plugins used by VCC.
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::InitializeL( const MCCPObserver& aMonitor,
+                                  const MCCPSsObserver& aSsObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccDirector::InitializeL" );
+    
+    if ( iProviders.Count() == 0 )
+    	{
+    	User::Leave( KErrNotFound );
+    	}
+	
+    iMandatoryPluginFailedError = KErrNone;
+
+    //MT: setting CVccDirector as observer to plugin
+    Initialize( *this, aSsObserver );
+
+    // Leave if mandatory plugins failed
+    User::LeaveIfError( iMandatoryPluginFailedError );
+
+    // save CCP monitor ; CCCEPluginMCCPObserver
+    const MCCPCSObserver& obs = static_cast<const MCCPCSObserver&>( aMonitor );
+    iCCPObserver = const_cast<MCCPCSObserver*>(&obs);
+
+    const MCCPSsObserver& ssObs = static_cast<const MCCPSsObserver&>( aSsObserver );
+    iCCPSsObserver = const_cast<MCCPSsObserver*>(&ssObs);
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::InitializeL
+// Tries to initialize call provider plugins VCC uses. 
+// Informs if  failure.
+// ---------------------------------------------------------------------------
+//
+TBool CVccDirector::Initialize( const MCCPObserver& aMonitor,
+        const MCCPSsObserver& aSsObserver )
+	{
+    RUBY_DEBUG_BLOCK( "CVccDirector::Initialize" );
+   
+    TBool initSucceeded = ETrue;
+	
+	for ( TInt i = 0; i < iProviders.Count() ; i++)
+        {
+        TUid pluginUid = iProviders[ i ]->Uid();
+        RUBY_DEBUG1( "starting to initialize plugin index= %d", i );
+    	
+        TRAPD( err, InitializeL( aMonitor, aSsObserver, *(iProviders[ i ]) ) );
+        RUBY_DEBUG1( "initialization err = %d", err );
+        if ( KErrNone != err && KCSCallProviderPlugId == pluginUid.iUid ) // CS plugin mandatory
+            {
+            RUBY_DEBUG0( "-- Mandatory VCC plugin initialization FAILED" );    
+            initSucceeded = EFalse; 
+            iMandatoryPluginFailedError = err;
+            }
+        else
+            {
+            switch( err )
+                {
+                case KErrNone:
+                    iInitialisedPlugins.Append(  pluginUid.iUid );
+                    //fall-through
+                case KErrAlreadyExists:
+                    RUBY_DEBUG0( "-- VCC plugin initialization OK" );
+                    break;
+                default:
+                    RUBY_DEBUG0( "-- VCC plugin initialization FAILED" );
+                    initSucceeded = EFalse;
+                    break;
+                }
+            }
+        }
+	
+	RUBY_DEBUG1( "-- VCC plugin nbr of initialized plugins:%d",
+			iInitialisedPlugins.Count() );
+	return initSucceeded; 
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::InitializeL
+// Finds from the VCC settings the service id that should be used with the 
+// given plugin. Uses the service id to initialize plugin.
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::InitializeL( const MCCPObserver& aMonitor,
+        const MCCPSsObserver& aSsObserver, CConvergedCallProvider& aPlugin )
+	{
+    RUBY_DEBUG_BLOCKL( "CVccDirector::InitializeL" );
+	TInt serviceId = VccSettingsReader::ServiceIdL( aPlugin.Uid().iUid );
+	RUBY_DEBUG1( "Initialize plugin with serviceId = %d", serviceId );	   
+    
+	User::LeaveIfError( serviceId );
+	
+	aPlugin.InitializeL( serviceId, aMonitor, 
+			aSsObserver );
+	}
+
+// ---------------------------------------------------------------------------
+// CVccDirector::NewCallL
+// ---------------------------------------------------------------------------
+//
+MCCPCall* CVccDirector::NewCallL(
+                            const CCCPCallParameters& aParameters,
+                            const TDesC& aRecipient,
+                            const MCCPCallObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccDirector::NewCallL" );
+
+    // Check call type and translate it into domain type
+    CVccPerformer* perf;
+    TBool csOriginated = EFalse;
+    
+    if( aParameters.CallType() == CCPCall::ECallTypeCSVoice )
+        {
+        RUBY_DEBUG0("CS Call");
+        iHoTrigger->SetCurrentDomainType( CVccHoTrigger::ECallDomainTypeCS );
+        csOriginated = ETrue;
+        iHoTrigger->ReadHoAllowedWhenCsOriginatedSettingL();
+        }
+    else
+        {
+        RUBY_DEBUG0("PS Call");
+        iHoTrigger->SetCurrentDomainType( CVccHoTrigger::ECallDomainTypePS );
+        }
+    
+    perf = CVccPerformer::NewL( iProviders, 
+                                iStateInit, 
+                                *iHoTrigger, 
+                                csOriginated );
+    CleanupStack::PushL( perf );
+    User::LeaveIfError( iPerfArray.Append( perf ) ); 
+    CleanupStack::Pop( perf ); // perf
+    return perf->CreatePrimaryCallL( aParameters, aRecipient, aObserver );
+    }
+
+// ---------------------------------------------------------------------------
+// Releases call
+// ---------------------------------------------------------------------------
+//
+TInt CVccDirector::ReleaseCall( MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::ReleaseCall" );
+    TInt err = KErrNotFound;
+    //Go through the performer array to see which performer should be deleted.
+    for( TInt i = 0; i < iPerfArray.Count(); i++ )
+    	{
+    	if( iPerfArray[i] == &aCall )
+    		{
+            err = iPerfArray[ i ]->ReleaseCall( aCall ); 
+            iPerfArray[ i ]->ReleaseSecondaryCallLeg();
+            delete iPerfArray[ i ];
+            iPerfArray.Remove( i );
+            iPerfArray.Compress();
+            break;
+    		}
+    	}
+    if( iPerfArray.Count() == 0 )
+        {
+        //make it possible to initiate HOs in new call
+        iHoTrigger->ManualHoCallReleased();
+        iHoTrigger->HoAllowed();
+        iHoTrigger->Stop();
+        }
+    //If iHoKeyValue it means that PropertyChanged function has been visited
+    //i.e. handover should be made. Non-active calls need to be released
+    //before handover can be made.
+    if ( iHoKeyValue >= KErrNone )
+        {
+        TRAP( err, PropertyChangedL( KPSVccPropertyCategory, 
+                            KVccPropKeyHoRequest, 
+                            iHoKeyValue ) );
+        }
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Releases emergency call
+// ---------------------------------------------------------------------------
+//
+TInt CVccDirector::ReleaseEmergencyCall( MCCPEmergencyCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::ReleaseEmergencyCall" );
+    for( TInt i = 0; i < iProviders.Count() ; i++)
+           {
+           TUid pluginUid = iProviders[ i ]->Uid();
+           if (pluginUid.iUid == KCSCallProviderPlugId )
+               {
+               RUBY_DEBUG0( "CS Plugin found" ); 
+               return iProviders[i]->ReleaseEmergencyCall( aCall );
+               }
+           }
+    
+    return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// Releases conference call
+// ---------------------------------------------------------------------------
+//
+TInt CVccDirector::ReleaseConferenceCall( MCCPConferenceCall& /*aCall*/ )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::ReleaseConferenceCall" );
+    
+    iConference->ReleaseConference();
+    delete iConference;
+    iConference = NULL;
+    iHoTrigger->HoAllowed();
+    if( iPerfArray.Count() > 0 )
+    	{
+    	for( TInt i = 0; i < iPerfArray.Count(); i++ )
+    		{
+    		iPerfArray[i]->ConferenceEnded();
+    		}
+    	}
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::Uid
+// ---------------------------------------------------------------------------
+//
+const TUid& CVccDirector::Uid() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::Uid" );
+    return iImplementationUid;
+    }
+
+// from ConvergedCallProvider
+
+// ---------------------------------------------------------------------------
+// CVccDirector::NewEmergencySessionL
+// ---------------------------------------------------------------------------
+//
+MCCPEmergencyCall* CVccDirector::NewEmergencyCallL(
+    const TUint32 aServiceId,
+    const TDesC&  aAddress,
+    const MCCPCallObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccDirector::NewEmergencyCallL" );
+    for( TInt i = 0; i < iProviders.Count() ; i++)
+        {
+        TUid pluginUid = iProviders[ i ]->Uid();
+        if (pluginUid.iUid == KCSCallProviderPlugId )
+            {
+            RUBY_DEBUG0( "CS Plugin found" ); 
+            return iProviders[i]->NewEmergencyCallL( aServiceId, aAddress, aObserver );
+            }
+        }
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::NewConferenceL
+// ---------------------------------------------------------------------------
+//
+MCCPConferenceCall* CVccDirector::NewConferenceL(
+        const TUint32 aServiceId,
+        const MCCPConferenceCallObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccDirector::NewConferenceL" );
+    
+    if ( !iConference )
+        {
+        iConference = CVccConferenceCall::NewL( aServiceId, aObserver, iPerfArray );
+        }
+    else
+        {
+        iConference->AddObserverL( aObserver );
+        }
+
+    iHoTrigger->HoNotAllowedL();
+    return iConference;
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::Caps
+// ---------------------------------------------------------------------------
+//
+TUint32 CVccDirector::Caps() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::Caps()" );
+    return 0;
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::DTMFProvider
+// ---------------------------------------------------------------------------
+//
+MCCPDTMFProvider* CVccDirector::DTMFProviderL(
+                                           const MCCPDTMFObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccDirector::DTMFProviderL" );
+    if( !iDtmfProvider )
+        {
+        iDtmfProvider = CVccDtmfProvider::NewL( iProviders, aObserver, *this );
+        }
+    return iDtmfProvider; 
+    }
+
+
+// ---------------------------------------------------------------------------
+// CVccDirector::ExtensionProvider
+// ---------------------------------------------------------------------------
+//
+MCCPExtensionProvider* CVccDirector::ExtensionProviderL(
+                                const MCCPExtensionObserver& /*aObserver*/ )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccDirector::ExtensionProviderL" );
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::AddObserverL
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::AddObserverL( const MCCPDTMFObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccDirector::AddObserverL" );
+    if(iDtmfProvider)
+        {
+        iDtmfProvider->AddObserverL(aObserver);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::RemoveObserver
+// ---------------------------------------------------------------------------
+//
+TInt CVccDirector::RemoveObserver( const MCCPDTMFObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::RemoveObserver" );
+    if(iDtmfProvider)
+        {
+        return iDtmfProvider->RemoveObserver(aObserver);
+        }
+    return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::GetLifeTime
+// ---------------------------------------------------------------------------
+//
+TBool CVccDirector::GetLifeTime( TDes8& aLifeTimeInfo )
+    {
+    for( TInt i = 0; i < iProviders.Count(); i++ )
+        {
+        if( iProviders[ i ]->GetLifeTime( aLifeTimeInfo ) )
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+    
+// ---------------------------------------------------------------------------
+// CVccDirector::GetCSInfo
+// ---------------------------------------------------------------------------
+//
+TBool CVccDirector::GetCSInfo( CSInfo& aCSInfo )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::GetCSInfo" );
+    for( TInt i = 0; i < iProviders.Count(); i++ )
+        {
+        if( iProviders[ i ]->GetCSInfo( aCSInfo ) )
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::CPPObserver()
+// ---------------------------------------------------------------------------
+//
+const MCCPCSObserver* CVccDirector::CPPObserver() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::CPPObserver" );
+    return iCCPObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::ErrorOccurred
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::ErrorOccurred( const TCCPError /*aError*/ )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::ErrorOccurred" );
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::IncomingCall
+// Transfer call
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::IncomingCall( MCCPCall* /*aCall*/, MCCPCall& /*aTempCall*/ )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::IncomingCall" );
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::IncomingCall
+// 
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::IncomingCall( MCCPCall* aCall )
+    {
+    TRAP_IGNORE( IncomingCallL( aCall ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::IncomingCallL
+// 
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::IncomingCallL( MCCPCall* aCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::IncomingCallL" );
+
+    RUBY_DEBUG1( "CVccDirector::IncomingCallL - array count: %d", iPerfArray.Count() );
+    TBool csOriginated = EFalse;
+    if( aCall->Parameters().CallType() == CCPCall::ECallTypeCSVoice )
+        {
+        RUBY_DEBUG0("incoming CS Call");
+        iHoTrigger->SetCurrentDomainType( CVccHoTrigger::ECallDomainTypeCS );
+        csOriginated = ETrue;
+        iHoTrigger->ReadHoAllowedWhenCsOriginatedSettingL();
+        
+        }
+    
+    else
+        {
+        RUBY_DEBUG0("incoming PS Call");
+        iHoTrigger->SetCurrentDomainType( CVccHoTrigger::ECallDomainTypePS );
+        }
+    
+    //Create 1 performer for each call
+    
+    CVccPerformer* perf = CVccPerformer::NewL( iProviders, 
+                                               iStateInit, 
+                                               *iHoTrigger,
+                                               csOriginated );
+    CleanupStack::PushL( perf );
+    User::LeaveIfError( iPerfArray.Append( perf ) );
+	CleanupStack::Pop( perf ); //perf
+    perf->IncomingCall( aCall );
+ 	iCCPObserver->IncomingCall( perf );
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::CallCreated
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::CallCreated( MCCPCall* /*aNewTransferCall*/,
+                              MCCPCall* /*aOriginator*/,
+                              TBool /*aAttented*/ )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::CallCreated" );
+    }
+
+// ---------------------------------------------------------------------------
+// CVccDirector::DataPortName
+// ---------------------------------------------------------------------------
+//
+void CVccDirector::DataPortName( TName& aPortName )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::DataPortName" );
+    iCCPObserver->DataPortName( aPortName );
+    }
+
+// -----------------------------------------------------------------------------
+//  Gets called when PS key is changed
+// -----------------------------------------------------------------------------
+//
+void CVccDirector::PropertyChangedL( const TUid /*aCategoryId*/, 
+                                    const TUint aKeyId,
+                                    const TInt aValue )	
+    {
+    RUBY_DEBUG_BLOCKL( "CVccDirector::PropertyChangedL" );
+    // Go through the performer array to see which call is in active state.
+    // HO is done for the active call. Other calls are dropped.
+    if (aKeyId == KVccPropKeyHoRequest && 
+    	( aValue == EVccManualStartCsToPsHoRequest ||
+    	  aValue == EVccAutomaticStartCsToPsHoRequest ||
+          aValue == EVccManualStartPsToCsHoRequest ||
+          aValue == EVccAutomaticStartPsToCsHoRequest ||
+          aValue == EVccAutomaticStartPsToCsHoRequestIfSingleCall ||
+          aValue == EVccAutomaticStartCsToPsHoRequestIfSingleCall ) )
+		{
+			// If manual handover is initiated during active call, automatic 
+			// handovers are no longer done during the ongoing call
+			// ==> stopping HoTrigger
+			if ( aValue == EVccManualStartCsToPsHoRequest || 
+             	aValue == EVccManualStartPsToCsHoRequest )
+				{
+				iHoTrigger->ManualHoCallStarted();
+				}
+		//Check state of call and handover when possible
+        SwitchL( aValue );
+		
+	    }//if
+		
+	else if (aKeyId == KVccPropKeyHoStatus)
+		{
+		RUBY_DEBUG0( "CVccDirector::PropertyChangedL -- no handover" );
+		iHoKeyValue = KErrNotFound;	
+		}//else-if
+
+    }
+
+// -----------------------------------------------------------------------------
+// Callback function for service settings table observer.
+// Service provider settings table was changed.  
+// Only VCC service changes are notified
+// -----------------------------------------------------------------------------
+//
+void CVccDirector::HandleNotifyChange( TServiceId /*aServiceId*/ )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::HandleNotifyChange" );
+    
+    if( !IsPluginInitialized())
+    	RetryInitialization();
+    }
+
+// -----------------------------------------------------------------------------
+// HandleError event recieved from service provider settings table observer
+// -----------------------------------------------------------------------------
+//
+void CVccDirector::HandleError( TInt /*aError*/ )
+   {
+   RUBY_DEBUG_BLOCK( "CVccDirector::HandleError" );
+   }
+
+// -----------------------------------------------------------------------------
+// Get call type of the call and return it.
+// -----------------------------------------------------------------------------
+//
+TInt CVccDirector::CurrentCallTypeForDTMF()
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::CurrentCallTypeForDTMF" );
+    TInt ret = KErrNotFound;
+    
+    for( TInt i = 0; i < iPerfArray.Count(); i++ )
+        {
+        if( iPerfArray[i]->PrimaryCall()->State() == 
+            MCCPCallObserver::ECCPStateDialling ||
+            iPerfArray[i]->PrimaryCall()->State() == 
+            MCCPCallObserver::ECCPStateConnecting ||
+            iPerfArray[i]->PrimaryCall()->State() == 
+            MCCPCallObserver::ECCPStateConnected )
+            {
+            ret = (TInt) iPerfArray[i]->PrimaryCall()->Parameters().CallType();
+            break;
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Get call type of the call and and fetch that call provider and
+// return it.
+// -----------------------------------------------------------------------------
+//
+CConvergedCallProvider* CVccDirector::GetProvider()
+    {
+    CConvergedCallProvider* ret = NULL;
+    
+    //if no performers in array, all calls have been disconnected
+    //and current call must be emergency call -> return CS provider
+    if( iPerfArray.Count() > 0 )
+        {
+        for( TInt i = 0; i < iPerfArray.Count(); i++ )
+            {
+            if( iPerfArray[i]->PrimaryCall()->State() == 
+                MCCPCallObserver::ECCPStateDialling ||
+                iPerfArray[i]->PrimaryCall()->State() == 
+                MCCPCallObserver::ECCPStateConnecting ||
+                iPerfArray[i]->PrimaryCall()->State() == 
+                MCCPCallObserver::ECCPStateConnected )
+                {
+                if( iPerfArray[ i ]->PrimaryCall()->Parameters().CallType() == 
+                                               CCPCall::ECallTypePS )
+                    {
+                    ret = &iPerfArray[i]->PsProvider();
+                    break;
+                    }
+                else
+                    {
+                    ret = &iPerfArray[i]->CsProvider();
+                    break;
+                    }
+                }
+            }
+        }
+    else
+        {
+        for( TInt i = 0; i < iProviders.Count(); i++ )
+            {
+            TUid pluginUid = iProviders[ i ]->Uid();
+            if( pluginUid.iUid == KCSCallProviderPlugId )
+                {
+                ret = iProviders[ i ];
+                }
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+//  Checks state of calls and acts accordingly
+//  Anything else except Waiting or connected - hangup
+//  Waiting - reject
+//  Connected - handover
+// -----------------------------------------------------------------------------
+//
+void CVccDirector::SwitchL( const TInt aValue )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccDirector::SwitchL" );
+    //if there is only 1 performer in the array it means that handover can be
+    //made with that performer. If there are more performers it meas that it
+    //is multicall situation and non-active calls need to be released before
+    //handover.
+    //This function is called as many times as there are performers. See 
+    //ReleaseCall!
+    if (iPerfArray.Count() > 1 )
+        {
+        if( aValue == EVccAutomaticStartCsToPsHoRequestIfSingleCall || 
+            aValue == EVccAutomaticStartPsToCsHoRequestIfSingleCall )
+            {
+            return;
+            }
+        //Check that the connected call is capable to make handover (ie. it is
+        //PS call and the direction of HO is PS to CS and vica verse).
+	    for( TInt i = 0; i < iPerfArray.Count(); i++ )
+	    	{
+	    	//call is connected
+	    	if( iPerfArray[i]->PrimaryCall()->State() == MCCPCallObserver::ECCPStateConnected )
+	    		{
+	    		//cs call and the direction is ps to cs. no ho, return
+	    		if( iPerfArray[i]->PrimaryCall()->Parameters().CallType() ==
+	    		        CCPCall::ECallTypeCSVoice &&
+	    		        ( aValue == EVccManualStartPsToCsHoRequest 
+	    				|| aValue == EVccAutomaticStartPsToCsHoRequest ) )
+	    			{
+	    			iHoKeyValue = KErrNotFound;
+	    			return;
+	    			}
+	    		//ps call and the direction is cs to ps. no ho, return
+	    		else if( iPerfArray[i]->PrimaryCall()->Parameters().CallType() ==
+	    		        CCPCall::ECallTypePS && 
+						( aValue == EVccManualStartCsToPsHoRequest 
+	    				|| aValue == EVccAutomaticStartCsToPsHoRequest ) )
+	    			{
+	    			iHoKeyValue = KErrNotFound;
+	    			return;
+	    			}
+	    		}
+	    	}
+	    //It is now ok to hangup/reject non-active calls and make handover.
+        for( TInt i = 0; i < iPerfArray.Count(); i++)
+            {
+            if ( (iPerfArray[i]->PrimaryCall()->State() == MCCPCallObserver::ECCPStateRinging) ||
+                  iPerfArray[i]->PrimaryCall()->State() == MCCPCallObserver::ECCPStateConnecting   )
+                {
+                RUBY_DEBUG0( "CVccDirector::SwitchL - Reject");
+                User::LeaveIfError( iPerfArray[i]->Reject() );
+                iHoKeyValue = aValue;
+                break;
+                }
+            
+            else if (iPerfArray[i]->PrimaryCall()->State() != MCCPCallObserver::ECCPStateConnected)
+                {
+                RUBY_DEBUG0( "CVccDirector::SwitchL - Hangup");
+                User::LeaveIfError( iPerfArray[i]->HangUp() );
+                iHoKeyValue = aValue;
+                break;
+                }
+            } //for             
+        } //if
+    else
+        {
+        iPerfArray[0]->SwitchL(aValue);
+        iHoKeyValue = KErrNotFound;
+
+        }//else
+    }
+
+// -----------------------------------------------------------------------------
+// Checks are the plugins vcc uses initialised
+// -----------------------------------------------------------------------------
+//
+TBool CVccDirector::IsPluginInitialized()
+	{
+	RUBY_DEBUG_BLOCK( "CVccDirector::IsPluginInitialized" );
+	
+	if( iProviders.Count() == 0 )
+		return EFalse;
+		
+	TBool initialised = ETrue;
+	for( TInt i = 0; i < iProviders.Count() ; i++)
+		{
+		TUid pluginUid = iProviders[ i ]->Uid();
+		
+		TInt found = iInitialisedPlugins.Find( pluginUid.iUid );
+		if( found == KErrNotFound )	
+			{
+			initialised = EFalse;
+			break;
+			}
+		}
+	
+	RUBY_DEBUG1( "-- IsPluginInitialised:%d", initialised );
+	return initialised;
+	}
+
+// -----------------------------------------------------------------------------
+// Starts settings provider table observer.
+// Director is notified about the change in VCC settings. 
+// -----------------------------------------------------------------------------
+//
+void CVccDirector::StartSpNotifierL()
+	{
+	RUBY_DEBUG_BLOCKL( "CVccDirector::StartSpNotifierL" );
+	__ASSERT_DEBUG(iSpNotifier, User::Leave( KErrNotFound ));
+	
+
+	RIdArray array;
+	CleanupClosePushL( array );
+
+	
+	iSpNotifier->NotifyChangeL( array );
+	
+	CleanupStack::PopAndDestroy( &array );
+	}
+
+// -----------------------------------------------------------------------------
+// Stops settings provider table observer.
+// -----------------------------------------------------------------------------
+//
+void CVccDirector::StopSpNotifierL()
+	{
+	RUBY_DEBUG_BLOCK( "CVccDirector::StopSpNotifierL" );
+	__ASSERT_DEBUG( iSpNotifier, User::Leave( KErrNotFound ) );
+	iSpNotifier->NotifyChangeCancel();
+	}
+
+// -----------------------------------------------------------------------------
+// Tries to initialize the call provider plugins that were not 
+// initialized the first time because of missing settings.
+// -----------------------------------------------------------------------------
+//
+void CVccDirector::RetryInitialization()
+	{
+	RUBY_DEBUG_BLOCK( "CVccDirector::ReTryInitializationL" );
+	Initialize( *this, *iCCPSsObserver );
+	}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CVccDirector::MoCallCreated( MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::MoCallCreated" );
+    
+    RUBY_DEBUG1( "CVccDirector::MoCallCreated - array count: %d", iPerfArray.Count() );
+    TBool csOriginated = EFalse;
+    if( aCall.Parameters().CallType() == CCPCall::ECallTypeCSVoice )
+        {
+        csOriginated = ETrue;
+        iHoTrigger->ReadHoAllowedWhenCsOriginatedSettingL();
+            
+        }
+    //Create 1 performer for each call
+        
+    CVccPerformer* perf = CVccPerformer::NewL( iProviders, 
+                                               iStateInit, 
+                                               *iHoTrigger,
+                                               csOriginated );
+    CleanupStack::PushL( perf );
+    User::LeaveIfError( iPerfArray.Append( perf ) );
+    CleanupStack::Pop( perf ); //perf
+    perf->MoCall( &aCall );
+    iCCPObserver->MoCallCreated( *perf );
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CVccDirector::ConferenceCallCreated( MCCPConferenceCall& aConferenceCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::ConferenceCallCreated" );
+    if ( !iConference )
+        {
+        TInt err( KErrNone );
+        TRAP( err, CreateConferenceL( aConferenceCall ) );
+        if( KErrNone == err )
+           {
+           TRAP_IGNORE( iHoTrigger->HoNotAllowedL() );
+           iCCPObserver->ConferenceCallCreated( *iConference );  
+           }
+        else
+           {
+           RUBY_DEBUG1( "CVccDirector::Conference call creation failed - error: %d", err );
+           }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CVccDirector::CreateConferenceL
+//
+// -----------------------------------------------------------------------------
+//
+void CVccDirector::CreateConferenceL( MCCPConferenceCall& aConferenceCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDirector::CreateConferenceL" );
+    iConference = CVccConferenceCall::NewL( aConferenceCall, iPerfArray );
+    aConferenceCall.AddObserverL( *iConference );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/cvccdtmfprovider.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,263 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Sends and receives DTMF tones
+*
+*/
+
+#include <cconvergedcallprovider.h>
+
+#include "cvccdtmfprovider.h"
+#include "cvccdirector.h"
+#include "rubydebug.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Symbian constructor
+// ---------------------------------------------------------------------------
+//
+CVccDtmfProvider* CVccDtmfProvider::NewL(
+        RPointerArray<CConvergedCallProvider>& /*aProviders*/, 
+        const MCCPDTMFObserver& aObserver,
+        CVccDirector& aDirector )
+	{
+    RUBY_DEBUG_BLOCK( "CVccDtmfProvider::NewL" );
+	CVccDtmfProvider* self;
+	self = new( ELeave ) CVccDtmfProvider( aObserver, aDirector );
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CVccDtmfProvider::~CVccDtmfProvider()
+	{
+	iObservers.Close();
+	iProviders.Close();
+	}
+
+// ---------------------------------------------------------------------------
+// CVccDtmfProvider::CVccDtmfProvider
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CVccDtmfProvider::CVccDtmfProvider( const MCCPDTMFObserver& aObserver,
+                                    CVccDirector& aDirector):
+    iDirector( &aDirector )                                   
+    {
+    RUBY_DEBUG_BLOCK( "CVccDtmfProvider::CVccDtmfProvider" );		
+    iObservers.InsertInAddressOrder( &aObserver );
+    }
+		
+// ---------------------------------------------------------------------------
+// 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CVccDtmfProvider::ConstructL()
+	{
+    RUBY_DEBUG_BLOCKL( "CVccDtmfProvider::ConstructL" );
+	}
+
+
+// ---------------------------------------------------------------------------
+// @ see MCCPDTMFObserver::HandleDTMFEvent
+// ---------------------------------------------------------------------------
+//
+void CVccDtmfProvider::HandleDTMFEvent( const MCCPDTMFObserver::TCCPDtmfEvent aEvent,
+								        const TInt aError,
+								        const TChar aTone ) const
+    {
+    RUBY_DEBUG_BLOCK( "CVccDtmfProvider::HandleDTMFEvent" );	
+    RUBY_DEBUG1( "CVccDtmfProvider::HandleDTMFEvent -- obs count: %d",
+                                                  iObservers.Count() );
+    for ( TInt i = 0; i < iObservers.Count(); i++ )
+        {
+        iObservers[i]->HandleDTMFEvent( aEvent, aError, aTone );
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// @see MCCPDTMFProvider::CancelDtmfStringSending
+// ---------------------------------------------------------------------------
+//
+TInt CVccDtmfProvider::CancelDtmfStringSending()
+	{
+    RUBY_DEBUG_BLOCK( "CVccDtmfProvider::CancelDtmfStringSending" );
+    RUBY_DEBUG1( "-- call type = %d (0 = cs, 4 = ps)",
+                        iDirector->CurrentCallTypeForDTMF() );
+    TInt err( KErrNotSupported );
+    
+    CConvergedCallProvider* prov = iDirector->GetProvider();
+    if( prov )
+        {
+        MCCPDTMFProvider* dtmf = NULL;
+        TRAPD( err1, dtmf = prov->DTMFProviderL( *this ) );
+        if( err1 == KErrNone )
+            {
+            err = dtmf->CancelDtmfStringSending();
+            }
+        else
+            {
+            err = err1;
+            }
+         
+        }
+    
+    RUBY_DEBUG1( "err = %d ", err );
+  
+    return err;
+	}
+
+// ---------------------------------------------------------------------------
+// @see MCCPDTMFProvider::StartDtmfTone
+// ---------------------------------------------------------------------------
+//
+TInt CVccDtmfProvider::StartDtmfTone( const TChar aTone )
+	{
+    RUBY_DEBUG_BLOCK( "CVccDtmfProvider::StartDtmfTone" );
+    RUBY_DEBUG1( "-- call type = %d (0 = cs, 4 = ps)",
+                         iDirector->CurrentCallTypeForDTMF() );
+    TInt err( KErrNotSupported );
+    
+    CConvergedCallProvider* prov = iDirector->GetProvider();
+    if( prov )
+        {
+        MCCPDTMFProvider* dtmf = NULL;
+        TRAPD( err1, dtmf = prov->DTMFProviderL( *this ) );
+        if( err1 == KErrNone )
+            {
+            err = dtmf->StartDtmfTone( aTone );
+            }
+        else
+            {
+            err = err1;
+            }
+        }
+    return err;
+	}
+
+// ---------------------------------------------------------------------------
+// @see MCCPDTMFProvider::StopDtmfTone
+// ---------------------------------------------------------------------------
+//
+TInt CVccDtmfProvider::StopDtmfTone()
+	{
+    RUBY_DEBUG_BLOCK( "CVccDtmfProvider::StopDtmfTone" );
+    RUBY_DEBUG1( "-- call type = %d (0 = cs, 4 = ps)",
+                       iDirector->CurrentCallTypeForDTMF() );
+    TInt err( KErrNotSupported );
+    CConvergedCallProvider* prov = iDirector->GetProvider();
+    if( prov )
+        {
+        MCCPDTMFProvider* dtmf = NULL;
+        TRAPD( err1, dtmf = prov->DTMFProviderL( *this ) );
+        if( err1 == KErrNone )
+            {
+            err = dtmf->StopDtmfTone();
+            }
+        else
+            {
+            err = err1;
+            }
+        }
+    return err;
+	}
+
+// ---------------------------------------------------------------------------
+// @see MCCPDTMFProvider::SendDtmfToneString
+// ---------------------------------------------------------------------------
+//
+TInt CVccDtmfProvider::SendDtmfToneString( const TDesC& aString )
+	{
+    RUBY_DEBUG_BLOCK( "CVccDtmfProvider::SendDtmfToneString" );
+    RUBY_DEBUG1( "-- call type = %d (0 = cs, 4 = ps)",
+                      iDirector->CurrentCallTypeForDTMF() );
+    TInt err( KErrNotSupported );
+    
+    CConvergedCallProvider* prov = iDirector->GetProvider();
+    if( prov )
+        {
+        MCCPDTMFProvider* dtmf = NULL;
+        TRAPD( err1, dtmf = prov->DTMFProviderL( *this ) );
+        if( err1 == KErrNone )
+            {
+            err = dtmf->SendDtmfToneString( aString );
+            }
+        else
+            {
+            err = err1;
+            }
+        }
+    RUBY_DEBUG1( "err = %d ", err );
+   
+    return err;
+	}
+
+// ---------------------------------------------------------------------------
+// @see MCCPDTMFProvider::ContinueDtmfStringSending
+// ---------------------------------------------------------------------------
+//
+TInt CVccDtmfProvider::ContinueDtmfStringSending( const TBool aContinue )
+	{
+    RUBY_DEBUG_BLOCK( "CVccDtmfProvider::ContinueDtmfStringSending" );
+    RUBY_DEBUG1( "-- call type = %d (0 = cs, 4 = ps)", 
+                        iDirector->CurrentCallTypeForDTMF() );
+    TInt err ( KErrNotSupported );
+    
+    CConvergedCallProvider* prov = iDirector->GetProvider();
+    if( prov )
+        {
+        MCCPDTMFProvider* dtmf = NULL;
+        TRAPD( err1, dtmf = prov->DTMFProviderL( *this ) );
+        if( err1 == KErrNone )
+            {
+            err = dtmf->ContinueDtmfStringSending( aContinue );
+            }
+        else
+            {
+            err = err1;
+            }
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// @see MCCPDTMFProvider::AddObserverL
+// ---------------------------------------------------------------------------
+//
+void CVccDtmfProvider::AddObserverL( const MCCPDTMFObserver& aObserver )
+	{
+    RUBY_DEBUG_BLOCK( "CVccDtmfProvider::AddObserverL" );
+    iObservers.InsertInAddressOrderL( &aObserver );
+	}
+
+// ---------------------------------------------------------------------------
+// @see MCCPDTMFProvider::RemoveObserver
+// ---------------------------------------------------------------------------
+//
+TInt CVccDtmfProvider::RemoveObserver( const MCCPDTMFObserver& aObserver )
+	{
+    RUBY_DEBUG_BLOCK( "CVccDtmfProvider::RemoveObserver" );
+    TInt res = iObservers.Find( &aObserver );
+    if ( res != KErrNotFound )
+        {
+        iObservers.Remove( res );
+        res = KErrNone;
+        }
+    return res;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/cvccperformer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,988 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   CCP reference plug-in implementation.
+*
+*/
+
+#include <mccpcall.h>
+#include <mccpcallobserver.h>
+#include "ccpdefs.h" 
+#include <mccpforwardprovider.h>
+
+#include "vccdefinitions.h"
+#include "cvccperformer.h"
+#include "vcchotrigger.h"
+#include "vccsettingsreader.h"
+#include "cvcctransferprovider.h"
+
+//state machine
+#include "tvccstateinit.h"
+#include "tvccstatecalling.h"
+#include "tvccstatefailing.h"
+#include "tvccstatereleasing.h"
+#include "rubydebug.h"
+
+_LIT( KSVPSipPrefix, "sip:" );
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+CVccPerformer::CVccPerformer(RPointerArray<CConvergedCallProvider>& aProviders,
+							 TVccState& aState, CVccHoTrigger& aVccHoTrigger,
+							 TBool aCsOriginated ) :
+    iProviders(aProviders),
+    iCurrentState(&aState),
+    iVccHoTrigger( aVccHoTrigger ),
+    iCsOriginated( aCsOriginated),
+    iTransferProvider( NULL ),
+    iRemotePartiesSet( EFalse )
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::CVccPerformer" );
+    }
+
+// -----------------------------------------------------------------------------
+// Default C++ destructor.
+// -----------------------------------------------------------------------------
+//
+CVccPerformer::~CVccPerformer()
+    {
+    RUBY_DEBUG0( "CVccPerformer::~CVccPerformer() - ENTER" );
+	delete iVccPsp;
+	delete iTransferProvider;
+    RUBY_DEBUG0( "CVccPerformer::~CVccPerformer() - EXIT" );
+    }
+// -----------------------------------------------------------------------------
+// Call creating comes here. In MT case observer is null and CCE will call
+// SetObserver later on for us
+// -----------------------------------------------------------------------------
+//
+CVccPerformer* CVccPerformer::NewL(
+						RPointerArray<CConvergedCallProvider>& aProviders, 
+						TVccState& aState,
+						CVccHoTrigger& aVccHoTrigger,
+						TBool aCsOriginated)
+    {
+    RUBY_DEBUG_BLOCKL( "CVccPerformer::NewL" );
+    CVccPerformer* self = new( ELeave ) CVccPerformer(aProviders, 
+    													aState, 
+    													aVccHoTrigger,
+    													aCsOriginated);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(self);
+
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CVccPerformer::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccPerformer::ConstructL" );
+        
+    iVccPsp = CVccEngPsProperty::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// User has answered the incoming call
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::Answer()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::Answer" );
+ 	return iCurrentState->Answer(*iPrimaryCall);
+    }
+    
+// -----------------------------------------------------------------------------
+// User has rejected the incoming call
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::Reject()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::Reject" );
+  	return iCurrentState->Reject(*iPrimaryCall);
+    }
+    
+// -----------------------------------------------------------------------------
+// Queue incoming call
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::Queue()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::Queue" );
+ 	return iCurrentState->Queue(*iPrimaryCall);
+    }
+    
+// -----------------------------------------------------------------------------
+// Dial a new call
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::Dial()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::Dial" );
+ 	return iCurrentState->Dial(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// MT call user ringing now
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::Ringing()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::Ringing" );
+	return iCurrentState->Ringing(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// End current call
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::HangUp()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::HangUp" );
+    return iCurrentState->HangUp(*this, *iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Cancel ongoing request
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::Cancel()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::Cancel" );
+  	return iCurrentState->Cancel(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Hold call
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::Hold()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::Hold" );
+    return iCurrentState->Hold(*iPrimaryCall); 
+    }
+
+// -----------------------------------------------------------------------------
+// Resume held call
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::Resume()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::Resume" );
+ 	return iCurrentState->Resume(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Swap hold/resume states
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::Swap()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::Swap" );
+    return iCurrentState->Swap(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Get call recipient
+// -----------------------------------------------------------------------------
+//
+const TDesC& CVccPerformer::RemoteParty() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::RemoteParty" );
+    
+    return iOrigRemoteParty;
+    }
+
+// -----------------------------------------------------------------------------
+// RemotePartyName
+// -----------------------------------------------------------------------------
+//
+const TDesC& CVccPerformer::RemotePartyName()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::RemotePartyName" );
+    return iOrigRemotePartyName;
+    //return iCurrentState->RemoteParty(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Get call recipient
+// -----------------------------------------------------------------------------
+//
+const TDesC& CVccPerformer::DialledParty() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::DialledParty" );
+    return iCurrentState->DialledParty(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Is call forwarded or not
+// -----------------------------------------------------------------------------
+//
+TBool CVccPerformer::IsCallForwarded() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::IsCallForwarded " );
+ 	return iCurrentState->IsCallForwarded(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Is call mobile originated or not
+// -----------------------------------------------------------------------------
+//
+TBool CVccPerformer::IsMobileOriginated() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::IsMobileOriginated" );
+ 	return iCurrentState->IsMobileOriginated(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Get current call state
+// -----------------------------------------------------------------------------
+//
+MCCPCallObserver::TCCPCallState CVccPerformer::State() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::State " );
+ 	return iCurrentState->State(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Get plug-in UID
+// -----------------------------------------------------------------------------
+//
+TUid CVccPerformer::Uid() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::Uid " );
+  
+    return TUid::Uid( KVccCallProviderPlugId );
+    }
+
+// -----------------------------------------------------------------------------
+// get call capabilities
+// -----------------------------------------------------------------------------
+//
+MCCPCallObserver::TCCPCallControlCaps CVccPerformer::Caps() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::CVccPerformer" );
+ 	return iCurrentState->Caps(*iPrimaryCall);
+    }
+
+
+// -----------------------------------------------------------------------------
+// SecureSpecified()
+// -----------------------------------------------------------------------------
+//
+TBool CVccPerformer::SecureSpecified() const
+    {
+    return iCurrentState->SecureSpecified( *iPrimaryCall );
+    }
+// -----------------------------------------------------------------------------
+// Is call secured
+// -----------------------------------------------------------------------------
+//
+TBool CVccPerformer::IsSecured() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::IsSecured" );
+    return iCurrentState->IsSecured(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Set parameters
+// -----------------------------------------------------------------------------
+//
+void CVccPerformer::SetParameters( const CCCPCallParameters& aNewParams )
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::SetParameters " );
+    iCurrentState->SetParameters(aNewParams);
+    }
+
+// -----------------------------------------------------------------------------
+// Get parameters
+// -----------------------------------------------------------------------------
+//
+const CCCPCallParameters& CVccPerformer::Parameters() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::Parameters" );
+    return iCurrentState->Parameters(*iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Return used tone.
+// -----------------------------------------------------------------------------
+//
+TCCPTone CVccPerformer::Tone() const
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::Tone " );
+	return iCurrentState->Tone(*iPrimaryCall);
+	}
+  
+// -----------------------------------------------------------------------------
+// Get forward call enabling methods for the call
+// -----------------------------------------------------------------------------
+//
+MCCPForwardProvider* CVccPerformer::ForwardProviderL
+                                        ( const MCCPForwardObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccPerformer::ForwardProviderL " );
+ 	return iPrimaryCall->ForwardProviderL(aObserver);
+    }
+
+// -----------------------------------------------------------------------------
+// Get transfer call enabling methods for the call
+// -----------------------------------------------------------------------------
+//
+MCCPTransferProvider* CVccPerformer::TransferProviderL
+                                        ( const MCCPTransferObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccPerformer::TransferProviderL " );
+	if ( !iTransferProvider )
+          {    
+          iTransferProvider = CVccTransferProvider::NewL(this);
+          iTransferProvider->AddObserverL( aObserver );
+          }
+      
+    return iTransferProvider;
+    }
+
+// -----------------------------------------------------------------------------
+// Add observer.
+// the CCE will call that in the MT call case, to put the observer for a call in place
+// -----------------------------------------------------------------------------
+//
+void CVccPerformer::AddObserverL( const MCCPCallObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccPerformer::AddObserverL " );
+ 	iCallObs = const_cast<MCCPCallObserver*>( &aObserver );
+ 	iCurrentState->AddObserverL(*this, *iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// remove observer.
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::RemoveObserver(const MCCPCallObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::RemoveObserver " );
+	return iCurrentState->RemoveObserver(aObserver, *iPrimaryCall);
+    }
+
+// -----------------------------------------------------------------------------
+// Dial from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::Dial( const TDesC8& aCallParams )
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::Dial" );
+	return iCurrentState->Dial(aCallParams, 
+	                        *static_cast<MCCPCSCall*>(iPrimaryCall));
+	}
+
+// -----------------------------------------------------------------------------
+// NoFDNCheck from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+void CVccPerformer::NoFDNCheck()
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::NoFDNCheck " );
+	iCurrentState->NoFDNCheck(*static_cast<MCCPCSCall*>(iPrimaryCall));
+	}
+
+// -----------------------------------------------------------------------------
+// GetMobileCallInfo from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::GetMobileCallInfo( TDes8& aCallInfo ) const
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::GetMobileCallInfo " );
+	return iCurrentState->GetMobileCallInfo(aCallInfo,
+	                          *static_cast<MCCPCSCall*>(iPrimaryCall));
+	}
+	
+// -----------------------------------------------------------------------------
+// SwitchAlternatingCall from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::SwitchAlternatingCall()
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::SwitchAlternatingCall " );
+	return iCurrentState->SwitchAlternatingCall(
+	                         *static_cast<MCCPCSCall*>(iPrimaryCall));
+	}
+
+// -----------------------------------------------------------------------------
+// GetMobileDataCallCaps from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::GetMobileDataCallCaps( TDes8& aCaps ) const
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::GetMobileDataCallCaps " );
+	return iCurrentState->GetMobileDataCallCaps(aCaps,
+	                          *static_cast<MCCPCSCall*>(iPrimaryCall));
+	}
+
+// -----------------------------------------------------------------------------
+// LogDialedNumber from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::LogDialedNumber() const
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::LogDialedNumber " );
+	return iCurrentState->LogDialedNumber(
+	                          *static_cast<MCCPCSCall*>(iPrimaryCall) );
+	}
+	
+// -----------------------------------------------------------------------------
+// MCCPCallObserver:: ErrorOccurred
+// -----------------------------------------------------------------------------
+//
+void CVccPerformer::ErrorOccurred(const TCCPError aError, MCCPCall* aCall )
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::TCCPError ");	
+	iCurrentState->ErrorOccurred(*this, aError, aCall );
+	}
+	
+// -----------------------------------------------------------------------------
+// MCCPCallObserver:: CallStateChanged
+// -----------------------------------------------------------------------------
+//	
+void CVccPerformer::CallStateChanged( 
+                                   const MCCPCallObserver::TCCPCallState aState, 
+                                   MCCPCall* aCall  )
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::CallStateChanged ");
+	iCurrentState->CallStateChanged( *this, aState, aCall );		
+	}
+
+// -----------------------------------------------------------------------------
+// MCCPCallObserver:: CallStateChangedWithInband
+// -----------------------------------------------------------------------------
+//	
+void CVccPerformer::CallStateChangedWithInband( 
+                                   const MCCPCallObserver::TCCPCallState aState,
+                                   MCCPCall* aCall )
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::CallStateChanged ");
+	iCurrentState->CallStateChangedWithInband( *this, aState, aCall );
+	}
+
+// -----------------------------------------------------------------------------
+// MCCPCallObserver::CallEventOccurred
+// -----------------------------------------------------------------------------
+//	
+void CVccPerformer::CallEventOccurred( 
+                                   const MCCPCallObserver::TCCPCallEvent aEvent, 
+                                   MCCPCall* aCall  )
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::CallEventOccurred ");
+	iCurrentState->CallEventOccurred(*this, aEvent, aCall);
+	}
+	
+// -----------------------------------------------------------------------------
+// MCCPCallObserver::CallCapsChanged
+// -----------------------------------------------------------------------------
+//	
+void CVccPerformer::CallCapsChanged(const TUint32 aCapsFlags, MCCPCall* aCall )
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::CallCapsChanged");
+	iCurrentState->CallCapsChanged(*this, aCapsFlags, aCall );
+	}
+
+// -----------------------------------------------------------------------------
+//  Get CallObserver()
+// -----------------------------------------------------------------------------
+//
+MCCPCallObserver* CVccPerformer::CallObserver()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::CallObserver " );
+  	return iCallObs;
+    }
+
+// -----------------------------------------------------------------------------
+//  Creates actual implementation
+// -----------------------------------------------------------------------------
+//
+MCCPCall* CVccPerformer::CreatePrimaryCallL( 
+                                 const CCCPCallParameters& aParameters,
+                                 const TDesC& aRecipient,
+                                 const MCCPCallObserver& aObserver )
+	{
+    RUBY_DEBUG_BLOCKL( "CVccPerformer::CreatePrimaryCallL" );
+
+    iPrimaryCall = NULL;
+    TInt index = KErrNotFound;
+    if (aParameters.CallType() != CCPCall::ECallTypePS )
+	    {
+	    index = VoipProviderIndex( EFalse );
+	    }
+    else
+ 	    {
+ 	    index = VoipProviderIndex( ETrue );
+ 	    }
+    if( index != KErrNotFound )
+        {
+        iPrimaryCall = iProviders[ index ]->NewCallL(aParameters, aRecipient, *this);
+        }
+            
+	if( !iPrimaryCall )
+	    {
+	    User::Leave( KErrNotFound );
+	    }
+    iCallObs = const_cast< MCCPCallObserver* >( &aObserver ); 
+    
+    SetRemoteParties();
+    
+	return this;
+	}
+	
+// -----------------------------------------------------------------------------
+//  saves incoming call and returns itself
+// -----------------------------------------------------------------------------
+//
+MCCPCall* CVccPerformer::IncomingCall( MCCPCall* aCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::IncomingCall" );
+    iPrimaryCall = aCall;
+    SetRemoteParties();
+    
+    return this;
+     }
+
+// -----------------------------------------------------------------------------
+//  saves 3rd party mo call and returns itself
+// -----------------------------------------------------------------------------
+//
+MCCPCall* CVccPerformer::MoCall( MCCPCall* aCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::MoCall" );
+    iPrimaryCall = aCall;
+    return this;
+     }
+
+// -----------------------------------------------------------------------------
+//  Returns actual call implementation
+// -----------------------------------------------------------------------------
+//	
+MCCPCall* CVccPerformer::PrimaryCall()
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::PrimaryCall" );
+	return iPrimaryCall;	
+	}
+	
+// -----------------------------------------------------------------------------
+//  Returns actual CS provider implementation
+// -----------------------------------------------------------------------------
+//
+CConvergedCallProvider& CVccPerformer::CsProvider()
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::CsProvider" );
+	return *iProviders[ VoipProviderIndex( EFalse ) ];
+	            
+	}
+	
+// -----------------------------------------------------------------------------
+//  Returns actual PS provider implementation
+// -----------------------------------------------------------------------------
+//
+CConvergedCallProvider& CVccPerformer::PsProvider()
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::PsProvider" );
+	return *iProviders[ VoipProviderIndex( ETrue ) ];
+	}
+
+// -----------------------------------------------------------------------------
+//  Updates the actual call
+// -----------------------------------------------------------------------------
+//
+void CVccPerformer::SetCall(MCCPCall* aCall)
+    {
+    TRAP_IGNORE( SetCallL( aCall) );
+    }
+
+
+// -----------------------------------------------------------------------------
+//  Updates the actual call
+// -----------------------------------------------------------------------------
+//
+void CVccPerformer::SetCallL(MCCPCall* aCall)
+	{
+	__ASSERT_DEBUG(aCall == iSecondaryCall, User::Leave(KErrArgument));
+    RUBY_DEBUG_BLOCK( "CVccPerformer::SetCall" );
+    
+    //inform through phone engine to phone about call bubble update needs
+    MCCPCallObserver::TCCPCallEvent event = 
+                              MCCPCallObserver::ECCPNotifyRemotePartyInfoChange;
+    iCallObs->CallEventOccurred( event, this );
+    
+    //both secure call and not secure call events result in same 
+    //securestatuschanged message in phone engine.
+        
+        
+    MCCPCall* temp = iPrimaryCall;
+	iPrimaryCall = aCall;
+	iSecondaryCall = temp; //taking old call pointer
+	if (iTransferProvider)
+	    {
+	    iTransferProvider->UpdateL();
+	    }
+
+	MCCPCallObserver::TCCPCallEvent event2;
+	//if( iPrimaryCall->IsSecured() )
+	//    {
+	//    event2 = MCCPCallObserver::ECCPSecureCall;
+	//    }
+	//else
+	//    {
+	    event2 = MCCPCallObserver::ECCPNotSecureCall;
+	//    }
+    iCallObs->CallEventOccurred( event2, this );
+        
+	}
+	
+// -----------------------------------------------------------------------------
+//  Releases ongoing call
+// -----------------------------------------------------------------------------
+//
+TInt CVccPerformer::ReleaseCall(MCCPCall& /*aCall*/)
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::ReleaseCall" );
+	TInt err = KErrNotFound;
+	err = iCurrentState->ReleaseCall(*iPrimaryCall, iProviders);
+	iPrimaryCall = NULL;
+	return err;
+	}
+	
+// -----------------------------------------------------------------------------
+//  Suppressor calls this when HO is done
+// -----------------------------------------------------------------------------
+//    
+void CVccPerformer::HandoverReady()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::HandoverReady" );    
+	iSecondaryCall = NULL;
+    ActivateTrigger( ETrue );
+    //get new service id for voip call and set it to parameters
+    //this is used later for loading correct CTI plugins
+    TInt VoIPServiceId(KErrNotFound);
+    TRAP_IGNORE( VoIPServiceId = VccSettingsReader::VoIPServiceIdL() );
+    RUBY_DEBUG1( "CVccPerformer::HandoverReady() -- new Service Id: %d", VoIPServiceId );
+    CCCPCallParameters* params = NULL;
+    TRAP_IGNORE( params = iPrimaryCall->Parameters().CloneL() );
+    params->SetServiceId( VoIPServiceId );
+    iPrimaryCall->SetParameters( *params );
+    //inform through phone engine to phone about call bubble update needs
+    MCCPCallObserver::TCCPCallEvent event = 
+                              MCCPCallObserver::ECCPNotifyRemotePartyInfoChange;
+    iCallObs->CallEventOccurred( event, this );
+    
+    RUBY_DEBUG0("Let HoTrigger know about changed domain");
+
+    if( params->CallType() == CCPCall::ECallTypeCSVoice )
+          {
+          RUBY_DEBUG0("New domain is CS");
+          iVccHoTrigger.SetCurrentDomainType( CVccHoTrigger::ECallDomainTypeCS );
+          }
+      else
+          {
+          RUBY_DEBUG0("New domain is PS");
+          iVccHoTrigger.SetCurrentDomainType( CVccHoTrigger::ECallDomainTypePS );
+          }
+    
+    delete params;
+    }
+
+// -----------------------------------------------------------------------------
+//  Creates a new call to be handled
+// -----------------------------------------------------------------------------
+// 
+void CVccPerformer::CreateSecondaryCallL(
+                               const CCCPCallParameters& aParameters,
+					      	   const TDesC& aRecipient,
+					      	   const MCCPCallObserver& aObserver)
+	{
+	RUBY_DEBUG_BLOCKL( "CVccPerformer::CreateLocalSecondaryCallL" );
+	iSecondaryCall = NULL;
+	TInt index = KErrNotFound;
+	if (aParameters.CallType() != CCPCall::ECallTypePS )
+	    {
+	    index = VoipProviderIndex( EFalse );
+	    }
+	else
+	    {
+	    index = VoipProviderIndex( ETrue );
+	    }
+	if( index != KErrNotFound )
+	    {
+	    iSecondaryCall = iProviders[ index ]->NewCallL(aParameters, 
+	                                                   aRecipient, 
+	                                                   aObserver);
+	    }
+	            
+	if( !iSecondaryCall )
+	    {
+	    User::Leave( KErrNotFound );
+	    }
+	}
+
+// -----------------------------------------------------------------------------
+//  Creates a new call to be handled
+// -----------------------------------------------------------------------------
+// 
+MCCPCall* CVccPerformer::SecondaryCall()
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::SecondaryCall" );
+	return iSecondaryCall;
+	}
+	
+// -----------------------------------------------------------------------------
+//  Updates the state with the next one
+// -----------------------------------------------------------------------------
+// 
+void CVccPerformer::SetState(TVccState& aState)
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::SetState" );
+	iCurrentState = &aState;
+	}
+
+// -----------------------------------------------------------------------------
+//  Returns the state name
+// -----------------------------------------------------------------------------
+// 
+TUint CVccPerformer::StateName() const
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::StateName" );
+	return iCurrentState->Name();
+	}
+
+// -----------------------------------------------------------------------------
+//  Returns the Notifier
+// -----------------------------------------------------------------------------
+// 
+CVccEngPsProperty& CVccPerformer::Notifier()
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::Notifier" );
+	return *iVccPsp;
+	}
+
+// -----------------------------------------------------------------------------
+//  Starts Handover procedure
+// -----------------------------------------------------------------------------
+// 
+void CVccPerformer::SwitchL( const TInt aValue )
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::DoHandover" );
+	//there must be an actuall call implementation created
+	__ASSERT_DEBUG(iPrimaryCall != NULL, User::Leave(KErrArgument));
+    
+	//dont change remote party after/during handover
+	iRemotePartiesSet = ETrue;
+	// check which call is active and do handover for that call. other calls
+	// are dropped.
+	if( iPrimaryCall->State() == MCCPCallObserver::ECCPStateConnected )
+		{
+        switch ( iPrimaryCall->Parameters().CallType() )
+            {
+            case CCPCall::ECallTypeCSVoice:
+                {
+                // CS call active
+                if ( aValue == EVccAutomaticStartCsToPsHoRequest || 
+                     aValue == EVccManualStartCsToPsHoRequest ||
+                     aValue == EVccAutomaticStartCsToPsHoRequestIfSingleCall )
+                    {
+                    // HO direction OK
+                    RUBY_DEBUG0( "- CS to PS HO OK" );
+            		iCurrentState->SwitchL(*this);
+                    }
+                break;
+                }
+            case CCPCall::ECallTypePS:
+                {
+                // PS call active
+                if ( aValue == EVccAutomaticStartPsToCsHoRequest || 
+                     aValue == EVccManualStartPsToCsHoRequest ||
+                     aValue == EVccAutomaticStartPsToCsHoRequestIfSingleCall )
+                    {
+                    // HO direction OK
+                    RUBY_DEBUG0( "- PS to CS HO OK" );
+					iCurrentState->SwitchL(*this);
+                    }
+                break;
+                }
+            }        
+		}
+	}
+
+// -----------------------------------------------------------------------------
+//  Activates trigger when call becomes active
+// -----------------------------------------------------------------------------
+// 
+void CVccPerformer::ActivateTrigger( TBool aActivation )
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::ActivateTrigger" );
+	//Dont activate trigger if ho not allowed
+	if( aActivation )
+		{
+		// Trigger is started only if call type is CS or PS
+		CCPCall::TCallType type = iPrimaryCall->Parameters().CallType(); 
+		if ( type == CCPCall::ECallTypeCSVoice || 
+		     type == CCPCall::ECallTypePS )
+		    {
+		    //call became active, start trigger for automatic HOs
+		    //inform trigger about the original domain so it can check
+		    //possible HO restrictions
+		    iVccHoTrigger.Start( *this, iCsOriginated );
+		    }
+		}
+	else
+		{
+		//call is not active anymore, stop trigger
+		iVccHoTrigger.Stop( *this );
+		}
+	}
+
+// -----------------------------------------------------------------------------
+//  Updates PS key using trigger
+// -----------------------------------------------------------------------------
+// 
+void CVccPerformer::AllowHo( TBool aAllow )
+    {
+    TRAP_IGNORE( AllowHoL( aAllow) );
+    }
+
+// -----------------------------------------------------------------------------
+//  Updates PS key using trigger
+// -----------------------------------------------------------------------------
+// 
+void CVccPerformer::AllowHoL( TBool aAllow )
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::AllowHoL" );
+    if( aAllow )
+        {
+        //HO is allowed, item can be in in call options menu
+        iVccHoTrigger.HoAllowed();
+        }
+    else
+        {
+        //HO is not allowed (f.ex. remote hold) and UI item needs to be removed
+        iVccHoTrigger.HoNotAllowedL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+//  Checks call state and starts trigger if connected
+//  Conference call doesnt notify state Connected after conference ended
+//  Only one call can be in Connected state
+// -----------------------------------------------------------------------------
+// 
+void CVccPerformer::ConferenceEnded()
+	{
+	RUBY_DEBUG_BLOCK( "CVccPerformer::ConferenceEnded" );
+	if( iPrimaryCall->State() == MCCPCallObserver::ECCPStateConnected )
+		{
+		ActivateTrigger( ETrue );
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// Release secondary call leg, if needed, before calling destructor
+// -----------------------------------------------------------------------------
+// 
+void CVccPerformer::ReleaseSecondaryCallLeg()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::ReleaseSecondaryCallLeg" );
+    if ( iSecondaryCall )
+        {
+        TInt err = iCurrentState->ReleaseCall(*iSecondaryCall, iProviders);
+        if( err != KErrNone )
+            {
+            RUBY_DEBUG0("CVccPerformer::ReleaseSecondaryCallLeg:" );
+            RUBY_DEBUG1("Error releasing secondary call leg: %d", err );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Save original RemoteParty and RemotePartyName
+// -----------------------------------------------------------------------------
+// 
+void CVccPerformer::SetRemoteParties()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::SetRemoteParties" );
+    if( !iRemotePartiesSet )
+        {
+        iOrigRemoteParty = iPrimaryCall->RemoteParty();
+        iOrigRemotePartyName = iPrimaryCall->RemotePartyName();
+        ParseRemoteParty();
+        }
+    } 
+
+// -----------------------------------------------------------------------------
+// Return ps/cs provider index
+// -----------------------------------------------------------------------------
+// 
+TInt CVccPerformer::VoipProviderIndex( TBool aVoipIndexWanted )
+    {
+    TInt index = KErrNotFound;
+    CSInfo info;
+    if( aVoipIndexWanted )
+        {
+        for( TInt i = 0; i < iProviders.Count(); i++ )
+            {
+            if( !iProviders[ i ]->GetCSInfo( info ) )
+                {
+                index = i;
+                break;
+                }
+            }
+        }
+    else
+        {
+        for( TInt i = 0; i < iProviders.Count(); i++ )
+            {
+            if( iProviders[ i ]->GetCSInfo( info ) )
+                {
+                index = i;
+                break;
+                }
+            }
+        }
+    return index;
+    }
+
+// -----------------------------------------------------------------------------
+// Parse remoteparty number if call is VoIP call
+// -----------------------------------------------------------------------------
+// 
+void CVccPerformer::ParseRemoteParty()
+    {
+    RUBY_DEBUG_BLOCK( "CVccPerformer::ParseRemoteParty" );
+    TInt position = 0;
+        
+     // seek '@' sign (returns KErrNotFound if none)
+    position = iOrigRemoteParty.Locate('@');
+        
+     // if found
+     if(position != KErrNotFound)
+           {
+           TInt length = iOrigRemoteParty.Length();
+            // remove the domain part from sip uri
+           iOrigRemoteParty.Delete(position, length - position);
+           //and delete 'sip:' prefix if found
+           if ( iOrigRemoteParty.Find( KSVPSipPrefix ) != KErrNotFound )
+               {
+               RUBY_DEBUG0("SIP: prefix found, delete it");
+               iOrigRemoteParty.Delete(0, 4);
+               }
+           }
+
+    } 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/cvccproxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   SVP Ecom proxyfile        
+*
+*/
+
+
+
+#include <e32base.h>
+#include <ecom/implementationproxy.h>
+#include "cvccdirector.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// TImplementationProxy::ImplementationTable
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 0x2000CFAA, CVccDirector::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// TImplementationProxy::ImplementationGroupProxy
+// ---------------------------------------------------------------------------
+//
+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/callcontinuity/vcc/src/cvcctransferprovider.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   Takes of call transfer 
+*                (forwards call transfer requests to SVP or CS transfer 
+*                provider 
+*
+*/
+
+
+
+#include "cvcctransferprovider.h"
+#include "cvccperformer.h"
+#include "cvccdirector.h" // KVCCImplementationUid
+#include "rubydebug.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Symbian constructor
+// ---------------------------------------------------------------------------
+//
+CVccTransferProvider* CVccTransferProvider::NewL( CVccPerformer* aCall )
+	{
+  RUBY_DEBUG_BLOCK( "CVccTransferProvider::NewL" );
+	
+	CVccTransferProvider* self;
+	self = new( ELeave ) CVccTransferProvider( aCall );
+	CleanupStack::PushL( self );
+	self->ConstructL( );
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CVccTransferProvider::~CVccTransferProvider()
+	{
+	iObservers.Close();
+	}
+
+// ---------------------------------------------------------------------------
+// CVccTransferProvider::CVccTransferProvider
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CVccTransferProvider::CVccTransferProvider(CVccPerformer* aCall )
+    : iPerfCall( aCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccDtmfProvider::CVccDtmfProvider" );		
+    
+    
+    }
+		
+// ---------------------------------------------------------------------------
+// 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CVccTransferProvider::ConstructL( )
+	 {
+     RUBY_DEBUG_BLOCK( "CVccTransferProvider::ConstructL" );
+     iCallTransferProvider = iPerfCall->PrimaryCall()->TransferProviderL(*this);
+     iCallTransferProvider->AddObserverL(*this);
+     }
+
+// ---------------------------------------------------------------------------
+// CVccTransferProvider::AttendedTransfer
+// ---------------------------------------------------------------------------
+//
+TInt CVccTransferProvider::AttendedTransfer( MCCPCall& aTransferTargetCall )
+    {
+    RUBY_DEBUG_BLOCK( "CVccTransferProvider::AttendedTransfer" );
+    MCCPCall* target = &aTransferTargetCall;
+    if ( target )
+        {
+        if ( KVCCImplementationUid == target->Uid() )
+            {
+            RUBY_DEBUG0( "CVccTransferProvider::AttendedTransfer - Target call Plugin Uid matches VCC Plugin Uid" );
+            CVccPerformer* targetCall = static_cast< CVccPerformer* >(&aTransferTargetCall);
+            target = targetCall->PrimaryCall();
+            }
+        }
+    else
+        {
+        return KErrNotReady;
+        }
+    return iCallTransferProvider->AttendedTransfer( *target );
+    }
+
+// ---------------------------------------------------------------------------
+// CVccTransferProvider::AttendedTransfer
+// ---------------------------------------------------------------------------
+//
+TInt CVccTransferProvider::AttendedTransfer( const TDesC& aTransferTarget )
+	 {
+	 RUBY_DEBUG_BLOCK( "CVccTransferProvider::AttendedTransfer" );    
+	 return iCallTransferProvider->AttendedTransfer( aTransferTarget );
+	 }
+
+// ---------------------------------------------------------------------------
+// CVccTransferProvider::UnattendedTransfer
+// ---------------------------------------------------------------------------
+//
+TInt CVccTransferProvider::UnattendedTransfer( const TDesC& aTransferTarget )
+	 {
+	 RUBY_DEBUG_BLOCK( "CVccTransferProvider::UnattendedTransfer" );
+     return iCallTransferProvider->UnattendedTransfer( aTransferTarget );
+     }
+
+// ---------------------------------------------------------------------------
+// CVccTransferProvider::AcceptTransfer
+// ---------------------------------------------------------------------------
+//
+TInt CVccTransferProvider::AcceptTransfer( const TBool aAccept )
+	 {
+	 RUBY_DEBUG_BLOCK( "CVccTransferProvider::AcceptTransfer" );
+     return iCallTransferProvider->AcceptTransfer( aAccept );
+     
+     }
+
+// ---------------------------------------------------------------------------
+// CVccTransferProvider::TransferTarget()
+// ---------------------------------------------------------------------------
+//
+const TDesC& CVccTransferProvider::TransferTarget() const
+	 {
+	 RUBY_DEBUG_BLOCK( "CVccTransferProvider::TransferTarget" );
+	 return iCallTransferProvider->TransferTarget( );
+	 }
+
+// ---------------------------------------------------------------------------
+// CVccTransferProvider::AddObserverL
+// ---------------------------------------------------------------------------
+//
+void CVccTransferProvider::AddObserverL( const MCCPTransferObserver& aObserver )
+	 {
+	 RUBY_DEBUG_BLOCK( "CVccTransferProvider::AddObserverL" );
+	 iObservers.InsertInAddressOrderL( &aObserver );
+	 }
+
+// ---------------------------------------------------------------------------
+// CVccTransferProvider::RemoveObserver
+// ---------------------------------------------------------------------------
+//
+TInt CVccTransferProvider::RemoveObserver( const MCCPTransferObserver& aObserver )
+	 {
+	 RUBY_DEBUG_BLOCK( "CVccTransferProvider::RemoveObserver" );
+	 TInt res = iObservers.Find( &aObserver );
+	    if ( res != KErrNotFound )
+	        {
+	        iObservers.Remove( res );
+	        res = KErrNone;
+	        }
+	 return res;	
+     }
+
+// ---------------------------------------------------------------------------
+// CVccTransferProvider::TransferEventOccurred
+// ---------------------------------------------------------------------------
+//
+void CVccTransferProvider::TransferEventOccurred( 
+                const MCCPTransferObserver::TCCPTransferEvent aEvent )
+    {
+    RUBY_DEBUG_BLOCK( "CVccTransferProvider::TransferEventOccurred" );
+    for ( TInt i = 0; i < iObservers.Count(); i++ )
+       {
+       iObservers[i]->TransferEventOccurred( aEvent );
+       }   
+
+    }
+
+// ---------------------------------------------------------------------------
+// CVccTransferProvider::UpdateL
+// ---------------------------------------------------------------------------
+//
+void CVccTransferProvider::UpdateL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccTransferProvider::UpdateL" );
+    iCallTransferProvider->RemoveObserver(*this);
+    iCallTransferProvider = iPerfCall->PrimaryCall()->TransferProviderL(*this);
+    iCallTransferProvider->AddObserverL(*this);
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/rubydebug.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,165 @@
+/*
+* 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:   Debugging utilities implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "rubydebug.h"
+
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#include <f32file.h>
+#endif
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#ifdef _DEBUG // UDEB version:
+_LIT( KSpace, " " );
+_LIT( KColon, ":" );
+_LIT( KFormat, "%02d" );
+_LIT( KFormat2, "%06d" );
+#endif
+#endif
+
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::PrintToFile
+// Method for writing traces to a file.
+// -----------------------------------------------------------------------------
+//
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+
+#ifdef _DEBUG // UDEB version:
+void RRubyDebug::PrintToFile( TRefByValue<const TDesC> aFmt, ... )
+    {
+    _LIT( KRubyLogFileName, "c:\\Data\\Logs\\RubyTrace_vcc.txt" );
+
+    const TInt KRubyDebugMaxLineLength = 0x84; // rest will be truncated
+
+    const TInt KRubyDebugOpenFileRetries = 100;
+    const TInt KRubyDebugOpenFileInterval = 1000;
+
+    const TUint16 KRubyDebugLineSep1 = 0x0d;
+    const TUint16 KRubyDebugLineSep2 = 0x0a;
+
+    // Handle variable argument list
+    VA_LIST list;
+	VA_START( list, aFmt );
+	TBuf<KRubyDebugMaxLineLength+2> aBuf;
+    TTruncateOverflow overflow;
+    
+    // Append the time...
+    TTime currentTime;
+    currentTime.HomeTime();
+    TDateTime dateTime = currentTime.DateTime();
+
+    aBuf.AppendFormat( KFormat, dateTime.Hour() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat, dateTime.Minute() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat, dateTime.Second() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat2, dateTime.MicroSecond() );
+    aBuf.Append( KSpace );
+    // time done
+    
+	aBuf.AppendFormatList( aFmt, list, &overflow );
+	if( aBuf.Length() > ( KRubyDebugMaxLineLength - 2 ) )
+		{
+		aBuf.Delete(aBuf.Length() - 2, 2);
+		}
+	
+    // Add linefeed characters
+    aBuf.Append( KRubyDebugLineSep1 );
+    aBuf.Append( KRubyDebugLineSep2 );
+
+    RFs fs;
+    if ( fs.Connect() == KErrNone )
+        {
+        RFile file;
+
+        // Open file in an exclusive mode so that only one thread 
+        // can acess it simultaneously
+        TUint fileMode = EFileWrite | EFileShareExclusive;
+
+        TInt err = file.Open( fs, KRubyLogFileName, fileMode );
+
+        // Create a file if it doesn't exist
+        if ( err == KErrNotFound )
+            {
+            err = file.Create( fs, KRubyLogFileName, fileMode );
+            }
+        else
+            {
+            // Error in opening the file
+            TInt retryCount = KRubyDebugOpenFileRetries;
+            while ( err == KErrInUse && retryCount-- )
+                {
+                // Some other tread is accessing the file, wait a while...
+                User::After( KRubyDebugOpenFileInterval );
+                err = file.Open( fs, KRubyLogFileName, fileMode );
+                }
+            }
+
+        // Check if we have access to a file
+        if ( err == KErrNone )
+            {
+            TInt offset = 0;
+            if ( file.Seek( ESeekEnd, offset ) == KErrNone )
+                {
+                // Append text to the end of file
+                TPtr8 ptr8( (TUint8*)aBuf.Ptr(), aBuf.Size(), aBuf.Size() );
+                file.Write( ptr8 );
+                }
+            file.Close();
+            }
+
+        fs.Close();
+        }
+    }
+
+#else // UREL version:
+void RRubyDebug::PrintToFile( TRefByValue<const TDesC> /*aFmt*/, ... )
+    {
+    }
+#endif
+
+#endif // __RUBY_DEBUG_TRACES_TO_FILE
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/tvccstate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,465 @@
+/*
+* 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:   Default implementations for the VCC state machine functions
+*
+*/
+
+#include "tvccstate.h"
+#include "cvccperformer.h"
+#include "rubydebug.h"
+
+
+// -----------------------------------------------------------------------------
+// c'tor
+// -----------------------------------------------------------------------------
+//
+
+TVccState::TVccState()
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::TVccState" );	
+	}
+
+
+// -----------------------------------------------------------------------------
+// User has answered the incoming call
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::Answer( MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::Answer" );
+ 	return aCall.Answer();
+    }
+    
+// -----------------------------------------------------------------------------
+// User has rejected the incoming call
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::Reject( MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::Reject" );
+  	return aCall.Reject();
+    }
+    
+// -----------------------------------------------------------------------------
+// Queue incoming call
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::Queue( MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::Queue" );
+ 	return aCall.Queue();
+    }
+    
+// -----------------------------------------------------------------------------
+// Dial a new call
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::Dial( MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::Dial" );
+ 	return aCall.Dial();
+    }
+
+// -----------------------------------------------------------------------------
+// MT call user ringing now
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::Ringing( MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::Ringing" );
+	return aCall.Ringing();
+    }
+
+// -----------------------------------------------------------------------------
+// End current call
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::HangUp( CVccPerformer& /*aContext*/, MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::HangUp" );
+    return aCall.HangUp();
+ 
+    }
+
+// -----------------------------------------------------------------------------
+// Cancel ongoing request
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::Cancel( MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::Cancel" );
+  	return aCall.Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// Hold call
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::Hold( MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::Hold" );
+    return aCall.Hold();
+ 
+    }
+
+
+// -----------------------------------------------------------------------------
+// Resume held call
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::Resume( MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::Resume" );
+ 	return aCall.Resume();
+    }
+
+
+// -----------------------------------------------------------------------------
+// Swap hold/resume states
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::Swap( MCCPCall& /*aCall*/ )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::Swap" );
+    //return aCall.Swap();
+    return KErrArgument; //not allowed
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// Get call recipient
+// -----------------------------------------------------------------------------
+//
+const TDesC& TVccState::RemoteParty( const MCCPCall& aCall ) const
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::RemoteParty" );
+	return aCall.RemoteParty();
+    }
+
+
+// -----------------------------------------------------------------------------
+// Get call recipient
+// -----------------------------------------------------------------------------
+//
+const TDesC& TVccState::DialledParty( const MCCPCall& aCall ) const
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::DialledParty" );
+    return aCall.DialledParty();
+ 
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// Is call forwarded or not
+// -----------------------------------------------------------------------------
+//
+TBool TVccState::IsCallForwarded( const MCCPCall& aCall ) const
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::IsCallForwarded" );
+ 	return aCall.IsCallForwarded();
+    }
+
+
+// -----------------------------------------------------------------------------
+// Is call mobile originated or not
+// -----------------------------------------------------------------------------
+//
+TBool TVccState::IsMobileOriginated( const MCCPCall& aCall ) const
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::IsMobileOriginated" );
+ 	return aCall.IsMobileOriginated();
+    }
+
+
+// -----------------------------------------------------------------------------
+// Get current call state
+// -----------------------------------------------------------------------------
+//
+MCCPCallObserver::TCCPCallState TVccState::State( const MCCPCall& aCall ) const
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::State" );
+ 	return aCall.State();
+    }
+
+
+// -----------------------------------------------------------------------------
+// get call capabilities
+// -----------------------------------------------------------------------------
+//
+MCCPCallObserver::TCCPCallControlCaps TVccState::Caps( const MCCPCall& aCall ) const
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::Caps" );
+ 	return aCall.Caps();
+    }
+
+// -----------------------------------------------------------------------------
+// SecureSpecified
+// -----------------------------------------------------------------------------
+//
+TBool TVccState::SecureSpecified( const MCCPCall& aCall ) const
+    {
+    return aCall.SecureSpecified();
+    }
+
+// -----------------------------------------------------------------------------
+// Is call secured
+// -----------------------------------------------------------------------------
+//
+TBool TVccState::IsSecured( const MCCPCall& aCall ) const
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::IsSecured" );
+    return aCall.IsSecured();
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set paramaters
+// -----------------------------------------------------------------------------
+//
+void TVccState::SetParameters( const CCCPCallParameters& /*aNewParams*/ )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::SetParameters" );
+    //not implemented
+    }
+
+// -----------------------------------------------------------------------------
+// Get paramaters
+// -----------------------------------------------------------------------------
+//
+const CCCPCallParameters& TVccState::Parameters( const MCCPCall& aCall ) const
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::Parameters" );
+    return aCall.Parameters();
+    
+    }
+
+// -----------------------------------------------------------------------------
+// Return used tone.
+// -----------------------------------------------------------------------------
+//
+TCCPTone TVccState::Tone( const MCCPCall& aCall ) const
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::Tone" );
+	return aCall.Tone();
+	}
+    
+
+// -----------------------------------------------------------------------------
+// Add observer.
+// -----------------------------------------------------------------------------
+//
+void TVccState::AddObserverL( const MCCPCallObserver& aObserver, 
+                              MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCKL( "TVccState::AddObserverL" );
+ 	aCall.AddObserverL(aObserver);
+    }
+
+// -----------------------------------------------------------------------------
+// Add observer.
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::RemoveObserver( const MCCPCallObserver& aObserver, 
+                                MCCPCall& aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::RemoveObserver" );
+	return aCall.RemoveObserver(aObserver);
+    }
+
+
+// -----------------------------------------------------------------------------
+// Dial from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::Dial( const TDesC8& aCallParams, MCCPCSCall& aCall  )
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::Dial" );
+	return aCall.Dial(aCallParams);
+	//!!!!!!!!!!!!!!-> check if "if" is really as this cannot be really invoked
+	// for non-cs call
+	}
+
+// -----------------------------------------------------------------------------
+// NoFDNCheck from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+void TVccState::NoFDNCheck( MCCPCSCall& aCall )
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::NoFDNCheck" );
+	aCall.NoFDNCheck();
+	}
+
+// -----------------------------------------------------------------------------
+// GetMobileCallInfo from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::GetMobileCallInfo( TDes8& aCallInfo, 
+                                   const MCCPCSCall& aCall ) const
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::GetMobileCallInfo" );
+	return aCall.GetMobileCallInfo(aCallInfo);
+
+	}
+	
+// -----------------------------------------------------------------------------
+// SwitchAlternatingCall from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::SwitchAlternatingCall( MCCPCSCall& aCall )
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::SwitchAlternatingCall" );
+	return aCall.SwitchAlternatingCall();
+	}
+
+// -----------------------------------------------------------------------------
+// SwitchAlternatingCall from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::GetMobileDataCallCaps( TDes8& aCaps, 
+                                       const MCCPCSCall& aCall) const
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::GetMobileDataCallCaps" );
+	return aCall.GetMobileDataCallCaps(aCaps);
+	}
+
+// -----------------------------------------------------------------------------
+// LogDialedNumber from MCCPCSCall
+// -----------------------------------------------------------------------------
+//
+TBool TVccState::LogDialedNumber( const MCCPCSCall& aCall ) const
+    {
+    RUBY_DEBUG_BLOCK( "TVccState::GetMobileDataCallCaps" );
+    return aCall.LogDialedNumber();
+    }
+//  Releases ongoing call
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::ReleaseCall( MCCPCall& aCall, 
+                             RPointerArray<CConvergedCallProvider>& aProvs )
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::ReleaseCall" );
+	TInt err = KErrNotFound;
+	for (TUint i=0; i < aProvs.Count(); i++)
+		{
+		 err = aProvs[i]->ReleaseCall(aCall);
+		 if (err == KErrNone)
+		 	{
+		 	break;
+		 	}
+		}
+	return err;
+	}
+	
+// -----------------------------------------------------------------------------
+//  Releases ongoing call
+// -----------------------------------------------------------------------------
+//
+TInt TVccState::ReleaseCall(CVccPerformer& aContext, 
+                                MCCPCall& aCall, 
+                                TVccState& aState,
+                                TUint aHoValue )
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::ReleaseCall" );
+	TInt err = KErrNotFound;
+	err = aContext.CsProvider().ReleaseCall(aCall);
+	if (err!=KErrNone)
+		{
+		aContext.PsProvider().ReleaseCall(aCall);
+		}
+		
+	if( aHoValue == KVccHoNok )
+	    {
+	    //MT party of the call disconnected the call during HO
+	    TRAP_IGNORE(aContext.Notifier().NotifySubscriberL( EVccCsToPsHoFailure, 
+	            KErrGeneral ) );
+	    }
+	else
+	    {
+	    aContext.HandoverReady();
+	    TRAP_IGNORE(aContext.Notifier().NotifySubscriberL(EVccCsToPsHoSuccessful,
+                KErrNone) );
+	    }
+	//-> Set Next State
+	aContext.SetState(aState);
+	return err;
+	}
+    
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccState::ErrorOccurred(CVccPerformer& /*aContext*/, 
+                            const TCCPError /*aError*/,
+                            MCCPCall* /*aCall*/ )
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::ErrorOccurred" );	
+	}
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccState::CallStateChanged(CVccPerformer& /*aContext*/, 
+                            const MCCPCallObserver::TCCPCallState /*aState*/,
+                            MCCPCall* /*aCall*/ )
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::CallStateChanged" );
+	}
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccState::CallStateChangedWithInband(CVccPerformer& /*aContext*/, 
+                            const MCCPCallObserver::TCCPCallState /*aState*/,
+                            MCCPCall* /*aCall*/  )
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::CallStateChangedWithInband" );
+		
+	}
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccState::CallEventOccurred(CVccPerformer& /*aContext*/, 
+                            const MCCPCallObserver::TCCPCallEvent /*aEvent*/,
+                            MCCPCall* /*aCall*/ )
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::CallEventOccurred" );	
+	}
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccState::CallCapsChanged(CVccPerformer& aContext, 
+                            const TUint32 aCapsFlags,
+                            MCCPCall* aCall )
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::CallCapsChanged" );	
+	aContext.CallObserver()->CallCapsChanged( aCapsFlags, aCall );
+	}
+    
+// -----------------------------------------------------------------------------
+// SwitchL()
+// -----------------------------------------------------------------------------
+//
+void TVccState::SwitchL(CVccPerformer& /*aContext*/)
+	{
+	RUBY_DEBUG_BLOCK( "TVccState::SwitchL" );
+	User::Leave(KErrCompletion);
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/tvccstatecalling.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,325 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 VCC Calling state
+*
+*/
+
+#include "tvccstatecalling.h"
+#include "cvccperformer.h"
+#include "rubydebug.h"
+
+
+// -----------------------------------------------------------------------------
+// c'tor
+// -----------------------------------------------------------------------------
+//
+TVccStateCalling::TVccStateCalling()
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateCalling::TVccStateCalling" );	
+	} 
+
+// -----------------------------------------------------------------------------
+// Name
+// -----------------------------------------------------------------------------
+//	
+TUint TVccStateCalling::Name() const
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateCalling::Name" );
+	return KVccStateCalling;
+	}
+
+// -----------------------------------------------------------------------------
+// LinkState
+// -----------------------------------------------------------------------------
+//
+void TVccStateCalling::LinkState(TVccState& aReleasing, 
+                                TVccState& aInit, 
+                                TVccState& aFailing )
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateCalling::LinkState" );
+	iReleasing = &aReleasing;
+	iInit = &aInit;	
+	iFailing = &aFailing;
+	}
+	
+// -----------------------------------------------------------------------------
+// HangUp
+// -----------------------------------------------------------------------------
+//
+TInt TVccStateCalling::HangUp(CVccPerformer& aContext, MCCPCall& aCall)
+	{
+    RUBY_DEBUG_BLOCK( "TVccStateCalling::HangUp" );
+    
+	TInt err = KErrNotFound;
+	
+	__ASSERT_DEBUG(&aCall == aContext.PrimaryCall(), User::Invariant());
+	
+	//must release old leg and put old observer back aCall is the
+	// same as returned in the iContext.PrimaryCall()
+	aCall.RemoveObserver(aContext);
+	
+	//add new observer because the original call will be released and events 
+	//must be suppressed and performer does not have to be on the path for this 
+	//call anymore.
+	TRAP_IGNORE(aCall.AddObserverL(*aContext.CallObserver()));
+	
+	//now hangup old leg and forget about it - CCE will take of it.
+	//The performer will not be aware of the old leg release events.
+	err = aCall.HangUp();
+	
+	//must release new call leg as well and suppress the events 	
+	//new leg idle event should come in the releasing-state and
+	//it will be suppressed.
+	__ASSERT_DEBUG(aContext.SecondaryCall() != NULL, User::Invariant());
+	aContext.SecondaryCall()->HangUp();
+	
+	//signal the performer for the "idle call", so it can stop the trigger
+	//move to the releasing state
+	aContext.SetState(*iReleasing);
+	
+	//stop trigger since call becomes not active
+	aContext.ActivateTrigger( EFalse );
+	
+	//notify UI about hangup, hangup rejects HO but it is not failure
+	//no need to show the "ho failed note"
+	TRAP_IGNORE( aContext.Notifier().NotifySubscriberL(EVccCsToPsHoSuccessful, KErrNone) );
+	
+	return err;
+	
+	}
+	
+// -----------------------------------------------------------------------------
+// CallStateChanged
+// -----------------------------------------------------------------------------
+//	
+void TVccStateCalling::CallStateChanged( CVccPerformer& aContext, 
+                                const MCCPCallObserver::TCCPCallState aState,
+                                MCCPCall* aCall )
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateCalling::CallStateChanged" );
+	
+	__ASSERT_DEBUG( aContext.SecondaryCall() != NULL, User::Invariant());
+    __ASSERT_DEBUG( aContext.PrimaryCall() != NULL, User::Invariant() );
+    
+	if ( aState == MCCPCallObserver::ECCPStateConnected && 
+         aContext.SecondaryCall() == aCall)
+		{
+        RUBY_DEBUG0( "TVccStateCalling::CallStateChanged - swap the calls" );
+        
+		aContext.SetCall(aContext.SecondaryCall());
+		
+		if ( aContext.Parameters().CallType() == CCPCall::ECallTypePS )
+            {
+            TRAP_IGNORE( aContext.Notifier().NotifySubscriberL( EVccCsToPsHoInprogress, 
+                                                   KErrNone ) );
+                  
+            RUBY_DEBUG0( "TVccStateCalling::CallStateChanged - call are swapped so hang up CS call now" );
+            ReleaseCall( aContext, *aContext.SecondaryCall(), *iInit, KVccHoOk );
+            return;
+            }
+        else
+            {
+            TRAP_IGNORE( aContext.Notifier().NotifySubscriberL( EVccPsToCsHoInprogress, 
+                                                       KErrNone ) );
+            }
+		//-> Set Next State - if the call is idle just destroy call object and 
+		//go to init-state
+		__ASSERT_DEBUG( aContext.SecondaryCall() != NULL, 
+		                User::Invariant());
+		
+		if ( aContext.SecondaryCall()->State() == 
+		     MCCPCallObserver::ECCPStateIdle)
+			{
+            RUBY_DEBUG0( "TVccStateCalling::CallStateChanged -\
+                         release the old leg" );
+            
+			//delete the actuall call object and move to Init-state
+            ReleaseCall( aContext, *aContext.SecondaryCall(), *iInit, 
+                         KVccHoOk );
+			}
+		else
+			{
+            RUBY_DEBUG0( "TVccStateCalling::CallStateChanged -\
+                          set state to iReleasing" );
+                    
+			//must wait for old leg to be released
+			aContext.SetState( *iReleasing );	
+			}				
+        }
+    else 
+        {
+        InspectChangedStates( aContext, 
+                              aState, 
+                              aCall, 
+                              aContext.CallObserver(), 
+                              &MCCPCallObserver::CallStateChanged );
+        }
+    }
+// -----------------------------------------------------------------------------
+// CallStateChangedWithInband
+// -----------------------------------------------------------------------------
+//  
+void TVccStateCalling::CallStateChangedWithInband( CVccPerformer& aContext, 
+                                const MCCPCallObserver::TCCPCallState aState,
+                                MCCPCall* aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccStateCalling::CallStateChangedWithInband" );
+    __ASSERT_DEBUG( aContext.SecondaryCall() != NULL, User::Invariant() );
+    __ASSERT_DEBUG( aContext.PrimaryCall() != NULL, User::Invariant() );
+    InspectChangedStates(aContext, 
+                        aState, 
+                        aCall, 
+                        aContext.CallObserver(), 
+                        &MCCPCallObserver::CallStateChangedWithInband);
+
+    }
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccStateCalling::ErrorOccurred( CVccPerformer& aContext, 
+                                const TCCPError aError,
+                                MCCPCall* aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccStateCalling::ErrorOccurred" );
+    RUBY_DEBUG1( "TVccStateCalling::ErrorOccurred - error: %d", aError );
+    
+    __ASSERT_DEBUG( aContext.CallObserver()!=NULL, User::Invariant() );
+    __ASSERT_DEBUG(aContext.PrimaryCall()!=NULL, User::Invariant());
+    __ASSERT_DEBUG(aCall != NULL, User::Invariant());
+    
+    if ( aCall == aContext.SecondaryCall() &&
+         aContext.PrimaryCall()->State() == 
+         MCCPCallObserver::ECCPStateConnected )
+    	{
+    	RUBY_DEBUG0( "TVccStateCalling::ErrorOccurred - set state to iFailing" );
+    	        
+    	aContext.SetState( *iFailing );
+    	}
+    else if( aCall == aContext.SecondaryCall() &&
+            aContext.PrimaryCall()->State() != 
+            MCCPCallObserver::ECCPStateConnected )
+    	{
+    //	RUBY_DEBUG0( "TVccStateCalling::ErrorOccurred - forward the error to CCE" );
+    	//aContext.CallObserver()->ErrorOccurred( aError, 
+    	  //                                      aContext.PrimaryCall() );
+    	}
+  		
+    //Update PS key to notify handover failure
+    TRAP_IGNORE( aContext.Notifier().NotifySubscriberL( EVccCsToPsHoFailure, 
+                                                        aError ) );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccStateCalling::CallEventOccurred(CVccPerformer& aContext, 
+                                const MCCPCallObserver::TCCPCallEvent aEvent,
+                                MCCPCall* aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccStateCalling::CallEventOccurred" ); 
+    
+	__ASSERT_DEBUG(aContext.CallObserver()!=NULL, User::Invariant());
+	__ASSERT_DEBUG(aCall != NULL, User::Invariant());
+	
+	//in successful HO case ECCPRemoteTerminated is also received when server
+	//disconnects the original leg
+	if ( aEvent == MCCPCallObserver::ECCPRemoteTerminated &&
+	     aCall == aContext.SecondaryCall()  &&
+	     aContext.PrimaryCall()->State() != MCCPCallObserver::ECCPStateConnected )
+		{
+		RUBY_DEBUG1( "TVccStateCalling::CallEventOccurred -\
+		             forward the call event to CCE: %d", aEvent );
+		        
+	 	aContext.CallObserver()->CallEventOccurred( aEvent, 
+	                                                aContext.PrimaryCall());
+	 	    
+		}
+	else if( aEvent == MCCPCallObserver::ECCPRemoteTerminated &&
+         aCall == aContext.SecondaryCall()  &&
+         aContext.PrimaryCall()->State() == MCCPCallObserver::ECCPStateConnected )
+	    {
+	    RUBY_DEBUG0( "TVccStateCalling::CallEventOccurred - set state to iFailing" );
+	            
+	    aContext.SetState( *iFailing );
+	    }
+	//if remote end holds the call HO is not allowed at this end either
+	else if( aEvent == MCCPCallObserver::ECCPRemoteHold )
+	    {
+	    //Trigger is informed that automatic HO is not allowed. 
+	    aContext.ActivateTrigger( EFalse );
+	    //for manual HO PS key needs to be updated
+	    aContext.AllowHo( EFalse );
+	    aContext.CallObserver()->CallEventOccurred( aEvent, 
+	                                                aContext.PrimaryCall());    
+	    }
+	else if( aEvent == MCCPCallObserver::ECCPRemoteResume )
+	    {
+	    //HO is allowed again
+	    aContext.ActivateTrigger( ETrue );
+	    //for manual HO PS key needs to be updated
+	    aContext.AllowHo( ETrue );
+	    aContext.CallObserver()->CallEventOccurred( aEvent, 
+	                                                aContext.PrimaryCall());                    
+	    }
+	}
+
+
+// -----------------------------------------------------------------------------
+// InspectChangedStates
+// -----------------------------------------------------------------------------
+//
+void TVccStateCalling::InspectChangedStates (CVccPerformer& aContext, 
+                                const MCCPCallObserver::TCCPCallState aState,
+                                MCCPCall* aCall,
+                                MCCPCallObserver* aCallee,
+                                void (MCCPCallObserver::*aCallback)
+                                (const MCCPCallObserver::TCCPCallState, MCCPCall*))
+
+                                
+    {
+    //Remote party has disconnected the call - the events might arrive
+    //to the new leg first. The event must be issued on the old leg as
+    //all previous events are suppressed.
+    //
+    if( (aState == MCCPCallObserver::ECCPStateDisconnecting ||
+            aState == MCCPCallObserver::ECCPStateIdle) &&
+            aCall == aContext.SecondaryCall() &&
+            aContext.PrimaryCall()->State() != MCCPCallObserver::ECCPStateIdle &&
+            aContext.PrimaryCall()->State() != MCCPCallObserver::ECCPStateConnected )
+        {
+        RUBY_DEBUG1( "TVccStateCalling::InspectChangedStates -\
+                forward the events on the old leg, suppress from new one: %d", aState );
+        //remove progress bar from UI
+        TRAP_IGNORE( aContext.Notifier().NotifySubscriberL( EVccCsToPsHoFailure, KErrGeneral ) );
+        (aCallee->*aCallback)( aState, aContext.PrimaryCall());
+        }
+    //old leg is released in remote disconnect or other abnormal case, this should never
+    //happen in the successfull HO case.
+    
+    else if( aState == MCCPCallObserver::ECCPStateIdle &&
+                    aCall == aContext.PrimaryCall() )
+        {       
+        RUBY_DEBUG1( "TVccStateCalling::InspectChangedStates - shouldnt happen in normal HO case,\
+                      MT disconnected the call, or some other abnormal case: %d", aState );
+                
+        //remove progress bar from UI
+        TRAP_IGNORE( aContext.Notifier().NotifySubscriberL( EVccCsToPsHoFailure, KErrGeneral ) );
+        (aCallee->*aCallback)( aState, aContext.PrimaryCall() );
+        aContext.SetState( *iInit );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/tvccstatefailing.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   Implementation for the VCC Failing state
+*
+*/
+
+
+
+#include "tvccstatefailing.h"
+#include "cvccperformer.h"
+#include "rubydebug.h"
+
+
+
+// -----------------------------------------------------------------------------
+// c'tor
+// -----------------------------------------------------------------------------
+//
+TVccStateFailing::TVccStateFailing()
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateFailing::TVccStateFailing" );	
+	} 
+
+// -----------------------------------------------------------------------------
+// Name
+// -----------------------------------------------------------------------------
+//	
+TUint TVccStateFailing::Name() const
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateFailing::Name" );
+	return KVccStateFailing;
+	}
+
+// -----------------------------------------------------------------------------
+// LinkState
+// -----------------------------------------------------------------------------
+//
+void TVccStateFailing::LinkState( TVccState& aInit )
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateFailing::LinkState" );
+	iInit = &aInit;	
+	}
+	
+// -----------------------------------------------------------------------------
+// CallStateChanged
+// -----------------------------------------------------------------------------
+//	
+void TVccStateFailing::CallStateChanged( CVccPerformer& aContext, 
+                                const MCCPCallObserver::TCCPCallState aState,
+                                MCCPCall* aCall )
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateFailing::CallStateChanged" );
+	InspectChangedStates(aContext, 
+	                        aState, 
+	                        aCall, 
+	                        aContext.CallObserver(), 
+	                        &MCCPCallObserver::CallStateChanged);
+	}
+
+// -----------------------------------------------------------------------------
+// CallStateChangedWithInband
+// -----------------------------------------------------------------------------
+//  
+void TVccStateFailing::CallStateChangedWithInband( CVccPerformer& aContext, 
+                                const MCCPCallObserver::TCCPCallState aState,
+                                MCCPCall* aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccStateFailing::CallStateChangedWithInband" );
+    InspectChangedStates(aContext, 
+                            aState, 
+                            aCall, 
+                            aContext.CallObserver(), 
+                            &MCCPCallObserver::CallStateChangedWithInband);  
+    }
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccStateFailing::ErrorOccurred( CVccPerformer& aContext, 
+                                const TCCPError aError,
+                                MCCPCall* aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccStateFailing::ErrorOccurred" );
+    RUBY_DEBUG1( "TVccStateFailing::ErrorOccurred - error: %d", aError );
+    __ASSERT_DEBUG( aContext.CallObserver()!=NULL, User::Invariant() );
+    __ASSERT_DEBUG(aContext.PrimaryCall()!=NULL, User::Invariant());
+    __ASSERT_DEBUG(aCall != NULL, User::Invariant());
+    if( aCall == aContext.PrimaryCall() )
+        {
+        aContext.CallObserver()->ErrorOccurred( aError, aContext.PrimaryCall() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccStateFailing::CallEventOccurred(CVccPerformer& aContext, 
+                                const MCCPCallObserver::TCCPCallEvent aEvent,
+                                MCCPCall* aCall )
+    {
+    RUBY_DEBUG_BLOCK( "TVccStateFailing::CallEventOccurred" ); 
+	__ASSERT_DEBUG(aContext.CallObserver()!=NULL, User::Invariant());
+	__ASSERT_DEBUG(aCall != NULL, User::Invariant());
+	__ASSERT_DEBUG(aContext.PrimaryCall()!=NULL, User::Invariant());
+	    
+	if( aCall == aContext.PrimaryCall() )
+	    {
+	    aContext.CallObserver()->CallEventOccurred( aEvent, aContext.PrimaryCall() );
+	    }
+	}
+
+// -----------------------------------------------------------------------------
+// CheckAndMoveToInit
+// -----------------------------------------------------------------------------
+//
+void TVccStateFailing::CheckAndMoveToInit(CVccPerformer& aContext, MCCPCall* aCall,
+                                            const MCCPCallObserver::TCCPCallState aState)
+    {
+       RUBY_DEBUG_BLOCK( "TVccStateFailing::CheckAndmoveToInit" ); 
+        
+       if ( !aContext.SecondaryCall() )
+           {
+           RUBY_DEBUG0( "Secondary call not exist - setting state to init");
+           aContext.SetState(*iInit);
+           }
+       
+ else  if ( aCall == aContext.SecondaryCall() )
+           {
+           if( aState == MCCPCallObserver::ECCPStateDisconnecting || 
+                   aState == MCCPCallObserver::ECCPStateIdle )
+               {
+               RUBY_DEBUG0( "Secondary call is disconnecting or idle - setting state to init");
+               aContext.SetState(*iInit);
+               }
+           }
+     }
+
+// -----------------------------------------------------------------------------
+// InspectChangedStates
+// -----------------------------------------------------------------------------
+//
+void TVccStateFailing::InspectChangedStates (CVccPerformer& aContext, 
+                               const MCCPCallObserver::TCCPCallState aState,
+                               MCCPCall* aCall,
+                               MCCPCallObserver* aCallee,
+                               void( MCCPCallObserver::*aCallback)
+                               (const MCCPCallObserver::TCCPCallState, MCCPCall*))
+    {
+    __ASSERT_DEBUG( aContext.PrimaryCall() != NULL, User::Invariant() );
+    __ASSERT_DEBUG(aCall != NULL, User::Invariant());
+
+    RUBY_DEBUG1("call state is: %d", aState);
+    // Remote party has disconnected the call during the handover
+    if( aState == MCCPCallObserver::ECCPStateDisconnecting &&
+        aCall == aContext.SecondaryCall() )
+        {
+        ReleaseCall(aContext, *aContext.SecondaryCall(), *iInit, KVccHoNok );
+        }
+    else if (aCall == aContext.PrimaryCall())
+        {
+        //events related to the old leg, so pass them to the telephony.
+        (aCallee->*aCallback)( aState, aContext.PrimaryCall());
+        }
+            
+    CheckAndMoveToInit( aContext, aCall, aState );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/tvccstateinit.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,238 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 VCC Init state
+*
+*/
+
+#include "tvccstateinit.h"
+#include "cvccperformer.h"
+#include "vccsettingsreader.h"
+#include "rubydebug.h"
+
+// -----------------------------------------------------------------------------
+// c'tor
+// -----------------------------------------------------------------------------
+//
+
+TVccStateInit::TVccStateInit()
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateInit::TVccStateInit" );	
+	} 
+
+// -----------------------------------------------------------------------------
+// Name
+// -----------------------------------------------------------------------------
+//	
+TUint TVccStateInit::Name() const
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateInit::Name" );
+	return KVccStateInit;
+	}
+
+// -----------------------------------------------------------------------------
+// LinkState
+// -----------------------------------------------------------------------------
+//
+void TVccStateInit::LinkState(TVccState& aCalling)
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateInit::LinkState" );
+	iCalling = &aCalling;
+	}
+	
+// -----------------------------------------------------------------------------
+// Swap()
+// -----------------------------------------------------------------------------
+//
+TInt TVccStateInit::Swap(MCCPCall& aCall)
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateInit::Swap()" );
+	return aCall.Swap();		
+	}
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccStateInit::ErrorOccurred( CVccPerformer& aContext, 
+                                   const TCCPError aError,
+                                   MCCPCall* /*aCall*/ )
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateInit::ErrorOccurred" );
+	__ASSERT_DEBUG(aContext.CallObserver()!=NULL, User::Invariant());
+	aContext.CallObserver()->ErrorOccurred( aError, 
+	                                        aContext.PrimaryCall() );
+	}
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver 
+// -----------------------------------------------------------------------------
+//
+void TVccStateInit::CallStateChanged( CVccPerformer& aContext, 
+                                  const MCCPCallObserver::TCCPCallState aState,
+                                  MCCPCall* /*aCall*/ )
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateInit::CallStateChanged" );
+	__ASSERT_DEBUG(aContext.CallObserver()!=NULL, User::Invariant());
+	//start trigger if call is connected, stop if not.
+	if( aState == MCCPCallObserver::ECCPStateConnected )
+		{
+		aContext.SetRemoteParties();
+		aContext.ActivateTrigger( ETrue );
+		
+		}
+	else
+		{
+		aContext.ActivateTrigger( EFalse );
+		}
+	aContext.CallObserver()->CallStateChanged( aState, 
+	                                           aContext.PrimaryCall());
+	}
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccStateInit::CallStateChangedWithInband( CVccPerformer& aContext, 
+                                  const MCCPCallObserver::TCCPCallState aState,
+                                  MCCPCall* /*aCall*/ )
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateInit::CallStateChangedWithInband" );
+	__ASSERT_DEBUG(aContext.CallObserver()!=NULL, User::Invariant());
+	aContext.CallObserver()->CallStateChangedWithInband( aState, 
+	                                                aContext.PrimaryCall());
+		
+	}
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccStateInit::CallEventOccurred( CVccPerformer& aContext, 
+                                  const MCCPCallObserver::TCCPCallEvent aEvent,
+                                  MCCPCall* aCall )
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateInit::CallEventOccurred" );
+	RUBY_DEBUG1( "TVccStateInit::CallEventOccurred, event: %d", aEvent );
+	__ASSERT_DEBUG(aContext.CallObserver()!=NULL, User::Invariant());
+	
+	   if(  aContext.PrimaryCall() == aCall )
+	        {
+             //if remote end holds the call HO is not allowed at this end either
+	        if( aEvent == MCCPCallObserver::ECCPRemoteHold )
+	            {
+	            //Trigger is informed that automatic HO is not allowed. 
+	            aContext.ActivateTrigger( EFalse );
+	            //for manual HO PS key needs to be updated
+	            aContext.AllowHo( EFalse ); 
+	            }
+	        
+	        else if( aEvent == MCCPCallObserver::ECCPRemoteResume )
+	            {
+	            //HO is allowed again
+	            aContext.ActivateTrigger( ETrue );
+	            //for manual HO PS key needs to be updated
+	            aContext.AllowHo( ETrue );
+	            }
+	        else if( aEvent == MCCPCallObserver::ECCPNotifyRemotePartyInfoChange )
+	            {
+	            aContext.SetRemoteParties();
+	            }
+	
+	    RUBY_DEBUG0("primary call event, forward it");
+	    aContext.CallObserver()->CallEventOccurred( aEvent, 
+	                                                 aContext.PrimaryCall());
+	    }
+
+	}
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver
+// -----------------------------------------------------------------------------
+//
+void TVccStateInit::CallCapsChanged( CVccPerformer& aContext, 
+                                     const TUint32 aCapsFlags )
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateInit::CallCapsChanged" );
+	__ASSERT_DEBUG(aContext.CallObserver()!=NULL, User::Invariant());
+	aContext.CallObserver()->CallCapsChanged( aCapsFlags,
+	                                          aContext.PrimaryCall() );	
+	}
+	 
+// -----------------------------------------------------------------------------
+// 	SwitchL()
+// -----------------------------------------------------------------------------
+//
+void TVccStateInit::SwitchL(CVccPerformer& aContext)
+	{
+	RUBY_DEBUG_BLOCKL( "TVccStateInit::SwitchL" );
+	
+	__ASSERT_DEBUG(aContext.PrimaryCall()!=NULL, User::Invariant());
+	__ASSERT_ALWAYS(aContext.PrimaryCall()->State() == 
+	          MCCPCallObserver::ECCPStateConnected,User::Leave(KErrAccessDenied));
+	
+	if ( aContext.PrimaryCall()->Parameters().CallType() == 
+	    CCPCall::ECallTypeCSVoice )
+		{
+		RUBY_DEBUG0( "- make VoIP call" );
+		aContext.Notifier().NotifySubscriberL(EVccCsToPsHoStarted, KErrNone);
+		CCCECallParameters* params = CCCECallParameters::NewL();
+		params->SetCallType( CCPCall::ECallTypePS );
+		params->SetServiceId( KErrNone );
+		TInt id = KErrNotFound;
+		id =  VccSettingsReader::VoIPServiceIdL();
+		__ASSERT_ALWAYS(id >= 0, User::Leave(KErrArgument));		
+		params->SetServiceId( id );
+		HBufC* uri = NULL;
+		uri = VccSettingsReader::DomainTransferUriL();
+		CleanupStack::PushL(uri);
+		__ASSERT_ALWAYS (uri->Length() > 0, User::Leave(KErrArgument));				     
+		aContext.CreateSecondaryCallL(*params, *uri, aContext);	
+		CleanupStack::PopAndDestroy( uri ); //uri		
+		__ASSERT_DEBUG(aContext.SecondaryCall()!=NULL, User::Invariant());
+		//-> Set Next State (work around, VoIP should call CallStateChanged 
+        //                    only after Dial has returned)
+        aContext.SetState(*iCalling);
+        User::LeaveIfError(aContext.SecondaryCall()->Dial());
+        delete params;
+		}
+	else
+		{
+		RUBY_DEBUG0( "- make CS call" );
+		aContext.Notifier().NotifySubscriberL(EVccPsToCsHoStarted, KErrNone);
+		       
+		CCCECallParameters* params = CCCECallParameters::NewL();
+		params->SetCallType( CCPCall::ECallTypeCSVoice );
+		params->SetServiceId( KErrNone );
+		
+		TInt id = KErrNotFound;
+		id = VccSettingsReader::CSServiceIdL();
+		__ASSERT_ALWAYS(id >= 0, User::Leave(KErrArgument));
+		params->SetServiceId( id );
+		HBufC* number = NULL;
+		number = VccSettingsReader::DomainTransferNumberL();
+		CleanupStack::PushL( number );
+		__ASSERT_ALWAYS (number->Length() > 0, User::Leave(KErrArgument));
+		// the events will come to the context
+		aContext.CreateSecondaryCallL(*params, *number, aContext); 
+		CleanupStack::PopAndDestroy( number ); //number
+		__ASSERT_DEBUG(aContext.SecondaryCall()!=NULL, User::Invariant());
+        //-> Set Next State (work around, VoIP should call CallStateChanged 
+        //                    only after Dial has returned)
+        aContext.SetState(*iCalling);
+        
+        //not used by cs-plugin
+		User::LeaveIfError(static_cast<MCCPCSCall*>
+		                        (aContext.SecondaryCall())->Dial(KNullDesC8));	
+        delete params;
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/tvccstatereleasing.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 VCC Releasing state
+*
+*/
+
+
+
+#include "tvccstatereleasing.h"
+#include "cvccperformer.h"
+#include "rubydebug.h"
+
+
+// -----------------------------------------------------------------------------
+// c'tor
+// -----------------------------------------------------------------------------
+//
+
+TVccStateReleasing::TVccStateReleasing()
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateReleasing::TVccStateReleasing" );	
+	} 
+
+// -----------------------------------------------------------------------------
+// Name
+// -----------------------------------------------------------------------------
+//	
+TUint TVccStateReleasing::Name() const
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateReleasing::Name" );
+	return KVccStateReleasing;
+	}
+
+// -----------------------------------------------------------------------------
+// LinkState
+// -----------------------------------------------------------------------------
+//	
+void TVccStateReleasing::LinkState(TVccState& aInit)
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateReleasing::LinkState" );
+	iInit = &aInit;
+	}
+	
+// -----------------------------------------------------------------------------
+// CallStateChanged
+// -----------------------------------------------------------------------------
+//	
+void TVccStateReleasing::CallStateChanged( CVccPerformer& aContext, 
+                                const MCCPCallObserver::TCCPCallState aState,
+                                MCCPCall* aCall )
+	{
+	RUBY_DEBUG_BLOCK( "TVccStateReleasing::CallStateChanged" );
+	__ASSERT_DEBUG( aContext.CallObserver()!=NULL, User::Invariant() );
+	__ASSERT_DEBUG(aContext.PrimaryCall()!=NULL, User::Invariant());
+	__ASSERT_DEBUG(aCall != NULL, User::Invariant());
+	if (aState == MCCPCallObserver::ECCPStateIdle )
+		{
+		//delete the actuall call object and move to the Init state
+		if( aCall == aContext.PrimaryCall() )
+		    {
+		    ReleaseCall( aContext, *aContext.SecondaryCall(), *iInit, KVccHoNok );
+		    aContext.CallObserver()->CallStateChanged( aState, aCall );
+		    }
+		else
+		    {
+		    ReleaseCall( aContext, *aContext.SecondaryCall(), *iInit, KVccHoOk );
+		                
+		    }
+		    
+		}
+	//for some reason the old leg hasnt been released, so new leg's events must
+	//be passed forward. 
+	else if( aCall == aContext.PrimaryCall() ) 
+	    {
+	    aContext.CallObserver()->CallStateChanged( aState, aCall );
+	    }
+		
+	}
+
+// -----------------------------------------------------------------------------
+// From MCCPCallObserver, new leg events need to go through even when 
+// old leg has not yet been disconnected
+// -----------------------------------------------------------------------------
+//
+void TVccStateReleasing::CallEventOccurred( CVccPerformer& aContext, 
+                                  const MCCPCallObserver::TCCPCallEvent aEvent,
+                                  MCCPCall* aCall)
+    {
+    if( aCall == aContext.PrimaryCall() ) 
+        {
+        aContext.CallObserver()->CallEventOccurred( aEvent, 
+                                                    aContext.PrimaryCall());
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/vccengpsproperty.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,191 @@
+/*
+* 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:   P&S property writer/reader
+*
+*/
+
+
+#include "vccengpsproperty.h"
+#include "rubydebug.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CVccEngPsProperty::CVccEngPsProperty()
+	{
+	RUBY_DEBUG_BLOCK( "CVccEngPsProperty::CVccEngPsProperty" );
+	}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CVccEngPsProperty::~CVccEngPsProperty()
+	{
+    RUBY_DEBUG0( "CVccEngPsProperty::~CVccEngPsProperty() - ENTER" );
+    iHoStatusKey.Close();
+    iErrorCodeKey.Close();
+    RUBY_DEBUG0( "CVccEngPsProperty::~CVccEngPsProperty() - EXIT" );
+	}
+
+// ---------------------------------------------------------------------------
+// 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CVccEngPsProperty::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccEngPsProperty::ConstructL" );
+   
+    DefineKeysL();
+    CreateHandlesL();
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian constructor
+// ---------------------------------------------------------------------------
+//
+CVccEngPsProperty* CVccEngPsProperty::NewL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccEngPsProperty::NewL" );
+   
+    CVccEngPsProperty* self = new ( ELeave ) CVccEngPsProperty();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the value of a VCC property
+// ---------------------------------------------------------------------------
+//
+void CVccEngPsProperty::NotifySubscriberL( TVccHoStatus aStatus, 
+		TInt aErrorCode )
+	{
+    RUBY_DEBUG_BLOCKL( "CVccEngPsProperty::NotifySubscriberL" );
+    RUBY_DEBUG1( " -status = %d", aStatus );
+    RUBY_DEBUG1( " -errorcode = %d", aErrorCode);
+   
+	switch( aStatus )
+		{
+		case EVccHoStateIdle:
+		case EVccCsToPsHoStarted:
+		case EVccPsToCsHoStarted:
+		case EVccCsToPsHoInprogress:
+		case EVccPsToCsHoInprogress:
+		case EVccCsToPsHoSuccessful:
+		case EVccCsToPsHoFailure:
+        case EVccHoUnavailable:
+        case EVccCsToPsNotAllowed:
+        case EVccPsToCsNotAllowed:
+        case EVccHoStateIdleIfSingleCall:
+        case EVccHoAllowedToCsIfSingleCall:
+        case EVccHoAllowedToPsIfSingleCall:
+			{
+	  	    RUBY_DEBUG0( " -updating keys" );
+    
+			User::LeaveIfError( iHoStatusKey.Set( aStatus ));	
+			User::LeaveIfError( iErrorCodeKey.Set( aErrorCode ));
+            break;
+			}
+		case EVccHoStateUnknown:	
+		default:
+			{
+	  	    RUBY_DEBUG0( " -Error, unknown key!!" );
+
+			User::Leave( KErrNotFound );
+            break;
+			}
+		}
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the Ho status property
+// ---------------------------------------------------------------------------
+//
+TInt CVccEngPsProperty::GetCurrentHoStatus(  TVccHoStatus& aStatus )
+	{
+    RUBY_DEBUG_BLOCK( "CVccEngPsProperty::GetCurrentHoStatus" );
+   
+	TInt value ( EVccHoStateUnknown );
+	TInt err = iHoStatusKey.Get( value );
+	aStatus = ( TVccHoStatus ) value;
+	return err;
+	}
+
+// ---------------------------------------------------------------------------
+// Gets the error code 
+// ---------------------------------------------------------------------------
+//
+TInt CVccEngPsProperty::GetCurrentErrorCode(  TInt& aErrorCode )
+	{
+	RUBY_DEBUG_BLOCK( "CVccEngPsProperty::GetCurrentErrorCode" );
+   
+	TInt err = iErrorCodeKey.Get( aErrorCode );
+	return err;
+	}
+
+// ---------------------------------------------------------------------------
+// Defines the keys the UI can update
+// ---------------------------------------------------------------------------
+//
+void CVccEngPsProperty::DefineKeysL()
+	{
+	RUBY_DEBUG_BLOCK( "CVccEngPsProperty::DefineKeysL" );
+   
+	RProcess myProcess;
+	    
+	_LIT_SECURITY_POLICY_PASS(KPassReadPolicy);
+	_LIT_SECURITY_POLICY_S0( KAllowSidPolicy, myProcess.SecureId() );
+
+	TInt err = RProperty::Define( KPSVccPropertyCategory,
+								  KVccPropKeyHoStatus,
+								  RProperty::EInt,
+								  KPassReadPolicy,
+								  KAllowSidPolicy );
+
+	if ( err != KErrNone && err != KErrAlreadyExists )
+		{
+		User::Leave( err );		
+		}
+	
+	err = RProperty::Define( KPSVccPropertyCategory,
+							 KVccPropKeyHoError,
+							 RProperty::EInt,
+							 KPassReadPolicy,
+							 KAllowSidPolicy );
+
+	if ( err != KErrNone && err != KErrAlreadyExists )
+		{
+		User::Leave( err );		
+		}	
+	}
+
+// ---------------------------------------------------------------------------
+// Defines the keys the UI can update
+// ---------------------------------------------------------------------------
+//
+void CVccEngPsProperty::CreateHandlesL()
+	{
+	RUBY_DEBUG_BLOCKL( "CVccEngPsProperty::CreateHandlesL" );
+   
+	User::LeaveIfError( iHoStatusKey.Attach( KPSVccPropertyCategory,
+			KVccPropKeyHoStatus ));
+	User::LeaveIfError( iErrorCodeKey.Attach( KPSVccPropertyCategory,
+			KVccPropKeyHoError ));
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcc/src/vccengpspropertylistener.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   Observes the state of P&S property
+*
+*/
+
+
+
+#include <e32cmn.h>
+#include <vccsubscribekeys.h>
+
+#include "vccengpspropertylistener.h"
+#include "rubydebug.h"
+
+//#include "vccuipropertyhandler.pan"
+
+// ======== MEMBER FUNCTIONS ========
+// -----------------------------------------------------------------------------
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+CVccEngPsPropertyListener::CVccEngPsPropertyListener( 
+const TUid aCategoryUid,
+		const TUint aKeyId ):
+CActive( EPriorityStandard ),
+iCategoryId( aCategoryUid ),
+iKeyId( aKeyId )
+	{
+	RUBY_DEBUG_BLOCK( "VccEngPsPropertyListener::CVccEngPsPropertyListener" );
+	}
+
+// -----------------------------------------------------------------------------
+// 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+void CVccEngPsPropertyListener::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccEngPsPropertyListener::ConstructL" );
+    // Attach to categroy and key.
+    User::LeaveIfError( iProperty.Attach( iCategoryId, iKeyId ));
+    // Add to active scheduler
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CVccEngPsPropertyListener* CVccEngPsPropertyListener::NewL(
+		                                                 const TUid aCategoryId, 
+		                                                 const TUint aKeyId)   
+    {
+	RUBY_DEBUG_BLOCKL("CVccEngPsPropertyListener::NewL");
+   
+	CVccEngPsPropertyListener* self = new (ELeave) CVccEngPsPropertyListener( 
+			                                              aCategoryId, aKeyId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+   
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CVccEngPsPropertyListener::~CVccEngPsPropertyListener()
+    {
+    RUBY_DEBUG0( "CVccEngPsPropertyListener::~CVccEngPsPropertyListener() - ENTER" );
+    Cancel();
+    iProperty.Close();
+    iObservers.Close();
+    RUBY_DEBUG0( "CVccEngPsPropertyListener::~CVccEngPsPropertyListener() - EXIT" );
+    }
+
+// -----------------------------------------------------------------------------
+// Add Vcc property observer
+// -----------------------------------------------------------------------------
+//
+void CVccEngPsPropertyListener::AddObserverL( 
+        MVccEngPsPropertyListenerObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccEngPsPropertyListener::AddObserverL" );
+    
+    if ( iObservers.Find( &aObserver ) == KErrNotFound )
+        {
+        User::LeaveIfError( iObservers.Append( &aObserver ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Removes observer
+// -----------------------------------------------------------------------------
+//
+void CVccEngPsPropertyListener::RemoveObserver( 
+        MVccEngPsPropertyListenerObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCK( "CVccEngPsPropertyListener::RemoveObserver" );
+   
+    TInt index = iObservers.Find( &aObserver );
+    
+    if ( index != KErrNotFound )
+        {
+        iObservers.Remove( index );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Fetches the current value of the key
+// -----------------------------------------------------------------------------
+//
+TInt CVccEngPsPropertyListener::CurrentValue()
+    {
+    RUBY_DEBUG_BLOCK( "CVccEngPsPropertyListener::CurrentValue" );
+   
+    TInt value( KErrNotFound );
+    iProperty.Get( iCategoryId, iKeyId, value );
+    return value;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Cancels the outstanding subsription request
+// -----------------------------------------------------------------------------
+//
+void CVccEngPsPropertyListener::DoCancel()
+    {
+    RUBY_DEBUG0( "CVccEngPsPropertyListener::DoCancel - ENTER" );
+    iProperty.Cancel();
+    RUBY_DEBUG0( "CVccEngPsPropertyListener::DoCancel - EXIT" );
+    }
+
+// -----------------------------------------------------------------------------
+// Subsribes to property
+// -----------------------------------------------------------------------------
+//
+void CVccEngPsPropertyListener::Start()
+    {
+    RUBY_DEBUG_BLOCK( "CVccEngPsPropertyListener::Start" );
+   
+    // Subscribe to get updates.
+    iProperty.Subscribe( iStatus );
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// RunL
+// -----------------------------------------------------------------------------
+//
+void CVccEngPsPropertyListener::RunL()
+    {
+    TInt err = iStatus.Int();
+Start();
+    RUBY_DEBUG_BLOCK( "CVccEngPsPropertyListener::RunL" );
+    RUBY_DEBUG1( " - Status: %d", iStatus.Int() );
+    if ( KErrNone == err )
+        {
+        RUBY_DEBUG0( " - CVccEngPsPropertyListener::RunL - \
+                     if ( KErrNone == err )" );
+        // Notify property changes to observers.
+        NotifyObserversL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Notify all observers about the changed value
+// -----------------------------------------------------------------------------
+//
+void CVccEngPsPropertyListener::NotifyObserversL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccEngPsPropertyListener::NotifyObserversL" );
+   
+    TInt value = CurrentValue();
+    RUBY_DEBUG1( " - value [%d]", value );
+   
+    for ( TInt i(0) ; i < iObservers.Count() ; i++ )
+        {
+        MVccEngPsPropertyListenerObserver* observer = iObservers[i];
+
+        if ( observer )
+            {
+            observer->PropertyChangedL( iCategoryId, iKeyId, value );
+            }
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/data/2000CFAC.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* 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 WpVccAdapter
+*
+*/
+
+
+#include <ecom/registryinfov2.rh>
+
+#include "wpvccadapteruids.h"
+
+// ---------------------------------------------------------------------------
+// theInfo
+// Resource defining the ProvisioningAdapter plugin.
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // use resource format version 2 to enable ROM only plugins
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+
+    dll_uid = KProvisioningVccAdapterDllUid;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KProvisioningAdapterInterface;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KProvisioningVccAdapterImplementationUid;
+                    version_no = 1;
+                    display_name = "VCC provisioning||Implements a VCC Provisioning Adapter||Copyright © 2007 Nokia Corporation.";
+                    default_data = "";
+                    opaque_data = "10";
+                    rom_only = 0; // This is not a ROM only plugin
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/data/wpvccadapterrsc.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   Resource definitions for project WpUmaAdapter
+*
+*/
+
+
+
+#include <badef.rh>
+#include <bldvariant.hrh>
+#include "wpvccadapter.loc"
+
+// ---------------------------------------------------------------------------
+// r_qtn_sm_head_vcc
+// Summary title for VCC settings received via OMA SMS
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_qtn_sm_head_vcc
+    {
+    txt = qtn_sm_head_vcc;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   Vcc OMA provisioning adapter build info file
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/wpvccadapter.loc APP_LAYER_LOC_EXPORT_PATH( wpvccadapter.loc )
+
+PRJ_MMPFILES
+wpvccadapter.mmp
+
+PRJ_TESTMMPFILES
+//../internal/tsrc/group/ut_vccclientprov.mmp
+
+GNUMAKEFILE test_mover.make
+
+PRJ_TESTEXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/group/test_mover.make	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,5 @@
+FINAL :
+	echo Copying test DLL to z\sys\bin
+	copy %epocroot%epoc32\release\winscw\udeb\t_vccclientprov.dll %epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES CLEAN BLD SAVESPACE :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/group/wpvccadapter.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* 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 WpVccAdapter plugin
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../inc/wpvccadapteruids.h"
+
+TARGET	        wpvccadapter.dll
+TARGETTYPE      PLUGIN
+UID             KECOMUid KProvisioningVccAdapterDllUid
+
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE	        wpvccadapter.cpp
+SOURCE	        wpvccadaptergroupproxy.cpp
+SOURCE	        wpvccadaptermain.cpp
+SOURCE	    	  rubydebug.cpp
+SOURCEPATH      ../../settingsreader/src
+SOURCE           vccsettingsreader.cpp
+
+USERINCLUDE     .
+USERINCLUDE     ../inc
+USERINCLUDE     ../../vcc/inc
+USERINCLUDE     ../../vccutils/inc
+USERINCLUDE     ../../settingsreader/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../data
+
+START RESOURCE 2000CFAC.rss
+TARGET wpvccadapter.rsc
+END
+
+START RESOURCE  wpvccadapterrsc.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+
+LIBRARY        	euser.lib
+LIBRARY	        provisioningengine.lib
+LIBRARY	        bafl.lib
+LIBRARY         charconv.lib
+LIBRARY         serviceprovidersettings.lib
+LIBRARY         vccutils.lib
+LIBRARY         rcse.lib
+LIBRARY         cch.lib
+LIBRARY         sipprofilecli.lib       // For SIP settings
+LIBRARY         cmmanager.lib       // cmmanager.h
+
+//rubydebug
+LIBRARY         efsrv.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/inc/vccunittesting.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Unit testing definitions for VCC
+*
+*/
+
+
+
+#ifndef _VCCUNITTESTING_H_
+#define _VCCUNITTESTING_H_
+
+#ifdef UNIT_TESTING // if unit testing
+
+    #define VCC_UNITTEST( aClassName ) friend class aClassName;
+
+#else
+
+    #define VCC_UNITTEST( aClassName ) 
+
+#endif // UNIT_TESTING
+
+
+#endif // _VCCUNITTESTING_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/inc/wpvccadapter.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Vcc settings in provisioning.
+*
+*/
+
+
+
+#ifndef C_WPVCCADAPTER_H
+#define C_WPVCCADAPTER_H
+
+#include <CWPAdapter.h>
+#include <MWPContextExtension.h>
+
+#include "vccunittesting.h"
+#include <sipprofileregistryobserver.h>
+
+class CWPCharacteristic;
+class CVccSPSettings;
+
+/**
+ * CVccAdapter handles Vcc settings received via provisioning framework.
+ *
+ * CVccAdapter is a plugin for provisioning framework. It indicates to
+ * framwork that it is interested in Vcc settings, and when they're
+ * available CVccAdapter stores them into instance of CVccItem.
+ *
+ * @lib wpvccadapter
+ * @since S60 3.2
+ */
+class CWPVccAdapter : public CWPAdapter, public MWPContextExtension, public MSIPProfileRegistryObserver
+    {
+
+public:
+    
+    /**
+    * Symbian OS two-phased constructor
+    */
+    static CWPVccAdapter* NewL();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CWPVccAdapter();
+
+// from base class CWPAdapter
+
+    /**
+     * @see CWPAdapter::ItemCount()
+     */
+    TInt ItemCount() const;
+
+    /**
+     * @see CWPAdapter::SummaryTitle()
+     */
+    const TDesC16& SummaryTitle( TInt aIndex ) const;
+
+    /**
+     * @see CWPAdapter::SummaryText()
+     */
+    const TDesC16& SummaryText( TInt aIndex ) const;
+
+    /**
+     * @see CWPAdapter::SaveL()
+     */
+    void SaveL( TInt aIndex );
+
+    /**
+     * @see CWPAdapter::CanSetAsDefault()
+     */
+    TBool CanSetAsDefault( TInt aIndex ) const;
+
+    /**
+     * @see CWPAdapter::SetAsDefaultL()
+     */
+    void SetAsDefaultL( TInt aIndex );
+
+    /**
+     * @see CWPAdapter::DetailsL()
+     */
+    TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor );
+
+    /**
+     * @see CWPAdapter::ContextExtension()
+     */
+    TInt ContextExtension( MWPContextExtension*& aExtension );
+
+    /**
+     * @see CWPAdapter::SettingsSavedL()
+     */
+    void SettingsSavedL(const TDesC8& aAppIdOfSavingItem,
+                        const TDesC8& aAppRef, 
+                        const TDesC8& aStorageIdValue);
+    
+// From base class MWPVisitor
+    
+    /**
+     * @see MWPVisitor::VisitL()
+     */
+    void VisitL( CWPCharacteristic& aCharacteristic );
+    
+    /**
+     * @see MWPVisitor::SavingFinalizedL()
+     */
+    void SavingFinalizedL();
+
+
+    /**
+     * @see MWPVisitor::VisitL()
+     */
+    void VisitL( CWPParameter& aParameter );
+
+    /**
+     * @see MWPVisitor:VisitLinkL()
+     */
+    void  VisitLinkL( CWPCharacteristic& aLink );
+
+// from base class MWPContextExtension
+    
+    /**
+     * @see MWPContextExtension::SaveDataL()
+     */
+    const TDesC8& SaveDataL( TInt aIndex ) const;
+
+    /**
+     * @see MWPContextExtension::DeleteL()
+     */
+    void DeleteL( const TDesC8& aSaveData );
+
+    /**
+     * @see MWPContextExtension::Uid()
+     */
+    TUint32 Uid() const;
+  
+    /** 
+    * From MSIPProfileRegistryObserver
+    * SIP profile information event.
+    *
+    * @since S60 v3.1
+    * @param aSIPProfileId id for profile
+    * @param aEvent type of information event
+    */
+     void ProfileRegistryEventOccurred(TUint32 aProfileId,
+                                              TEvent aEvent);
+     /**
+     * From MSIPProfileRegistryObserver
+     * An asynchronous error has occurred related to SIP profile.
+     *
+     * @since S60 v3.1
+     * @param aSIPProfileId the id of failed profile
+     * @param aError a error code
+     * @return none
+     */
+     void ProfileRegistryErrorOccurred(TUint32 aProfileId,
+                                              TInt aError);
+      
+private:
+
+    /**
+    * C++ constructor 
+    */
+    CWPVccAdapter();
+    
+    /**
+    * Symbian 2nd phase constructor
+    */
+    void ConstructL();
+
+    /**
+    * Remove old VCC related settings if found
+    */
+    void RemoveVCCSettingsL();
+    
+    /**
+    * Remove VCC enabled VoIP network destination from snaplist
+    */
+    void RemoveNetworkDestinationL();
+
+private: // data
+
+    /**
+     * The application id of the current characteristic
+     * Own
+     */
+    HBufC* iAppID;
+
+    /**
+     * Title for the Vcc settings.
+     * Own.
+     */
+    HBufC*  iTitle;
+
+    /**
+     * Holds the value of the current characteristic type (state).
+     */
+    TUint iCurrentCharacteristic;
+
+    /**
+     * Type of the current characteristics
+     */
+    TInt iCurrentCharacteristicType;
+    
+    /**
+     * Application references
+     * Own
+     */
+    RArray<TPtrC> iToAppReferences;
+    
+    /**
+     * Item that saves the provisioned settings
+     * Own
+     */
+    CVccSPSettings* iVccItem;
+    
+    /**
+     * Item that saves the provisioned settings
+     * Own
+     */
+    CVccSPSettings* iNewVccItem;
+
+    /**
+     * RCSE Profile ID
+     * Own
+     */
+    TUint iVoipProfileId;
+    
+     /**
+     * Old VCC enabled VoIP service name
+     * needed for deleting network destination before saving new VCC enabled VoIP service
+     */
+    TBuf<200> iOldVoipServiceName;
+    
+    
+    
+    VCC_UNITTEST( T_WpVccAdapter )
+    };
+
+#endif	// C_WPVCCADAPTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/inc/wpvccadapteruids.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   UIDs for Vcc Adapter.
+*
+*/
+
+
+
+#ifndef VCCCPADAPTERUID_H
+#define VCCCPADAPTERUID_H
+
+/** ECOM plugin */
+#define KECOMUid 0x10009D8D
+
+/** UID for the VCC Adapter DLL */
+//	dll_uid = 
+// mmp:
+// UID             0x10009D8D 0x1027540A
+// START RESOURCE 1027540A.rss
+#define KProvisioningVccAdapterDllUid 0x2000CFAC
+// 0x1027540A
+
+/** UID for provided ECOM implementation */
+//implementation_uid
+//IMPLEMENTATION_PROXY_ENTRY
+#define KProvisioningVccAdapterImplementationUid 0x2000CFAD
+//0x1027540B
+
+/**
+* UID of the Provisisioning Adapter plugin interface
+* (taken from S60\provisioning\group\ProvisioningUIDs.h)
+*/
+#define KProvisioningAdapterInterface 0x101F84D5
+
+
+#endif // VCCCPADAPTERUID_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/loc/wpvccadapter.loc	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,24 @@
+/*
+* 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:   Localization.
+*
+*/
+
+
+
+//d:Summary title for VCC settings received via OMA SMS provisioning.
+//l:msg_body_pane/opt
+//r:3.0
+//
+#define qtn_sm_head_vcc "VCC settings"  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/src/rubydebug.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,165 @@
+/*
+* 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:   Debugging utilities implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "rubydebug.h"
+
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#include <f32file.h>
+#endif
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#ifdef _DEBUG // UDEB version:
+_LIT( KSpace, " " );
+_LIT( KColon, ":" );
+_LIT( KFormat, "%02d" );
+_LIT( KFormat2, "%06d" );
+#endif
+#endif
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::PrintToFile
+// Method for writing traces to a file.
+// -----------------------------------------------------------------------------
+//
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+
+#ifdef _DEBUG // UDEB version:
+void RRubyDebug::PrintToFile( TRefByValue<const TDesC> aFmt, ... )
+    {
+    _LIT( KRubyLogFileName, "c:\\Data\\Logs\\RubyTrace_vccclientprovisioning.txt" );
+
+    const TInt KRubyDebugMaxLineLength = 0x84; // rest will be truncated
+
+    const TInt KRubyDebugOpenFileRetries = 100;
+    const TInt KRubyDebugOpenFileInterval = 1000;
+
+    const TUint16 KRubyDebugLineSep1 = 0x0d;
+    const TUint16 KRubyDebugLineSep2 = 0x0a;
+
+    // Handle variable argument list
+    VA_LIST list;
+	VA_START( list, aFmt );
+	TBuf<KRubyDebugMaxLineLength+2> aBuf;
+    TTruncateOverflow overflow;
+    
+    // Append the time...
+    TTime currentTime;
+    currentTime.HomeTime();
+    TDateTime dateTime = currentTime.DateTime();
+
+    aBuf.AppendFormat( KFormat, dateTime.Hour() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat, dateTime.Minute() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat, dateTime.Second() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat2, dateTime.MicroSecond() );
+    aBuf.Append( KSpace );
+    // time done
+    
+	aBuf.AppendFormatList( aFmt, list, &overflow );
+	if( aBuf.Length() > ( KRubyDebugMaxLineLength - 2 ) )
+		{
+		aBuf.Delete(aBuf.Length() - 2, 2);
+		}
+	
+    // Add linefeed characters
+    aBuf.Append( KRubyDebugLineSep1 );
+    aBuf.Append( KRubyDebugLineSep2 );
+
+    RFs fs;
+    if ( fs.Connect() == KErrNone )
+        {
+        RFile file;
+
+        // Open file in an exclusive mode so that only one thread 
+        // can acess it simultaneously
+        TUint fileMode = EFileWrite | EFileShareExclusive;
+
+        TInt err = file.Open( fs, KRubyLogFileName, fileMode );
+
+        // Create a file if it doesn't exist
+        if ( err == KErrNotFound )
+            {
+            err = file.Create( fs, KRubyLogFileName, fileMode );
+            }
+        else
+            {
+            // Error in opening the file
+            TInt retryCount = KRubyDebugOpenFileRetries;
+            while ( err == KErrInUse && retryCount-- )
+                {
+                // Some other tread is accessing the file, wait a while...
+                User::After( KRubyDebugOpenFileInterval );
+                err = file.Open( fs, KRubyLogFileName, fileMode );
+                }
+            }
+
+        // Check if we have access to a file
+        if ( err == KErrNone )
+            {
+            TInt offset = 0;
+            if ( file.Seek( ESeekEnd, offset ) == KErrNone )
+                {
+                // Append text to the end of file
+                TPtr8 ptr8( (TUint8*)aBuf.Ptr(), aBuf.Size(), aBuf.Size() );
+                file.Write( ptr8 );
+                }
+            file.Close();
+            }
+
+        fs.Close();
+        }
+    }
+
+#else // UREL version:
+void RRubyDebug::PrintToFile( TRefByValue<const TDesC> /*aFmt*/, ... )
+    {
+    }
+#endif
+
+#endif // __RUBY_DEBUG_TRACES_TO_FILE
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/src/wpvccadapter.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,818 @@
+/*
+* 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:   Handles Vcc settings in provisioning.
+*
+*/
+
+
+
+#include <e32base.h>
+#include <commdb.h>
+#include <CWPAdapter.h>
+#include <CWPCharacteristic.h>
+#include <CWPParameter.h>
+#include <utf.h>
+#include <wpvccadapterrsc.rsg>
+#include <crcseprofileentry.h>
+#include <crcseprofileregistry.h>
+#include <WPAdapterUtil.h>
+
+#include "wpvccadapter.h"
+#include "rubydebug.h"
+#include "vccspsettings.h"
+#include "wpvccadapteruids.h"
+#include <cch.h>
+#include "vccsettingsreader.h"
+#include <sipmanagedprofileregistry.h>
+#include <sipprofile.h>
+#include <spsettings.h>
+#include <spproperty.h>
+#include <cmmanagerext.h>
+#include <cmdestinationext.h>
+
+/** Name of *this adapter */
+_LIT( KVccResourceFileNameWithoutSuffix,  "wpvccadapterrsc" );
+
+/** Provisioning file format specific settings */
+// OMA Experimental values, registered by OMNA only for advisory purposes
+// range 0x4000 to 0x1FFFFF
+_LIT( KVccAppID,        "w9054" );        
+_LIT8( KVoIPAppID8,     "w9013" );  	  // OMA CP registration document for VoIP
+_LIT( KVdi,             "VDI" );          // 
+_LIT( KVdn,             "VDN" );          // 
+_LIT( KPreferredDomain, "PREF-DOMAIN" );  // 
+_LIT( KImmediateDT,     "IMMEDIATE-DOMAIN-TRANSFER" );   // 
+_LIT( KDtCsToPsAllowed, "DT-CS-TO-PS-ALLOWED" );      // 
+_LIT( KDtPsToCsAllowed, "DT-PS-TO-CS-ALLOWED" );     // 
+_LIT( KDtHeldwaitingCallsAllowed, "DT-HELD-WAITING-CALLS-ALLOWED" );     // 
+
+_LIT( KWlanHOTreshold, "WLAN-HO-THRESHOLD-VALUE" );
+_LIT( KWlanHOHysteresis, "WLAN-HO-HYSTERESIS-VALUE" );
+_LIT( KWlanHysteresisTimerLow, "WLAN-HYSTERESIS-TIMER-LOW" );
+_LIT( KWlanHysteresisTimerHigh, "WLAN-HYSTERESIS-TIMER-HIGH" );
+
+_LIT( KCSHOTreshold, "CS-HO-THRESHOLD-VALUE" );
+_LIT( KCSHOHysteresis, "CS-HO-HYSTERESIS-VALUE" );
+_LIT( KCSHysteresisTimerLow, "CS-HYSTERESIS-TIMER-LOW" );
+_LIT( KCSHysteresisTimerHigh, "CS-HYSTERESIS-TIMER-HIGH" );
+_LIT( KDtAllowedWhenCsOriginated, "DT-ALLOWED-WHEN-CS-ORIGINATED" );
+
+_LIT16( KDefaultName, "VCC application settings" );
+
+
+// -----------------------------------------------------------------------------
+// ResetAndDestroyEntries
+// -----------------------------------------------------------------------------
+//
+void ResetAndDestroyProfileEntries( TAny* anArray )
+    {
+
+    RPointerArray<CRCSEProfileEntry>* array =
+        reinterpret_cast<RPointerArray<CRCSEProfileEntry>*>( anArray );
+
+    if (array)
+        {
+        array->ResetAndDestroy();
+        array->Close();
+        }
+    }
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CWPVccAdapter::CWPVccAdapter() : CWPAdapter()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CWPVccAdapter::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CWPVccAdapter::ConstructL" );
+    
+    TFileName fileName;
+    
+    // ReadHBufCL needs the path where the resource file is.
+    // Actually, the WPAdapterUtil only uses the drive part of the string
+    // (which is normally "z:")
+    // The resource file name must not contain the suffix since it is
+    // added.
+    
+    Dll::FileName( fileName );
+    
+    iTitle = WPAdapterUtil::ReadHBufCL(
+        fileName, KVccResourceFileNameWithoutSuffix, R_QTN_SM_HEAD_VCC );
+     }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CWPVccAdapter* CWPVccAdapter::NewL()
+    {
+    RUBY_DEBUG_BLOCKL( "CWPVccAdapter::NewL" );
+    CWPVccAdapter* self = new( ELeave ) CWPVccAdapter;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CWPVccAdapter::~CWPVccAdapter()
+    {
+    RUBY_DEBUG0( "CWPVccAdapter::~CWPVccAdapter() - ENTER" );
+   
+    iToAppReferences.Close();
+    delete iTitle;
+    delete iAppID;
+    delete iVccItem;
+    delete iNewVccItem;
+ 
+    RUBY_DEBUG0( "CWPVccAdapter::~CWPVccAdapter() - EXIT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Not currently supported.
+// ---------------------------------------------------------------------------
+//
+TInt CWPVccAdapter::ContextExtension( MWPContextExtension*& /*aExtension*/ )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::ContextExtension" );
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// Not currently supported.
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CWPVccAdapter::SaveDataL( TInt /*aIndex*/ ) const
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::SaveDataL" );
+    User::Leave( KErrNotSupported );
+    // Nothing returned cause we leave.
+    return KNullDesC8;
+    }
+
+// ---------------------------------------------------------------------------
+// Not currently supported.
+// ---------------------------------------------------------------------------
+//
+void CWPVccAdapter::DeleteL( const TDesC8& /*aSaveData*/ )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::DeleteL" );
+    User::Leave( KErrNotSupported );
+    }
+
+// ---------------------------------------------------------------------------
+// Returns UID of the adapter (*this).
+// ---------------------------------------------------------------------------
+//
+TUint32 CWPVccAdapter::Uid() const
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::Uid" );
+    return KProvisioningVccAdapterImplementationUid; //iDtor_ID_Key.iUid;
+    }
+
+// ---------------------------------------------------------------------------
+// Used to query for the detail information about the Vcc profile.
+// Not currently supported.
+// ---------------------------------------------------------------------------
+//
+TInt CWPVccAdapter::DetailsL( TInt, MWPPairVisitor& )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::DetailsL" );
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the amount of Vcc data items (always 1 if data got, otherwise 0).
+// ---------------------------------------------------------------------------
+//
+TInt CWPVccAdapter::ItemCount() const
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::ItemCount" );
+    return iVccItem ? 1 : 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns summary title of the Vcc profile received in configuration
+// message.
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CWPVccAdapter::SummaryTitle( TInt /*aIndex*/ ) const
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::SummaryTitle" );
+    return *iTitle;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns summary text of the Vcc profile received in configuration
+// message. Returns NULL descriptor if no settings received.
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CWPVccAdapter::SummaryText( TInt /*aIndex*/ ) const
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::SummaryText" );
+
+	if ( iVccItem )
+	    {
+	    RUBY_DEBUG0( "-vccitem Name" );
+	    return iVccItem->ServiceName();
+	    }
+    else
+        {
+  
+        RUBY_DEBUG0( " - default text NO ITEM!" );
+        return KDefaultName;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Saves Vcc item (whole profile). If no settings are received, leaves with
+// errorcode KErrGeneral.
+// ---------------------------------------------------------------------------
+//
+void CWPVccAdapter::SaveL( TInt /*aIndex*/ )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::SaveL" );
+    
+    TRAP_IGNORE( RemoveVCCSettingsL() );
+    
+	// Lets do the saving when framework calls savingFinalisedL method
+    }
+
+// ---------------------------------------------------------------------------
+// Tells if current profile can be set as a default profile. Since Vcc
+// currently supports only single profile, return value is always false.
+// ---------------------------------------------------------------------------
+//
+TBool CWPVccAdapter::CanSetAsDefault( TInt /*aIndex*/ ) const
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::CanSetAsDefault" );
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the Vcc item on place pointed by index given in parameter as default.
+// Since Vcc currently supports only single profile and CanSetAsDefault method
+// always returns false, this method should never be called. It is unsupported
+// and does nothing. Derivation of this method is done only to fulfill the
+// demands of s60 Coding conventions, Symbian OS, C++ and other entities
+// setting boundaries for specific software as *this.
+// ---------------------------------------------------------------------------
+//
+void CWPVccAdapter::SetAsDefaultL( TInt /*aIndex*/ )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::SetAsDefaultL" );
+    // This shouldn't be called because CanSetAsDefault
+    // always returns EFalse
+    User::Leave( KErrNotSupported );
+    }
+
+// ---------------------------------------------------------------------------
+// This method is called by the provisioning framework to "visit" an adapter
+// plugin (*this). Plugin then checks if the visiting aCharacteristic are
+// of the particular type that this plugin wants to handle, and if so, it
+// invites the visitor deeper in to more intimate series of visits through
+// overloaded VisitL method with CWPParameter& visitor aboard.
+// Generally this plugin is interested in two type of visitors, one called
+// KWPApplication (carrying application level data), and other called
+// KWPNapDef (carrying data needed to establish new IAPs).
+// ---------------------------------------------------------------------------
+//
+void CWPVccAdapter::VisitL( CWPCharacteristic& aCharacteristic )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::VisitL char" );
+    
+    switch ( aCharacteristic.Type() )
+        {
+        case KWPApplication:
+            {
+            RUBY_DEBUG0( " - KWPApplication create new item" );
+            iNewVccItem = CVccSPSettings::NewL();
+        
+            iCurrentCharacteristicType = aCharacteristic.Type() ;
+            aCharacteristic.AcceptL( *this );
+        
+            if( iAppID && *iAppID == KVccAppID )
+                {
+                RUBY_DEBUG0( "- VCC AppId used" );
+                delete iVccItem;
+                iVccItem = iNewVccItem;
+                }
+            else
+                {
+                delete iNewVccItem;
+                }
+            iNewVccItem = NULL;   
+            }break;
+        default:
+            {
+            }break;
+        }
+
+    }
+
+// ---------------------------------------------------------------------------
+// This "visit" method should be called by all params in CWPCharacteristic&
+// visitors invited welcome in VisitL( CWPCharacteristic& ) overload. The
+// information in visiting params are then stored to VccItem datastructure for
+// future use.
+// ---------------------------------------------------------------------------
+//
+void CWPVccAdapter::VisitL( CWPParameter& aParameter )
+    {
+    RUBY_DEBUG0( "VisitL param" );
+    
+    switch( aParameter.ID() )
+        {
+        case EWPParameterAppID:
+            {
+	        RUBY_DEBUG0( "- got EWPParameterAppID");
+            delete iAppID; 
+	        iAppID = NULL;
+	        iAppID = aParameter.Value().AllocL();
+            
+            
+            }break;
+        case EWPNamedParameter:
+            {
+            RUBY_DEBUG0( "- got EWPNamedParameter populate VCC item" );
+            
+            if( !iNewVccItem )
+                {
+                RUBY_DEBUG0( "- NO VCC item " );
+                return;
+                }
+            
+            TPtrC value( aParameter.Value() );
+
+            if ( aParameter.Name().Compare( KVdi )  == KErrNone )
+                {
+                RUBY_DEBUG1( "- got VDI:%S" , 
+                             &value );
+                iNewVccItem->SetVdiL( value );
+                }
+            else if ( aParameter.Name().Compare( KVdn )  == KErrNone  )
+                {
+                RUBY_DEBUG1( "- got VDN:%S" ,
+                             &value );
+#if defined( _DEBUG )                
+                TInt val = aParameter.Name().Compare( KVdn );
+                TBool valb (!val);
+#endif                
+                RUBY_DEBUG1( "- got val:%d", val );
+                RUBY_DEBUG1( "- got valb:%d", valb );
+                
+                iNewVccItem->SetVdnL( value );
+                }
+            else if ( aParameter.Name().Compare( KPreferredDomain ) == KErrNone )
+                {
+                RUBY_DEBUG1( "- got Preferred Domain:%S" ,
+                             &value );
+                iNewVccItem->SetPreferredDomainL( value );
+                }
+            else if ( aParameter.Name().Compare( KImmediateDT )  == KErrNone  )
+                {
+                RUBY_DEBUG1( "- got Immediate DT:%S" , 
+                            &value );
+                iNewVccItem->SetImmediateDtL( value );
+                }
+            else if ( aParameter.Name().Compare( KDtCsToPsAllowed ) == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT from CS to PS allowed:%S" ,
+                             &value );
+                      
+                iNewVccItem->SetDtCsToPsAllowedL( value );
+                }
+            else if ( aParameter.Name().Compare( KDtPsToCsAllowed ) == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT from CS to PS allowed:%S" ,
+                             &value );
+                      
+                iNewVccItem->SetDtPsToCsAllowedL( value );
+                }
+            else if ( aParameter.Name().Compare( 
+                            KDtHeldwaitingCallsAllowed )  == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT from CS to PS allowed:%S" ,
+                             &value );
+                      
+                iNewVccItem->SetDtHeldWaitingCallsAllowedL( value );
+                }
+            else if ( aParameter.Name().Compare( 
+                            KWlanHOTreshold )  == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT from WLAN HO Treshold value:%S" ,
+                             &value );
+                     
+                iNewVccItem->SetDtWlanHoTresholdL( value );
+                }
+            else if ( aParameter.Name().Compare( 
+                            KWlanHOHysteresis )  == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT from WLAN HO hysteresis value:%S" ,
+                             &value );
+                      
+                iNewVccItem->SetDtWlanHoHysteresisL( value );
+                }
+            else if ( aParameter.Name().Compare( 
+                            KWlanHysteresisTimerLow )  == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT from WLAN Hysteresis timer low:%S" ,
+                             &value );
+                      
+                iNewVccItem->SetDtWlanHoHysteresisTimerLowL( value );
+                }
+            else if ( aParameter.Name().Compare( 
+                            KWlanHysteresisTimerHigh )  == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT from WLAN Hysteresis timer high:%S" ,
+                             &value );
+                      
+                iNewVccItem->SetDtWlanHoHysteresisTimerHighL( value );
+                }
+
+            else if ( aParameter.Name().Compare( 
+                            KCSHOTreshold )  == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT from CS HO Treshold value:%S" ,
+                             &value );
+                     
+                iNewVccItem->SetDtCsHoTresholdL( value );
+                }
+            else if ( aParameter.Name().Compare( 
+                            KCSHOHysteresis )  == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT from CS HO hysteresis value:%S" ,
+                             &value );
+                      
+                iNewVccItem->SetDtCsHoHysteresisL( value );
+                }
+            else if ( aParameter.Name().Compare( 
+                            KCSHysteresisTimerLow )  == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT from CS Hysteresis timer low:%S" ,
+                             &value );
+                      
+                iNewVccItem->SetDtCsHoHysteresisTimerLowL( value );
+                }
+            else if ( aParameter.Name().Compare( 
+                            KCSHysteresisTimerHigh )  == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT from CS Hysteresis timer high:%S" ,
+                             &value );
+                      
+                iNewVccItem->SetDtCsHoHysteresisTimerHighL( value );
+                }
+            else if( aParameter.Name().Compare( 
+                        KDtAllowedWhenCsOriginated )  == KErrNone )
+                {
+                RUBY_DEBUG1( "- got DT allowed when CS originated:%S" ,
+                                             &value );
+                iNewVccItem->SetDtAllowedWhenCsOriginated( value );
+                }
+            else
+                {
+                RUBY_DEBUG0( "- no such VCC param" );    
+                }    
+            break;
+            }
+        case EWPParameterProviderID: // APPLICATION/PROVIDER-ID
+            {
+            if( iNewVccItem != NULL )
+                {
+                RUBY_DEBUG0( "- got EWPParameterProviderID" );
+                
+                iNewVccItem->SetProviderIdL( aParameter.Value() );
+                
+                }
+                
+            } break;
+
+        case EWPParameterName: // APPLICATION/NAME
+            {
+            if( iNewVccItem != NULL )
+                {
+                RUBY_DEBUG0( "- got EWPParameterName" );
+                iNewVccItem->SetServiceNameL( aParameter.Value() );
+
+                }
+
+            } break;
+            
+        case EWPParameterToAppRef:
+            {
+            RUBY_DEBUG1("-got EWPParameterToAppRef: %S", &aParameter.Value());
+            iToAppReferences.Append(aParameter.Value());
+            break;
+            }
+      default:
+            {
+            RUBY_DEBUG0( "- got unknown" );
+        
+            } break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// This method is called when the provisioning framework finds a link to
+// special characteristic belonging to characteristics accepted by *this
+// plugin. The linked characteristics are stored to VccItem data structure
+// for future use in a need-to-store basis.
+// ---------------------------------------------------------------------------
+//
+void CWPVccAdapter::VisitLinkL( CWPCharacteristic& /*aLink*/ )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::VisitLinkL" );
+    
+    RUBY_DEBUG0("Do nothing");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWPVccAdapter::::SettingsSavedL
+//
+// -----------------------------------------------------------------------------
+void CWPVccAdapter::SettingsSavedL(const TDesC8& aAppIdOfSavingItem,
+                                                const TDesC8& aAppRef, 
+                                                const TDesC8& aStorageIdValue)
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::SettingsSavedL" );
+   
+#ifdef _DEBUG
+    HBufC* tmp = HBufC::NewLC( aAppIdOfSavingItem.Length() );
+    tmp->Des().Copy( aAppIdOfSavingItem );
+    RUBY_DEBUG1( "aAppIdOfSavingItem = %S", &(*tmp) );
+    CleanupStack::PopAndDestroy( tmp );
+    
+    tmp = HBufC::NewLC( aAppRef.Length() );
+    tmp->Des().Copy( aAppRef );
+    RUBY_DEBUG1( "aAppRef = %S", &(*tmp) );
+    CleanupStack::PopAndDestroy( tmp );
+    
+    tmp = HBufC::NewLC( aStorageIdValue.Length() );
+    tmp->Des().Copy( aStorageIdValue );
+    RUBY_DEBUG1( "aStorageIdValue = %S", &(*tmp) );
+    CleanupStack::PopAndDestroy( tmp );
+#endif
+        
+     // Check which application reference is being offered
+     for(TInt j=0; j<iToAppReferences.Count(); j++)
+            {
+            const TDesC& toAppRef = iToAppReferences[j];
+            HBufC* appRef16 = HBufC::NewLC(aAppRef.Length());
+            appRef16->Des().Copy(aAppRef);
+            
+            RUBY_DEBUG1( "Checking toAppRef: %S", &toAppRef );
+    
+            
+            if( toAppRef.Compare(*appRef16) == 0 )
+                {
+    			RUBY_DEBUG0( "APPREF matched with TO-APPREF" );
+                
+                if( (aAppIdOfSavingItem.Compare( KVoIPAppID8 ) == 0) && iVccItem != NULL )
+                	{
+            		TLex8 temp( aStorageIdValue );
+            		User::LeaveIfError( temp.Val( iVoipProfileId ) );
+                	}
+                }
+            else
+            	{
+            	RUBY_DEBUG0( "APPREF did not match with TO-APPREF" );
+                
+            	}
+                
+            CleanupStack::PopAndDestroy(appRef16);
+            }
+                
+    }
+    
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::SavingFinalizedL()
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVccAdapter::SavingFinalizedL()
+    {
+    RUBY_DEBUG0( "CWPVccAdapter::SavingFinalizedL IN" );
+    if ( iVccItem )
+        {
+        CRCSEProfileRegistry* cRCSEProfileRegistry = CRCSEProfileRegistry::NewLC(); // CS:1
+        CRCSEProfileEntry* foundEntry = CRCSEProfileEntry::NewLC(); // CS:2
+        cRCSEProfileRegistry->FindL( iVoipProfileId, *foundEntry );
+        RUBY_DEBUG1( "SavingFinalizedL::ServiceId=%d", foundEntry->iServiceProviderId );
+                                
+        iVccItem->SetVoipServiceIdL( foundEntry->iServiceProviderId );
+        iVccItem->StoreL();
+
+        CleanupStack::PopAndDestroy( foundEntry ); // CS:1
+        CleanupStack::PopAndDestroy( cRCSEProfileRegistry ); // CS:0
+        }
+    
+    //Remove SNAP
+    TRAP_IGNORE(RemoveNetworkDestinationL() );
+    
+    RUBY_DEBUG0( "CWPVccAdapter::SavingFinalizedL OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CWPVccAdapter::RemoveVCCSettingsL()
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVccAdapter::RemoveVCCSettingsL()
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::RemoveVCCSettingsL" );
+    // Get the Voip service id. Get it always to if the SP
+    // settings are changed, we get updated values.
+    TInt VoIPServiceId(KErrNotFound);
+    TRAPD(error, VoIPServiceId = VccSettingsReader::VoIPServiceIdL() );
+    RUBY_DEBUG1( " -VoIP service id: %d", VoIPServiceId );  
+    
+    if ( error != KErrNone )
+           {
+           RUBY_DEBUG0( " -VoIP service not found - LEAVE" );
+           User::Leave( KErrNotFound );
+           }
+     
+    //Get current VCC enabled VoIP service name before saving new one
+    //it will be used to delete the network destination
+    
+    CSPSettings* settings = CSPSettings::NewLC();
+    CSPProperty* property = CSPProperty::NewLC();
+    
+    //Get VoIP service name store it
+    error = settings->FindPropertyL( VoIPServiceId, EServiceName, *property );
+      
+    error = property->GetValue( iOldVoipServiceName );
+    User::LeaveIfError( error );
+    
+     CleanupStack::PopAndDestroy( property );
+     CleanupStack::PopAndDestroy( settings );
+    
+   
+     CCchService* cchService;
+      // Get the service 
+     CCch* cch = CCch::NewL();
+    //ownership not transfered so no need to delete
+     cchService = cch->GetService( VoIPServiceId );
+                
+     if( cchService )
+         {
+         RUBY_DEBUG0( " -Disable service" );
+         (void) cchService->Disable( ECCHVoIPSub );
+         }
+     delete cch;
+     
+     
+     // Get VoIP profile ID from VCC settings (use Service ID)
+     // Convert Service Id to VoipProfileID
+     CRCSEProfileRegistry* cRCSEProfileRegistry = CRCSEProfileRegistry::NewLC();
+     RPointerArray<CRCSEProfileEntry> foundEntries;
+     CleanupStack::PushL( TCleanupItem( ResetAndDestroyProfileEntries, &foundEntries ) );
+
+     cRCSEProfileRegistry->FindByServiceIdL( VoIPServiceId, foundEntries );
+     
+     const TInt count( foundEntries.Count() );
+     TSettingIds value;
+ 
+     CSIPManagedProfileRegistry* SIPRegistry;
+     SIPRegistry = CSIPManagedProfileRegistry::NewLC(*this);
+
+     TInt err(0);
+       
+     //remove SIP settings
+     if ( count > 0 )
+        {
+        // Check the existence of linked SIP profiles
+           for ( TInt i( count-1 ); 0 <= i ; i-- )
+                {
+                 value = foundEntries[0]->iIds[i];
+             
+                 if ( CRCSEProfileEntry::EProtocolSIP == value.iProfileType )
+                     {
+                     CSIPProfile* profile = NULL;
+                     TRAP( err, profile = SIPRegistry->ProfileL( value.iProfileId ) );
+                     if ( KErrNotFound == err )
+                         {
+                         delete profile;
+                         profile = NULL;
+                         RUBY_DEBUG0 ("SIP profile not found");
+                         }
+                     else
+                         {
+                         SIPRegistry->DestroyL(*profile);
+                         RUBY_DEBUG0 ("Sip profile destroyed");
+                         delete profile;
+                         profile = NULL;
+                         }
+                  }
+               }
+      
+         TInt voipId = foundEntries[0]->iId;
+       
+         // Remove VoIP settings
+        cRCSEProfileRegistry->DeleteL(voipId);
+        }
+    CleanupStack::PopAndDestroy( SIPRegistry ); 
+    CleanupStack::PopAndDestroy(); // foundEntries
+    CleanupStack::PopAndDestroy( cRCSEProfileRegistry );
+    }
+// ---------------------------------------------------------------------------
+// From MSIPProfileRegistryObserver
+// CWPVccAdapter::ProfileRegistryEventOccurred
+// SIP profile event
+// ---------------------------------------------------------------------------
+//
+void CWPVccAdapter::ProfileRegistryEventOccurred( 
+    TUint32 /*aSIPProfileId*/,
+    TEvent /*aEvent*/ )
+    {
+    RUBY_DEBUG0( "CWPVccAdapter::ProfileRegistryEventOccurred" );
+    // Have to be implemented because MSIPProfileRegistryObserver
+    // is passed to CSIPManagedProfileRegistry.
+    }
+
+// ---------------------------------------------------------------------------
+// From MSIPProfileRegistryObserver
+// CWPVccAdapter::ProfileRegistryErrorOccured
+// An asynchronous error has occurred related to SIP profile
+// ---------------------------------------------------------------------------
+//
+void CWPVccAdapter::ProfileRegistryErrorOccurred( 
+    TUint32  /*aProfileId*/,
+    TInt /*aError*/ )
+    {
+    RUBY_DEBUG0( "CRCSEProfileRegistry::ProfileRegistryErrorOccurred" );
+    // Have to be implemented because MSIPProfileRegistryObserver
+    // is passed to CSIPManagedProfileRegistry.
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVccAdapter::RemoveNetworkDestinationL()
+//
+// ---------------------------------------------------------------------------
+//
+
+void CWPVccAdapter::RemoveNetworkDestinationL()
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccAdapter::RemoveNetworkDestination" );
+
+    //remove destination 
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL(cmManager);
+    
+    RArray<TUint32> destinations;
+    CleanupClosePushL(destinations);
+    cmManager.AllDestinationsL(destinations);
+   
+    RCmDestinationExt destination;
+    HBufC *destinationName;
+    
+    for( TInt i = 0; i < destinations.Count(); i++)
+          {
+           destination = cmManager.DestinationL(destinations[i]);
+           CleanupClosePushL(destination);
+           destinationName = destination.NameLC();
+                          
+           if (destinationName->Compare( iOldVoipServiceName ) == 0 )
+               {
+               CleanupStack::PopAndDestroy( destinationName ); // Ownership is transferred to item    
+               destinationName = NULL;
+               CleanupStack::Pop(); // destination
+               destination.DeleteLD();
+               RUBY_DEBUG0( "deleted network destination");
+               }
+           else
+               {
+               RUBY_DEBUG0("destination NOT found");
+               CleanupStack::PopAndDestroy( destinationName ); // Ownership is transferred to item    
+               destinationName = NULL;
+               CleanupStack::PopAndDestroy(); // destination
+               }
+            
+           }
+        CleanupStack::PopAndDestroy(); // destinations
+        CleanupStack::PopAndDestroy(); //cmManager  
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/src/wpvccadaptergroupproxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Table of plugins for ECom.
+*
+*/
+
+
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "wpvccadapteruids.h"
+#include "wpvccadapter.h"
+
+// ---------------------------------------------------------------------------
+// Return implementation proxy entry
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy KImplementationTable[] =
+    {
+   	IMPLEMENTATION_PROXY_ENTRY(
+    	KProvisioningVccAdapterImplementationUid,
+	    CWPVccAdapter::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// This function returns a TImplementationProxy* pointer pointing to table
+// of implementations allowed to instantiate with this plugin collection.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount =
+        sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+    return KImplementationTable;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccclientprovisioningadapter/src/wpvccadaptermain.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   DLL entry point
+*
+*/
+
+
+
+
+#ifndef EKA2
+
+// ======== OTHER EXPORTED FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Entry point of *this dll.
+// ---------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Dll( TDllReason )
+    {
+    return KErrNone;
+    }
+
+
+#endif // EKA2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/EABI/vcchotriggerU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,30 @@
+EXPORTS
+	_ZN13CVccHoTrigger13HoNotAllowedLEv @ 1 NONAME
+	_ZN13CVccHoTrigger19ManualHoCallStartedEv @ 2 NONAME
+	_ZN13CVccHoTrigger20ManualHoCallReleasedEv @ 3 NONAME
+	_ZN13CVccHoTrigger20SetCurrentDomainTypeENS_15TCallDomainTypeE @ 4 NONAME
+	_ZN13CVccHoTrigger22SetPreferredDomainTypeE27TVccHoPolicyPreferredDomain @ 5 NONAME
+	_ZN13CVccHoTrigger26SetImmediateDomainTransferEi @ 6 NONAME
+	_ZN13CVccHoTrigger4NewLEv @ 7 NONAME
+	_ZN13CVccHoTrigger4StopER13CVccPerformer @ 8 NONAME
+	_ZN13CVccHoTrigger4StopEv @ 9 NONAME
+	_ZN13CVccHoTrigger5StartER13CVccPerformeri @ 10 NONAME
+	_ZN13CVccHoTrigger9HoAllowedEv @ 11 NONAME
+	_ZTI13CVccHoTrigger @ 12 NONAME ; #<TI>#
+	_ZTI14CVccCchMonitor @ 13 NONAME ; #<TI>#
+	_ZTI17CVccEngPsProperty @ 14 NONAME ; #<TI>#
+	_ZTI18CVccHoPolicyReader @ 15 NONAME ; #<TI>#
+	_ZTI20CVccGsmNotifications @ 16 NONAME ; #<TI>#
+	_ZTI22CVccSignalLevelHandler @ 17 NONAME ; #<TI>#
+	_ZTI25CVccGsmSignalLevelHandler @ 18 NONAME ; #<TI>#
+	_ZTI26CVccWlanSignalLevelHandler @ 19 NONAME ; #<TI>#
+	_ZTV13CVccHoTrigger @ 20 NONAME ; #<VT>#
+	_ZTV14CVccCchMonitor @ 21 NONAME ; #<VT>#
+	_ZTV17CVccEngPsProperty @ 22 NONAME ; #<VT>#
+	_ZTV18CVccHoPolicyReader @ 23 NONAME ; #<VT>#
+	_ZTV20CVccGsmNotifications @ 24 NONAME ; #<VT>#
+	_ZTV22CVccSignalLevelHandler @ 25 NONAME ; #<VT>#
+	_ZTV25CVccGsmSignalLevelHandler @ 26 NONAME ; #<VT>#
+	_ZTV26CVccWlanSignalLevelHandler @ 27 NONAME ; #<VT>#
+	_ZN13CVccHoTrigger37ReadHoAllowedWhenCsOriginatedSettingLEv @ 28 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/bwins/vcchotriggeru.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,14 @@
+EXPORTS
+	?HoAllowed@CVccHoTrigger@@QAEXXZ @ 1 NONAME ; void CVccHoTrigger::HoAllowed(void)
+	?HoNotAllowedL@CVccHoTrigger@@QAEXXZ @ 2 NONAME ; void CVccHoTrigger::HoNotAllowedL(void)
+	?ManualHoCallReleased@CVccHoTrigger@@QAEXXZ @ 3 NONAME ; void CVccHoTrigger::ManualHoCallReleased(void)
+	?ManualHoCallStarted@CVccHoTrigger@@QAEXXZ @ 4 NONAME ; void CVccHoTrigger::ManualHoCallStarted(void)
+	?NewL@CVccHoTrigger@@SAPAV1@XZ @ 5 NONAME ; class CVccHoTrigger * CVccHoTrigger::NewL(void)
+	?ReadHoAllowedWhenCsOriginatedSettingL@CVccHoTrigger@@QAEXXZ @ 6 NONAME ; void CVccHoTrigger::ReadHoAllowedWhenCsOriginatedSettingL(void)
+	?SetCurrentDomainType@CVccHoTrigger@@QAEXW4TCallDomainType@1@@Z @ 7 NONAME ; void CVccHoTrigger::SetCurrentDomainType(enum CVccHoTrigger::TCallDomainType)
+	?SetImmediateDomainTransfer@CVccHoTrigger@@QAEXH@Z @ 8 NONAME ; void CVccHoTrigger::SetImmediateDomainTransfer(int)
+	?SetPreferredDomainType@CVccHoTrigger@@QAEXW4TVccHoPolicyPreferredDomain@@@Z @ 9 NONAME ; void CVccHoTrigger::SetPreferredDomainType(enum TVccHoPolicyPreferredDomain)
+	?Start@CVccHoTrigger@@QAEXAAVCVccPerformer@@H@Z @ 10 NONAME ; void CVccHoTrigger::Start(class CVccPerformer &, int)
+	?Stop@CVccHoTrigger@@QAEXAAVCVccPerformer@@@Z @ 11 NONAME ; void CVccHoTrigger::Stop(class CVccPerformer &)
+	?Stop@CVccHoTrigger@@QAEXXZ @ 12 NONAME ; void CVccHoTrigger::Stop(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 vcchotrigger
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+vcchotrigger.mmp
+
+PRJ_TESTMMPFILES
+//../internal/ETelTestServer/Group/vpbketelserver.mmp
+//../internal/ETelTestServer/Group/vpbketelserverclient.mmp
+//../internal/tsrc/group/ut_vcchotrigger.mmp
+
+GNUMAKEFILE test_mover.make
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/group/test_mover.make	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,5 @@
+FINAL :
+	echo Copying test DLL to z\sys\bin
+	copy %epocroot%epoc32\release\winscw\udeb\t_vcchotrigger.dll %epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES CLEAN BLD SAVESPACE :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/group/vcchotrigger.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 vcchotrigger
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET                  vcchotrigger.dll
+TARGETTYPE              DLL
+UID                     0x1000008D 0x2000CFB1
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  vcchotrigger.cpp
+SOURCE                  rubydebug.cpp
+SOURCE                  vccwlansignallevelhandler.cpp
+SOURCE                  vccsignallevelhandler.cpp
+SOURCE                  vccgsmnotifications.cpp
+SOURCE                  vccgsmsignallevelhandler.cpp
+SOURCE                  vcchopolicyreader.cpp
+SOURCE                  vcchopolicy.cpp
+SOURCE                  vcccchmonitor.cpp
+
+SOURCEPATH              ../../vcc/src
+SOURCE                  vccengpsproperty.cpp
+SOURCEPATH              ../../settingsreader/src
+SOURCE                  vccsettingsreader.cpp
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../vcc/inc
+USERINCLUDE             ../../vccutils/inc
+USERINCLUDE             ../../settingsreader/inc
+
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY             euser.lib
+LIBRARY             efsrv.lib                   //rubydebug
+LIBRARY             vccuipropertyhandler.lib    //ps keys
+LIBRARY             ecom.lib
+LIBRARY             vccutils.lib
+LIBRARY             serviceprovidersettings.lib
+LIBRARY             centralrepository.lib
+LIBRARY             cch.lib
+LIBRARY             etel.lib
+LIBRARY             etelmm.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/inc/vcccchmonitor.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,227 @@
+/*
+* 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:   CCH monitor class definition
+*
+*/
+
+
+#ifndef VCCCCHMONITOR_H
+#define VCCCCHMONITOR_H
+
+#include <e32base.h>
+#include <cch.h>
+
+#include "vcccchobserver.h"
+#include "vccunittesting.h"
+
+/**
+ *  CCH monitor. Uses CCH to enable/disable CCH services.
+ *
+ *  @code
+ *   MyClass::ConstructL()
+ *       {
+ *       iMyCch = Cch::NewL();
+ *
+ *       iMyService = iMyCch->GetService( iMyServiceId );
+ *
+ *       User::LeaveIfNull( iMyService );
+ *
+ *       iMyService->SetObserver( *this );
+ *
+ *       TInt error = iMyService->Enable( iMyServiceType );
+ *
+ *       if ( error != KErrNone )
+ *           {
+ *           User::Leave( error );
+ *           }
+ *       }
+ *
+ *   MyClass::ServiceStatusChanged(
+ *       TInt aServiceId,
+ *       CCHSubserviceType aType,
+ *       const TCchServiceStatus& aServiceStatus )
+ *       {
+ *       if ( aServiceStatus.Error() != KErrNone )
+ *           {
+ *           HandleError();
+ *           }
+ *       else
+ *           {
+ *           HandleStateChange();
+ *           }
+ *       }
+ *
+ *   MyClass::~MyClass()
+ *       {
+ *       iMyService->Disable( iMyServiceType );
+ *       delete iCch;
+ *       }
+ *
+ *  @endcode
+ *
+ *  @lib vcchotrigger.dll
+ *  @since S60 v3.2
+ */
+class CVccCchMonitor : public CBase,
+                       public MCchServiceStatusObserver
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aObserver Observer to be notified when status changes
+     */
+    static CVccCchMonitor* NewL( MVccCchObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVccCchMonitor();
+
+    /**
+     * Enable the service and start monitoring
+     * the service state.
+     *
+     * @since S60 v3.2
+     */
+    void EnableServiceL();
+
+    /**
+     * Disable the service and stop monitoring the
+     * service state
+     *
+     * @since S60 v3.2
+     */
+    void DisableService();
+
+    /**
+     * Get the last state of the CCH service.
+     *
+     * @since S60 v3.2
+     * @return The status of the service: available or not
+     */
+    MVccCchObserver::TServiceStatus ServiceStatus() const;
+
+
+// from base class MCchServiceStatusObserver
+
+    /**
+     * From MCchServiceStatusObserver
+     * Signaled when service status or error changes
+     *
+     * @param aServiceId Id of the service
+     * @param aType Service type
+     * @param aServiceStatus Service status
+     */
+    void ServiceStatusChanged(
+            TInt aServiceId,
+            TCCHSubserviceType aType,
+            const TCchServiceStatus& aServiceStatus );
+
+private:
+
+    /**
+     * C++ constructor
+     *
+     * @since S60 v3.2
+     * @param aObserver Observer to be notified when status changes.
+     */
+    CVccCchMonitor( MVccCchObserver& aObserver );
+
+    /**
+     * Symbian constructor
+     *
+     * @since S60 v3.2
+     */
+    void ConstructL();
+
+    /**
+     * Notify observer about CCH service status has changed.
+     *
+     * @since S60 v3.2
+     */
+    void NotifyObserver();
+
+
+    /**
+     * Enable the service (assioated to the iCchService)
+     *
+     * @since S60 v3.2
+     */
+    void DoEnableServiceL();
+
+
+private: // data
+
+    /**
+     * Our observer.
+     * Not own
+     */
+    MVccCchObserver& iObserver;
+
+    /**
+     * Should our obsever to be notified
+     * ETrue: yes, EFalse: no.
+     */
+    TBool iNotifyObserver;
+
+    /*
+     * CCH
+     * Own.
+     */
+    CCch* iCch;
+
+    /*
+     * CCH service
+     * Not own.
+     */
+    CCchService* iCchService;
+
+    /*
+     * Service is reserved for us.
+     */
+    TBool iServiceReserved;
+
+    /*
+     * Must we disable the service upon exit.
+     */
+    TBool iDisableService;
+
+    /**
+     * The last state of the CCH service.
+     */
+    TCCHSubserviceState iCurrentCchState;
+
+    /**
+     * The last error received from the CCH service
+     */
+    TInt iLastCchError;
+
+    /**
+     * Service id of the VoIP we are using
+     */
+    TInt iServiceId;
+
+    /*
+     * Current status (own status reported to observer).
+     */
+    MVccCchObserver::TServiceStatus iCurrentStatus;
+
+
+    VCC_UNITTEST( UT_CVccCchMonitor )
+    };
+
+
+#endif // VCCCCHMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/inc/vcccchobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCH observer API
+*
+*/
+
+
+
+#ifndef VCCCCHOBSERVER_H
+#define VCCCCHOBSERVER_H
+
+#include <e32base.h>
+
+/**
+ *  Observer class for CVccCchMonitor
+ *
+ *  The class that defines observer interfaces.
+ *  Used to get notifications when CCH states changes.
+ *  @code
+ *   class CMyClass : public CBase, public MVccCchObserver
+ *       {
+ *   public:
+ *       ...
+ *       void CchServiceStatusChanged( TServiceStatus aStatus );
+ *       ...
+ *       }
+ *
+ *   void MyClass::CchServiceStatusChanged( TServiceStatus aStatus )
+ *       {
+ *       if ( aStatus == MVccCchObserver::EServiceUnavailable )
+ *           {
+ *           ServiceNotWorking();
+ *           }
+ *       else
+ *           {
+ *           ServiceWorking();
+ *           }
+ *       }
+ *
+ *  @endcode
+ *
+ *  @lib vcchotrigger.lib
+ *  @since S60 v3.2
+ */
+class MVccCchObserver
+    {
+public:
+
+    /**  Service status */
+    enum TServiceStatus
+        {
+        EServiceUnavailable = 0,
+        EServiceAvailable
+        };
+
+    /**
+     * Observer interface. Called when the CCH status has been changed.
+     *
+     * @since S60 v3.2
+     * @param aStatus Status of the service availability.
+     */
+
+    virtual void CchServiceStatusChanged( TServiceStatus aStatus ) = 0;
+
+    };
+
+#endif // VCCCCHOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/inc/vccgsmnotifications.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Activates the notification of gsm signal level strengths
+*
+*/
+
+
+
+#ifndef VCCGSMNOTIFICATIONS_H_
+#define VCCGSMNOTIFICATIONS_H_
+
+#include <etelmm.h> 
+
+/**
+ *  Observer which will receive notification about gsm signal level changes
+ *
+ *  @lib vcchotrigger.lib
+ *  @since S60 3.2
+ */
+class MVccGsmNotifications
+    {
+    public:
+        /**
+        * Constructor.
+        *
+        * @since S60 3.2
+        */
+        virtual void GsmStrengthChanged( TInt32 aStrength ) = 0;
+    };
+    
+/**
+ *  Clas which starts and stops notification of the gsm signal level 
+ *
+ *  @lib vcchotrigger.lib
+ *  @since S60 3.2
+ */
+class CVccGsmNotifications : public CActive
+    {
+    public:
+        /**
+        * Two-phased constructor.
+        *
+        * @param aPhone RMobilePhone
+        */
+        static CVccGsmNotifications* NewL( RMobilePhone& aPhone );
+        
+        /**
+        * Destructor.
+        */
+        ~CVccGsmNotifications();
+        
+        /**
+         * Activates gsm signal level notification
+         *
+         * @since S60 3.2
+         * @param aObserver observer which will receive notification
+         * @param aLow value for low signal level
+         * @param aHigh value for high signal level
+         *
+         */
+        void ActivateNotifications( MVccGsmNotifications* aObserver, TInt32 aLow, TInt32 aHigh );
+        
+        /**
+         * Cancels gsm signal level notification
+         *
+         * @since S60 3.2
+         */
+        void CancelNotifications();
+    
+    protected:
+        
+        /**
+         * Symbian second-phase constructor
+         */
+        void ConstructL();
+        
+        /**
+         * C++ constructor
+         */
+        CVccGsmNotifications( RMobilePhone& aPhone );
+    
+    private: // From CActive
+        
+        /**
+         * @see CActive::RunL()
+         */
+        void RunL();
+        
+        /**
+         * @see CActive::Cancel()
+         */
+        void DoCancel();
+    
+    private:
+        /**
+        * RMobilePhone handle
+        * Not own
+        */
+        RMobilePhone& iPhone;
+        
+        /**
+         * Observer
+         * Not own
+         */
+        MVccGsmNotifications* iObserver;
+        
+        /**
+        * Gsm signal strength value
+        */
+        TInt32 iStrength;
+
+        /**
+        * Gsm signal bar value
+        */
+        TInt8 iBar;
+        
+        /**
+        * Gsm signal strength value for low signal level
+        */
+        TInt32 iLow;
+
+        /**
+        * Gsm signal strength value for high signal level
+        */
+        TInt32 iHigh;
+    };
+
+#endif // VCCGSMNOTIFICATIONS_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/inc/vccgsmsignallevelhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   ?Description
+*
+*/
+
+
+
+#ifndef C_VCCGSMSIGNALLEVELHANDLER_H
+#define C_VCCGSMSIGNALLEVELHANDLER_H
+
+#include <e32base.h>
+#include <etel.h>
+
+#include "vccsignallevelhandler.h"
+#include "vccsignallevelobserver.h"
+#include "vccgsmnotifications.h"
+#include "vccunittesting.h"
+
+/**
+ *  VCC GSM signal level handler.
+ *
+ *  @code
+ *  void CExampleClass::ConstructL()
+ *      {
+ *      //Scan time for low and high 5 sec, low strength -85, high -70 dBm
+ *      TSignalLevelParams params = { 5e6, 5e6, 85, 70 };
+ *
+ *      //
+ *      iGsmHandler = CVccGsmSignalLevelHandler::NewL( *this, params );
+ *      }
+ *
+ *  void CExampleClass::StartMonitoringL()
+ *      {
+ *      // Start monitoring gsm signal levels.
+ *      iGsmHandler->StartL();
+ *      }
+ *
+ *  void CExampleClass::StopMonitoringL()
+ *      {
+ *      // Stop monitoring.
+ *      iGsmHandler->StopL();
+ *      }
+ *
+ *  // Called when signal level changes.
+ *  void CExampleClass::SignalLevelL(
+ *      const CVccSignalLevelHandler* aHandlerInstance,
+ *      TInt32 aSignalStrength,
+ *      TSignalStrengthClass aClass )
+ *      {
+ *      if ( iGsmHandler == aHandlerInstance )
+ *          {
+ *          // GSM signal changed, do whatever is needed
+ *          MakeHandoverDecision( aSignalStrength, aClass );
+ *          }
+ *      }
+ *
+ *
+ *  @endcode
+ *
+ *  @lib vcchotrigger.dll
+ *  @since S60 v3.2
+ */
+class CVccGsmSignalLevelHandler : public CVccSignalLevelHandler,
+                                  public MVccGsmNotifications
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aObserver Observer of this signal handler
+     * @param aParams Parameters for signal monitoring
+     */
+    static CVccGsmSignalLevelHandler * NewL( MVccSignalLevelObserver & aObserver,
+    const TSignalLevelParams& aParams );
+
+    /**
+     * Two-phased constructor.
+     * @param aObserver Observer of this signal handler
+     * @param aParams Parameters for signal monitoring
+     */
+    static CVccGsmSignalLevelHandler * NewLC(
+        MVccSignalLevelObserver & aObserver,
+        const TSignalLevelParams& aParams );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CVccGsmSignalLevelHandler();
+
+private:
+
+    /**
+     * C++ constructor
+     * @param aObserver Reference to signal level observer
+     * @param aParams Reference to signal level parameters
+     */
+    CVccGsmSignalLevelHandler( MVccSignalLevelObserver & aObserver,
+                               const TSignalLevelParams& aParams );
+
+    /**
+     * Symbian second-phase constructor
+     */
+    void ConstructL();
+
+private:
+
+// from base class CVccSignalLevelHandler
+
+    /**
+    * @see CVccSignalLevelHandler::GetStrength()
+    */
+    void GetStrength();
+
+    /**
+    * @see CVccSignalLevelHandler::EnableNotificationsL()
+    */
+    void EnableNotificationsL();
+
+    /**
+    * @see CVccSignalLevelHandler::DisableNotifications()
+    */
+    void DisableNotifications();
+
+    /**
+    * @see CVccSignalLevelHandler::CancelGetStrength()
+    */
+    void CancelGetStrength();
+
+    /**
+    * @see CVccSignalLevelHandler::NotifyChanges()
+    */
+    void NotifyChanges( TInt32 aSignalStrength,
+                        MVccSignalLevelObserver::TSignalStrengthClass aClass );
+    
+// from base class MVccGsmNotifications
+
+    /**
+    * @see MVccGsmNotifications::GsmStrengthChanged()
+    */
+    void GsmStrengthChanged( TInt32 aStrength );
+
+
+private: // data
+     
+    /**
+     * Etel server
+     * Own.
+     */
+    RTelServer iEtelServer;
+    
+    /**
+     * Phone based functionality
+     * Own.
+     */
+    RMobilePhone iPhone;
+    
+    /**
+     * Gsm signal level notifier 
+     * Own.
+     */
+    CVccGsmNotifications* iGsmNotifications;
+    
+    /** Value of the GSM indication bar */
+    TInt8 iBar;
+    
+    VCC_UNITTEST( UT_CVccGsmSignalLevelHandler )
+    };
+
+#endif  // C_VCCGSMSIGNALLEVELHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/inc/vcchopolicy.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Vcc handover policy definitions
+*
+*/
+
+
+
+#ifndef T_VCCHOPOLICY_H
+#define T_VCCHOPOLICY_H
+
+#include <e32def.h> 
+
+/*
+* VCC Handover policy attr
+* Preferred Domain Attributes 
+*/
+enum TVccHoPolicyPreferredDomain
+    {
+    ECsPreferred = 0,
+    EPsPreferred,
+    ECsOnly,
+    EPsOnly
+    };    
+
+enum TVccHoPolicyHoDirection
+    {
+    ECsToPsAllowed = 0x000001,
+    EPsToCsAllowed = 0x000002
+    };
+    
+/**
+ *  Class indicating the Vcc handover policy
+ *
+ *  @lib vcchotrigger.dll
+ *  @since S60 v3.2
+ */
+class TVccHoPolicy
+    {
+    
+public:    
+    /**
+     * Constructor.
+     *
+     * @since S60 3.2
+     */  
+    TVccHoPolicy();
+    
+     /**
+     * Preferred domain for mobile device.
+     *
+     * @since S60 3.2
+     * @return TVccHoPolicyPreferredMode 
+     */
+    TVccHoPolicyPreferredDomain PreferredDomain() const;
+    
+    /**
+     * Set preferred domain for mobile device.
+     *
+     * @since S60 3.2
+     * @param aPreferredDomain Prefered domain value
+     */
+    void SetPreferredDomain( 
+            const TVccHoPolicyPreferredDomain& aPreferredDomain ); 
+     
+     /**
+     * Allowed direction for handover.
+     *
+     * @since S60 3.2
+     * @return TVccHoPolicyHoDirection 
+     */
+    TInt AllowedDirection() const;
+
+     /**
+     * Set allowed direction for handover on/off.
+     * @since S60 3.2 
+     * @param aAllowedDirection Allowed direction value
+     */
+    void SetAllowedDirection( const TInt aAllowedDirection );
+     
+     /**
+     * Indicates that immediate domain transfer should be
+     * performed when preferred network comes available.
+     *
+     * @since S60 3.2
+     * @return TBool ETrue when Dt should be performed immediately
+     */
+    TBool DoImmediateHo() const;
+     
+    /**
+     * Set immediate domain transfer flag on/off
+     * @since S60 3.2
+     * @param aImmediate Immediate HO value
+     */
+    void SetDoImmediateHo( const TBool& aImmediate );
+    
+     /**
+     * Indicates can the domain transfer be performed
+     * when active/held/waiting calls in trasnferring-out domain.
+     *
+     * @since S60 3.2
+     * @return TBool ETrue when Dt should be performed
+     */
+    TBool DoHoInHeldWaitingCalls() const;
+     
+     /**
+     * Set can domain transfer be performed
+     * when active/held/waiting calls in trasnferring-out domain
+     * on/off.
+     *
+     * @since S60 3.2
+     * @param aHeldWaitingCalls Held waiting calls value
+     */
+    void SetDoHoInHeldWaitingCalls( const TBool& aHeldWaitingCalls );
+    
+    /**
+     * Indicates can HO be performed when cs originated call
+     * 
+     * @since S60 3.2
+     * @return TBool ETrue when HO can be performed
+     */
+    TBool DtAllowedWhenCsOriginated() const;
+    
+    /**
+     * Set is HO allowed when the call is CS originated
+     * 
+     * @since S60 3.2
+     * @param aDtAllowedCsOrig Is Dt allowed value
+     */
+    void SetDtAllowedWhenCsOriginated( 
+                    const TBool& aDtAllowedWhenCsOriginated );
+    
+private:
+    /** Preferred domain */
+    TVccHoPolicyPreferredDomain iPreferredDomain;
+    
+    /** Allowed direction */
+    TInt                        iAllowedDirection;
+    
+    /** Immediate HO value */
+    TBool                       iImmediate;
+    
+    /** Held waiting calls value*/
+    TBool                       iHeldWaitingCalls;
+    
+    /** Dt allowed in cs originated call */
+    TBool                       iDtAllowedWhenCsOriginated;
+    };
+
+#endif //T_VCCHOPOLICY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/inc/vcchopolicyreader.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 to get the settings that define when ho should be 
+*                allowed.
+*
+*/
+
+
+
+#ifndef C_VCCHOPOLICYREADER_H
+#define C_VCCHOPOLICYREADER_H
+
+#include <e32base.h>
+
+#include "vcchopolicy.h"
+#include "vccsignallevelparams.h"
+#include "vccunittesting.h"
+
+class CVccSPSettings;
+
+/**
+ *  Reads settings that define when handover can be performed from cenreps.
+ *
+ *  @lib vcchotrigger.lib
+ *  @since S60 v3.2
+ */
+class CVccHoPolicyReader: public CBase
+    {
+public:
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CVccHoPolicyReader* NewL();    
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CVccHoPolicyReader* NewLC();    
+   
+    /**
+    * Destructor.
+    */
+    virtual ~CVccHoPolicyReader();
+    
+    /**
+    * Handover policy
+    * @since S60 3.2
+    * @return VCC HO policy
+    */
+    TVccHoPolicy HoPolicy() const;
+    
+    /**
+    * Read Ho policy settings from repository
+    * @since S60 3.2
+    */
+    void ReadSettingsL();
+    
+    /**
+     * Get CS signal level parameters
+     * @since S60 3.2
+     * @return CS signal level parameters
+     */
+    TSignalLevelParams CsSignalLevelParams() const;
+
+    /**
+     * Get PS signal level parameters
+     * @since S60 3.2
+     * @return PS signal level parameters
+     */
+    TSignalLevelParams PsSignalLevelParams() const;
+    
+private:
+
+    /**
+     * C++ Constructor
+     */
+    CVccHoPolicyReader();
+
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+
+    /*
+    * Defines policy for preferred domain
+    * @since S60 3.2
+    */
+    void ResolvePreferredDomainL();
+
+    /*
+    * Defines policy for immediate domain transfer 
+    * @since S60 3.2
+    */
+    void ResolveImmediateHoL();
+    
+    /*
+    * Defines policy for allowed handover direction 
+    * @since S60 3.2
+    */
+    void ResolveHoDirectionL();
+    
+    /*
+    * Defines policy is handover allowed when  
+    * mobile device has held or waiting calls
+    * @since S60 3.2
+    */
+    void ResolveHoInHeldWaitingCallsL();
+
+    /*
+    * Defines policy for signal levels
+    * @since S60 3.2
+    */
+    void ResolveSignalLevelParametersL();
+    
+    /*
+     * Defines can HO be made if call is CS originated
+     */
+    void ResolveDtAllowedWhenCsOriginatedL();
+    
+private: //data
+    
+    /**
+    * Reads handover specific settings from sp table
+    * Own. 
+    */
+    CVccSPSettings* iSpSettings;
+   
+    /*
+    * Contains settings that affect when handover 
+    * can be performed.
+    */ 
+    TVccHoPolicy   iPolicy;
+    
+    /** PS signal level parameters */
+    TSignalLevelParams iPsParams;
+    
+    /** CS signal level parameters */
+    TSignalLevelParams iCsParams;
+    
+    VCC_UNITTEST( UT_CVccHoPolicy )
+    };
+
+#endif //  C_VCCHOPOLICYREADER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/inc/vcchotrigger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 the class which handles handover triggering.
+*
+*/
+
+
+
+#ifndef C_VCCHOTRIGGER_H
+#define C_VCCHOTRIGGER_H
+
+
+#include <e32base.h>
+#include <e32std.h>
+#include <wlanmgmtcommon.h>
+
+#include "vccsignallevelobserver.h"
+#include "vcccchobserver.h"
+#include "vcchopolicy.h"
+#include "vccunittesting.h"
+
+class CVccUiPsProperty;
+class CVccWlanSignalLevelHandler;
+class CVccGsmSignalLevelHandler;
+class CVccHoPolicyReader;
+class CVccCchMonitor;
+class CVccEngPsProperty;
+class CVccPerformer;
+
+/**
+ *  This class handles the triggering of the handover from
+ *  one network to another.
+ *
+ *
+ *  @code
+ *   CMyClass::ConstructL()
+ *       {
+ *       iHoTrigger = CVccHoTrigger::NewL();
+ *       }
+ *
+ *   CMyClass::FunctionL()
+ *       {
+ *       iHoTrigger->Start();
+ *       }
+ *
+ *   CMyClass::DomainChanged()
+ *       {
+ *       // Use swapped the domain of an active call
+ *       iHoTrigger->SetCurrentDomain( iActiveCallDomain );
+ *       }
+ *
+ *   CMyClass::CallPutToHold()
+ *       {
+ *       // Stop all network monitoring.
+ *       iHoTrigger->Stop();
+ *       }
+ *
+ *   CMyClass::CallActivated()
+ *       {
+ *       // Start all network monitors
+ *       iHoTrigger->Start();
+ *       }
+ *
+ *   CMyClass::~CMyClass()
+ *       {
+ *       delete iHoTrigger;
+ *       }
+ *
+ *  @endcode
+ *
+ *  @lib vcchotrigger.lib
+ *  @since S60 v3.2
+ */
+class CVccHoTrigger : public CBase,
+                      public MVccSignalLevelObserver,
+                      public MVccCchObserver
+    {
+
+public:
+
+
+    /** Domain types */
+    enum TCallDomainType
+        {
+        /** PS domain */
+        ECallDomainTypePS,
+        /** CS domain */
+        ECallDomainTypeCS
+        };
+
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CVccHoTrigger* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVccHoTrigger();
+
+
+    /**
+     * Stop all network monitors
+     *
+     * @since S60 v3.2
+     */
+    IMPORT_C void Stop();
+    
+    /**
+     * Stop all network monitors
+     *
+     * @since S60 v3.2
+     */
+    IMPORT_C void Stop( CVccPerformer& aStopper );
+
+    /**
+     * Start all network monitors
+     *
+     * @since S60 v3.2
+     */
+    IMPORT_C void Start( CVccPerformer& aWhoStartedMe, TBool aCsOriginated );
+
+    /**
+     * Set the current domain of the active call
+     *
+     * @since S60 v3.2
+     * @param aDomainType is the domain of the current (active) call.
+     */
+    IMPORT_C void SetCurrentDomainType( TCallDomainType aDomainType );
+
+    /**
+     * Set the preferred domain of the active call
+     * 
+     * @since S60 v3.2
+     * @param aDomainType is the call´s preferred domain type.
+     */
+    IMPORT_C void SetPreferredDomainType( TVccHoPolicyPreferredDomain aDomainType );
+
+    
+    /**
+     * Set immediate domain transfer setting
+     * 
+     * @since S60 v3.2
+     * @param aDomainType is the call´s preferred domain type.
+     */
+    IMPORT_C void SetImmediateDomainTransfer( TBool aImmediateDT );
+        
+// from base class MVccSignalLevelObserver
+
+    /**
+     * @see MVccSignalLevelObserver::WlanSignalChanged()
+     */
+    void WlanSignalChanged( TInt32 aSignalStrength,
+            TSignalStrengthClass aClass );
+
+    /**
+     * @see MVccSignalLevelObserver::GsmSignalChanged()
+     */
+    void GsmSignalChanged( TInt32 aSignalStrength,
+            TSignalStrengthClass aClass );
+
+// from base class MVccCchMonitorObserver
+
+    /**
+     * @see MVccCchMonitorObserver::CchServiceStatusChanged
+     */
+    void CchServiceStatusChanged( TServiceStatus aStatus );
+    
+public:
+    /**
+     * When manual handover is started no automatic handovers should
+     * be made.
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C void ManualHoCallStarted();
+
+    /**
+     * After manual handover call has been released, automatic
+     * handovers can be made again.
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C void ManualHoCallReleased();
+
+    /**
+     * During conference call HO is not allowed
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C void HoNotAllowedL();
+    
+    /**
+     * After conference call HO is allowed again
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C void HoAllowed();
+    
+    /**
+     * Reads the settings to get the info if ho is allowed when cs originated call
+     * @since s60 3.2
+     */
+    IMPORT_C void ReadHoAllowedWhenCsOriginatedSettingL();
+    
+private:
+
+    /**
+     * C++ constructor
+     *
+     * @since S60 v3.2
+     */
+    CVccHoTrigger();
+
+    /**
+     * Symbian second-phase constructor
+     *
+     * @since S60 v3.2
+     */
+    void ConstructL();
+    
+    /**
+     * Check if PS or CS are available (to do handover).
+     * 
+     * @since S60 v3.2
+     * @return ETrue if service is available, else return EFalse
+     */
+    TBool ServicesAvailable();
+    
+    /**
+     * Update (write) service status state to P&S.
+     * 
+     * @since S60 v3.2
+     */
+    void UpdatePsKeysL();
+
+    /**
+     * Initiates the actual handover if its ok to start ho.
+     * 
+     * @since S60 v3.2
+     */
+    void TriggerHo();
+    
+    /**
+     * Initiate immediate ho.
+     * 
+     * @since S60 v3.2
+     * @return ETrue if immediate HO was initiated, EFalse otherwise
+     */
+    TBool DoImmediateHo();
+
+private: // data
+
+
+    /**
+     * VCC P&S key manager for UI side
+     * Own.
+     */
+    CVccUiPsProperty* iProperty;
+    
+    /**
+     * PS property writer to write TVccHoStatus values
+     * Own.
+     */
+    CVccEngPsProperty* iEngPsProperty;
+
+    /**
+     * VCC Wlan signal level observer
+     * Own.
+     */
+    CVccWlanSignalLevelHandler* iWlanSignalLevelHandler;
+
+    /**
+     * VCC GSM signal level observer
+     * Own.
+     */
+    CVccGsmSignalLevelHandler* iGsmSignalLevelHandler;
+
+    /**
+     * Call domain type
+     */
+    TCallDomainType iDomainType;
+
+
+    /**
+     * GSM signal class
+     */
+    TSignalStrengthClass iGsmClass;
+
+    /**
+     * Previous GSM signal class
+     */
+    TSignalStrengthClass iPreviousGsmClass;
+    
+    /**
+     * WLAN signal class.
+     */
+    TSignalStrengthClass iWlanClass;
+    
+    /**
+     * Previous WLAN signal class.
+     */
+    TSignalStrengthClass iPreviousWlanClass;
+    
+    /**
+     * CenRep reader for VCC HO policy
+     * Own.
+     */
+    CVccHoPolicyReader* iHoPolicyReader;
+    
+    /** VCC HO policy */
+    TVccHoPolicy iPolicy;
+    
+    /**
+     * CCH monitor.
+     * Own
+     */
+    CVccCchMonitor* iCchMonitor;
+    
+    /**
+     * CCH status (PS service availability)
+     */
+    MVccCchObserver::TServiceStatus iCchServiceStatus;
+    
+    /**
+     * CS status (i.e. signal level)
+     */
+    TInt iCsSignalLevel;
+    
+    /**
+     * Are we stopped or active (i.e. monitoring)
+     */
+    TBool iStarted;
+    
+    /**
+     * Has manual ho been made
+     */
+    TBool iManualHoDone;
+    
+    /**
+     * Ho allowed or not (conference, video, data, multimedia sharing)
+     */
+    TBool iHoNotAllowed;
+    
+    /**
+     * Performer that started trigger
+     * Not own.
+     */
+    CVccPerformer* iWhoStartedMe;
+    
+    /*
+     * Is ho allowed if the originating domain of the 
+     * original call was CS
+     */
+    TBool iHoAllowedIfCsOriginated;
+    
+    friend class T_CVccPerformer;
+    
+    VCC_UNITTEST( UT_CVccHoTrigger )
+    };
+
+#endif //  C_VCCHOTRIGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/inc/vccsignallevelhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,213 @@
+/*
+* 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:   Base class for the signal level handling
+*
+*/
+
+
+
+#ifndef VCCSIGNALLEVELHANDLER_H
+#define VCCSIGNALLEVELHANDLER_H
+
+#include <e32base.h>
+
+#include "vccsignallevelobserver.h"
+#include "vccunittesting.h"
+#include "vccsignallevelparams.h"
+
+/**
+ *  Base class for signal level handling.
+ *  Other classes are derived from this class.
+ *
+ *  @code
+ *
+ *  class CVccXXXSignalLevelHandler : public CVccSignalLevelHandler,
+ *                                    public MXXXOtherClass
+ *
+ *  @endcode
+ *
+ *  @lib vcchotrigger.dll
+ *  @since S60 v3.2
+ */
+class CVccSignalLevelHandler : public CTimer
+    {
+
+protected:
+
+    /** Level of the signal */
+    enum TStrengthState
+        {
+        EStrengthUnknown,
+        EStrengthLow,
+        EStrengthHigh
+        };
+
+    /** Current operation mode */
+    enum TOperation
+        {
+        EOperationNone,
+        EOperationGet,
+        EOperationWait,
+        EOperationComplete
+        };
+
+public:
+
+    /**
+    * Destructor.
+    */
+    virtual ~CVccSignalLevelHandler();
+
+    /**
+     * Start signal level observing
+     *
+     * @since S60 3.2
+     */
+    void StartL();
+
+    /**
+     * Stop signal level observing
+     *
+     * @since S60 3.2
+     */
+    void Stop();
+
+    /**
+     * Set the notification parameters
+     *
+     * @since S60 3.2
+     * @param aParams Notification parameters
+     */
+    virtual void SetParams( const TSignalLevelParams& aParams );
+
+protected:
+
+    /**
+     * C++ constructor
+     *
+     * @since S60 3.2
+     * @param aObserver Observer to be notified when signal level changes
+     * @param aParams Parameters at which level notifications should be given
+     * as well the timeout how long the signal must at the specified level or
+     * above before notification is given.
+     */
+    CVccSignalLevelHandler(
+            MVccSignalLevelObserver& aObserver,
+            const TSignalLevelParams& aParams );
+
+    /**
+     * Get the current Received Signal Strength Indicator (RSSI)
+     *
+     * @since S60 3.2
+     */
+    virtual void GetStrength() = 0;
+
+    /**
+     * Activate the notification service
+     *
+     * @since S60 3.2
+     */
+    virtual void EnableNotificationsL() = 0;
+
+    /**
+     * Cancel the notification service
+     *
+     * @since S60 3.2
+     */
+    virtual void DisableNotifications() = 0;
+
+    /**
+     * Cancel outstanding signal strentgh request.
+     *
+     * @since S60 3.2
+     */
+    virtual void CancelGetStrength() = 0;
+
+    /**
+     * Notifies the observer about signal level changes.
+     *
+     * @since S60 3.2
+     * @param aRss RSS level in absolute dBm values
+     * @param aRssClass specifies the current class of the received signal
+     */
+    virtual void NotifyChanges( TInt32 aSignalStrength,
+         MVccSignalLevelObserver::TSignalStrengthClass aClass ) = 0;
+
+    /**
+     * Handles singal strength changes which are notified by the signal level observer
+     *
+     * @since S60 3.2
+     */
+    void StrengthChanged();
+
+// from base class CTimer
+
+    /**
+     * @see CTimer::ConstructL()
+     */
+    void ConstructL();
+
+    /**
+     * From CTimer::DoCancel()
+     */
+    void DoCancel();
+
+
+private:
+
+// from base class CActive
+
+    /**
+     * From CActive::RunL()
+     */
+    void RunL();
+
+
+protected: // data
+
+    /**
+     * Observer
+     * Not own
+     */
+    MVccSignalLevelObserver& iObserver;
+
+    /**
+     * Parameters defining timers and signal levels
+     */
+    TSignalLevelParams iParams;
+
+    /**
+     * Current signal level in dBm
+     */
+    TInt32 iStrength;
+
+    /**
+     * Flag to determine if the observing/notifications are on or off
+     */
+    TBool iNotificationsOn;
+
+    /* Current operation
+    */
+   TOperation iOperation;
+
+     /* Current signal state
+     */
+    TStrengthState iState;
+ 
+
+    VCC_UNITTEST( UT_CVccWlanSignalLevelHandler )
+    VCC_UNITTEST( UT_CVccGsmSignalLevelHandler )
+    };
+
+#endif // VCCSIGNALLEVELHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/inc/vccsignallevelobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* 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:   Definition of a signal level observer API
+*
+*/
+
+
+
+#ifndef VCCSIGNALLEVELOBSERVER_H
+#define VCCSIGNALLEVELOBSERVER_H
+
+#include <e32base.h>
+#include <wlanmgmtcommon.h>
+
+class CVccSignalLevelHandler;
+
+/**
+ *  Defines the API for the signal level observer
+ *
+ *
+ *  @code
+ *   ?good_class_usage_example(s)
+ *  @endcode
+ *
+ *  @lib vcchotrigger.dll
+ *  @since S60 v3.2
+ */
+class MVccSignalLevelObserver
+    {
+public:
+
+    /** Signal RSS class */
+    enum TSignalStrengthClass
+        {
+        /** Received signal level is 'normal'. */
+        ESignalClassNormal,
+        /** Received signal level is 'weak'. */
+        ESignalClassWeak,
+        /** Signal strength is not known yet, no handover. */
+        ESignalClassUndefined
+        };
+
+    /**
+     * WLAN signal level has been changed.
+     *
+     * @since S60 3.2
+     * @param aRSS level in absolute dBm values.
+     * @param aRssClass specifies the current class of the received signal.
+     * @return ?description
+     */
+    virtual void WlanSignalChanged(
+            TInt32 aSignalStrength,
+            TSignalStrengthClass aClass ) =  0;
+
+    /**
+     * GSM signal level has been changed.
+     *
+     * @since S60 3.2
+     * @param aRSS level in absolute dBm values.
+     * @param aRssClass specifies the current class of the received signal.
+     */
+    virtual void GsmSignalChanged(
+            TInt32 aSignalStrength,
+            TSignalStrengthClass aClass ) =  0;
+
+    };
+
+#endif // VCCSIGNALLEVELOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/inc/vccsignallevelparams.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   Definition of signal level parameters
+*
+*/
+
+
+
+#ifndef VCCSIGNALLEVELPARAMS_
+#define VCCSIGNALLEVELPARAMS_
+
+/**  Signal level parameters, timeouts and signal strength levels */
+struct TSignalLevelParams
+    {
+    TTimeIntervalMicroSeconds32 iLowTimeout;
+    TTimeIntervalMicroSeconds32 iHighTimeout;
+    TInt32 iLowLevel;
+    TInt32 iHighLevel;
+    };
+
+#endif /*VCCSIGNALLEVELPARAMS_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/inc/vccwlansignallevelhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,215 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 the WLAN signal level handler
+*
+*/
+
+
+
+#ifndef VCCWLANSIGNALLEVELHANDLER_H
+#define VCCWLANSIGNALLEVELHANDLER_H
+
+#include <e32base.h>
+#include <wlanmgmtcommon.h>
+
+#include "vccsignallevelhandler.h"
+#include "vccsignallevelobserver.h"
+
+class CWlanMgmtClient;
+class CVccEngPsProperty;
+
+/**
+ *  WLAN signal level observer
+ *
+ *
+ *  @code
+ *
+ *  TSignalLevelParams params = { 8e6, 8e6, 80, 40 };
+ *
+ *  CMyClass::ConstructL()
+ *      {
+ *      iSignalLevelHandler = CVccWlanSignalLevelHandler::NewL( *this, params );
+ *      iSignalLevelHandler->StartL();
+ *      }
+ *
+ *  CMyClass::StopMonitoring()
+ *      {
+ *      iSignalLevelHandler->Stop();
+ *      }
+ *
+ *  CMyClass::SetNewParametersAndStartL()
+ *      {
+ *      TSignalLevelParams params = { 8e6, 10e6, 80, 20 };
+ *
+ *      iSignalLevelHandler->SetParams( params );
+ *
+ *      // Start using new parameters
+ *      iSignalLevelHandler->StartL();
+ *      }
+ *
+ *  CMyClass::~CMyClass()
+ *      {
+ *      delete iSignalLevelHandler;
+ *      }
+ *
+ *
+ *  CMyClass::WlanSignalChanged(
+ *      TInt32 aRss,
+ *      TSignalRssClass aRssClass )
+ *      {
+ *      // Signal level changed. Must do something
+ *      if ( aRssClass == ESignalClassWeak )
+ *          {
+ *          // Do handover if the signal is very weak
+ *          if ( aRss > EReallyBadSignalLevel )
+ *              {
+ *              }
+ *          }
+ *      }
+ *
+ *
+ *
+ *  @endcode
+ *
+ *  @lib vcchotrigger.dll
+ *  @since S60 v3.2
+ */
+class CVccWlanSignalLevelHandler : public CVccSignalLevelHandler,
+                                   public MWlanMgmtNotifications
+    {
+public:
+
+
+    /**
+     * Two-phased constructor.
+     * @param aObserver Observer which will be notified upon signal changes.
+     * @param aParams Parameters for the timer and signal levels.
+     */
+    static CVccWlanSignalLevelHandler * NewL(
+            MVccSignalLevelObserver& aObserver,
+            const TSignalLevelParams& aParams, CVccEngPsProperty& aPsProperty );
+    /**
+     * Two-phased constructor.
+     * @param aObserver Observer which will be notified upon signal changes.
+     * @param aParams Parameters for the timer and signal levels.
+     */
+    static CVccWlanSignalLevelHandler* NewLC(
+            MVccSignalLevelObserver& aObserver,
+            const TSignalLevelParams& aParams, CVccEngPsProperty& aPsProperty );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CVccWlanSignalLevelHandler();
+    
+    /**
+    *  for telling WLAN Signal Level Handler that manual HO is done or not done
+    */
+    void SetManualHoDone( TBool aValue );
+
+private:
+
+    /**
+     * Symbian second-phase constructor
+     *
+     * @since S60 3.2
+     */
+    void ConstructL();
+
+    /**
+     * C++ constructor
+     *
+     * @since S60 3.2
+     * @param aObserver Observer which will be notified upon signal changes.
+     * @param aParams Parameters for the timer and signal levels.
+     */
+    CVccWlanSignalLevelHandler( MVccSignalLevelObserver& aObserver,
+                               const TSignalLevelParams& aParams, CVccEngPsProperty& aPsProperty);
+
+// from base class CVccSignalLevelHandler
+
+    /**
+     * @see CVccSignalLevelHandler::GetStrength()
+     */
+    void GetStrength();
+
+    /**
+     * @see CVccSignalLevelHandler::EnableNotificationsL()
+     */
+    void EnableNotificationsL();
+
+    /**
+     * @see CVccSignalLevelHandler::DisableNotifications()
+     */
+    void DisableNotifications();
+
+    /**
+     * @see CVccSignalLevelHandler::CancelGetStrength()
+     */
+    void CancelGetStrength();
+
+    /**
+     * @see CVccSignalLevelHandler::NotifyChanges()
+     */
+    void NotifyChanges( TInt32 aSignalStrength,
+                 MVccSignalLevelObserver::TSignalStrengthClass aClass );
+
+
+// from base class MWlanMgmtNotifications
+
+    /**
+     * @see MWlanMgmtNotifications::RssChanged()
+     */
+    void RssChanged( TWlanRssClass aRssClass, TUint aRss );
+
+    /**
+     * @see MWlanMgmtNotifications::BssidChanged()
+     */
+    void BssidChanged( TWlanBssid& aNewBSSID );
+
+    /**
+     * @see MWlanMgmtNotifications::OldNetworksLost()
+     */
+    void OldNetworksLost();
+    
+    /**
+     * Overriding this because WLAN signal level handler needs to observe the signal level
+     * more frequently than GSM Signal Level Handler
+     */
+    void RunL();
+    
+    //overriding this because specific actions needed for cancellation for WLAN
+    void DoCancel(); 
+    
+private: // data
+
+    /**
+     * WLAN management client.
+     * Own.
+     */
+    CWlanMgmtClient* iWlanMgmt;
+    
+    /**
+     * for informing the states
+     */
+    CVccEngPsProperty& iVccPsp;
+    
+    /**
+     * indicates is manual HO done or not
+     */
+    TBool iManualHoDone;
+    };
+
+#endif // VCCWLANSIGNALLEVELHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/src/rubydebug.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,165 @@
+/*
+* 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:   Debugging utilities implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "rubydebug.h"
+
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#include <f32file.h>
+#endif
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#ifdef _DEBUG // UDEB version:
+_LIT( KSpace, " " );
+_LIT( KColon, ":" );
+_LIT( KFormat, "%02d" );
+_LIT( KFormat2, "%06d" );
+#endif
+#endif
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::PrintToFile
+// Method for writing traces to a file.
+// -----------------------------------------------------------------------------
+//
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+
+#ifdef _DEBUG // UDEB version:
+void RRubyDebug::PrintToFile( TRefByValue<const TDesC> aFmt, ... )
+    {
+    _LIT( KRubyLogFileName, "c:\\Data\\Logs\\vcchotrigger.txt" );
+
+    const TInt KRubyDebugMaxLineLength = 0x84; // rest will be truncated
+
+    const TInt KRubyDebugOpenFileRetries = 100;
+    const TInt KRubyDebugOpenFileInterval = 1000;
+
+    const TUint16 KRubyDebugLineSep1 = 0x0d;
+    const TUint16 KRubyDebugLineSep2 = 0x0a;
+
+    // Handle variable argument list
+    VA_LIST list;
+	VA_START( list, aFmt );
+	TBuf<KRubyDebugMaxLineLength+2> aBuf;
+    TTruncateOverflow overflow;
+    
+    // Append the time...
+    TTime currentTime;
+    currentTime.HomeTime();
+    TDateTime dateTime = currentTime.DateTime();
+
+    aBuf.AppendFormat( KFormat, dateTime.Hour() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat, dateTime.Minute() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat, dateTime.Second() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat2, dateTime.MicroSecond() );
+    aBuf.Append( KSpace );
+    // time done
+    
+	aBuf.AppendFormatList( aFmt, list, &overflow );
+	if( aBuf.Length() > ( KRubyDebugMaxLineLength - 2 ) )
+		{
+		aBuf.Delete(aBuf.Length() - 2, 2);
+		}
+	
+    // Add linefeed characters
+    aBuf.Append( KRubyDebugLineSep1 );
+    aBuf.Append( KRubyDebugLineSep2 );
+
+    RFs fs;
+    if ( fs.Connect() == KErrNone )
+        {
+        RFile file;
+
+        // Open file in an exclusive mode so that only one thread 
+        // can acess it simultaneously
+        TUint fileMode = EFileWrite | EFileShareExclusive;
+
+        TInt err = file.Open( fs, KRubyLogFileName, fileMode );
+
+        // Create a file if it doesn't exist
+        if ( err == KErrNotFound )
+            {
+            err = file.Create( fs, KRubyLogFileName, fileMode );
+            }
+        else
+            {
+            // Error in opening the file
+            TInt retryCount = KRubyDebugOpenFileRetries;
+            while ( err == KErrInUse && retryCount-- )
+                {
+                // Some other tread is accessing the file, wait a while...
+                User::After( KRubyDebugOpenFileInterval );
+                err = file.Open( fs, KRubyLogFileName, fileMode );
+                }
+            }
+
+        // Check if we have access to a file
+        if ( err == KErrNone )
+            {
+            TInt offset = 0;
+            if ( file.Seek( ESeekEnd, offset ) == KErrNone )
+                {
+                // Append text to the end of file
+                TPtr8 ptr8( (TUint8*)aBuf.Ptr(), aBuf.Size(), aBuf.Size() );
+                file.Write( ptr8 );
+                }
+            file.Close();
+            }
+
+        fs.Close();
+        }
+    }
+
+#else // UREL version:
+void RRubyDebug::PrintToFile( TRefByValue<const TDesC> /*aFmt*/, ... )
+    {
+    }
+#endif
+
+#endif // __RUBY_DEBUG_TRACES_TO_FILE
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/src/vcccchmonitor.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,433 @@
+/*
+* 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:   Implementation of the CCH monitor.
+*
+*/
+
+
+
+#include <cch.h>
+#include "vcccchmonitor.h"
+#include "vccsettingsreader.h"
+#include "rubydebug.h"
+
+// ---------------------------------------------------------------------------
+// Symbian OS static constructor
+// ---------------------------------------------------------------------------
+//
+CVccCchMonitor* CVccCchMonitor::NewL( MVccCchObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccCchMonitor::NewL" );
+
+    CVccCchMonitor* self = new ( ELeave ) CVccCchMonitor( aObserver );
+
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ destructor
+// ---------------------------------------------------------------------------
+//
+CVccCchMonitor::~CVccCchMonitor()
+    {
+    RUBY_DEBUG0( "CVccCchMonitor::~CVccCchMonitor START" );
+
+    // If we have reserved the used service, free it before disabling.
+    // Do not mind the return values, just keep going.
+
+    if ( iCchService )
+        {
+        if ( iServiceReserved )
+            {
+            RUBY_DEBUG0( " -Free and disable service" );
+
+            (void) iCchService->Free( ECCHVoIPSub );
+            (void) iCchService->Disable( ECCHVoIPSub );
+
+            // We did disabled here.
+            iDisableService = EFalse;
+            }
+
+        // If we enabled the service, we must disable it also
+        // ( even if it was not reserved for us).
+        // Do not mind the return value, just keep going.
+
+        if ( iDisableService )
+            {
+            RUBY_DEBUG0( " -Disable service" );
+            (void) iCchService->Disable( ECCHVoIPSub );
+            }
+
+        // Remove observer
+        iCchService->RemoveObserver();
+
+        // We DO NOT OWN the service, DO NOT DELETE IT
+        iCchService = NULL;
+        }
+
+    // Free the CCH itself
+    delete iCch;
+    RUBY_DEBUG0( "CVccCchMonitor::~CVccCchMonitor STOP" );
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian OS 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CVccCchMonitor::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccCchMonitor::ConstructL" );
+
+    // First we create the CCH object and get the VoIP id
+    // which is VCC enabled.
+    //
+    // If we don't get the VoIP id we leave since
+    // without the VoIP id we cannot get the right VoIP service.
+    //
+    // If everything goes well, we try to enable the service.
+    // All errors etc. are received thru the CCH observer interface.
+    //
+
+    // Initialize some own flags.
+
+    // Do not notify our observer (yet).
+    iNotifyObserver = EFalse;
+
+    // Do not disable service when we exit.
+    iDisableService = EFalse;
+
+    // Intitial CCH state.
+    iCurrentCchState = ECCHUninitialized;
+
+    // No errors so far.
+    iLastCchError = KErrNone;
+
+    // And service is not available (yet).
+    iCurrentStatus = MVccCchObserver::EServiceUnavailable;
+
+
+    // Create CCH
+    iCch = CCch::NewL();
+
+    // We do not have the service yet.
+    iCchService = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CVccCchMonitor::CVccCchMonitor( MVccCchObserver& aObserver )
+    : iObserver( aObserver )
+    {
+    RUBY_DEBUG_BLOCK( "CVccCchMonitor::CVccCchMonitor" );
+    }
+
+// ---------------------------------------------------------------------------
+// Enable the VoIP service and start monitoring the state of the CCH.
+// ---------------------------------------------------------------------------
+//
+void CVccCchMonitor::EnableServiceL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccCchMonitor::EnableServiceL" );
+
+    // CCH must be created.
+    __ASSERT_DEBUG( iCch, User::Leave( KErrArgument ) );
+
+    // Get the Voip service id. Get it always to if the SP
+    // settings are chagned, we get updated values.
+
+    iServiceId = VccSettingsReader::VoIPServiceIdL();
+
+    if ( iServiceId == KErrNotFound )
+        {
+        RUBY_DEBUG1( " -VoIP service id (%d) not found - LEAVE", iServiceId );
+        User::Leave( KErrNotFound );
+        }
+
+    // Get the service if not already available
+
+    if ( !iCchService )
+        {
+
+        // Get the service. The ownership is not transfered
+        iCchService = iCch->GetService( iServiceId );
+
+        RUBY_DEBUG1( " -CCH service fetched, addr = %x (LEAVE if NULL)",
+                iCchService );
+
+        // CCH cannot find the service if it returns NULL
+        if ( !iCchService )
+            {
+            User::Leave( KErrNotFound );
+            }
+
+        // We got the service.
+        // Set us as observer to get notifications.
+
+        iCchService->SetObserver( *this );
+        }
+
+
+    // Start sending notifications to our observer.
+    iNotifyObserver = ETrue;
+
+    // And then enable the VoIP service.
+    DoEnableServiceL();
+    }
+
+// ---------------------------------------------------------------------------
+// Disable the service, this means that
+// we stop sending notifications to our observer.
+// The service is not disabled, we just do not notify our obsserver.
+// The service is disabled when we exit.
+// ---------------------------------------------------------------------------
+//
+void CVccCchMonitor::DisableService()
+    {
+    RUBY_DEBUG_BLOCK( "CVccCchMonitor::DisableService" );
+
+    // We do not disable the service.
+    // It can be done here but if we start and stop it
+    // many times within a short period of time,
+    // it does not make sense.
+    //
+    // Service is released (and disabled if needed)
+    // when we exit (see destructor).
+    // So here just flag to stop sending notifications to
+    // our observer.
+    iCchService = NULL;
+    iNotifyObserver = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// From MCchServiceStatusObserver
+// Handles CCH service or error status changes.
+// ---------------------------------------------------------------------------
+//
+void CVccCchMonitor::ServiceStatusChanged(
+        TInt aServiceId,
+        TCCHSubserviceType aType,
+        const TCchServiceStatus& aServiceStatus )
+    {
+    RUBY_DEBUG_BLOCK( "CVccCchMonitor::ServiceStatusChanged" );
+
+    // The CCH sends notifications to all
+    // so service id and the type must be checked.
+
+    if ( !( aServiceId == iServiceId && aType == ECCHVoIPSub ) )
+        {
+        return;
+        }
+
+    // Get the state and the error.
+    iCurrentCchState = aServiceStatus.State();
+    iLastCchError = aServiceStatus.Error();
+
+    RUBY_DEBUG2( " -State = %d, error = %d", iCurrentCchState, iLastCchError );
+
+
+    // If we are observing, notify our observer.
+    if ( iNotifyObserver == EFalse )
+        {
+        return;
+        }
+    else
+        {
+        NotifyObserver();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Send notifications to our observer.
+// ---------------------------------------------------------------------------
+//
+void CVccCchMonitor::NotifyObserver()
+    {
+    RUBY_DEBUG_BLOCK( "CVccCchMonitor::NotifyObserver" );
+
+
+    // This method should be called only when
+    // the state of the cch service is updated
+    // to iCurrentCchState member variable.
+
+    // If CCH state != enabled or there is an error, service is not working
+    //
+    // Note that the service stays enabled until someone disables it.
+
+    if ( ( iCurrentCchState != ECCHEnabled ) ||
+        ( iLastCchError != KErrNone ) )
+        {
+        RUBY_DEBUG0( " -Service unavailable" );
+        iCurrentStatus = MVccCchObserver::EServiceUnavailable;
+        }
+    else
+        {
+        RUBY_DEBUG0( " -Service available" );
+        iCurrentStatus = MVccCchObserver::EServiceAvailable;
+        }
+
+    iObserver.CchServiceStatusChanged( iCurrentStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// Enable the CCH service we are using (ECCHVoIPSub).
+// ---------------------------------------------------------------------------
+//
+void CVccCchMonitor::DoEnableServiceL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccCchMonitor::DoEnableServiceL" );
+
+    // Enable the service
+    //
+    // Depending of the current state of the CCH service:
+    //
+    // Do nothing if
+    // - ECCHConnecting
+    //
+    //
+    // Try to enable if
+    // - ECCHDisconnecting
+    // - ECCHDisabled
+    // - ECCHUninitialized
+    //
+    // Notify our observer if
+    // - ECCHEnabled
+
+
+    // Check the state of the service.
+    // The state is got from the status object of the service.
+
+
+    TCchServiceStatus serviceStatus;
+    TInt errorValue( KErrNone );
+
+    // Get the status.
+    errorValue = iCchService->GetStatus( ECCHVoIPSub, serviceStatus );
+
+    RUBY_DEBUG2( " -GetStatus returned = %d, service status = %d",
+            errorValue, serviceStatus.State() );
+
+
+    // If we can't get the status, leave
+
+    if ( errorValue != KErrNone )
+        {
+        RUBY_DEBUG0( " -GetStatus returned error, can't enable - LEAVE" );
+
+        User::Leave( errorValue );
+        }
+
+
+    // Okay, get the state and error (from status).
+    iCurrentCchState = serviceStatus.State();
+    iLastCchError = serviceStatus.Error();
+
+    RUBY_DEBUG1( " -Service state = %d", iCurrentCchState );
+
+
+    switch( iCurrentCchState )
+        {
+        case ECCHUninitialized:
+        // Fall-through intended here
+        case ECCHDisabled:
+        // Fall-through intended here
+        case ECCHDisconnecting:
+            {
+            RUBY_DEBUG0( " -Try to enable service, LEAVE if error" );
+
+            // Enable, leave if errors,
+            User::LeaveIfError( iCchService->Enable( ECCHVoIPSub ) );
+
+            // Service should be enabled in a while,
+            // we must disable it upon exiting since it was not enabled
+            // (we are one who enabled it so must disable it).
+
+            iDisableService = ETrue;
+            break;
+            }
+
+        case ECCHConnecting:
+            {
+            // Service is connecting (by someone else
+            // or we have been called more than twice).
+            // We should get the notification when it is enabled
+            // and ready for the use.
+            // Do nothing.
+            break;
+            }
+
+        case ECCHEnabled:
+            {
+            RUBY_DEBUG0( " -Service is already enabled - do nothing" );
+
+            // Enabled already. We can notify our observer
+            // with the status of the service.
+
+            NotifyObserver();
+            break;
+            }
+
+        default:
+            {
+            break;
+            }
+
+        } // End of switch
+
+
+    // So good so far...
+    // Check if we can reserve (if not done already)
+    // the service for us.
+    // This prevents someone to disable it during a call
+
+    if ( !iServiceReserved )
+        {
+        TBool isReserved( EFalse );
+
+        iCchService->IsReserved( ECCHVoIPSub, isReserved );
+
+        if ( !isReserved )
+            {
+            RUBY_DEBUG0( " -Try to reserve the service for us" );
+
+            // It is free. Try to reserve it.
+
+            if ( iCchService->Reserve( ECCHVoIPSub ) == KErrNone )
+                {
+                RUBY_DEBUG0( " -Service reserved for us" );
+                iServiceReserved = ETrue;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Return the current status of the service availability
+// ---------------------------------------------------------------------------
+//
+MVccCchObserver::TServiceStatus CVccCchMonitor::ServiceStatus() const
+    {
+    RUBY_DEBUG_BLOCK( "CVccCchMonitor::ServiceStatus" );
+
+    RUBY_DEBUG1( " -Status = %d", iCurrentStatus );
+
+    return iCurrentStatus;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/src/vccgsmnotifications.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <mmtsy_names.h>
+
+#include "vccgsmnotifications.h"
+#include "rubydebug.h"
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CVccGsmNotifications::CVccGsmNotifications( RMobilePhone& aPhone )
+    : CActive( EPriorityStandard ),
+      iPhone( aPhone )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian constructor.
+// ---------------------------------------------------------------------------
+//
+void CVccGsmNotifications::ConstructL()
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// Symbian constructor.
+// ---------------------------------------------------------------------------
+//    
+CVccGsmNotifications* CVccGsmNotifications::NewL( RMobilePhone& aPhone )
+    {
+    CVccGsmNotifications* self = new(ELeave) CVccGsmNotifications( aPhone );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ destructor.
+// ---------------------------------------------------------------------------
+//
+CVccGsmNotifications::~CVccGsmNotifications()
+    {
+    iObserver = 0;
+    Cancel();
+    }
+    
+// ---------------------------------------------------------------------------
+// Activates notifications
+// ---------------------------------------------------------------------------
+//
+void CVccGsmNotifications::ActivateNotifications( MVccGsmNotifications* aObserver,
+                                                  TInt32 aLow, TInt32 aHigh )
+    {
+    RUBY_DEBUG_BLOCK( "CVccGsmNotifications::ActivateNotifications" );
+    RUBY_DEBUG2( " -aLow = %d aHigh = %d", aLow, aHigh );
+
+    iLow = aLow;
+    iHigh = aHigh;
+    iObserver = aObserver;
+    Cancel();
+    iPhone.NotifySignalStrengthChange( iStatus, iStrength, iBar );
+    RUBY_DEBUG0( " -call SetActive()" );
+    SetActive();
+    }
+    
+// ---------------------------------------------------------------------------
+// Cancels notifications
+// ---------------------------------------------------------------------------
+//
+void CVccGsmNotifications::CancelNotifications()
+    {
+    RUBY_DEBUG_BLOCK( "CVccGsmNotifications::CancelNotifications" );
+    iObserver = NULL;
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CVccGsmNotifications::RunL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccGsmNotifications::RunL" );
+    RUBY_DEBUG2( " -iObserver=%x iStrength=%d", iObserver, iStrength );
+    RUBY_DEBUG2( " -iLow = %d iHigh = %d", iLow, iHigh );
+
+    iObserver->GsmStrengthChanged( iStrength );
+    iPhone.NotifySignalStrengthChange( iStatus, iStrength, iBar );
+    SetActive();
+    }
+    
+// ---------------------------------------------------------------------------
+// Cancel
+// ---------------------------------------------------------------------------
+//
+void CVccGsmNotifications::DoCancel()
+    {
+    RUBY_DEBUG_BLOCK( "CVccGsmNotifications::DoCancel" );
+    iPhone.CancelAsyncRequest( EMobilePhoneNotifySignalStrengthChange );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/src/vccgsmsignallevelhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <mmtsy_names.h>
+
+#include "vccgsmsignallevelhandler.h"
+#include "rubydebug.h"
+
+static const TInt32 KStrengthMin = 110;
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CVccGsmSignalLevelHandler::CVccGsmSignalLevelHandler( 
+                                             MVccSignalLevelObserver& aObserver, 
+                                             const TSignalLevelParams& aParams )
+    : CVccSignalLevelHandler( aObserver, aParams )
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// Symbian constructor.
+// ---------------------------------------------------------------------------
+//
+void CVccGsmSignalLevelHandler::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccGsmSignalLevelHandler::ConstructL" );
+
+    CVccSignalLevelHandler::ConstructL();
+    User::LeaveIfError( iEtelServer.Connect() );
+    User::LeaveIfError( iEtelServer.LoadPhoneModule( KMmTsyModuleName ) );
+    User::LeaveIfError( iPhone.Open( iEtelServer, KMmTsyPhoneName ) );
+    iGsmNotifications = CVccGsmNotifications::NewL( iPhone );
+    }   
+    
+// ---------------------------------------------------------------------------
+// Symbian constructor.
+// ---------------------------------------------------------------------------
+// 
+CVccGsmSignalLevelHandler * CVccGsmSignalLevelHandler::NewL( 
+                                            MVccSignalLevelObserver& aObserver, 
+                                            const TSignalLevelParams& aParams )
+    {
+    CVccGsmSignalLevelHandler * self = 
+                         CVccGsmSignalLevelHandler::NewLC( aObserver, aParams );
+    CleanupStack::Pop(self);
+    return self;
+    }    
+
+// ---------------------------------------------------------------------------
+// Symbian constructor.
+// ---------------------------------------------------------------------------
+// 
+CVccGsmSignalLevelHandler * CVccGsmSignalLevelHandler::NewLC( 
+                                            MVccSignalLevelObserver& aObserver, 
+                                            const TSignalLevelParams& aParams )
+    {
+    CVccGsmSignalLevelHandler * self = 
+                    new(ELeave) CVccGsmSignalLevelHandler( aObserver, aParams );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ destructor.
+// ---------------------------------------------------------------------------
+//    
+CVccGsmSignalLevelHandler::~CVccGsmSignalLevelHandler()
+    {
+    Cancel(); // Cancel any request, if outstanding
+    delete iGsmNotifications;
+    iPhone.Close();
+    iEtelServer.Close();
+    }
+    
+// ---------------------------------------------------------------------------
+// Enables signal level change notifications.
+// ---------------------------------------------------------------------------
+// 
+void CVccGsmSignalLevelHandler::EnableNotificationsL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccGsmSignalLevelHandler::EnableNotificationsL" );
+
+    iGsmNotifications->ActivateNotifications( this,
+                                  iParams.iLowLevel, iParams.iHighLevel );
+    }
+    
+// ---------------------------------------------------------------------------
+// Disables signal level change notifications.
+// ---------------------------------------------------------------------------
+// 
+void CVccGsmSignalLevelHandler::DisableNotifications()
+    {
+    iGsmNotifications->CancelNotifications();
+    }
+    
+// ---------------------------------------------------------------------------
+// Issues signal strength request to RMobilePhone.
+// ---------------------------------------------------------------------------
+// 
+void CVccGsmSignalLevelHandler::GetStrength()
+    {
+    RUBY_DEBUG_BLOCK( "CVccGsmSignalLevelHandler::GetStrength" );
+
+    iPhone.GetSignalStrength( iStatus, iStrength, iBar );
+    RUBY_DEBUG3( " -iStatus = %d, iStrength = %d, iBar = %d",
+                            iStatus.Int(), iStrength, iBar );
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels signal strength request
+// ---------------------------------------------------------------------------
+// 
+void CVccGsmSignalLevelHandler::CancelGetStrength()
+    {
+    RUBY_DEBUG_BLOCK( "CVccGsmSignalLevelHandler::CancelGetStrength" );
+   
+    // EMobilePhoneNotifyModeChange
+    iPhone.CancelAsyncRequest( EMobilePhoneGetSignalStrength ); 
+    }
+    
+// ---------------------------------------------------------------------------
+// Notification that signal strength has changed is received.
+// ---------------------------------------------------------------------------
+//
+void CVccGsmSignalLevelHandler::GsmStrengthChanged( TInt32 aStrength )
+    {
+    RUBY_DEBUG_BLOCK( "CVccGsmSignalLevelHandler::GsmStrengthChanged" );
+    RUBY_DEBUG1( " -aStrength = %d", aStrength );
+
+    iStrength = aStrength  ? aStrength : KStrengthMin;
+    StrengthChanged();
+    }
+
+// ---------------------------------------------------------------------------
+// Notififies observer about signal level change.
+// ---------------------------------------------------------------------------
+//
+void CVccGsmSignalLevelHandler::NotifyChanges(
+    TInt32 aSignalStrength,
+    MVccSignalLevelObserver::TSignalStrengthClass aClass )
+    {
+    RUBY_DEBUG_BLOCK( "CVccGsmSignalLevelHandler::NotifyChanges" );
+    iObserver.GsmSignalChanged( aSignalStrength, aClass );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/src/vcchopolicy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <e32const.h>
+
+#include "vcchopolicy.h"
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+TVccHoPolicy::TVccHoPolicy()
+    : iPreferredDomain( ECsPreferred ), iAllowedDirection( 0 ),
+      iImmediate( EFalse ), iHeldWaitingCalls( ETrue )
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------
+// Returns preferred mode
+// ---------------------------------------------------------------------------
+//
+TVccHoPolicyPreferredDomain TVccHoPolicy::PreferredDomain() const
+    {
+    return iPreferredDomain;   
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets preferred mode
+// ---------------------------------------------------------------------------
+//
+void TVccHoPolicy::SetPreferredDomain( 
+    const TVccHoPolicyPreferredDomain& aPreferredDomain ) 
+    {
+    iPreferredDomain = aPreferredDomain;   
+    }
+
+// ---------------------------------------------------------------------------
+// Returns allowed direction
+// ---------------------------------------------------------------------------
+//    
+TInt TVccHoPolicy::AllowedDirection() const
+    {
+    return iAllowedDirection;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets allowed direction
+// ---------------------------------------------------------------------------
+//    
+void TVccHoPolicy::SetAllowedDirection( const TInt aAllowedDirection )
+    {
+    iAllowedDirection = aAllowedDirection;
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns preferred mode
+// ---------------------------------------------------------------------------
+//        
+TBool TVccHoPolicy::DoImmediateHo() const
+    {
+    return iImmediate;    
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets preferred mode
+// ---------------------------------------------------------------------------
+//   
+void TVccHoPolicy::SetDoImmediateHo( const TBool& aImmediate )
+    {
+    iImmediate = aImmediate;
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns domain transfer while held waiting calls active in transferring-out
+// domain.
+// ---------------------------------------------------------------------------
+//       
+TBool TVccHoPolicy::DoHoInHeldWaitingCalls() const
+    {
+    return iHeldWaitingCalls; 
+    }
+
+// ---------------------------------------------------------------------------
+// Sets flag for domain transfer while held waiting calls ongoing
+// ---------------------------------------------------------------------------
+//   
+void TVccHoPolicy::SetDoHoInHeldWaitingCalls( const TBool& aHeldWaitingCalls )
+    {
+    iHeldWaitingCalls = aHeldWaitingCalls;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets flag for domain transfer when cs originated call
+// ---------------------------------------------------------------------------
+//   
+void TVccHoPolicy::SetDtAllowedWhenCsOriginated( 
+        const TBool& aDtAllowedWhenCsOriginated )
+    {
+    iDtAllowedWhenCsOriginated = aDtAllowedWhenCsOriginated;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns is HO allowed when CS originated call
+// ---------------------------------------------------------------------------
+//   
+TBool TVccHoPolicy::DtAllowedWhenCsOriginated() const
+    {
+    return iDtAllowedWhenCsOriginated;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/src/vcchopolicyreader.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "vcchopolicyreader.h"
+#include "vccspsettings.h"
+#include "rubydebug.h"
+
+_LIT( KVccServiceName,               "VCC" );
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CVccHoPolicyReader::CVccHoPolicyReader()
+    : iPolicy()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CVccHoPolicyReader::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "ConstructL" );
+
+    iSpSettings = CVccSPSettings::NewL();
+    }
+    
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//          
+CVccHoPolicyReader* CVccHoPolicyReader::NewL()
+    {
+    RUBY_DEBUG_BLOCKL( "NewL" );
+
+    CVccHoPolicyReader* self = CVccHoPolicyReader::NewLC();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//  
+CVccHoPolicyReader* CVccHoPolicyReader::NewLC()
+    {
+    CVccHoPolicyReader* self = new( ELeave ) CVccHoPolicyReader();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CVccHoPolicyReader::~CVccHoPolicyReader()
+    {
+    RUBY_DEBUG0( "~CVccHoPolicyReader START" );
+
+    delete iSpSettings;
+
+    RUBY_DEBUG0( "~CVccHoPolicyReader STOP" ); 
+    }
+
+// ---------------------------------------------------------------------------
+// Returns ho policy 
+// ---------------------------------------------------------------------------
+//
+TVccHoPolicy CVccHoPolicyReader::HoPolicy() const
+    {
+    return iPolicy;
+    }  
+      
+// ---------------------------------------------------------------------------
+// Reads current settings which define when Ho can occur 
+// from Sp table and user modifiable repositories.
+// ---------------------------------------------------------------------------
+//      
+void CVccHoPolicyReader::ReadSettingsL()
+    {
+    RUBY_DEBUG_BLOCK( "ReadSettingsL" );
+
+    iSpSettings->ReadSettingsL( KVccServiceName );
+    //read user settings
+    
+    ResolvePreferredDomainL();
+    ResolveImmediateHoL();
+    ResolveHoDirectionL();
+    ResolveHoInHeldWaitingCallsL();   
+    ResolveSignalLevelParametersL();
+    ResolveDtAllowedWhenCsOriginatedL();
+    }
+
+// ---------------------------------------------------------------------------
+// Defines what is the preferred domain the user should use for MO calls.
+// 3GPP 24.216-720 defines operator preference:
+// 0 - Indicates the preference for CS domain.
+// 1 - Indicates the preference for IM CN subsystem.
+// 2 - Indicates the preference for CS domain only.
+// 3 - Indicates the preference for IM CN subsystem only.
+//
+// User preferred domain overrides operator preference.
+// User preference modes: CS/PS 
+// ---------------------------------------------------------------------------
+//     
+void CVccHoPolicyReader::ResolvePreferredDomainL()
+    {
+    RUBY_DEBUG_BLOCK( "ResolvePreferredDomainL" );
+
+    TVccHoPolicyPreferredDomain val = 
+    static_cast<TVccHoPolicyPreferredDomain>( iSpSettings->PreferredDomainL() );
+    
+    iPolicy.SetPreferredDomain( val );
+    }
+    
+// ---------------------------------------------------------------------------
+// Defines should handover occur immediately when preferred network becomes
+// available
+// 3GPP 24.216-720 defines operator preference: 
+//  0 - Indicates the preference to not initiate domain transfer immediately 
+//      to the preferred domain when that domain becomes available.
+//  1 - Indicates the preference to initiate domain transfer immediately to 
+//      the preferred domain when that domain becomes available.
+//
+// ---------------------------------------------------------------------------
+//  
+void  CVccHoPolicyReader::ResolveImmediateHoL()
+    {
+    RUBY_DEBUG_BLOCK( "ResolveImmediateHoL" );
+
+    TBool val( iSpSettings->ImmediateDtL() );
+    
+    iPolicy.SetDoImmediateHo( val );
+    }
+    
+// ---------------------------------------------------------------------------
+// Resolves into which domain hanover can occur 
+// 3GPP 24.216-720 defines operator preference:
+// 0 - Indicates that the network operator prefers the domain transfer in the
+//     CS to IM CN/IM CN to CS subsystem direction can occur.
+// 1 - Indicates that the network operator prefers the domain transfer in the 
+//     CS to IM CN/IM CN to CS subsystem direction cannot occur.
+//
+// ---------------------------------------------------------------------------
+//   
+void CVccHoPolicyReader::ResolveHoDirectionL()
+    {
+    RUBY_DEBUG_BLOCK( "ResolveHoDirectionL" );
+
+    TInt val( 0 );
+    
+    if( iSpSettings->DtCsToPsAllowedL() == 0 )
+        val |= ECsToPsAllowed;
+    
+    if( iSpSettings->DtPsToCsAllowedL() == 0 )
+        val |= EPsToCsAllowed;
+    
+    iPolicy.SetAllowedDirection( val );
+    }    
+    
+// ---------------------------------------------------------------------------
+// Resolves can handover occur when held or waiting calls exist. 
+// 3GPP 24.216-720 defines operator preference:
+// 0 - Indicates that the network operator prefers the domain transfer can 
+//     occur when the VCC UE is engaged in an active and a held/waiting 
+//     call/session on the transferring-out domain.
+// 1 - Indicates that the network operator prefers the domain transfer cannot
+//     occur when the VCC UE is engaged in an active and a held/waiting 
+//     call/session on the transferring-out domain.
+//
+// ---------------------------------------------------------------------------
+//   
+void CVccHoPolicyReader::ResolveHoInHeldWaitingCallsL()
+    {
+    RUBY_DEBUG_BLOCK( "ResolveHoInHeldWaitingCallsL" );
+
+    TBool val( !iSpSettings->DtHeldWaitingCallsAllowedL() );
+    iPolicy.SetDoHoInHeldWaitingCalls( val );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CVccHoPolicyReader::ResolveSignalLevelParametersL()
+    {
+    iCsParams.iHighLevel = iSpSettings->CsHoTresholdL();
+    iCsParams.iLowLevel = iCsParams.iHighLevel + iSpSettings->CsHoHysteresisL();
+    iCsParams.iLowTimeout = iSpSettings->CsHoHysteresisTimerLowL();
+    iCsParams.iHighTimeout = iSpSettings->CsHoHysteresisTimerHighL();
+    
+    iPsParams.iHighLevel = iSpSettings->PsHoTresholdL();
+    iPsParams.iLowLevel = iPsParams.iHighLevel + iSpSettings->PsHoHysteresisL();
+    iPsParams.iLowTimeout = iSpSettings->PsHoHysteresisTimerLowL();
+    iPsParams.iHighTimeout = iSpSettings->PsHoHysteresisTimerHighL();
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TSignalLevelParams CVccHoPolicyReader::CsSignalLevelParams() const
+    {
+    return iCsParams;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TSignalLevelParams CVccHoPolicyReader::PsSignalLevelParams() const
+    {
+    return iPsParams;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CVccHoPolicyReader::ResolveDtAllowedWhenCsOriginatedL()
+    {
+    TBool val( iSpSettings->DtAllowedWhenCsOriginatedL() );
+    iPolicy.SetDtAllowedWhenCsOriginated( val );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/src/vcchotrigger.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,702 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 handover trigger
+*
+*/
+
+
+
+#include <e32base.h>
+
+#include <vccsubscribekeys.h>
+#include "vccuipsproperty.h"
+#include "vcchotrigger.h"
+#include "vccsignallevelhandler.h"
+#include "vccwlansignallevelhandler.h"
+#include "vccgsmsignallevelhandler.h"
+#include "rubydebug.h"
+#include "vcchopolicyreader.h"
+#include "vcccchmonitor.h"
+#include "vccengpsproperty.h"
+#include "cvccperformer.h"
+
+// Min. signal strength.
+static const TInt32 KStrengthMin = 110;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Symbian constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVccHoTrigger* CVccHoTrigger::NewL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccHoTrigger::NewL" );
+
+    CVccHoTrigger* self = new ( ELeave ) CVccHoTrigger();
+
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CVccHoTrigger::~CVccHoTrigger()
+    {
+    RUBY_DEBUG0( "CVccHoTrigger::~CVccHoTrigger() - ENTER" );
+
+    delete iProperty;
+    delete iWlanSignalLevelHandler;
+    delete iGsmSignalLevelHandler;
+    delete iHoPolicyReader;
+    delete iCchMonitor;
+    delete iEngPsProperty;
+    
+    RUBY_DEBUG0( "CVccHoTrigger::~CVccHoTrigger() - EXIT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CVccHoTrigger::CVccHoTrigger()
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CVccHoTrigger::CVccHoTrigger() :         //: CActive( EPriorityStandard )
+    iGsmClass( ESignalClassUndefined ),
+    iWlanClass( ESignalClassUndefined ),
+    iManualHoDone( EFalse ),
+    iHoNotAllowed( EFalse ),
+    iHoAllowedIfCsOriginated( ETrue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccHoTrigger::CVccHoTrigger" );
+    }
+// ---------------------------------------------------------------------------
+// 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CVccHoTrigger::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccHoTrigger::ConstructL" );
+
+    iProperty = CVccUiPsProperty::NewL();
+    iHoPolicyReader = CVccHoPolicyReader::NewL();
+    iHoPolicyReader->ReadSettingsL();
+    
+    iEngPsProperty = CVccEngPsProperty::NewL();
+    iPolicy = iHoPolicyReader->HoPolicy();
+    TSignalLevelParams gsm = iHoPolicyReader->CsSignalLevelParams();
+    TSignalLevelParams wlan = iHoPolicyReader->PsSignalLevelParams();
+    
+
+    iWlanSignalLevelHandler =
+        CVccWlanSignalLevelHandler::NewL( *this, wlan, *iEngPsProperty );
+
+         
+    iGsmSignalLevelHandler =
+        CVccGsmSignalLevelHandler::NewL( *this, gsm );
+  
+    iHoAllowedIfCsOriginated = iPolicy.DtAllowedWhenCsOriginated();
+    // Previous signal level class must be undefined
+    iPreviousGsmClass = ESignalClassUndefined;
+    iPreviousWlanClass = ESignalClassUndefined;
+    // In the beginning the VoIP service is not available.
+    // This will be changed when the cch monitor calls us
+    // when the service is available.
+    iCchServiceStatus = EServiceUnavailable;
+    
+    // CS network has signal level zero if the service is not
+    // available.
+    iCsSignalLevel = KStrengthMin;
+
+    // We are not stared yet.
+    iStarted = EFalse;
+    
+    // Update P&S keys to tell if we can do ho or not.    
+    UpdatePsKeysL();
+    // Create the CCH monitor. We are the observer to be
+    // notified when the status changes.
+    iCchMonitor = CVccCchMonitor::NewL( *this );
+    }
+
+// -----------------------------------------------------------------------------
+// Stop monitoring
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccHoTrigger::Stop()
+    {
+    RUBY_DEBUG_BLOCK( "CVccHoTrigger::Stop" );
+    Stop( *iWhoStartedMe );
+    }
+
+// -----------------------------------------------------------------------------
+// Stop monitoring
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccHoTrigger::Stop( CVccPerformer& aStopper )
+    {
+    RUBY_DEBUG_BLOCK( "CVccHoTrigger::Stop" );
+    // If someone else that the one who started us tries
+    // to stop us, we do not allow it.
+    // There may be several performers that are in differnet state
+    // and in those state they do not need trigger and thus try
+    // to stop us.
+    if ( iWhoStartedMe == &aStopper )
+        {
+        iWhoStartedMe = NULL;
+        iStarted = EFalse;
+        TRAP_IGNORE( UpdatePsKeysL() );
+        TRAP_IGNORE( iProperty->NotifySubscriberL( EVccNoRequestOngoing ) );
+        iWlanSignalLevelHandler->Stop();
+        iGsmSignalLevelHandler->Stop();
+        
+        iGsmClass = ESignalClassUndefined;
+        iWlanClass = ESignalClassUndefined;        
+        
+        // Reset CS signal strength to min
+        iCsSignalLevel = KStrengthMin;
+        
+        // Disable (do not send notifications).
+        // The service is not actually disabled.
+        // It will be disabled (if needed) when the monitor
+        // is deleted.
+        iCchMonitor->DisableService();
+        RUBY_DEBUG0( " -Trigger stopped");
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Start monitoring
+// We must not leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccHoTrigger::Start( CVccPerformer& aWhoStartedMe, 
+                                    TBool aCsOriginated )
+    {
+    RUBY_DEBUG_BLOCK( "CVccHoTrigger::Start" );
+    if( iHoAllowedIfCsOriginated == EFalse && aCsOriginated )
+        {
+        RUBY_DEBUG0( "HO not allowed for CS originated calls" );
+                
+        Stop();
+        return;
+        }
+    //anyone can start, but only the last one who started can stop the trigger
+    iWhoStartedMe = &aWhoStartedMe;
+    if( !iStarted )
+        {
+        
+        // Previous signal level class must be undefined
+        iPreviousGsmClass = ESignalClassUndefined;
+        iPreviousWlanClass = ESignalClassUndefined;
+    
+        // read signal high/low levels, timers etc.
+        TRAPD( err, iHoPolicyReader->ReadSettingsL() );
+        RUBY_DEBUG1( "reading ho settings, err = %d", err );
+        
+        if ( !err )
+        	{
+		    TSignalLevelParams gsm = iHoPolicyReader->CsSignalLevelParams();
+		    TSignalLevelParams wlan = iHoPolicyReader->PsSignalLevelParams();
+		    iPolicy = iHoPolicyReader->HoPolicy();
+		    
+		    iWlanSignalLevelHandler->SetParams( wlan );
+		    iGsmSignalLevelHandler->SetParams( gsm );
+		    
+		    TRAPD( err_wlan, iWlanSignalLevelHandler->StartL() );
+		    RUBY_DEBUG1( "starting wlan signal level handler, err = %d", err_wlan );
+		    TRAPD( err_gsm, iGsmSignalLevelHandler->StartL() );
+		    RUBY_DEBUG1( "starting gsm signal level handler, err = %d", err_gsm );
+		    
+		    if ( !err_wlan && !err_gsm )
+		    	{		    
+			    // Enable the VoIP service to be able to do VoIP calls.
+			    TRAPD( err_cch, iCchMonitor->EnableServiceL() );
+			    RUBY_DEBUG1( "enabling service, err = %d", err_cch );
+			    
+			    if ( !err_cch )
+			    	{
+			    	// Everything was started ok
+			    	iStarted = ETrue;
+			    	}
+		    	}
+		    else
+		    	{
+		    	// Stop the handlers just in case either one was started
+		    	iWlanSignalLevelHandler->Stop();
+		    	iGsmSignalLevelHandler->Stop();
+		    	}
+        	}
+        
+        TRAP_IGNORE( UpdatePsKeysL() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Set the domain type of the current call
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccHoTrigger::SetCurrentDomainType( TCallDomainType aDomainType )
+    {
+    RUBY_DEBUG_BLOCK( "CVccHoTrigger::SetCurrentDomainType" );
+    iDomainType = aDomainType;
+    }
+
+// -----------------------------------------------------------------------------
+// Set the preferred domain type
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccHoTrigger::SetPreferredDomainType( 
+                                        TVccHoPolicyPreferredDomain aDomainType )
+    {
+    RUBY_DEBUG1( "CVccHoTrigger::SetPreferredDomainType(%d)", aDomainType );
+    iPolicy.SetPreferredDomain( aDomainType );
+    }
+
+// -----------------------------------------------------------------------------
+// Set Immediate Domain Transfer on/off
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccHoTrigger::SetImmediateDomainTransfer( TBool aImmediateDT )
+    {
+    RUBY_DEBUG1( "CVccHoTrigger::SetImmediateDomainTransfer(%d)", aImmediateDT );
+    iPolicy.SetDoImmediateHo(  aImmediateDT );
+    }
+
+// -----------------------------------------------------------------------------
+// Handles wlan signal change notifications
+// -----------------------------------------------------------------------------
+//
+void CVccHoTrigger::WlanSignalChanged(
+        TInt32 /*aSignalStrength*/,
+        TSignalStrengthClass aClass )
+    {
+    RUBY_DEBUG_BLOCK( "CVccHoTrigger::WlanSignalChanged" );
+
+    //Store signal strength class to that we know later what is the strength
+    iWlanClass = aClass;
+    
+    RUBY_DEBUG1( " -iWlanClass=%x ", iWlanClass );
+    RUBY_DEBUG1( " -iDomainType=%x ", iDomainType );
+    RUBY_DEBUG1( " -iGsmClass=%x ", iGsmClass );
+    RUBY_DEBUG1( " -DoImmediateHO=%x ", iPolicy.DoImmediateHo() );
+    RUBY_DEBUG1( " -PreferredDomain=%x ", iPolicy.PreferredDomain() );
+    RUBY_DEBUG1( " -iGsmClass=%x ", iGsmClass );
+    RUBY_DEBUG1( " -DoHoInHeldWaitingCalls=%x ", iPolicy.DoHoInHeldWaitingCalls() );
+    RUBY_DEBUG0( "0 = GOOD, 1 = WEAK, 2 = UNDEFINED" );
+    
+    // If the previous class is the same as the new one
+    // - do nothing.
+    
+    if ( iPreviousWlanClass == iWlanClass )
+        {
+        if (iWlanClass == ESignalClassWeak)
+            {
+            RUBY_DEBUG0( "Signal is still weak try again to do HO" );
+            }
+        else
+            {
+            RUBY_DEBUG0( "No change in WLAN signal class -> return" );
+            return;
+            }
+          }
+    else
+        {
+        iPreviousWlanClass = iWlanClass;
+        }
+    
+    TriggerHo();
+     }
+
+// -----------------------------------------------------------------------------
+// Handles GSM singnal change notifications
+// -----------------------------------------------------------------------------
+//
+void CVccHoTrigger::GsmSignalChanged(
+        TInt32 aSignalStrength,
+        TSignalStrengthClass aClass )
+    {
+    RUBY_DEBUG_BLOCK( "VccHoTrigger::GsmSignalChanged" );
+    RUBY_DEBUG1( " -iCsSignalLevel=%d ", aSignalStrength );
+
+    //Store signal strength class to that we know later what is the strength
+    iGsmClass = aClass;
+    
+    // Save the signal strength as "status".
+    // Zero (0) means that the service is not available.
+    iCsSignalLevel = aSignalStrength;
+
+    // Update P&S keys to tell if we can do ho or not.
+    // If the signal level has gone to zero, we are unable to
+    // do hondover.
+    
+    TVccHoStatus hoStatus( EVccHoStateUnknown );
+    iEngPsProperty->GetCurrentHoStatus( hoStatus );
+    
+    if( hoStatus != EVccCsToPsHoStarted || hoStatus != EVccCsToPsHoInprogress 
+        || hoStatus != EVccPsToCsHoStarted || hoStatus != EVccPsToCsHoInprogress )
+        {
+        RUBY_DEBUG0( "HO not in progress,  updating keys" );
+        TRAP_IGNORE( UpdatePsKeysL() );
+        }
+    
+    RUBY_DEBUG1( " -iWlanClass=%x ", iWlanClass );
+    RUBY_DEBUG1( " -iDomainType=%x ", iDomainType );
+    RUBY_DEBUG1( " -iGsmClass=%x ", iGsmClass );
+    RUBY_DEBUG1( " -DoImmediateHO=%x ", iPolicy.DoImmediateHo() );
+    RUBY_DEBUG1( " -PreferredDomain=%x ", iPolicy.PreferredDomain() );
+    RUBY_DEBUG1( " -DoHoInHeldWaitingCalls=%x ", iPolicy.DoHoInHeldWaitingCalls() );  
+    RUBY_DEBUG0( "0 = GOOD, 1 = WEAK, 2 = UNDEFINED" );
+    
+    // If the previous class is the same as the new one
+    // - do nothing.
+    
+    if ( iPreviousGsmClass == iGsmClass && iWlanClass != ESignalClassWeak  )
+        {
+        RUBY_DEBUG0( "No change in GSM signal class -> return" );
+    
+        return;
+        }
+    else
+        {
+        iPreviousGsmClass = iGsmClass;
+        }
+    
+    TriggerHo();
+    }
+
+// -----------------------------------------------------------------------------
+// Handles CCH monitor notifications
+// -----------------------------------------------------------------------------
+//
+void CVccHoTrigger::CchServiceStatusChanged( TServiceStatus aStatus )
+    {
+    RUBY_DEBUG_BLOCK( "VccHoTrigger::CchServiceStateChanged" );
+    RUBY_DEBUG1( " -Service status = %d", aStatus );
+    
+    // Save the status
+    iCchServiceStatus = aStatus;
+    
+    TRAP_IGNORE( UpdatePsKeysL() );
+    TriggerHo();
+    }
+
+// -----------------------------------------------------------------------------
+// Check if the CS or PS services are available or not
+// -----------------------------------------------------------------------------
+//
+TBool CVccHoTrigger::ServicesAvailable()
+    {
+    RUBY_DEBUG_BLOCK( "CVccHoTrigger::AreServicesAvailable" );
+    
+    TBool retVal( ETrue );
+    
+    // If PS service (VoIP service) is unavailable or
+    // the CS service == 0 (i.e. signal level),
+    // we cannot do handover.
+    
+    if ( iCchServiceStatus == EServiceUnavailable || 
+                    iCsSignalLevel == KStrengthMin )
+        {
+        RUBY_DEBUG0( " -VoIP/CS service(s) not available" );
+        retVal = EFalse;
+        }
+    
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// Update (write) service status state to P&S.
+// -----------------------------------------------------------------------------
+//
+void CVccHoTrigger::UpdatePsKeysL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccHoTrigger::UpdatePsKeysL" );
+    
+    // If we are started and both services are available,
+    // handover can be done.
+    // Services available in CS means that we have
+    // signal strength != KStrengthMin (which is 110, returned
+    // from the CS signal level monitor).
+    
+    RUBY_DEBUG1( " -iStarted = %d", iStarted );
+    RUBY_DEBUG1( " -iHoNotAllowed = %d", iHoNotAllowed );
+    RUBY_DEBUG1( " -Service status = %d (0=unavailable, 1=available)", iCchServiceStatus );
+    RUBY_DEBUG1( " -CS signal min level = 110, current level = %d", iCsSignalLevel );
+        
+    if ( iStarted &&
+            ( iCchServiceStatus == EServiceAvailable ) && 
+            ( iCsSignalLevel != KStrengthMin ) &&
+            ( !iHoNotAllowed ) )
+        {
+        RUBY_DEBUG0( " -We are started and both services are available" );
+        // Check HO direction restrictions
+        if ( ( iPolicy.AllowedDirection() & ECsToPsAllowed ) && 
+                ( iPolicy.AllowedDirection() & EPsToCsAllowed ) )
+            {
+            if( iPolicy.DoHoInHeldWaitingCalls() )
+                {
+                RUBY_DEBUG0( " -Services available and ho allowed to both \
+                             directions, also in multicall" );
+                iEngPsProperty->NotifySubscriberL( EVccHoStateIdle, KErrNone );
+                }
+            else
+                {
+                RUBY_DEBUG0( " -Services available and ho allowed to both \
+                             directions but not in multicall" );
+                iEngPsProperty->NotifySubscriberL( EVccHoStateIdleIfSingleCall, KErrNone );
+                }
+            }
+        else if ( !( iPolicy.AllowedDirection() & ECsToPsAllowed  ) &&
+                ( iPolicy.AllowedDirection() & EPsToCsAllowed ) )
+            {
+            if( iPolicy.DoHoInHeldWaitingCalls() )
+                {
+                RUBY_DEBUG0( " -HO allowed only to CS" );
+                iEngPsProperty->NotifySubscriberL( EVccCsToPsNotAllowed, KErrNone );
+                }
+            else
+                {
+                RUBY_DEBUG0( " -HO allowed only to CS, in single call situation" );
+                iEngPsProperty->NotifySubscriberL( EVccHoAllowedToCsIfSingleCall, KErrNone );
+                }
+            }
+        else if ( !( iPolicy.AllowedDirection() & EPsToCsAllowed ) &&  
+                    ( iPolicy.AllowedDirection() & ECsToPsAllowed ) )
+            {
+            if( iPolicy.DoHoInHeldWaitingCalls() )
+                {
+                RUBY_DEBUG0( " -HO allowed only to PS" );
+                iEngPsProperty->NotifySubscriberL( EVccPsToCsNotAllowed, KErrNone );
+                }
+            else
+                {
+                RUBY_DEBUG0( " -HO allowed only to PS, in single call situation" );
+                iEngPsProperty->NotifySubscriberL( EVccHoAllowedToPsIfSingleCall, KErrNone );
+                }
+            }
+        }
+    else
+        {
+        RUBY_DEBUG0( " -We are stopped or services are unavailable:" );
+        iEngPsProperty->NotifySubscriberL( EVccHoUnavailable, KErrNotReady );        
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// If manual HO is done, no automatic should be made.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccHoTrigger::ManualHoCallStarted()
+    {
+    RUBY_DEBUG_BLOCK( "CVccHoTrigger::ManualHoCallStarted" );
+    iManualHoDone = ETrue;
+    //notify Wlan Signal Level Handler so it can stop polling WLAN signal
+    iWlanSignalLevelHandler->SetManualHoDone( ETrue );
+    }
+
+// -----------------------------------------------------------------------------
+// After manual HO call has been released automatic HOs can be made again.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccHoTrigger::ManualHoCallReleased()
+    {
+    RUBY_DEBUG_BLOCK( "CVccHoTrigger::ManualHoCallReleased" );
+    iManualHoDone = EFalse;
+
+    iWlanSignalLevelHandler->SetManualHoDone( EFalse );
+    }
+
+// -----------------------------------------------------------------------------
+// During conference HO is not allowed
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccHoTrigger::HoNotAllowedL()
+	{
+	RUBY_DEBUG_BLOCK( "CVccHoTrigger::HoNotAllowedL" );
+	iHoNotAllowed = ETrue;
+	UpdatePsKeysL();
+	}
+
+// -----------------------------------------------------------------------------
+// After conference HO is allowed again
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccHoTrigger::HoAllowed()
+	{
+	RUBY_DEBUG_BLOCK( "CVccHoTrigger::HoAllowed" );
+	iHoNotAllowed = EFalse;
+	TRAP_IGNORE( UpdatePsKeysL() );
+	}
+
+// -----------------------------------------------------------------------------
+// Read settings
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccHoTrigger::ReadHoAllowedWhenCsOriginatedSettingL()
+    {
+    iHoPolicyReader->ReadSettingsL();
+    iPolicy = iHoPolicyReader->HoPolicy();
+    iHoAllowedIfCsOriginated = iPolicy.DtAllowedWhenCsOriginated();
+    }
+    
+// -----------------------------------------------------------------------------
+// Initiate the actual ho when its ok
+// -----------------------------------------------------------------------------
+//
+void CVccHoTrigger::TriggerHo()
+	{
+	RUBY_DEBUG_BLOCK( "CVccHoTrigger::TriggerHo" );
+	
+	RUBY_DEBUG1("Current domain is: %d", iDomainType);
+	//Check if manual ho is already made during this call and the 
+	//service availability.
+	if( iManualHoDone || !ServicesAvailable() || iHoNotAllowed )
+		{
+		return;
+		}
+	
+	//If immediate ho is "ON" do it first and then return.
+	if( iPolicy.DoImmediateHo() )
+		{
+		if ( DoImmediateHo() )
+		    {
+		    RUBY_DEBUG0( "VccHoTrigger::TriggerHo - immediate HO was initiated" );
+		    return;
+		    }
+		RUBY_DEBUG0( "VccHoTrigger::TriggerHo - no immediate HO" );
+		}
+	
+	if ( ( iWlanClass == ESignalClassWeak || iCchServiceStatus == EServiceUnavailable )&&
+	        iGsmClass == ESignalClassNormal && 
+	     ( iPolicy.AllowedDirection() & EPsToCsAllowed  ) && iDomainType == ECallDomainTypePS )
+	    {
+	    RUBY_DEBUG0( "VccHoTrigger::WlanSignalChanged - NotifySubscriberL" );
+	        
+	    // First empty the key, so that director 
+	    // gets notified about all changes
+	        
+	    TRAP_IGNORE( iProperty->NotifySubscriberL( EVccNoRequestOngoing ) );
+	    // Check whether HO is allowed in multicall situation
+	    if( iPolicy.DoHoInHeldWaitingCalls() )
+	        {
+	        TRAP_IGNORE( iProperty->NotifySubscriberL(
+	                    EVccAutomaticStartPsToCsHoRequest ) );
+	        }
+	    else
+	        {
+	        TRAP_IGNORE( iProperty->NotifySubscriberL(
+	                    EVccAutomaticStartPsToCsHoRequestIfSingleCall ) );
+	        }
+	        
+	    }        
+	
+	else if ( iGsmClass == ESignalClassWeak &&
+            iWlanClass == ESignalClassNormal &&
+            ( iPolicy.AllowedDirection() & ECsToPsAllowed ))
+        {
+        RUBY_DEBUG0( "VccHoTrigger::GsmSignalChanged - NotifySubscriberL" );
+        
+        // First empty the key, so that director 
+        // gets notified about all changes
+        
+        TRAP_IGNORE( iProperty->NotifySubscriberL( EVccNoRequestOngoing ) );
+        // Check whether HO is allowed in multicall situation
+        if( iPolicy.DoHoInHeldWaitingCalls() )
+            {
+            TRAP_IGNORE( iProperty->NotifySubscriberL(
+                        EVccAutomaticStartCsToPsHoRequest ) );
+            }
+        else
+            {
+            TRAP_IGNORE( iProperty->NotifySubscriberL(
+                        EVccAutomaticStartCsToPsHoRequestIfSingleCall ) );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Initiate immediate ho
+// -----------------------------------------------------------------------------
+//
+TBool CVccHoTrigger::DoImmediateHo()
+	{
+	RUBY_DEBUG_BLOCK( "CVccHoTrigger::DoImmediateHo" );
+	TBool ret( EFalse );
+	if( ( iPolicy.PreferredDomain() == ECsPreferred ) &&
+	    iGsmClass ==  ESignalClassNormal &&
+        ( iPolicy.AllowedDirection() & EPsToCsAllowed ) )  
+		{
+		// Current call is PS, CS signal is ok, preferred domain is CS
+        // and immediate HO is requested -> HANDOVER to CS
+        
+        RUBY_DEBUG0( "VccHoTrigger::GsmSignalChanged - NotifySubscriberL ->\
+                      IMMEDIATE HO to CS" );
+        
+        // First empty the key, so that director gets
+        // notified about all changes
+        
+        TRAP_IGNORE( iProperty->NotifySubscriberL( EVccNoRequestOngoing ) );
+        
+        // Check whether HO is allowed in multicall situation
+        if( iPolicy.DoHoInHeldWaitingCalls() )
+            {
+            TRAP_IGNORE( iProperty->NotifySubscriberL(
+                        EVccAutomaticStartPsToCsHoRequest ) );
+            ret = ETrue;
+            }
+        else
+            {
+            TRAP_IGNORE( iProperty->NotifySubscriberL(
+                        EVccAutomaticStartPsToCsHoRequestIfSingleCall ) );
+            ret = ETrue;
+            }
+		}
+	
+	else if ( (iPolicy.PreferredDomain() == EPsPreferred)  &&
+	      iWlanClass == ESignalClassNormal && iCchServiceStatus != EServiceUnavailable &&
+	      ( iPolicy.AllowedDirection() & ECsToPsAllowed  ) && iDomainType != ECallDomainTypePS )
+        {
+        // Current call is CS, PS signal is ok, preferred domain is PS and 
+	    // immediate HO is requested -> HANDOVER to PS
+
+        RUBY_DEBUG0( "VccHoTrigger::WlanSignalChanged - NotifySubscriberL ->\
+                      IMMEDIATE HO to PS" );
+	       
+	    // First empty the key, so that director gets 
+	    // notified about all changes
+	        
+	    TRAP_IGNORE( iProperty->NotifySubscriberL( EVccNoRequestOngoing ) );
+	        
+        // Check whether HO is allowed in multicall situation
+	    if( iPolicy.DoHoInHeldWaitingCalls() )
+            {
+	        TRAP_IGNORE( iProperty->NotifySubscriberL(
+	                    EVccAutomaticStartCsToPsHoRequest ) );
+	        ret = ETrue;
+	        }
+	    else
+	        {
+	        TRAP_IGNORE( iProperty->NotifySubscriberL(
+	                       EVccAutomaticStartCsToPsHoRequestIfSingleCall ) );
+	        ret = ETrue;
+	        }
+        }
+	return ret;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/src/vccsignallevelhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,319 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 base class of signal level handler
+*
+*/
+
+
+
+#include "vccsignallevelhandler.h"
+#include "vccsignallevelobserver.h"
+#include "rubydebug.h"
+
+
+// Min. signal strength in absolut dBm, i.e. the value
+// in real world is -110 dBm (so quite weak).
+static const TInt32 KStrengthMin = 110;
+
+// ---------------------------------------------------------------------------
+// C++ destructor.
+// ---------------------------------------------------------------------------
+//
+CVccSignalLevelHandler::~CVccSignalLevelHandler()
+    {
+    // Cancel any outstanding requests.
+    Cancel();
+
+    iStrength = 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian second-phase constructor.
+// ---------------------------------------------------------------------------
+//
+void CVccSignalLevelHandler::ConstructL()
+    {
+    CTimer::ConstructL();
+    }
+
+// ---------------------------------------------------------------------------
+// C++ constructor.
+// ---------------------------------------------------------------------------
+//
+CVccSignalLevelHandler::CVccSignalLevelHandler(
+    MVccSignalLevelObserver& aObserver,
+    const TSignalLevelParams& aParams )
+    : CTimer( EPriorityStandard ),
+    iObserver( aObserver ),
+    iParams( aParams )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// Star signal level observing.
+// ---------------------------------------------------------------------------
+//
+void CVccSignalLevelHandler::StartL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSignalLevelHandler::StartL" );
+
+    if ( !iNotificationsOn )
+        {
+        EnableNotificationsL();
+        iNotificationsOn = ETrue;
+        }
+
+    RUBY_DEBUG0( " -call Cancel()" );
+    Cancel();
+
+    RUBY_DEBUG0( " -call GetStrength()" );
+    GetStrength();
+
+    RUBY_DEBUG1( " -iStrength = %d, set op = EOperationGet \
+                 state = EStrengthUnknown", iStrength );
+    
+    iOperation = EOperationGet;
+
+    iState = EStrengthUnknown;
+
+    RUBY_DEBUG0( " -call SetActive()" );
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// Stop signal level observing.
+// ---------------------------------------------------------------------------
+//
+void CVccSignalLevelHandler::Stop()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSignalLevelHandler::Stop ");
+
+    DisableNotifications();
+
+    iNotificationsOn = EFalse;
+
+    iStrength = 0;
+
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// Set new parameters.
+// ---------------------------------------------------------------------------
+//
+void CVccSignalLevelHandler::SetParams( const TSignalLevelParams& aParams )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSignalLevelHandler::SetParams" );
+    iParams = aParams;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles getting the signal strength and notifying the observer about
+// strength changes.
+// ---------------------------------------------------------------------------
+//
+void CVccSignalLevelHandler::RunL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSignalLevelHandler::RunL" );
+
+    // Zero (0) is not acceptable.
+    if ( !iStrength )
+        {
+        RUBY_DEBUG0( " -0 strength not acceptable, setting to KStrengthMin");
+        iStrength = KStrengthMin;
+        }
+
+    RUBY_DEBUG3( " -iStrength = %d iState = %d iOp = %d", iStrength, iState, iOperation );
+
+    switch ( iOperation )
+        {
+        case EOperationGet:
+            {
+
+            // We are in the Get-mode to get the signal strength.
+            // If the strength is < than the high level (== the strength
+            // is good), start timer to check if we are still in good level
+            // after the timer completes.
+            // The same is done if we have a low level (== bad).
+
+            RUBY_DEBUG0( " -EOperationGet");
+
+            if ( iStrength <= iParams.iHighLevel && iStrength > 0 )
+                {
+                RUBY_DEBUG0( "  set state = EStrengthHigh, op = EOperationWait" );
+
+                After( iParams.iHighTimeout );
+                iState = EStrengthHigh;
+                iOperation = EOperationWait;
+                }
+            else if ( iStrength >= iParams.iLowLevel )
+                {
+                RUBY_DEBUG0( "  set state = EStrengtLow, op = EOperationWait" );
+                After( iParams.iLowTimeout );
+                iState = EStrengthLow;
+                iOperation = EOperationWait;
+                }
+            else
+                {
+                RUBY_DEBUG0( "  strength between low and high, set op = EOperationNone" );
+
+                iOperation = EOperationNone;
+                // PCLint
+                }
+            break;
+            }
+
+        case EOperationWait:
+            {
+
+            // Timer has completed. Check the signal level again.
+
+            RUBY_DEBUG0( " -EOperationWait" );
+            RUBY_DEBUG0( "  set op = EOperationComplete" );
+            GetStrength();
+
+            SetActive();
+
+            iOperation = EOperationComplete;
+
+            break;
+            }
+
+        case EOperationComplete:
+            {
+            // Checking signal strength is now done.
+            // Notify our observer (if needed).
+
+            RUBY_DEBUG1( " -EOperationComplete, iStrength = %d", iStrength );
+
+            // Do we have a good signal level?
+            if ( iStrength <= iParams.iHighLevel && iStrength > 0 && iState == EStrengthHigh )
+                {
+                RUBY_DEBUG0( " -if ( iStrength <= iParams.iHighLevel" );
+                NotifyChanges( iStrength, MVccSignalLevelObserver::ESignalClassNormal );
+                }
+            // Or do we have a bad signal level?
+            else if ( iStrength >= iParams.iHighLevel && iState == EStrengthLow )
+                {
+                RUBY_DEBUG0( " -else if ( iStrength >= iParams.iHighLevel" );
+                NotifyChanges( iStrength, MVccSignalLevelObserver::ESignalClassWeak );
+                }
+            else
+                {
+                // PCLint
+                }
+
+            iOperation = EOperationNone;
+
+            break;
+            }
+
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handles signal strength changes notified by the subsystem
+// (either the WLAN or the GSM).
+// ---------------------------------------------------------------------------
+//
+void CVccSignalLevelHandler::StrengthChanged()
+    {
+
+    RUBY_DEBUG_BLOCK( "CVccSignalLevelHandler::StrengthChanged" );
+
+    // The zero (0) is not good.
+    if ( !iStrength )
+        {
+        iStrength = KStrengthMin;
+        }
+
+    RUBY_DEBUG3( " -iStrength = %d, iState = %d, iOp = %d",
+                             iStrength, iState, iOperation);
+
+    // Check in which direction the signal strength changed
+    // and start the timeout timer to see if the signal level
+    // stays at that (new) level.
+
+    RUBY_DEBUG1( " -iHighLevel = %d", iParams.iHighLevel );
+    RUBY_DEBUG1( " -iLowLevel = %d", iParams.iLowLevel );
+    if ( iStrength <= iParams.iHighLevel && iStrength > 0 )  // && 
+        //( iState == EStrengthLow || iState == EStrengthUnknown ) )
+        {
+        // Cancel outstanding timer in all the cases
+        Cancel();
+        // We have a good level after a bad one.
+
+        RUBY_DEBUG0( " -call After( hightimeout ), set state = High, op = Wait");
+        After( iParams.iHighTimeout );
+        iState = EStrengthHigh;
+        iOperation = EOperationWait;
+        }
+    else if ( iStrength >= iParams.iLowLevel )  //&& 
+            //( iState == EStrengthHigh || iState == EStrengthUnknown ) )
+        {
+        // Cancel outstanding timer in all the cases
+        Cancel();
+        // We have a bad level after a good one.
+
+        RUBY_DEBUG0( " -call After( lowtimeout ), set state = Low, op = Wait");
+
+        After ( iParams.iLowTimeout );
+        iState = EStrengthLow;
+        iOperation = EOperationWait;
+        }
+    else
+        {
+        RUBY_DEBUG0( "-EOperationNone ");
+        iOperation = EOperationNone;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Cancel outstanding requests.
+// ---------------------------------------------------------------------------
+//
+void CVccSignalLevelHandler::DoCancel()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSignalLevelHandler::DoCancel" );
+    switch ( iOperation )
+        {
+        case EOperationWait:
+            {
+            RUBY_DEBUG0( "EOperationWait" );
+            CTimer::DoCancel();
+
+            break;
+            }
+
+        case EOperationGet:
+            // fall-through intended here
+        case EOperationComplete:
+            {
+            RUBY_DEBUG0( "EOperationGet / EOperationComplete" );
+            CancelGetStrength();
+
+            break;
+            }
+
+        default:
+            {
+            break;
+            }
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vcchotrigger/src/vccwlansignallevelhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,442 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 WLAN signal level handler
+*
+*/
+
+
+
+#include <wlanmgmtclient.h>
+#include "vccwlansignallevelhandler.h"
+#include "rubydebug.h"
+#include "vccengpsproperty.h"
+#include <ccpdefs.h>
+
+// Min. signal strength.
+static const TInt32 KStrengthMin = 110;
+
+const TInt KWlanPollIntervalLowSignal= 1000000;
+const TInt KWlanPollIntervalHighSignal= 5000000;
+
+// ---------------------------------------------------------------------------
+// C++ destructor.
+// ---------------------------------------------------------------------------
+//
+CVccWlanSignalLevelHandler::~CVccWlanSignalLevelHandler()
+    {
+    // Cancel any request, if outstanding
+    Cancel();
+#ifndef __WINS__
+    delete iWlanMgmt;
+#endif
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian constructor.
+// ---------------------------------------------------------------------------
+//
+CVccWlanSignalLevelHandler* CVccWlanSignalLevelHandler::NewL(
+    MVccSignalLevelObserver& aObserver,
+    const TSignalLevelParams& aParams, CVccEngPsProperty& aPsProperty )
+    {
+    CVccWlanSignalLevelHandler* self =
+        CVccWlanSignalLevelHandler::NewLC( aObserver, aParams, aPsProperty );
+
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian constructor.
+// ---------------------------------------------------------------------------
+//
+CVccWlanSignalLevelHandler* CVccWlanSignalLevelHandler::NewLC(
+    MVccSignalLevelObserver& aObserver,
+    const TSignalLevelParams& aParams, CVccEngPsProperty& aPsProperty )
+    {
+    CVccWlanSignalLevelHandler * self =
+        new ( ELeave ) CVccWlanSignalLevelHandler( aObserver, aParams, aPsProperty );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ constructor.
+// ---------------------------------------------------------------------------
+//
+CVccWlanSignalLevelHandler::CVccWlanSignalLevelHandler(
+    MVccSignalLevelObserver& aObserver,
+    const TSignalLevelParams& aParams, CVccEngPsProperty& aPsProperty )
+    : CVccSignalLevelHandler( aObserver, aParams ), iVccPsp( aPsProperty )
+    {
+    iManualHoDone = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian second-phase constructor.
+// ---------------------------------------------------------------------------
+//
+void CVccWlanSignalLevelHandler::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccWlanSignalLevelHandler::ConstructL" );
+
+    CVccSignalLevelHandler::ConstructL();
+#ifndef __WINS__
+    //WlanMgmtClient is not started when the phone is not f. ex. labeled
+    TRAP_IGNORE( iWlanMgmt = CWlanMgmtClient::NewL() );
+#endif
+    }
+
+// ---------------------------------------------------------------------------
+// Enable notifications.
+// ---------------------------------------------------------------------------
+//
+void CVccWlanSignalLevelHandler::EnableNotificationsL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::EnableNotificationsL" );
+#ifndef __WINS__
+    if( iWlanMgmt )
+        {
+        TInt error = iWlanMgmt->UpdateRssNotificationBoundary(
+            iParams.iLowLevel,
+            iParams.iLowLevel - iParams.iHighLevel );
+
+        User::LeaveIfError( error );
+
+        iWlanMgmt->ActivateNotificationsL( *this );
+        }
+#endif
+    }
+
+// ---------------------------------------------------------------------------
+// Disable notifications.
+// ---------------------------------------------------------------------------
+//
+void CVccWlanSignalLevelHandler::DisableNotifications()
+    {
+    RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::DisableNotificationsL" );
+#ifndef __WINS__
+    if( iWlanMgmt )
+        {
+        iWlanMgmt->CancelNotifications();
+        }
+#endif
+    }
+
+// ---------------------------------------------------------------------------
+// Get signal strength.
+// ---------------------------------------------------------------------------
+//
+void CVccWlanSignalLevelHandler::GetStrength()
+    {
+
+    RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::GetStrength" );
+
+    iStrength = KStrengthMin;
+#ifndef __WINS__
+    if( iWlanMgmt )
+        {
+        iWlanMgmt->GetConnectionSignalQuality( iStrength );
+        }
+#endif
+    RUBY_DEBUG1( " -strength = %d", iStrength );
+
+    // Because the RMobilePhone used in GSM is asynchronous we need here
+    // to signal that the request is complete (in order to continue
+    // processing stuff in RunL)
+
+    TRequestStatus *sP = &iStatus;
+
+    User::RequestComplete( sP, KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// Cancel outstanding GetStrength.
+// We do not need to do anything since WLAN GetStrength is synchronous.
+// ---------------------------------------------------------------------------
+//
+void CVccWlanSignalLevelHandler::CancelGetStrength()
+    {
+    RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::CancelGetStrength" );
+    }
+
+// ---------------------------------------------------------------------------
+// Handles indication of changed RSS value.
+// ---------------------------------------------------------------------------
+//
+void CVccWlanSignalLevelHandler::RssChanged( TWlanRssClass aRssClass, TUint aRss )
+    {
+    RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::RssChanged" );
+    RUBY_DEBUG2( " -class = %d rss = %d", aRssClass, aRss);
+
+    // Do some basic check
+    // Zero (0) is not acceptable strength (too good?).
+
+    iStrength = aRss ? aRss : KStrengthMin;
+    StrengthChanged();
+    }
+
+// ---------------------------------------------------------------------------
+// Handles BSSID has changed (i.e. AP handover) situation.
+// ---------------------------------------------------------------------------
+//
+void CVccWlanSignalLevelHandler::BssidChanged( TWlanBssid& aNewBSSID )
+    {
+    RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::BssidChanged" );
+    RUBY_DEBUG1( " -aNewBSSID = %S", &aNewBSSID );
+
+    iStrength = KStrengthMin;
+#ifndef __WINS__
+    if( iWlanMgmt )
+        {
+        iWlanMgmt->GetConnectionSignalQuality( iStrength );
+        }
+#endif
+
+    StrengthChanged();
+    }
+
+// ---------------------------------------------------------------------------
+//  Handles lost of one or more networks
+// ---------------------------------------------------------------------------
+//
+void CVccWlanSignalLevelHandler::OldNetworksLost()
+    {
+    RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::OldNetworksLost" );
+
+    iStrength = KStrengthMin;
+#ifndef __WINS__
+    if( iWlanMgmt )
+        {
+        iWlanMgmt->GetConnectionSignalQuality( iStrength );
+        }
+#endif
+    StrengthChanged();
+    
+    TVccHoStatus hoStatus( EVccHoStateUnknown );
+    iVccPsp.GetCurrentHoStatus( hoStatus );
+    
+    RUBY_DEBUG1("Current HoStatus; %d", hoStatus);
+    
+    if( hoStatus == EVccCsToPsHoStarted || hoStatus == EVccCsToPsHoInprogress 
+                                         || hoStatus == EVccHoUnavailable )
+        {
+        iVccPsp.NotifySubscriberL( EVccCsToPsHoFailure, ECCPErrorNetworkOutOfOrder );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Notify observer that the signal level has been changed.
+// ---------------------------------------------------------------------------
+//
+void CVccWlanSignalLevelHandler::NotifyChanges(
+    TInt32 aSignalStrength,
+    MVccSignalLevelObserver::TSignalStrengthClass aClass )
+    {
+    RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::NotifyChanges" );
+    RUBY_DEBUG1( " -New strength = -%d dBm", aSignalStrength );
+
+    iObserver.WlanSignalChanged( aSignalStrength, aClass );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Handles getting the signal strength and notifying the observer about
+// strength changes.
+// ---------------------------------------------------------------------------
+
+void CVccWlanSignalLevelHandler::RunL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::RunL" );
+
+    // Zero (0) is not acceptable.
+       if ( !iStrength )
+           {
+           RUBY_DEBUG0( " -0 strength not acceptable, setting to KStrengthMin");
+           iStrength = KStrengthMin;
+           }
+
+       RUBY_DEBUG3( " -iStrength = %d iState = %d iOp = %d", iStrength, iState, iOperation );
+
+       switch ( iOperation )
+           {
+           case EOperationGet:
+               {
+
+               // We are in the Get-mode to get the signal strength.
+               // If the strength is < than the high level (== the strength
+               // is good), start timer to check if we are still in good level
+               // after the timer completes.
+               // The same is done if we have a low level (== bad).
+
+               RUBY_DEBUG0( " -EOperationGet");
+
+               if ( iStrength <= iParams.iHighLevel && iStrength > 0 )
+                   {
+                   RUBY_DEBUG0( "  set state = EStrengthHigh, op = EOperationWait" );
+                   
+                   After( iParams.iHighTimeout );
+                   iState = EStrengthHigh;
+                   iOperation = EOperationWait;
+                   }
+               else if ( iStrength >= iParams.iLowLevel )
+                   {
+                   RUBY_DEBUG0( "  set state = EStrengtLow, op = EOperationWait" );
+                   After( iParams.iLowTimeout );
+                   iState = EStrengthLow;
+                   iOperation = EOperationWait;
+                   }
+               else
+                   {
+                   RUBY_DEBUG0( "  strength between low and high, set op = EOperationNone" );
+                  
+                   //WLAN signal is almost weak, check again with low interval
+                   After( KWlanPollIntervalLowSignal );
+                   iOperation = EOperationNone;
+                   iState = EStrengthLow;
+                   // PCLint
+                   }
+               break;
+               }
+
+           case EOperationWait:
+               {
+
+               // Timer has completed. Check the signal level again.
+
+               RUBY_DEBUG0( " -EOperationWait" );
+               RUBY_DEBUG0( "  set op = EOperationComplete" );
+               GetStrength();
+
+               SetActive();
+
+               iOperation = EOperationComplete;
+
+               break;
+               }
+
+           case EOperationComplete:
+               {
+               // Checking signal strength is now done.
+               // Notify our observer (if needed).
+
+               RUBY_DEBUG1( " -EOperationComplete, iStrength = %d", iStrength );
+
+               // Do we have a good signal level?
+               if ( iStrength <= iParams.iHighLevel && iStrength > 0 && iState == EStrengthHigh )
+                   {
+                   RUBY_DEBUG0( " -if ( iStrength <= iParams.iHighLevel" );
+                   NotifyChanges( iStrength, MVccSignalLevelObserver::ESignalClassNormal );
+                   }
+               // Or do we have a bad signal level?
+               else if ( iStrength >= iParams.iHighLevel && iState == EStrengthLow )
+                   {
+                   RUBY_DEBUG0( " -else if ( iStrength >= iParams.iHighLevel" );
+                   NotifyChanges( iStrength, MVccSignalLevelObserver::ESignalClassWeak );
+                   }
+               else
+                   {
+                   // PCLint
+                   }
+               
+               TTimeIntervalMicroSeconds32 interval;
+                                              
+                    if( iState == EStrengthHigh )
+                        {
+                         RUBY_DEBUG0( "  high interval" );
+                        interval = KWlanPollIntervalHighSignal;
+                         }
+                    else
+                          {
+                          RUBY_DEBUG0( "  low interval" )
+                           interval = KWlanPollIntervalLowSignal;
+                          }
+                               
+                    After( interval );
+       
+               iState = EStrengthUnknown;
+               iOperation = EOperationNone;
+             
+               break;
+               }
+
+           case EOperationNone:
+               {
+               RUBY_DEBUG0( " -EOperationNone" );
+               
+               //if manual HO is done then there is no need for checking signal strength so much,
+               //so stopping the loop
+               if( !iManualHoDone )
+                   {
+                   RUBY_DEBUG0( " -call GetStrength()" );
+                   GetStrength();
+                   SetActive();
+                   RUBY_DEBUG1( " -iStrength = %d, set op = EOperationGet \
+                                        state = EStrengthUnknown", iStrength );
+                   iOperation = EOperationGet;
+                   }
+                break;
+         
+               }
+               
+                
+           default:
+               {
+               break;
+               }
+           }
+       
+    }
+
+// ---------------------------------------------------------------------------
+// Lets Wlan Signal Level Handler know is manual handover done or not done
+// 
+// ---------------------------------------------------------------------------
+
+
+void CVccWlanSignalLevelHandler::SetManualHoDone( TBool aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccWlanSignalLevelHandler::SetManualHoDone" );
+    iManualHoDone = aValue;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Cancel outstanding requests.
+// ---------------------------------------------------------------------------
+//
+void CVccWlanSignalLevelHandler::DoCancel()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSignalLevelHandler::DoCancel" );
+    switch ( iOperation )
+        {
+        case EOperationWait:
+        case EOperationNone:
+            {
+            RUBY_DEBUG0( "EOperationWait / EOperationNone" );
+            CTimer::DoCancel();
+
+            break;
+            }
+
+
+        default:
+            {
+            break;
+            }
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccpropertyhandler/bwins/vccuipropertyhandler.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,13 @@
+EXPORTS
+	??1CVccUiPsProperty@@UAE@XZ @ 1 NONAME ; CVccUiPsProperty::~CVccUiPsProperty(void)
+	?DeleteKeys@CVccUiPsProperty@@QAEHXZ @ 2 NONAME ; int CVccUiPsProperty::DeleteKeys(void)
+	?GetCurrentRequest@CVccUiPsProperty@@QAEHAAW4TVccHoRequest@@@Z @ 3 NONAME ; int CVccUiPsProperty::GetCurrentRequest(enum TVccHoRequest &)
+	?NewL@CVccUiPsProperty@@SAPAV1@XZ @ 4 NONAME ; class CVccUiPsProperty * CVccUiPsProperty::NewL(void)
+	?NotifySubscriberL@CVccUiPsProperty@@QAEXW4TVccHoRequest@@@Z @ 5 NONAME ; void CVccUiPsProperty::NotifySubscriberL(enum TVccHoRequest)
+	??1CVccUiPsPropertyListener@@UAE@XZ @ 6 NONAME ; CVccUiPsPropertyListener::~CVccUiPsPropertyListener(void)
+	?AddObserverL@CVccUiPsPropertyListener@@QAEXAAVMVccPsPropertyListenerObserver@@@Z @ 7 NONAME ; void CVccUiPsPropertyListener::AddObserverL(class MVccPsPropertyListenerObserver &)
+	?CurrentValue@CVccUiPsPropertyListener@@QAEHXZ @ 8 NONAME ; int CVccUiPsPropertyListener::CurrentValue(void)
+	?NewL@CVccUiPsPropertyListener@@SAPAV1@I@Z @ 9 NONAME ; class CVccUiPsPropertyListener * CVccUiPsPropertyListener::NewL(unsigned int)
+	?RemoveObserver@CVccUiPsPropertyListener@@QAEXAAVMVccPsPropertyListenerObserver@@@Z @ 10 NONAME ; void CVccUiPsPropertyListener::RemoveObserver(class MVccPsPropertyListenerObserver &)
+	?Start@CVccUiPsPropertyListener@@QAEXXZ @ 11 NONAME ; void CVccUiPsPropertyListener::Start(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccpropertyhandler/eabi/vccuipropertyhandler.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,21 @@
+EXPORTS
+	_ZN16CVccUiPsProperty10DeleteKeysEv @ 1 NONAME
+	_ZN16CVccUiPsProperty17GetCurrentRequestER13TVccHoRequest @ 2 NONAME
+	_ZN16CVccUiPsProperty17NotifySubscriberLE13TVccHoRequest @ 3 NONAME
+	_ZN16CVccUiPsProperty4NewLEv @ 4 NONAME
+	_ZN16CVccUiPsPropertyD0Ev @ 5 NONAME
+	_ZN16CVccUiPsPropertyD1Ev @ 6 NONAME
+	_ZN16CVccUiPsPropertyD2Ev @ 7 NONAME
+	_ZN24CVccUiPsPropertyListener12AddObserverLER30MVccPsPropertyListenerObserver @ 8 NONAME
+	_ZN24CVccUiPsPropertyListener12CurrentValueEv @ 9 NONAME
+	_ZN24CVccUiPsPropertyListener14RemoveObserverER30MVccPsPropertyListenerObserver @ 10 NONAME
+	_ZN24CVccUiPsPropertyListener4NewLEj @ 11 NONAME
+	_ZN24CVccUiPsPropertyListener5StartEv @ 12 NONAME
+	_ZN24CVccUiPsPropertyListenerD0Ev @ 13 NONAME
+	_ZN24CVccUiPsPropertyListenerD1Ev @ 14 NONAME
+	_ZN24CVccUiPsPropertyListenerD2Ev @ 15 NONAME
+	_ZTI16CVccUiPsProperty @ 16 NONAME ; #<TI>#
+	_ZTI24CVccUiPsPropertyListener @ 17 NONAME ; #<TI>#
+	_ZTV16CVccUiPsProperty @ 18 NONAME ; #<VT>#
+	_ZTV24CVccUiPsPropertyListener @ 19 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccpropertyhandler/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* 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 ?myapp
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+vccuipropertyhandler.mmp
+
+PRJ_TESTMMPFILES
+//../internal/tsrc/group/ut_uipropertyhandler.mmp
+
+GNUMAKEFILE test_mover.make
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccpropertyhandler/group/test_mover.make	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,5 @@
+FINAL :
+	echo Copying test DLL to z\sys\bin
+	copy %epocroot%epoc32\release\winscw\udeb\t_uipropertyhandler.dll %epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES CLEAN BLD SAVESPACE :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccpropertyhandler/group/vccuipropertyhandler.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* 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 Vcc UI property handler
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          vccuipropertyhandler.dll
+TARGETTYPE      DLL
+UID             0x1000008d  0x2000E5BF 
+
+//SECUREID 0x11111111
+// Capability assignment.
+CAPABILITY      CAP_GENERAL_DLL
+
+USERINCLUDE	    ../inc
+USERINCLUDE     ../../vcc/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH	  ../src
+
+SOURCE		  vccuipspropertylistener.cpp
+SOURCE		  vccuipsproperty.cpp 
+SOURCE		  vccuipropertyhandlerdllmain.cpp
+SOURCE		  Rubydebug.cpp
+
+
+nostrictdef
+
+LIBRARY		 euser.lib
+LIBRARY         efsrv.lib               //rubydebug
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccpropertyhandler/inc/vccuipropertyhandler.pan	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 codes
+*
+*/
+
+
+
+#ifndef __VCCHO_PAN__
+#define __VCCHO_PAN__
+
+/**  Panic codes */
+enum TvcchoPanic
+	{
+	EvcchoNullPointer
+	};
+
+/**
+ * Panics
+ *
+ * @since S60 3.2
+ * @param aPanic Panic code
+  */
+GLREF_C void Panic( TvcchoPanic aPanic );
+
+#endif  // __VCCHO_PAN__
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccpropertyhandler/sis/vccpropertyhandler.pkg	Wed Sep 01 12:29:57 2010 +0100
@@ -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: 
+;
+
+;
+; UID is the dll's UID
+;
+#{"vccpropertyhandler DLL"},(0x01AE6B0E),1,0,0
+
+
+;Localised Vendor name
+%{"Vendor-EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\vccpropertyhandler.dll"		  -"!:\system\libs\vccpropertyhandler.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccpropertyhandler/src/Rubydebug.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,167 @@
+/*
+* 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:   Debugging utilities implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "rubydebug.h"
+
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#include <f32file.h>
+#endif
+
+// EXTERNAL DATA STRUCTURES
+
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#ifdef _DEBUG // UDEB version:
+_LIT( KSpace, " " );
+_LIT( KColon, ":" );
+_LIT( KFormat, "%02d" );
+_LIT( KFormat2, "%06d" );
+#endif
+#endif
+
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::PrintToFile
+// Method for writing traces to a file.
+// -----------------------------------------------------------------------------
+//
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+
+#ifdef _DEBUG // UDEB version:
+void RRubyDebug::PrintToFile( TRefByValue<const TDesC> aFmt, ... )
+    {
+    _LIT( KRubyLogFileName, "c:\\Data\\Logs\\RubyTrace_vccuiproperty.txt" );
+
+    const TInt KRubyDebugMaxLineLength = 0x84; // rest will be truncated
+
+    const TInt KRubyDebugOpenFileRetries = 100;
+    const TInt KRubyDebugOpenFileInterval = 1000;
+
+    const TUint16 KRubyDebugLineSep1 = 0x0d;
+    const TUint16 KRubyDebugLineSep2 = 0x0a;
+
+    // Handle variable argument list
+    VA_LIST list;
+	VA_START( list, aFmt );
+	TBuf<KRubyDebugMaxLineLength+2> aBuf;
+    TTruncateOverflow overflow;
+    
+    // Append the time...
+    TTime currentTime;
+    currentTime.HomeTime();
+    TDateTime dateTime = currentTime.DateTime();
+
+    aBuf.AppendFormat( KFormat, dateTime.Hour() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat, dateTime.Minute() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat, dateTime.Second() );
+    aBuf.Append( KColon );
+
+    aBuf.AppendFormat( KFormat2, dateTime.MicroSecond() );
+    aBuf.Append( KSpace );
+    // time done
+    
+	aBuf.AppendFormatList( aFmt, list, &overflow );
+	if( aBuf.Length() > ( KRubyDebugMaxLineLength - 2 ) )
+		{
+		aBuf.Delete(aBuf.Length() - 2, 2);
+		}
+	
+    // Add linefeed characters
+    aBuf.Append( KRubyDebugLineSep1 );
+    aBuf.Append( KRubyDebugLineSep2 );
+
+    RFs fs;
+    if ( fs.Connect() == KErrNone )
+        {
+        RFile file;
+
+        // Open file in an exclusive mode so that only one thread 
+        // can acess it simultaneously
+        TUint fileMode = EFileWrite | EFileShareExclusive;
+
+        TInt err = file.Open( fs, KRubyLogFileName, fileMode );
+
+        // Create a file if it doesn't exist
+        if ( err == KErrNotFound )
+            {
+            err = file.Create( fs, KRubyLogFileName, fileMode );
+            }
+        else
+            {
+            // Error in opening the file
+            TInt retryCount = KRubyDebugOpenFileRetries;
+            while ( err == KErrInUse && retryCount-- )
+                {
+                // Some other tread is accessing the file, wait a while...
+                User::After( KRubyDebugOpenFileInterval );
+                err = file.Open( fs, KRubyLogFileName, fileMode );
+                }
+            }
+
+        // Check if we have access to a file
+        if ( err == KErrNone )
+            {
+            TInt offset = 0;
+            if ( file.Seek( ESeekEnd, offset ) == KErrNone )
+                {
+                // Append text to the end of file
+                TPtr8 ptr8( (TUint8*)aBuf.Ptr(), aBuf.Size(), aBuf.Size() );
+                file.Write( ptr8 );
+                }
+            file.Close();
+            }
+
+        fs.Close();
+        }
+    }
+
+#else // UREL version:
+void RRubyDebug::PrintToFile( TRefByValue<const TDesC> /*aFmt*/, ... )
+    {
+    }
+#endif
+
+#endif // __RUBY_DEBUG_TRACES_TO_FILE
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccpropertyhandler/src/vccuipropertyhandlerdllmain.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* 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:   main class for dll
+*
+*/
+
+
+
+#include <e32std.h>		 // GLDEF_C
+
+#ifndef EKA2 // for EKA1 only
+
+EXPORT_C TInt E32Dll(TDllReason /*aReason*/)
+// Called when the DLL is loaded and unloaded. Note: have to define
+// epoccalldllentrypoints in MMP file to get this called in THUMB.
+	{
+	return KErrNone;
+	}
+	
+
+#endif
+		
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccpropertyhandler/src/vccuipsproperty.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   VCC property manager on the UI side
+*
+*/
+
+
+
+#include <e32cmn.h>
+#include <vccsubscribekeys.h>
+
+#include "vccuipsproperty.h"
+#include "rubydebug.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CVccUiPsProperty::CVccUiPsProperty()
+    {
+    RUBY_DEBUG_BLOCK( "CVccUiPsProperty::CVccUiPsProperty" );
+    }
+
+// ---------------------------------------------------------------------------
+// 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CVccUiPsProperty::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccUiPsProperty::ConstructL" );
+
+    DefineKeysL();
+    CreateHandlesL();
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVccUiPsProperty* CVccUiPsProperty::NewL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccUiPsProperty::NewL" );
+
+    CVccUiPsProperty* self = new ( ELeave ) CVccUiPsProperty();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVccUiPsProperty::~CVccUiPsProperty()
+    {
+    RUBY_DEBUG0( "CVccUiPsProperty::~CVccUiPsProperty() - ENTER" );
+    iHoRequestKey.Close();
+    RUBY_DEBUG0( "CVccUiPsProperty::~CVccUiPsProperty() - EXIT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the value of a VCC property
+// ---------------------------------------------------------------------------
+//
+
+EXPORT_C void CVccUiPsProperty::NotifySubscriberL( TVccHoRequest aValue )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccUiPsProperty::NotifySubscriberL" );
+    RUBY_DEBUG1( " -value [%d]", aValue);
+
+    TVccHoRequest currVal;
+
+    GetCurrentRequest( currVal );
+
+    RUBY_DEBUG1( " -current value [%d]", currVal);
+
+    switch( aValue )
+        {
+        case EVccNoRequestOngoing:
+        case EVccManualStartCsToPsHoRequest:
+        case EVccManualCancelCsToPsHoRequest:
+        case EVccManualStartPsToCsHoRequest:
+        case EVccManualCancelPsToCsHoRequest:
+        case EVccAutomaticStartCsToPsHoRequest:
+        case EVccAutomaticStartCsToPsHoRequestIfSingleCall:    
+        case EVccAutomaticCancelCsToPsHoRequest:
+        case EVccAutomaticStartPsToCsHoRequest:
+        case EVccAutomaticStartPsToCsHoRequestIfSingleCall:
+        case EVccAutomaticCancelPsToCsHoRequest:        
+            {
+            RUBY_DEBUG0( " -setting key");
+
+            User::LeaveIfError( iHoRequestKey.Set( aValue ));
+
+            break;
+            }
+
+        case EVccUndefinedRequest:
+        default:
+            {
+            RUBY_DEBUG0( " -Undefined key!!");
+
+            User::Leave( KErrNotFound );
+
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the value of a VCC property
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVccUiPsProperty::GetCurrentRequest(  TVccHoRequest& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccUiPsProperty::GetCurrentRequest" );
+
+    TInt value(0);
+    TInt err = iHoRequestKey.Get( value );
+    aValue = static_cast<TVccHoRequest>( value );
+
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Deletes the keys used by ui
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVccUiPsProperty::DeleteKeys()
+    {
+    RUBY_DEBUG_BLOCK( "CVccUiPsProperty::DeleteKeys" );
+
+    iHoRequestKey.Close();
+    TInt err = RProperty::Delete( KPSVccPropertyCategory, KVccPropKeyHoRequest );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Defines the keys the UI can update
+// ---------------------------------------------------------------------------
+//
+void CVccUiPsProperty::DefineKeysL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccUiPsProperty::DefineKeysL" );
+
+    RProcess myProcess;
+
+    _LIT_SECURITY_POLICY_PASS( KPassReadPolicy );
+    _LIT_SECURITY_POLICY_S0( KAllowSidPolicy, myProcess.SecureId() );
+
+    TInt err = RProperty::Define( KPSVccPropertyCategory,
+                                  KVccPropKeyHoRequest,
+                                  RProperty::EInt,
+                                  KPassReadPolicy,
+                                  KAllowSidPolicy );
+
+    if ( err != KErrNone && err != KErrAlreadyExists )
+        {
+        User::Leave( err );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Defines the keys the UI can update
+// ---------------------------------------------------------------------------
+//
+void CVccUiPsProperty::CreateHandlesL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccUiPsProperty::CreateHandlesL" );
+
+    User::LeaveIfError( iHoRequestKey.Attach( KPSVccPropertyCategory,
+              KVccPropKeyHoRequest ));
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccpropertyhandler/src/vccuipspropertylistener.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Observes the state of a Vcc P&S property
+*
+*/
+
+
+#include <e32cmn.h>
+#include <e32debug.h>
+#include <vccsubscribekeys.h>
+
+#include "vccuipspropertylistener.h"
+#include "rubydebug.h"
+
+// ======== MEMBER FUNCTIONS ========
+// -----------------------------------------------------------------------------
+// C++ constructor
+// -----------------------------------------------------------------------------
+//
+CVccUiPsPropertyListener::CVccUiPsPropertyListener( const TUint aKeyId )
+    :CActive( EPriorityStandard ),
+     iCategoryId( KPSVccPropertyCategory ),
+     iKeyId( aKeyId )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// 2nd phase constructor
+// -----------------------------------------------------------------------------
+//
+void CVccUiPsPropertyListener::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccUiPsPropertyListener::ConstructL" );
+    // Attach to categroy and key.
+    User::LeaveIfError( iProperty.Attach( iCategoryId, iKeyId ) );
+    // Add to active scheduler
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// Constructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVccUiPsPropertyListener* CVccUiPsPropertyListener::NewL(
+    const TUint aKeyId )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccUiPsPropertyListener::NewL" );
+
+    CVccUiPsPropertyListener* self = new ( ELeave ) CVccUiPsPropertyListener(
+                                                    aKeyId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CVccUiPsPropertyListener::~CVccUiPsPropertyListener()
+    {
+    RUBY_DEBUG0( "CVccUiPsPropertyListener::~CVccUiPsPropertyListener() - ENTER" );
+    Cancel();
+    iProperty.Close();
+    iObservers.Close();
+    RUBY_DEBUG0( "CVccUiPsPropertyListener::~CVccUiPsPropertyListener() - EXIT" );
+    }
+
+// -----------------------------------------------------------------------------
+// Adds a Vcc property observer to the list of observers
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccUiPsPropertyListener::AddObserverL(
+    MVccPsPropertyListenerObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCKL( "CVccUiPsPropertyListener::AddObserverL" );
+
+    if ( iObservers.Find( &aObserver ) == KErrNotFound )
+        {
+        User::LeaveIfError( iObservers.Append( &aObserver ) );
+        }
+    
+    // And then start. Start() do not start if there are no observers
+    // so we must also try to start here after adding an observer
+    // (if somebody has called Start() before this method).
+    Start();
+    }
+
+// -----------------------------------------------------------------------------
+// Removes observer
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccUiPsPropertyListener::RemoveObserver(
+    MVccPsPropertyListenerObserver& aObserver )
+    {
+    RUBY_DEBUG_BLOCK( "CVccUiPsPropertyListener::RemoveObserver" );
+    TInt index = iObservers.Find( &aObserver );
+
+    if ( index != KErrNotFound )
+        {
+        iObservers.Remove( index );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Fetches the current value of the key
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CVccUiPsPropertyListener::CurrentValue()
+    {
+    RUBY_DEBUG_BLOCK( "CVccUiPsPropertyListener::CurrentValue" );
+    TInt value( KErrNotFound );
+    iProperty.Get( iCategoryId, iKeyId, value );
+    return value;
+    }
+
+// -----------------------------------------------------------------------------
+// Subscribes to property
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CVccUiPsPropertyListener::Start()
+    {
+    RUBY_DEBUG_BLOCK( "CVccUiPsPropertyListener::Start" );
+
+    // If no obsevers, do not start.
+    if ( iObservers.Count() == 0 )
+        {
+        return;
+        }
+    
+    // Subscribe to get updates.
+    if ( !IsActive() )
+        {
+        iProperty.Subscribe( iStatus );       
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Cancels the outstanding subsription request
+// -----------------------------------------------------------------------------
+//
+void CVccUiPsPropertyListener::DoCancel()
+    {
+    RUBY_DEBUG0( "CVccUiPsPropertyListener::DoCancel - ENTER" );
+    iProperty.Cancel();
+    RUBY_DEBUG0( "CVccUiPsPropertyListener::DoCancel - EXIT" );
+    }
+
+// -----------------------------------------------------------------------------
+// Handles the request completion event
+// -----------------------------------------------------------------------------
+//
+void CVccUiPsPropertyListener::RunL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccUiPsPropertyListener::RunL" );
+    TInt err = iStatus.Int();
+
+    // Re-issue the subscription request if there are observers.
+    // Do this before notifying our observser so that we get all
+    // notifications (if the rest of the RunL takes some time).
+    
+    if ( iObservers.Count() > 0 )
+        {
+        Start();
+        }
+     
+    if ( KErrNone == err )
+        {
+        // Notify property changes to observers.
+        NotifyObserversL();
+        }    
+     }
+
+// -----------------------------------------------------------------------------
+// Notifies all observers about the changed value
+// -----------------------------------------------------------------------------
+//
+void CVccUiPsPropertyListener::NotifyObserversL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccUiPsPropertyListener::NotifyObserversL" );
+
+    TInt value = CurrentValue();
+
+    RUBY_DEBUG1( " -value[%d]", value);
+
+    for ( TInt i(0) ; i < iObservers.Count() ; i++ )
+        {
+        MVccPsPropertyListenerObserver* observer = iObservers[i];
+
+        if ( observer )
+            {
+            observer->VccPropertyChangedL( iKeyId, value );
+            }
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccutils/bwins/vccutilsu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,48 @@
+EXPORTS
+	?SetDtCsToPsAllowedL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 1 NONAME ; void CVccSPSettings::SetDtCsToPsAllowedL(class TDesC16 const &)
+	?FindPropertyL@CVccSPSettings@@QAEHIW4TServicePropertyName@@AAVCSPProperty@@@Z @ 2 NONAME ; int CVccSPSettings::FindPropertyL(unsigned int, enum TServicePropertyName, class CSPProperty &)
+	?FindServiceEntryL@CVccSPSettings@@QAEXABVTDesC16@@AAVCSPEntry@@@Z @ 3 NONAME ; void CVccSPSettings::FindServiceEntryL(class TDesC16 const &, class CSPEntry &)
+	?SetDtCsHoTresholdL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 4 NONAME ; void CVccSPSettings::SetDtCsHoTresholdL(class TDesC16 const &)
+	?SetDtWlanHoHysteresisTimerLowL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 5 NONAME ; void CVccSPSettings::SetDtWlanHoHysteresisTimerLowL(class TDesC16 const &)
+	?SetDtHeldWaitingCallsAllowedL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 6 NONAME ; void CVccSPSettings::SetDtHeldWaitingCallsAllowedL(class TDesC16 const &)
+	?VoipServiceId@CVccSPSettings@@QAEHXZ @ 7 NONAME ; int CVccSPSettings::VoipServiceId(void)
+	?ProviderId@CVccSPSettings@@QAEABVTDesC16@@XZ @ 8 NONAME ; class TDesC16 const & CVccSPSettings::ProviderId(void)
+	?PreferredDomainL@CVccSPSettings@@QAEHXZ @ 9 NONAME ; int CVccSPSettings::PreferredDomainL(void)
+	?SetDtWlanHoTresholdL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 10 NONAME ; void CVccSPSettings::SetDtWlanHoTresholdL(class TDesC16 const &)
+	?PsHoTresholdL@CVccSPSettings@@QAEHXZ @ 11 NONAME ; int CVccSPSettings::PsHoTresholdL(void)
+	??1CVccSPSettings@@UAE@XZ @ 12 NONAME ; CVccSPSettings::~CVccSPSettings(void)
+	?CsHoHysteresisTimerHighL@CVccSPSettings@@QAEHXZ @ 13 NONAME ; int CVccSPSettings::CsHoHysteresisTimerHighL(void)
+	?SetProviderIdL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 14 NONAME ; void CVccSPSettings::SetProviderIdL(class TDesC16 const &)
+	?SetImmediateDtL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 15 NONAME ; void CVccSPSettings::SetImmediateDtL(class TDesC16 const &)
+	?PsHoHysteresisTimerHighL@CVccSPSettings@@QAEHXZ @ 16 NONAME ; int CVccSPSettings::PsHoHysteresisTimerHighL(void)
+	?SetDtCsHoHysteresisTimerHighL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 17 NONAME ; void CVccSPSettings::SetDtCsHoHysteresisTimerHighL(class TDesC16 const &)
+	?SetVoipServiceIdL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 18 NONAME ; void CVccSPSettings::SetVoipServiceIdL(class TDesC16 const &)
+	?SetPreferredDomainL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 19 NONAME ; void CVccSPSettings::SetPreferredDomainL(class TDesC16 const &)
+	?DtAllowedWhenCsOriginatedL@CVccSPSettings@@QAEHXZ @ 20 NONAME ; int CVccSPSettings::DtAllowedWhenCsOriginatedL(void)
+	?SetVdnL@CVccSPSettings@@QAEHABVTDesC16@@@Z @ 21 NONAME ; int CVccSPSettings::SetVdnL(class TDesC16 const &)
+	?SetDtCsHoHysteresisL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 22 NONAME ; void CVccSPSettings::SetDtCsHoHysteresisL(class TDesC16 const &)
+	?PsHoHysteresisTimerLowL@CVccSPSettings@@QAEHXZ @ 23 NONAME ; int CVccSPSettings::PsHoHysteresisTimerLowL(void)
+	?URIValidL@TVCCMiscUtils@@SAHABVTDesC16@@@Z @ 24 NONAME ; int TVCCMiscUtils::URIValidL(class TDesC16 const &)
+	?DtHeldWaitingCallsAllowedL@CVccSPSettings@@QAEHXZ @ 25 NONAME ; int CVccSPSettings::DtHeldWaitingCallsAllowedL(void)
+	?SetDtWlanHoHysteresisL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 26 NONAME ; void CVccSPSettings::SetDtWlanHoHysteresisL(class TDesC16 const &)
+	?SetVdiL@CVccSPSettings@@QAEHABVTDesC16@@@Z @ 27 NONAME ; int CVccSPSettings::SetVdiL(class TDesC16 const &)
+	?SetDtCsHoHysteresisTimerLowL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 28 NONAME ; void CVccSPSettings::SetDtCsHoHysteresisTimerLowL(class TDesC16 const &)
+	?SetServiceNameL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 29 NONAME ; void CVccSPSettings::SetServiceNameL(class TDesC16 const &)
+	?ConvertToIntL@CVccSPSettings@@QAEHABVTDesC16@@@Z @ 30 NONAME ; int CVccSPSettings::ConvertToIntL(class TDesC16 const &)
+	?NewL@CVccSPSettings@@SAPAV1@XZ @ 31 NONAME ; class CVccSPSettings * CVccSPSettings::NewL(void)
+	?CsHoHysteresisL@CVccSPSettings@@QAEHXZ @ 32 NONAME ; int CVccSPSettings::CsHoHysteresisL(void)
+	?CsHoHysteresisTimerLowL@CVccSPSettings@@QAEHXZ @ 33 NONAME ; int CVccSPSettings::CsHoHysteresisTimerLowL(void)
+	?DtPsToCsAllowedL@CVccSPSettings@@QAEHXZ @ 34 NONAME ; int CVccSPSettings::DtPsToCsAllowedL(void)
+	?SetDtAllowedWhenCsOriginated@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 35 NONAME ; void CVccSPSettings::SetDtAllowedWhenCsOriginated(class TDesC16 const &)
+	?ReadSettingsL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 36 NONAME ; void CVccSPSettings::ReadSettingsL(class TDesC16 const &)
+	?SetVoipServiceIdL@CVccSPSettings@@QAEXH@Z @ 37 NONAME ; void CVccSPSettings::SetVoipServiceIdL(int)
+	?VDNValidL@TVCCMiscUtils@@SAHABVTDesC16@@@Z @ 38 NONAME ; int TVCCMiscUtils::VDNValidL(class TDesC16 const &)
+	?SetDtPsToCsAllowedL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 39 NONAME ; void CVccSPSettings::SetDtPsToCsAllowedL(class TDesC16 const &)
+	?PsHoHysteresisL@CVccSPSettings@@QAEHXZ @ 40 NONAME ; int CVccSPSettings::PsHoHysteresisL(void)
+	?DtCsToPsAllowedL@CVccSPSettings@@QAEHXZ @ 41 NONAME ; int CVccSPSettings::DtCsToPsAllowedL(void)
+	?ImmediateDtL@CVccSPSettings@@QAEHXZ @ 42 NONAME ; int CVccSPSettings::ImmediateDtL(void)
+	?SetDtWlanHoHysteresisTimerHighL@CVccSPSettings@@QAEXABVTDesC16@@@Z @ 43 NONAME ; void CVccSPSettings::SetDtWlanHoHysteresisTimerHighL(class TDesC16 const &)
+	?StoreL@CVccSPSettings@@QAEXXZ @ 44 NONAME ; void CVccSPSettings::StoreL(void)
+	?CsHoTresholdL@CVccSPSettings@@QAEHXZ @ 45 NONAME ; int CVccSPSettings::CsHoTresholdL(void)
+	?ServiceName@CVccSPSettings@@QAEABVTDesC16@@XZ @ 46 NONAME ; class TDesC16 const & CVccSPSettings::ServiceName(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccutils/eabi/vccutilsU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,52 @@
+EXPORTS
+	_ZN13TVCCMiscUtils9URIValidLERK7TDesC16 @ 1 NONAME
+	_ZN13TVCCMiscUtils9VDNValidLERK7TDesC16 @ 2 NONAME
+	_ZN14CVccSPSettings10ProviderIdEv @ 3 NONAME
+	_ZN14CVccSPSettings11ServiceNameEv @ 4 NONAME
+	_ZN14CVccSPSettings12ImmediateDtLEv @ 5 NONAME
+	_ZN14CVccSPSettings13ConvertToIntLERK7TDesC16 @ 6 NONAME
+	_ZN14CVccSPSettings13CsHoTresholdLEv @ 7 NONAME
+	_ZN14CVccSPSettings13FindPropertyLEj20TServicePropertyNameR11CSPProperty @ 8 NONAME
+	_ZN14CVccSPSettings13PsHoTresholdLEv @ 9 NONAME
+	_ZN14CVccSPSettings13ReadSettingsLERK7TDesC16 @ 10 NONAME
+	_ZN14CVccSPSettings13VoipServiceIdEv @ 11 NONAME
+	_ZN14CVccSPSettings14SetProviderIdLERK7TDesC16 @ 12 NONAME
+	_ZN14CVccSPSettings15CsHoHysteresisLEv @ 13 NONAME
+	_ZN14CVccSPSettings15PsHoHysteresisLEv @ 14 NONAME
+	_ZN14CVccSPSettings15SetImmediateDtLERK7TDesC16 @ 15 NONAME
+	_ZN14CVccSPSettings15SetServiceNameLERK7TDesC16 @ 16 NONAME
+	_ZN14CVccSPSettings16DtCsToPsAllowedLEv @ 17 NONAME
+	_ZN14CVccSPSettings16DtPsToCsAllowedLEv @ 18 NONAME
+	_ZN14CVccSPSettings16PreferredDomainLEv @ 19 NONAME
+	_ZN14CVccSPSettings17FindServiceEntryLERK7TDesC16R8CSPEntry @ 20 NONAME
+	_ZN14CVccSPSettings17SetVoipServiceIdLERK7TDesC16 @ 21 NONAME
+	_ZN14CVccSPSettings17SetVoipServiceIdLEi @ 22 NONAME
+	_ZN14CVccSPSettings18SetDtCsHoTresholdLERK7TDesC16 @ 23 NONAME
+	_ZN14CVccSPSettings19SetDtCsToPsAllowedLERK7TDesC16 @ 24 NONAME
+	_ZN14CVccSPSettings19SetDtPsToCsAllowedLERK7TDesC16 @ 25 NONAME
+	_ZN14CVccSPSettings19SetPreferredDomainLERK7TDesC16 @ 26 NONAME
+	_ZN14CVccSPSettings20SetDtCsHoHysteresisLERK7TDesC16 @ 27 NONAME
+	_ZN14CVccSPSettings20SetDtWlanHoTresholdLERK7TDesC16 @ 28 NONAME
+	_ZN14CVccSPSettings22SetDtWlanHoHysteresisLERK7TDesC16 @ 29 NONAME
+	_ZN14CVccSPSettings23CsHoHysteresisTimerLowLEv @ 30 NONAME
+	_ZN14CVccSPSettings23PsHoHysteresisTimerLowLEv @ 31 NONAME
+	_ZN14CVccSPSettings24CsHoHysteresisTimerHighLEv @ 32 NONAME
+	_ZN14CVccSPSettings24PsHoHysteresisTimerHighLEv @ 33 NONAME
+	_ZN14CVccSPSettings26DtAllowedWhenCsOriginatedLEv @ 34 NONAME
+	_ZN14CVccSPSettings26DtHeldWaitingCallsAllowedLEv @ 35 NONAME
+	_ZN14CVccSPSettings28SetDtAllowedWhenCsOriginatedERK7TDesC16 @ 36 NONAME
+	_ZN14CVccSPSettings28SetDtCsHoHysteresisTimerLowLERK7TDesC16 @ 37 NONAME
+	_ZN14CVccSPSettings29SetDtCsHoHysteresisTimerHighLERK7TDesC16 @ 38 NONAME
+	_ZN14CVccSPSettings29SetDtHeldWaitingCallsAllowedLERK7TDesC16 @ 39 NONAME
+	_ZN14CVccSPSettings30SetDtWlanHoHysteresisTimerLowLERK7TDesC16 @ 40 NONAME
+	_ZN14CVccSPSettings31SetDtWlanHoHysteresisTimerHighLERK7TDesC16 @ 41 NONAME
+	_ZN14CVccSPSettings4NewLEv @ 42 NONAME
+	_ZN14CVccSPSettings6StoreLEv @ 43 NONAME
+	_ZN14CVccSPSettings7SetVdiLERK7TDesC16 @ 44 NONAME
+	_ZN14CVccSPSettings7SetVdnLERK7TDesC16 @ 45 NONAME
+	_ZN14CVccSPSettingsD0Ev @ 46 NONAME
+	_ZN14CVccSPSettingsD1Ev @ 47 NONAME
+	_ZN14CVccSPSettingsD2Ev @ 48 NONAME
+	_ZTI14CVccSPSettings @ 49 NONAME ; #<TI>#
+	_ZTV14CVccSPSettings @ 50 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccutils/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,36 @@
+/*
+* 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:   Build information file for project ?myapp
+*
+*/
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+vccutils.mmp
+
+
+PRJ_TESTMMPFILES
+//../internal/tsrc/group/ut_vccutilstest.mmp
+
+GNUMAKEFILE test_mover.make
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccutils/group/test_mover.make	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,5 @@
+FINAL :
+	echo Copying test DLL to z\sys\bin
+	copy %epocroot%epoc32\release\winscw\udeb\ut_vccutilstest.dll %epocroot%epoc32\release\winscw\UDEB\z\sys\bin /y
+
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES CLEAN BLD SAVESPACE :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccutils/group/vccutils.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   Project definition file for project WpVccAdapter plugin
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+
+TARGET	        vccutils.dll
+TARGETTYPE      DLL
+UID             0x1000008d 0x2000CFB2
+
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          vccmiscutils.cpp
+SOURCE          vccspsettings.cpp         
+SOURCE          rubydebug.cpp 
+
+
+USERINCLUDE     .
+USERINCLUDE     ../inc
+USERINCLUDE     ../../vcc/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY        	euser.lib
+LIBRARY	        bafl.lib
+LIBRARY         inetprotutil.lib
+LIBRARY         centralrepository.lib
+LIBRARY         serviceprovidersettings.lib
+
+//rubydebug
+LIBRARY         efsrv.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccutils/inc/vccmiscutils.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Miscallaneous service functions
+*
+*/
+
+
+
+#ifndef T_VCCMISCUTILS_H
+#define T_VCCMISCUTILS_H
+
+#include <e32des8.h>
+#include <e32des16.h>
+
+/**
+ *  T class for miscallenous service functions
+ *
+ *  @lib vccutils.dll
+ *  @since S60 v3.2
+ */
+class TVCCMiscUtils
+    {
+public:
+
+    /**
+     * Check if reference is valid URI
+     *
+     *  @since S60 v3.2
+     * @param aURI reference to a 16 bit value checked if valid URI
+     * @return KErrNone if the descriptor has been parsed into uri components. 
+     *         EUriUtilsParserErrInvalidUri if the descriptor is an invalid uri.
+     */
+    IMPORT_C static TInt URIValidL( const TDesC16& aURI );
+    
+    /**
+     * Check if reference is valid VDN
+     *
+     *  @since S60 v3.2
+     * @param aVDN reference to a 16 bit value checked if valid VDN
+     * @return ETrue if the descriptor is a valid VDN. 
+     *         EFalse if the descriptor is an invalid VDN.
+     */
+    IMPORT_C static TBool VDNValidL(  const TDesC16& aVDN );
+
+    };
+
+#endif /* T_VCCMISCUTILS_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccutils/inc/vccspsettings.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,609 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   SP settings handler functions for Vcc settings.
+*
+*/
+
+
+
+#ifndef C_VCCSPSETTINGS_H
+#define C_VCCSPSETTINGS_H
+
+// INCLUDES
+#include <e32base.h>
+#include <spdefinitions.h>
+
+#include "vccunittesting.h"
+
+class CWPCharacteristic;
+class CSPEntry;
+class CSPProperty;
+class CSPSettings;
+
+/**
+ * CVccSPSettings handles saving of Vcc settings.
+ *
+ * Settings are received from CVccAdapter (an adapter in Provisioning framework)
+ * and VCC DM Adapter and stored to SPsettings
+ *
+ *  @code
+ *   
+ *    _LIT( KServiceName, "VCC" );
+ *    _LIT( KVdiValue, "sip:2323" );
+ *   
+ *   CVccSPSettings* vccSettings = CVccSPSettings::NewL();
+ *   
+ *   //Store VDI
+ *   vccSettings->SetServiceNameL( KServiceName );
+ *   vccSettings->SetVdiL( KVdiValue );
+ *   vccSettings->StoreL();
+ *
+ *   //Read Preferred domain from store 
+ *   vccSettings->ReadSettingsL( KServiceName );
+ *   TInt prefDom = vccSettings->PreferredDomain();
+ *  
+ *   delete vccSettings;
+ *  @endcode
+ * 
+ * @lib vccutils.dll
+ * @since S60 v3.2
+ */
+class CVccSPSettings : public CBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CVccSPSettings* NewL();
+
+    /**
+    * Destructor.
+    */
+    IMPORT_C virtual ~CVccSPSettings();
+
+    /**
+     * Saves Vcc settings.
+     *
+     * @since S60 3.2
+     */
+    IMPORT_C void StoreL();
+
+    /**
+     * Returns provider name of stored settings
+     *
+     * @since S60 3.2
+     * @return Constant descriptor reference to name of stored settings
+     */
+    IMPORT_C const TDesC& ProviderId();
+
+    /**
+     * Sets name of stored settings
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetProviderIdL( const TDesC& aValue );
+
+    /**
+     * Sets name of stored settings
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetServiceNameL( const TDesC& aValue );
+    
+    /**
+     * Sets name of stored settings
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C const TDesC& ServiceName();
+    
+    /**
+     * Sets VDI
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     * @return KErrNone if VDN is valid and set into member variable,
+     *         Symbian error code if VDN is not valid thus not set into member 
+     *         variable, otherwise leaves in system error cases.
+     */
+    IMPORT_C TInt SetVdiL( const TDesC& aValue );
+
+    /**
+     * Sets VDN
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     * @return ETrue if VDN is valid and set into member variable,
+     *         EFalse if VDN is not valid thus not set into member variable,
+     *         otherwise leaves in system error cases.
+     */
+    IMPORT_C TBool SetVdnL( const TDesC& aValue );
+
+    /**
+     * Sets preferred domain
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetPreferredDomainL( const TDesC& aValue );
+    
+    /**
+     * Sets immediate domain transfer
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetImmediateDtL( const TDesC& aValue );
+
+    /**
+     * Sets Domain transfer from CS to Ps is allowed
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetDtCsToPsAllowedL( const TDesC& aValue );
+
+    /**
+     * Sets Domain transfer from PS to CS is allowed
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetDtPsToCsAllowedL( const TDesC& aValue );
+
+    /**
+     * Sets domain transfer allowed while held and waiting calls 
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetDtHeldWaitingCallsAllowedL( const TDesC& aValue );
+    
+    /**
+     * Sets WLAN handover treshold value 
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetDtWlanHoTresholdL( const TDesC& aValue );
+   
+    /**
+     * Sets WLAN handover hysteresis value  
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetDtWlanHoHysteresisL( const TDesC& aValue );
+   
+    /**
+     * Sets WLAN handover hysteresis timer for low limit 
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetDtWlanHoHysteresisTimerLowL( const TDesC& aValue );
+   
+    /**
+     * Sets WLAN handover hysteresis timer for high limit 
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetDtWlanHoHysteresisTimerHighL( const TDesC& aValue );
+   
+    /**
+     * Sets CS handover treshold value 
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetDtCsHoTresholdL( const TDesC& aValue );
+   
+    /**
+     * Sets CS handover hysteresis value  
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetDtCsHoHysteresisL( const TDesC& aValue );
+   
+    /**
+     * Sets CS handover hysteresis timer for low limit 
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetDtCsHoHysteresisTimerLowL( const TDesC& aValue );
+   
+    /**
+     * Sets CS handover hysteresis timer for high limit 
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetDtCsHoHysteresisTimerHighL( const TDesC& aValue );
+   
+    /**
+     * Sets Voip service id 
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+    IMPORT_C void SetVoipServiceIdL( const TDesC& aValue );
+
+    /**
+     * Sets Voip service id 
+     *
+     * @since S60 3.2
+     * @param aValue Given value
+     */
+	IMPORT_C void SetVoipServiceIdL( TInt aValue );
+
+    
+    /**
+     * Converts given TDesC value to TInt.
+     *
+     * @param aValue     value to be converted
+     * @return the TInt value
+     */
+     IMPORT_C TInt ConvertToIntL( const TDesC& aValue );
+
+     /**
+      * Finds entry from service provider settings with given service name.
+      *
+      * @param aServiceName     name of the service entry
+      * @param aServiceEntry    entry which will contain current properties 
+      */
+      IMPORT_C void FindServiceEntryL( const TDesC& aServiceName, 
+                                       CSPEntry& aServiceEntry );
+      
+      /**
+       * Finds property data from SP Settings table.
+       *
+       * @since S60 3.2 
+       * @param aServiceId       Service ID 
+       * @param aPropertyName    name of the property
+       * @param aProperty        Property to store data
+       * @return error code 
+       */
+      IMPORT_C TInt FindPropertyL( TServiceId aServiceId, 
+                                   TServicePropertyName aPropertyName,
+                                   CSPProperty& aProperty );      
+    
+      /**
+       * Searches service entry with given name and sets found values to
+       *   
+       *
+       * @since S60 3.2
+       * @param aValue Given value
+       */
+      IMPORT_C void ReadSettingsL( const TDesC& aServiceName );
+       
+      /**
+       * Gets preferred domain
+       *
+       * @since S60 3.2
+       * @return current value 
+       */
+      IMPORT_C TInt PreferredDomainL();
+    
+      /**
+       * Gets immediate domain transfer
+       *
+       * @since S60 3.2
+       * @return current value 
+       */
+      IMPORT_C TInt ImmediateDtL();
+
+      /**
+       * Gets Domain transfer from CS to Ps is allowed
+       *
+       * @since S60 3.2
+       */
+      IMPORT_C TInt DtCsToPsAllowedL();
+
+      /**
+       * Gets Domain transfer from PS to CS is allowed
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt DtPsToCsAllowedL();
+
+      /**
+       * Gets domain transfer allowed while held and waiting calls 
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt DtHeldWaitingCallsAllowedL();
+   
+      /**
+       * Threshold for good signal level ? in GSM
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt CsHoTresholdL();
+      
+      /**
+       * GSM hysterisis value
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt CsHoHysteresisL();
+      
+      /**
+       * GSM hysterisis timer low signal 
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt CsHoHysteresisTimerLowL();
+      
+      /**
+       * GSM hysterisis timer value for high signal   
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt CsHoHysteresisTimerHighL();
+      /**
+       * Threshold for good signal level ? in WLAN
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt PsHoTresholdL();
+      
+      /**
+       * WLAN hysterisis value
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt PsHoHysteresisL();
+      
+      /**
+       * WLAN hysterisis timer low signal 
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt PsHoHysteresisTimerLowL();
+      
+      /**
+       * WLAN hysterisis timer value for high signal   
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt PsHoHysteresisTimerHighL();
+      
+      /**
+       * Voip service which is used by VCC    
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt VoipServiceId();
+      
+      /**
+       * Is handover allowed when CS originated original call
+       *
+       * @since S60 3.2
+       * @return current value
+       */
+      IMPORT_C TInt DtAllowedWhenCsOriginatedL();
+      
+      IMPORT_C void SetDtAllowedWhenCsOriginated( const TDesC& aValue );
+
+private:
+    VCC_UNITTEST( T_WpVccAdapter )
+    VCC_UNITTEST( T_CVccSPSettings )
+
+    /**
+    * Symbian 2nd phase constructor
+    */
+    void ConstructL();
+
+    /**
+    * C++ Constructor
+    */
+    CVccSPSettings();
+    
+    /**
+    * Adds new integer type property or updates the old property 
+    * of the given service entry
+    *
+    * @param aServiceEntry    entry which contains the properties 
+    * @param aName            name of the property
+    * @param aValue           value of the property
+    */    
+    void AddOrUpdatePropertyL( CSPEntry& aServiceEntry, 
+                               const TServicePropertyName aName, 
+                               TInt aValue );
+    /**
+    * Adds new desc type property or updates the old property 
+    * of the given service entry
+    *
+    * @param aServiceEntry    entry which contains the properties 
+    * @param aName            name of the property
+    * @param aValue           value of the property
+    */                               
+    void AddOrUpdatePropertyL( CSPEntry& aServiceEntry, 
+                               const TServicePropertyName aName, 
+                               const TDesC& aValue );
+    /**
+    * Finds the given property and extracts it's TInt value.
+    *
+    * @param aServiceEntry    entry which contains the properties 
+    * @param aPropertyName    name of the property 
+    * @param aValue           value of the property
+    */  
+    TInt GetPropertyValue( CSPEntry& aServiceEntry, 
+                            const TServicePropertyName& aPropertyName,
+                            TInt& aValue );     
+    TInt GetPropertyValue( CSPEntry& aServiceEntry, 
+                                const TServicePropertyName& aPropertyName,
+                                TDes& aValue );     
+    /**
+    * Change provider UID and set bootstrap -bit on in VoIP profile
+    *
+    */ 
+    void ModifyVoipProfileL();
+
+private:
+
+    VCC_UNITTEST( T_CWPVccItem )
+    VCC_UNITTEST( T_CVccSPSettings )
+
+    /**
+     * Provider id vcc settings 
+     * Own.
+     */
+    HBufC* iProviderId;
+    
+    /**
+     * service name vcc settings 
+     * Own.
+     */
+    HBufC* iServiceName;
+    
+    /**
+     * service id
+     */
+    TServiceId iServiceId;
+
+    /**
+     * VDI
+     * Own.
+     */
+    HBufC* iVdi;
+
+    /**
+     * VDI
+     * Own.
+     */
+    HBufC* iVdn;
+
+    /**
+     * Preferred Domain
+     * Own.
+     */
+    HBufC* iPreferredDomain;
+    
+    /**
+     * Immediate Domain transfer
+     * Own.
+     */
+    HBufC* iImmediateDt;
+    
+    /**
+     * Domain transfer from CS to PS allowed
+     * Own.
+     */    
+    HBufC* iDtCsToPsAllowed;
+    
+    /**
+     * Domain transfer from PS to CS allowed
+     * Own.
+     */    
+    HBufC* iDtPsToCsAllowed;
+    
+    /**
+     * Domain transfer allowed while Held/Waiting calls 
+     * Own.
+     */    
+    HBufC* iDtHeldWaitingCallsAllowed;
+   
+    /**
+     *  WLAN HO treshold value
+     * Own.
+     */    
+    HBufC* iDtWlanHoTreshold;
+   
+    /**
+     *  WLAN HO hysteresis
+     * Own.
+     */    
+    HBufC* iDtWlanHoHysteresis;
+    
+    /**
+     *  WLAN HO hysteresis timer used for low limit
+     * Own.
+     */    
+    HBufC* iDtWlanHoHysteresisTimerLow;
+    
+    /**
+     *  WLAN HO hysteresis timer used for high limit
+     * Own.
+     */    
+    HBufC* iDtWlanHoHysteresisTimerHigh;
+    
+    /**
+     * CS HO treshold value
+     * Own.
+     */    
+    HBufC* iDtCsHoTreshold;
+   
+    /**
+     * CS HO hysteresis 
+     * Own.
+     */    
+    HBufC* iDtCsHoHysteresis;
+    
+    /**
+     * CS HO hysteresis timer used for low limit 
+     * Own.
+     */    
+    HBufC* iDtCsHoHysteresisTimerLow;
+    
+    /**
+     *  CS HO hysteresis timer used for high limit
+     * Own.
+     */    
+    HBufC* iDtCsHoHysteresisTimerHigh; 
+   
+    /*
+    * SP settings
+    * Own.
+    */ 
+    CSPSettings* iSettings;
+
+    /**
+	* Voip service id to be used in conjuction with VCC
+	*/
+    TServiceId iVoipServiceId;
+    
+    /*
+    * VoIP service ID
+    * Own.
+    */ 
+    HBufC* iVoipServiceIdString;
+    
+    /*
+    * Is handover allowed when call orginated in CS domain
+    * Own.
+    */ 
+    HBufC* iDtAllowedWhenCsOriginated;
+};
+
+#endif /*C_VCCSPSETTINGS_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccutils/inc/vccunittesting.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Unit testing definitions for VCC
+*
+*/
+
+
+
+#ifndef _VCCUNITTESTING_H_
+#define _VCCUNITTESTING_H_
+
+#ifdef UNIT_TESTING // if unit testing
+
+    #define VCC_UNITTEST( aClassName ) friend class aClassName;
+
+#else
+
+    #define VCC_UNITTEST( aClassName ) 
+
+#endif // UNIT_TESTING
+
+
+#endif // _VCCUNITTESTING_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccutils/src/rubydebug.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,137 @@
+/*
+* 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:   Debugging utilities implementation.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "rubydebug.h"
+
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+#include <f32file.h>
+#endif
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RRubyDebug::PrintToFile
+// Method for writing traces to a file.
+// -----------------------------------------------------------------------------
+//
+#ifdef __RUBY_DEBUG_TRACES_TO_FILE
+
+#ifdef _DEBUG // UDEB version:
+ void RRubyDebug::PrintToFile( TRefByValue<const TDesC> aFmt, ... )
+    {
+    _LIT( KRubyLogFileName, "c:\\Data\\Logs\\rubytrace_vccutils.txt" );
+
+    const TInt KRubyDebugMaxLineLength = 0x80; // rest will be truncated
+
+    const TInt KRubyDebugOpenFileRetries = 100;
+    const TInt KRubyDebugOpenFileInterval = 1000;
+
+    const TUint16 KRubyDebugLineSep1 = 0x0d;
+    const TUint16 KRubyDebugLineSep2 = 0x0a;
+
+    // Handle variable argument list
+    VA_LIST list;
+    VA_START( list, aFmt );
+    TBuf<KRubyDebugMaxLineLength+2> aBuf;
+    TTruncateOverflow overflow;
+    aBuf.AppendFormatList( aFmt, list, &overflow );
+    if( aBuf.Length() > ( KRubyDebugMaxLineLength - 2 ) )
+        {
+        aBuf.Delete(aBuf.Length() - 2, 2);
+        }
+
+    // Add linefeed characters
+    aBuf.Append( KRubyDebugLineSep1 );
+    aBuf.Append( KRubyDebugLineSep2 );
+
+    RFs fs;
+    if ( fs.Connect() == KErrNone )
+        {
+        RFile file;
+
+        // Open file in an exclusive mode so that only one thread
+        // can acess it simultaneously
+        TUint fileMode = EFileWrite | EFileShareExclusive;
+
+        TInt err = file.Open( fs, KRubyLogFileName, fileMode );
+
+        // Create a file if it doesn't exist
+        if ( err == KErrNotFound )
+            {
+            err = file.Create( fs, KRubyLogFileName, fileMode );
+            }
+        else
+            {
+            // Error in opening the file
+            TInt retryCount = KRubyDebugOpenFileRetries;
+            while ( err == KErrInUse && retryCount-- )
+                {
+                // Some other tread is accessing the file, wait a while...
+                User::After( KRubyDebugOpenFileInterval );
+                err = file.Open( fs, KRubyLogFileName, fileMode );
+                }
+            }
+
+        // Check if we have access to a file
+        if ( err == KErrNone )
+            {
+            TInt offset = 0;
+            if ( file.Seek( ESeekEnd, offset ) == KErrNone )
+                {
+                // Append text to the end of file
+                TPtr8 ptr8( (TUint8*)aBuf.Ptr(), aBuf.Size(), aBuf.Size() );
+                file.Write( ptr8 );
+                }
+            file.Close();
+            }
+
+        fs.Close();
+        }
+    }
+
+#else // UREL version:
+ void RRubyDebug::PrintToFile( TRefByValue<const TDesC> /*aFmt*/, ... )
+    {
+    }
+#endif
+
+#endif // __RUBY_DEBUG_TRACES_TO_FILE
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccutils/src/vccmiscutils.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,187 @@
+/*
+* 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 Miscallaneous service functions
+*
+*/
+
+
+
+#include <e32std.h>
+#include <uri8.h>
+#include <uriutils.h>
+#include <authority8.h>
+#include <delimitedpath8.h>
+//#include <e32const.h>
+
+#include "vccmiscutils.h"
+#include "rubydebug.h"
+
+_LIT( KVCCSIPScheme, "sip" );
+_LIT( KVCCSIPSScheme, "sips" );
+_LIT( KVCCHTTPScheme, "http" );
+_LIT( KVCCHTTPSScheme, "https" );
+
+const TUint KAt = '@';
+
+const TInt KVCCMinVDNLength = 5; 
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Checks if 16 bit reference is valid URI (VDI).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt TVCCMiscUtils::URIValidL( const TDesC16& aURI )
+    {
+    RUBY_DEBUG_BLOCK( "TVCCMiscUtils::URIValidL()" );
+    
+    TUriParser parser;
+    // Check if uri contains multiple @ characters
+    TUint atcount( 0 );
+    for( TUint i(0); i<aURI.Length(); i++ )
+        {
+        if(  KAt == aURI[i] )
+             {
+             ++atcount;
+             }
+        }
+    
+    if( atcount>1 )
+       {
+       return KErrUnknown;
+       }
+      
+    
+    // Parse the URI
+    TInt err = parser.Parse( aURI );
+    
+    if ( !err )
+        {
+        // Check for invalid characters
+        // 0x00-0x1F and > 0x7F), space (0x20), delimiter characters ('<', '>', 
+        // '#', '%', '"') and unwise characters ('{', '}', '|', '\', '^', '[', 
+        // ']', '`') are illegal
+        if ( !UriUtils::HasInvalidChars( aURI ) )
+            {
+            // Check if scheme is valid
+            if ( parser.IsSchemeValid() )
+                {
+                // Extract the scheme for comparing
+                const TDesC& scheme = parser.Extract( EUriScheme );
+                
+                // SIP or SIPS scheme
+                if ( scheme.Compare( KVCCSIPScheme ) == 0 || 
+                     scheme.Compare( KVCCSIPSScheme ) == 0 )
+                    {
+                    err = parser.Validate();
+                    }
+                // HTTP or HTTPS scheme
+                else if ( scheme.Compare( KVCCHTTPScheme ) == 0 || 
+                          scheme.Compare( KVCCHTTPSScheme ) == 0 )
+                    {
+                    // Do nothing at the moment.
+                    }
+                else
+                    {
+                    err = KErrUnknown;
+                    }
+                }
+            // No scheme, maybe a host type
+            else
+                {
+                UriUtils::TUriHostType type = UriUtils::HostType( aURI );
+                
+                switch ( type )
+                    {
+                    case UriUtils::EIPv6Host:
+                    case UriUtils::EIPv4Host:
+                    case UriUtils::ETextHost:
+                        break;
+                    default:
+                        {
+                        err = KErrUnknown;
+                        break;
+                        }
+                    } // switch
+                } // else
+            } // if invalid characters
+        else
+            {
+            err = KErrNotSupported;
+            }
+        }
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Checks if reference is valid VDN.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool TVCCMiscUtils::VDNValidL(  const TDesC16& aVDN )
+    {
+    RUBY_DEBUG_BLOCK( "TVCCMiscUtils::VDNValidL()" );
+    
+    TBool retVal( ETrue );
+    TLex input( aVDN );
+    TInt numCount( 0 );
+    
+    // Is the string empty
+    if ( aVDN.Length() > 0 )
+        {
+        input.Mark();
+        
+        // Deal with the '+' -sign at the beginning of the string
+        if (input.Peek() == '+')
+            {
+            // Step forward
+            input.Inc();
+            }
+      
+        for ( ;; numCount++ )
+            {
+            if ( !( input.Peek().IsDigit() ) && !( input.Peek().Eos() ) )
+                {
+                // Next character is not a digit or end-of-string character
+                retVal = EFalse;
+                break;
+                }
+            else if ( input.Peek().Eos() && numCount < KVCCMinVDNLength )
+                {
+                // End of string but number count is too small to be a valid VDN
+                retVal = EFalse;
+                break;
+                }
+            else if ( input.Peek().Eos() && numCount >= KVCCMinVDNLength )
+                {
+                // At the end of string and number count is acceptable to be a
+                // valid VDN
+                break;
+                }
+            else
+                {
+                // step forward
+                input.Inc();                
+                }
+            } // for
+        }
+    else
+        {
+        // Empty string
+        retVal = EFalse;
+        }
+    
+    return retVal;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/callcontinuity/vccutils/src/vccspsettings.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1083 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   SP Settings handler for Vcc settings, handles caching and 
+                 storing data related to Vcc settings.
+*
+*/
+
+
+
+#include <charconv.h>
+#include <in_sock.h>
+#include <spsettings.h>
+#include <spentry.h>
+#include <spproperty.h>
+#include <badesca.h>
+#include <e32cmn.h>
+
+#include "vccspsettings.h"
+#include "vccmiscutils.h"
+#include "rubydebug.h"
+
+/** VCC call provider plugin uid */
+const TInt32 KVccCallProviderPlugId = 0x2000CFAA; 
+
+/** Zero ID */
+const TUint KVccZeroId = 0;
+
+/** Service Id string length */
+const TInt KVccServiceIdLength = 8;
+
+/** Names array size */
+const TInt KVccNameArraySize = 10;
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// C++ constructor
+// ---------------------------------------------------------------------------
+//
+CVccSPSettings::CVccSPSettings()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase Constructor
+// ---------------------------------------------------------------------------
+//
+void CVccSPSettings::ConstructL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccSPSettings::ConstructL" );
+    iSettings = CSPSettings::NewL();
+    }
+ 
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//   
+EXPORT_C CVccSPSettings* CVccSPSettings::NewL()
+    {
+    RUBY_DEBUG_BLOCKL( "CVccSPSettings::NewL" );
+    
+    CVccSPSettings* self = new ( ELeave ) CVccSPSettings();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVccSPSettings::~CVccSPSettings()
+    {
+    RUBY_DEBUG0( "CVccSPSettings::~CVccSPSettings START" );
+    
+    delete iProviderId;
+    delete iServiceName;
+    delete iVdi;
+    delete iVdn;
+    delete iPreferredDomain;
+    delete iImmediateDt;
+    delete iDtCsToPsAllowed;
+    delete iDtPsToCsAllowed;
+    delete iDtHeldWaitingCallsAllowed;
+    delete iDtWlanHoTreshold;
+    delete iDtWlanHoHysteresis;
+    delete iDtWlanHoHysteresisTimerLow;
+    delete iDtWlanHoHysteresisTimerHigh;
+    delete iDtCsHoTreshold;
+    delete iDtCsHoHysteresis;
+    delete iDtCsHoHysteresisTimerLow;
+    delete iDtCsHoHysteresisTimerHigh;
+    delete iVoipServiceIdString;
+    delete iDtAllowedWhenCsOriginated;
+    
+    delete iSettings;
+    RUBY_DEBUG0( "CVccSPSettings::~CVccSPSettings EXIT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Stores cached Vcc settings.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::StoreL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::StoreL" );
+    RUBY_DEBUG1( "CVccSPSettings::StoreL instance %x", this );
+ 
+    CSPEntry* entry = CSPEntry::NewLC();
+    
+    RUBY_DEBUG1( "-service name:[%S]",iServiceName );
+   
+    TInt error( KErrNone );
+    RIdArray serviceids;
+    CleanupClosePushL( serviceids );
+    iSettings->FindServiceIdsL( serviceids );
+    
+    TBool foundEntry( EFalse );
+          
+      //look for VCC service
+      for ( TInt i( 0 ); i < serviceids.Count() && !foundEntry; i++ )
+            {
+            CSPProperty* property = CSPProperty::NewLC(); 
+            error = iSettings->FindPropertyL( serviceids[i], ESubPropertyVccVDI, *property ); 
+   
+            if( error == KErrNone )
+                {
+                RUBY_DEBUG0( "-service found" );
+                iSettings->FindEntryL( serviceids[i], *entry );
+                foundEntry = ETrue;
+                }
+            CleanupStack::PopAndDestroy( property );
+            }
+      
+      if ( !foundEntry ) //if service not found then add new
+          {
+          //add entry fails if name is not set
+           RUBY_DEBUG0( "add new service" ); 
+           entry->SetServiceName( *iServiceName ); 
+           User::LeaveIfError( iSettings->AddEntryL( *entry ));
+          }
+     CleanupStack::PopAndDestroy( &serviceids );
+     iServiceId = entry->GetServiceId();
+
+    ModifyVoipProfileL();
+    
+    TInt err = 0;
+    /*
+    
+    CSPProperty* voipProperty = CSPProperty::NewLC(); 
+    TInt err = iSettings->FindPropertyL( iVoipServiceId, 
+    			EPropertyCallProviderPluginId,
+    			*voipProperty );
+    
+    if( err == KErrNone)
+    	{
+    	voipProperty->SetValue( KVccCallProviderPlugId );
+    	User::LeaveIfError( iSettings->AddOrUpdatePropertyL( iVoipServiceId, 
+    						*voipProperty ) );
+    	}
+    CleanupStack::PopAndDestroy( voipProperty );
+    
+    voipProperty = CSPProperty::NewLC(); 
+    err = iSettings->FindPropertyL( iVoipServiceId, 
+                                         EPropertyServiceAttributeMask,
+                                         *voipProperty );
+    
+    
+    //Set bootstrap bit on, so that CCE cant unload VCC
+    //Should be figured out how do it so that inactive VoIP service
+    //is still unloaded, but VCC is not.
+    if( err == KErrNone)
+        {
+        TInt mask;
+        voipProperty->GetValue( mask );
+                
+        mask = mask | EBootstrapCallProvider;
+                        
+        voipProperty->SetValue( mask );
+        User::LeaveIfError( iSettings->AddOrUpdatePropertyL( iVoipServiceId, 
+                                *voipProperty ) );
+        }
+    CleanupStack::PopAndDestroy( voipProperty );
+    */
+    
+    
+    //check existing properties from entry
+    if( iVdi != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccVDI, *iVdi );
+    
+    if( iVdn != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccVDN, *iVdn );
+    
+    if( iPreferredDomain != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccPreferredDomain, 
+                        *iPreferredDomain );
+    
+    if( iImmediateDt != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccImmediateDomainTransfer, 
+                        *iImmediateDt );
+    
+    if( iDtCsToPsAllowed != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccDtCstoPsAllowed, 
+                        *iDtCsToPsAllowed );
+    
+    if( iDtPsToCsAllowed != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccDtPstoCsAllowed, 
+                        *iDtPsToCsAllowed );
+
+    if( iDtHeldWaitingCallsAllowed != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccDtHeldWaitingCallsAllowed, 
+                        *iDtHeldWaitingCallsAllowed );
+
+    if( iDtWlanHoTreshold != NULL )    
+        AddOrUpdatePropertyL( *entry,  ESubPropertyVccDtWLANHoTriggerLevel, 
+                        *iDtWlanHoTreshold );
+
+    if( iDtWlanHoHysteresis != NULL )
+        AddOrUpdatePropertyL( *entry,  ESubPropertyVccDtWLANHoHysteresis, 
+                        *iDtWlanHoHysteresis );
+
+    if( iDtWlanHoHysteresisTimerLow != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccDtWLANHoHysteresisTimerLow, 
+                        *iDtWlanHoHysteresisTimerLow );
+
+    if( iDtWlanHoHysteresisTimerHigh != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccDtWLANHoHysteresisTimerHigh, 
+                        *iDtWlanHoHysteresisTimerHigh );
+
+    if( iDtCsHoTreshold != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccDtCSHoTriggerLevel, 
+                        *iDtCsHoTreshold );
+
+    if( iDtCsHoHysteresis != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccDtCSHoHysteresis, 
+                        *iDtCsHoHysteresis );
+
+    if( iDtCsHoHysteresisTimerLow != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccDtCSHoHysteresisTimerLow, 
+                        *iDtCsHoHysteresisTimerLow );
+
+    if( iDtCsHoHysteresisTimerHigh != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccDtCSHoHysteresisTimerHigh, 
+                        *iDtCsHoHysteresisTimerHigh );     
+
+    if( iVoipServiceIdString != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccDtVoipServiceId, 
+                        *iVoipServiceIdString );     
+    
+    if( iDtAllowedWhenCsOriginated != NULL )
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccDtAllowedWhenCsOriginated,
+                        *iDtAllowedWhenCsOriginated );
+            
+    RUBY_DEBUG1( "iVoipServiceId [%d]", iVoipServiceId ); 
+    
+    // Initialize HO notification tone value to 0 (off), if not found or invalid   
+    RBuf val;
+    val.CreateL( KSPMaxDesLength );
+    err = GetPropertyValue( *entry, ESubPropertyVccHoNotificationToneMode, 
+                            val ); 
+    
+    if ( err || !( ConvertToIntL( val ) == 0 || ConvertToIntL( val ) == 1 ) )
+        {
+        // setting not found, or illegal value, set to default (0=off)TBuf<1> 
+        // zero = _L( "0" );
+        HBufC* tmp;
+        TBuf<1> zero(_L("0"));
+        tmp = zero.AllocL();
+        AddOrUpdatePropertyL( *entry, ESubPropertyVccHoNotificationToneMode, 
+                              *tmp );
+        delete tmp;
+        }
+    val.Close();
+ 
+    //get propertyarray
+    RPropertyArray newProperties = entry->GetAllProperties();
+    TInt propCount( entry->PropertyCount() );
+    RUBY_DEBUG1( "service properties count [%d]", propCount ); 
+    
+    //add/update propertyarray to settings
+    User::LeaveIfError( iSettings->AddOrUpdatePropertiesL( iServiceId, 
+                                newProperties ));
+
+    CleanupStack::PopAndDestroy( entry );
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns the name of stored settings
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CVccSPSettings::ProviderId()
+    {
+    if( iProviderId != NULL )
+        {
+        RUBY_DEBUG0( "- VCC provider id exists" );
+        return *iProviderId;
+        }
+    else
+        {
+        RUBY_DEBUG0( "-no VCC provider id" );
+        return KNullDesC;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets name of settings
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetProviderIdL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::SetProviderIdL" );
+    
+    // Delete the setting if already allocated
+    delete iProviderId;
+    iProviderId = NULL;
+    iProviderId = aValue.AllocL();
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets name of settings
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetServiceNameL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::SetNameL" );
+    delete iServiceName;
+    iServiceName = NULL;
+    iServiceName = aValue.AllocL();
+    }
+    
+// ---------------------------------------------------------------------------
+// Returns name of stored settings
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CVccSPSettings::ServiceName()
+    {
+    if( iServiceName != NULL )
+        {
+        RUBY_DEBUG0( "-VCC service name exists" );
+        return *iServiceName;
+        }
+    else
+        {
+        RUBY_DEBUG0( "-no VCC service name" );
+
+        return KNullDesC;
+        }
+    }    
+// ---------------------------------------------------------------------------
+// Sets VDI
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVccSPSettings::SetVdiL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::SetVdiL" );
+    
+    TInt err = TVCCMiscUtils::URIValidL( aValue );
+    if ( !err )
+        {
+        if( iVdi )
+        	{
+            delete iVdi;
+        	iVdi = NULL;
+        	}
+        iVdi = aValue.AllocL();
+        }
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets VDN
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CVccSPSettings::SetVdnL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::SetVdnL" );
+    
+    TBool ok = TVCCMiscUtils::VDNValidL( aValue );
+    
+    if ( ok )
+        {
+        if( iVdn )
+        	{
+        	delete iVdn;
+        	iVdi = NULL;
+        	}
+        
+        iVdn = aValue.AllocL();
+        }
+    
+    return ok;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets Preferred Domain
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetPreferredDomainL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::SetPreferredDomainL" );
+    if ( iPreferredDomain )
+        {
+        delete iPreferredDomain;
+        iPreferredDomain = NULL;
+        }
+    iPreferredDomain = aValue.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// Sets Immediate Domain Transfer
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetImmediateDtL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::SetImmediateDtL" );
+    if ( iImmediateDt )
+        {
+        delete iImmediateDt;
+        iImmediateDt = NULL;
+        }
+    
+    iImmediateDt = aValue.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// Sets Domain Transfer Cs To Ps Allowed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetDtCsToPsAllowedL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::SetDtCsToPsAllowedL" );
+    if ( iDtCsToPsAllowed )
+        {
+        delete iDtCsToPsAllowed;
+        iDtCsToPsAllowed = NULL;
+        }
+    iDtCsToPsAllowed = aValue.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// Sets Domain Transfer Ps To Cs Allowed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetDtPsToCsAllowedL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::SetDtPsToCsAllowedL" );
+    if ( iDtPsToCsAllowed )
+        {
+        delete iDtPsToCsAllowed;
+        iDtPsToCsAllowed = NULL;
+        }
+    iDtPsToCsAllowed = aValue.AllocL();
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets Domain Transfer allowed while Held and Waiting Calls 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetDtHeldWaitingCallsAllowedL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::SetDtHeldWaitingCallsAllowedVccL" );
+    if ( iDtHeldWaitingCallsAllowed )
+        {
+        delete iDtHeldWaitingCallsAllowed;
+        iDtHeldWaitingCallsAllowed = NULL;
+        }
+    iDtHeldWaitingCallsAllowed = aValue.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+//  Sets handover treshold value for WLAN
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetDtWlanHoTresholdL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccItem::SetDtWlanHoTresholdL" );
+    if ( iDtWlanHoTreshold )
+        {
+        delete iDtWlanHoTreshold;
+        iDtWlanHoTreshold = NULL;
+        }
+    iDtWlanHoTreshold = aValue.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+//  Sets handover hysteresis value for WLAN
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetDtWlanHoHysteresisL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccItem::SetDtWlanHoHysteresisL" );
+    if ( iDtWlanHoHysteresis )
+        {
+        delete iDtWlanHoHysteresis;
+        iDtWlanHoHysteresis = NULL;
+        }
+    iDtWlanHoHysteresis = aValue.AllocL();
+    }
+// ---------------------------------------------------------------------------
+//  Sets handover hysteresis timer value for WLAN lower limit
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetDtWlanHoHysteresisTimerLowL(
+                                                           const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccItem::SetDtWlanHoHysteresisTimerLowL" );
+    if ( iDtWlanHoHysteresisTimerLow )
+        {
+        delete iDtWlanHoHysteresisTimerLow;
+        iDtWlanHoHysteresisTimerLow = NULL;
+        }
+    iDtWlanHoHysteresisTimerLow = aValue.AllocL();
+    }
+// ---------------------------------------------------------------------------
+//  Sets handover hysteresis timer value for WLAN higher limit
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetDtWlanHoHysteresisTimerHighL( 
+                                                           const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccItem::SetDtWlanHoHysteresisTimerHighL" );
+    if ( iDtWlanHoHysteresisTimerHigh )
+        {
+        delete iDtWlanHoHysteresisTimerHigh;
+        iDtWlanHoHysteresisTimerHigh = NULL;
+        }
+    iDtWlanHoHysteresisTimerHigh = aValue.AllocL();
+    }
+// ---------------------------------------------------------------------------
+//  Sets handover treshold value for CS
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetDtCsHoTresholdL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccItem::SetDtCsHoTresholdL" );
+    if ( iDtCsHoTreshold )
+        {
+        delete iDtCsHoTreshold;
+        iDtCsHoTreshold = NULL;
+        }
+    iDtCsHoTreshold = aValue.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+//  Sets handover hysteresis value for CS
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetDtCsHoHysteresisL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccItem::SetDtCsHoHysteresisL" );
+    if ( iDtCsHoHysteresis )
+        {
+        delete iDtCsHoHysteresis;
+        iDtCsHoHysteresis = NULL;
+        }
+    iDtCsHoHysteresis = aValue.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+//  Sets handover hysteresis timer value for CS lower limit
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetDtCsHoHysteresisTimerLowL( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccItem::SetDtCsHoHysteresisTimerLowL" );
+    if ( iDtCsHoHysteresisTimerLow )
+        {
+        delete iDtCsHoHysteresisTimerLow;
+        iDtCsHoHysteresisTimerLow = NULL;
+        }
+    iDtCsHoHysteresisTimerLow = aValue.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+//  Sets handover hysteresis timer value for CS higher limit
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetDtCsHoHysteresisTimerHighL( 
+                                                           const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CWPVccItem::SetDtCsHoHysteresisTimerHighL" );
+    if ( iDtCsHoHysteresisTimerHigh )
+        {
+        delete iDtCsHoHysteresisTimerHigh;
+        iDtCsHoHysteresisTimerHigh = NULL;
+        }
+    iDtCsHoHysteresisTimerHigh = aValue.AllocL();
+    }
+        
+// ---------------------------------------------------------------------------
+// Converts given value to int.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVccSPSettings::ConvertToIntL( const TDesC& aValue )
+    {
+    TInt intValue;
+    TLex temp( aValue );
+    User::LeaveIfError( temp.Val( intValue ) );
+    return intValue;
+    }
+    
+// ---------------------------------------------------------------------------
+// Finds service provider entry from spsettings
+// if service entry was not found, a new entry is created.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::FindServiceEntryL( const TDesC& aServiceName, 
+        CSPEntry& aServiceEntry )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::FindServiceEntryL" );
+    
+    RUBY_DEBUG1( "-service name:[%S]",&aServiceName );
+    TInt error( KErrNone );
+    RIdArray serviceids;
+    CleanupClosePushL( serviceids );
+    iSettings->FindServiceIdsL( serviceids );
+    
+    TInt count = serviceids.Count();
+    RUBY_DEBUG1( "-serviceids count [%d]",count ); 
+
+    TBool foundEntry( EFalse );
+        
+    for ( TInt i( 0 ); i < serviceids.Count() && !foundEntry; i++ )
+          {
+          CSPProperty* property = CSPProperty::NewLC(); 
+          error = iSettings->FindPropertyL( serviceids[i], ESubPropertyVccVDI, *property ); 
+ 
+          if( error == KErrNone )
+              {
+              RUBY_DEBUG0( "-service found" );
+              iSettings->FindEntryL( serviceids[i], aServiceEntry );
+              foundEntry = ETrue;
+              }
+          CleanupStack::PopAndDestroy( property );
+          }
+  
+    if( aServiceEntry.GetServiceId() == KVccZeroId && !foundEntry )
+        {
+        RUBY_DEBUG0( "-no service found"); 
+        }
+
+    CleanupStack::PopAndDestroy( &serviceids );
+     }
+
+// ---------------------------------------------------------------------------
+// Sets Voip service Id 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetVoipServiceIdL( const TDesC& aValue )
+    {
+    RUBY_DEBUG1( "CVccSPSettings::SetVoipServiceIdL instance %x", this );
+    SetVoipServiceIdL( ConvertToIntL( aValue ) );
+    RUBY_DEBUG1( "SetVoipServiceId:[%d]",iVoipServiceId );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets Voip service Id 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVccSPSettings::SetVoipServiceIdL( TInt aValue )
+    {
+    TBuf<KVccServiceIdLength> serviceIdString;
+		serviceIdString.Num(aValue);	
+    
+    if ( iVoipServiceIdString )
+        {
+        delete iVoipServiceIdString;
+        iVoipServiceIdString = NULL;
+        }
+        
+    iVoipServiceIdString = serviceIdString.AllocL();  
+    iVoipServiceId = aValue; 
+    
+    RUBY_DEBUG1( "SetVoipServiceId:[%d]",iVoipServiceId );
+    }
+
+// ---------------------------------------------------------------------------
+//  
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVccSPSettings::FindPropertyL( TServiceId aServiceId,
+                                   TServicePropertyName aPropertyName,
+                                   CSPProperty& aProperty )
+  {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::FindPropertyL" );
+    
+    return iSettings->FindPropertyL( aServiceId, aPropertyName, aProperty );
+  }
+
+// ---------------------------------------------------------------------------
+// reads entry from sp settings 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CVccSPSettings::ReadSettingsL( const TDesC& aServiceName )
+    {
+    RUBY_DEBUG_BLOCK( "ReadSettingsL" );
+    SetServiceNameL( aServiceName );
+    
+    CSPEntry* entry = CSPEntry::NewLC();
+    
+    RUBY_DEBUG1( "-service name:[%S]",iServiceName );
+   
+    FindServiceEntryL( *iServiceName, *entry );
+    iServiceId = entry->GetServiceId();
+    
+    RUBY_DEBUG0( "service found" ); 
+    
+    RBuf val;
+    val.CreateL( KSPMaxDesLength );
+
+    TInt err = GetPropertyValue( *entry, ESubPropertyVccPreferredDomain, val );
+    SetPreferredDomainL( val );
+    RUBY_DEBUG2( "iPreferredDomain = %S, err %d ", iPreferredDomain, err );                
+
+    err = GetPropertyValue( *entry, ESubPropertyVccDtCstoPsAllowed, val );
+    SetDtCsToPsAllowedL( val );
+    RUBY_DEBUG2( "iDtCsToPsAllowed = %S, err %d ", iDtCsToPsAllowed, err );                
+
+    err = GetPropertyValue( *entry, ESubPropertyVccDtPstoCsAllowed, val );
+    SetDtPsToCsAllowedL( val );
+    RUBY_DEBUG2( "iDtPsToCsAllowed = %S, err %d ", iDtPsToCsAllowed, err );                
+   
+    err = GetPropertyValue( *entry, ESubPropertyVccImmediateDomainTransfer, 
+                       val );
+    SetImmediateDtL( val );
+    RUBY_DEBUG2( "iImmediateDt = %S, err %d ", iImmediateDt, err );                
+
+    err = GetPropertyValue( *entry, ESubPropertyVccDtHeldWaitingCallsAllowed, 
+                 val );
+    SetDtHeldWaitingCallsAllowedL( val );
+    RUBY_DEBUG2( "iDtHeldWaitingCallsAllowed = %S, err %d ", 
+                iDtHeldWaitingCallsAllowed, err );                
+    
+    err = GetPropertyValue( *entry, ESubPropertyVccDtCSHoTriggerLevel, val );
+    SetDtCsHoTresholdL( val );
+    RUBY_DEBUG2( "iDtCsHoTreshold = %S, err %d ", iDtCsHoTreshold, err );                
+
+    err = GetPropertyValue( *entry, ESubPropertyVccDtCSHoHysteresis, 
+            val );
+    SetDtCsHoHysteresisL( val );
+    RUBY_DEBUG2( "iDtCsHoHysteresis = %S, err %d ", iDtCsHoHysteresis, err );  
+
+    err = GetPropertyValue( *entry, ESubPropertyVccDtCSHoHysteresisTimerLow, 
+            val );
+    SetDtCsHoHysteresisTimerLowL( val );
+    RUBY_DEBUG2( "iDtCsHoHysteresisTimerLow = %S, err %d ", 
+            iDtCsHoHysteresisTimerLow, err );                
+
+    err = GetPropertyValue( *entry, ESubPropertyVccDtCSHoHysteresisTimerHigh, 
+            val );
+    SetDtCsHoHysteresisTimerHighL( val );
+    RUBY_DEBUG2( "iDtCsHoHysteresisTimerHigh = %S, err %d ",
+                 iDtCsHoHysteresisTimerHigh, err );                
+
+    err = GetPropertyValue( *entry, ESubPropertyVccDtWLANHoTriggerLevel,  val );
+    SetDtWlanHoTresholdL( val );
+    RUBY_DEBUG2( "iDtWlanHoTreshold = %S, err %d ", iDtWlanHoTreshold, err );                
+    
+    err = GetPropertyValue( *entry, ESubPropertyVccDtWLANHoHysteresis, val );
+    SetDtWlanHoHysteresisL( val );
+    RUBY_DEBUG2( "iDtWlanHoHysteresis = %S, err %d ", iDtWlanHoHysteresis, err );   
+
+    err = GetPropertyValue( *entry, ESubPropertyVccDtWLANHoHysteresisTimerLow, 
+            val );
+    SetDtWlanHoHysteresisTimerLowL( val );
+    RUBY_DEBUG2( "iDtWlanHoHysteresisTimerLow = %S, err %d ", 
+            iDtWlanHoHysteresisTimerLow, err );   
+
+    err = GetPropertyValue( *entry, ESubPropertyVccDtWLANHoHysteresisTimerHigh, 
+            val );
+    SetDtWlanHoHysteresisTimerHighL( val );
+    RUBY_DEBUG2( "iDtWlanHoHysteresisTimerHigh = %S, err %d ", 
+            iDtWlanHoHysteresisTimerHigh, err );   
+
+    err = GetPropertyValue( *entry, ESubPropertyVccDtVoipServiceId, val );
+    SetVoipServiceIdL( val );
+    RUBY_DEBUG2( "iVoipServiceId = %d, err0 %d ", iVoipServiceId, err );  
+    
+    err = GetPropertyValue( *entry, ESubPropertyVccDtAllowedWhenCsOriginated, val );
+    SetDtAllowedWhenCsOriginated( val );
+    RUBY_DEBUG2( "iDtAllowedWhenCsOriginated = %S, err %d ", 
+                    iDtAllowedWhenCsOriginated, err );  
+
+    val.Close();
+    CleanupStack::PopAndDestroy( entry );
+    }
+
+// ---------------------------------------------------------------------------
+// Return preferred domain
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVccSPSettings::PreferredDomainL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::PreferredDomainL" );
+    return ConvertToIntL( *iPreferredDomain );
+    }
+
+// ---------------------------------------------------------------------------
+// Return Immediate Dt
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVccSPSettings::ImmediateDtL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::ImmediateDtL" );
+    return ConvertToIntL( *iImmediateDt );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVccSPSettings::DtCsToPsAllowedL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::DtCsToPsAllowedL" );
+    return ConvertToIntL( *iDtCsToPsAllowed );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVccSPSettings::DtPsToCsAllowedL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::DtPsToCsAllowedL" );
+    return ConvertToIntL( *iDtPsToCsAllowed );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVccSPSettings::DtHeldWaitingCallsAllowedL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::DtHeldWaitingCallsAllowedL" );
+    return ConvertToIntL( *iDtHeldWaitingCallsAllowed );
+    }
+   
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CVccSPSettings::CsHoTresholdL()
+    {
+    return ConvertToIntL( *iDtCsHoTreshold );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CVccSPSettings::CsHoHysteresisL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::CsHoHysteresisL" );
+    return ConvertToIntL( *iDtCsHoHysteresis );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CVccSPSettings::CsHoHysteresisTimerLowL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::CsHoHysteresisTimerLowL" );
+    return ConvertToIntL( *iDtCsHoHysteresisTimerLow );
+    }
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CVccSPSettings::CsHoHysteresisTimerHighL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::CsHoHysteresisTimerHighL" );
+    return ConvertToIntL( *iDtCsHoHysteresisTimerHigh );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CVccSPSettings::PsHoTresholdL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::PsHoTresholdL" );
+    return ConvertToIntL( *iDtWlanHoTreshold );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CVccSPSettings::PsHoHysteresisL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::PsHoHysteresisL" );
+    return ConvertToIntL( *iDtWlanHoHysteresis );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CVccSPSettings::PsHoHysteresisTimerLowL()
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::PsHoHysteresisTimerLowL" );
+    return ConvertToIntL( *iDtWlanHoHysteresisTimerLow );
+    }
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CVccSPSettings::PsHoHysteresisTimerHighL()
+    {
+    return ConvertToIntL( *iDtWlanHoHysteresisTimerHigh );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C TInt CVccSPSettings::VoipServiceId()
+    {
+    return iVoipServiceId;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//  
+EXPORT_C TInt CVccSPSettings::DtAllowedWhenCsOriginatedL()
+    {
+    return ConvertToIntL( *iDtAllowedWhenCsOriginated );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//  
+EXPORT_C void CVccSPSettings::SetDtAllowedWhenCsOriginated( const TDesC& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "CVccSPSettings::SetDtAllowedWhenCsOriginated" );
+    if ( iDtAllowedWhenCsOriginated )
+        {
+        delete iDtAllowedWhenCsOriginated;
+        iDtAllowedWhenCsOriginated = NULL;
+        }
+    TRAP_IGNORE( iDtAllowedWhenCsOriginated = aValue.AllocL() );
+    }
+// ---------------------------------------------------------------------------
+// Update old property or add new property to the service entry 
+// ---------------------------------------------------------------------------
+//
+void CVccSPSettings::AddOrUpdatePropertyL( CSPEntry& aServiceEntry, 
+    const TServicePropertyName aName, TInt aValue )
+    {
+   
+    TInt err = aServiceEntry.UpdateProperty( aName, aValue ); 
+    
+    //add new to entry
+    if( err == KErrNotFound )
+        {
+        CSPProperty* property = CSPProperty::NewLC(); 
+        property->SetName( aName );
+        property->SetValue( aValue );
+        // New property, don't need to check return value
+        // coverity[check_return] coverity[unchecked_value]
+        aServiceEntry.AddPropertyL( *property );
+        CleanupStack::PopAndDestroy( property );
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// Update old property or add new property to the service entry 
+// ---------------------------------------------------------------------------
+//
+void CVccSPSettings::AddOrUpdatePropertyL( CSPEntry& aServiceEntry, 
+    const TServicePropertyName aName, const TDesC& aValue )
+    {
+    TInt err = aServiceEntry.UpdateProperty( aName, aValue ); 
+    
+    //add new to entry
+    if( err == KErrNotFound )
+        {
+        CSPProperty* property = CSPProperty::NewLC(); 
+        property->SetName( aName );
+        property->SetValue( aValue );
+        // New property, don't need to check return value
+        // coverity[check_return] coverity[unchecked_value]
+        aServiceEntry.AddPropertyL( *property );
+        CleanupStack::PopAndDestroy( property );
+        }    
+    }
+    
+// ---------------------------------------------------------------------------
+// Try to get the value of property as integer
+// ---------------------------------------------------------------------------
+//    
+TInt CVccSPSettings::GetPropertyValue( CSPEntry& aServiceEntry,
+    const TServicePropertyName& aPropertyName,
+    TInt& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "GetPropertyValue" );
+  
+    const CSPProperty* property = NULL;
+    TInt err = aServiceEntry.GetProperty( property, aPropertyName );
+    if( property != NULL )                     
+        err = property->GetValue( aValue ) ;
+    
+    return err;
+     }
+
+// ---------------------------------------------------------------------------
+// Try to get the value of property as integer
+// ---------------------------------------------------------------------------
+//    
+TInt CVccSPSettings::GetPropertyValue( CSPEntry& aServiceEntry,
+    const TServicePropertyName& aPropertyName,
+    TDes& aValue )
+    {
+    RUBY_DEBUG_BLOCK( "GetPropertyValue" );
+  
+    const CSPProperty* property = NULL;
+    TInt err = aServiceEntry.GetProperty( property, aPropertyName );
+    
+    if( property != NULL )
+        {
+        err = property->GetValue( aValue ) ;
+        }
+    else
+        {
+        TBuf<1> zero(_L("0"));
+        aValue.Copy( zero );
+        }
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//    
+void CVccSPSettings::ModifyVoipProfileL()
+    {
+    //Change callprovider plugin uid in VoIP setting
+    CSPEntry* voipEntry = CSPEntry::NewLC();
+    TRAPD( e, iSettings->FindEntryL( iVoipServiceId, *voipEntry ) );
+  
+    if (e == KErrNone)
+        {
+        RUBY_DEBUG0( "voip service found" ); 
+             
+        const CSPProperty* property = NULL;
+        TInt err = voipEntry->GetProperty( property, 
+                                           EPropertyServiceAttributeMask );
+      
+        if( property != NULL )
+            {
+            TInt mask;
+            err = property->GetValue( mask ) ;
+            RUBY_DEBUG1( "voip service mask %d", mask ); 
+                 
+            mask = mask | EBootstrapCallProvider;
+            RUBY_DEBUG1( "voip service mask after mod %d", mask ); 
+            voipEntry->UpdateProperty(EPropertyServiceAttributeMask, mask );
+            voipEntry->UpdateProperty(EPropertyCallProviderPluginId, KVccCallProviderPlugId );
+          
+            // Update entry
+            iSettings->UpdateEntryL(*voipEntry);
+              
+            RUBY_DEBUG0( "voip service updated" ); 
+            }
+        }
+    CleanupStack::PopAndDestroy( voipEntry );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/aif/csc_caption.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,36 @@
+/*
+* 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:  Resource definitions for project CSC
+*
+*/
+
+
+#include <apcaptionfile.rh>
+
+#include <csc.loc>
+
+
+// -----------------------------------------------------------------------------
+//
+// caption_data
+// Captions for CSC application
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CAPTION_DATA
+    {
+    caption =qtn_apps_csc_gs;
+    shortcaption = qtn_apps_csc_gs;
+    }
+    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/aif/cscaif.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* 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:  Resource definitions for project CSC
+*
+*/
+
+
+#include <aiftool.rh>
+
+#include <csc.loc>
+
+
+// -----------------------------------------------------------------------------
+//
+// aif_data
+// AIF for CSC application
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AIF_DATA
+    {
+    app_uid = 0x10275458;
+    caption_list=
+        {       
+        CAPTION
+            {
+            code = ELangEnglish;
+            caption = qtn_apps_csc_gs;
+            }
+        };
+    num_icons = 1;
+    embeddability = KAppNotEmbeddable;
+    newfile = KAppDoesNotSupportNewFile;
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/bitmaps/qgn_prop_download_serv_voip.svg	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,129 @@
+<?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 49">
+<g>
+<rect fill="none" width="57" height="49"/>
+<g>
+<g>
+<g>
+<radialGradient id="SVGID_1_" cx="-356.0454" cy="281.7109" r="4.5044" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#00000C"/>
+<stop offset="0.26" style="stop-color:#16168B"/>
+<stop offset="0.5" style="stop-color:#3838DB"/>
+<stop offset="0.85" style="stop-color:#4646FC"/>
+<stop offset="1" style="stop-color:#0E0EA8"/>
+</radialGradient>
+<path fill="url(#SVGID_1_)" d="M44.694,26.479c0,9.396-7.624,17.012-17.035,17.012c-9.407,0-17.031-7.615-17.031-17.012      c0-9.395,7.624-17.011,17.031-17.011C37.07,9.468,44.694,17.084,44.694,26.479z"/>
+<radialGradient id="SVGID_2_" cx="-356.2363" cy="282.0635" r="3.6988" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<path fill="url(#SVGID_2_)" d="M44.624,24.736c-0.176-2.616-1.318-5.334-2.511-7.274c-0.365-0.718-1.619-0.258-1.647-0.167      c-0.3,1.249-0.051,1.683-0.051,1.683l0.45-0.2l1,0.65l-0.833-2.133l0.804,0.292l0.115,0.755l0.389,0.891l-0.229,0.526      l-0.742-0.063l-0.441-0.284l-0.134,0.313l0.355,0.563l0.062,0.572l-0.252,0.367l-0.072,1.012l-0.624-0.041l-0.139,0.511      l0.641,0.631l-0.158,0.619l1.135,0.221l0.813-0.803l0.684,0.715l0.446,0.587l0.001-1.012l-0.709-0.915l0.271-0.133l0.574,0.834      l0.476,0.802l-1.376,1.542l-5,6.1l-0.445,0.39l0.149,0.918l0.477,0.927l0.877,0.402l3.018-1.245l0.076,0.834l-0.275,0.23      l-0.456,1.982l-1.593,1.436l-1.16,1.763c0,0,1.548-1.365,2.646-2.747c0.986-1.248,2.099-3.39,2.742-5.359      C44.62,29.451,44.797,27.257,44.624,24.736z"/>
+<radialGradient id="SVGID_3_" cx="-356.2358" cy="282.0557" r="3.9913" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<polygon fill="url(#SVGID_3_)" points="22.062,13.753 21.57,13.264 20.456,13.352 20.324,13.576 20.635,13.843     "/>
+<radialGradient id="SVGID_4_" cx="-356.2358" cy="282.0762" r="3.9711" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<polygon fill="url(#SVGID_4_)" points="38.891,21.499 39.29,20.688 39.543,20.845 39.543,21.741 40.165,21.727 40.525,21.104       38.83,19.32 38.582,19.632 38.875,20.256 38.384,20.479 38.361,21.342     "/>
+<radialGradient id="SVGID_5_" cx="-356.2354" cy="282.0732" r="3.973" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<polygon fill="url(#SVGID_5_)" points="22.397,13.2 26.121,11.393 25.375,11.155 23.072,11.546 23.043,12.015 22.29,11.957       21.592,12.314 21.792,12.996 21.568,13.264     "/>
+<radialGradient id="SVGID_6_" cx="-356.2354" cy="282.0742" r="3.9721" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<polygon fill="url(#SVGID_6_)" points="33.197,15.055 33.006,13.959 31.465,11.448 29.861,10.99 26.785,11.57 24.327,12.694       24.02,13.354 26.22,13.854 26.484,16.11 26.965,16.202 26.557,17.556 28.254,19.409 29.481,19.294 29.774,17.716 31.583,16.499       33.237,16.172     "/>
+<radialGradient id="SVGID_7_" cx="-356.5044" cy="281.6729" r="4.3224" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<path fill="url(#SVGID_7_)" d="M27.853,36.87l-0.999-1.212l-6.06-1.426L18.907,35.1l-1.213-0.285l-0.731-2.485l-1.063-0.436      l-0.087-1.114l-1,0.3l-0.85-0.851l0.05-1.8l1.2,0.2l0.9-0.4l1,2.051l0.5-0.55l-0.05-1.501l0.95-0.499l0.9-1.201l1.805-1.657      l1.558,0.051l1.098-0.593l-1.015-0.22l-0.14-0.754l1.934-0.45l-0.337,0.617l1.178,0.53l0.972,0.16l-0.806-1.025l-0.589-0.479      l0.815-0.277l-0.895-1.158l-0.624-0.269l-0.332-0.01l-0.426-1.46l-1.372,0.514l-0.546-1.271l-1.427-0.266l-0.121,2.118      l-0.555,0.102l-0.629,0.604l0.323,0.693l-1.155-0.193l0.271-1.034L17.5,20.326l-0.226-0.559l-0.455,0.156l-0.214-0.918      l0.936-1.342l1.08-0.249l0.731,0.392l0.247-0.59l-0.316-0.088l1.385-1.559l0.787,0.028l0.377,0.489l-0.72,0.239l0.287,0.274      l0.869-0.111l-1.691,1.174l1.776,0.898l1.262-0.477l-0.364-0.951l0.669,0.439l0.786-0.556l-1.277-0.646v-0.714l-0.68-0.362      l-0.569-0.975l-1.288-0.044l-1.038,0.504l0.252,0.504l-0.588,0.588l-0.192-0.617l-1.296,0.142l-0.843,0.571l0.566-0.909      l0.415-0.873l-0.503-0.33l-0.252-0.896l-0.998,0.774l-0.12,1.788l-0.314,0.043l-0.307-1.144c0,0-2.156,1.872-3.611,5.245      c-1.529,3.534-1.409,6.397-1.409,6.397l1.8,3.11l-0.091,1.253l2.2,1.25l1.1,1.364l0.754,0.935l1.147,1.422l1.593,0.223      l-0.842,1.196l-0.013,1.156l1.954,1.648l1.075,0.882l-0.143,1.746l1.877,0.595l5.18-2.233l0.499-1.176L27.853,36.87z"/>
+</g>
+<polygon fill="#59B80A" points="18.96,31.025 17.846,31.212 18.305,31.421 18.811,31.505 19.318,31.864 20.174,32.021      20.345,31.764 19.629,31.429    "/>
+</g>
+<g>
+<g>
+<g>
+<linearGradient id="SVGID_8_" gradientUnits="userSpaceOnUse" x1="-207.2441" y1="424.6357" x2="-206.1006" y2="422.6346" gradientTransform="matrix(5.9528 0 0 -5.9528 1270.4589 2527.6038)">
+<stop offset="0" style="stop-color:#626262"/>
+<stop offset="0.5082" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#616161"/>
+</linearGradient>
+<path fill="url(#SVGID_8_)" d="M39.864,11.146l5.107-2.08c0,0,0.053-4.903-0.414-5.682c-0.477-0.797-3.911-1.238-5.542-1.326       c-2.544-0.137-5.861,0.487-6.261,0.783L39.864,11.146z"/>
+<linearGradient id="SVGID_9_" gradientUnits="userSpaceOnUse" x1="-206.6963" y1="423.0176" x2="-206.2246" y2="422.1921" gradientTransform="matrix(5.9528 0 0 -5.9528 1270.4589 2527.6038)">
+<stop offset="0" style="stop-color:#818181"/>
+<stop offset="0.7472" style="stop-color:#F4F4F4"/>
+<stop offset="0.9945" style="stop-color:#333333"/>
+<stop offset="1" style="stop-color:#333333"/>
+</linearGradient>
+<path fill="url(#SVGID_9_)" d="M49.298,9.372c-1.061-0.232-0.979-0.116-4.276-0.436l-4.957,1.73l-3.153,9.971       c0.681-0.271,3.1-1.451,3.369-1.647c0.269-0.195,8.472-7.811,8.472-7.811S50.338,9.596,49.298,9.372z M37.35,20.446       c-0.099,0.036-0.201,0.066-0.298,0.066C37.085,20.511,37.23,20.495,37.35,20.446z"/>
+<path fill="#FFFFFF" d="M40.662,10.301c0,0,3.46,0.628,4.61,0.828c1.15,0.198,0.274,1.115,0.274,1.115l-7.933,8.134       c0,0-0.409,0.278-0.713,0.278s-0.543-0.449-0.543-0.449s-7.096-10.618-7.576-11.36C28.299,8.104,29.35,8.09,29.35,8.09       l3.347,0.637c0,0,0.063-4.447,0.063-5.945c0-0.03,5.79-0.096,7.499,1.843C41.327,5.796,40.662,10.301,40.662,10.301z"/>
+<linearGradient id="SVGID_10_" gradientUnits="userSpaceOnUse" x1="-207.6563" y1="423.1523" x2="-206.6072" y2="422.2198" gradientTransform="matrix(5.9528 0 0 -5.9528 1270.4589 2527.6038)">
+<stop offset="0" style="stop-color:#626262"/>
+<stop offset="1" style="stop-color:#000000"/>
+</linearGradient>
+<path fill="url(#SVGID_10_)" d="M30.722,9.959l5.886,8.464c0,0,0.235,0.638,0.761,0.127c0.522-0.513,5.864-6.277,5.864-6.277       s0.532-0.458-0.308-0.62c-0.969-0.19-3.263-0.639-3.263-0.639s0.041-4.441,0-4.827c-0.043-0.383-0.225-0.878-0.906-1.397       c-0.678-0.516-3.997-1.271-4.844-0.785c0,0.137-0.004,1.477-0.004,1.477v4.48c0,0-2.799-0.664-2.792-0.662       C29.706,8.882,30.722,9.959,30.722,9.959z"/>
+</g>
+</g>
+</g>
+<g>
+<linearGradient id="SVGID_11_" gradientUnits="userSpaceOnUse" x1="-355.7402" y1="283.6572" x2="-355.2567" y2="281.8528" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)">
+<stop offset="0" style="stop-color:#864E00"/>
+<stop offset="0.45" style="stop-color:#FCA703"/>
+<stop offset="0.64" style="stop-color:#FFD400"/>
+<stop offset="1" style="stop-color:#AC6D00"/>
+</linearGradient>
+<path fill="url(#SVGID_11_)" d="M33.768,27.313l-9.973,7.942l0.667,7.297l5.845-2.072c0,0-1.664-2.781-1.689-4.382     c-0.081-3.099,5.449-7.101,5.993-6.942L33.768,27.313z"/>
+<path fill="#613624" d="M21.498,46.584c4.244-1.021,6.097-2.239,8.81-5.241C29.002,41.502,24.045,42.361,21.498,46.584z"/>
+<linearGradient id="SVGID_12_" gradientUnits="userSpaceOnUse" x1="-354.0649" y1="284.4268" x2="-353.8051" y2="283.7128" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)">
+<stop offset="0" style="stop-color:#FFFF00"/>
+<stop offset="0.35" style="stop-color:#FFFF00"/>
+<stop offset="0.8" style="stop-color:#DEC500"/>
+<stop offset="1" style="stop-color:#D98800"/>
+</linearGradient>
+<path fill="url(#SVGID_12_)" d="M31.657,26.601l11.234-0.036l5.184-1.291C44.937,24.063,38.248,21.4,31.657,26.601z"/>
+<path fill="#613624" d="M48.295,26.318c-5.09-0.763-9.761,5.019-10.401,5.812C42.631,32.161,47.233,27.742,48.295,26.318z"/>
+<radialGradient id="SVGID_13_" cx="-356.5757" cy="284.5576" r="3.083" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#ECE617"/>
+<stop offset="0.7" style="stop-color:#ECE617"/>
+<stop offset="1" style="stop-color:#D98800"/>
+</radialGradient>
+<path fill="url(#SVGID_13_)" d="M24.463,42.552c-0.177-5.211,0.778-6.496,2.832-9.374c0.889-1.244,4.189-4.088,5.235-4.368     c2.233-0.601,4.591,2.54,4.591,2.54l5.799-4.798c-1.792-1.438-4.381-2.288-6.557-2.188c-4.806,0.214-12.949,10.487-14.124,12.998     c-1.467,3.139-1.583,8.646-1.583,8.646L24.463,42.552z"/>
+<linearGradient id="SVGID_14_" gradientUnits="userSpaceOnUse" x1="-356.7349" y1="281.1748" x2="-355.2725" y2="281.7071" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)">
+<stop offset="0" style="stop-color:#6D2800"/>
+<stop offset="0.3" style="stop-color:#E89000"/>
+<stop offset="0.6" style="stop-color:#F7FC00"/>
+<stop offset="0.9" style="stop-color:#EFC400"/>
+<stop offset="1" style="stop-color:#832100"/>
+</linearGradient>
+<path fill="url(#SVGID_14_)" d="M20.656,46.007l0.842,0.577c2.002-2.931,5.152-4.46,8.81-5.241v-0.863     C26.971,40.547,22.828,43.137,20.656,46.007z"/>
+<linearGradient id="SVGID_15_" gradientUnits="userSpaceOnUse" x1="-354.3643" y1="283.335" x2="-352.6455" y2="283.9605" gradientTransform="matrix(6.7645 0 0 -6.7645 2433.925 1947.1653)">
+<stop offset="0" style="stop-color:#6D2800"/>
+<stop offset="0.3" style="stop-color:#E89000"/>
+<stop offset="0.6" style="stop-color:#F7FC00"/>
+<stop offset="0.9" style="stop-color:#EFC400"/>
+<stop offset="1" style="stop-color:#832100"/>
+</linearGradient>
+<path fill="url(#SVGID_15_)" d="M48.075,25.273c-3.924-0.458-7.793,2.768-10.955,6.076l0.776,0.778     c3.005-3.036,6.659-6.237,10.399-5.81L48.075,25.273z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/bitmaps/qgn_prop_set_service.svg	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!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" width="84" height="58" viewBox="0 0 84 58">
+<rect fill="none" height="58" width="84"/>
+<linearGradient id="_15" gradientUnits="userSpaceOnUse" x1="46.02" y1="5.72" x2="46.92" y2="7.5">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M40.36,7.038c0.076,0.156,0.33,0.194,0.863,0.025c0.393-0.034,1.421-0.927,1.957-0.747 c0.539,0.178,0.979-0.182,1.479-0.503c1.04,0.092,2.147-0.822,2.36-0.822c0.215,0,1.021,0.148,1.201-0.137 c0,0,1.951,0.459,3.733,0.076c-1.33-0.304-2.714-0.465-4.135-0.465c-1.83,0-3.599,0.268-5.269,0.762 C42.087,5.678,41.586,6.288,40.36,7.038z" fill="url(#_15)"/>
+<radialGradient id="_16" gradientUnits="userSpaceOnUse" cx="49.07" cy="15.52" r="24.17">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</radialGradient>
+<path d="M35.86,9.528c0-0.333,0.546-0.498,0.546-0.498l0.071,0.261l0.498,0.214c0,0,0.594-0.641,0.713-0.808 c0.116-0.165,0.331-0.806,0.331-0.806l1.036-1.222c-2.325,1.254-4.352,2.99-5.945,5.076C33.749,11.24,35.86,9.861,35.86,9.528z" fill="url(#_16)"/>
+<radialGradient id="_17" gradientUnits="userSpaceOnUse" cx="46.03" cy="8.04" r="4.07">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</radialGradient>
+<path d="M45.65,6.6c0.234-0.045,0.768-0.295,0.768-0.295s-0.267-0.113-0.568-0.068 c-0.299,0.046-0.731-0.181-0.967-0.068C45.081,6.418,45.416,6.645,45.65,6.6z" fill="url(#_17)"/>
+<linearGradient id="_18" gradientUnits="userSpaceOnUse" x1="42.25" y1="5.04" x2="56.91" y2="52.17">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M70.442,40.96l-0.011-4.05l-1.975-0.535l-0.154-0.908l1.553-0.646l-1.793-3.978L66.5,31.332 L66,30.874l1.077-1.812l-1.239-0.864c0.481-1.661,0.754-3.412,0.754-5.228c0-10.366-8.404-18.771-18.771-18.771 c-10.367,0-18.77,8.404-18.77,18.771c0,9.215,6.647,16.865,15.406,18.452l2.387,5.137l1.92-1.188l0.547,0.567l-1.162,2.121 l3.352,2.564l1.75-0.958l0.031,1.685l3.916,0.321l1.511-0.923l0.325,0.762l3.348-1.749l4.536-2.846l-0.167-0.292l1.104-0.443 l1.934-3.285l-0.869-1.188L70.442,40.96z M59.5,44.875c-1.688,0.932-5.154-2.383-6.545-3.863c2.915-0.828,5.533-2.341,7.686-4.355 C60.928,38.811,61.111,43.984,59.5,44.875z" fill="url(#_18)"/>
+<radialGradient id="_19" gradientUnits="userSpaceOnUse" cx="51.47" cy="11.04" r="34.24">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.53"/>
+<stop stop-color="#6C83BB" offset="0.87"/>
+<stop stop-color="#003D6D" offset="1"/>
+</radialGradient>
+<circle cx="47.821" cy="22.971" fill="url(#_19)" r="18.504"/>
+<path d="M62.656,28.855l-0.604,0.958c0,0-0.906,0.285-0.94,0.57c-0.017,0.121-0.698,1.635-0.698,1.635 s-0.268,0.844,0.499,0.594C62.508,32.09,63.549,28.677,62.656,28.855z" fill="url(#_16)"/>
+<path d="M33.844,30.738c0.262,0,0.935,0.082,1.016-0.164c0.006-0.105,0.1-2.636,0.1-2.636l1.008-1.341V25.53 l-2.622-1.697l-1.138-1.232c0,0.004-0.441-1.331-0.854-1.708c-0.346-0.315-0.32-1.008-0.688-1.519 c-0.333-0.462-0.602-0.721-0.815-0.824c-1.691,6.849,0.931,12.671,3.387,15.812c0.352-0.504,0.63-1.063,0.846-1.561 C34.303,32.291,32.966,31.568,33.844,30.738z" fill="url(#_16)"/>
+<radialGradient id="_22" gradientUnits="userSpaceOnUse" cx="51.8" cy="11.18" r="18.59">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#003D6D" offset="1"/>
+</radialGradient>
+<path d="M56.342,6.542c-0.568,0.16-1.035,0.281-1.146,0.281c-0.322,0-0.235-0.272-0.522-0.309 C54.387,6.479,52,5.862,51.68,6.183c-0.321,0.322-1.58,0.651-1.867,0.688c-0.284,0.036,0.096,0.902,0.854,1.447 c-0.104,0.107-1.804,1.047-1.804,0.403c0-0.644-0.331-1.115-0.854-1.305c-0.476,0.118-1.021,0.616-0.262,1.305 c0.475,0.428,0.004,0.485-0.027,0.609c-0.143,0.518,1.135,1.021,0.524,1.401c-0.571,0.051-1.083-0.054-1.181-0.107 c-0.898-0.505-1.104,1.495-1.104,1.495l0.982,0.485l-1.641,1.598c0,0-2.406,1.67-2.442,1.886c-0.036,0.214-1.068,2.984-0.711,3.808 c0.359,0.824,2.211,3.041,3.068,3.111c1.119,0.091,4.357-0.556,4.357-0.556c0.07,0.18,0.4,0.896,1.99,1.192 c0.059,0.01-0.687,1.434-0.25,2.046c0.951,1.328,0.904,3.315,0.904,3.315l7.406-1.754l2.375-3l1.25-2.875l-1.875,0.25l-0.083-1.73 l-1.139-2.136l-1.14-1.731l0.143-0.356l2.467,3.357c0.227,0.652,0.38,0.953,0.559,1.72c1.408-0.341,2.625-2.178,2.057-3.672 c-0.025-0.027-0.377,0.043-0.895,0.007c-0.8-0.582-1.279-1.812-1.279-1.812l1.813,1.526l0.891,0.071l0.563,1.115 c0.159,0.104,0.268,0.174,0.268,0.174s0.037,0.005,0.099,0.007C64.338,13.11,60.895,8.908,56.342,6.542z M52.395,7.278 c-0.149-0.38,0.438-0.522,0.438-0.522s0.585,0.85,0.491,1.41c-0.094,0.556-0.711,0.216-0.896,0.049 C52.242,8.051,52.541,7.659,52.395,7.278z M57.719,14.404c-0.607,0-1.453-0.002-1.974-0.358c-0.519-0.357-0.703,0.153-1.049,0.512 c-0.224,0.232-2.554-0.92-2.554-0.92l-0.344-1.002l-2.125-0.143l-1.355,0.404l-1.32-0.208l1.465-0.522c0,0,1.053-0.988,1.432-1.311 c0.32-0.272,1.602-0.106,1.602-0.106l1.465,1.173c0,0-0.101,0.535-0.234,0.713c0.535-0.036,0.937-0.723,0.937-0.723 c-1.188-1.044-1.183-1.297-1.183-1.297l1.527,0.862l0.108,0.444c0,0,0.608,1.048,1.194,1.092c0.25,0.019,0.045-0.984,0.045-0.984 l0.313-0.044c0.613,1.421,2.778,1.279,3.176,1.611C58.864,15.07,57.973,14.476,57.719,14.404z M58.124,11.868 c-0.545-0.214-1.104-0.108-1.104-0.108c-0.123,0.241-1-0.007-0.823-0.541c0.175-0.534,0.75-0.113,1.014-0.403 c0.267-0.291,0.64-0.484,0.812-0.209c-0.198,0.263,0.176,0.47,0.437,0.61C59.188,11.611,59.668,12.179,58.124,11.868z M61.141,13.174c-0.273-0.244-0.098-0.533-0.512-0.922c-0.596-0.555-0.923-0.795-0.578-1.403c0.582-0.277,0.235,0.372,0.455,0.682 c0.116,0.165,0.641,0.688,1.139,1.359C62.059,13.448,61.416,13.419,61.141,13.174z" fill="url(#_22)"/>
+<path d="M13.257,34.175c-2.879,0-6.823,0.685-7.823,6.593l-0.15,0.894c0,0,6.635,0,7.422,0 c0.238,0.428,0.592,1.065,0.818,1.475c-0.228,0.408-0.58,1.048-0.818,1.474c-0.787,0-7.422,0-7.422,0l0.15,0.894 c1,5.907,4.944,6.593,7.823,6.593c2.271,0,4.293-1.904,5.92-3.439c0.88-0.824,1.707-1.604,2.146-1.604H41.64l0.226-0.25 c0.438-0.479,1.452-1.791,1.476-3.631v-0.063c-0.021-1.842-1.035-3.15-1.476-3.633l-0.226-0.248H21.323 c-0.439,0-1.269-0.779-2.146-1.604C17.55,36.082,15.527,34.175,13.257,34.175z" fill="#FFFFFF"/>
+<linearGradient id="_23" gradientUnits="userSpaceOnUse" x1="11.87" y1="29.37" x2="33.77" y2="55.72">
+<stop stop-color="#E6EDF3" offset="0"/>
+<stop stop-color="#CABAD7" offset="0.12"/>
+<stop stop-color="#AB7EB8" offset="0.27"/>
+<stop stop-color="#9759A4" offset="0.38"/>
+<stop stop-color="#8F4B9C" offset="0.44"/>
+<stop stop-color="#73357C" offset="0.57"/>
+<stop stop-color="#551D5A" offset="0.72"/>
+<stop stop-color="#430E45" offset="0.85"/>
+<stop stop-color="#3C093D" offset="0.94"/>
+</linearGradient>
+<path d="M42.577,43.134c0-0.01,0.004-0.016,0.004-0.022h-0.006c-0.019-1.603-0.937-2.758-1.271-3.127 c-0.431,0-19.98,0-19.98,0c-0.744,0-1.551-0.762-2.672-1.813c-1.525-1.438-3.426-3.229-5.396-3.229 c-3.194,0-6.221,0.938-7.067,5.955c1.201,0,6.967,0,6.967,0l1.238,2.237l-1.238,2.236c0,0-5.766,0-6.967,0 c0.848,5.019,3.873,5.954,7.067,5.954c1.97,0,3.869-1.791,5.396-3.229c1.121-1.054,1.928-1.814,2.672-1.814c0,0,19.551,0,19.98,0 c0.336-0.368,1.254-1.524,1.271-3.127h0.006C42.581,43.148,42.577,43.143,42.577,43.134z" fill="url(#_23)"/>
+<linearGradient id="_24" gradientUnits="userSpaceOnUse" x1="60.04" y1="44.95" x2="53.21" y2="38.72">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<path d="M54.133,33.221c-3.443,4.688,0.641,10.813,5.01,10.975C52.123,50.094,44.469,35.391,54.133,33.221z" fill="url(#_24)"/>
+<linearGradient id="_25" gradientUnits="userSpaceOnUse" x1="62.84" y1="23.85" x2="43.12" y2="35.85">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<path d="M48.047,36.475l0.84-2.887l-4.447,2.348L48.047,36.475z M46.619,30.537l3.318,2.462l-0.868-3.747 L46.619,30.537z M55.09,25.662l-3.949,1.687l0.926,3.254l4.693-2.799L55.09,25.662z" fill="url(#_25)"/>
+<linearGradient id="_26" gradientUnits="userSpaceOnUse" x1="66.67" y1="38.97" x2="43.57" y2="37.88">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<path d="M51.542,50.199l4.292-2.658l-3.205,0.605L51.542,50.199z M56.988,51.357l3.007-1.852l-3.003-1.331 L56.988,51.357z M69.43,42.926l-1.682-2.023l-2.749,1.545l-1.487-0.225l-2.758,4.295l1.426,2.906l4.266-2.588l-0.784-1.471 L69.43,42.926z M61.624,34.622l5.021-2.455l-1.17-1.293l1.063-1.723l-4.261,1.813l-1.611,2.628L61.624,34.622z M56.588,32.025 l4.748-4.021l-0.205-2.13l-4.281,1.752C56.85,27.626,56.456,31.941,56.588,32.025z M66.196,38.814l3.885-1.719L68.079,36.6l0,0 c0-0.021-0.159-1.223-0.219-1.354l-6.894,3.256L66.196,38.814z" fill="url(#_26)"/>
+<linearGradient id="_27" gradientUnits="userSpaceOnUse" x1="57.18" y1="26.83" x2="79.43" y2="59.43">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<path d="M57.209,25.501l-3.921,1.529l3.55,0.592l4.313-1.761L57.209,25.501z M63.465,26.814l-4.299,1.779 l3.109,2.368l4.263-1.828L63.465,26.814z M66.196,38.807l-0.045,3.813l3.913-1.908l0.017-3.614L66.196,38.807z M63.749,47.865 l3.872-2.037l1.803-2.903l-3.889,1.964L63.749,47.865z M65.628,36.434l3.786-1.779l-1.541-3.414l-4.004,1.689L65.628,36.434z" fill="url(#_27)"/>
+<linearGradient id="_28" gradientUnits="userSpaceOnUse" x1="48.33" y1="19.58" x2="58.16" y2="46.98">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<path d="M66.198,38.809l-0.047,3.824l-2.45-0.285l-0.266,0.977l2.098,1.55l-1.803,3.024l-2.024-1.506 l-0.676,0.698l1.147,2.347l-2.985,1.559l-1.121-2.297l-1.073,0.223l-0.012,2.448l-3.377-0.339l-0.035-2.463l-0.939-0.414 l-1.093,2.031l-2.962-2.217l1.072-2.05l-0.809-0.953l-1.832,1.032l-1.773-3.553l1.861-1.041l-0.256-1.188l-2.277-0.301l-0.127-3.986 l2.295,0.322l0.191-1.113l-1.961-1.602l1.655-3.01l1.922,1.439l0.792-0.756l-1.181-2.269l2.985-1.6l1.229,2.415l0.955-0.17 l-0.032-2.555l3.557,0.586l0.031,2.522l1.117,0.508l1.178-2.062l3.104,2.366l-1.225,2.086l0.701,0.895l2.118-1.012l1.789,3.494 l-2.153,1.042l0.219,1.035L66.198,38.809z M52.982,33.568c-2.766,0.935-3.98,4.385-2.732,7.664c1.234,3.252,4.43,5.02,7.158,3.992 c2.729-1.013,3.995-4.359,2.802-7.52C59.002,34.52,55.758,32.65,52.982,33.568z" fill="url(#_28)"/>
+</svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/bitmaps/qgn_prop_set_voip.svg	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,130 @@
+<?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 49">
+<g>
+<rect fill="none" width="57" height="49"/>
+<g>
+<g>
+<radialGradient id="SVGID_1_" cx="-367.7129" cy="255.8301" r="4.4971" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#00000C"/>
+<stop offset="0.26" style="stop-color:#16168B"/>
+<stop offset="0.5" style="stop-color:#3838DB"/>
+<stop offset="0.85" style="stop-color:#4646FC"/>
+<stop offset="1" style="stop-color:#0E0EA8"/>
+</radialGradient>
+<path fill="url(#SVGID_1_)" d="M45.512,23.581c0,9.379-7.611,16.982-17.008,16.982c-9.392,0-17.005-7.602-17.005-16.982     c0-9.382,7.613-16.985,17.005-16.985C37.9,6.596,45.512,14.199,45.512,23.581z"/>
+<radialGradient id="SVGID_2_" cx="-367.9023" cy="256.2021" r="3.9574" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<polygon fill="url(#SVGID_2_)" points="35.406,8.523 35.806,8.985 36.765,9.469 36.896,9.139 36.776,8.75 35.312,8.032    "/>
+<radialGradient id="SVGID_3_" cx="-367.9023" cy="256.1826" r="3.7104" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<path fill="url(#SVGID_3_)" d="M45.441,21.841c-0.176-2.614-1.315-5.326-2.507-7.265c-1.19-1.938-1.671,1.401-1.671,1.401     l0.266-0.266l0.441,0.188l0.58,0.533l0.012-0.311l-0.457-1.289l0.553-0.132l0.115,0.754l0.389,0.889l-0.229,0.526l-0.739-0.063     l-0.441-0.284l-0.133,0.311l0.354,0.563l0.062,0.568l-0.251,0.369l-0.073,1.01l-0.621-0.041l-0.139,0.511l0.638,0.629     l-0.155,0.618l-1.188,0.19l-0.144,0.389l0.072,1.465l1.324,0.282l0.477-0.441l0.594-1.665l0.809-0.8l0.684,0.713l0.046,0.878     l0.399-0.291l0.002-1.011L43.8,19.857l0.269-0.133l0.574,0.832l0.475,0.8l-0.041,1.899l-0.716,0.27l-0.617-0.63l-1.429,0.326     l-2.016,1.51l0.031,0.848l-1.145,0.829l-0.658,1.609l0.225,0.971l-0.444,0.389l0.147,0.917l0.476,0.924l0.876,0.401l3.014-1.242     l0.074,0.832l-0.273,0.231l-0.455,1.978l-1.59,1.435l-1.16,1.76c0,0,1.546-1.363,2.643-2.745c0.985-1.244,2.096-3.382,2.738-5.35     C45.438,26.548,45.615,24.355,45.441,21.841z"/>
+<radialGradient id="SVGID_4_" cx="-367.9023" cy="256.21" r="3.9468" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<polygon fill="url(#SVGID_4_)" points="22.915,10.876 22.425,10.385 21.313,10.474 21.179,10.696 21.491,10.963    "/>
+<radialGradient id="SVGID_5_" cx="-367.9028" cy="256.1895" r="3.9685" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<polygon fill="url(#SVGID_5_)" points="39.717,18.607 40.116,17.797 40.369,17.955 40.369,18.85 40.992,18.834 41.349,18.212      39.657,16.433 39.41,16.745 39.701,17.367 39.211,17.59 39.189,18.45    "/>
+<radialGradient id="SVGID_6_" cx="-367.9028" cy="256.1855" r="3.9721" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<polygon fill="url(#SVGID_6_)" points="23.251,10.322 26.969,8.517 26.225,8.28 23.925,8.67 23.894,9.139 23.144,9.081      22.448,9.438 22.645,10.118 22.423,10.385    "/>
+<radialGradient id="SVGID_7_" cx="-367.9023" cy="256.1924" r="3.9603" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<polygon fill="url(#SVGID_7_)" points="20.6,29.018 21.123,29.398 21.837,29.22 21.8,28.93    "/>
+<radialGradient id="SVGID_8_" cx="-367.9023" cy="256.1885" r="3.9692" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<polygon fill="url(#SVGID_8_)" points="34.032,12.172 33.252,11.731 33.844,11.078 32.305,8.574 30.703,8.116 27.632,8.695      25.177,9.816 24.869,10.474 27.066,10.975 27.33,13.228 27.812,13.318 27.404,14.67 29.1,16.521 30.324,16.405 30.616,14.831      32.421,13.616 34.074,13.289    "/>
+<radialGradient id="SVGID_9_" cx="-367.9023" cy="255.9844" r="4.1639" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#0D2E0D"/>
+<stop offset="0.3" style="stop-color:#1B861B"/>
+<stop offset="0.75" style="stop-color:#2DF22D"/>
+<stop offset="1" style="stop-color:#34D134"/>
+</radialGradient>
+<path fill="url(#SVGID_9_)" d="M30.875,34.255l-0.724,0.186l-2.732-1.138l-3.595-1.827l-8.223-3.311l-0.879-0.91v-1.791     l1.289,0.167l6.062-3.656l1.555,0.05l1.098-0.59l-1.014-0.221l-0.14-0.753l1.931-0.449l-0.336,0.617l1.176,0.529l0.972,0.159     l-0.804-1.025l-0.589-0.477l0.813-0.277l-0.892-1.155l-0.623-0.269l-0.332-0.009l-0.426-1.46l-1.369,0.514l-0.547-1.269     l-1.425-0.266l-0.121,2.116l-0.552,0.099l-0.628,0.604l0.324,0.693l-1.155-0.193l0.271-1.031l-0.897-0.476l-0.225-0.559     l-0.455,0.157l-0.214-0.917l0.935-1.341l1.079-0.248l0.729,0.392l0.247-0.589l-0.314-0.089l1.381-1.557l0.785,0.029l0.377,0.488     l-0.718,0.24l0.285,0.273l0.868-0.112l-1.688,1.172l1.772,0.897l1.261-0.475l-0.364-0.95l0.67,0.438l0.783-0.553l-1.274-0.646     v-0.714l-0.678-0.36l-0.568-0.975l-1.287-0.043l-1.035,0.502l0.251,0.503l-0.588,0.589l-0.191-0.616l-1.294,0.141l-0.841,0.57     l0.563-0.907l0.416-0.872l-0.501-0.33l-0.252-0.894l-0.996,0.773l-0.12,1.785l-0.313,0.043l-0.306-1.143     c0,0-2.152,1.87-3.606,5.237c-1.526,3.53-1.407,6.388-1.407,6.388l1.799,3.105l-0.084,1.23l1.429,0.975l1.022,0.262l2.953,2.929     l10.255,6.894l1.479-1.04l0.592-1.058l1.153-0.478l0.269-1.214L30.875,34.255z"/>
+</g>
+<g>
+<linearGradient id="SVGID_10_" gradientUnits="userSpaceOnUse" x1="-366.8179" y1="259.6748" x2="-366.4105" y2="258.1545" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)">
+<stop offset="0" style="stop-color:#864E00"/>
+<stop offset="0.45" style="stop-color:#FCA703"/>
+<stop offset="0.64" style="stop-color:#FFD400"/>
+<stop offset="1" style="stop-color:#AC6D00"/>
+</linearGradient>
+<path fill="url(#SVGID_10_)" d="M37.619,11.704l-8.402,6.693l0.562,6.147l4.925-1.745c0,0-1.401-2.344-1.423-3.693     c-0.068-2.61,4.591-5.983,5.048-5.849L37.619,11.704z"/>
+<path fill="#613624" d="M27.279,27.945c3.578-0.861,5.139-1.888,7.424-4.419C33.604,23.662,29.427,24.387,27.279,27.945z"/>
+<linearGradient id="SVGID_11_" gradientUnits="userSpaceOnUse" x1="-365.4063" y1="260.3232" x2="-365.1875" y2="259.7222" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)">
+<stop offset="0" style="stop-color:#FFFF00"/>
+<stop offset="0.35" style="stop-color:#FFFF00"/>
+<stop offset="0.8" style="stop-color:#DEC500"/>
+<stop offset="1" style="stop-color:#D98800"/>
+</linearGradient>
+<path fill="url(#SVGID_11_)" d="M35.84,11.104l9.467-0.03l4.368-1.088C47.031,8.967,41.395,6.722,35.84,11.104z"/>
+<path fill="#613624" d="M49.859,10.866c-4.289-0.643-8.224,4.229-8.764,4.897C45.088,15.792,48.965,12.067,49.859,10.866z"/>
+<radialGradient id="SVGID_12_" cx="-367.522" cy="260.4346" r="2.5978" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)" gradientUnits="userSpaceOnUse">
+<stop offset="0" style="stop-color:#ECE617"/>
+<stop offset="0.7" style="stop-color:#ECE617"/>
+<stop offset="1" style="stop-color:#D98800"/>
+</radialGradient>
+<path fill="url(#SVGID_12_)" d="M29.778,24.545c-0.15-4.391,0.655-5.473,2.386-7.897c0.75-1.049,3.531-3.445,4.41-3.683     c1.883-0.505,3.869,2.142,3.869,2.142l4.888-4.044c-1.512-1.21-3.692-1.927-5.526-1.845c-4.049,0.182-10.912,8.839-11.9,10.954     c-1.235,2.645-1.335,7.284-1.335,7.284L29.778,24.545z"/>
+<linearGradient id="SVGID_13_" gradientUnits="userSpaceOnUse" x1="-367.6567" y1="257.584" x2="-366.4244" y2="258.0325" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)">
+<stop offset="0" style="stop-color:#6D2800"/>
+<stop offset="0.3" style="stop-color:#E89000"/>
+<stop offset="0.6" style="stop-color:#F7FC00"/>
+<stop offset="0.9" style="stop-color:#EFC400"/>
+<stop offset="1" style="stop-color:#832100"/>
+</linearGradient>
+<path fill="url(#SVGID_13_)" d="M26.569,27.457l0.71,0.488c1.686-2.473,4.342-3.759,7.424-4.42V22.8     C31.893,22.855,28.4,25.041,26.569,27.457z"/>
+<linearGradient id="SVGID_14_" gradientUnits="userSpaceOnUse" x1="-365.6587" y1="259.4033" x2="-364.2097" y2="259.9307" gradientTransform="matrix(6.7645 0 0 -6.7645 2513.6965 1769.1666)">
+<stop offset="0" style="stop-color:#6D2800"/>
+<stop offset="0.3" style="stop-color:#E89000"/>
+<stop offset="0.6" style="stop-color:#F7FC00"/>
+<stop offset="0.9" style="stop-color:#EFC400"/>
+<stop offset="1" style="stop-color:#832100"/>
+</linearGradient>
+<path fill="url(#SVGID_14_)" d="M49.676,9.986c-3.309-0.387-6.566,2.332-9.232,5.12l0.654,0.656     c2.531-2.559,5.611-5.257,8.762-4.896L49.676,9.986z"/>
+</g>
+<g>
+<path fill="#FFFFFF" d="M26.195,38.514c-1.014-1.363-2.999-4.098-3.35-5.068c-0.353-0.969-0.22-2.688-0.177-4.761     c0.044-2.071,0-2.866-1.587-5.16c-1.585-2.29-4.098-3.084-5.067-3.393c-0.971-0.307-2.425-0.616-2.734-0.573     C12.971,19.604,12.75,20,12.75,20l4.584,6.746l-4.584,5.466l-4.319-5.775c0,0-0.397-0.132-0.53,0.043     c-0.134,0.177,0.149,7.314,2.789,9.806c1.193,1.125,2.351,1.747,4.098,1.831c0.723,0.035,1.983,0.185,2.753,1.144     c2.792,3.456,3.108,3.979,3.108,3.979l0.742,0.301l2.576,0.719l0.479-0.096l2.906,0.814l0.187,0.278l2.715,0.61l1.408-0.033     C31.66,45.832,27.21,39.88,26.195,38.514z"/>
+<linearGradient id="SVGID_15_" gradientUnits="userSpaceOnUse" x1="-104.8242" y1="-96.8931" x2="-94.5499" y2="-125.1214" gradientTransform="matrix(1 0 0 -1 123.4648 -77.8281)">
+<stop offset="0" style="stop-color:#E5E5E5"/>
+<stop offset="0.3037" style="stop-color:#4D4D4D"/>
+<stop offset="0.3933" style="stop-color:#4D4D4D"/>
+<stop offset="0.5618" style="stop-color:#CCCCCC"/>
+<stop offset="1" style="stop-color:#CCCCCC"/>
+</linearGradient>
+<path fill="url(#SVGID_15_)" d="M28.369,37.862c-2.752-3.326-3.362-4.809-3.644-5.632c-0.283-0.822,0.224-3.939-0.034-5.891     c-0.26-1.953-1.965-3.951-3.799-5.258c-1.834-1.305-4.95-1.681-5.282-1.715c-0.329-0.038-2.331,0.191-2.331,0.191     c0.309-0.044,1.764,0.267,2.734,0.573c0.969,0.309,3.482,1.104,5.067,3.394c1.587,2.293,1.633,3.086,1.587,5.16     c-0.043,2.071-0.176,3.791,0.177,4.76c0.351,0.969,2.336,3.704,3.35,5.068c1.015,1.365,5.465,7.318,5.465,7.318l1.849-1.149     C33.508,44.683,31.123,41.19,28.369,37.862z"/>
+<path fill="#808080" d="M8.431,26.437l4.319,5.775l1.438-1.717c-0.819-1.087-3.359-4.451-3.454-4.534     c-0.115-0.104-0.229-0.055-0.229-0.055l-2.305,0.485C8.323,26.401,8.431,26.437,8.431,26.437z"/>
+<polygon fill="#D9D9D9" points="23.947,44.246 17.642,36.236 20.163,34.756 27.999,45.152 24.442,44.169    "/>
+<path fill="#FF9400" d="M21.023,35.942c0,0-0.638-0.8-1.425-0.123c-0.765,0.66-0.202,1.425-0.202,1.425l5.046,6.925l3.556,0.982     L21.023,35.942z"/>
+<path fill="#B5B5B5" d="M12.883,32.83c0,0,4.484-5.376,4.693-5.664c0.588-0.807,0.116-1.293,0.116-1.293l-3.752-5.078     c0,0,2.777,0.749,3.969,1.454c1.188,0.706,2.731,2.557,3.259,4.013c0.53,1.453,0.294,3.752,0.261,4.639     c-0.101,2.771,0.769,3.879,0.769,3.879l8.054,11.095l-2.731-0.618l-7.001-9.245c0,0-0.637-0.8-1.425-0.121     c-0.765,0.658-0.202,1.423-0.202,1.423l5.053,6.935l-2.555-0.707c0,0-3.174-4.23-3.836-4.979     c-0.661-0.749-1.676-0.749-3.084-1.014c-1.411-0.267-1.63,0.089-3.616-1.722c-1.983-1.804-2.688-7.935-2.688-7.935l3.731,4.936     C11.897,32.824,12.357,33.354,12.883,32.83z"/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/bitmaps/qgn_prop_set_voip_advanced.svg	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!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" width="84" height="58" viewBox="0 0 84 58">
+<rect fill="none" height="58" width="84"/>
+<linearGradient id="_22" gradientUnits="userSpaceOnUse" x1="32.78" y1="19.19" x2="55.19" y2="64.01">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M70.801,29.545c-0.367-2.903-1.959-4.788-2.277-5.138l-0.012-0.013l0,0l-0.043-0.046l-0.002-0.002 l-0.377-0.204c-1.726-0.843-3.871-1.036-3.967-1.044l-0.238,0.037c-1.524,0.643-3.177,1.524-4.877,2.579 c0.02-0.376,0.033-0.753,0.033-1.133c0-11.027-8.939-19.965-19.965-19.965c-11.028,0-19.965,8.94-19.965,19.966 c0,11.027,8.939,19.966,19.965,19.966c0.458,0,0.913-0.022,1.365-0.051l-1.399,3.887c-0.207,0.513-0.824,1.824-0.875,1.897 c-0.061,0.092-0.262,0.221-0.629,0.316c-0.388,0.1-2.982,0.104-3.653,0.063c-0.619-0.045-1.203-0.082-1.726-0.082 c-0.415,0.001-0.854,0.016-1.3,0.158c-0.269,0.093-0.567,0.213-0.885,0.344c-0.321,0.131-0.653,0.266-1.005,0.393 c-0.798,0.285-1.467,0.43-2.001,0.43c-0.302-0.002-0.566-0.047-0.783-0.137c-0.237-0.104-0.42-0.244-0.593-0.461 c-0.114-0.144-0.169-0.367-0.171-0.683c-0.003-0.601,0.225-1.438,0.472-2.265c0.031-0.108,0.063-0.219,0.095-0.326 c0.227-0.766,0.462-1.563,0.48-2.332l0.001-0.053c0.001-0.836-0.279-1.647-0.811-2.345c-0.552-0.726-1.328-1.321-2.372-1.831 c-0.12-0.06-0.24-0.115-0.364-0.166c-0.002-0.109-0.009-0.219-0.018-0.326c-0.14-1.58-0.364-2.188-1.088-3.236l-0.577-0.653 l-5.058-1.235l-2.043,0.862l-1.007,0.423l-0.279-0.066l-0.143,0.062l-1.827,0.759l0.117,1.703l1.659,0.443L10.89,40.71l0.058,1.728 l2.875,0.785l0.032,1.491l5.295,1.778l2.634-1.899c0,0,0.496-0.585,0.697-1.005c0.197,0.102,0.381,0.207,0.548,0.32 c0.377,0.254,0.679,0.533,0.874,0.811c0.216,0.309,0.312,0.592,0.314,0.938l-0.001,0.027c0,0.436-0.279,1.358-0.485,2.039 l-0.004,0.016c-0.259,0.886-0.551,1.89-0.557,2.886c-0.001,0.829,0.22,1.526,0.655,2.081c0.399,0.503,0.913,0.896,1.484,1.136 c0.499,0.209,1.057,0.315,1.661,0.315h0.001c1.043-0.002,2.022-0.303,2.758-0.563c0.418-0.147,0.802-0.304,1.14-0.442 c0.287-0.117,0.532-0.217,0.712-0.276c0.046-0.013,0.247-0.042,0.543-0.042c0,0,3.031,0.174,3.792,0.174 c0.894,0,1.586-0.07,2.184-0.225c0.87-0.225,1.495-0.617,1.915-1.209c0.24-0.346,0.46-0.803,0.716-1.385 c0.036-0.08,0.077-0.176,0.116-0.267c0.433,0.461,3.109,3.086,8.486,3.993l0.365-0.081c3.87-2.589,6.394-6.353,7.097-8.753 l0.168-2.182c0,0-0.125-3.037-0.31-4.166c0.61-0.578,1.188-1.123,1.735-1.641c1.112-1.049,2.092-1.971,2.967-2.813 c1.121,0.791,3.324,1.869,4.746,2.188l0.158,0.036l0.152-0.063c1.527-0.653,3.926-3.584,4.188-4.635 C70.827,30.895,70.801,29.545,70.801,29.545z" fill="url(#_22)"/>
+<linearGradient id="_23" gradientUnits="userSpaceOnUse" x1="20.35" y1="41.7" x2="25.88" y2="40.65">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#003D6D" offset="1"/>
+</linearGradient>
+<path d="M22.43,41.02c-0.15-1.697-0.387-2.172-1.342-3.48l-1.946,0.982l-0.073,7.44l2.437-1.755 C21.881,43.789,22.587,42.779,22.43,41.02z" fill="url(#_23)"/>
+<linearGradient id="_24" gradientUnits="userSpaceOnUse" x1="11.36" y1="39.2" x2="15.22" y2="39.24">
+<stop stop-color="#FFFFFF" offset="0.05"/>
+<stop stop-color="#A2C2DD" offset="1"/>
+</linearGradient>
+<polygon fill="url(#_24)" points="15.176,39.161 15.219,40.238 11.45,39.223 11.378,38.189 "/>
+<linearGradient id="_25" gradientUnits="userSpaceOnUse" x1="10.84" y1="35.26" x2="17.92" y2="42.04">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#003D6D" offset="1"/>
+</linearGradient>
+<polygon fill="url(#_25)" points="15.298,39.171 11.392,38.189 12.892,37.566 16.764,38.505 "/>
+<linearGradient id="_26" gradientUnits="userSpaceOnUse" x1="11.36" y1="42.07" x2="15.23" y2="42.1">
+<stop stop-color="#FFFFFF" offset="0.05"/>
+<stop stop-color="#A2C2DD" offset="1"/>
+</linearGradient>
+<polygon fill="url(#_26)" points="15.201,42.055 15.222,43.111 11.412,42.068 11.377,41.051 "/>
+<polygon fill="url(#_25)" points="15.281,42.064 11.351,41.051 12.873,40.466 16.748,41.396 "/>
+<polygon fill="#CEDFF2" points="14.173,37.215 16.222,36.355 21.129,37.55 19.163,38.508 "/>
+<linearGradient id="_28" gradientUnits="userSpaceOnUse" x1="14.42" y1="33.18" x2="19.06" y2="49">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#003D6D" offset="1"/>
+</linearGradient>
+<path d="M14.323,44.37l-0.149-7.155l4.97,1.305c0,0,2.429,3.766-0.072,7.44L14.323,44.37z" fill="url(#_28)"/>
+<linearGradient id="_29" gradientUnits="userSpaceOnUse" x1="31.48" y1="39.65" x2="36.04" y2="54.77">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M25.493,53.4c-0.48-0.199-0.93-0.529-1.296-0.994l0,0c-0.419-0.529-0.554-1.17-0.552-1.784l0,0 c0.003-0.935,0.283-1.886,0.542-2.769l0,0c0.265-0.875,0.504-1.697,0.504-2.172l0,0c0-0.018,0-0.027,0-0.039l0,0 c-0.002-0.461-0.148-0.842-0.398-1.197l0,0c-0.251-0.356-0.611-0.674-1-0.932l0,0c-0.777-0.523-1.648-0.805-1.817-0.853l0,0 c-0.023-0.009-0.027-0.009-0.027-0.009l0,0c0,0-0.237-0.229-0.132-0.688c0.104-0.457,0.476-0.569,0.476-0.569 c0.025,0.008,0.582,0.16,1.289,0.502l0,0c0.706,0.344,1.571,0.867,2.2,1.691l0,0c0.415,0.544,0.715,1.246,0.714,2.055l0,0 c0,0.019,0,0.033-0.001,0.049l0,0c-0.019,0.806-0.303,1.656-0.557,2.531l0,0c-0.26,0.864-0.493,1.739-0.491,2.398l0,0 c0.002,0.439,0.092,0.746,0.272,0.975l0,0c0.238,0.299,0.493,0.48,0.78,0.602l0,0c0.286,0.119,0.61,0.177,0.969,0.179l0,0 c0.67,0.001,1.444-0.204,2.16-0.461l0,0c0.722-0.259,1.37-0.556,1.883-0.731l0,0c0.357-0.113,0.726-0.129,1.151-0.134l0,0 c1.065,0.002,2.482,0.175,3.754,0.175l0,0c0.657,0,1.271-0.051,1.739-0.17l0,0c0.473-0.121,0.765-0.306,0.902-0.508l0,0 c0.078-0.104,0.724-1.484,0.925-1.988l0,0l2.377-6.606l1.674,0.174l-3.237,7.868c-0.251,0.572-0.458,0.996-0.672,1.304l0,0 c-0.4,0.565-1.01,0.856-1.645,1.021l0,0c-0.64,0.162-1.345,0.207-2.062,0.211l0,0c-1.378-0.004-2.826-0.176-3.755-0.176l0,0 c-0.361-0.002-0.644,0.035-0.739,0.071l0,0c-0.394,0.13-1.078,0.438-1.856,0.718l0,0c-0.785,0.278-1.679,0.534-2.599,0.537l0,0 C26.476,53.68,25.973,53.604,25.493,53.4L25.493,53.4z" fill="url(#_29)"/>
+<linearGradient id="_30" gradientUnits="userSpaceOnUse" x1="37.19" y1="6.61" x2="38.13" y2="8.46">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M31.289,7.971c0.081,0.163,0.345,0.203,0.899,0.026c0.41-0.036,1.48-0.965,2.041-0.777 c0.559,0.185,1.019-0.19,1.54-0.525c1.082,0.096,2.238-0.856,2.458-0.856c0.224,0,1.066,0.154,1.251-0.142 c0,0,2.034,0.478,3.891,0.079c-1.387-0.316-2.827-0.485-4.307-0.485c-1.908,0-3.75,0.28-5.488,0.795 C33.089,6.555,32.567,7.19,31.289,7.971z" fill="url(#_30)"/>
+<radialGradient id="_31" gradientUnits="userSpaceOnUse" cx="40.38" cy="16.81" r="25.2">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</radialGradient>
+<path d="M26.602,10.565c0-0.347,0.569-0.519,0.569-0.519l0.074,0.272l0.519,0.223 c0,0,0.619-0.667,0.743-0.842c0.12-0.171,0.345-0.839,0.345-0.839l1.08-1.274c-2.423,1.306-4.535,3.116-6.194,5.289 C24.404,12.349,26.602,10.912,26.602,10.565z" fill="url(#_31)"/>
+<radialGradient id="_32" gradientUnits="userSpaceOnUse" cx="37.21" cy="9.07" r="4.35">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</radialGradient>
+<path d="M36.801,7.516C37.046,7.468,37.6,7.208,37.6,7.208s-0.277-0.118-0.592-0.07 C36.696,7.186,36.244,6.949,36,7.067C36.208,7.326,36.557,7.562,36.801,7.516z" fill="url(#_32)"/>
+<radialGradient id="_33" gradientUnits="userSpaceOnUse" cx="42.87" cy="12.15" r="35.66">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.53"/>
+<stop stop-color="#6C83BB" offset="0.87"/>
+<stop stop-color="#003D6D" offset="1"/>
+</radialGradient>
+<circle cx="39.062" cy="24.568" fill="url(#_33)" r="19.275"/>
+<path d="M54.518,30.697l-0.631,0.998c0,0-0.941,0.297-0.979,0.596c-0.018,0.124-0.729,1.701-0.729,1.701 s-0.278,0.881,0.52,0.619C54.361,34.068,55.447,30.514,54.518,30.697z" fill="url(#_31)"/>
+<path d="M24.503,32.658c0.273,0,0.974,0.087,1.059-0.17c0.006-0.108,0.104-2.745,0.104-2.745l1.049-1.396 v-1.112l-2.731-1.769l-1.185-1.283c0,0.004-0.459-1.387-0.891-1.779c-0.36-0.328-0.333-1.05-0.718-1.583 c-0.346-0.481-0.626-0.751-0.848-0.858c-1.761,7.135,0.97,13.198,3.529,16.471c0.366-0.525,0.656-1.109,0.88-1.625 C24.981,34.275,23.588,33.521,24.503,32.658z" fill="url(#_31)"/>
+<radialGradient id="_36" gradientUnits="userSpaceOnUse" cx="42.88" cy="12.02" r="23.35">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#003D6D" offset="1"/>
+</radialGradient>
+<path d="M47.939,7.456c-0.592,0.166-1.079,0.292-1.194,0.292c-0.335,0-0.245-0.283-0.542-0.321 c-0.302-0.037-2.787-0.679-3.121-0.345c-0.336,0.335-1.648,0.678-1.946,0.717c-0.298,0.037,0.099,0.94,0.892,1.508 c-0.11,0.111-1.883,1.09-1.883,0.418c0-0.67-0.341-1.161-0.886-1.36c-0.497,0.124-1.063,0.643-0.272,1.36 c0.492,0.446,0.004,0.506-0.032,0.635c-0.145,0.54,1.184,1.063,0.549,1.459c-0.596,0.052-1.129-0.057-1.228-0.112 c-0.938-0.525-1.15,1.558-1.15,1.558l1.025,0.505l-1.71,1.665c0,0-2.507,1.739-2.545,1.963c-0.037,0.224-1.113,3.108-0.741,3.968 c0.371,0.858,2.304,3.167,3.196,3.24c1.167,0.094,4.538-0.579,4.538-0.579c0.075,0.188,0.42,0.933,2.074,1.241 c0.061,0.011-0.714,1.494-0.26,2.131c1.159,2.542,0.239,3.503,0.281,4.632c0.041,1.113,1.842,5.896,3.387,5.896 c2.676,0,5.227-5.771,5.854-6.479c0.627-0.711-0.377-3.679,0.711-4.766c1.088-1.087,3.22-2.592,3.262-5.017 c-1.255,0.752-2.676,0.794-2.676,0.794l-1.609-3.317l-1.188-1.804l0.147-0.371l2.572,3.497c0.233,0.679,0.142,0.319,0.327,1.117 c1.465-0.355,2.986-1.595,2.394-3.152c-0.026-0.027-0.392,0.046-0.931,0.009c-0.832-0.607-1.332-1.889-1.332-1.889l1.889,1.589 l0.926,0.074l0.588,1.162c0.162,0.107,0.276,0.179,0.276,0.179s0.039,0.006,0.103,0.008C56.27,14.297,52.682,9.919,47.939,7.456z M43.823,8.221c-0.154-0.396,0.459-0.543,0.459-0.543s0.608,0.885,0.515,1.469c-0.097,0.58-0.742,0.224-0.938,0.051 C43.667,9.027,43.979,8.617,43.823,8.221z M49.373,15.645c-0.634,0-1.518-0.002-2.056-0.374c-0.538-0.371-0.731,0.159-1.091,0.532 c-0.235,0.242-2.66-0.958-2.66-0.958l-0.36-1.043l-2.211-0.15l-1.413,0.421l-1.376-0.217l1.525-0.544c0,0,1.098-1.029,1.491-1.365 c0.333-0.283,1.667-0.111,1.667-0.111l1.527,1.223c0,0-0.105,0.558-0.242,0.744c0.557-0.039,0.973-0.753,0.973-0.753 c-1.237-1.088-1.229-1.352-1.229-1.352l1.589,0.898l0.113,0.462c0,0,0.634,1.092,1.245,1.138c0.261,0.02,0.046-1.025,0.046-1.025 l0.328-0.047c0.637,1.48,2.893,1.333,3.305,1.678C50.564,16.338,49.637,15.72,49.373,15.645z M49.799,13.002 c-0.57-0.222-1.152-0.112-1.152-0.112c-0.131,0.251-1.045-0.008-0.861-0.563c0.184-0.557,0.783-0.117,1.059-0.42 c0.275-0.303,0.666-0.504,0.846-0.217c-0.207,0.274,0.184,0.489,0.453,0.634C50.903,12.735,51.402,13.327,49.799,13.002z M52.938,14.363c-0.283-0.254-0.104-0.555-0.53-0.96c-0.621-0.579-0.964-0.828-0.604-1.461c0.606-0.288,0.246,0.388,0.475,0.71 c0.123,0.172,0.669,0.717,1.188,1.416C53.896,14.648,53.225,14.619,52.938,14.363z" fill="url(#_36)"/>
+<path d="M68.936,45.577l-6.817-6.818l-2.358,2.362l4.455,4.456c-1.38,1.383-4.455,4.456-4.455,4.456l2.358,2.367 L68.936,45.577z M68.563,38.759l-2.357,2.362c0,0,3.073,3.074,4.451,4.456c-1.378,1.383-4.451,4.456-4.451,4.456l2.357,2.367 l6.818-6.823L68.563,38.759z" fill="#FFFFFF"/>
+<path d="M68.563,39.406l-1.717,1.715c0,0,3.248,3.247,4.457,4.456c-1.209,1.211-4.457,4.456-4.457,4.456 l1.717,1.721l6.173-6.177L68.563,39.406z M62.117,39.406l-1.715,1.715c0,0,3.244,3.247,4.455,4.456 c-1.211,1.211-4.455,4.456-4.455,4.456l1.715,1.721l6.175-6.177L62.117,39.406z" fill="#235487"/>
+<linearGradient id="_37" gradientUnits="userSpaceOnUse" x1="76.16" y1="25.46" x2="57.56" y2="39.44">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#4A9900" offset="0.44"/>
+<stop stop-color="#0E4E58" offset="0.94"/>
+</linearGradient>
+<path d="M70.292,29.619l-8.446,3.463L61.303,33.6c0.816,0.705,3.318,2.016,4.91,2.373 c1.357-0.582,3.674-3.402,3.893-4.291C70.357,30.688,70.371,30.121,70.292,29.619z" fill="url(#_37)"/>
+<linearGradient id="_38" gradientUnits="userSpaceOnUse" x1="71.09" y1="32.52" x2="58.02" y2="31.45">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#4A9900" offset="0.44"/>
+<stop stop-color="#0E4E58" offset="0.94"/>
+</linearGradient>
+<path d="M65.34,29.09l-3.715,3.831c1.482,1.036,3.268,1.815,4.484,2.147L65.34,29.09z" fill="url(#_38)"/>
+<linearGradient id="_39" gradientUnits="userSpaceOnUse" x1="72.22" y1="42.8" x2="36.6" y2="52.67">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#4A9900" offset="0.44"/>
+<stop stop-color="#0E4E58" offset="0.94"/>
+</linearGradient>
+<path d="M56.457,42.876l-15.603,5.087l0.31,1.553c0,0,2.586,2.94,8.251,3.893 c3.791-2.534,6.237-6.227,6.896-8.471L56.457,42.876z" fill="url(#_39)"/>
+<linearGradient id="_40" gradientUnits="userSpaceOnUse" x1="34.6" y1="41.09" x2="58.85" y2="52.48">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#4A9900" offset="0.44"/>
+<stop stop-color="#0E4E58" offset="0.94"/>
+</linearGradient>
+<path d="M40.837,47.963c0.392-3.666,2.293-7.005,2.293-7.005l5.754,1.962l0.164,9.008 C44.637,51.266,42.266,49.354,40.837,47.963z" fill="url(#_40)"/>
+<linearGradient id="_41" gradientUnits="userSpaceOnUse" x1="63.16" y1="26.55" x2="36.75" y2="48.76">
+<stop stop-color="#DCE8E4" offset="0"/>
+<stop stop-color="#43910A" offset="1"/>
+</linearGradient>
+<path d="M43.131,40.958c0.866,0.823,3.217,2.321,5.662,2.104l19.355-18.317 c-1.686-0.937-4.066-1.142-4.066-1.142C57.496,26.381,48.936,33.259,43.131,40.958z" fill="url(#_41)"/>
+<linearGradient id="_42" gradientUnits="userSpaceOnUse" x1="75.09" y1="21.51" x2="42.58" y2="52.97">
+<stop stop-color="#DCE8E4" offset="0"/>
+<stop stop-color="#43910A" offset="1"/>
+</linearGradient>
+<path d="M49.047,51.93c-0.5-1.861-0.705-6.824-0.25-8.925c5.305-7.754,12.936-14.686,19.317-18.291 c0,0,1.803,1.878,2.181,4.894c-0.443,1.91-2.654,4.324-4.188,5.455c-0.205-0.461-0.896-5.645-0.896-5.645 c-1.766,2.307-4.545,4.813-9.104,9.13c0.302,1.603,0.351,4.313,0.351,4.313C54.996,46.382,52.398,49.838,49.047,51.93z" fill="url(#_42)"/>
+</svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/bitmaps/qgn_prop_voip_new_service.svg	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!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" width="84" height="58" viewBox="0 0 84 58">
+<rect fill="none" height="58" width="84"/>
+<linearGradient id="_26" gradientUnits="userSpaceOnUse" x1="38.44" y1="32.65" x2="50.02" y2="55.46">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M63.917,43.949l-0.007-3.438c0,0-1.557-0.388-1.797-0.446c-0.025-0.172-0.09-0.571-0.12-0.783 c0.235-0.107,1.392-0.652,1.392-0.652l-1.521-3.377l-0.204,0.039c0,0-1.115,0.395-1.371,0.48c-0.114-0.164-0.323-0.471-0.419-0.611 c0.128-0.209,0.979-1.563,0.979-1.563l-0.166-0.136l-0.254-0.192c0.318-1.289,0.49-2.636,0.49-4.021 c0-6.287-3.484-11.76-8.632-14.592c0.831-0.968,1.78-2.082,1.78-2.082s-5.118-0.933-5.586-1.018 c0.074-0.494,1.418-8.854,1.418-8.854l-6.871-0.884l-3.908,1.629c0,0,0.514,6.039,0.584,6.671c-0.484-0.072-1.794-0.269-1.794-0.269 l-2.373,0.733c0,0,1.079,1.74,2.105,3.392c-5.896,2.562-10.02,8.435-10.02,15.273c0,8.272,6.036,15.133,13.942,16.426l1.604,3.206 c0,0,1.404-0.791,1.665-0.938c0.071,0.084,0.171,0.203,0.268,0.316l-0.092,0.256c-0.209,0.514-0.83,1.834-0.881,1.905 c-0.063,0.093-0.263,0.222-0.634,0.317c-0.39,0.101-2.992,0.105-3.666,0.062c-0.622-0.041-1.208-0.082-1.733-0.082 c-0.417,0.002-0.857,0.017-1.305,0.161c-0.27,0.091-0.57,0.212-0.889,0.344c-0.323,0.131-0.654,0.266-1.009,0.393 c-0.801,0.287-1.473,0.433-2.008,0.433c-0.304-0.002-0.57-0.047-0.787-0.14c-0.238-0.1-0.421-0.243-0.596-0.463 c-0.114-0.144-0.168-0.366-0.171-0.685c-0.003-0.603,0.225-1.444,0.474-2.272c0.031-0.107,0.064-0.221,0.096-0.326 c0.229-0.771,0.463-1.567,0.482-2.34v-0.057c0.001-0.841-0.28-1.652-0.814-2.355c-0.554-0.727-1.332-1.326-2.381-1.836 c-0.119-0.061-0.241-0.114-0.365-0.166c-0.004-0.11-0.011-0.219-0.02-0.329c-0.141-1.584-0.366-2.194-1.091-3.248l-0.58-0.657 l-5.078-1.236L20,36.8l-1.011,0.425l-0.281-0.068l-0.144,0.063l-1.833,0.76l0.117,1.711l1.665,0.446l-1.775,0.675l0.059,1.732 l2.887,0.789l0.031,1.5l5.317,1.779l2.645-1.905c0,0,0.497-0.586,0.7-1.009c0.198,0.102,0.382,0.211,0.55,0.322 c0.378,0.252,0.682,0.532,0.879,0.813c0.216,0.31,0.313,0.595,0.314,0.938L30.119,45.8c0,0.438-0.281,1.366-0.487,2.048 l-0.004,0.016c-0.261,0.89-0.556,1.896-0.56,2.896c-0.001,0.832,0.22,1.532,0.658,2.088c0.4,0.508,0.916,0.903,1.49,1.141 c0.5,0.214,1.06,0.318,1.667,0.318h0.001c1.049-0.002,2.03-0.304,2.768-0.566c0.422-0.148,0.807-0.307,1.146-0.443 c0.287-0.115,0.534-0.217,0.715-0.277c0.045-0.011,0.248-0.041,0.545-0.041c0,0,3.042,0.174,3.809,0.174 c0.895,0,1.59-0.071,2.191-0.226c0.873-0.228,1.502-0.618,1.924-1.216c0.016-0.023,0.033-0.053,0.051-0.08l1.225,0.916l0.129-0.066 c0,0,1.027-0.64,1.471-0.91c0.008,0.486,0.023,1.666,0.023,1.666l3.26,0.328l0.064-0.054c0,0,1.1-0.677,1.414-0.87 c0.098,0.2,0.322,0.662,0.322,0.662l2.844-1.484l4.066-2.398l-0.109-0.277l1.011-0.58l1.642-2.789L62.4,44.686L63.917,43.949z M54.063,47.123l-0.07,0.068l-0.098-0.01c-1.484-0.084-2.983-0.938-4.072-2.238c2.044-0.721,3.904-1.832,5.494-3.242 C55.883,43.721,55.424,45.8,54.063,47.123z" fill="url(#_26)"/>
+<linearGradient id="_27" gradientUnits="userSpaceOnUse" x1="26.24" y1="41.8" x2="31.79" y2="40.75">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#003D6D" offset="1"/>
+</linearGradient>
+<path d="M28.33,41.12c-0.151-1.705-0.39-2.179-1.348-3.495l-1.955,0.986l-0.072,7.474l2.447-1.763 C27.777,43.9,28.486,42.889,28.33,41.12z" fill="url(#_27)"/>
+<linearGradient id="_28" gradientUnits="userSpaceOnUse" x1="17.21" y1="39.29" x2="21.1" y2="39.33">
+<stop stop-color="#FFFFFF" offset="0.05"/>
+<stop stop-color="#A2C2DD" offset="1"/>
+</linearGradient>
+<polygon fill="url(#_28)" points="21.045,39.256 21.087,40.335 17.303,39.314 17.231,38.281 "/>
+<linearGradient id="_29" gradientUnits="userSpaceOnUse" x1="16.67" y1="35.33" x2="23.8" y2="42.15">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#003D6D" offset="1"/>
+</linearGradient>
+<polygon fill="url(#_29)" points="21.166,39.262 17.244,38.281 18.75,37.654 22.638,38.596 "/>
+<linearGradient id="_30" gradientUnits="userSpaceOnUse" x1="17.22" y1="42.17" x2="21.09" y2="42.21">
+<stop stop-color="#FFFFFF" offset="0.05"/>
+<stop stop-color="#A2C2DD" offset="1"/>
+</linearGradient>
+<polygon fill="url(#_30)" points="21.07,42.161 21.091,43.221 17.265,42.175 17.23,41.15 "/>
+<polygon fill="url(#_29)" points="21.149,42.171 17.202,41.15 18.732,40.563 22.623,41.499 "/>
+<polygon fill="#CEDFF2" points="20.038,37.302 22.094,36.438 27.021,37.636 25.047,38.598 "/>
+<linearGradient id="_32" gradientUnits="userSpaceOnUse" x1="20.28" y1="33.19" x2="24.94" y2="49.09">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#003D6D" offset="1"/>
+</linearGradient>
+<path d="M20.187,44.484l-0.149-7.183l4.99,1.31c0,0,2.438,3.779-0.072,7.47L20.187,44.484z" fill="url(#_32)"/>
+<linearGradient id="_33" gradientUnits="userSpaceOnUse" x1="37.41" y1="39.75" x2="42" y2="54.93">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M31.404,53.552c-0.481-0.2-0.933-0.532-1.302-1l0,0c-0.421-0.528-0.557-1.174-0.555-1.79l0,0 c0.004-0.938,0.285-1.895,0.545-2.779l0,0c0.265-0.877,0.505-1.703,0.505-2.181l0,0c0-0.017,0-0.03,0-0.04l0,0 c-0.001-0.462-0.148-0.843-0.399-1.201l0,0c-0.251-0.358-0.613-0.677-1.004-0.937l0,0c-0.78-0.524-1.655-0.808-1.824-0.854l0,0 c-0.023-0.009-0.028-0.011-0.028-0.011l0,0c0,0-0.237-0.228-0.132-0.688c0.104-0.461,0.478-0.573,0.478-0.573 c0.025,0.009,0.584,0.161,1.294,0.502l0,0c0.709,0.345,1.579,0.874,2.209,1.698l0,0c0.418,0.551,0.718,1.252,0.717,2.063l0,0 c0,0.021,0,0.035,0,0.052l0,0c-0.019,0.807-0.304,1.662-0.559,2.541l0,0c-0.262,0.869-0.496,1.748-0.492,2.407l0,0 c0.001,0.44,0.092,0.75,0.273,0.978l0,0c0.239,0.302,0.494,0.486,0.782,0.607l0,0c0.287,0.119,0.613,0.176,0.974,0.176l0,0 c0.672,0.002,1.451-0.203,2.17-0.461l0,0c0.724-0.26,1.374-0.558,1.89-0.733l0,0c0.359-0.115,0.729-0.132,1.156-0.136l0,0 c1.069,0.002,2.491,0.176,3.769,0.176l0,0c0.661,0,1.277-0.049,1.748-0.17l0,0c0.475-0.123,0.77-0.309,0.906-0.51l0,0 c0.074-0.104,0.723-1.492,0.928-1.996l0,0l2.385-6.633l1.682,0.172l-3.248,7.901c-0.254,0.573-0.459,1.001-0.674,1.312l0,0 c-0.403,0.565-1.015,0.857-1.651,1.021l0,0c-0.644,0.164-1.351,0.21-2.072,0.212l0,0c-1.381-0.002-2.835-0.177-3.77-0.175l0,0 c-0.362-0.004-0.648,0.031-0.743,0.066l0,0c-0.395,0.131-1.082,0.443-1.864,0.725l0,0c-0.787,0.277-1.685,0.537-2.609,0.539l0,0 C32.391,53.831,31.886,53.755,31.404,53.552L31.404,53.552z" fill="url(#_33)"/>
+<linearGradient id="_34" gradientUnits="userSpaceOnUse" x1="42.7" y1="14.25" x2="43.49" y2="15.8">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</linearGradient>
+<path d="M37.779,15.395c0.065,0.136,0.287,0.17,0.749,0.022c0.343-0.03,1.235-0.805,1.7-0.649 c0.468,0.154,0.852-0.159,1.285-0.437c0.904,0.08,1.865-0.713,2.051-0.713c0.185,0,0.888,0.128,1.043-0.12 c0,0,1.693,0.398,3.242,0.066c-1.153-0.264-2.356-0.403-3.59-0.403c-1.591,0-3.126,0.233-4.577,0.662 C39.28,14.215,38.844,14.744,37.779,15.395z" fill="url(#_34)"/>
+<radialGradient id="_35" gradientUnits="userSpaceOnUse" cx="45.34" cy="22.77" r="21.01">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</radialGradient>
+<path d="M33.87,17.558c0-0.289,0.474-0.432,0.474-0.432l0.062,0.226l0.433,0.187 c0,0,0.517-0.557,0.619-0.703c0.101-0.143,0.288-0.7,0.288-0.7l0.899-1.061c-2.02,1.089-3.781,2.597-5.165,4.409 C32.037,19.046,33.87,17.848,33.87,17.558z" fill="url(#_35)"/>
+<radialGradient id="_36" gradientUnits="userSpaceOnUse" cx="42.71" cy="16.3" r="3.59">
+<stop stop-color="#A2C2DD" offset="0.1"/>
+<stop stop-color="#6C83BB" offset="0.71"/>
+<stop stop-color="#003D6D" offset="0.99"/>
+</radialGradient>
+<path d="M42.375,15.016c0.203-0.039,0.667-0.256,0.667-0.256s-0.231-0.099-0.493-0.06 c-0.26,0.041-0.638-0.157-0.842-0.059C41.879,14.857,42.17,15.055,42.375,15.016z" fill="url(#_36)"/>
+<radialGradient id="_37" gradientUnits="userSpaceOnUse" cx="47.43" cy="18.87" r="29.75">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.53"/>
+<stop stop-color="#6C83BB" offset="0.87"/>
+<stop stop-color="#003D6D" offset="1"/>
+</radialGradient>
+<circle cx="44.26" cy="29.236" fill="url(#_37)" r="16.074"/>
+<path d="M57.146,34.348l-0.524,0.832c0,0-0.784,0.25-0.815,0.494c-0.017,0.107-0.608,1.42-0.608,1.42 s-0.231,0.733,0.437,0.518C57.02,37.156,57.922,34.193,57.146,34.348z" fill="url(#_35)"/>
+<path d="M32.118,35.982c0.228,0,0.813,0.072,0.883-0.144c0.006-0.092,0.087-2.29,0.087-2.29l0.875-1.163 v-0.929l-2.279-1.475l-0.988-1.07c0,0.004-0.383-1.155-0.741-1.483c-0.301-0.272-0.278-0.875-0.598-1.319 c-0.289-0.402-0.523-0.625-0.708-0.716c-1.469,5.948,0.809,11.006,2.942,13.734c0.306-0.437,0.548-0.924,0.735-1.354 C32.518,37.331,31.355,36.705,32.118,35.982z" fill="url(#_35)"/>
+<radialGradient id="_40" gradientUnits="userSpaceOnUse" cx="47.71" cy="19.01" r="16.14">
+<stop stop-color="#FFFFFF" offset="0"/>
+<stop stop-color="#A2C2DD" offset="0.35"/>
+<stop stop-color="#6C83BB" offset="0.7"/>
+<stop stop-color="#003D6D" offset="1"/>
+</radialGradient>
+<path d="M51.662,14.965c-0.494,0.139-0.898,0.244-0.995,0.244c-0.28,0-0.204-0.236-0.454-0.269 c-0.25-0.03-2.322-0.566-2.603-0.287c-0.277,0.279-1.369,0.565-1.62,0.598c-0.248,0.031,0.081,0.783,0.742,1.257 c-0.09,0.093-1.567,0.909-1.567,0.35c0-0.56-0.287-0.968-0.743-1.133c-0.41,0.102-0.884,0.534-0.226,1.133 c0.409,0.372,0.004,0.421-0.024,0.529c-0.123,0.449,0.986,0.886,0.455,1.216c-0.498,0.044-0.939-0.047-1.021-0.092 c-0.782-0.438-0.961,1.298-0.961,1.298l0.854,0.421l-1.425,1.388c0,0-2.091,1.45-2.123,1.638c-0.031,0.186-0.928,2.592-0.618,3.308 c0.311,0.716,1.921,2.643,2.666,2.703c0.972,0.08,3.784-0.483,3.784-0.483c0.063,0.156,0.35,0.779,1.729,1.037 c0.053,0.008-0.595,1.244-0.213,1.777c0.824,1.149,0.783,2.879,0.783,2.879l7.211-3.592L57.7,27.97h-1.647l-0.09-1.407l-0.99-1.855 l-0.988-1.503l0.124-0.31l2.144,2.917c0.196,0.566,0.33,0.828,0.484,1.494c1.223-0.295,2.279-1.893,1.785-3.19 c-0.022-0.023-0.325,0.038-0.776,0.007c-0.692-0.506-1.11-1.575-1.11-1.575l1.574,1.327l0.774,0.061l0.487,0.969 c0.141,0.09,0.23,0.151,0.23,0.151s0.033,0.004,0.086,0.006C58.609,20.67,55.615,17.02,51.662,14.965z M48.233,15.604 c-0.132-0.329,0.379-0.453,0.379-0.453s0.508,0.738,0.428,1.225c-0.081,0.483-0.618,0.188-0.78,0.042 C48.102,16.276,48.359,15.935,48.233,15.604z M52.855,21.794c-0.527,0-1.262-0.001-1.713-0.312c-0.45-0.309-0.611,0.134-0.912,0.445 c-0.192,0.201-2.219-0.799-2.219-0.799l-0.297-0.871l-1.847-0.124l-1.179,0.351l-1.146-0.182l1.272-0.453 c0,0,0.914-0.858,1.244-1.139c0.275-0.236,1.39-0.093,1.39-0.093l1.272,1.021c0,0-0.088,0.465-0.205,0.619 c0.465-0.031,0.813-0.627,0.813-0.627c-1.032-0.907-1.028-1.127-1.028-1.127l1.328,0.749l0.096,0.386c0,0,0.529,0.909,1.035,0.948 c0.219,0.017,0.041-0.854,0.041-0.854l0.271-0.039c0.529,1.234,2.412,1.111,2.756,1.399C53.854,22.373,53.077,21.856,52.855,21.794z M53.21,19.591c-0.475-0.186-0.96-0.094-0.96-0.094c-0.109,0.209-0.869-0.005-0.718-0.471c0.151-0.463,0.651-0.097,0.883-0.349 c0.229-0.254,0.556-0.421,0.703-0.182c-0.175,0.229,0.151,0.409,0.379,0.529C54.133,19.369,54.551,19.862,53.21,19.591z M55.83,20.727c-0.24-0.213-0.085-0.463-0.445-0.801c-0.52-0.482-0.801-0.691-0.502-1.219c0.504-0.241,0.203,0.323,0.396,0.592 c0.101,0.144,0.558,0.597,0.989,1.181C56.626,20.963,56.069,20.938,55.83,20.727z" fill="url(#_40)"/>
+<linearGradient id="_41" gradientUnits="userSpaceOnUse" x1="44.56" y1="3.57" x2="61.96" y2="4.23">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<polygon fill="url(#_41)" points="49.295,3.15 43.076,2.312 39.641,3.685 45.799,4.815 "/>
+<linearGradient id="_42" gradientUnits="userSpaceOnUse" x1="43.03" y1="11.88" x2="62.57" y2="15.74">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<polygon fill="url(#_42)" points="53.227,12.751 38.126,10.157 36.188,10.791 49.691,14.342 "/>
+<linearGradient id="_43" gradientUnits="userSpaceOnUse" x1="49.29" y1="8.38" x2="47.56" y2="25.26">
+<stop stop-color="#E6EEF4" offset="0"/>
+<stop stop-color="#A3740A" offset="0.44"/>
+<stop stop-color="#474105" offset="0.94"/>
+</linearGradient>
+<polygon fill="url(#_43)" points="45.854,20.782 43.479,22.282 49.822,14.184 53.227,12.751 "/>
+<polygon fill="url(#_43)" points="45.098,13.185 47.958,11.953 49.295,3.15 45.832,4.804 "/>
+<linearGradient id="_45" gradientUnits="userSpaceOnUse" x1="44.7" y1="2.58" x2="42.18" y2="17.33">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<polygon fill="url(#_45)" points="40.271,11.896 39.641,3.685 45.928,4.714 45.098,13.185 49.822,14.184 43.479,22.282 36.188,10.791 "/>
+<linearGradient id="_46" gradientUnits="userSpaceOnUse" x1="54.7" y1="47.38" x2="48.91" y2="42.09">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<path d="M49.678,37.445c-2.928,3.98,0.543,9.186,4.254,9.32C47.971,51.777,41.468,39.288,49.678,37.445z" fill="url(#_46)"/>
+<linearGradient id="_47" gradientUnits="userSpaceOnUse" x1="57.07" y1="29.49" x2="40.32" y2="39.68">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<path d="M44.51,40.208l0.713-2.448l-3.779,1.991L44.51,40.208z M43.297,35.166l2.815,2.092l-0.734-3.182 L43.297,35.166z M50.488,31.025l-3.354,1.435l0.785,2.765l3.986-2.379L50.488,31.025z" fill="url(#_47)"/>
+<linearGradient id="_48" gradientUnits="userSpaceOnUse" x1="60.33" y1="42.33" x2="40.71" y2="41.41">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<path d="M47.477,51.865l3.646-2.256L48.4,50.124L47.477,51.865z M52.102,52.85l2.557-1.57l-2.555-1.129 L52.102,52.85z M62.669,45.689l-1.428-1.721l-2.333,1.313l-1.264-0.189l-2.344,3.646l1.209,2.47l3.625-2.196l-0.668-1.248 L62.669,45.689z M56.04,38.637l4.265-2.085l-0.994-1.101l0.902-1.461l-3.617,1.539l-1.369,2.231L56.04,38.637z M51.762,36.434 l4.032-3.416l-0.175-1.81l-3.635,1.489C51.984,32.695,51.648,36.359,51.762,36.434z M59.922,42.197l3.301-1.463l-1.699-0.418l0,0 c-0.002-0.019-0.137-1.039-0.188-1.151l-5.854,2.767L59.922,42.197z" fill="url(#_48)"/>
+<linearGradient id="_49" gradientUnits="userSpaceOnUse" x1="52.27" y1="32.02" x2="71.16" y2="59.71">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<path d="M52.289,30.891l-3.328,1.299l3.014,0.502l3.664-1.494L52.289,30.891z M57.604,32.007l-3.651,1.511 l2.642,2.01l3.621-1.553L57.604,32.007z M59.922,42.191l-0.037,3.238l3.324-1.621l0.014-3.072L59.922,42.191z M57.844,49.887 l3.291-1.732l1.529-2.463l-3.302,1.666L57.844,49.887z M59.439,40.173l3.216-1.508l-1.31-2.899l-3.4,1.434L59.439,40.173z" fill="url(#_49)"/>
+<linearGradient id="_50" gradientUnits="userSpaceOnUse" x1="44.74" y1="25.86" x2="53.09" y2="49.13">
+<stop stop-color="#E2E6E4" offset="0"/>
+<stop stop-color="#A3740A" offset="1"/>
+</linearGradient>
+<path d="M59.926,42.191l-0.041,3.248l-2.08-0.24l-0.227,0.826l1.783,1.316l-1.532,2.566l-1.722-1.278 l-0.572,0.595l0.977,1.993l-2.537,1.324l-0.955-1.948l-0.908,0.186L52.1,52.861l-2.869-0.287l-0.027-2.096l-0.798-0.348 l-0.929,1.727l-2.516-1.883l0.91-1.74l-0.688-0.81l-1.556,0.874l-1.508-3.016l1.583-0.883l-0.218-1.01l-1.936-0.26l-0.106-3.383 l1.947,0.273l0.166-0.945l-1.667-1.359l1.408-2.559l1.633,1.225l0.672-0.643l-1.004-1.926l2.539-1.359l1.043,2.051l0.813-0.145 l-0.029-2.172l3.022,0.498l0.024,2.146l0.948,0.429l0.998-1.748l2.64,2.01l-1.043,1.771l0.599,0.762l1.797-0.859l1.521,2.969 l-1.828,0.884l0.183,0.88L59.926,42.191z M48.7,37.74c-2.351,0.796-3.382,3.727-2.321,6.511c1.049,2.761,3.764,4.265,6.078,3.392 c2.318-0.859,3.396-3.703,2.381-6.388C53.813,38.549,51.059,36.961,48.7,37.74z" fill="url(#_50)"/>
+</svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/data/csc.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,317 @@
+/*
+* 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:  Resource definitions for project CSC
+*
+*/
+
+
+NAME SECO
+
+#include <eikon.rh>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.loc>
+#include <appinfo.rh>
+
+#include <csc.loc>
+#include "csc.hrh"
+
+
+// -----------------------------------------------------------------------------
+//
+// Define the resource file signature 
+// This resource should be empty
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+// -----------------------------------------------------------------------------
+//
+// Default Document Name
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_default_document_name
+    {
+    buf="";
+    }
+
+// -----------------------------------------------------------------------------
+//
+// Define default menu and status pane
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE EIK_APP_INFO 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+// r_csc_service_view_title
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_csc_service_view_title
+    {
+    buf = qtn_voip_csc_title;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_csc_serviceview_menubar
+// Menubar for CSC service view
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_csc_serviceview_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_csc_serviceview_menu;
+            }
+        };
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+// r_csc_serviceview_menu
+// Menu for CSC service view "Options"
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_csc_serviceview_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EAknSoftkeyOpen;
+            txt = qtn_options_open;
+            flags = EEikMenuItemAction;
+            },
+        MENU_ITEM
+            {
+            command = EAknSoftkeySelect;
+            txt = qtn_cffh_options_select;
+            flags = EEikMenuItemAction;
+            },
+        MENU_ITEM
+            {
+            command = ECSCCommandDelete;
+            txt = qtn_voip_csc_option_delete_service;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknSoftkeyExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+// r_csc_view_service
+// Service view resource
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_csc_view_service
+    {
+    menubar = r_csc_serviceview_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    }
+
+//----------------------------------------------------
+//   
+//    r_csc_softkeys_options_exit_open
+//    Text association with MSK ( OPEN )
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_csc_softkeys_options_exit_open
+    {
+    buttons =
+        {
+        CBA_BUTTON 
+            {
+            id=EAknSoftkeyOptions; 
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON 
+            {
+            id=EAknSoftkeyExit; 
+            txt = text_softkey_exit; 
+            },
+        CBA_BUTTON 
+            {
+            id=ECSCCmdOpen; 
+            txt = qtn_msk_open;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_csc_msk_open
+//    Middle softkey label: open.
+//
+// -----------------------------------------------------------------------------
+//    
+RESOURCE TBUF r_csc_msk_open
+    {
+    buf = qtn_msk_open;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_csc_msk_select
+//    Middle softkey label: select.
+//
+// -----------------------------------------------------------------------------
+//    
+RESOURCE TBUF r_csc_msk_select
+    {
+    buf = qtn_msk_select;
+    }
+
+// -----------------------------------------------------------------------------
+//    
+//    r_csc_configure_service_query
+//    Configure service query.
+//
+// -----------------------------------------------------------------------------
+//     
+RESOURCE DIALOG r_csc_configure_service_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationLayout;
+                label = r_qtn_csc_configure_service_query;
+                };
+            }
+        };
+    }  
+
+// -----------------------------------------------------------------------------
+//    
+//    r_csc_delete_service_query
+//    Delete service confirmation query.
+//
+// -----------------------------------------------------------------------------
+//     
+RESOURCE DIALOG r_csc_delete_service_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationLayout;
+                label = r_qtn_csc_delete_service_query;
+                };
+            }
+        };
+    }
+
+
+//**RESOURCE STRINGS**
+
+RESOURCE TBUF r_qtn_csc_service_listbox_item
+    {
+    buf=qtn_voip_csc_service_settings;
+    }
+
+RESOURCE TBUF r_qtn_csc_configure_service_query
+    {
+    buf=qtn_voip_csc_query_configure_service;
+    }
+
+RESOURCE TBUF r_qtn_csc_delete_service_query
+    {
+    buf=qtn_voip_csc_delete_service_settings;
+    }
+   
+RESOURCE TBUF r_qtn_csc_unable_to_configure_note
+   {
+   buf=qtn_voip_csc_error_note_unable_to_configure;
+   }
+
+RESOURCE TBUF r_qtn_csc_unable_to_delete_note
+   {
+   buf=qtn_voip_csc_error_note_unable_to_delete;
+   }
+
+RESOURCE TBUF r_qtn_csc_removing_service
+    {
+    buf=qtn_voip_csc_removing_service;
+    }
+
+RESOURCE TBUF r_qtn_csc_no_services_installed
+    {
+    buf=qtn_voip_csc_no_services_installed;
+    }
+   
+//**RESOURCE STRINGS END**
+
+// -----------------------------------------------------------------------------
+//
+// r_csc_localisable_app_info
+// Defines caption and icon
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE LOCALISABLE_APP_INFO r_csc_localisable_app_info
+    {
+    short_caption = qtn_set_folder_conn_service_configurator;
+    caption_and_icon = 
+    CAPTION_AND_ICON_INFO
+        {
+        caption = qtn_set_folder_conn_service_configurator;
+#ifdef __SCALABLE_ICONS
+        number_of_icons = 1;
+        icon_file = "//resource//apps//csc_aif.mif";        
+#else
+        number_of_icons = 2;
+        icon_file = "//resource//apps//csc_aif.mbm";        
+#endif // __SCALABLE_ICONS
+        };
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/data/csc_reg.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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:  Resource definitions for project CSC
+*
+*/
+
+
+#include <csc.rsg>
+#include <appinfo.rh>
+#include <data_caging_paths_strings.hrh>
+
+// UID
+UID2 KUidAppRegistrationResourceFile
+UID3 0x10275458
+
+
+// -----------------------------------------------------------------------------
+//
+// app_registration_info
+// Applications registration file.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file = "csc";
+    localisable_resource_file = APP_RESOURCE_DIR"\\csc"; 
+    localisable_resource_id = R_CSC_LOCALISABLE_APP_INFO;
+    hidden = KAppIsHidden;
+    embeddability = KAppEmbeddable;
+    group_name = "csc";
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/group/Icons_dc.mk	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,72 @@
+#
+# 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: 
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+# ----------------------------------------------------------------------------
+# : Configure these
+# ----------------------------------------------------------------------------
+
+TARGETDIR=$(ZDIR)\resource\apps
+HEADERDIR=\epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\csc_aif.mif
+HEADERFILENAME=$(HEADERDIR)\csc.mbg
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# : Configure these.
+#
+# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
+# MifConv if the mask detph is defined.
+#
+# NOTE 2: Usually, source paths should not be included in the bitmap
+# definitions. MifConv searches for the icons in all icon directories in a
+# predefined order, which is currently \s60\icons, \s60\bitmaps2.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME)  /h$(HEADERFILENAME) \
+        /c8,8 ..\bitmaps\qgn_prop_set_service.svg \
+        /c8,8 ..\bitmaps\qgn_prop_voip_new_service.svg \
+   	/c8,8 ..\bitmaps\qgn_prop_set_voip_advanced.svg
+   		 
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSC
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/csc.loc APP_LAYER_LOC_EXPORT_PATH( csc.loc )
+
+PRJ_MMPFILES
+cscappui.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/group/cscappui.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSC
+*
+*/
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          csc.exe
+EPOCSTACKSIZE   0x2700
+TARGETTYPE      exe
+UID             0x100039CE 0x10275458
+
+CAPABILITY      CAP_APPLICATION TrustedUI NetworkControl AllFiles
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          cscappui.cpp
+SOURCE          cscdialog.cpp
+SOURCE          cscdocument.cpp 
+SOURCE          cscapplication.cpp 
+SOURCE          cscserviceview.cpp
+SOURCE          cscnoteutilities.cpp
+SOURCE          cscservicecontainer.cpp
+
+SOURCEPATH      ../group
+
+TARGETPATH      /system/apps/csc
+
+START RESOURCE  ../data/csc.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../cscengine/inc
+SYSTEMINCLUDE   ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         cch.lib
+LIBRARY         ecom.lib
+LIBRARY         egul.lib
+LIBRARY         ws32.lib
+LIBRARY         bafl.lib
+LIBRARY         cone.lib 
+LIBRARY         avkon.lib
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib 
+LIBRARY         apgrfx.lib 
+LIBRARY         apparc.lib
+LIBRARY         eikctl.lib
+LIBRARY         hlplch.lib
+LIBRARY         fbscli.lib
+LIBRARY         featmgr.lib
+LIBRARY         eikcore.lib
+LIBRARY         aknicon.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         aknskins.lib
+LIBRARY         cscengine.lib
+LIBRARY         aknnotify.lib
+LIBRARY         platformenv.lib 
+LIBRARY         commonengine.lib
+LIBRARY         cscsettingsui.lib
+LIBRARY         xspviewservices.lib
+
+
+START RESOURCE  ../data/csc_reg.rss
+DEPENDS csc.rsg
+// Do not change the UID 10003a3f below.
+TARGETPATH /private/10003a3f/apps
+END
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/group/icons_aif_csc.mk	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,73 @@
+#
+# Copyright (c) 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: 
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\z
+else
+ZDIR=\epoc32\data\z
+endif
+
+# ----------------------------------------------------------------------------
+# : Configure these
+# ----------------------------------------------------------------------------
+
+TARGETDIR=$(ZDIR)\resource\apps
+HEADERDIR=\epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\csc_aif.mif
+HEADERFILENAME=$(HEADERDIR)\csc.mbg
+
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# : Configure these.
+#
+# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
+# MifConv if the mask detph is defined.
+#
+# NOTE 2: Usually, source paths should not be included in the bitmap
+# definitions. MifConv searches for the icons in all icon directories in a
+# predefined order, which is currently \s60\icons, \s60\bitmaps2.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME)  /h$(HEADERFILENAME) \
+        /c8,8 ..\bitmaps\qgn_prop_set_service.svg \
+        /c8,8 ..\bitmaps\qgn_prop_voip_new_service.svg \
+        /c8,8 ..\bitmaps\qgn_prop_set_voip_advanced.svg
+		
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/inc/csc.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* 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:  Resource headers for project CSC Application
+*
+*/
+
+
+
+#ifndef CSC_HRH
+#define CSC_HRH
+
+
+// CSC enumerations for menu command codes
+enum TCSCCommandIds
+    {
+    ECSCCommandDelete = 1,
+    ECSCCmdOpen
+    };
+
+#endif // CSC_HRH
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/inc/cscapplication.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,65 @@
+/*
+* 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:  CSC Application
+*
+*/
+
+
+
+#ifndef C_CSCAPPLICATION_H
+#define C_CSCAPPLICATION_H
+
+/**
+ *  An instance of CCSCApplication
+ *  The application part of AVKON application framework for CSC application
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCApplication ) : public CAknApplication
+    {
+    public:  
+        
+        // from base class CAknApplication
+
+        /** 
+         * From CAknApplication
+         * Return the application DLL UID value
+         *
+         * @since S60 v3.0
+         * @return the UID of this Application/Dll
+         */
+        TUid AppDllUid() const;
+
+    protected: 
+    
+        // from base class CAknApplication
+    
+        /**
+         * From CAknApplication
+         * Create a CApaDocument object and return a pointer to it
+         *
+         * @since S60 v3.0
+         * @return a pointer to the created document
+         */
+        CApaDocument* CreateDocumentL();
+        
+#ifdef _DEBUG
+    friend class UT_CSC;
+#endif
+
+    };
+
+#endif // C_CSCAPPLICATION_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/inc/cscappui.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,260 @@
+/*
+* 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:  CSC Applications AppUi
+*
+*/
+
+
+#ifndef C_CSCAPPUI_H
+#define C_CSCAPPUI_H
+
+#include <aknViewAppUi.h>
+
+#include "mcscengcchobserver.h"
+#include "mcscengserviceobserver.h"
+#include "mcscengconnectionobserver.h"
+#include "mcscenguiextensionobserver.h"
+#include "mcscengprovisioningobserver.h"
+
+class CEikAppUi;
+class CAknViewAppUi;
+class CCSCServiceView;
+class CCSCEngCCHHandler;
+class CCSCEngStartupHandler;
+class CCSCEngServiceHandler;
+class CCSCEngBrandingHandler;
+class CCSCEngConnectionHandler;
+class CCSCEngServicePluginHandler;
+class CCSCEngUiExtensionPluginHandler;
+
+// View ID's for CSC views.
+const TUid KCSCServiceViewId = {947873};
+
+ 
+/**
+ *  An instance of class CCSCAppUi.
+ *  User Interface part of AVKON application framework for CSC application
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCAppUi ) : public CAknViewAppUi,  
+                                 public MCSCEngProvisioningObserver,
+                                 public MCSCEngUiExtensionObserver,
+                                 public MCSCEngConnectionObserver,
+                                 public MCSCEngServiceObserver,
+                                 public MCSCEngCCHObserver
+    {
+    public:
+    
+        void ConstructL();
+
+        CCSCAppUi();
+    
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCAppUi();
+        
+        
+        // from base class CEikAppUi
+                
+        /**
+         * From CEikAppUi 
+         * 
+         *
+         * @since
+         * @param aCommand Defines the command codes used to indicate the way
+         * an application is to be launched. Not used in CSC.
+         * @param aDocumentName A buffer that can contain the name of a file.
+         * Used in CSC to pass startup parameters instead of file name.
+         * @param aTail 
+         */
+        TBool ProcessCommandParametersL(
+            TApaCommand aCommand,
+            TFileName& aDocumentName,
+            const TDesC8& aTail);
+        
+        
+        /**
+         * From CEikAppUi 
+         * 
+         *
+         * @since
+         * @param aUid
+         * @param aParams startup parameters.
+         */
+        void ProcessMessageL( TUid aUid, const TDesC8 &aParams );
+
+        // from base class CAknViewAppUi
+    
+        /**
+         * From CAknViewAppUi 
+         * Handles user menu selections.
+         *
+         * @since S60 v3.0
+         * @param aCommand The enumerated code for the option selected
+         */
+        void HandleCommandL( TInt aCommand );
+        
+        
+        /**
+         * From CAknViewAppUi 
+         * Handling changing of the skin and layout.
+         *
+         * @since S60 v3.0
+         * @param aType for type of the change
+         */
+        void HandleResourceChangeL( TInt aType );
+                
+        
+        // from base class MCSCProvisioningObserver
+        
+        /**
+         * From MCSCProvisioningObserver
+         * Notifies when configuring of service plug-in is done.
+         *
+         * @since S60 v3.2
+         * @param aResponse plug-in response type
+         * @param aIndex index
+         * @param aPluginUid plugins uid
+         */
+        void NotifyServicePluginResponse( 
+            const CCSCEngServicePluginHandler::TServicePluginResponse& aResponse, 
+            const TInt aIndex, 
+            const TUid& aPluginUid );
+        
+        
+         // from base class MCSCUiExtensionObserver
+        
+        /**
+         * From MCSCUiExtensionObserver
+         * Notifies when ui extension plug-in is exited
+         *
+         * @since S60 v3.2
+         * @param aResponse plug-in response type
+         * @param aIndex index
+         * @param aPluginUid plugins uid
+         */
+        void NotifyUiExtensionPluginResponse(
+            const CCSCEngUiExtensionPluginHandler::TUiExtensionPluginResponse&
+            aResponse, 
+            const TInt aIndex, 
+            const TUid& aPluginUid );
+        
+         
+        // from base class MCSCEngServiceObserver
+        
+         /**
+         * Called when change in service(s) occur
+         *
+         * @since S60 v3.2
+         */
+        void NotifyServiceChange();
+        
+        
+        // from base class MCSCEngCCHObserver
+
+        /**
+         * From MCSCEngCCHObserver.
+         */
+        void ServiceStatusChanged(
+            TUint aServiceId, 
+            TCCHSubserviceType aType, 
+            const TCchServiceStatus& aServiceStatus );
+        
+        
+        // from base class MCSCEngConnectionObserver
+    
+        /**
+         * From MCSCEngConnectionObserver.
+         */
+        void NotifyConnectionEvent( 
+            CCSCEngConnectionHandler::TConnectionEvent aConnectionEvent );
+
+        /**
+         * From MCoeMessageObserver.
+         */
+        MCoeMessageObserver::TMessageResponse HandleMessageL(
+            TUint32 aClientHandleOfTargetWindowGroup, TUid aMessageUid,
+            const TDesC8& aMessageParameters);
+
+    private:
+            
+        /*
+         * For checking if SNAP is still in use.
+         *
+         * @since S60 3.2
+         * @param aServiceId service id
+         */
+        void SnapCheckL( TUint aServiceId ) const;
+        
+        /*
+         * Exits GS application if needed
+         *
+         * @since S60 3.2
+         */
+        TBool ExitGSIfParentL();
+            
+    private: // data
+                       
+        /** 
+         * For CSC Application startup parameter handling
+         * Own.
+         */
+        CCSCEngStartupHandler* iStartupHandler;
+    
+        /** 
+         * For CSC Application service handling
+         * Own.
+         */
+        CCSCEngServiceHandler* iServiceHandler;
+        
+        /** 
+         * For CSC Application branding handling
+         * Own.
+         */
+        CCSCEngBrandingHandler* iBrandingHandler;
+        
+        /** 
+         * For CSC Application CCH handling
+         * Own.
+         */
+        CCSCEngCCHHandler* iCCHHandler;
+        
+        /** 
+         * For CSC Application RConnection monitoring
+         * Own.
+         */
+        CCSCEngConnectionHandler* iConnectionHandler;
+                    
+        /**
+         * Pointer to CCSCServiceView
+         * Not own.
+         */
+        CCSCServiceView* iServiceView;
+        
+        /**
+         * Service which is monitored when disabling and removing service
+         */
+        TUint iMonitoredService;
+
+#ifdef _DEBUG
+    friend class UT_CSC;
+#endif
+             
+    };
+
+#endif // C_CSCAPPUI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/inc/cscconstants.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 for CSC Application
+*
+*/
+
+
+#ifndef CSCCONSTANTS_H
+#define CSCCONSTANTS_H
+
+// UID for the csc application
+const TUid KUidCSCApp = {0x10275458};
+
+const TUid KPhoneBookTabUid = { 0x20012423 };
+
+// Account creation plugin UID
+const TUid KAccountCreationPluginUID = { 0x2000BEF1 };
+
+// Advanced settings plugin UID
+const TUid KAdvancedSettingsPluginUID = { 0x1028331D };
+
+// Help context UID
+const TUid KCscHelpUid = { 0x1020E566 };
+
+// Filename and path for bitmaps and icons.
+_LIT( KDriveZ, "z:" );
+_LIT( KCSCAifFile, "csc_aif.mif");
+
+// For icon size
+const TInt KItemHeightPortrait = 67;
+const TInt KIconSizeCorrectionPortrait = 8;
+const TInt KIconSizeCorrectionLandscape = 7;
+
+#endif  // CSCCONSTANTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/inc/cscdialog.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,109 @@
+/*
+* 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:  CSC Application´s Dialog
+*
+*/
+
+
+#ifndef C_CSCDIALOG_H
+#define C_CSCDIALOG_H
+
+class CAknGlobalNote;
+    
+/**
+ *  CCSCDialog class
+ *  Used to show CSC Application glogal dialogs.
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCDialog ) : public CActive
+    {
+    public:
+    
+        /**
+         * Two-phased constructor.
+         */
+        static CCSCDialog* NewL();
+
+
+        /**
+         * Two-phased constructor.
+         */
+        static CCSCDialog* NewLC();
+        
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCDialog();
+    
+
+        /**
+         * Launches a wait note.
+         *
+         * @since S60 v3.2
+         */
+        void LaunchWaitNoteL( 
+            const TInt aResourceId );
+        
+        
+        /**
+         * Destroys a wait note.
+         *
+         * @since S60 v3.2
+         */
+        void DestroyWaitNote();
+        
+        
+    protected:      
+
+        // from base class CActive
+    
+        /**
+         * @see CActive.
+         */
+        void RunL();
+
+
+        /**
+         * @see CActive.
+         */
+        void DoCancel();
+        
+    private:
+
+        CCSCDialog();
+
+        void ConstructL();
+        
+    private: // Data  
+
+        /**
+         * A global wait note.
+         * Own.
+         */
+        CAknGlobalNote* iWaitNote;
+        
+       /*
+        * Global note Id
+        */
+       TInt iNoteId;
+        
+#ifdef _DEBUG
+    friend class UT_CSC;
+#endif
+     };
+
+#endif // C_CSCDIALOG_H  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/inc/cscdocument.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,128 @@
+/*
+* 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:  CSC Applications Document
+*
+*/
+
+
+#ifndef C_CSCDOCUMENT_H
+#define C_CSCDOCUMENT_H
+
+#include <AknDoc.h>
+
+class CCSCAppUi;
+class CEikAppUi;
+class CEikApplication;
+class CCSCEngServicePluginHandler;
+class CCSCEngUiExtensionPluginHandler;
+
+
+/**
+ *  An instance of class CCSCDocument
+ *  The Document part of AVKON application framework for CSC application
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCDocument ) : public CAknDocument
+    {
+    public:
+        
+        /**
+         * Two-phased constructor.
+         * @param aApp CEikApplication
+         */
+        static CCSCDocument* NewL( CEikApplication& aApp );
+        
+        
+        /**
+         * Two-phased constructor.
+         * @param aApp CEikApplication
+         */
+        static CCSCDocument* NewLC( CEikApplication& aApp );
+
+
+        /**
+         * Destructor
+         */
+        virtual ~CCSCDocument();
+
+        
+        /**
+         * Transfers ownership to document.
+         * 
+         * @since S60 v3.2
+         * @param aServicePluginHandler for handle to be transferred
+         * @param aUiExtensionPluginHandler for handle to be transferred
+         */
+        void SetOwnershipOfPluginHandlers( 
+            CCSCEngServicePluginHandler* aServicePluginHandler,
+            CCSCEngUiExtensionPluginHandler* aUiExtensionPluginHandler );  
+        
+        
+        /**
+         * Return reference to service plug-in handler
+         * 
+         * @since S60 v3.0
+         * @return reference to service plug-in handler
+         */
+        CCSCEngServicePluginHandler& ServicePluginHandler();
+        
+        
+        // from base call CAknDocument
+
+        /**
+         * From CAknDocument 
+         * Create a CCSCAppUi object and return a pointer to it
+         *
+         * @return CEikAppUi A pointer to the created instance of the
+         *                   AppUi created
+         */
+        CEikAppUi* CreateAppUiL();
+        
+        /**
+         * From CAknDocument 
+         * Hides icon from task list
+         * 
+         * @param aWgName window group name
+         */
+        void UpdateTaskNameL( CApaWindowGroupName* aWgName );
+
+    private:
+
+        void ConstructL();
+
+        CCSCDocument( CEikApplication& aApp );
+    
+    private: //data
+        
+        /**
+         * Handle to CSC ServicePluginHandler.
+         * Own.
+         */
+        CCSCEngServicePluginHandler* iServicePluginHandler;
+        
+        /**
+         * Handle to CSC UiExtensionPluginHandler.
+         * Own.
+         */
+        CCSCEngUiExtensionPluginHandler* iUiExtensionPluginHandler;
+        
+#ifdef _DEBUG
+    friend class UT_CSC;
+#endif
+        
+    };
+
+#endif // C_CSCDOCUMENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/inc/csclogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,70 @@
+/*
+* 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:  Provides macros for logging
+*
+*/
+
+
+#ifndef CSCLOGGER_H
+#define CSCLOGGER_H
+
+#include <e32def.h>
+
+
+//----------------------------------------------------------------------------
+//  USER LOGGING SETTINGS
+//----------------------------------------------------------------------------
+
+#ifndef _DEBUG
+
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = RDebug
+***************************/ 
+
+#define CSC_DEBUG             0   // UREL BUILD
+
+#else
+
+#define CSC_DEBUG             1   // UDEB BUILD
+
+#endif // _DEBUG
+
+
+
+//----------------------------------------------------------------------------
+//  LOGGING MACROs (DO NOT EDIT)
+//
+//  USE THESE MACROS IN YOUR CODE
+//----------------------------------------------------------------------------
+
+#if CSC_DEBUG == 1    // RDebug
+
+#define CSCDEBUG(AA)           { RDebug::Print(_L(AA)); }
+#define CSCDEBUG2(AA,BB)       { RDebug::Print(_L(AA),BB); }
+#define CSCDEBUG3(AA,BB,CC)    { RDebug::Print(_L(AA),BB,CC); }
+#define CSCDEBUG4(AA,BB,CC,DD) { RDebug::Print(_L(AA),BB,CC,DD); }
+
+#else   // CSC_DEBUG == 0 or invalid -> Disable loggings
+
+#define CSCDEBUG(AA)          
+#define CSCDEBUG2(AA,BB)     
+#define CSCDEBUG3(AA,BB,CC)    
+#define CSCDEBUG4(AA,BB,CC,DD) 
+
+#endif  // CSC_DEBUG
+
+#endif  // CSCLOGGER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/inc/cscnoteutilities.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* 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:  CSC Application note utilities
+*
+*/
+
+
+#ifndef C_CSCNOTEUTILITIES_H
+#define C_CSCNOTEUTILITIES_H
+
+/**
+ *  CCSCNoteUtilities class
+ *  Used to show CSC Application notes.
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCNoteUtilities ) : public CBase
+    {
+    public: 
+    
+        /** Enumeration for different note types */
+        enum TCSCNoteType
+            {
+            // Information notes..
+            ECSCUnableToConfigureNote,
+            ECSCUnableToDeleteNote,
+            // Query dialogs..
+            ECSCConfigureServiceQuery,
+            ECSCDeleteServiceQuery
+            };
+        
+            
+        /**
+         * Shows a confirmation note without query. 
+         *
+         * @since S60 v3.2
+         * @param aType for note to be shown
+         * @param aText for additional text information
+         */ 
+        static void ShowConfirmationNote( 
+            TCSCNoteType aType, 
+            const TDesC& aText = KNullDesC() );
+        
+        
+        /**
+         * Shows an information note without query. 
+         *
+         * @since S60 v3.2
+         * @param aType for note to be shown
+         * @param aText for additional text information
+         * @param aArray for additional text information
+         */ 
+        static void ShowInformationNoteL( 
+            TCSCNoteType aType, 
+            const TDesC& aText = KNullDesC(), 
+            const MDesCArray* aArray = NULL );
+        
+        
+        /**
+         * Shows an error note without query.
+         *
+         * @since S60 v3.2
+         * @param aType for note to be shown
+         * @param aText for additional text information
+         */ 
+        static void ShowErrorNote( 
+            TCSCNoteType aType, 
+            const TDesC& aText = KNullDesC() );
+        
+        
+        /**
+         * Shows a note with query.
+         *
+         * @since S60 v3.2
+         * @param aType for note to be shown
+         * @param aText for additional text information
+         * @return ETrue if accepted
+         */ 
+        static TBool ShowCommonQueryL( 
+            TCSCNoteType aType, 
+            const TDesC& aText = KNullDesC() );
+    
+    };
+
+#endif // C_CSCNOTEUTILITIES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/inc/cscservicecontainer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,478 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CSC Application service view´s container
+*
+*/
+
+
+#ifndef C_CSCSERVICECONTAINER_H
+#define C_CSCSERVICECONTAINER_H
+
+#include <eikmobs.h>
+
+class MCSCServiceContainerObserver;
+class CCSCEngCCHHandler;
+class CCSCEngServiceHandler;
+class CCSCEngBrandingHandler;
+class CCSCEngServicePluginHandler;
+class CCSCEngUiExtensionPluginHandler;
+
+
+const TUint KBrandIdMaxLength = 512;
+
+/**
+ *  TListBoxItem class
+ *
+ *  For identifying list box item types
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TListBoxItem )
+    {
+    public:
+    
+        /**  Enumeration for listbox item type */
+        enum TItemType
+            {
+            EGeneralService = 0,
+            EServicePlugin,
+            EUiExtension
+            };
+        
+        /**
+         * Constructor.
+         *
+         * @since S60 3.2
+         */
+        TListBoxItem()
+            : iItemType( EGeneralService ),
+              iPluginUid( KNullUid ),
+              iServiceId( KErrNone )
+            {}
+
+    public: // data
+    
+        /**
+         * Listbox item type
+         */
+        TItemType iItemType;
+                
+        /**
+         * Plug-in UID for Listbox item type EServicePlugin and EUiExtension
+         */
+        TUid iPluginUid;
+        
+        /*
+         * Service id ( used only with EGeneralService and EServicePlugin)
+         */
+        TUint iServiceId;
+    };
+
+
+
+/**
+ *  CCSCServiceContainer class
+ *  CSC Applications Service view container class.
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCServiceContainer ) : public CCoeControl,
+                                            public MEikMenuObserver
+    {
+    public:
+        
+        /**
+         * Two-phased constructor.
+         *
+         * @param aView pointer to calling view
+         * @param aRect rect
+         * @param aServicePluginHandler reference to servicepluginhandler
+         * @param aUiExtensionPluginHandler reference to uiextensionhandler
+         * @param aServiceHandler reference to service handler
+         * @param aBrandingHandler reference to branding handler
+         * @param aCCHHandler reference to cch handler
+         */
+        static CCSCServiceContainer* NewL(
+            const TRect& aRect,
+            MCSCServiceContainerObserver& aContainerObserver,
+            CCSCEngServicePluginHandler& aServicePluginHandler,
+            CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
+            CCSCEngServiceHandler& aServiceHandler,
+            CCSCEngBrandingHandler& aBrandingHandler,
+            CCSCEngCCHHandler& aCCHHandler );
+        
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCServiceContainer();
+        
+                
+        /**
+         * Update service view
+         *
+         * @since S60 v3.2
+         */
+        void UpdateServiceViewL();
+        
+        
+        /**
+         * Update listbox
+         *
+         * @since S60 v3.2
+         */
+        void UpdateListboxL();
+        
+        
+        /**
+         * Return current listbox item index
+         *
+         * @since S60 v3.2
+         * @return current item index
+         */
+        TInt CurrentItemIndex() const;
+        
+        
+        /**
+         * Return current listbox item
+         *
+         * @since S60 v3.2
+         * @return current listbox item
+         */
+        TListBoxItem ListBoxItem();
+        
+        
+        /**
+         * Return reference to listbox
+         *
+         * @since S60 v5.2
+         * @return reference to listbox
+         */
+        CAknDouble2LargeStyleListBox& ListBox();
+        
+        
+        /**
+         * Return pen down point
+         *
+         * @since S60 v5.2
+         * @return pen down point
+         */
+        TPoint PenDownPoint();
+        
+        
+        /**
+         * Return service count
+         *
+         * @since S60 v3.2
+         * @return service count
+         */
+        TInt ServiceCount();
+
+        
+        /**
+         * Set current item index
+         *
+         * @since S60 v3.2
+         * @param current item index
+         */
+        void SetCurrentIndex( TInt aIndex );
+        
+        
+        /**
+         * Delete service
+         *
+         * @since S60 v3.2
+         */
+        void DeleteServiceL();
+        
+        
+        /**
+         * Handle service plugin removation.
+         *
+         * @since S60 v5.0
+         * @param aUid plugin uid.
+         */
+        void HandleServicePluginRemovationL( const TUid& aUid );
+        
+        
+        /**
+         * Updates container data because of layout change
+         *
+         * @since S60 v3.2
+         * @param aType for layout change type
+         */ 
+        void HandleResourceChange( TInt aType );
+        
+        
+        /**
+         * Sets listbox observer.
+         *
+         * @since S60 v3.2
+         * @param aObserver listbox observer
+         */ 
+        void SetListBoxObserver( MEikListBoxObserver* aObserver );
+        
+                
+        /**
+         * Hides dialog wait note
+         *
+         * @since S60 v3.2
+         * @param aIndex index of plugin
+         */ 
+        void HideDialogWaitNote();
+
+
+        /**
+         * Launches cleanup plugin to remove settings.
+         *
+         * @since S60 v3.2
+         * @param aServiceId for service to be removed.
+         */ 
+        void LaunchCleanupPluginL( TUint aServiceId ) const;
+        
+        
+        /**
+         * Resolve service id from service plugin uid
+         *
+         * @since S60 v3.2
+         * @param aUid service plugin uid
+         * @param aServiceId service id stored here
+         */ 
+        void ResolveServiceIdL( const TUid& aUid, TUint& aServiceId );
+        
+        
+        // from base class CCoeControl
+
+        /**
+         * From CCoeControl
+         * Offer key events for controls.
+         *
+         * @since S60 v3.0
+         * @param aKeyEvent for pressed key
+         * @param aType for type of press
+         * @return ETrue if consumed
+         */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                     TEventCode aType );
+
+        /**
+         * From CCoeControl
+         * Returns component controls.
+         *
+         * @since S60 v3.0
+         * @param aIndex for index
+         * @return control of the component
+         */
+        CCoeControl* ComponentControl( TInt aIndex ) const;
+        
+        
+        /**
+         * From CCoeControl
+         * Handle pointer event.
+         *
+         * @since S60 v3.0
+         * @param aPointerEvent pointer event
+         */
+        void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+        
+        
+        // from base class MCSCEngCCHObserver
+
+        /**
+         * From MCSCEngCCHObserver.
+         */
+        void ServiceStatusChanged(
+            TUint aServiceId, 
+            TCCHSubserviceType aType, 
+            const TCchServiceStatus& aServiceStatus );
+
+        
+    protected: 
+        
+        // from base class CCoeControl
+          
+        /**
+         * From CCoeControl
+         * Handles controls size changes
+         *
+         * @since S60 v3.0
+         */
+        void SizeChanged();
+        
+        
+        /**
+         * From CoeControl
+         * Handles focus changes
+         *
+         * @since S60 v3.0
+         * @param aDrawNow for drawing event
+         */        
+        virtual void FocusChanged( TDrawNow aDrawNow );
+        
+        
+        /**
+         * From CoeControl
+         * Counts components controls
+         *
+         * @since S60 v3.0
+         * @return returns number of controls
+         */
+        TInt CountComponentControls() const;
+        
+        
+        /**
+         * From CCoeControl
+         * For getting help context
+         *
+         * @since S60 v3.0
+         * @param aContext
+         */
+        void GetHelpContext( TCoeHelpContext& aContext ) const;
+        
+        
+        /**
+         * From MEikMenuObserver
+         */
+        void SetEmphasis( CCoeControl* /*aMenuControl*/, TBool /*aEmphasis*/ ){};
+      
+        
+        /**
+         * From MEikMenuObserver
+         */
+        void ProcessCommandL( TInt /*aCommandId*/ ){};
+
+    private:
+        
+        CCSCServiceContainer( 
+            MCSCServiceContainerObserver& aContainerObserver,
+            CCSCEngServicePluginHandler& aServicePluginHandler,
+            CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
+            CCSCEngServiceHandler& aServiceHandler,
+            CCSCEngBrandingHandler& aBrandingHandler,
+            CCSCEngCCHHandler& aCCHHandler );
+            
+            
+        void ConstructL( const TRect& aRect );
+        
+        
+        /**
+         * Sets icons for listbox items.
+         *
+         * @since S60 v3.2
+         * @param aListBoxItem lisbox item
+         * @param aIconArray icon array
+         * @param aIconSize icon size in pixels
+         */
+        void SetIconL( const TListBoxItem& aListBoxItem,
+            CArrayPtr<CGulIcon>* aIconArray, TInt aIconSize );
+        
+        
+       /**
+        * Cleanup RImplInfoPtrArray
+        * @since S60 3.2
+        * @param aArray Which to be destroyed
+        */
+        static void ResetAndDestroy( TAny* aArray );
+            
+
+    private: // data
+    
+        /**
+         * Reference to MCSCServiceContainerObserver
+         */
+        MCSCServiceContainerObserver& iContainerObserver;
+                        
+        /**
+         *  Reference to CCSCServicePluginHandler
+         */         
+        CCSCEngServicePluginHandler& iServicePluginHandler;
+        
+        /*
+         * Reference to CCSCUiExtensionPluginHandler
+         */
+        CCSCEngUiExtensionPluginHandler& iUiExtensionPluginHandler;
+        
+        /*
+         * Reference to CCSCEngServiceHandler
+         */
+        CCSCEngServiceHandler& iServiceHandler;
+        
+        /**
+         * Reference to CCSCEngBrandingHandler
+         */         
+        CCSCEngBrandingHandler& iBrandingHandler;
+        
+        /**
+         * Reference to CCSCEngCCHHandler
+         */         
+        CCSCEngCCHHandler& iCCHHandler;
+                        
+        /*
+         * Pointer to listbox
+         * Own.
+         */
+        CAknDouble2LargeStyleListBox* iListBox;
+        
+        /*
+         * Pointer to listbox item array
+         * Own.
+         */
+        CDesCArrayFlat* iArray;
+        
+        /*
+         * Pointer to listbox item array
+         * Own.
+         */
+        CDesCArray* iListBoxItems;
+        
+        /**
+         * A Global wait note for removing service.
+         */
+        CCSCDialog* iDialog;
+        
+        /**
+         * Menubar.
+         * Own.
+         */
+        CEikMenuBar* iEikMenuBar;
+        
+        /*
+         * Array for identifying different type listbox items
+         */
+        RArray<TListBoxItem> iListBoxItemArray;
+        
+        /**
+         * Ui extension plug-in count
+         */
+        TUint iUiExtensionCount;
+        
+        /**
+         * Pen down point
+         */
+        TPoint iPenDownPoint;
+        
+	    /**
+         * Holds current listbox item height
+         */
+        TInt iListBoxItemHeight;
+
+#ifdef _DEBUG
+    friend class UT_CSC;
+#endif    
+
+};
+
+#endif // C_CSCSERVICECONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/inc/cscserviceview.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,392 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CSC Applications Service View
+*
+*/
+
+
+#ifndef C_CSCSERVICEVIEW_H
+#define C_CSCSERVICEVIEW_H
+
+#include <aknview.h>
+#include "mcscservicecontainerobserver.h"
+#include "mcscengtimerobserver.h"
+
+class CCSCAppUi;
+class CCSCDialog;
+class CCSCEngCCHHandler;
+class CCSCServiceContainer;
+class CCSCEngStartupHandler;
+class CCSCEngServiceHandler;
+class CCSCEngBrandingHandler;
+class CCSCEngServicePluginHandler;
+class CCSCEngUiExtensionPluginHandler;
+class CCSCSettingsUi;
+
+/**
+ *  CCSCServiceView class
+ *  An instance of CCSCServiceView is the Application View object
+ *  for the CSC application
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCServiceView ) : public CAknView,
+                                       public MEikListBoxObserver,
+                                       public MCSCServiceContainerObserver,
+                                       public MCSCEngTimerObserver
+    {
+    public:
+
+        /**
+         * Two-phased constructor.
+         *
+         * @param aServicePluginHandler reference to service plug-in handler
+         * @param aUiExtensionPluginHandler reference to ui extension 
+         *        plug-in handler
+         * @param aStartupHandler reference to startup handler
+         * @param aServiceHandler reference to service handler
+         * @param aBrandingHandler reference to branding handler
+         * @param aCCHHandler reference to cch handler
+         */
+        static CCSCServiceView* NewL( 
+            CCSCEngServicePluginHandler& aServicePluginHandler,
+            CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
+            CCSCEngStartupHandler& aStartupHandler,
+            CCSCEngServiceHandler& aServiceHandler,
+            CCSCEngBrandingHandler& aBrandingHandler,
+            CCSCEngCCHHandler& aCCHHandler );
+
+
+        /**
+         * Two-phased constructor.
+         *
+         * @param aServicePluginHandler reference to service plug-in handler
+         * @param aUiExtensionPluginHandler reference to ui extension 
+         *        plug-in handler
+         * @param aStartupHandler reference to startup handler
+         * @param aServiceHandler reference to service handler
+         * @param aBrandingHandler reference to branding handler
+         * @param aCCHHandler reference to cch handler
+         */
+        static CCSCServiceView* NewLC( 
+            CCSCEngServicePluginHandler& aServicePluginHandler,
+            CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
+            CCSCEngStartupHandler& aStartupHandler,
+            CCSCEngServiceHandler& aServiceHandler,
+            CCSCEngBrandingHandler& aBrandingHandler,
+            CCSCEngCCHHandler& aCCHHandler );
+
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCServiceView();
+        
+        /**
+         * Initializes view with startup parameters.
+         * 
+         * @since S60 v5.1
+         */
+        void InitializeWithStartupParametersL();
+        
+        
+        // from base class CAknView
+        
+        /**
+         * From CAknView.
+         * Handles the commands. If the command is command which is require to
+         * display outline-screen, the command display outline-screen
+         * corresponded to required.
+         *
+         * @since S60 v3.0
+         * @param aCommand Command to be handled.
+         */
+        void HandleCommandL( TInt aCommand );
+        
+        
+        /**
+         * From CAknView.
+         *
+         * @since S60 v3.0
+         * @return The ID of view.
+         */
+        TUid Id() const;
+        
+        
+        /**
+         * From CAknView.
+         *
+         * @since S60 v3.0
+         * @param aForeground
+         */
+        void HandleForegroundEventL( TBool aForeground );
+        
+         
+        /**
+         * For handling ui extension plug-in exits
+         *
+         * @since S60 v3.2
+         */  
+        void HandleUiExtensionExitL();
+        
+        
+        /**
+         * For updating service view
+         *
+         * @since S60 v3.2
+         */  
+        void UpdateServiceViewL();
+        
+        
+        /**
+         * For deleting service
+         *
+         * @since S60 v3.2
+         * @param aServiceId
+         */  
+        void DeleteServiceL( TUint aServiceId );
+        
+        
+        /**
+         * Service configuration failed.
+         *
+         * @since S60 v3.2
+         * @param aIndex index of plugin
+         */ 
+        void ServiceConfiguringFailedL( TInt aIndex );
+        
+        
+        /**
+         * Hides dialog wait note
+         *
+         * @since S60 v3.2
+         * @param aIndex index of plugin
+         */ 
+        void HideDialogWaitNote();
+        
+                
+        /**
+         * For handling service configuration
+         *
+         * @since S60 v3.2
+         * @param aUid for service setup plugin uid
+         * @return ETrue if configuration canceled by user
+         */  
+        TBool HandleServiceConfigurationL( TUid aUid  );
+        
+        
+        /**
+         * Executes startup actions based on startup parameters.
+         * 
+         * @since   S60 v5.1
+         * @param   aForeGroundEvent    ETrue if initiated by foreground event.
+         * @param   aLaunchedFromAi     ETrue if launched from active idle.
+         */
+        void ExecuteStartupActionsL( 
+            TBool aForeGroundEvent = EFalse,
+            TBool aLaunchedFromAi = EFalse );
+        
+        
+        // from base class MCSCServiceContainerObserver
+        
+        /**
+         * Update softkey
+         *
+         * @since S60 v3.2
+         */         
+        void UpdateCbaL();
+        
+		
+    protected:
+              
+        // from base class MEIkListBoxObserver
+        
+        /**
+         * From MEikListBoxObserver.
+         * For handling list box events.
+         *
+         * @since S60 v3.0
+         * @param aListBox for listbox
+         * @param aEventType for event type
+         */
+        void HandleListBoxEventL( CEikListBox* aListBox, 
+                                  TListBoxEvent aEventType );    
+                                  
+		
+    private:
+        
+        
+        CCSCServiceView( 
+            CCSCEngServicePluginHandler& aServicePluginHandler,
+            CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
+            CCSCEngStartupHandler& aStartupHandler,
+            CCSCEngServiceHandler& aServiceHandler,
+            CCSCEngBrandingHandler& aBrandingHandler,
+            CCSCEngCCHHandler& aCCHHandler );
+        
+  
+        void ConstructL();
+        
+        
+        /**
+         * For handling listbox itemp opening.
+         *
+         * @since S60 v3.2
+         */  
+        void HandleListboxItemOpenL();
+        
+        
+        /**
+         * For changing text in the title pane.
+         *
+         * @since S60 v3.2
+         */         
+        void SetTitlePaneTextL() const;
+                 
+                
+        // from base class CAknView
+        
+        /**
+         * From CAknView.
+         * Dynamically initializes the contents of the menu list.
+         *
+         * @since S60 v3.0
+         * @param aResourceId Initiallized resource
+         * @param aMenuPane Instance to MenuPanel
+         */
+        void DynInitMenuPaneL( TInt aResourceId,
+                               CEikMenuPane* aMenuPane );
+        
+        
+        /**
+         * From CAknView.
+         * Creates the Container class object.
+         *
+         * @since S60 v3.0
+         * @param aPrevViewId is not used.
+         * @param aCustomMessageId is not used.
+         * @param aCustomMessage is not used.
+         */
+        void DoActivateL( const TVwsViewId& aPrevViewId,
+                          TUid aCustomMessageId,
+                          const TDesC8& aCustomMessage );
+
+
+        /**
+        * From CAknView.
+        * Deletes the Container class object.
+        *
+        * @since S60 v3.0
+        */
+        void DoDeactivate();
+        
+        
+        // from base class MCSCEngTimerObserver
+        
+        /**
+         * From MCSCEngTimerObserver.
+         *
+         * @since S60 v5.0
+         */
+        void TimerExpired();
+         
+		
+    private: // data
+                           
+        /**
+         *  Reference to CCSCServicePluginHandler
+         */          
+        CCSCEngServicePluginHandler& iServicePluginHandler;
+        
+        /**
+         *  Reference to CCSCUiExtensionPluginHandler
+         */         
+        CCSCEngUiExtensionPluginHandler& iUiExtensionPluginHandler;
+                
+        /**
+         *  Reference to CCSCEngStartupHandler
+         */         
+        CCSCEngStartupHandler& iStartupHandler;
+        
+        /**
+         *  Reference to CCSCEngServiceHandler
+         */         
+        CCSCEngServiceHandler& iServiceHandler;
+        
+        /**
+         *  Reference to CCSCEngBrandingHandler
+         */
+        CCSCEngBrandingHandler& iBrandingHandler;
+        
+        /**
+         *  Reference to CCSCEngCCHHandler
+         */
+        CCSCEngCCHHandler& iCCHHandler;
+                
+        /**
+         * Pointer to service container
+         * Own.
+         */       
+        CCSCServiceContainer* iContainer;
+        
+        /**
+         * Pointer to CSC Settings UI
+         * Own.
+         */ 
+        CCSCSettingsUi* iSettingsUi; 
+        
+        /**
+         *  Flag indicating if DoActivateL is called first time (startup)
+         */ 
+        TBool iStartup;
+                                                        
+        /**
+         * Current list item index in container
+         */
+        TInt iCurrentIndex;
+        
+        /**
+         * Array for already offered to configure plugin uids
+         */
+        RArray<TUid> iOfferedPluginUids;
+        
+        /**
+         * Pointer to timer
+         * Own.
+         */
+        CCSCEngTimer* iEngTimer;
+        
+        /**
+         * Plugin info.
+         */
+        TServicePluginInfo iPluginInfo;
+        
+        /**
+         * Next plugin index.
+         */
+        TUint iNextPluginIndex;
+		
+        /**
+         * Uid.
+         */
+        TUid iUid;
+        
+#ifdef _DEBUG
+    friend class UT_CSC;
+#endif
+        
+    };
+
+#endif // C_CSCSERVICEVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/inc/mcscservicecontainerobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* 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:  Observer interface for notifying container change.
+*
+*/
+
+
+#ifndef M_CSCSERVICECONTAINEROBSERVER_H
+#define M_CSCSERVICECONTAINEROBSERVER_H
+
+/**
+ *  MCSCServiceContainerObserver class
+ *
+ *  Observer interface for notifying container change.
+ *
+ *  @lib cscengine.lib
+ *  @since S60 v3.2
+ */
+class MCSCServiceContainerObserver
+    {
+    public:
+    
+        /**
+         * Should be called when the current item in listbox changes.
+         *
+         * @since S60 v3.2
+         */
+        virtual void UpdateCbaL() = 0;
+            
+    };
+    
+#endif // M_CSCSERVICECONTAINEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/loc/csc.loc	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2007-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:  Localization strings for project CSC
+*
+*/
+
+
+
+// d: CSC applications name on app grid
+// l: cell_app_pane_t1
+// r: VoIP Rel3.0 
+//
+#define qtn_set_folder_conn_service_configurator                       "Internet communications settings"
+
+
+// d:Title pane text
+// l:title_pane_t2/opt9
+// r:VoIP Rel3.0 
+//
+#define qtn_voip_csc_title                                             "Internet communications settings"
+
+
+// d:Service item text in service view
+// d:%U represents service name
+// l:list_double2_large_graphic_pane
+// r:VoIP Rel3.0 
+//
+#define qtn_voip_csc_service_settings                                  "%U settings"
+
+
+// d:Text in service configuration confirmation note
+// d: %U represents service name
+// l:popup_note_window
+// r:VoIP Rel3.0 
+//
+#define qtn_voip_csc_query_configure_service                           "Service %U not yet configured. Configure now?"
+
+
+// d:Text in unable to configure service information note
+// l:popup_note_window
+// r:VoIP Rel3.0 
+//
+#define qtn_voip_csc_error_note_unable_to_configure                    "Unable to configure service"
+
+// d:Text in unable to delete service information note
+// d: %U represents service name
+// l:popup_note_window
+// r:VoIP Rel3.0 
+//
+#define qtn_voip_csc_error_note_unable_to_delete                       "Service %U is in use, unable to delete"
+
+
+// d:Text in delete service confirmation query
+// d:%U represents service name
+// l:popup_note_window
+// r:VoIP Rel3.0 
+//
+#define qtn_voip_csc_delete_service_settings                           "Delete %U settings?"
+
+
+// d:Options menu item text for service deletion
+// l:list_single_pane_t1_cp2
+// r:VoIP Rel3.0 
+//
+#define qtn_voip_csc_option_delete_service                             "Delete service"
+
+
+// d:Text in removing service wait note
+// l:popup_note_wait_window
+// r:VoIP Rel3.0 
+//
+#define qtn_voip_csc_removing_service                                  "Removing service"
+
+
+// d:Text in main pane when there are no services or plugins installed.
+// l:main_list_empty_pane
+// r:VoIP Rel3.0 
+//
+#define qtn_voip_csc_no_services_installed                             "No services installed"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/src/cscapplication.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* 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:  CSC Application
+*
+*/
+
+
+#include <aknapp.h>
+#include <AknDoc.h>
+#include <eikstart.h>
+
+#include "cscdocument.h"
+#include "cscconstants.h"
+#include "cscapplication.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// Returns the uid of the app.
+// ---------------------------------------------------------------------------
+//
+TUid CCSCApplication::AppDllUid() const
+    {
+    return KUidCSCApp;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Creates an instance of CCSCDocument and returns it.
+// ---------------------------------------------------------------------------
+//
+CApaDocument* CCSCApplication::CreateDocumentL()
+    {  
+    return CCSCDocument::NewL( *this ); 
+    }
+
+
+// ======== GLOBAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructs and returns an application object.
+// ---------------------------------------------------------------------------
+//
+LOCAL_C CApaApplication* NewApplication()
+    {
+    return new CCSCApplication;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Main function of the application executable.
+// ---------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    return EikStart::RunApplication( NewApplication );
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/src/cscappui.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,546 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CSC Application´s AppUi
+*
+*/
+
+
+#include <apgcli.h>
+#include <AknDoc.h>
+#include <eikclb.h>
+#include <aknview.h>
+#include <eikappui.h>
+#include <cchclient.h>
+#include <cmmanagerext.h>
+#include <AknIconUtils.h>
+#include <AknsConstants.h>
+#include <cscsettingsui.h>
+#include <xSPViewServices.h>
+#include <AiwServiceHandler.h>
+#include <mspnotifychangeobserver.h>
+#include <gsfwviewuids.h>
+#include <apgwgnam.h>
+
+#include "cscappui.h"
+#include "csclogger.h"
+#include "cscdocument.h"
+#include "cscconstants.h"
+#include "cscserviceview.h"
+#include "cscengcchhandler.h"
+#include "cscengstartuphandler.h"
+#include "cscengservicehandler.h"
+#include "cscengbrandinghandler.h"
+#include "cscengconnectionhandler.h"
+#include "cscengservicepluginhandler.h"
+#include "cscengdestinationshandler.h"
+#include "cscenguiextensionpluginhandler.h"
+
+const TInt KMaxParamLength = 255;
+const TInt KGSChildAppWindowGroupNameLength = 100;
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCAppUi::CCSCAppUi()                         
+    {
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCAppUi::ConstructL()
+    {
+    CSCDEBUG( "CCSCAppUi::ConstructL - begin" );
+    
+    BaseConstructL( 
+        EAknEnableSkin | EAknEnableMSK | EAknSingleClickCompatible );
+    
+    iStartupHandler = CCSCEngStartupHandler::NewL();
+    iServiceHandler = CCSCEngServiceHandler::NewL( this );
+    iBrandingHandler = CCSCEngBrandingHandler::NewL();
+    iCCHHandler = CCSCEngCCHHandler::NewL( *this );
+    iConnectionHandler = CCSCEngConnectionHandler::NewL( *this );
+    
+    CCSCEngServicePluginHandler* servicePluginHandler = 
+        CCSCEngServicePluginHandler::NewL( 
+            *iEikonEnv, *this, *iServiceHandler );
+    
+    CleanupStack::PushL( servicePluginHandler );
+    
+    CCSCEngUiExtensionPluginHandler* uiExtensionPluginHandler = 
+        CCSCEngUiExtensionPluginHandler::NewL( 
+            *iEikonEnv, *this, *iStartupHandler );
+
+    CleanupStack::Pop( servicePluginHandler );
+    
+    // Responsibility or Plugin Handlers are transferred to document,
+    // because UI framework might make calls to ECom plugin after the
+    // application UI is deleted. Case exists when Exit() is 
+    // called from plugin.
+    CCSCDocument* doc = static_cast< CCSCDocument* >( Document() );
+    doc->SetOwnershipOfPluginHandlers( 
+        servicePluginHandler, uiExtensionPluginHandler );
+    
+    TRAP_IGNORE(   
+        servicePluginHandler->InitializePluginsL();
+        uiExtensionPluginHandler->InitializePluginsL();
+        );
+        
+    iServiceView = CCSCServiceView::NewL( 
+        *servicePluginHandler, 
+        *uiExtensionPluginHandler,
+        *iStartupHandler,
+        *iServiceHandler,
+        *iBrandingHandler,
+        *iCCHHandler );
+    
+    AddViewL( iServiceView );
+     
+    CSCDEBUG( "CCSCAppUi::ConstructL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCAppUi::~CCSCAppUi()
+    {
+    CSCDEBUG( "CCSCAppUi::~CCSCAppUi - begin" );
+        
+    delete iStartupHandler;
+    delete iServiceHandler;
+    delete iBrandingHandler;
+    delete iCCHHandler;
+    delete iConnectionHandler;
+                  
+    CSCDEBUG( "CCSCAppUi::~CCSCAppUi - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CEikAppUi
+// For giving startup parameters to CSC application
+// ---------------------------------------------------------------------------
+//
+TBool CCSCAppUi::ProcessCommandParametersL(
+    TApaCommand /*aCommand*/,
+    TFileName& aDocumentName,
+    const TDesC8& /*aTail*/)
+    {
+    CSCDEBUG( "CCSCAppUi::ProcessCommandParametersL - begin" );
+    
+    if ( aDocumentName.Length() )
+        {
+        iStartupHandler->SetStartupParametersL( aDocumentName );
+        if ( CCSCEngStartupHandler::EOpenSettingsUi == 
+            iStartupHandler->GetParamAction() )
+            {
+            iServiceView->InitializeWithStartupParametersL();
+            }
+        }
+        
+    CSCDEBUG( "CCSCAppUi::ProcessCommandParametersL - end" );
+    
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CEikAppUi
+// For giving startup parameters to CSC application
+// ---------------------------------------------------------------------------
+//
+void CCSCAppUi::ProcessMessageL( TUid /* aUid */, const TDesC8 &aParams )
+	{
+	CSCDEBUG( "CCSCAppUi::ProcessMessageL - begin" );
+	    
+	if ( aParams.Length() && ( aParams.Length() <= KMaxParamLength ) )
+	    {
+        TBuf<KMaxParamLength> params;
+	    params.Copy( aParams );  
+	    iStartupHandler->SetStartupParametersL( params );
+	        
+	    iServiceView->InitializeWithStartupParametersL();
+	    iServiceView->ExecuteStartupActionsL( EFalse, EFalse );
+	    }
+	        
+	CSCDEBUG( "CCSCAppUi::ProcessMessageL - end" );
+	}
+
+
+// ---------------------------------------------------------------------------
+// From class CAknViewAppUi
+// For command handling.
+// ---------------------------------------------------------------------------
+//
+void CCSCAppUi::HandleCommandL( TInt aCommand ) 
+    {
+    CSCDEBUG( "CCSCAppUi::HandleCommandL - begin" );
+    
+    switch ( aCommand )
+        {
+        case EAknSoftkeyBack:
+            {
+            Exit();
+            break;
+            }
+        case EEikCmdExit:
+        case EAknSoftkeyExit:
+        case EAknCmdExit:
+            {
+            ExitGSIfParentL();
+            Exit();
+            break;
+            }
+        default:
+            break;
+        }
+    
+    CSCDEBUG( "CCSCAppUi::HandleCommandL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CAknViewAppUi
+// Handling changing of the skin and layout.
+// ---------------------------------------------------------------------------
+//
+void CCSCAppUi::HandleResourceChangeL( TInt aType )
+    {
+    CSCDEBUG( "CCSCAppUi::HandleResourceChangeL" );
+
+    CAknViewAppUi::HandleResourceChangeL( aType );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MCSCProvisioningObserver
+// Notifies service plug-in event
+// ---------------------------------------------------------------------------
+//
+void CCSCAppUi::NotifyServicePluginResponse( 
+    const CCSCEngServicePluginHandler::TServicePluginResponse& aResponse, 
+    const TInt aIndex, 
+    const TUid& aPluginUid )
+    {
+    CSCDEBUG( "CCSCAppUi::NotifyServicePluginResponse - begin" );
+    
+    CCSCEngStartupHandler::TAction action = iStartupHandler->GetParamAction();
+    TUid pluginUid = iStartupHandler->GetParamPluginUid();
+  
+    switch ( aResponse )
+        {
+        case CCSCEngServicePluginHandler::EPluginInitialized:
+            {           
+            // Run service configuration procedure, if new plugin is added
+            // after service setup plugins has been initialized and plugin 
+            // is set to be configured in startup parameters.
+            if ( CCSCEngStartupHandler::EAddSetupPluginService == action &&
+                aPluginUid == pluginUid )
+                {       
+                TRAP_IGNORE( 
+                    TBool canceled ( EFalse );
+                    canceled = iServiceView->HandleServiceConfigurationL( 
+                                aPluginUid );
+                                
+                    if ( canceled )
+                        {
+                        iServiceView->ExecuteStartupActionsL();
+                        }
+                    );
+                } 
+            else if ( iStartupHandler->StartedFromHomescreen() )
+                {
+                TRAP_IGNORE( iServiceView->HandleServiceConfigurationL( KNullUid ) );
+                }
+            break;
+            }
+        case CCSCEngServicePluginHandler::EPluginProvisioned:
+            {
+            CSCDEBUG( "CCSCAppUi::NotifyServicePluginResponse - plugin provisioned" );
+                  
+            // shutdown csc (provisioned service plugin should open phonebook tab).
+            RunAppShutter();
+            break;
+            }
+        case CCSCEngServicePluginHandler::EPluginRemoved:
+            {
+            // Service removed. If application is started with statup
+            // parameters, close application and retuns to application
+            // installer. Otherwise dismiss wait note from the screen.
+            if ( CCSCEngStartupHandler::ERemoveSetupPluginService == action &&
+                KNullUid != pluginUid )
+                {
+                iServiceView->HideDialogWaitNote();
+                RunAppShutter();
+                }
+            else
+                {
+                CCSCDocument* doc = 
+                    static_cast< CCSCDocument* >( Document() );
+                    
+                CCSCEngServicePluginHandler& handler = 
+                    doc->ServicePluginHandler();
+
+                TServicePluginInfo pluginInfo = 
+                    handler.ItemFromPluginInfoArray( aIndex );
+                          
+                CAknView* view = View( pluginInfo.iViewId );
+                if( !view )
+                    {
+                    RemoveView( pluginInfo.iViewId );
+                    }
+                else
+                    {
+                    // nothing to do
+                    }
+                       
+                iServiceView->HideDialogWaitNote();
+                }
+            break;
+            }
+        case CCSCEngServicePluginHandler::EPluginError:
+            {
+            TRAP_IGNORE( iServiceView->ServiceConfiguringFailedL( aIndex ) );
+            break;
+            }
+        case CCSCEngServicePluginHandler::EPluginModified:
+        default:
+             break;
+        }
+    
+    CSCDEBUG( "CCSCAppUi::NotifyServicePluginResponse - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MCSCUiExtensionObserver
+// Notifies when configuring of service plug-in is done.
+// ---------------------------------------------------------------------------
+//
+void CCSCAppUi::NotifyUiExtensionPluginResponse( 
+    const CCSCEngUiExtensionPluginHandler::TUiExtensionPluginResponse& 
+    aResponse, 
+    const TInt /*aIndex*/, 
+    const TUid& /*aPluginUid*/ )
+    {
+    CSCDEBUG( "CCSCAppUi::NotifyUiExtensionPluginResponse - begin" );
+    
+    switch ( aResponse )
+        {
+        case CCSCEngUiExtensionPluginHandler::EPluginExited:
+            {
+            TRAP_IGNORE( iServiceView->HandleUiExtensionExitL() );
+            break;
+            }
+        case CCSCEngUiExtensionPluginHandler::EPluginError:
+            {
+            TRAP_IGNORE( ActivateLocalViewL( KCSCServiceViewId ) );
+            break;
+            }
+        case CCSCEngUiExtensionPluginHandler::EPluginInitialized:
+            // nothing to do
+        default:
+            break;
+        }
+   
+    CSCDEBUG( "CCSCAppUi::NotifyUiExtensionPluginResponse - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MCSCEngServiceObserver
+// Notifies when service(s) have changed.
+// ---------------------------------------------------------------------------
+//
+void CCSCAppUi::NotifyServiceChange()
+    {
+    CSCDEBUG( "CCSCAppUi::NotifyServiceChange - begin" );
+    
+    TVwsViewId activeViewId;
+    GetActiveViewId( activeViewId );
+    
+    if( iServiceView && KCSCServiceViewId == activeViewId.iViewUid )
+        {
+        TRAP_IGNORE( iServiceView->UpdateServiceViewL() );
+        }
+    
+    CSCDEBUG( "CCSCAppUi::NotifyServiceChange - end" );  
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MCSCEngCCHObserver
+// ---------------------------------------------------------------------------
+//
+void CCSCAppUi::ServiceStatusChanged(
+    TUint aServiceId, 
+    TCCHSubserviceType /*aType*/, 
+    const TCchServiceStatus& aServiceStatus )
+    {
+    CSCDEBUG2( 
+       "CCSCAppUi::ServiceStatusChanged - STATE=%d", aServiceStatus.State() );
+    
+    if ( ECCHDisabled == aServiceStatus.State() )
+        {        
+        TVwsViewId activeViewId;
+        GetActiveViewId( activeViewId );
+        
+        if( iServiceView && KCSCServiceViewId == activeViewId.iViewUid )
+            {            
+            TRAPD( err, SnapCheckL( aServiceId ) );  
+            
+            if ( KErrInUse == err )
+                {
+                iMonitoredService = aServiceId;
+                }
+            else
+                {
+                TRAP_IGNORE( iServiceView->DeleteServiceL( aServiceId ) );
+                }
+            }
+        }
+        
+    CSCDEBUG( "CCSCAppUi::ServiceStatusChanged - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MCSCEngConnectionObserver
+// ---------------------------------------------------------------------------
+//
+void CCSCAppUi::NotifyConnectionEvent( 
+    CCSCEngConnectionHandler::TConnectionEvent aConnectionEvent )
+    {
+    CSCDEBUG( "CCSCAppUi::NotifyConnectionEvent - begin" );
+        
+    TVwsViewId activeViewId;
+    GetActiveViewId( activeViewId );
+    
+    if( ( iServiceView && KCSCServiceViewId == activeViewId.iViewUid ) &&
+        ( CCSCEngConnectionHandler::EEventConnectionDown == aConnectionEvent || 
+          CCSCEngConnectionHandler::EEventTimedOut == aConnectionEvent ) )
+        {        
+        iConnectionHandler->StopListeningConnectionEvents();
+        TRAP_IGNORE( iServiceView->DeleteServiceL( iMonitoredService ) );
+        }
+    
+    CSCDEBUG( "CCSCAppUi::NotifyConnectionEvent - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// For checking if SNAP is still in use.
+// ---------------------------------------------------------------------------
+//
+void CCSCAppUi::SnapCheckL( TUint aServiceId ) const
+    {
+    CSCDEBUG( "CCSCAppUi::SnapCheckL - begin" );  
+    
+    CCSCEngDestinationsHandler* destHandler =
+        CCSCEngDestinationsHandler::NewL();
+    CleanupStack::PushL( destHandler );
+    
+    TInt snapId( 0 );
+    snapId = iServiceHandler->SnapIdL( aServiceId );
+    
+    if ( destHandler->IsSnapInUseL( snapId ) )
+        {
+        iConnectionHandler->StartListeningConnectionEvents();
+        User::Leave( KErrInUse );
+        }
+    
+    CleanupStack::PopAndDestroy( destHandler );
+    
+    CSCDEBUG( "CCSCAppUi::SnapCheckL - end" );  
+    }
+
+// ---------------------------------------------------------------------------
+// Check if GS has to be closed
+// ---------------------------------------------------------------------------
+//
+TBool CCSCAppUi::ExitGSIfParentL()
+    {
+    TBool ret = EFalse;
+    
+    RWsSession ws  = CEikonEnv::Static()->WsSession();
+    TApaTaskList taskList( ws );
+    TApaTask gstask = taskList.FindApp( KUidGS  );
+
+    if ( gstask.Exists() )
+        {
+        TInt gswgid = gstask.WgId();
+        RArray<RWsSession::TWindowGroupChainInfo> wgrp;
+        ws.WindowGroupList( &wgrp );
+        TInt i = 0;
+
+        // Loop window groups, find GS's child app
+        for ( i=0; i < wgrp.Count() ; ++i )
+            {
+            TBuf< KGSChildAppWindowGroupNameLength > name;
+            ws.GetWindowGroupNameFromIdentifier( wgrp[i].iId , name );
+            RWsSession::TWindowGroupChainInfo wginfo = wgrp[i];
+            if ( wginfo.iParentId == gswgid ) // Child of GS found
+                {
+                CApaWindowGroupName* windowName1 =
+                    CApaWindowGroupName::NewLC( ws, wginfo.iId ); // CS:1
+                TUid embeddeeuid;
+                embeddeeuid = windowName1->AppUid();
+
+                // Check if CSC is the child of GS
+                if ( KUidCSCApp == embeddeeuid )
+                    {
+                    ret = ETrue;
+                    gstask.EndTask();
+                    }
+                CleanupStack::PopAndDestroy( windowName1 );  // CS:0
+                }
+            }
+        wgrp.Close();
+        }
+    
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle view change messages (e.g. from MeCo)
+// ---------------------------------------------------------------------------
+//
+MCoeMessageObserver::TMessageResponse CCSCAppUi::HandleMessageL(
+    TUint32 /*aClientHandleOfTargetWindowGroup*/, TUid aMessageUid,
+    const TDesC8& aMessageParameters )
+    {
+    CSCDEBUG( "CCSCAppUi::HandleMessageL - begin" ); 
+
+    MCoeMessageObserver::TMessageResponse ret = EMessageNotHandled;
+
+    if ( TUid::Uid( KUidApaMessageSwitchOpenFileValue ) == aMessageUid &&
+        aMessageParameters.Length() &&
+        aMessageParameters.Length() <= KMaxParamLength )
+        {
+        TBuf<KMaxParamLength> params;
+        params.Copy( aMessageParameters );  
+        iStartupHandler->SetStartupParametersL( params );
+            
+        iServiceView->InitializeWithStartupParametersL();
+        iServiceView->ExecuteStartupActionsL( EFalse, EFalse );
+        
+        ret = EMessageHandled;
+        }
+
+    CSCDEBUG( "CCSCAppUi::HandleMessageL - end" ); 
+    return ret;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/src/cscdialog.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,143 @@
+/*
+* 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:  CSC Application´s Dialog
+*
+*/
+
+
+#include <avkon.rsg>
+#include <StringLoader.h>
+#include <AknGlobalNote.h>
+
+#include "cscdialog.h"
+#include "csclogger.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCDialog::CCSCDialog() : CActive ( EPriorityHigh )
+    {
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCDialog::ConstructL()
+    {
+    CSCDEBUG( "CCSCDialog::ConstructL - begin" );
+    
+    CActiveScheduler::Add( this );
+    
+    CSCDEBUG( "CCSCDialog::ConstructL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCDialog* CCSCDialog::NewL()
+    {
+    CCSCDialog* self = CCSCDialog::NewLC();
+    CleanupStack::Pop( self );    
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCDialog* CCSCDialog::NewLC()
+    {
+    CCSCDialog* self = new ( ELeave ) CCSCDialog();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCDialog::~CCSCDialog()
+    {
+    Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCSCDialog::LaunchWaitNoteL
+// Launches a wait note.
+// -----------------------------------------------------------------------------
+//
+void CCSCDialog::LaunchWaitNoteL( const TInt aResourceId )
+    {
+    CSCDEBUG( "CCSCDialog::LaunchWaitNoteL" );
+    
+    if ( !IsActive() )
+        {
+        // Show wait note with appropriate text.
+        HBufC* text = StringLoader::LoadLC( aResourceId );
+        iWaitNote = CAknGlobalNote::NewL();
+        iWaitNote->SetSoftkeys( R_AVKON_SOFTKEYS_EMPTY );
+        iNoteId = iWaitNote->ShowNoteL( 
+            iStatus, 
+            EAknGlobalWaitNote, 
+            *text );
+        CleanupStack::PopAndDestroy( text );
+        SetActive();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCSCDialog::DestroyWaitNote
+// Destroys a wait note.
+// -----------------------------------------------------------------------------
+//
+void CCSCDialog::DestroyWaitNote()
+    {
+    Cancel();
+    }
+
+
+// ---------------------------------------------------------------------------
+// From CActive
+// CCSCDialog::RunL
+// ---------------------------------------------------------------------------
+//
+void CCSCDialog::RunL()
+    {
+    CSCDEBUG( "CCSCDialog::RunL" );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// From CActive
+// CCSCDialog::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CCSCDialog::DoCancel()
+    {
+    if ( iWaitNote )
+        {
+        TRAP_IGNORE( iWaitNote->CancelNoteL( iNoteId ) );
+        delete iWaitNote;
+        iWaitNote = NULL;
+        }
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/src/cscdocument.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,129 @@
+/*
+* 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:  CSC Application´s Document
+*
+*/
+
+#include <apgwgnam.h>
+#include <cchclient.h>
+#include <xSPViewServices.h>
+#include <AiwServiceHandler.h>
+
+#include "cscappui.h"
+#include "csclogger.h"
+#include "cscdocument.h"
+#include "cscengservicepluginhandler.h"
+#include "cscenguiextensionpluginhandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCDocument::CCSCDocument( CEikApplication& aApp ) : 
+    CAknDocument( aApp )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCDocument::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCDocument::UpdateTaskNameL( CApaWindowGroupName* aWgName )
+    {
+    CAknDocument::UpdateTaskNameL( aWgName );
+    aWgName->SetHidden( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCDocument* CCSCDocument::NewL( CEikApplication& aApp ) 
+    {
+    CCSCDocument* self = NewLC( aApp );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCDocument* CCSCDocument::NewLC( CEikApplication& aApp )
+    {
+    CCSCDocument* self = new (ELeave) CCSCDocument( aApp );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Transfers ownership to document.
+// ---------------------------------------------------------------------------
+//
+void CCSCDocument::SetOwnershipOfPluginHandlers( 
+    CCSCEngServicePluginHandler* aServicePluginHandler,
+    CCSCEngUiExtensionPluginHandler* aUiExtensionPluginHandler )
+    {
+    iServicePluginHandler = aServicePluginHandler;
+    iUiExtensionPluginHandler = aUiExtensionPluginHandler;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Returns reference to service plug-in handler.
+// ---------------------------------------------------------------------------
+//
+CCSCEngServicePluginHandler& CCSCDocument::ServicePluginHandler()
+    {
+    return *iServicePluginHandler;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CAknDocument
+// Create the application user interface
+// ---------------------------------------------------------------------------
+//
+CEikAppUi* CCSCDocument::CreateAppUiL()
+    {
+    // Create the application user interface, and return a pointer to it
+    // the framework takes ownership of this object
+    return ( static_cast<CEikAppUi*>( new (ELeave) CCSCAppUi ) ); 
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCDocument::~CCSCDocument()
+    {
+    CSCDEBUG( "CCSCDocument::~CCSCDocument - begin" );
+    
+    delete iServicePluginHandler;
+    delete iUiExtensionPluginHandler;
+    
+    CSCDEBUG( "CCSCDocument::~CCSCDocument - end" );
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/src/cscnoteutilities.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,153 @@
+/*
+* 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:  CSC Application´s note utilities
+*
+*/
+
+
+#include <csc.rsg>
+#include <StringLoader.h>
+#include <aknnotedialog.h>
+#include <aknnotewrappers.h>
+
+#include "csclogger.h"
+#include "cscnoteutilities.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// Shows a confirmation note without query. 
+// ---------------------------------------------------------------------------
+//
+void CCSCNoteUtilities::ShowConfirmationNote( 
+    TCSCNoteType /*aType*/, const TDesC& /*aText*/ )
+    {
+    CSCDEBUG( "CCSCNoteUtilites::ShowConfirmationNote - begin" );
+    
+     // Not used
+    
+    CSCDEBUG( "CCSCNoteUtilites::ShowConfirmationNote - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Shows an information note without query. 
+// ---------------------------------------------------------------------------
+//
+void CCSCNoteUtilities::ShowInformationNoteL( 
+    TCSCNoteType aType, const TDesC& aText, const MDesCArray* /*aArray*/ )
+    {
+    CSCDEBUG( "CCSCNoteUtilites::ShowInformationNoteL" );
+    
+    // Create note.
+    HBufC* string = NULL;
+    
+    // Select text for note.
+    switch ( aType )
+        { 
+        case ECSCUnableToConfigureNote:
+            string = StringLoader::LoadL( 
+                R_QTN_CSC_UNABLE_TO_CONFIGURE_NOTE );
+            break;
+        case ECSCUnableToDeleteNote:
+            string = StringLoader::LoadL( 
+                R_QTN_CSC_UNABLE_TO_DELETE_NOTE, aText );
+            break;
+        default:
+            break;    
+        }
+    
+   if ( string )
+       {
+       // Set text and show note.
+       CleanupStack::PushL( string );   
+       CAknInformationNote* note = 
+       new ( ELeave ) CAknInformationNote( ETrue );
+       note->ExecuteLD( *string );
+       CleanupStack::PopAndDestroy( string );
+       }
+   }
+
+
+// ---------------------------------------------------------------------------
+// Shows an error note without query. 
+// ---------------------------------------------------------------------------
+//
+void CCSCNoteUtilities::ShowErrorNote( 
+    TCSCNoteType /*aType*/, const TDesC& /*aText*/ )
+    {
+    // Not used
+    }
+
+    
+// ---------------------------------------------------------------------------
+// Shows a note with query.
+// ---------------------------------------------------------------------------
+//
+TBool CCSCNoteUtilities::ShowCommonQueryL( 
+    TCSCNoteType aType, const TDesC& aText )
+    {
+    CSCDEBUG( "CCSCNoteUtilites::ShowCommonQueryL - begin" );
+    
+    TBool ret( EFalse );
+    TBool showQuery( ETrue );
+    
+    // Create confirmation query dialog.
+    HBufC* string = NULL;
+    CAknQueryDialog* query = 
+        new( ELeave ) CAknQueryDialog( CAknQueryDialog::ENoTone );
+        
+    CleanupStack::PushL( query );
+    
+    // Prepare and set text for query.
+    switch ( aType )
+        {
+        case ECSCConfigureServiceQuery:
+            query->PrepareLC( R_CSC_CONFIGURE_SERVICE_QUERY );
+            string = StringLoader::LoadLC( 
+                R_QTN_CSC_CONFIGURE_SERVICE_QUERY, aText );
+            query->SetPromptL( *string );
+            CleanupStack::PopAndDestroy( string );
+            break;
+        case ECSCDeleteServiceQuery:
+            query->PrepareLC( R_CSC_DELETE_SERVICE_QUERY );
+            string = StringLoader::LoadLC( 
+                R_QTN_CSC_DELETE_SERVICE_QUERY, aText );
+            query->SetPromptL( *string );
+            CleanupStack::PopAndDestroy( string );
+            break;
+        default:
+            // in default case query is not shown
+            showQuery = EFalse;
+            break;    
+        }
+    
+    CleanupStack::Pop( query );
+    
+    // Show query.
+    if ( showQuery )
+    	{
+    	if( query->RunLD() )
+	        {
+	        ret = ETrue;
+	        }
+		}    
+    
+    CSCDEBUG( "CCSCNoteUtilites::ShowCommonQueryL - end" );
+        
+    return ret;
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/src/cscservicecontainer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,972 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CSC Application´s Service View´s Container
+*
+*/
+
+
+#include <fbs.h>
+#include <csc.mbg>
+#include <csc.rsg>
+#include <e32std.h>
+#include <aknapp.h>
+#include <gulicon.h>
+#include <eikclbd.h>
+#include <aknlists.h>
+#include <pathinfo.h>
+#include <coecntrl.h>
+#include <AknsUtils.h>
+#include <cchclient.h>
+#include <akncontext.h>
+#include <AknIconArray.h>
+#include <StringLoader.h>
+#include <aknViewAppUi.h>
+#include <AiwServiceHandler.h>
+#include <mspnotifychangeobserver.h>
+#include <cscengsettingscleanupplugininterface.h>
+
+#include <csxhelp/voip.hlp.hrh>
+#include <data_caging_path_literals.hrh>
+
+#include "mcscservicecontainerobserver.h"
+#include "csclogger.h"
+#include "cscdialog.h"
+#include "cscconstants.h"
+#include "cscapplication.h"
+#include "cscnoteutilities.h"
+#include "cscengcchhandler.h"
+#include "cscservicecontainer.h"
+#include "cscengservicehandler.h"
+#include "cscengbrandinghandler.h"
+#include "cscengservicepluginhandler.h"
+#include "cscenguiextensionpluginhandler.h"
+
+const TUint KServiceListItemTextMaxLength = 64;
+const TUint KMaxUiExetnsionNameLength = 64;
+
+// Format of the list item string.
+_LIT( KServiceListItemTextFormat, "%d\t%S\t" );
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCServiceContainer::CCSCServiceContainer( 
+    MCSCServiceContainerObserver& aContainerObserver,
+    CCSCEngServicePluginHandler& aServicePluginHandler,
+    CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
+    CCSCEngServiceHandler& aServiceHandler,
+    CCSCEngBrandingHandler& aBrandingHandler,
+    CCSCEngCCHHandler& aCCHHandler ):
+    iContainerObserver( aContainerObserver ),
+    iServicePluginHandler( aServicePluginHandler ),
+    iUiExtensionPluginHandler( aUiExtensionPluginHandler ),
+    iServiceHandler( aServiceHandler ),
+    iBrandingHandler( aBrandingHandler ),
+    iCCHHandler( aCCHHandler )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::ConstructL( const TRect& aRect )
+    {
+    CSCDEBUG( "CCSCServiceContainer::ConstructL - begin" );
+    
+    CreateWindowL(); 
+    iDialog = CCSCDialog::NewL();
+    
+    iListBox = new (ELeave) CAknDouble2LargeStyleListBox;
+    iListBox->SetContainerWindowL( *this );
+    iListBox->ConstructL( this, EAknGenericListBoxFlags );
+    iListBox->HideSecondRow( ETrue );
+    iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+    
+    HBufC* emptyTxt = StringLoader::LoadLC( R_QTN_CSC_NO_SERVICES_INSTALLED );
+    iListBox->View()->SetListEmptyTextL( *emptyTxt );
+    CleanupStack::PopAndDestroy( emptyTxt );
+    
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+                                                 CEikScrollBarFrame::EOff,
+                                                 CEikScrollBarFrame::EAuto );
+    
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    iListBoxItems = static_cast<CDesCArray*>( textArray );
+    
+    iEikMenuBar = new ( ELeave ) CEikMenuBar();
+    iEikMenuBar->ConstructL( this, NULL, R_CSC_SERVICEVIEW_MENUBAR );
+    
+    SetRect( aRect );
+    
+    UpdateServiceViewL();
+    
+    ActivateL();
+
+    CSCDEBUG( "CCSCServiceContainer::ConstructL - end" );
+    }
+    
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCServiceContainer* CCSCServiceContainer::NewL( 
+    const TRect& aRect,
+    MCSCServiceContainerObserver& aContainerObserver,
+    CCSCEngServicePluginHandler& aServicePluginHandler,
+    CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
+    CCSCEngServiceHandler& aServiceHandler,
+    CCSCEngBrandingHandler& aBrandingHandler,
+    CCSCEngCCHHandler& aCCHHandler )
+    {
+    CCSCServiceContainer* self = 
+        new ( ELeave ) CCSCServiceContainer( 
+            aContainerObserver,
+            aServicePluginHandler, 
+            aUiExtensionPluginHandler,
+            aServiceHandler,
+            aBrandingHandler,
+            aCCHHandler );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCServiceContainer::~CCSCServiceContainer()
+    {
+    CSCDEBUG( "CCSCServiceContainer::~CCSCServiceContainer - begin" );
+    
+    delete iDialog;        
+    delete iArray;   
+    delete iListBox;    
+    delete iEikMenuBar;
+    
+    iListBoxItemArray.Reset();
+    iListBoxItemArray.Close();
+    
+    CSCDEBUG( "CCSCServiceContainer::~CCSCServiceContainer - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Updates services to listbox.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::UpdateServiceViewL()
+    {
+    CSCDEBUG( "CCSCServiceContainer::UpdateServiceViewL - begin" );
+    
+    TInt currentItemIndex = CurrentItemIndex();
+    
+    // Reset listbox items and item array
+    iListBoxItems->Reset();
+    iListBoxItemArray.Reset();
+        
+    // Find and add Ui Extension Plug-ins
+    iUiExtensionCount = iUiExtensionPluginHandler.PluginCount();
+    
+    // Create icon array or cleanup iconarray if it already exists
+    CArrayPtr<CGulIcon>* iconArray =  
+        iListBox->ItemDrawer()->ColumnData()->IconArray();
+    
+    if ( !iconArray )
+        {
+        iconArray = new( ELeave ) CAknIconArray( 1 );
+         // Set icon array for ListBox.
+        iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
+        }
+    else
+        {
+        iconArray->ResetAndDestroy();
+        }
+
+    // move add new service plugin to top
+    RArray<TUiExtensionPluginInfo> uiPlugins;
+    CleanupClosePushL( uiPlugins );
+    
+    for( TInt i = 0; i < iUiExtensionCount; i++ )
+        {
+        TUiExtensionPluginInfo uiExtension = 
+            iUiExtensionPluginHandler.ItemFromPluginInfoArray( i );
+                        
+        if ( KAccountCreationPluginUID == uiExtension.iPluginsUid )
+            {
+            uiPlugins.InsertL( uiExtension, 0 );
+            }
+        else
+            {
+            uiPlugins.AppendL( uiExtension );
+            }
+        }
+  
+    iListBoxItemHeight = iListBox->ItemHeight();
+    
+    TInt iconSize( 0 );
+    if ( iListBoxItemHeight == KItemHeightPortrait )
+        {
+        iconSize = iListBoxItemHeight - KIconSizeCorrectionPortrait;
+        }
+    else
+        {
+        iconSize = iListBoxItemHeight - KIconSizeCorrectionLandscape;
+        }
+                 
+    for ( TUint i( 0 ) ; i < iUiExtensionCount ; i++ )
+        {
+        TUiExtensionPluginInfo uiExtension = uiPlugins[i];
+                        
+        if ( 0 == uiExtension.iPlace )
+            {                        
+            TBuf<KMaxUiExetnsionNameLength> extensionName;
+            extensionName.Copy( uiExtension.iUiExtensionName );
+                
+            // To keep track which kind of listbox items we have
+            TListBoxItem listBoxItem;
+            listBoxItem.iItemType = TListBoxItem::EUiExtension;
+            listBoxItem.iPluginUid = uiExtension.iPluginsUid;
+                        
+            iListBoxItemArray.Append( listBoxItem );
+            
+            // Set icon for ui extension
+            SetIconL( listBoxItem, iconArray, iconSize );
+                                                
+            TBuf<KServiceListItemTextMaxLength> listBoxItemText;          
+            
+            listBoxItemText.Format(
+                KServiceListItemTextFormat,
+                iconArray->Count() - 1,
+                &extensionName );
+            
+            iListBoxItems->AppendL( listBoxItemText );
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &uiPlugins );
+    
+    // Get services  
+    RArray<TUint> serviceIds;
+    CleanupClosePushL( serviceIds );
+    
+    TRAPD( err, iServiceHandler.GetAllServiceIdsL( serviceIds ) );
+            
+    for ( TInt i(0) ; i < serviceIds.Count() && !err ; i++ )
+        {                
+        // Check service validity from cch before adding to listbox
+        if ( iCCHHandler.IsServiceValidL( serviceIds[ i ] ) )
+            {
+            TBuf<KServiceListItemTextMaxLength> listBoxItemText;          
+            HBufC* serviceString = NULL;
+                            
+            serviceString = StringLoader::LoadLC( 
+                R_QTN_CSC_SERVICE_LISTBOX_ITEM, 
+                iServiceHandler.ServiceNameL( serviceIds[ i ] ) );
+                            
+            // To keep track which kind of listbox items we have
+            TListBoxItem listBoxItem;
+            listBoxItem.iServiceId = serviceIds[ i ];
+                        
+            // Set icon for service
+            SetIconL( listBoxItem, iconArray, iconSize );
+                        
+            listBoxItemText.Format(
+                KServiceListItemTextFormat,
+                iconArray->Count() - 1,
+                serviceString );
+                       
+            iListBoxItems->AppendL( listBoxItemText );    
+                                           
+            TInt32 servicePluginId( 0 );
+            TInt err2( KErrNone );
+                        
+            // Find service plug-in id if service has one
+            TRAP( 
+                err2, servicePluginId = 
+                iServiceHandler.ServiceSetupPluginIdL( serviceIds[ i ] ) );
+                                                              
+            if ( !err2 && servicePluginId )
+                {            
+                listBoxItem.iItemType = TListBoxItem::EServicePlugin;
+                listBoxItem.iPluginUid.iUid = servicePluginId;
+                }
+            else if ( KErrNotFound == err2 )
+                {
+                listBoxItem.iItemType = TListBoxItem::EGeneralService;
+                }
+                        
+            iListBoxItemArray.Append( listBoxItem );    
+
+            CleanupStack::PopAndDestroy( serviceString );   
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &serviceIds );  
+    
+    UpdateListboxL();
+    
+    if( iListBoxItemArray.Count() > 0 )
+    	{
+        if ( 0 <= currentItemIndex && 
+           ( iListBoxItemArray.Count() > currentItemIndex  ) )
+            {
+            iListBox->SetCurrentItemIndexAndDraw( currentItemIndex );
+            }
+        else
+            {
+            iListBox->SetCurrentItemIndexAndDraw( 0 );
+            }
+    	}
+    	
+    CSCDEBUG( "CCSCServiceContainer::UpdateSerUpdateServiceViewL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Update listbox. Handle item addition and drawing.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::UpdateListboxL()
+    {
+    CSCDEBUG( "CCSCServiceContainer::UpdateListboxL - begin" );
+    
+    iListBox->HandleItemAdditionL(); 
+    
+    CSCDEBUG( "CCSCServiceContainer::UpdateListboxL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// Returns current item index of listbox.
+// ---------------------------------------------------------------------------
+//
+TInt CCSCServiceContainer::CurrentItemIndex() const
+    {
+    CSCDEBUG2( 
+    "CCSCServiceContainer::CurrentItemIndex:%d",iListBox->CurrentItemIndex());
+    
+    return iListBox->CurrentItemIndex();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Returns currently selected list box item.
+// ---------------------------------------------------------------------------
+//
+TListBoxItem CCSCServiceContainer::ListBoxItem()
+    {    
+    return iListBoxItemArray[ CurrentItemIndex() ];
+    }
+
+// ---------------------------------------------------------------------------
+// Returns reference to listbox.
+// ---------------------------------------------------------------------------
+//
+CAknDouble2LargeStyleListBox& CCSCServiceContainer::ListBox()
+    {    
+    return *iListBox;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns pen down point.
+// ---------------------------------------------------------------------------
+//
+TPoint CCSCServiceContainer::PenDownPoint()
+    {
+    return iPenDownPoint;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns service count.
+// ---------------------------------------------------------------------------
+//
+TInt CCSCServiceContainer::ServiceCount()
+    {
+    TUint serviceCount( 0 );
+    
+    for ( TInt i ( 0 ) ; i < iListBoxItemArray.Count() ; i++ )
+        {
+        //Add count if list box item type is general service or service plugin
+        if ( 
+            TListBoxItem::EGeneralService == iListBoxItemArray[i].iItemType ||
+            TListBoxItem::EServicePlugin == iListBoxItemArray[i].iItemType )
+            {
+            serviceCount++;
+            }
+        }
+    
+    return serviceCount;
+    }
+
+// ---------------------------------------------------------------------------
+// Set current item index.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::SetCurrentIndex( TInt aIndex )
+    {
+    CSCDEBUG2( "CCSCServiceContainer::SetCurrentIndex: aIndex=%d", aIndex );
+    
+    if( ( aIndex < iListBoxItemArray.Count() ) && ( aIndex >= 0 ) )
+        {
+        iListBox->SetCurrentItemIndex( aIndex );
+        }
+    else
+        {
+        iListBox->SetCurrentItemIndex( 0 );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Deletes service.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::DeleteServiceL()
+    {
+    CSCDEBUG( "CCSCServiceContainer::DeleteServiceL - begin" );
+    
+    if (  iListBoxItemArray.Count() )
+        {
+        TListBoxItem item = ListBoxItem();
+
+        // Show confirmation query for service deletion                        
+        if ( CCSCNoteUtilities::ShowCommonQueryL( 
+            CCSCNoteUtilities::ECSCDeleteServiceQuery, 
+            iServiceHandler.ServiceNameL( item.iServiceId ) ) )
+            {
+            TBool  disabled = iCCHHandler.IsServiceDisabled( item.iServiceId );
+               
+            // if enabled -> show unable to delete note
+            if ( !disabled )
+                {
+                CCSCNoteUtilities::ShowInformationNoteL( 
+                    CCSCNoteUtilities::ECSCUnableToDeleteNote,
+                        iServiceHandler.ServiceNameL( item.iServiceId ) );
+                return;
+                }
+            
+            // First check if there is a service plugin UID.
+            TInt count = iServicePluginHandler.PluginCount( 
+                CCSCEngServicePluginHandler::EInitialized );
+            TBool setupPlugin( EFalse );
+            for ( TInt i = 0; i < count && !setupPlugin; i++ )
+                 {
+                 TServicePluginInfo pluginInfo = 
+                     iServicePluginHandler.ItemFromPluginInfoArray( i );
+                 if ( pluginInfo.iPluginsUid == item.iPluginUid )
+                     {
+                     CSCDEBUG2( "   DeleteServiceL - plugin UID match found: %d",
+                         item.iPluginUid );
+                     setupPlugin = ETrue;
+                     }
+                 }
+
+            if ( setupPlugin )
+                {
+                HandleServicePluginRemovationL( item.iPluginUid );
+                }
+            else
+                {
+                TRAPD( err, LaunchCleanupPluginL( item.iServiceId ) );
+                if ( KErrNone != err )
+                    {
+                    iServiceHandler.DeleteServiceL( item.iServiceId );
+                    }
+                }
+            }
+        }
+    
+    CSCDEBUG( "CCSCServiceContainer::DeleteServiceL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// Handles service plugin removation.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::HandleServicePluginRemovationL( const TUid& aUid )
+    {
+    CSCDEBUG( 
+         "CCSCServiceContainer::HandleServicePluginRemovationL - begin" );  
+    
+    TUint serviceId( 0 );   
+    ResolveServiceIdL( aUid, serviceId );
+    if ( !serviceId )
+        {
+        User::Leave( KErrNotFound );
+        }
+        
+    TBool disabled = iCCHHandler.IsServiceDisabled( serviceId );
+        
+    // If service is not disabled, try to disable it
+    if ( !disabled )
+        {
+        iDialog->LaunchWaitNoteL( R_QTN_CSC_REMOVING_SERVICE );
+        User::LeaveIfError( iCCHHandler.DisableService( serviceId ) );
+        return;
+        } 
+        
+    // Remove service plugin
+    TInt error( KErrNone );
+    TRAP( error, iServicePluginHandler.DoRemovationL( aUid, EFalse ) );
+        
+    // If error, remove remainging setting by cleanupplugin
+    if ( error )
+        {
+        error = KErrNone;
+        TRAP( error, LaunchCleanupPluginL( serviceId ) );
+               
+        if ( error )
+            {
+            iServiceHandler.DeleteServiceL( serviceId );
+            }  
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Updates container data because of layout change.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::HandleResourceChange( TInt aType )
+    {
+    CSCDEBUG( "CCSCServiceContainer::HandleResourceChange - begin" );
+    
+    if( aType == KAknsMessageSkinChange ||
+        aType == KEikDynamicLayoutVariantSwitch )
+        {
+        TRect mainPaneRect;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
+                                           mainPaneRect );
+        SetRect( mainPaneRect );
+        DrawNow();
+        iListBox->DrawNow();
+        
+        // Get handler to status pane.
+        CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+        if ( statusPane )
+            {
+            statusPane->DrawNow();
+            }
+        }
+    
+    CCoeControl::HandleResourceChange( aType );
+    
+    CSCDEBUG( "CCSCServiceContainer::HandleResourceChange - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Sets listbox observer.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::SetListBoxObserver( 
+    MEikListBoxObserver* aObserver )
+    {
+    iListBox->SetListBoxObserver( aObserver );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Hides dialog wait note.
+// ---------------------------------------------------------------------------
+//
+ void CCSCServiceContainer::HideDialogWaitNote()
+    {
+    iDialog->DestroyWaitNote();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Launches cleanup plugin to remove settings.
+// ---------------------------------------------------------------------------
+//
+ void CCSCServiceContainer::LaunchCleanupPluginL( TUint aServiceId ) const
+    {
+    CSCDEBUG( "CCSCServiceContainer::LaunchCleanupPluginL - begin" );
+    
+    RImplInfoPtrArray implInfoArray;
+    CleanupStack::PushL( TCleanupItem( 
+    ResetAndDestroy, &implInfoArray ) );
+                    
+    REComSession::ListImplementationsL(
+        KCSCSettingsCleanupPluginInterfaceUid,
+        implInfoArray );
+        
+    for ( TInt i( 0 ) ; i < implInfoArray.Count() ; i++ )
+        {                    
+        CCSCEngSettingsCleanupPluginInterface* plugin = 
+            CCSCEngSettingsCleanupPluginInterface::NewL( 
+                implInfoArray[ i ]->ImplementationUid() );
+        
+        CleanupStack::PushL( plugin );
+        
+        if ( CCSCEngSettingsCleanupPluginInterface::ESipVoIPCleanupPlugin 
+            == plugin->PluginType() )
+            {
+            plugin->RemoveSettingsL( aServiceId );
+            }
+        
+        CleanupStack::PopAndDestroy( plugin );
+        }
+                        
+    CleanupStack::PopAndDestroy( &implInfoArray );
+    REComSession::FinalClose();
+    
+    CSCDEBUG( "CCSCServiceContainer::LaunchCleanupPluginL - end" );
+    }
+ 
+ 
+ // ---------------------------------------------------------------------------
+ // Resolve service id from service plugi uid.
+ // ---------------------------------------------------------------------------
+ //
+ void CCSCServiceContainer::ResolveServiceIdL( 
+     const TUid& aUid, TUint& aServiceId )
+     {     
+     RArray<TUint> serviceIds;
+     CleanupClosePushL( serviceIds );
+     iServiceHandler.GetAllServiceIdsL( serviceIds );
+     
+     TInt serviceCount(  serviceIds.Count() );
+     
+     if ( serviceCount )
+         {
+         for ( TInt i = 0 ; i < serviceCount ; i++ )
+              {
+              TInt32 serviceSetupPluginId( KErrNotFound );
+              TRAPD( err, serviceSetupPluginId = 
+                  iServiceHandler.ServiceSetupPluginIdL( serviceIds[ i ] ) );
+                  
+              if ( KErrNone == err && 
+                  serviceSetupPluginId == aUid.iUid )
+                  {
+                  aServiceId = serviceIds[ i ];
+                  break;
+                  }
+              }
+         }
+     else
+         {
+         User::Leave( KErrNotFound );
+         }
+         
+     CleanupStack::PopAndDestroy( &serviceIds );
+     }
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// Offer key events for controls.
+// ---------------------------------------------------------------------------
+// 
+TKeyResponse CCSCServiceContainer::OfferKeyEventL( 
+    const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    CSCDEBUG2( 
+        "CCSCServiceContainer::OfferKeyEventL: aKeyEvent: %d", 
+            aKeyEvent.iScanCode );
+    
+    TKeyResponse result( EKeyWasNotConsumed );
+    
+    if ( iEikMenuBar->ItemSpecificCommandsEnabled() && 
+        EKeyBackspace  == aKeyEvent.iCode &&
+        ( TListBoxItem::EUiExtension != ListBoxItem().iItemType ) )
+        {
+        DeleteServiceL();
+        result = EKeyWasConsumed;
+        }
+    else
+        {
+        result = iListBox->OfferKeyEventL( aKeyEvent, aType );
+        }
+
+    iContainerObserver.UpdateCbaL();        
+    
+    return result;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// Returns component controls.
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CCSCServiceContainer::ComponentControl( TInt aIndex ) const
+    {
+    switch ( aIndex )
+        {
+        case 0:
+            return iListBox;
+        default:
+            return NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// Handle pointer event.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::HandlePointerEventL(
+    const TPointerEvent& aPointerEvent )
+    {
+    iPenDownPoint = aPointerEvent.iPosition;
+    CCoeControl::HandlePointerEventL( aPointerEvent );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MCSCEngCCHObserver
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::ServiceStatusChanged(
+    TUint /*aServiceId*/, 
+    TCCHSubserviceType /*aType*/, 
+    const TCchServiceStatus& /*aServiceStatus*/ )
+    {
+    // not used
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// Handles controls size changes.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::SizeChanged()
+    {
+    if ( iListBox )
+        {
+        iListBox->SetRect( Rect() );
+        
+        // Update view if portrait/landscape change happened
+        if ( iListBoxItemHeight != iListBox->ItemHeight() )
+            {
+            TRAP_IGNORE( UpdateServiceViewL() );
+            }        
+        }
+    }
+    
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// Handles focus changes.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::FocusChanged( TDrawNow aDrawNow )
+    {
+    CCoeControl::FocusChanged( aDrawNow );
+    
+    if( iListBox )
+        {
+        iListBox->SetFocus( IsFocused() );
+        }            
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// Counts components controls.
+// ---------------------------------------------------------------------------
+//
+TInt CCSCServiceContainer::CountComponentControls() const
+    {
+    return 1; // only iListBox
+    }
+
+
+// -----------------------------------------------------------------------------
+// From class CoeControl
+// For getting help context
+// -----------------------------------------------------------------------------
+//
+void CCSCServiceContainer::GetHelpContext( 
+    TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KCscHelpUid;
+    aContext.iContext = KVOIP_HLP_CSC;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Sets icons for lisbox items.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::SetIconL( const TListBoxItem& aListBoxItem,
+    CArrayPtr<CGulIcon>* aIconArray, TInt aIconSize )
+    {
+    CSCDEBUG( "CCSCServiceContainer::SetIconL - begin" );
+         
+    if ( NULL == aIconArray )
+        {
+        return;
+        }
+                 
+    TFileName iconsFileName = TParsePtrC( PathInfo::RomRootPath() ).Drive();
+    iconsFileName.Append( KDC_APP_BITMAP_DIR );
+    iconsFileName.Append( KCSCAifFile );
+    
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+    
+    if ( TListBoxItem::EUiExtension == aListBoxItem.iItemType )
+        {   
+        // specific icon for accountcreationplugin
+        if ( KAccountCreationPluginUID == aListBoxItem.iPluginUid )
+            {
+            aIconArray->AppendL( AknsUtils::CreateGulIconL( 
+                    skinInstance, 
+                    KAknsIIDDefault,
+                    iconsFileName, 
+                    EMbmCscQgn_prop_voip_new_service, 
+                    EMbmCscQgn_prop_voip_new_service ) );
+            }
+        // specific icon for advanced settings plugin (sip voip settings)
+        else if ( KAdvancedSettingsPluginUID == aListBoxItem.iPluginUid )
+            {
+            aIconArray->AppendL( AknsUtils::CreateGulIconL( 
+                    skinInstance, 
+                    KAknsIIDDefault,
+                    iconsFileName, 
+                    EMbmCscQgn_prop_set_voip_advanced, 
+                    EMbmCscQgn_prop_set_voip_advanced ) );
+            }
+        else // generic icon
+            {
+            aIconArray->AppendL( AknsUtils::CreateGulIconL( 
+                    skinInstance, 
+                    KAknsIIDDefault,
+                    iconsFileName,
+                    EMbmCscQgn_prop_set_service, 
+                    EMbmCscQgn_prop_set_service ) );
+            }
+        } 
+    // Service in question, try to get branded icon. If fails use default icon
+    else 
+        {
+        CSCDEBUG( "CCSCServiceContainer::SetIconL - branded icon" );
+        CFbsBitmap* bitmap = NULL;
+        CFbsBitmap* mask = NULL;
+        
+        // Get service brand id and branded icon(s).       
+        TRAPD( err, 
+            TBuf16<KBrandIdMaxLength> brandId16 ( KNullDesC );
+            iServiceHandler.BrandIdL( 
+                aListBoxItem.iServiceId, 
+                brandId16 );
+            
+            TBuf8<KBrandIdMaxLength> brandId8 ( KNullDesC8 );
+            brandId8.Copy( brandId16 );
+            iBrandingHandler.GetServiceBrandIconL( brandId8, bitmap, 
+                mask, aIconSize ); );
+        // Use default icons if error.
+        if ( KErrNone != err )
+            {
+            aIconArray->AppendL( AknsUtils::CreateGulIconL( 
+                skinInstance, 
+                KAknsIIDDefault,
+                iconsFileName,
+                EMbmCscQgn_prop_set_service, 
+                EMbmCscQgn_prop_set_service ) );
+            }
+        // Use branded icons if KErrNone.    
+        else
+            {
+            if ( bitmap )
+                {
+                CSCDEBUG( "CCSCServiceContainer::SetIconL - branded icon" );
+                CleanupStack::PushL( bitmap );
+                CleanupStack::PushL( mask );
+                
+                CFbsBitmap* newBitmap = new (ELeave) CFbsBitmap;     
+                if ( KErrNone == newBitmap->Duplicate( bitmap->Handle() ) )
+                    {
+                    CleanupStack::PushL( newBitmap );
+                    //ownership transferred (newBitmap)
+                    
+                    //Create new mask
+                    CFbsBitmap* newMask = new (ELeave) CFbsBitmap; 
+                    if( KErrNone == newMask->Duplicate( mask->Handle() ) )
+                        {
+                        CSCDEBUG( "CCSCServiceContainer::SetIconsL - branded newMASK" );
+                        
+                        CleanupStack::PushL ( newMask );
+                        CGulIcon* icon = CGulIcon::NewL( 
+                            AknIconUtils::CreateIconL( newBitmap ),
+                            AknIconUtils::CreateIconL( newMask ) );
+                        
+                        CleanupStack::Pop( newMask );
+                        CleanupStack::Pop( newBitmap );
+                    
+                        CleanupStack::PushL( icon );     
+                        aIconArray->AppendL( icon );
+                        CleanupStack::Pop( icon );
+                        CSCDEBUG( "CCSCServiceContainer::SetIconsL - branded newMASK done" );
+                        }
+                    else
+                        {
+                        CSCDEBUG( "CCSCServiceContainer::SetIconsL - Error creating mask duplicate" );
+                        CleanupStack::PopAndDestroy( newBitmap );
+                        delete newMask;
+                        newMask = NULL;
+                        }
+                    }
+                else
+                    {
+                    delete newBitmap;
+                    newBitmap = NULL;
+                    
+                    aIconArray->AppendL( AknsUtils::CreateGulIconL( 
+                        skinInstance, 
+                        KAknsIIDDefault,
+                        iconsFileName,
+                        EMbmCscQgn_prop_set_service, 
+                        EMbmCscQgn_prop_set_service ) );  
+                    }
+                
+                CleanupStack::PopAndDestroy( mask );
+                CleanupStack::PopAndDestroy( bitmap );
+                }
+            }
+        }
+             
+    CSCDEBUG( "CCSCServiceContainer::SetIconsL - end" );
+    }    
+
+
+// ---------------------------------------------------------------------------
+// CCSCServiceContainer::ResetAndDestroy
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceContainer::ResetAndDestroy( TAny* aArray )
+    {
+    CSCDEBUG( "CCSCServiceContainer::ResetAndDestroy - end" );	
+    
+    if ( aArray )
+        {
+        RImplInfoPtrArray* array = 
+            reinterpret_cast<RImplInfoPtrArray*>( aArray );
+        array->ResetAndDestroy();
+        }
+    
+    CSCDEBUG( "CCSCServiceContainer::ResetAndDestroy - end" );
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscapplicationui/src/cscserviceview.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,862 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CSC Application´s Service View
+*
+*/
+
+
+#include <csc.rsg>
+#include <eikclb.h>
+#include <apgcli.h> 
+#include <hlplch.h>
+#include <featmgr.h>
+#include <aknview.h>
+#include <akntitle.h>
+#include <aknlists.h>
+#include <cchclient.h>
+#include <AknsUtils.h>
+#include <StringLoader.h>
+#include <cscsettingsui.h>
+#include <xSPViewServices.h>
+#include <AiwServiceHandler.h>
+#include <mspnotifychangeobserver.h>
+
+#include "csc.hrh"
+#include "cscappui.h"
+#include "csclogger.h"
+#include "cscdialog.h"
+#include "cscconstants.h"
+#include "cscserviceview.h"
+#include "cscnoteutilities.h"
+#include "cscengcchhandler.h"
+#include "cscservicecontainer.h"
+#include "cscengstartuphandler.h"
+#include "cscengservicehandler.h"
+#include "cscengbrandinghandler.h"
+#include "cscengservicepluginhandler.h"
+#include "cscenguiextensionpluginhandler.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+const TUid KAIAppUid = { 0x102750F0 }; // active idle app uid
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCServiceView::CCSCServiceView( 
+    CCSCEngServicePluginHandler& aServicePluginHandler,
+    CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
+    CCSCEngStartupHandler& aStartupHandler,
+    CCSCEngServiceHandler& aServiceHandler,
+    CCSCEngBrandingHandler& aBrandingHandler,
+    CCSCEngCCHHandler& aCCHHandler )
+    :
+    iServicePluginHandler( aServicePluginHandler ),
+    iUiExtensionPluginHandler( aUiExtensionPluginHandler ),
+    iStartupHandler( aStartupHandler ),
+    iServiceHandler( aServiceHandler ),
+    iBrandingHandler( aBrandingHandler ),
+    iCCHHandler( aCCHHandler ),
+    iStartup( ETrue )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceView::ConstructL()
+    {
+    CSCDEBUG( "CCSCServiceView::ConstructL - begin" );
+    
+    BaseConstructL( R_CSC_VIEW_SERVICE );
+    iSettingsUi = CCSCSettingsUi::NewL( *iEikonEnv );
+                     
+    CSCDEBUG( "CCSCServiceView::ConstructL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//      
+CCSCServiceView* CCSCServiceView::NewL( 
+    CCSCEngServicePluginHandler& aServicePluginHandler,
+    CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
+    CCSCEngStartupHandler& aStartupHandler,
+    CCSCEngServiceHandler& aServiceHandler,
+    CCSCEngBrandingHandler& aBrandingHandler,
+    CCSCEngCCHHandler& aCCHHandler )
+    {
+    CCSCServiceView* self = 
+        CCSCServiceView::NewLC( 
+            aServicePluginHandler, 
+            aUiExtensionPluginHandler, 
+            aStartupHandler,
+            aServiceHandler,
+            aBrandingHandler,
+            aCCHHandler );
+    
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCServiceView* CCSCServiceView::NewLC( 
+    CCSCEngServicePluginHandler& aServicePluginHandler,
+    CCSCEngUiExtensionPluginHandler& aUiExtensionPluginHandler,
+    CCSCEngStartupHandler& aStartupHandler,
+    CCSCEngServiceHandler& aServiceHandler,
+    CCSCEngBrandingHandler& aBrandingHandler,
+    CCSCEngCCHHandler& aCCHHandler )
+    {
+    CCSCServiceView* self = 
+        new( ELeave ) CCSCServiceView( 
+            aServicePluginHandler, 
+            aUiExtensionPluginHandler, 
+            aStartupHandler,
+            aServiceHandler,
+            aBrandingHandler,
+            aCCHHandler );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCServiceView::~CCSCServiceView()
+    {
+    CSCDEBUG( "CCSCServiceView::~CCSCServiceView - begin" );
+    
+    iOfferedPluginUids.Reset();
+    
+    delete iSettingsUi;
+    delete iContainer;
+    delete iEngTimer;
+    
+    CSCDEBUG( "CCSCServiceView::~CCSCServiceView - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCServiceView::InitializeWithStartupParametersL
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceView::InitializeWithStartupParametersL()
+    {
+    CSCDEBUG( "CCSCServiceView::InitializeWithStartupParametersL" );
+    
+    CCSCEngStartupHandler::TAction action = iStartupHandler.GetParamAction();
+    TBool isServiceViewDefault = 
+        CCSCEngStartupHandler::EOpenSettingsUi != action;
+    TUint serviceId = iStartupHandler.GetParamServiceId();
+    TUid tabViewId( KNullUid );
+    tabViewId.iUid = iServiceHandler.ServiceTabViewIdL( serviceId );
+    iSettingsUi->InitializeL( 
+        tabViewId, serviceId, isServiceViewDefault ? this : NULL );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CAknView.
+// Handles the commands. If the command is command which is require to
+// display outline-screen, the command display outline-screen
+// corresponded to required.
+// ---------------------------------------------------------------------------
+// 
+void CCSCServiceView::HandleCommandL( TInt aCommand )
+    {
+    CSCDEBUG2( "CCSCServiceView::HandleCommandL aCommand: %d", aCommand );
+        
+    switch ( aCommand )
+        {
+        case EAknSoftkeyOpen:
+        case ECSCCmdOpen:
+        case EAknSoftkeySelect:
+            HandleListboxItemOpenL();
+            break;
+        case ECSCCommandDelete:
+            iContainer->DeleteServiceL();
+            break;
+        case EAknCmdHelp:
+            if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+                {
+                CArrayFix<TCoeHelpContext>* buf = AppUi()->AppHelpContextL();
+                HlpLauncher::LaunchHelpApplicationL(
+                    iEikonEnv->WsSession(), buf );
+                }
+            break;         
+        // Exit menu command.    
+        case EAknSoftkeyExit:
+            AppUi()->HandleCommandL( EEikCmdExit );
+            break;           
+        case EAknSoftkeyBack:
+            AppUi()->HandleCommandL( EAknSoftkeyBack );
+            break;
+        // Let appui handle other commands.    
+        default:
+            CSCDEBUG( "CCSCServiceView::HandleCommandL: !!DEFAULT!!" );
+            AppUi()->HandleCommandL( aCommand );
+            break;
+        }
+    }    
+        
+
+// ---------------------------------------------------------------------------
+// From class CAknView.
+// The ID of view.
+// ---------------------------------------------------------------------------
+// 
+TUid CCSCServiceView::Id() const
+    {
+    return KCSCServiceViewId;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CAknView.
+// Handle foreground event.
+// ---------------------------------------------------------------------------
+// 
+void CCSCServiceView::HandleForegroundEventL( TBool aForeground )
+    {
+    if ( aForeground )
+        {
+        ExecuteStartupActionsL( ETrue );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// For handling ui extension plug-in exits
+// ---------------------------------------------------------------------------
+// 
+void CCSCServiceView::HandleUiExtensionExitL()
+    {
+    CSCDEBUG( "CCSCServiceView::HandleUiExtensionExit - begin" );
+    
+    AppUi()->ActivateLocalViewL( KCSCServiceViewId );
+    
+    TUid appUid = iStartupHandler.GetParamAppUid();
+                          
+    if ( appUid.iUid )
+        {
+        // Open application matching uid
+        RApaLsSession session;
+        CleanupClosePushL( session );
+        
+        User::LeaveIfError(session.Connect());
+ 
+        TFileName fileName;
+        TThreadId threadId;
+
+        User::LeaveIfError(
+            session.StartDocument( fileName, appUid, threadId ) );
+                
+        CleanupStack::PopAndDestroy( &session );
+                       
+        // Reset startup parameter app uid
+        iStartupHandler.ResetUid( CCSCEngStartupHandler::EAppUid );
+        }
+         
+    CSCDEBUG( "CCSCServiceView::HandleUiExtensionExit - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// For updating service view
+// ---------------------------------------------------------------------------
+// 
+void CCSCServiceView::UpdateServiceViewL()
+    {
+    CSCDEBUG( "CCSCServiceView::UpdateServiceViewL - begin" );
+    
+    iContainer->UpdateServiceViewL();
+    
+    CSCDEBUG( "CCSCServiceView::UpdateServiceViewL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// For deleting service.
+// ---------------------------------------------------------------------------
+// 
+void CCSCServiceView::DeleteServiceL( TUint serviceId )
+    {
+    CSCDEBUG( "CCSCServiceView::DeleteServiceL - begin" );
+    
+    TUid pluginUid( KNullUid );
+    TInt32 servicePluginId( 0 );
+    
+    TRAPD( err, servicePluginId = 
+        iServiceHandler.ServiceSetupPluginIdL( serviceId ) );
+    
+    if ( !err && servicePluginId )
+        {
+        pluginUid.iUid = servicePluginId;
+        iContainer->HandleServicePluginRemovationL( pluginUid );
+        }
+    else
+        {
+        iContainer->DeleteServiceL();
+        }
+    
+    CSCDEBUG( "CCSCServiceView::DeleteServiceL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// Shows information about failed configuration.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceView::ServiceConfiguringFailedL( TInt aIndex )
+    {
+    CSCDEBUG( "CCSCServiceView::ServiceConfiguringFailedL - begin" );
+    
+    TServicePluginInfo pluginInfo;
+    
+    if ( iServicePluginHandler.PluginCount( 
+        CCSCEngServicePluginHandler::EInitialized ) > aIndex )
+        {
+        pluginInfo = iServicePluginHandler.ItemFromPluginInfoArray( aIndex );
+        
+        if ( pluginInfo.iProviderName.Length() )
+            {
+            CCSCNoteUtilities::ShowInformationNoteL( 
+                CCSCNoteUtilities::ECSCUnableToConfigureNote, 
+                    pluginInfo.iProviderName );
+            }
+        
+        // Try to remove uncomplete settings by calling service setup plugin.
+        iServicePluginHandler.DoRemovationL( pluginInfo.iPluginsUid, EFalse );
+        }   
+          
+    AppUi()->ActivateLocalViewL( KCSCServiceViewId );
+        
+    CSCDEBUG( "CCSCServiceView::ServiceConfiguringFailedL - end" );    
+    }
+ 
+ 
+// ---------------------------------------------------------------------------
+// Hides dialog wait note.
+// ---------------------------------------------------------------------------
+//
+ void CCSCServiceView::HideDialogWaitNote()
+    {
+    if ( iContainer )
+        {
+        iContainer->HideDialogWaitNote();
+        }
+    }
+   
+// ---------------------------------------------------------------------------
+// From class MEikListBoxObserver.
+// For handling list box events.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceView::HandleListBoxEventL( CEikListBox* /*aListBox*/, 
+                                           TListBoxEvent aEventType )
+    {
+    CSCDEBUG2( "CCSCServiceView::HandleListBoxEventL aEventType: %d",
+        aEventType );
+    
+    switch( aEventType )
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemSingleClicked:
+            HandleListboxItemOpenL();
+            break;
+        default:
+            CSCDEBUG( "CCSCServiceView::HandleListBoxEventL !!DEFAULT!!" );
+            break;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MCSCServiceContainerObserver.
+// Update softkey.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceView::UpdateCbaL()
+    {
+    if( !Cba() )
+       {
+       return;
+       }
+    
+    TInt commandId ( EAknSoftkeyOpen );
+    HBufC* selectText = StringLoader::LoadLC( R_CSC_MSK_SELECT );
+    HBufC* openText = StringLoader::LoadLC( R_CSC_MSK_OPEN );
+    
+    if( iContainer->CurrentItemIndex() >= 0 )
+        {
+        if( iContainer->ListBoxItem().iPluginUid != KAccountCreationPluginUID )
+            {
+            Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
+                commandId, *openText );
+            }
+        else
+            {
+            commandId = EAknSoftkeySelect;
+            Cba()->SetCommandL( CEikButtonGroupContainer::EMiddleSoftkeyPosition,
+                commandId, *selectText );
+            }
+        }
+    else
+        {
+        Cba()->MakeCommandVisibleByPosition( 
+            CEikButtonGroupContainer::EMiddleSoftkeyPosition, EFalse );
+        }
+    
+    Cba()->DrawDeferred();
+    CleanupStack::PopAndDestroy( openText );
+    CleanupStack::PopAndDestroy( selectText );
+    }
+
+
+// ---------------------------------------------------------------------------
+// For handling listbox item opening
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceView::HandleListboxItemOpenL()
+    {
+    CSCDEBUG( "CCSCServiceView::HandleListboxItemOpen - begin" );
+
+    TListBoxItem item = iContainer->ListBoxItem();
+    
+    switch ( item.iItemType )
+        {
+        case TListBoxItem::EUiExtension:
+            {
+            iUiExtensionPluginHandler.LaunchUiExtensionL( 
+                item.iPluginUid, Id() );
+            break;
+            }
+        case TListBoxItem::EGeneralService:
+        case TListBoxItem::EServicePlugin:
+            {
+            iSettingsUi->InitializeL( Id(), item.iServiceId, this );
+            iSettingsUi->LaunchSettingsUiL();
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrArgument );
+            break;
+            }       
+        }
+                       
+    CSCDEBUG( "CCSCServiceView::HandleListboxItemOpen - end" );
+    }
+
+    
+// ---------------------------------------------------------------------------
+// For changing text in the title pane.
+// ---------------------------------------------------------------------------
+// 
+void CCSCServiceView::SetTitlePaneTextL() const
+    {
+    CSCDEBUG( "CCSCServiceView::SetTitlePaneTextL - begin" );
+    
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    
+    CAknTitlePane* titlePane =
+        static_cast<CAknTitlePane*> ( statusPane->ControlL(
+            TUid::Uid( EEikStatusPaneUidTitle ) ) );
+       
+    HBufC* text = iEikonEnv->AllocReadResourceLC( R_CSC_SERVICE_VIEW_TITLE );
+    titlePane->SetTextL( text->Des() );
+    CleanupStack::PopAndDestroy( text );
+        
+    CSCDEBUG( "CCSCServiceView::SetTitlePaneTextL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Handle service configuration.
+// ---------------------------------------------------------------------------
+// 
+TBool CCSCServiceView::HandleServiceConfigurationL( TUid aUid )
+    {
+    CSCDEBUG( "CCSCServiceView::HandleServiceConfigurationL" );
+    
+    TInt initializedCount( iServicePluginHandler.PluginCount( 
+            CCSCEngServicePluginHandler::EInitialized ) );
+    
+    TBool canceled( EFalse );
+    TServicePluginInfo pluginInfo;
+    
+    iUid = aUid;
+    
+    if ( KNullUid != aUid ) 
+        {
+        for ( TInt i( 0 ) ; i < initializedCount ; i++ )
+            {            
+            pluginInfo = iServicePluginHandler.ItemFromPluginInfoArray( i );
+            
+            if ( aUid == pluginInfo.iPluginsUid && !pluginInfo.iProvisioned )
+                {                
+                iStartupHandler.ResetUid( CCSCEngStartupHandler::EPluginUid );
+                
+                iOfferedPluginUids.Append( pluginInfo.iPluginsUid );
+                
+                iPluginInfo = pluginInfo;
+                
+                iNextPluginIndex = i;
+                
+                delete iEngTimer;
+                iEngTimer = NULL;
+                iEngTimer = CCSCEngTimer::NewL( *this );
+                
+                iEngTimer->StartTimer( CCSCEngTimer::ENoteDelayTimer );
+                
+                break;
+                }
+            }   
+        
+        }
+    else
+        {
+        for ( TInt j( 0 ) ; j < initializedCount ; j++ )
+            {            
+            pluginInfo = iServicePluginHandler.ItemFromPluginInfoArray( j );                      
+            
+            if ( !pluginInfo.iProvisioned )
+                {   
+                iOfferedPluginUids.Append( pluginInfo.iPluginsUid );
+                
+                iPluginInfo = pluginInfo;
+                
+                iNextPluginIndex = j;
+                
+                delete iEngTimer;
+                iEngTimer = NULL;
+                iEngTimer = CCSCEngTimer::NewL( *this );
+
+                iEngTimer->StartTimer( CCSCEngTimer::ENoteDelayTimer );
+                
+                break;
+                }
+            }
+        }
+    
+    return canceled;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Executes startup actions based on startup parameters.
+// ---------------------------------------------------------------------------
+// 
+void CCSCServiceView::ExecuteStartupActionsL( 
+    TBool /*aForeGroundEvent*/, TBool aLaunchedFromAi )
+    {
+    CSCDEBUG( "CCSCServiceView::ExecuteStartupActionsL - begin" );
+    
+    CCSCEngStartupHandler::TAction action = iStartupHandler.GetParamAction();
+    TUid pluginUid = iStartupHandler.GetParamPluginUid();
+    TUint serviceId = iStartupHandler.GetParamServiceId();
+    
+    switch( action )
+        {
+        case  CCSCEngStartupHandler::EAddSetupPluginService:
+            {
+            if ( KNullUid != pluginUid )
+                {
+                HandleServiceConfigurationL( pluginUid );
+                }           
+            break;
+            }
+        case  CCSCEngStartupHandler::ERemoveSetupPluginService:
+            {
+            if ( KNullUid != pluginUid )
+                {
+                TRAPD( err, iContainer->HandleServicePluginRemovationL( 
+                    pluginUid ) );
+                
+                // If error in service plugin removal, close csc.
+                if ( err )
+                    {
+                    AppUi()->RunAppShutter();
+                    }
+                }
+            break;
+            }
+        case  CCSCEngStartupHandler::EOpenUiExtension:
+            {
+            if ( KNullUid != pluginUid )
+                {
+                TRAP_IGNORE( 
+                    iUiExtensionPluginHandler.LaunchUiExtensionL( 
+                        pluginUid, Id(), aLaunchedFromAi ) );
+                              
+                iStartupHandler.ResetUid( 
+                    CCSCEngStartupHandler::EPluginUid );
+                }
+            break;
+            }
+        case  CCSCEngStartupHandler::EOpenSettingsUi:
+            {
+            if ( serviceId )
+                {
+                TUid tabview( KNullUid );
+                tabview.iUid = iServiceHandler.ServiceTabViewIdL( serviceId );
+                iSettingsUi->InitializeL( tabview, serviceId, NULL );
+                iSettingsUi->LaunchSettingsUiL();
+                iStartupHandler.ResetServiceId();
+                }
+            break;
+            }
+        // Default action is to check unprovisioned service setup plugins.    
+        default:
+            {
+            TInt initializedCount( iServicePluginHandler.PluginCount( 
+                CCSCEngServicePluginHandler::EInitialized ) );
+                          
+             for ( TInt i( 0 ) ; i < initializedCount ; i++ )
+                 {
+                 TBool alreadyOffered( EFalse );
+                        
+                 TServicePluginInfo pluginInfo = 
+                     iServicePluginHandler.ItemFromPluginInfoArray( i );
+                        
+                 for ( TInt j( 0 ); j < iOfferedPluginUids.Count() ; j++ )
+                     {
+                     if ( pluginInfo.iPluginsUid == iOfferedPluginUids[ j ] )
+                         {
+                         alreadyOffered = ETrue;
+                         break;
+                         }
+                     }
+                        
+                 if ( !pluginInfo.iProvisioned && !alreadyOffered )
+                     {                
+                     TBool canceled = HandleServiceConfigurationL( 
+                         pluginInfo.iPluginsUid );
+                            
+                     if ( !canceled )
+                         {                    
+                         break;
+                         }
+                     }
+                 }
+            break;
+            }
+        }
+    
+    CSCDEBUG( "CCSCServiceView::ExecuteStartupActionsL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CAknView.
+// Dynamically initializes the contents of the menu list
+// ---------------------------------------------------------------------------
+// 
+void CCSCServiceView::DynInitMenuPaneL( TInt aResourceId, 
+                                        CEikMenuPane* aMenuPane )
+    {
+    CSCDEBUG( "CCSCServiceView::DynInitMenuPaneL - begin" );
+    
+    if ( R_CSC_SERVICEVIEW_MENU == aResourceId && aMenuPane && iContainer )
+        {    
+        TBool itemSpecificCommandsEnabled = 
+            MenuBar()->ItemSpecificCommandsEnabled();
+        
+        if( ( iContainer->CurrentItemIndex() >= 0 ) &&
+            itemSpecificCommandsEnabled )
+            {
+            if( iContainer->ListBoxItem().iPluginUid != 
+                KAccountCreationPluginUID )
+                {
+                aMenuPane->SetItemDimmed( EAknSoftkeySelect, ETrue );
+                aMenuPane->SetItemDimmed( EAknSoftkeyOpen, EFalse );
+                }
+            else
+                {
+                aMenuPane->SetItemDimmed( EAknSoftkeySelect, EFalse );
+                aMenuPane->SetItemDimmed( EAknSoftkeyOpen, ETrue );
+                }
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EAknSoftkeySelect, ETrue );
+            aMenuPane->SetItemDimmed( EAknSoftkeyOpen, ETrue );
+            }
+
+        // ===================================================================
+        // Delete service menu option.
+        // ===================================================================
+        //        
+        if ( !itemSpecificCommandsEnabled )
+            {
+            TInt index = iContainer->CurrentItemIndex();
+            TPoint penDownPoint = iContainer->PenDownPoint();
+            iContainer->ListBox().View()->XYPosToItemIndex( 
+                penDownPoint, index );
+            iContainer->SetCurrentIndex( index );
+            }
+                     
+        if ( TListBoxItem::EUiExtension == 
+            iContainer->ListBoxItem().iItemType )
+            {
+            aMenuPane->SetItemDimmed( ECSCCommandDelete, ETrue );
+            aMenuPane->SetItemSpecific( ECSCCommandDelete, EFalse ); 
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( ECSCCommandDelete, EFalse );
+            aMenuPane->SetItemSpecific( ECSCCommandDelete, ETrue );    
+            }           
+        }
+        
+    CSCDEBUG( "CCSCServiceView::DynInitMenuPaneL - end" );
+    }
+
+         
+// ---------------------------------------------------------------------------
+// From class CAknView.
+// Creates the Container class object.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceView::DoActivateL( const TVwsViewId& aPrevViewId,
+                                   TUid /*aCustomMessageId*/,
+                                   const TDesC8& /*aCustomMessage*/)
+    {
+    CSCDEBUG( "CCSCServiceView::DoActivateL - begin" );
+              
+    // Create container if it's not exists.
+    if( !iContainer )
+        {        
+        iContainer = CCSCServiceContainer::NewL( 
+                ClientRect(),
+                *this,
+                iServicePluginHandler, 
+                iUiExtensionPluginHandler,
+                iServiceHandler,
+                iBrandingHandler,
+                iCCHHandler );
+                
+        SetTitlePaneTextL();
+        iContainer->SetMopParent( this );
+        iContainer->SetListBoxObserver( this );
+        iContainer->MakeVisible( ETrue );
+        AppUi()->AddToStackL( *this, iContainer );
+        iContainer->SetCurrentIndex( iCurrentIndex );
+        }
+     
+    // Check startup parameters to see is there something to do with plugins.
+    if ( iStartup )
+        {
+        iStartup = EFalse;        
+        if ( KAIAppUid == aPrevViewId.iAppUid )
+            {
+            // launched from active idle
+            iStartupHandler.SetStartedFromHomescreen( ETrue );
+            }
+        else
+            {
+            iStartupHandler.SetStartedFromHomescreen( EFalse );
+            }
+        }
+
+    UpdateCbaL();
+    
+    CSCDEBUG( "CCSCServiceView::DoActivateL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CAknView.
+// Deletes the Container class object.
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceView::DoDeactivate()
+    {
+    CSCDEBUG( "CCSCServiceView::DoDeactivate - begin" );
+                    
+    if ( iContainer )
+        {
+        iCurrentIndex = iContainer->CurrentItemIndex();
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer; 
+        iContainer = NULL;
+        }
+    
+    CSCDEBUG( "CCSCServiceView::DoDeactivate - end" );
+    }
+	
+	
+// ---------------------------------------------------------------------------
+// From class MCSCEngTimerObserver.
+// CCSCServiceView::TimerExpired
+// ---------------------------------------------------------------------------
+//
+void CCSCServiceView::TimerExpired()
+    {
+    CSCDEBUG( "CCSCServiceView::TimerExpired - begin" );
+
+    iStartupHandler.ResetUid( CCSCEngStartupHandler::EPluginUid );
+    iOfferedPluginUids.Append( iPluginInfo.iPluginsUid );
+
+    CCSCNoteUtilities::TCSCNoteType 
+        type = CCSCNoteUtilities::ECSCConfigureServiceQuery;
+    TBool configure( EFalse );
+    TRAP_IGNORE
+        (
+        if ( CCSCNoteUtilities::ShowCommonQueryL( 
+           type, iPluginInfo.iProviderName ) )
+           {        
+           iServicePluginHandler.DoProvisioningL( 
+               iPluginInfo.iPluginsUid, KCSCServiceViewId );
+           // User has accepted plugin configuration query.
+           // Return to avoid launching a new query on top of
+           // current configuration process.
+           configure = ETrue;
+           }
+        );
+    if ( configure )
+        {
+        return;
+        }
+
+    iNextPluginIndex++;
+    TInt pluginCount = iServicePluginHandler.PluginCount( 
+        CCSCEngServicePluginHandler::EInitialized );
+
+    for ( ; iNextPluginIndex < pluginCount; iNextPluginIndex++ )
+        {
+        CSCDEBUG2( "CCSCServiceView::TimerExpired -iNextPluginIndex = %d",
+            iNextPluginIndex );
+
+        iPluginInfo =
+            iServicePluginHandler.ItemFromPluginInfoArray( iNextPluginIndex );
+
+        if ( KNullUid != iPluginInfo.iPluginsUid && !iPluginInfo.iProvisioned )
+            {
+            iEngTimer->StartTimer( CCSCEngTimer::ENoteDelayTimer );
+            break;
+            }
+
+        }
+    CSCDEBUG( "CCSCServiceView::TimerExpired - end" );
+    }
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/bwins/cscengineU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,72 @@
+EXPORTS
+	?ResetServiceId@CCSCEngStartupHandler@@QAEXXZ @ 1 NONAME ; void CCSCEngStartupHandler::ResetServiceId(void)
+	?InitializePluginsL@CCSCEngServicePluginHandler@@QAEXXZ @ 2 NONAME ; void CCSCEngServicePluginHandler::InitializePluginsL(void)
+	?DoProvisioningL@CCSCEngServicePluginHandler@@QAEXABVTUid@@0@Z @ 3 NONAME ; void CCSCEngServicePluginHandler::DoProvisioningL(class TUid const &, class TUid const &)
+	??1CCSCEngConnectionHandler@@UAE@XZ @ 4 NONAME ; CCSCEngConnectionHandler::~CCSCEngConnectionHandler(void)
+	?ItemFromPluginInfoArray@CCSCEngUiExtensionPluginHandler@@QAE?AVTUiExtensionPluginInfo@@H@Z @ 5 NONAME ; class TUiExtensionPluginInfo CCSCEngUiExtensionPluginHandler::ItemFromPluginInfoArray(int)
+	?InitializePluginsL@CCSCEngUiExtensionPluginHandler@@QAEXXZ @ 6 NONAME ; void CCSCEngUiExtensionPluginHandler::InitializePluginsL(void)
+	?SetPresenceReqPrefL@CCSCEngServiceHandler@@QAEXIW4TOnOff@@@Z @ 7 NONAME ; void CCSCEngServiceHandler::SetPresenceReqPrefL(unsigned int, enum TOnOff)
+	?ServiceTabViewIdL@CCSCEngServiceHandler@@QAEHI@Z @ 8 NONAME ; int CCSCEngServiceHandler::ServiceTabViewIdL(unsigned int)
+	?StopTimer@CCSCEngTimer@@QAEXXZ @ 9 NONAME ; void CCSCEngTimer::StopTimer(void)
+	?StartTimer@CCSCEngTimer@@QAEHW4TTimerType@1@@Z @ 10 NONAME ; int CCSCEngTimer::StartTimer(enum CCSCEngTimer::TTimerType)
+	?IsPreferredService@CCSCEngServiceHandler@@QBEHI@Z @ 11 NONAME ; int CCSCEngServiceHandler::IsPreferredService(unsigned int) const
+	?DisableService@CCSCEngCCHHandler@@QAEHH@Z @ 12 NONAME ; int CCSCEngCCHHandler::DisableService(int)
+	?SetHandoverNotifTonePrefL@CCSCEngServiceHandler@@QAEXIW4TOnOff@@@Z @ 13 NONAME ; void CCSCEngServiceHandler::SetHandoverNotifTonePrefL(unsigned int, enum TOnOff)
+	?GetServiceBrandIconL@CCSCEngBrandingHandler@@QAEXABVTDesC8@@AAPAVCFbsBitmap@@1H@Z @ 14 NONAME ; void CCSCEngBrandingHandler::GetServiceBrandIconL(class TDesC8 const &, class CFbsBitmap * &, class CFbsBitmap * &, int)
+	?GetAllServiceIdsL@CCSCEngServiceHandler@@QAEXAAV?$RArray@I@@@Z @ 15 NONAME ; void CCSCEngServiceHandler::GetAllServiceIdsL(class RArray<unsigned int> &)
+	?NewL@CCSCEngStartupHandler@@SAPAV1@XZ @ 16 NONAME ; class CCSCEngStartupHandler * CCSCEngStartupHandler::NewL(void)
+	?LaunchUiExtensionL@CCSCEngUiExtensionPluginHandler@@QAEXABVTUid@@0H@Z @ 17 NONAME ; void CCSCEngUiExtensionPluginHandler::LaunchUiExtensionL(class TUid const &, class TUid const &, int)
+	?StopListeningConnectionEvents@CCSCEngConnectionHandler@@QAEXXZ @ 18 NONAME ; void CCSCEngConnectionHandler::StopListeningConnectionEvents(void)
+	??1CCSCEngBrandingHandler@@UAE@XZ @ 19 NONAME ; CCSCEngBrandingHandler::~CCSCEngBrandingHandler(void)
+	?SetVoipAsPrefTelephony@CCSCEngServiceHandler@@QBEHHI@Z @ 20 NONAME ; int CCSCEngServiceHandler::SetVoipAsPrefTelephony(int, unsigned int) const
+	?ImSettingsIdL@CCSCEngServiceHandler@@QAEHI@Z @ 21 NONAME ; int CCSCEngServiceHandler::ImSettingsIdL(unsigned int)
+	?PresenceReqPrefL@CCSCEngServiceHandler@@QAE?AW4TOnOff@@I@Z @ 22 NONAME ; enum TOnOff CCSCEngServiceHandler::PresenceReqPrefL(unsigned int)
+	?ServiceSetupPluginIdL@CCSCEngServiceHandler@@QAEJI@Z @ 23 NONAME ; long CCSCEngServiceHandler::ServiceSetupPluginIdL(unsigned int)
+	?IsVccSupportedL@CCSCEngServiceHandler@@QAEHI@Z @ 24 NONAME ; int CCSCEngServiceHandler::IsVccSupportedL(unsigned int)
+	?NewLC@CCSCEngServicePluginHandler@@SAPAV1@AAVCEikonEnv@@AAVMCSCEngProvisioningObserver@@AAVCCSCEngServiceHandler@@@Z @ 25 NONAME ; class CCSCEngServicePluginHandler * CCSCEngServicePluginHandler::NewLC(class CEikonEnv &, class MCSCEngProvisioningObserver &, class CCSCEngServiceHandler &)
+	?GetConnectionParameter@CCSCEngCCHHandler@@QAEHHW4TCchConnectionParameter@@AAVRBuf16@@@Z @ 26 NONAME ; int CCSCEngCCHHandler::GetConnectionParameter(int, enum TCchConnectionParameter, class RBuf16 &)
+	?GetParamAppUid@CCSCEngStartupHandler@@QBE?BVTUid@@XZ @ 27 NONAME ; class TUid const CCSCEngStartupHandler::GetParamAppUid(void) const
+	?SetImSettingsIdL@CCSCEngServiceHandler@@QAEXIH@Z @ 28 NONAME ; void CCSCEngServiceHandler::SetImSettingsIdL(unsigned int, int)
+	?SetConnectionParameter@CCSCEngCCHHandler@@QAEHHW4TCchConnectionParameter@@ABVTDesC16@@@Z @ 29 NONAME ; int CCSCEngCCHHandler::SetConnectionParameter(int, enum TCchConnectionParameter, class TDesC16 const &)
+	?GetParamUrl@CCSCEngStartupHandler@@QBEHAAVTDes16@@@Z @ 30 NONAME ; int CCSCEngStartupHandler::GetParamUrl(class TDes16 &) const
+	?NewL@CCSCEngBrandingHandler@@SAPAV1@XZ @ 31 NONAME ; class CCSCEngBrandingHandler * CCSCEngBrandingHandler::NewL(void)
+	?StartedFromHomescreen@CCSCEngStartupHandler@@QBEHXZ @ 32 NONAME ; int CCSCEngStartupHandler::StartedFromHomescreen(void) const
+	?NewL@CCSCEngServiceHandler@@SAPAV1@PAVMCSCEngServiceObserver@@@Z @ 33 NONAME ; class CCSCEngServiceHandler * CCSCEngServiceHandler::NewL(class MCSCEngServiceObserver *)
+	?IsServiceDisabled@CCSCEngCCHHandler@@QAEHH@Z @ 34 NONAME ; int CCSCEngCCHHandler::IsServiceDisabled(int)
+	?IsSipVoIPL@CCSCEngServiceHandler@@QAEHI@Z @ 35 NONAME ; int CCSCEngServiceHandler::IsSipVoIPL(unsigned int)
+	??1CCSCEngServiceHandler@@UAE@XZ @ 36 NONAME ; CCSCEngServiceHandler::~CCSCEngServiceHandler(void)
+	?NewL@CCSCEngUiExtensionPluginHandler@@SAPAV1@AAVCEikonEnv@@AAVMCSCEngUiExtensionObserver@@AAVCCSCEngStartupHandler@@@Z @ 37 NONAME ; class CCSCEngUiExtensionPluginHandler * CCSCEngUiExtensionPluginHandler::NewL(class CEikonEnv &, class MCSCEngUiExtensionObserver &, class CCSCEngStartupHandler &)
+	?NewL@CCSCEngTimer@@SAPAV1@AAVMCSCEngTimerObserver@@@Z @ 38 NONAME ; class CCSCEngTimer * CCSCEngTimer::NewL(class MCSCEngTimerObserver &)
+	?ServiceNameL@CCSCEngServiceHandler@@QAEABVTDesC16@@I@Z @ 39 NONAME ; class TDesC16 const & CCSCEngServiceHandler::ServiceNameL(unsigned int)
+	?StartListeningConnectionEvents@CCSCEngConnectionHandler@@QAEXXZ @ 40 NONAME ; void CCSCEngConnectionHandler::StartListeningConnectionEvents(void)
+	?NewL@CCSCEngServicePluginHandler@@SAPAV1@AAVCEikonEnv@@AAVMCSCEngProvisioningObserver@@AAVCCSCEngServiceHandler@@@Z @ 41 NONAME ; class CCSCEngServicePluginHandler * CCSCEngServicePluginHandler::NewL(class CEikonEnv &, class MCSCEngProvisioningObserver &, class CCSCEngServiceHandler &)
+	?GetParamServiceId@CCSCEngStartupHandler@@QBEIXZ @ 42 NONAME ; unsigned int CCSCEngStartupHandler::GetParamServiceId(void) const
+	?PluginCount@CCSCEngUiExtensionPluginHandler@@QBEHXZ @ 43 NONAME ; int CCSCEngUiExtensionPluginHandler::PluginCount(void) const
+	?SetStartupParametersL@CCSCEngStartupHandler@@QAEHABVTDesC16@@@Z @ 44 NONAME ; int CCSCEngStartupHandler::SetStartupParametersL(class TDesC16 const &)
+	?ServiceIdCountL@CCSCEngServiceHandler@@QAEHXZ @ 45 NONAME ; int CCSCEngServiceHandler::ServiceIdCountL(void)
+	?NewL@CCSCEngDestinationsHandler@@SAPAV1@XZ @ 46 NONAME ; class CCSCEngDestinationsHandler * CCSCEngDestinationsHandler::NewL(void)
+	??1CCSCEngDestinationsHandler@@UAE@XZ @ 47 NONAME ; CCSCEngDestinationsHandler::~CCSCEngDestinationsHandler(void)
+	?NewL@CCSCEngConnectionHandler@@SAPAV1@AAVMCSCEngConnectionObserver@@@Z @ 48 NONAME ; class CCSCEngConnectionHandler * CCSCEngConnectionHandler::NewL(class MCSCEngConnectionObserver &)
+	?HandoverNotifTonePrefL@CCSCEngServiceHandler@@QAE?AW4TOnOff@@I@Z @ 49 NONAME ; enum TOnOff CCSCEngServiceHandler::HandoverNotifTonePrefL(unsigned int)
+	?NewL@CCSCEngCCHHandler@@SAPAV1@AAVMCSCEngCCHObserver@@@Z @ 50 NONAME ; class CCSCEngCCHHandler * CCSCEngCCHHandler::NewL(class MCSCEngCCHObserver &)
+	?GetParamPluginUid@CCSCEngStartupHandler@@QBE?BVTUid@@XZ @ 51 NONAME ; class TUid const CCSCEngStartupHandler::GetParamPluginUid(void) const
+	?SnapIdL@CCSCEngServiceHandler@@QAEHI@Z @ 52 NONAME ; int CCSCEngServiceHandler::SnapIdL(unsigned int)
+	?SetStartedFromHomescreen@CCSCEngStartupHandler@@QAEXH@Z @ 53 NONAME ; void CCSCEngStartupHandler::SetStartedFromHomescreen(int)
+	?ItemFromPluginInfoArray@CCSCEngServicePluginHandler@@QAE?AVTServicePluginInfo@@H@Z @ 54 NONAME ; class TServicePluginInfo CCSCEngServicePluginHandler::ItemFromPluginInfoArray(int)
+	?SupportedSubServicesL@CCSCEngCCHHandler@@QAEXHAAVTSupportedSubServices@@@Z @ 55 NONAME ; void CCSCEngCCHHandler::SupportedSubServicesL(int, class TSupportedSubServices &)
+	?SnapNameL@CCSCEngDestinationsHandler@@QAEPAVHBufC16@@K@Z @ 56 NONAME ; class HBufC16 * CCSCEngDestinationsHandler::SnapNameL(unsigned long)
+	?LaunchPluginViewL@CCSCEngServicePluginHandler@@QAEXABVTUid@@0@Z @ 57 NONAME ; void CCSCEngServicePluginHandler::LaunchPluginViewL(class TUid const &, class TUid const &)
+	?DeleteServiceL@CCSCEngServiceHandler@@QAEXI@Z @ 58 NONAME ; void CCSCEngServiceHandler::DeleteServiceL(unsigned int)
+	??1CCSCEngTimer@@UAE@XZ @ 59 NONAME ; CCSCEngTimer::~CCSCEngTimer(void)
+	?IsPreferredTelephonyVoip@CCSCEngServiceHandler@@QBEHXZ @ 60 NONAME ; int CCSCEngServiceHandler::IsPreferredTelephonyVoip(void) const
+	?ResetUid@CCSCEngStartupHandler@@QAEXW4TUidType@1@@Z @ 61 NONAME ; void CCSCEngStartupHandler::ResetUid(enum CCSCEngStartupHandler::TUidType)
+	?GetConnectionParameter@CCSCEngCCHHandler@@QAEHHW4TCchConnectionParameter@@AAH@Z @ 62 NONAME ; int CCSCEngCCHHandler::GetConnectionParameter(int, enum TCchConnectionParameter, int &)
+	?NewLC@CCSCEngUiExtensionPluginHandler@@SAPAV1@AAVCEikonEnv@@AAVMCSCEngUiExtensionObserver@@AAVCCSCEngStartupHandler@@@Z @ 63 NONAME ; class CCSCEngUiExtensionPluginHandler * CCSCEngUiExtensionPluginHandler::NewLC(class CEikonEnv &, class MCSCEngUiExtensionObserver &, class CCSCEngStartupHandler &)
+	?GetParamAction@CCSCEngStartupHandler@@QBE?AW4TAction@1@XZ @ 64 NONAME ; enum CCSCEngStartupHandler::TAction CCSCEngStartupHandler::GetParamAction(void) const
+	?PluginCount@CCSCEngServicePluginHandler@@QBEHW4TPluginCount@1@@Z @ 65 NONAME ; int CCSCEngServicePluginHandler::PluginCount(enum CCSCEngServicePluginHandler::TPluginCount) const
+	?BrandIdL@CCSCEngServiceHandler@@QAEXIAAVTDes16@@@Z @ 66 NONAME ; void CCSCEngServiceHandler::BrandIdL(unsigned int, class TDes16 &)
+	?IsServiceValidL@CCSCEngCCHHandler@@QAEHH@Z @ 67 NONAME ; int CCSCEngCCHHandler::IsServiceValidL(int)
+	?IsSnapInUseL@CCSCEngDestinationsHandler@@QAEHK@Z @ 68 NONAME ; int CCSCEngDestinationsHandler::IsSnapInUseL(unsigned long)
+	?AvailableSnapIdsL@CCSCEngDestinationsHandler@@QAEXAAV?$RArray@K@@@Z @ 69 NONAME ; void CCSCEngDestinationsHandler::AvailableSnapIdsL(class RArray<unsigned long> &)
+	?DoRemovationL@CCSCEngServicePluginHandler@@QAEXABVTUid@@H@Z @ 70 NONAME ; void CCSCEngServicePluginHandler::DoRemovationL(class TUid const &, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/data/cscengine.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,89 @@
+/*
+* 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:  Resource definitions for project CSC
+*
+*/
+
+
+NAME SCEN
+
+#include <eikon.rh>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <AiwCommon.rh>
+#include <AiwCommon.hrh>
+
+
+// -----------------------------------------------------------------------------
+//
+// Define the resource file signature 
+// This resource should be empty
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+//   
+// r_csceng_interest_service_plugin
+// Define items of the interest and given them to the ServiceHandler
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AIW_INTEREST r_csceng_interest_service_plugin
+    {
+    items=
+        {
+        AIW_CRITERIA_ITEM 
+            {
+            //define these in ServiceHandler's AiwCommon.hrh
+            //and re-compile it.
+            id = KAiwCmdCSCServicePlugins;
+            serviceCmd = KAiwCmdCSCServicePlugins;
+            contentType = "*";
+            serviceClass = KAiwClassBase;
+            maxProviders = 5;
+            }
+        };
+    }
+
+
+// -----------------------------------------------------------------------------
+//   
+// r_csceng_interest_ui_ext_plugin
+// Define items of the interest and given them to the ServiceHandler
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AIW_INTEREST r_csceng_interest_ui_ext_plugin
+    {
+    items=
+        {
+        AIW_CRITERIA_ITEM 
+            {
+            //define these in ServiceHandler's AiwCommon.hrh
+            //and re-compile it.
+            id = KAiwCmdCSCUiExtensionPlugins;
+            serviceCmd = KAiwCmdCSCUiExtensionPlugins;
+            contentType = "*";
+            serviceClass = KAiwClassBase;
+            maxProviders = 5;
+            }
+        };
+    }
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/eabi/cscengineU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,67 @@
+EXPORTS
+	_ZN12CCSCEngTimer10StartTimerENS_10TTimerTypeE @ 1 NONAME
+	_ZN12CCSCEngTimer4NewLER20MCSCEngTimerObserver @ 2 NONAME
+	_ZN12CCSCEngTimer9StopTimerEv @ 3 NONAME
+	_ZN17CCSCEngCCHHandler14DisableServiceEi @ 4 NONAME
+	_ZN17CCSCEngCCHHandler15IsServiceValidLEi @ 5 NONAME
+	_ZN17CCSCEngCCHHandler17IsServiceDisabledEi @ 6 NONAME
+	_ZN17CCSCEngCCHHandler21SupportedSubServicesLEiR21TSupportedSubServices @ 7 NONAME
+	_ZN17CCSCEngCCHHandler22GetConnectionParameterEi23TCchConnectionParameterR6RBuf16 @ 8 NONAME
+	_ZN17CCSCEngCCHHandler22GetConnectionParameterEi23TCchConnectionParameterRi @ 9 NONAME
+	_ZN17CCSCEngCCHHandler22SetConnectionParameterEi23TCchConnectionParameterRK7TDesC16 @ 10 NONAME
+	_ZN17CCSCEngCCHHandler4NewLER18MCSCEngCCHObserver @ 11 NONAME
+	_ZN21CCSCEngServiceHandler10IsSipVoIPLEj @ 12 NONAME
+	_ZN21CCSCEngServiceHandler12ServiceNameLEj @ 13 NONAME
+	_ZN21CCSCEngServiceHandler13ImSettingsIdLEj @ 14 NONAME
+	_ZN21CCSCEngServiceHandler14DeleteServiceLEj @ 15 NONAME
+	_ZN21CCSCEngServiceHandler15IsVccSupportedLEj @ 16 NONAME
+	_ZN21CCSCEngServiceHandler15ServiceIdCountLEv @ 17 NONAME
+	_ZN21CCSCEngServiceHandler16PresenceReqPrefLEj @ 18 NONAME
+	_ZN21CCSCEngServiceHandler16SetImSettingsIdLEji @ 19 NONAME
+	_ZN21CCSCEngServiceHandler17GetAllServiceIdsLER6RArrayIjE @ 20 NONAME
+	_ZN21CCSCEngServiceHandler17ServiceTabViewIdLEj @ 21 NONAME
+	_ZN21CCSCEngServiceHandler19SetPresenceReqPrefLEj6TOnOff @ 22 NONAME
+	_ZN21CCSCEngServiceHandler21ServiceSetupPluginIdLEj @ 23 NONAME
+	_ZN21CCSCEngServiceHandler22HandoverNotifTonePrefLEj @ 24 NONAME
+	_ZN21CCSCEngServiceHandler25SetHandoverNotifTonePrefLEj6TOnOff @ 25 NONAME
+	_ZN21CCSCEngServiceHandler4NewLEP22MCSCEngServiceObserver @ 26 NONAME
+	_ZN21CCSCEngServiceHandler7SnapIdLEj @ 27 NONAME
+	_ZN21CCSCEngServiceHandler8BrandIdLEjR6TDes16 @ 28 NONAME
+	_ZN21CCSCEngStartupHandler14ResetServiceIdEv @ 29 NONAME
+	_ZN21CCSCEngStartupHandler21SetStartupParametersLERK7TDesC16 @ 30 NONAME
+	_ZN21CCSCEngStartupHandler24SetStartedFromHomescreenEi @ 31 NONAME
+	_ZN21CCSCEngStartupHandler4NewLEv @ 32 NONAME
+	_ZN21CCSCEngStartupHandler8ResetUidENS_8TUidTypeE @ 33 NONAME
+	_ZN22CCSCEngBrandingHandler20GetServiceBrandIconLERK6TDesC8RP10CFbsBitmapS5_i @ 34 NONAME
+	_ZN22CCSCEngBrandingHandler4NewLEv @ 35 NONAME
+	_ZN24CCSCEngConnectionHandler29StopListeningConnectionEventsEv @ 36 NONAME
+	_ZN24CCSCEngConnectionHandler30StartListeningConnectionEventsEv @ 37 NONAME
+	_ZN24CCSCEngConnectionHandler4NewLER25MCSCEngConnectionObserver @ 38 NONAME
+	_ZN26CCSCEngDestinationsHandler12IsSnapInUseLEm @ 39 NONAME
+	_ZN26CCSCEngDestinationsHandler17AvailableSnapIdsLER6RArrayImE @ 40 NONAME
+	_ZN26CCSCEngDestinationsHandler4NewLEv @ 41 NONAME
+	_ZN26CCSCEngDestinationsHandler9SnapNameLEm @ 42 NONAME
+	_ZN27CCSCEngServicePluginHandler13DoRemovationLERK4TUidi @ 43 NONAME
+	_ZN27CCSCEngServicePluginHandler15DoProvisioningLERK4TUidS2_ @ 44 NONAME
+	_ZN27CCSCEngServicePluginHandler17LaunchPluginViewLERK4TUidS2_ @ 45 NONAME
+	_ZN27CCSCEngServicePluginHandler18InitializePluginsLEv @ 46 NONAME
+	_ZN27CCSCEngServicePluginHandler23ItemFromPluginInfoArrayEi @ 47 NONAME
+	_ZN27CCSCEngServicePluginHandler4NewLER9CEikonEnvR27MCSCEngProvisioningObserverR21CCSCEngServiceHandler @ 48 NONAME
+	_ZN27CCSCEngServicePluginHandler5NewLCER9CEikonEnvR27MCSCEngProvisioningObserverR21CCSCEngServiceHandler @ 49 NONAME
+	_ZN31CCSCEngUiExtensionPluginHandler18InitializePluginsLEv @ 50 NONAME
+	_ZN31CCSCEngUiExtensionPluginHandler18LaunchUiExtensionLERK4TUidS2_i @ 51 NONAME
+	_ZN31CCSCEngUiExtensionPluginHandler23ItemFromPluginInfoArrayEi @ 52 NONAME
+	_ZN31CCSCEngUiExtensionPluginHandler4NewLER9CEikonEnvR26MCSCEngUiExtensionObserverR21CCSCEngStartupHandler @ 53 NONAME
+	_ZN31CCSCEngUiExtensionPluginHandler5NewLCER9CEikonEnvR26MCSCEngUiExtensionObserverR21CCSCEngStartupHandler @ 54 NONAME
+	_ZNK21CCSCEngServiceHandler18IsPreferredServiceEj @ 55 NONAME
+	_ZNK21CCSCEngServiceHandler22SetVoipAsPrefTelephonyEij @ 56 NONAME
+	_ZNK21CCSCEngServiceHandler24IsPreferredTelephonyVoipEv @ 57 NONAME
+	_ZNK21CCSCEngStartupHandler11GetParamUrlER6TDes16 @ 58 NONAME
+	_ZNK21CCSCEngStartupHandler14GetParamActionEv @ 59 NONAME
+	_ZNK21CCSCEngStartupHandler14GetParamAppUidEv @ 60 NONAME
+	_ZNK21CCSCEngStartupHandler17GetParamPluginUidEv @ 61 NONAME
+	_ZNK21CCSCEngStartupHandler17GetParamServiceIdEv @ 62 NONAME
+	_ZNK21CCSCEngStartupHandler21StartedFromHomescreenEv @ 63 NONAME
+	_ZNK27CCSCEngServicePluginHandler11PluginCountENS_12TPluginCountE @ 64 NONAME
+	_ZNK31CCSCEngUiExtensionPluginHandler11PluginCountEv @ 65 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSC Engine
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+../inc/cscengsettingscleanupplugininterface.h     |../../../inc/cscengsettingscleanupplugininterface.h
+../inc/cscengsettingscleanupplugininterface.inl	  |../../../inc/cscengsettingscleanupplugininterface.inl
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+cscengine.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/group/cscengine.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,74 @@
+/*
+* 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:  Project definition file for project CSC Engine
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          cscengine.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x10275459
+
+CAPABILITY      CAP_GENERAL_DLL NetworkControl
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          cscengtimer.cpp
+SOURCE          cscengcchhandler.cpp
+SOURCE          cscengecommonitor.cpp
+SOURCE          cscengservicehandler.cpp
+SOURCE          cscengstartuphandler.cpp
+SOURCE          cscengbrandinghandler.cpp
+SOURCE          cscengconnectionhandler.cpp
+SOURCE          cscengdestinationshandler.cpp
+SOURCE          cscengservicepluginhandler.cpp
+SOURCE          cscenguiextensionpluginhandler.cpp
+
+START RESOURCE  ../data/cscengine.rss
+HEADER
+TARGETPATH      RESOURCE_FILES_DIR
+TARGET          cscengine.rsc
+LANG            SC
+END // RESOURCE
+
+
+USERINCLUDE     ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+LIBRARY         cch.lib
+LIBRARY         ecom.lib
+LIBRARY         cone.lib 
+LIBRARY         bafl.lib
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         esock.lib
+LIBRARY         eikcore.lib 
+LIBRARY         aknicon.lib
+LIBRARY         featmgr.lib
+LIBRARY         bsclient.lib
+LIBRARY         aknskins.lib
+LIBRARY         cchclient.lib
+LIBRARY         cmmanager.lib
+LIBRARY         swinstcli.lib
+LIBRARY         platformenv.lib 
+LIBRARY         servicehandler.lib
+LIBRARY         centralrepository.lib
+LIBRARY         serviceprovidersettings.lib
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscengbrandinghandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,117 @@
+/*
+* 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:  For CSC needed branding server handling
+*
+*/
+
+
+
+#ifndef C_CSCBRANDINGHANDLER_H
+#define C_CSCBRANDINGHANDLER_H
+
+#include <AknIconUtils.h>
+
+class MBSAccess;
+class CBSFactory;
+
+/**
+ * An instance of CCSCEngBrandingHandler
+ * For CSC needed Branding Server handling
+ *
+ * @lib cscengine.lib
+ * @since Series 60 3.2
+ */
+NONSHARABLE_CLASS ( CCSCEngBrandingHandler ) : public CBase, 
+                                               public MAknIconFileProvider
+    {    
+    public:
+        
+        /**
+         * Two-phased constructor.
+         */ 
+        IMPORT_C static CCSCEngBrandingHandler* NewL();
+
+
+        /**
+         * Destructor.
+         */
+        IMPORT_C virtual ~CCSCEngBrandingHandler();
+        
+        
+        /**
+         * Get branded bitmap for service.
+         *
+         * @since Series 60 3.2
+         * @param aBrandId service brand id
+         * @param aBitmap bitmap is stored to this
+         * @param aMask mask is stored to this
+         * @param aIconSize Size of the icon in pixels
+         */
+        IMPORT_C void GetServiceBrandIconL( 
+           const TDesC8& aBrandId, CFbsBitmap*& aBitmap, CFbsBitmap*& aMask,
+           TInt aIconSize );
+
+        // from base class MAknIconFileProvider
+            
+        /**
+         * From MAknIconFileProvider
+         * Returns an open file handle to the icon file.
+         *
+         * @param aFile Icon file should be opened in this file handle, which
+         * is an empty file handle, when the AknIcon framework calls this 
+         * method. The AknIcon framework takes care of closing the file handle
+         * after having used it.
+         * @param aType Icon file type.
+         * @since 
+         */
+        void RetrieveIconFileHandleL(
+                RFile& aFile, const TIconFileType aType );
+
+
+        /**
+         * From MAknIconFileProvider
+         * With this method, AknIcon framework informs that it does not use
+         * this MAknIconFileProvider instance any more.  
+         *
+         * @since
+         */
+        void Finished(){};
+
+                       
+    private:
+
+        CCSCEngBrandingHandler();
+
+        void ConstructL();
+        
+              
+    private:  // data
+        
+        /**
+         * Pointer to CBSFactory
+         * Own.
+         */
+        CBSFactory* iFactory;
+        
+        /**
+         * File.
+         */
+        RFile iFile;       
+        
+#ifdef _DEBUG
+    friend class UT_CSCEngBrandingHandler;
+#endif
+    };
+
+#endif // C_CSCBRANDINGHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscengcchhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,236 @@
+/*
+* 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:  For handling interactions betweed UI and CCH.
+*
+*/
+
+
+
+#ifndef C_CSCENGCCHHANDLER_H
+#define C_CSCENGCCHHANDLER_H
+
+#include <cch.h>
+
+class MCSCEngCCHObserver;
+
+/**
+ * TSupportedSubServices class
+ *
+ * @lib cscengine.lib
+ * @since Series 60 3.2
+ */
+NONSHARABLE_CLASS ( TSupportedSubServices )
+    {
+    public:
+    
+        /**
+         * Constructor.
+         *
+         * @since S60 3.2
+         */
+        TSupportedSubServices()
+            : iVoIP( EFalse ),
+            iPresence( EFalse ),
+            iIm( EFalse ),
+            iVmbx( EFalse )
+            {}
+
+    public: // data
+        
+        /*
+         * VoIP
+         */
+        TBool iVoIP;
+    
+        /*
+         * Presence
+         */
+        TBool iPresence;
+    
+        /*
+         * Instant Messaging
+         */
+        TBool iIm;
+        
+        /*
+         * Voice mail box
+         */
+        TBool iVmbx;
+    };
+
+
+/**
+ * An instance of CCSCEngCCHHandler
+ * For handling interactions betweed UI and CCH.
+ *
+ * @lib cscengine.lib
+ * @since Series 60 3.2
+ */
+NONSHARABLE_CLASS( CCSCEngCCHHandler ) : public CBase, 
+                                                MCchServiceStatusObserver
+    {    
+    public:
+                
+        /**
+         * Two-phased constructor.
+         */ 
+        IMPORT_C static CCSCEngCCHHandler* NewL( 
+            MCSCEngCCHObserver& aObserver );
+
+
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCEngCCHHandler();
+        
+        
+        /**
+         * Disable service
+         *
+         * @since S60 v5.0
+         * @param aServiceId service id
+         * @return Error code.
+         */
+        IMPORT_C TInt DisableService( TInt aServiceId );
+        
+                
+        /**
+         * Get supported subservices
+         *
+         * @since S60 v5.0
+         * @param aServiceId service id
+         * @param aSupSubServices supported subservices
+         */
+        IMPORT_C void SupportedSubServicesL( 
+                TInt aServiceId, 
+                TSupportedSubServices& aSupSubservices );
+        
+        
+        /**
+         * Get cch connection parameter (RBuf)
+         *
+         * @since S60 v5.0
+         * @param aServiceId service id
+         * @param aConnParam cch connection parameter
+         * @param aConnParamValue connection parameter value
+         * @return Error code.
+         */
+        IMPORT_C TInt GetConnectionParameter( 
+            TInt aServiceId, 
+            TCchConnectionParameter aConnParam,
+            RBuf& aConnParamValue );
+        
+        
+        /**
+         * Get cch connection parameter( TInt )
+         *
+         * @since S60 v5.0
+         * @param aServiceId service id
+         * @param aConnParam cch connection parameter
+         * @param aConnParamValue connection parameter value
+         * @return Error code.
+         */
+        IMPORT_C TInt GetConnectionParameter( 
+            TInt aServiceId, 
+            TCchConnectionParameter aConnParam,
+            TInt& aConnParamValue );
+        
+        
+        /**
+         * Set cch connection parameter
+         *
+         * @since S60 v5.0
+         * @param aServiceId service id
+         * @param aConnParam cch connection parameter
+         * @param aConnParamValue connection parameter value
+         * @return Error code.
+         */
+        IMPORT_C TInt SetConnectionParameter( 
+            TInt aServiceId, 
+            TCchConnectionParameter aConnParam,
+            const TDesC& aConnParamValue );
+        
+        
+        /**
+         * For checking if service is disabled
+         *
+         * @since S60 v3.2
+         * @param aServiceId service id
+         * @return ETrue if service is disabled
+         */
+        IMPORT_C TBool IsServiceDisabled( TInt aServiceId );
+               
+        
+        /**
+         * For checking if service is valid (some subservice(s) is supported)
+         *
+         * @since S60 v5.0
+         * @param aServiceId service id
+         * @return ETrue if service is valid
+         */
+        IMPORT_C TBool IsServiceValidL( TInt aServiceId );
+        
+    private:
+
+        CCSCEngCCHHandler( 
+            MCSCEngCCHObserver& aObserver );
+
+        void ConstructL();
+        
+        
+        /**
+         * Returns ETrue if subservice is disabled
+         * 
+         * @since S60 v5.0
+         * @param aServiceId Service id.
+         * @param aType Subservice type.
+         * @return ETrue if subservice is disabled
+         */
+        TBool IsDisabled( TInt aServiceId, TCCHSubserviceType aType );
+        
+        
+        // from base class MCchServiceStatusObserver
+        
+        /**
+         *  From MCchServiceStatusObserver
+         * 
+         * @since S60 v5.0
+         * @param aServiceId Service id.
+         * @param aType Subservice type.
+         * @return aServiceStatus service status.
+         */
+        void ServiceStatusChanged( 
+            TInt aServiceId, 
+            TCCHSubserviceType aType, 
+            const TCchServiceStatus& aServiceStatus );
+        
+    private:  // data
+        
+        /**
+         * Reference for observer.
+         */
+        MCSCEngCCHObserver& iObserver;
+               
+        /**
+         * Handle to CCH Client API.
+         * Own.
+         */
+        CCch* iCchClientApi;
+        
+#ifdef _DEBUG
+    friend class UT_CSCEngCchHandler;
+#endif 
+    };
+
+#endif // C_CSCENGCCHHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscengconnectionhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,153 @@
+/*
+* 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:  For handling interactions betweed UI and RConnection.
+*
+*/
+
+
+
+#ifndef C_CSCENGCONNECTIONHANDLER_H
+#define C_CSCENGCONNECTIONHANDLER_H
+
+#include <in_sock.h>
+#include <es_sock.h>
+#include <es_enum.h>
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <es_enum_internal.h>
+#endif
+
+#include "mcscengtimerobserver.h"
+
+class CCSCEngTimer;
+class MCSCEngConnectionObserver;
+
+/**
+ * An instance of CCSCEngConnectionHandler
+ * For handling interactions betweed UI and RConnection.
+ *
+ * @lib cscengine.lib
+ * @since Series 60 3.2
+ */
+NONSHARABLE_CLASS( CCSCEngConnectionHandler ) : public CActive,
+                                                public MCSCEngTimerObserver
+    {    
+    public:
+        
+        /**
+         * Enumeration for connection events
+         */
+        enum TConnectionEvent
+            {
+            EEventConnectionDown = 0,
+            EEventTimedOut
+            };
+                
+        /**
+         * Two-phased constructor.
+         */ 
+        IMPORT_C static CCSCEngConnectionHandler* NewL( 
+            MCSCEngConnectionObserver& aObserver );
+
+
+        /**
+         * Destructor.
+         */
+        IMPORT_C virtual ~CCSCEngConnectionHandler();
+        
+        
+        /**
+         * Start listening connection events
+         * 
+         * @since S60 v3.2
+         */
+        IMPORT_C void StartListeningConnectionEvents();
+        
+        
+        /**
+         * Stop listening connection events
+         * 
+         * @since S60 v3.2
+         */
+        IMPORT_C void StopListeningConnectionEvents();
+        
+        
+        // from base class MCSCEngTimerObserver
+        
+        /**
+        * Called on timer expiration.
+        *
+        * @since S60 v3.2
+        */
+       void TimerExpired();
+
+
+    protected: 
+    
+        // from base class CActive
+        
+        /**
+         * From CActive.
+         */
+        void RunL();
+        
+        
+        /**
+         * From CActive.
+         */
+        void DoCancel();
+
+               
+    private:
+
+        CCSCEngConnectionHandler( 
+            MCSCEngConnectionObserver& aObserver );
+
+        void ConstructL();
+        
+           
+    private:  // data
+        
+        /**
+         * Pointer to CSCEngTimer.
+         * Own.
+         */
+        CCSCEngTimer* iTimer;
+    
+        /**
+         * Reference for observer.
+         */
+        MCSCEngConnectionObserver& iObserver;
+        
+        /**
+         * RConnection.
+         */
+        RConnection iConnection;
+        
+        /**
+         * Socket server.
+         */
+        RSocketServ iSocketServ;
+                
+        /**
+         * Interface notifiaction buffer
+         */
+        TInterfaceNotificationBuf iInfoBuf;
+        
+#ifdef _DEBUG
+    friend class UT_CSCEngConnectionHandler;
+#endif   
+    };
+
+#endif // C_CSCENGCONNECTIONHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscengdestinationshandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,92 @@
+/*
+* 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:  For handling interactions betweed UI and CMM.
+*
+*/
+
+
+#ifndef C_CSCENGDESTINATIONSHANDLER_H
+#define C_CSCENGDESTINATIONSHANDLER_H
+
+#include <cmmanagerext.h>
+
+/**
+ * An instance of CCSCEngDestinationsHandler
+ * For handling interactions betweed UI and CMM.
+ *
+ * @lib cscengine.lib
+ * @since Series 60 3.2
+ */
+NONSHARABLE_CLASS( CCSCEngDestinationsHandler ) : public CBase
+    {    
+    public:
+        
+        /**
+         * Two-phased constructor.
+         */ 
+        IMPORT_C static CCSCEngDestinationsHandler* NewL();
+
+
+        /**
+         * Destructor.
+         */
+        IMPORT_C virtual ~CCSCEngDestinationsHandler();
+
+        
+        /**
+         * Returns available destination ids in the device.
+         *
+         * @since S60 v3.2
+         * @param aSnapIds for destination ids
+         */
+        IMPORT_C void AvailableSnapIdsL( RArray<TUint32>& aSnapIds );          
+    
+        
+        /**
+         * Returns destination name based on destination id.
+         *
+         * @since S60 v3.2
+         * @param aSnapId for destination id 
+         * @return HBufC pointer to destination name, 
+         *          ownership is transferred to caller
+         */
+        IMPORT_C HBufC* SnapNameL( TUint32 aSnapId );
+        
+        
+        /**
+         * Returns ETrue if snap is in use.
+         *
+         * @since S60 v3.2
+         * @param aSnapId for destination id 
+         * @return ETrue when snap is in use
+         */
+        IMPORT_C TBool IsSnapInUseL( TUint32 aSnapId );
+     
+    private:
+
+        CCSCEngDestinationsHandler();
+
+        void ConstructL();
+              
+    private:  // data
+        
+        /**
+         * Handle to Connection Method Manager.
+         * Own.
+         */
+        RCmManagerExt iCmManager;
+        
+    };
+
+#endif // C_CSCENGDESTINATIONSHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscengecommonitor.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2007-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:  For monitoring ecom events.
+*
+*/
+
+
+#ifndef C_CSCENGECOMMONITOR_H
+#define C_CSCENGECOMMONITOR_H
+
+#include <ecom/ecom.h>
+
+class MCSCEngEcomObserver;
+
+/**
+ * An instance of CCSCEngEcomMonitor
+ * For monitoring ecom events.
+ *
+ * @lib cscengine.lib
+ * @since Series 60 3.2
+ */
+NONSHARABLE_CLASS( CCSCEngEcomMonitor ) : public CActive
+    {    
+    public:
+        
+        /**
+         * Two-phased constructor.
+         *
+         * @param aObserver for Ecom observer
+         */ 
+        static CCSCEngEcomMonitor* NewL( MCSCEngEcomObserver& aObserver );
+
+
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCEngEcomMonitor();
+    
+    protected:      
+
+        // from base class CActive
+    
+        /**
+         * @see CActive.
+         */
+        void RunL();
+
+
+        /**
+         * @see CActive.
+         */
+        void DoCancel();
+     
+    private:
+
+        CCSCEngEcomMonitor( MCSCEngEcomObserver& aObserver );
+
+        void ConstructL();
+        
+        
+        /**
+         * Starts monitoring about ECom notifications.
+         *
+         * @since S60 v3.2
+         */
+        void StartMonitoring();
+                
+        /**
+         * Frees memory allocated by array in case of leave.
+         *
+         * @since S60 v3.2
+         * @param aArray for array to be freed
+         */
+        static void ResetAndDestroy( TAny* aArray );
+              
+    private:  // data
+    
+        /**
+         * Reference to ECom observer.
+         */
+        MCSCEngEcomObserver& iObserver;
+    
+        /**
+         * Handle to ECom session.
+         * Own.
+         */
+        REComSession iEcomSession;
+        
+#ifdef _DEBUG
+    friend class UT_CSCEngEcomMonitor;
+#endif
+    };
+
+#endif // C_CSCENGECOMMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscenglogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,70 @@
+/*
+* 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:  Provides macros for logging
+*
+*/
+
+
+#ifndef CSCENGLOGGER_H
+#define CSCENGLOGGER_H
+
+#include <e32def.h>
+#include <e32debug.h>
+
+
+//----------------------------------------------------------------------------
+//  USER LOGGING SETTINGS
+//----------------------------------------------------------------------------
+
+#ifndef _DEBUG
+
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = RDebug
+***************************/ 
+
+#define CSCENG_DEBUG             0   // UREL BUILD
+
+#else
+
+#define CSCENG_DEBUG             1   // UDEB BUILD
+
+#endif // _DEBUG
+
+
+
+//----------------------------------------------------------------------------
+//  LOGGING MACROs (DO NOT EDIT)
+//
+//  USE THESE MACROS IN YOUR CODE
+//----------------------------------------------------------------------------
+
+#if CSCENG_DEBUG == 1    // RDebug
+
+#define CSCENGDEBUG(AA)           { RDebug::Print(_L(AA)); }
+#define CSCENGDEBUG2(AA,BB)       { RDebug::Print(_L(AA),BB); }
+#define CSCENGDEBUG3(AA,BB,CC)    { RDebug::Print(_L(AA),BB,CC); }
+#define CSCENGDEBUG4(AA,BB,CC,DD) { RDebug::Print(_L(AA),BB,CC,DD); }
+
+#else   // CSCENG_DEBUG == 0 or invalid -> Disable loggings
+
+#define CSCENGDEBUG(AA)          
+#define CSCENGDEBUG2(AA,BB)     
+#define CSCENGDEBUG3(AA,BB,CC)    
+#define CSCENGDEBUG4(AA,BB,CC,DD) 
+
+#endif  // CSCENG_DEBUG
+
+#endif  // CSCENGLOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscengservicehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,313 @@
+/*
+* Copyright (c) 2007-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:  For CSC needed Service Provider Settings handling
+*
+*/
+
+
+
+#ifndef C_CSCENGSERVICEHANDLER_H
+#define C_CSCENGSERVICEHANDLER_H
+
+#include <mspnotifychangeobserver.h>
+
+class CSPEntry;
+class CSPProperty;
+class CSPSettings;
+class CSPNotifyChange;
+class CSPSettingsVoIPUtils;
+class MCSCEngServiceObserver;
+
+/**
+ * An instance of CCSCEngServiceHandler
+ * For CSC needed Service Provider Settings handling
+ *
+ * @lib cscengine.lib
+ * @since Series 60 3.2
+ */
+NONSHARABLE_CLASS ( CCSCEngServiceHandler ) : public CBase,
+                                              public MSPNotifyChangeObserver
+    {    
+    public:
+        
+        /**
+         * Two-phased constructor.
+         */ 
+        IMPORT_C static CCSCEngServiceHandler* NewL( 
+            MCSCEngServiceObserver* aObserver );
+
+
+        /**
+         * Destructor.
+         */
+        IMPORT_C virtual ~CCSCEngServiceHandler();
+
+
+        /**
+         * Get all service ids
+         *
+         * @since Series 60 3.2
+         * @param aServiceIds service id array
+         * @return error code
+         */
+        IMPORT_C void GetAllServiceIdsL( RArray<TUint>& aServiceIds );
+        
+        
+        /**
+         * Get stored service provider settings count. 
+         *
+         * @since Series 60 3.2
+         * @return count of stored service provider settings
+         */
+        IMPORT_C TInt ServiceIdCountL();
+        
+        
+        /**
+         * Delete service.
+         *
+         * @since Series 60 3.2
+         * @param aServiceId service id
+         */
+        IMPORT_C void DeleteServiceL( TUint aServiceId );
+        
+                
+        /**
+         * Get service name by service id
+         *
+         * @since Series 60 3.2
+         * @param aServiceId service id
+         * @return service name
+         */
+        IMPORT_C const TDesC16& ServiceNameL( TUint aServiceId );
+        
+        
+        /**
+         * Get brand identifier by service id
+         *
+         * @since Series 60 3.2
+         * @param aServiceId service id
+         * @param aBrandId brand id is stored to this
+         */
+        IMPORT_C void BrandIdL( TUint aServiceId, TDes16& aBrandId );
+        
+        
+        /**
+         * Get snap id by service id
+         *
+         * @since Series 60 3.2
+         * @param aServiceId service id
+         * @return snap id
+         */
+        IMPORT_C TInt SnapIdL( TUint aServiceId );
+        
+            
+        /**
+         * Get service setup plug-in id by service id
+         *
+         * @since Series 60 3.2
+         * @param aServiceId service id
+         * @return service setup plug-in id
+         */
+        IMPORT_C TInt32 ServiceSetupPluginIdL( TUint aServiceId );
+        
+        /**
+         * Get service phonebook tab view id by service id
+         *
+         * @since Series 60 3.2
+         * @param aServiceId service id
+         * @return service tab view id
+         */
+        IMPORT_C TInt ServiceTabViewIdL( TUint aServiceId );
+                
+        /**
+         * Get IM settings id.
+         *
+         * @since Series 60 5.0
+         * @param aServiceId service id
+         * @return service IM settings id
+         */
+        IMPORT_C TInt ImSettingsIdL( TUint aServiceId );
+        
+        /**
+         * Set IM settings id.
+         *
+         * @since Series 60 5.0
+         * @param aServiceId service id
+         * @param aSettingsId service IM settings id
+         */
+        IMPORT_C void SetImSettingsIdL(
+            TUint aServiceId, 
+            TInt aSettingsId );      
+        
+        /**
+         * Get service´s presence request preference setting
+         *
+         * @since Series 60 3.2
+         * @param aServiceId service id
+         * @return EOn when set
+         */
+        IMPORT_C TOnOff PresenceReqPrefL( TUint aServiceId );
+        
+        
+        /**
+         * Set service´s presence request preference setting
+         *
+         * @since Series 60 3.2
+         * @param aServiceId service id
+         * @param aOnOff EOn when set
+         */
+        IMPORT_C void SetPresenceReqPrefL( 
+                TUint aServiceId, TOnOff aOnOff );
+        
+        /**
+         * Get service´s handover notification tone preference setting
+         *
+         * @since Series 60 5.0
+         * @param aServiceId service id
+         * @return EOn when set
+         */
+        IMPORT_C TOnOff HandoverNotifTonePrefL( TUint aServiceId );
+        
+        /**
+         * Set service´s handover notification tone preference setting
+         *
+         * @since Series 60 5.0
+         * @param aServiceId service id
+         * @param aOnOff EOn when set
+         */
+        IMPORT_C void SetHandoverNotifTonePrefL( 
+                TUint aServiceId, TOnOff aOnOff );
+        
+        /**
+         * Find out if service supports VCC (Voice Call Continuity).
+         *
+         * @since Series 60 5.0
+         * @param aServiceId service id
+         * @return ETrue if service supports VCC
+         */
+        IMPORT_C TBool IsVccSupportedL( TUint aServiceId );
+        
+        /**
+         * Find out if service supports SIP/VoIP
+         *
+         * @since Series 60 3.2
+         * @param aServiceId service id
+         * @return ETrue if service supports SIP/VoIP
+         */
+        IMPORT_C TBool IsSipVoIPL( TUint aServiceId );
+        
+        /**
+         * Find out if service is the preferred service
+         *
+         * @since Series 60 3.2
+         * @param aServiceId service id
+         * @return ETrue if service is preferred
+         */
+        IMPORT_C TBool IsPreferredService( TUint aServiceId ) const;
+        
+        /**
+         * Find out if voip (PS) is the preferred telephony
+         *
+         * @since Series 60 3.2
+         * @return ETrue if voip is preferred
+         */
+        IMPORT_C TBool IsPreferredTelephonyVoip() const;
+       
+       	/**
+	     * Sets the preferred telephony value
+	     *
+	     * @since S60 v3.2
+	     * @param aValue, ETrue means that voip (PS) will be preferred.
+	     * @param aServiceId, Preferred service id.
+	     * @return KErrNone if succeed.
+	     */
+	    IMPORT_C TInt SetVoipAsPrefTelephony( 
+	            TBool aValue, TUint aServiceId ) const; 
+	    
+    private:
+
+        CCSCEngServiceHandler();
+
+        void ConstructL( MCSCEngServiceObserver* aObserver );
+	    
+	    /**
+	     * Sets the preferred telephony value
+	     * Leaves if value cannot be set.
+	     *
+	     * @since S60 v3.2
+	     * @param aValue, ETrue means that voip (PS) will be preferred.
+	     * @param aServiceId, Preferred service id.
+	     */
+	    void SetVoipAsPrefTelephonyL( 
+	            TBool aValue, TUint aServiceId ) const;       
+	    
+        
+        // from base class MSPNotifyChangeObserver
+      
+        /**
+         * From MSPNotifyChangeObserver
+         * Notifies change in service table
+         *
+         * @param aServiceId service id
+         * @since S60 v3.2
+         */
+        void HandleNotifyChange( TUint aServiceId );
+        
+        /**
+         * From MSPNotifyChangeObserver
+         * Notifies error
+         *
+         * @param aServiceId service id
+         * @since S60 v3.2
+         */
+        void HandleError( TInt /*aError*/ ){};
+        
+              
+    private:  // data
+        
+        /**
+         * Pointer to CSPSettings
+         * Own.
+         */
+        CSPSettings* iServiceSettings;
+        
+        /**
+         * Pointer to CSPNotifyChange
+         * Own.
+         */
+        CSPNotifyChange* iNotifier;
+
+        /**
+         * Pointer to CSPSettingsVoIPUtils
+         * Own.
+         */        
+        CSPSettingsVoIPUtils* iSettingsVoIPUtils;
+        
+        /**
+         * Service observer
+         */
+        MCSCEngServiceObserver* iObserver;
+        
+        /**
+         * Name of settings entry ( unique )
+         * Own.
+         */
+        RBuf iServiceName;
+        
+#ifdef _DEBUG
+    friend class UT_CSCEngServiceHandler;
+#endif  
+    };
+
+#endif // C_CSCENGSERVICEHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscengservicepluginhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,366 @@
+/*
+* 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:  For CSC needed AIW handling for service plug-ins
+*
+*/
+
+
+
+#ifndef C_CSCENGSERVICPLUGINHANDLER_H
+#define C_CSCENGSERVICPLUGINHANDLER_H
+
+#include <AiwCommon.h>
+#include "mcscengecomobserver.h"
+
+const TUint KMaxServiceProviderNameLength = 128;
+
+class CEikonEnv;
+class CAiwServiceHandler;
+class MAiwNotifyCallback;
+class CCSCEngEcomMonitor;
+class CAiwGenericParamList;
+class CCSCEngServiceHandler;
+class MCSCEngProvisioningObserver;
+
+/**
+ *  TServicePluginInfo class
+ *
+ *  For storing service plug-in information
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS ( TServicePluginInfo )
+    {
+    public:
+        
+        /**
+         * Constructor.
+         *
+         * @since S60 3.2
+         */
+        TServicePluginInfo()
+            : iProviderName( KNullDesC ),
+              iPluginsUid( KNullUid ),
+              iViewId( KNullUid ),
+              iModifiedUi( 1 ),
+              iRequiredIap( 0 ),
+              iProvisioned( EFalse ),
+              iOffered( EFalse )
+            {}
+
+    public: // data
+        
+        /*
+         * Service provider name
+         */
+        TBuf<KMaxServiceProviderNameLength> iProviderName;
+        
+        /*
+         * Service plug-in UID
+         */
+        TUid iPluginsUid;
+        
+        /*
+         * Service plug-in view id
+         */
+        TUid iViewId;
+        
+        /*
+         * 0 = plug-in has no UI
+         * 1 = plug-in has UI
+         * (only to provide backwards compatibility, 
+         *  all new plug-ins must provide UI )
+         */
+        TInt iModifiedUi;
+        
+        /*
+         * 0 = plug-in doesn´t required IAP
+         * 1 = plug-in requires IAP
+         * (only to provide backwards compatibility, 
+         *  all new plug-ins DO NOT require IAP )
+         */
+        TInt iRequiredIap;
+        
+        /*
+         * ETrue if plug-in is provisioned (configured)
+         */
+        TBool iProvisioned;
+        
+        /*
+         * ETrue if plug-in is offered for configuration
+         */
+        TBool iOffered;
+    };
+
+
+/**
+ *  CSCEngServicePluginHandler class
+ *  Handles Application Interworking (AIW) and service plug-in handling
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCEngServicePluginHandler ) : public CBase,
+                                                   public MAiwNotifyCallback,
+                                                   public MCSCEngEcomObserver
+    {
+    public: 
+
+        /** State of the plugin */
+        enum TPluginState
+            {
+            EPluginInitialize = 1,
+            EPluginProvisioning,
+            EPluginModifySettings,
+            EPluginRemovation
+            };
+        
+        /** Type of plugin count to be returned */
+        enum TPluginCount
+            {
+            EInitialized = 0,
+            EUnprovisioned
+            };
+        
+       // Provisioning plug-in callback service events.
+        enum TServicePluginResponse
+            {
+            EPluginInitialized = KAiwEventStarted,
+            EPluginProvisioned = KAiwEventCompleted,
+            EPluginModified = KAiwEventStopped,
+            EPluginRemoved = KAiwEventQueryExit,
+            EPluginError = KAiwEventError
+            };
+            
+        /**
+         * Two-phased constructor.
+         *
+         * @param aObserver reference to service plug-in provisioning observer
+         * @param aServiceHandler reference to service handler
+         */
+        IMPORT_C static CCSCEngServicePluginHandler* NewL(
+            CEikonEnv& aEikEnv, 
+            MCSCEngProvisioningObserver& aObserver,
+            CCSCEngServiceHandler& aServiceHandler );
+
+        
+        /**
+         * Two-phased constructor.
+         *
+         * @param aObserver reference to service plug-in provisioning observer
+         * @param aServiceHandler reference to service handler
+         */
+        IMPORT_C static CCSCEngServicePluginHandler* NewLC( 
+            CEikonEnv& aEikEnv,
+            MCSCEngProvisioningObserver& aObserver,
+            CCSCEngServiceHandler& aServiceHandler );
+
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCEngServicePluginHandler();
+ 
+ 
+        /**
+         * Initializes CSC supported plugins.
+         *
+         * @since S60 v3.2
+         */
+        IMPORT_C void InitializePluginsL();
+    
+    
+        /**
+         * Informs plugin of provisioning.
+         *
+         * @since S60 v3.2
+         * @param aPluginUid contains plugins Uid
+         * @param aViewUid contains view Uid to be returned
+         */
+        IMPORT_C void DoProvisioningL( const TUid& aPluginUid,
+                                       const TUid& aViewUid );
+    
+    
+        /**
+         * Launches plugin provided setting view.
+         *
+         * @since S60 v3.2
+         * @param aPluginUid contains plugins Uid
+         * @param aViewUid contains view Uid to be returned
+         */
+        IMPORT_C void LaunchPluginViewL( const TUid& aPluginUid, 
+                                         const TUid& aViewUid );
+    
+        
+        /**
+         * Informs plugin from removation.
+         *
+         * @since S60 v3.2
+         * @param aPluginUid contains plugins Uid
+         * @param aRemoveSisPckg for invoking application installer
+         */
+        IMPORT_C void DoRemovationL( const TUid& aPluginUid,
+                                     TBool aRemoveSisPckg );
+    
+                
+        /**
+         * Returns count of CSC supported plugins in array.
+         * 
+         * @since S60 v3.2
+         * @param aType for items to be returned
+         * @return count of profiles 
+         */
+        IMPORT_C TInt PluginCount( const TPluginCount aType ) const;
+        
+                
+        /**
+         * Returns item from service plug-in array
+         * 
+         * @param aIndex index
+         * @since S60 v3.2
+         */
+        IMPORT_C TServicePluginInfo ItemFromPluginInfoArray( TInt aIndex );
+        
+        
+         // from base class MAiwNotifyCallBack
+  
+        /**
+         * From MAiwNotifyCallBack.
+         * Handles received callbacks from AIW plugin.
+         *
+         * @since S60 v3.0
+         * @param aCmdId for cmd id
+         * @param aEventId for event id
+         * @param aEventParamList for event param list
+         * @param aInParamList for in param list
+         */
+        TInt HandleNotifyL( TInt aCmdId,
+                            TInt aEventId,
+                            CAiwGenericParamList& aEventParamList,
+                            const CAiwGenericParamList& aInParamList );
+
+
+        // from base class MCSCEngEcomObserver
+    
+        /**
+         * Observer interface for notifying ecom events.
+         *
+         * @since S60 v3.2
+         */
+        void NotifyEcomEvent();
+    
+    private:
+
+
+        CCSCEngServicePluginHandler( 
+            CEikonEnv& aEikEnv,
+            MCSCEngProvisioningObserver& aObserver,
+            CCSCEngServiceHandler& aServiceHandler );
+
+   
+        void ConstructL();
+        
+        
+        /**
+         * Gets plug-in index in plug-in info array and plug-ins uid
+         *
+         * @since S60 v3.2
+         * @param aInParamList for params received from plugin
+         * @param aIndex for plug-in info array index
+         * @param aPluginUid for plug-in uid
+         */ 
+        void GetPluginIndexAndUid( 
+            const CAiwGenericParamList& aInParamList, 
+            TInt& aIndex, 
+            TUid& aPluginUid );
+        
+        
+         /**
+         * Gets and sets plug-in view id
+         *
+         * @since S60 v3.2
+         * @param aInParamList for params received from plugin
+         */ 
+        void GetPluginViewId( 
+            const CAiwGenericParamList& aInParamList );
+        
+        /**
+         * Set information of plug-ins to plug-in info array
+         *
+         * @since S60 v3.2
+         * @param aInParamList for params received from plugin
+         */        
+        void SetPluginInitInfoL( const CAiwGenericParamList& aInParamList );
+        
+        
+        /**
+         * Invokes application installer to remove .sis package from device.
+         *
+         * @since S60 v3.2
+         * @param aPluginUid contains plugin uid
+         */        
+        void RemovePluginSisL( const TUid& aPluginUid ) const;
+        
+        
+    private: // data
+        
+        /**
+         * Reference to Eikon environment.
+         */
+        CEikonEnv& iEikEnv;
+        
+        /**
+         * Observer for AIW commands
+         */  
+        MCSCEngProvisioningObserver& iObserver;
+        
+        /*
+         * Reference to CCSCEngServiceHandler
+         */
+        CCSCEngServiceHandler& iServiceHandler;
+                        
+        /**
+         * For AIW Plugin services
+         * Own.
+         */
+        CAiwServiceHandler* iAiwServiceHandler;
+        
+        /**
+         * For monitoring Ecom changes.
+         * Own.
+         */
+        CCSCEngEcomMonitor* iEcomMonitor;
+                      
+        /**
+         * Array for storing information of service plug-ins
+         */
+        RArray<TServicePluginInfo> iServicePluginInfoArray;
+        
+        /**
+         * Resource file offset.
+         */
+        TInt iResourceOffset;
+        
+        /**
+         * Flag indicating that should application installer to be run.
+         */
+        TBool iRunSwinst;
+            
+#ifdef _DEBUG
+    friend class UT_CSCEngServicePluginHandler;
+#endif
+    };
+
+#endif // C_CSCSERVICPLUGINHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscengsettingscleanupplugininterface.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* 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 CCSCEngSettingsCleanupPluginInterface class.
+*
+*/
+
+#ifndef CSCSETTINGSCLEANUPPLUGININTERFACE_H
+#define CSCSETTINGSCLEANUPPLUGININTERFACE_H
+
+#include <e32base.h>
+#include <ecom/ecom.h>
+
+// Constant for plugin interface:
+const TUid KCSCSettingsCleanupPluginInterfaceUid = { 0x2000B009 };
+
+
+class CCSCEngSettingsCleanupPluginInterface : public CBase
+    {
+    public:
+    
+        enum TCSCPluginType
+            {
+            ESipVoIPCleanupPlugin = 0
+            };
+            
+
+        /**
+        * Creates new CSC settings cleanup plugin having the given UID.
+        * Uses Leave code KErrNotFound if implementation is not found.
+        *
+        * @param aImplementationUid Implementation UID of the plugin to be
+        *        created.
+        */
+        static CCSCEngSettingsCleanupPluginInterface* NewL(
+            const TUid aImplementationUid );
+
+
+        virtual ~CCSCEngSettingsCleanupPluginInterface();
+
+
+        // New methods
+
+        virtual TCSCPluginType PluginType() const;
+
+   
+        virtual void RemoveSettingsL( TUint32 aServiceId ) = 0;
+
+    
+    public: // Data
+
+    /// Unique key for implementations of this interface.
+    TUid iInstanceKey;    
+    };
+
+#include <cscengsettingscleanupplugininterface.inl>
+
+#endif // CSCSETTINGSCLEANUPPLUGININTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscengsettingscleanupplugininterface.inl	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* 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:  CSCEngSettingsCleanupPluginInterface implementation.
+*
+*/
+
+
+
+inline CCSCEngSettingsCleanupPluginInterface::~CCSCEngSettingsCleanupPluginInterface()
+    {
+    REComSession::DestroyedImplementation( iInstanceKey );
+    }
+
+
+inline CCSCEngSettingsCleanupPluginInterface*
+    CCSCEngSettingsCleanupPluginInterface::NewL( TUid aImplementationUid )
+    {
+    return reinterpret_cast< CCSCEngSettingsCleanupPluginInterface* >( 
+        REComSession::CreateImplementationL( 
+            aImplementationUid, 
+            _FOFF( CCSCEngSettingsCleanupPluginInterface, iInstanceKey ) ) );
+    }
+
+
+inline CCSCEngSettingsCleanupPluginInterface::TCSCPluginType 
+    CCSCEngSettingsCleanupPluginInterface::PluginType() const
+    {
+    return ESipVoIPCleanupPlugin;
+    }
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscengstartuphandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,231 @@
+/*
+* 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:  For CSC application startup parameter handling
+*
+*/
+
+
+#ifndef C_CSCENGSTARTUPHANDLER_H
+#define C_CSCENGSTARTUPHANDLER_H
+
+
+/**
+ *  An instance of CSCEngStartupHandler
+ *  For CSC application startup parameter handling
+ *
+ *  @lib CSCEngine.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS ( CCSCEngStartupHandler ) : public CBase
+    {
+    public:
+
+        /**  Enumeration for different startup actions */
+        enum TAction
+            {
+            EDefaultAction = 0,
+            EAddSetupPluginService, // for service setup plugins
+            ERemoveSetupPluginService,  
+            EOpenUiExtension, // for ui extensions plugins
+            EOpenSettingsUi
+            };
+        
+        
+        /**  Enumeration for different uid types */
+        enum TUidType
+            {
+            EPluginUid = 0,
+            EAppUid    
+            };
+
+
+        /**
+         * Two-phased constructor.
+         */
+        IMPORT_C static CCSCEngStartupHandler* NewL();
+
+ 
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCEngStartupHandler();
+        
+                
+        /**
+         * Sets CSC startup parameters.
+         *
+         * @since S60 v3.2
+         * @param aParameters string containing startup parameters
+         * @return KErrNone if successful
+         */
+        IMPORT_C TInt SetStartupParametersL( const TDesC& aParameters );
+        
+        
+        /**
+         * Gets startup parameter Action
+         *
+         * @since S60 v3.2
+         * @return action enum
+         */
+        IMPORT_C TAction GetParamAction() const;
+        
+        /**
+         * Gets startup parameter service id
+         *
+         * @since S60 v3.2
+         * @return service id
+         */
+        IMPORT_C TUint GetParamServiceId() const;
+        
+        
+        /**
+         * Gets startup parameter UI Extension Plug-in UID
+         *
+         * @since S60 v3.2
+         * @return plugin uid
+         */
+        IMPORT_C const TUid GetParamPluginUid() const;
+        
+        
+        /**
+         * Gets startup parameter application UID
+         *
+         * @since S60 v3.2
+         * @return application uid
+         */
+        IMPORT_C const TUid GetParamAppUid() const;
+        
+        
+        /**
+         * Gets startup parameter URL. 
+         *
+         * @since S60 v3.2
+         * @param aUrl url is stored here
+         * @return error code
+         */
+        IMPORT_C TInt GetParamUrl( TDes& aUrl ) const;
+        
+        
+        /**
+         * Resets uid value by uid type
+         *
+         * @since S60 v3.2
+         * @param aType plugin type
+         */
+        IMPORT_C void ResetUid( TUidType aType );
+        
+        
+        /**
+         * Resets service id
+         *
+         * @since S60 v3.2
+         */
+        IMPORT_C void ResetServiceId();
+        
+        /**
+         * For settings flag if csc was started from homescreen.
+         *
+         * @since S60 v5.0
+         */
+        IMPORT_C void SetStartedFromHomescreen( TBool aStartedFromHomescreen );
+                
+        /**
+         * For getting flag if csc was started from homescreen.
+         *
+         * @since S60 v5.0
+         */
+        IMPORT_C TBool StartedFromHomescreen() const;
+        
+                        
+    private:
+
+        CCSCEngStartupHandler();
+
+
+        void ConstructL();
+        
+        
+        /**
+         * Parses and sets startup parameter action
+         *
+         * @since S60 v3.2
+         * @param aParameters string containing startup parameters
+         */
+        void SetAction( const TDesC& aParameters );
+        
+        
+        /**
+         * Parses and sets startup parameter service id
+         *
+         * @since S60 v3.2
+         * @param aParameters string containing startup parameters
+         */
+        void SetServiceId( const TDesC& aParameters );
+        
+        
+        /**
+         * Parses and sets startup parameter plugin uid
+         *
+         * @since S60 v3.2
+         * @param aParameters string containing startup parameters
+         * @param aUidType uid type
+         */
+        void SetUid( const TDesC& aParameters, TUidType aUidType );
+        
+                
+        /**
+         * Parses and sets startup parameter URL
+         *
+         * @since S60 v3.2
+         * @param aParameters string containing startup parameters
+         */
+        void SetUrlL( const TDesC& aParameters );
+        
+        
+    private: // data
+    
+        /**
+         * Action type parameter
+         */
+        TAction iAction;
+        
+        /**
+         * Service id parameter
+         */
+   		TUint iServiceId;
+    
+        /**
+         * Plugin uid parameter
+         */
+   		TUid iPluginUid;
+   		
+   		/**
+         * Application uid parameter
+         */
+   		TUid iAppUid;
+   		
+   		/**
+         * URL parameter
+         * Own.
+         */
+   		HBufC* iURL;       
+   		
+        /**
+         * To deternmine if csc was started from homescreen.
+         * Own.
+         */
+        TBool iStartedFromHomescreen;
+    };
+
+#endif  // C_CSCENGSTARTUPHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscengtimer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 timer handling.
+*
+*/
+
+
+
+#ifndef C_CSCENGTIMER_H
+#define C_CSCENGTIMER_H
+
+#include <e32base.h> 
+
+class MCSCEngTimerObserver;
+
+/**
+ * An instance of CCSCEngTimer
+ * For timer handling.
+ *
+ * @lib cscengine.lib
+ * @since Series 60 3.2
+ */
+NONSHARABLE_CLASS( CCSCEngTimer ) : public CTimer
+    {    
+    public:
+
+        /**
+         * Enumeration which indicates timer type
+         */
+        enum TTimerType
+            {
+            EConnectionMonitoringTimer = 0,
+            ENoteDelayTimer
+            };
+    
+        /**
+         * Two-phased constructor.
+         */ 
+        IMPORT_C static CCSCEngTimer* NewL( 
+            MCSCEngTimerObserver& aObserver );
+
+
+        /**
+         * Destructor.
+         */
+        IMPORT_C virtual ~CCSCEngTimer();
+
+        
+        /**
+         * Start timer.
+         *
+         * @since S60 v3.2
+         * @return KErrNone when timer started successfully
+         */
+        IMPORT_C TInt StartTimer( TTimerType aType );
+        
+        
+        /**
+         * Stop timer.
+         *
+         * @since S60 v3.2
+         */
+        IMPORT_C void StopTimer();
+        
+
+    protected: 
+    
+        // from base class CTimer
+        
+        /**
+         * From CTimer. Called when timer expires.
+         */
+        void RunL();
+        
+               
+    private:
+
+        CCSCEngTimer( MCSCEngTimerObserver& aObserver );
+
+        void ConstructL();
+        
+        
+    private:  // data
+        
+        /**
+         * Reference for observer.
+         */
+        MCSCEngTimerObserver& iObserver;
+        
+#ifdef _DEBUG
+    friend class UT_CSCEngTimer;
+#endif 
+    };
+
+#endif // C_CSCENGTIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/cscenguiextensionpluginhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,258 @@
+/*
+* 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:  For CSC needed AIW handling for ui extension plug-ins
+*
+*/
+
+
+
+#ifndef C_CSCENGUIEXTENSIONPLUGINHANDLER_H
+#define C_CSCENGUIEXTENSIONPLUGINHANDLER_H
+
+#include <AiwCommon.h>
+
+const TUint KMaxUiExtensionNameLength = 128;
+
+class CEikonEnv;
+class MAiwNotifyCallback;
+class CAiwServiceHandler;
+class CAiwGenericParamList;
+class CCSCEngStartupHandler;
+class MCSCEngUiExtensionObserver;
+
+
+/**
+*   iUiExtensionName  = UI Extension name
+*   iPluginsUid       = Service plug-in UID
+*   iPlace            = Place parameter
+*/
+NONSHARABLE_CLASS( TUiExtensionPluginInfo )
+    {
+    public:
+    
+        TUiExtensionPluginInfo()
+            : iUiExtensionName( KNullDesC ),
+              iPluginsUid( KNullUid ),
+              iPlace( 0 )
+            {}
+
+    public:
+        
+        /*
+        * UI Extension name
+        */       
+        TBuf<KMaxUiExtensionNameLength> iUiExtensionName;
+        
+        /*
+        * UI Extension plug-in UID
+        */
+        TUid iPluginsUid;
+        
+        /*
+        * UI Extension placing information
+        * 0 = listbox
+        * 1 = options menu
+        */
+        TInt iPlace;
+    };
+
+
+
+/**
+ *  An instance of CSCUiExtensionPluginHandler
+ *  Handles Application Interworking (AIW).
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCEngUiExtensionPluginHandler ) : public CBase,
+                                                       public MAiwNotifyCallback
+    {
+    public: 
+
+        /**
+         * State of the plugin.
+         */
+        enum TPluginState
+            {
+            EPluginInitialize = 1,
+            EPluginOpenExtensionView,
+            EPluginOpenExtensionViewFromAI
+            };
+        
+        
+        // UI extension plug-in callback events.
+        enum TUiExtensionPluginResponse
+            {
+            EPluginInitialized = KAiwEventStarted,
+            EPluginExited = KAiwEventStopped,
+            EPluginError = KAiwEventError
+            };
+        
+        /**
+         * Two-phased constructor.
+         */
+        IMPORT_C static CCSCEngUiExtensionPluginHandler* NewL( 
+            CEikonEnv& aEikEnv, 
+            MCSCEngUiExtensionObserver& aObserver,
+            CCSCEngStartupHandler& aStartupHandler );
+
+
+        /**
+         * Two-phased constructor.
+         */
+        IMPORT_C static CCSCEngUiExtensionPluginHandler* NewLC(
+            CEikonEnv& aEikEnv, 
+            MCSCEngUiExtensionObserver& aObserver,
+            CCSCEngStartupHandler& aStartupHandler );
+
+
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCEngUiExtensionPluginHandler();
+ 
+        
+        /**
+         * Initializes CSC supported UI Extension plugins.
+         *
+         * @since S60 v3.2
+         */
+        IMPORT_C void InitializePluginsL();
+    
+        
+        /**
+         * Launches UI Extension plugin view
+         *
+         * @since S60 v3.2
+         * @param aPluginUid contains plugins Uid
+         * @param aViewUid contains view Uid to be returned
+         * @param aLaunchedFromAI ETrue if launched from active idle
+         */
+        IMPORT_C void LaunchUiExtensionL( 
+            const TUid& aPluginUid, const TUid& aViewUid,
+            TBool aLaunchedFromAI = EFalse );
+        
+        
+        /**
+         * Returns item from UI Extension plug-in array
+         *
+         * @since S60 v3.2
+         * @param aIndex array index
+         */
+        IMPORT_C TUiExtensionPluginInfo ItemFromPluginInfoArray( TInt aIndex );
+        
+        
+        /**
+         * Returns count of CSC supported ui extension plugins in array.
+         * 
+         * @since S60 v3.2
+         * @param aType for items to be returned
+         * @return count of profiles 
+         */
+        IMPORT_C TInt PluginCount() const;
+   
+   
+        // from base class MAiwNotifyCallBack
+ 
+        /**
+         * From MAiwNotifyCallBack.
+         * Handles received callbacks from AIW plugin.
+         *
+         * @since S60 v3.0
+         * @param aCmdId for cmd id
+         * @param aEventId for event id
+         * @param aEventParamList for event param list
+         * @param aInParamList for in param list
+         */
+        TInt HandleNotifyL( TInt aCmdId,
+                            TInt aEventId,
+                            CAiwGenericParamList& aEventParamList,
+                            const CAiwGenericParamList& aInParamList );
+     
+            
+    private:
+
+
+        CCSCEngUiExtensionPluginHandler( 
+            CEikonEnv& aEikEnv,
+            MCSCEngUiExtensionObserver& aObserver, 
+            CCSCEngStartupHandler& aStartupHandler );
+
+   
+        void ConstructL();
+        
+        
+        /**
+         * Gets plug-in index in plug-in info array and plug-ins uid
+         *
+         * @since S60 v3.2
+         * @param aInParamList for params received from plugin
+         * @param aIndex for plug-in info array index
+         * @param aPluginUid for plug-in uid
+         */ 
+        void GetPluginIndexAndUid( 
+            const CAiwGenericParamList& aInParamList,
+            TInt aIndex, 
+            TUid aPluginUid );
+        
+        /**
+         * Set information of plug-ins to plug-in info array
+         *
+         * @since S60 v3.2
+         * @param aInParamList for params received from plugin
+         */        
+        void SetPluginInitInfo( 
+            const CAiwGenericParamList& aInParamList );
+        
+        
+    private: // data
+        
+        /**
+         * Reference to Eikon environment.
+         */
+        CEikonEnv& iEikEnv;
+        
+        /**
+         * Observer for AIW commands
+         */  
+        MCSCEngUiExtensionObserver& iObserver;
+        
+        /**
+         *  Reference to CCSCEngStartupHandler
+         */         
+        CCSCEngStartupHandler& iStartupHandler;
+                 
+        /**
+         * For AIW Plugin services
+         * Own.
+         */
+        CAiwServiceHandler* iServiceHandler;
+        
+        /**
+         * CSC supported UI Extension plug-in information array
+         */ 
+        RArray<TUiExtensionPluginInfo> iUiExtensionPluginInfoArray;
+        
+        /**
+         * Resource file offset.
+         */
+        TInt iResourceOffset;  
+        
+#ifdef _DEBUG
+    friend class UT_CSCEngUiExtensionPluginHandler;
+#endif    
+    };
+
+#endif // C_CSCENGUIEXTENSIONPLUGINHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/mcscengcchobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* 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:  Observer interface for notifying service status changes.
+*
+*/
+
+
+#ifndef M_CSCENGCCHOBSERVER_H
+#define M_CSCENGCCHOBSERVER_H
+
+#include <cch.h>
+
+#include "cscengcchhandler.h"
+
+/**
+ *  MCSCEngCCHObserver class
+ *
+ *  Observer interface for notifying service status changes.
+ *
+ *  @lib cscengine.lib
+ *  @since S60 v5.0
+ */
+class MCSCEngCCHObserver
+    {
+    public:
+    
+        /**
+         * Should be called when service status changes.
+         *
+         * @since S60 v5.0
+         * @param aServiceId Id of the service
+         * @param aType Service type
+         * @param aServiceStatus Service status
+         */
+        virtual void ServiceStatusChanged(
+                TUint aServiceId, 
+                TCCHSubserviceType aType, 
+                const TCchServiceStatus& aServiceStatus ) = 0;            
+    };
+    
+#endif // M_CSCENGCCHOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/mcscengconnectionobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* 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:  Observer interface for notifying connection events.
+*
+*/
+
+
+#ifndef M_CSCENGCONNECTIONOBSERVER_H
+#define M_CSCENGCONNECTIONOBSERVER_H
+
+#include "cscengconnectionhandler.h"
+
+/**
+ *  MCSCEngConnectionObserver class
+ *
+ *  Observer interface for notifying connection events
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+class MCSCEngConnectionObserver
+    {
+    public:
+    
+        /**
+         * Should be called when connection is closed
+         *
+         * @since S60 v3.2
+         * @param aConnectionEvent connection event
+         */
+        virtual void NotifyConnectionEvent( 
+            CCSCEngConnectionHandler::TConnectionEvent aConnectionEvent ) = 0;
+        
+    };
+    
+#endif // M_CSCENGCONNECTIONOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/mcscengecomobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* 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:  Observer interface for notifying ecom events.
+*
+*/
+
+
+#ifndef M_CSCENGECOMOBSERVER_H
+#define M_CSCENGECOMOBSERVER_H
+
+/**
+ *  MCSCEngEcomObserver class
+ *
+ *  Observer interface for notifying ecom events.
+ *
+ *  @lib cscengine.lib
+ *  @since S60 v3.2
+ */
+class MCSCEngEcomObserver
+    {
+    public:
+    
+        /**
+         * Observer interface for notifying ecom events.
+         *
+         * @since S60 v3.2
+         */
+        virtual void NotifyEcomEvent() = 0;
+            
+    };
+    
+#endif // M_CSCENGECOMOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/mcscengprovisioningobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* 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:  Observer interface for notifying when service plugin 
+*              : is configured
+*
+*/
+
+
+
+#ifndef M_CSCENGPROVISIONINGOBSERVER_H
+#define M_CSCENGPROVISIONINGOBSERVER_H
+
+
+#include "cscengservicepluginhandler.h"
+
+/**
+ *  MCSCEngProvisioningObserver class
+ *
+ *  Observer interface for notifying when service plug-in is configured
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+class MCSCEngProvisioningObserver
+    {
+    public:
+    
+        /**
+         * Should be called when provisioning of the plugin is completed.
+         *
+         * @since S60 v3.2
+         * @param aResponse plug-in response type
+         * @param aIndex index
+         * @param aPluginUid plug-in uid
+         */
+        virtual void NotifyServicePluginResponse( 
+            const CCSCEngServicePluginHandler::TServicePluginResponse& aResponse, 
+            const TInt aIndex, 
+            const TUid& aPluginUid ) = 0;         
+    };
+    
+#endif // M_CSCENGPROVISIONINGOBSERVER_H    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/mcscengserviceobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* 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:  Observer interface for notifying service changes
+*
+*/
+
+
+
+#ifndef M_CSCENGSERVICEOBSERVER_H
+#define M_CSCENGSERVICEOBSERVER_H
+
+
+/**
+ *  MCSCEngServiceObserver class
+ *
+ *  Observer interface for notifying service changes
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+class MCSCEngServiceObserver
+    {
+    public:
+    
+        /**
+         * Should be called when change in service(s) occur
+         *
+         * @since S60 v3.2
+         */
+        virtual void NotifyServiceChange() = 0;
+        
+    };
+    
+#endif // M_CSCENGSERVICEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/mcscengtimerobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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:  Observer interface for notifying timer expiration
+*
+*/
+
+
+#ifndef M_CSCENGTIMEROBSERVER_H
+#define M_CSCENGTIMEROBSERVER_H
+
+#include "cscengtimer.h"
+
+/**
+ *  MCSCEngTimerObserver class
+ *
+ *  Observer interface for notifying timer expiration.
+ *
+ *  @lib cscengine.lib
+ *  @since S60 v3.2
+ */
+class MCSCEngTimerObserver
+    {
+    public:
+    
+        /**
+         * Should be called when the timer expires
+         *
+         * @since S60 v3.2
+         */
+        virtual void TimerExpired() = 0;            
+    };
+    
+#endif // M_CSCENGTIMEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/inc/mcscenguiextensionobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* 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:  bserver interface for notifying ui extension plug-in events
+*
+*/
+
+
+
+#ifndef M_CSCENGUIEXTENSIONOBSERVER_H
+#define M_CSCENGUIEXTENSIONOBSERVER_H
+
+#include "cscenguiextensionpluginhandler.h"
+
+/**
+ *  MCSCEngUiExtensionObserver class
+ *
+ *  Observer interface for notifying ui extension plug-in events
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+class MCSCEngUiExtensionObserver
+    {
+    public:
+    
+        /**
+         * Should be called when exited from ui extension
+         *
+         * @since S60 v3.2
+         */
+        virtual void NotifyUiExtensionPluginResponse( 
+            const CCSCEngUiExtensionPluginHandler::TUiExtensionPluginResponse& aResponse,
+            const TInt aIndex, 
+            const TUid& aPluginUid ) = 0;  
+    };
+            
+#endif // M_CSCENGUIEXTENSIONOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/src/cscengbrandinghandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,194 @@
+/*
+* 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:  For CSC needed branding server handling
+*
+*/
+
+
+#include <coemain.h>
+#include <AknsUtils.h>
+#include <cbsbitmap.h>
+#include <mbsaccess.h>
+#include <mbsupdater.h>
+#include <mbselement.h>
+#include <cbsfactory.h>
+#include <bselementfactory.h>
+#include <AknsSkinInstance.h> 
+
+#include "cscenglogger.h"
+#include "cscengbrandinghandler.h"
+
+
+_LIT8( KDefaultAppId, "xsp" );
+_LIT8( KBrandedBitmapItemId, "default_brand_image" );
+
+const TUint KVersion( 1 );
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngBrandingHandler::CCSCEngBrandingHandler()
+    {    
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCEngBrandingHandler::ConstructL()
+    {
+    CSCENGDEBUG( "CCSCEngBrandingHandler::ConstructL - begin" ); 
+    
+    iFactory = CBSFactory::NewL( KNullDesC8, KDefaultAppId );
+        
+    CSCENGDEBUG( "CCSCEngBrandingHandler::ConstructL - end" );
+    }   
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngBrandingHandler* CCSCEngBrandingHandler::NewL()
+    {
+    CCSCEngBrandingHandler* self = new (ELeave) CCSCEngBrandingHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngBrandingHandler::~CCSCEngBrandingHandler()
+    {
+    CSCENGDEBUG( 
+        "CCSCEngBrandingHandler::~CCSCEngBrandingHandler - begin" ); 
+
+    delete iFactory;
+    
+    CSCENGDEBUG( 
+        "CCSCEngBrandingHandler::~CCSCEngBrandingHandler - end" ); 
+    }
+    
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// 
+EXPORT_C void CCSCEngBrandingHandler::GetServiceBrandIconL( 
+    const TDesC8& aBrandId, CFbsBitmap*& aBitmap, CFbsBitmap*& aMask,
+    TInt aIconSize )
+    {
+    CSCENGDEBUG( 
+        "CCSCEngBrandingHandler::GetServiceBrandIconL - begin" ); 
+        
+    // Create access to Branding server
+    MBSAccess* access = iFactory->CreateAccessL( 
+        aBrandId, ELangInternationalEnglish, KVersion );
+    CleanupClosePushL( *access );
+            
+    // start fetching of branding image     
+	// get structure containing the info needed to load brand image
+	MBSElement* bitmapItem = NULL;
+	bitmapItem = access->GetStructureL( KBrandedBitmapItemId );
+	CleanupClosePushL( *bitmapItem );
+
+	// get info from the bitmap element
+	const CBSBitmap& bsBitmap = bitmapItem->BitmapDataL();
+	
+	RFile bitmapFile;
+	CleanupClosePushL( bitmapFile ); 
+	
+	// get the bitmap file from where we can load the bitmap
+	access->GetFileL( bsBitmap.BitmapFileId(), bitmapFile );	
+	
+	TInt err = KErrNotFound;
+	CFbsBitmap* skinBitmap = NULL;
+	
+	// Try getting skinned images first
+	
+	if( CCoeEnv::Static() )
+		{
+		MAknsSkinInstance* skin = AknsUtils::SkinInstance();	
+
+		TAknsItemID itemId;
+		itemId.Set( bsBitmap.SkinIdMajor(), bsBitmap.SkinIdMinor() );
+		
+		CleanupStack::PushL( skinBitmap );
+		
+	    TRAP( err, skinBitmap = AknsUtils::CreateBitmapL( skin, itemId ) );
+		
+		CleanupStack::Pop( skinBitmap );
+		}
+    
+    if( err == KErrNotFound ) 	// no skin bitmap found
+    	{
+    	iFile = bitmapFile;    	    
+	    AknIconUtils::CreateIconLC( aBitmap, 
+	                                aMask,
+                					*this,
+                					bsBitmap.BitmapId(), 
+                					bsBitmap.BitmapMaskId() );
+
+        CleanupStack::Pop( aMask );
+        CleanupStack::Pop( aBitmap );
+    	}
+    else if( err )
+    	{
+    	User::Leave( err );
+    	}
+	else
+		{
+		aBitmap = skinBitmap;
+		aMask = NULL;
+		}
+    
+    TSize size( aIconSize, aIconSize );
+    if ( aBitmap )
+        {
+        AknIconUtils::SetSize( aBitmap, size );
+        }
+	
+	if ( aMask )
+        {
+        AknIconUtils::SetSize( aMask, size );
+        }
+		
+	CleanupStack::PopAndDestroy( &bitmapFile );
+	CleanupStack::PopAndDestroy( bitmapItem );
+    CleanupStack::PopAndDestroy( access );
+    
+    CSCENGDEBUG( 
+        "CCSCEngBrandingHandler::GetServiceBrandIconL - end" ); 
+    } 
+
+
+// ---------------------------------------------------------------------------
+// From class MAknIconFileProvider
+// For getting an open file handle to the icon file.
+// ---------------------------------------------------------------------------
+//
+void CCSCEngBrandingHandler::RetrieveIconFileHandleL(
+            RFile& aFile, const TIconFileType /*aType*/ )
+    {
+    aFile.Duplicate( iFile );
+    }
+
+
+    
+
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/src/cscengcchhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,323 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  For handling interactions betweed UI and CCH.
+*
+*/
+
+
+#include <cch.h>
+
+#include "cscenglogger.h"
+#include "cscengcchhandler.h"
+#include "mcscengcchobserver.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngCCHHandler::CCSCEngCCHHandler( MCSCEngCCHObserver& aObserver ) :
+    iObserver( aObserver )
+    {    
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCEngCCHHandler::ConstructL()
+    {
+    CSCENGDEBUG( "CCSCEngCCHHandler::ConstructL - begin" ); 
+    
+    iCchClientApi = CCch::NewL();
+    
+    CSCENGDEBUG( "CCSCEngCCHHandler::ConstructL - end" ); 
+    }   
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngCCHHandler* CCSCEngCCHHandler::NewL( 
+    MCSCEngCCHObserver& aObserver )
+    {    
+    CCSCEngCCHHandler* self = new ( ELeave ) CCSCEngCCHHandler( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngCCHHandler::~CCSCEngCCHHandler()
+    {
+    CSCENGDEBUG( "CCSCEngCCHHandler::~CCSCEngCCHHandler - begin" ); 
+    
+    delete iCchClientApi;    
+    
+    CSCENGDEBUG( "CCSCEngCCHHandler::~CCSCEngCCHHandler - end" ); 
+    }
+
+
+// ---------------------------------------------------------------------------
+// Disable service.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngCCHHandler::DisableService( TInt aServiceId )
+    {    
+    CCchService* service = iCchClientApi->GetService( aServiceId );
+    
+    TInt err( KErrNone );
+    if ( service )
+        {
+        service->SetObserver( *this );
+        err = service->Disable( ECCHUnknown );
+        }
+    else
+        {
+        err = KErrArgument;
+        }
+    
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Check is service disabled
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCSCEngCCHHandler::IsServiceDisabled( TInt aServiceId )
+    {    
+    TBool disabled( ETrue );
+
+    if ( !IsDisabled( aServiceId, ECCHVoIPSub ) ) return EFalse;
+    if ( !IsDisabled( aServiceId, ECCHPresenceSub ) ) return EFalse;
+    if ( !IsDisabled( aServiceId, ECCHIMSub ) ) return EFalse;      
+    if ( !IsDisabled( aServiceId, ECCHVMBxSub ) ) return EFalse;
+        
+    return disabled;
+    }
+
+// ---------------------------------------------------------------------------
+// Check is service is valid
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCSCEngCCHHandler::IsServiceValidL( TInt aServiceId )
+    {    
+    TBool validService( EFalse );
+    
+    TSupportedSubServices supportedSubServices;
+    SupportedSubServicesL( aServiceId, supportedSubServices );
+
+    // Service is valid if some subservice is supported
+    if ( supportedSubServices.iVoIP || supportedSubServices.iIm ||
+        supportedSubServices.iPresence || supportedSubServices.iVmbx )
+        {
+        validService = ETrue;
+        }
+    
+    return validService;
+    }
+
+// ---------------------------------------------------------------------------
+// Get supported subservices.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngCCHHandler::SupportedSubServicesL( 
+    TInt aServiceId, TSupportedSubServices& aSupSubServices )
+    {
+    // Create new cch client for access the latest service info data.
+    CCchService* service = 
+        CCch::NewLC()->GetService( aServiceId );
+
+    TBool supported( EFalse );
+    
+    if ( service )
+        {
+        service->IsSupported( ECCHVoIPSub, supported );
+        aSupSubServices.iVoIP = supported;
+        
+        service->IsSupported( ECCHPresenceSub, supported );
+        aSupSubServices.iPresence = supported;
+        
+        service->IsSupported( ECCHIMSub, supported );
+        aSupSubServices.iIm = supported;
+        
+        service->IsSupported( ECCHVMBxSub, supported );
+        aSupSubServices.iVmbx = supported;
+        }
+    
+    CleanupStack::PopAndDestroy(); // cch
+    
+    CSCENGDEBUG2( 
+            "CCSCEngCCHHandler::SupportedSubServicesL VoIP=%d", 
+                aSupSubServices.iVoIP );
+    CSCENGDEBUG2( 
+            "CCSCEngCCHHandler::SupportedSubServicesL Presence=%d", 
+                aSupSubServices.iPresence );
+    CSCENGDEBUG2( 
+            "CCSCEngCCHHandler::SupportedSubServicesL IM=%d", 
+                aSupSubServices.iIm );
+    CSCENGDEBUG2( 
+            "CCSCEngCCHHandler::SupportedSubServicesL VMBX=%d", 
+                aSupSubServices.iVmbx );
+    }
+
+// ---------------------------------------------------------------------------
+// Get cch connection parameter (RBuf).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngCCHHandler::GetConnectionParameter( 
+    TInt aServiceId, 
+    TCchConnectionParameter aConnParam,
+    RBuf& aConnParamValue )
+    {   
+    CSCENGDEBUG(  "CCSCEngCCHHandler::GetConnectionParameter" );
+    
+    CCchService* service = 
+           iCchClientApi->GetService( aServiceId );
+
+    TInt err( KErrNone );
+    if ( service )
+        {
+        err = service->GetConnectionParameter( 
+            ECCHUnknown, aConnParam, aConnParamValue );
+        }
+    else
+        {
+        err = KErrArgument;
+        }
+    
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Get cch connection parameter (TInt).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngCCHHandler::GetConnectionParameter( 
+    TInt aServiceId, 
+    TCchConnectionParameter aConnParam,
+    TInt& aConnParamValue )
+    {   
+    CSCENGDEBUG(  "CCSCEngCCHHandler::GetConnectionParameter" );
+    
+    CCchService* service = 
+           iCchClientApi->GetService( aServiceId );
+
+    
+    TInt err( KErrNone );
+    if ( service )
+        {
+        err = service->GetConnectionParameter( 
+            ECCHUnknown, aConnParam, aConnParamValue );
+        }
+    else
+        {
+        err = KErrArgument;
+        }
+        
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Set cch connection parameter.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngCCHHandler::SetConnectionParameter( 
+    TInt aServiceId,
+    TCchConnectionParameter aConnParam,
+    const TDesC& aConnParamValue )
+    {       
+    CSCENGDEBUG(  "CCSCEngCCHHandler::SetConnectionParameter" );
+    
+    CCchService* service = 
+           iCchClientApi->GetService( aServiceId );
+    
+    TInt err( KErrNone );
+    if ( service )
+        {
+        err =service->SetConnectionParameter( 
+            ECCHUnknown, aConnParam, aConnParamValue );
+        }
+    else
+        {
+        err = KErrArgument;
+        }
+           
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCEngCCHHandler::IsDisabled
+// ---------------------------------------------------------------------------
+//
+TBool CCSCEngCCHHandler::IsDisabled( 
+    TInt aServiceId, 
+    TCCHSubserviceType aType  )                                     
+    {                                                                                                          
+    TBool disabled( EFalse );                                                                                   
+    
+    CCchService* service = 
+          iCchClientApi->GetService( aServiceId );
+    
+    if ( service )
+        {
+        TCchServiceStatus status;
+        TInt err = service->GetStatus( aType, status );
+                                                                                                                                                                                       
+        if ( KErrNotFound == err || 
+             ( KErrNone == err && 
+             ( ECCHUninitialized == status.State() || 
+               ECCHDisabled == status.State() ) ) )
+            {                                                                                                                                         
+            disabled = ETrue;                                                                                                                        
+            }          
+        }
+
+    return disabled;                                                                                                              
+    }  
+    
+// ---------------------------------------------------------------------------
+// From class MCchServiceStatusObserver
+// ---------------------------------------------------------------------------
+//
+void CCSCEngCCHHandler::ServiceStatusChanged( 
+    TInt aServiceId, 
+    TCCHSubserviceType aType, 
+    const TCchServiceStatus& aServiceStatus )                  
+    {       
+    CSCENGDEBUG(  "CCSCEngCCHHandler::ServiceStatusChanged" );
+    
+    if ( ECCHDisabled == aServiceStatus.State() )
+        {
+        CCchService* service = 
+                  iCchClientApi->GetService( aServiceId );
+        
+        if ( service )
+            {
+            service->RemoveObserver();
+            }
+        }
+    
+    iObserver.ServiceStatusChanged(
+            aServiceId, 
+            aType, 
+            aServiceStatus );                                                                                   
+    }  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/src/cscengconnectionhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,164 @@
+/*
+* 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:  For handling interactions betweed UI and RConnection.
+*
+*/
+
+
+#include <e32base.h>
+#include <nifman.h>
+
+#include "cscenglogger.h"
+#include "cscengconnectionhandler.h"
+#include "mcscengconnectionobserver.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngConnectionHandler::CCSCEngConnectionHandler( 
+    MCSCEngConnectionObserver& aObserver ) : 
+    CActive( EPriorityStandard ), 
+    iObserver( aObserver )
+    {    
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCEngConnectionHandler::ConstructL()
+    {
+    CSCENGDEBUG( "CCSCEngConnectionHandler::ConstructL - begin" ); 
+    
+    CActiveScheduler::Add( this );
+
+    iTimer = CCSCEngTimer::NewL( *this );
+    
+    // Open channel to Socket Server
+    User::LeaveIfError( iSocketServ.Connect() );
+    
+    // Open connection
+    User::LeaveIfError( iConnection.Open( iSocketServ ) );
+    
+    CSCENGDEBUG( "CCSCEngConnectionHandler::ConstructL - end" ); 
+    }   
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngConnectionHandler* CCSCEngConnectionHandler::NewL( 
+    MCSCEngConnectionObserver& aObserver )
+    {    
+    CCSCEngConnectionHandler* self = 
+        new ( ELeave ) CCSCEngConnectionHandler( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngConnectionHandler::~CCSCEngConnectionHandler()
+    {
+    CSCENGDEBUG( "CCSCEngConnectionHandler::~CCSCEngConnectionHandler - begin" ); 
+    
+    delete iTimer;
+    
+    Cancel();
+    iConnection.Close();
+    iSocketServ.Close();
+    
+    CSCENGDEBUG( "CCSCEngConnectionHandler::~CCSCEngConnectionHandler - end" ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCEngConnectionHandler::StartListeningConnectionEvents
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngConnectionHandler::StartListeningConnectionEvents()
+    {
+    CSCENGDEBUG( "CCSCEngConnectionHandler::StartListeningConnectionEvents" ); 
+    
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+    
+    iTimer->StartTimer( CCSCEngTimer::EConnectionMonitoringTimer ); 
+    iConnection.AllInterfaceNotification( iInfoBuf, iStatus );
+    SetActive(); 
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCEngConnectionHandler::StopListeningConnectionEvents
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngConnectionHandler::StopListeningConnectionEvents()
+     {
+     CSCENGDEBUG( "CCSCEngConnectionHandler::StopListeningConnectionEvents" ); 
+     
+     iTimer->StopTimer();
+     iConnection.CancelAllInterfaceNotification();
+     }    
+
+// ---------------------------------------------------------------------------
+// From MCSCEngTimerObserver
+// ---------------------------------------------------------------------------
+//
+void CCSCEngConnectionHandler::TimerExpired()
+     {
+     CSCENGDEBUG( "CCSCEngConnectionHandler::TimerExpired" ); 
+     
+     iConnection.CancelAllInterfaceNotification();
+     iObserver.NotifyConnectionEvent( EEventTimedOut );
+     } 
+   
+// ---------------------------------------------------------------------------
+// CCSCEngConnectionHandler::RunL
+// ---------------------------------------------------------------------------
+//
+void CCSCEngConnectionHandler::RunL()
+    {
+    if ( iStatus.Int() == KErrNone )
+        {
+        CSCENGDEBUG2( 
+            "CCSCEngConnectionHandler::RunL STATE=%d", iInfoBuf().iState );
+        
+        if ( EInterfaceDown == iInfoBuf().iState )
+            {
+            iTimer->StopTimer();
+            iObserver.NotifyConnectionEvent( EEventConnectionDown );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCEngConnectionHandler::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CCSCEngConnectionHandler::DoCancel()
+    {    
+    iTimer->StopTimer();
+    iConnection.CancelAllInterfaceNotification();
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/src/cscengdestinationshandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,132 @@
+/*
+* 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:  For handling interactions betweed UI and CMM.
+*
+*/
+
+#include <cmpluginwlandef.h>
+#include <cmdestinationext.h>
+#include <cmconnectionmethodext.h>
+
+#include "cscenglogger.h"
+#include "cscengdestinationshandler.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngDestinationsHandler::CCSCEngDestinationsHandler()
+    {    
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCEngDestinationsHandler::ConstructL()
+    {
+    CSCENGDEBUG( "CCSCEngDestinationsHandler::ConstructL - begin" ); 
+    
+    // Create connection to Connection Method Manager.
+    iCmManager.OpenL();
+    
+    CSCENGDEBUG( "CCSCEngDestinationsHandler::ConstructL - end" ); 
+    }   
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngDestinationsHandler* CCSCEngDestinationsHandler::NewL()
+    {    
+    CCSCEngDestinationsHandler* self = 
+        new ( ELeave ) CCSCEngDestinationsHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngDestinationsHandler::~CCSCEngDestinationsHandler()
+    {
+    CSCENGDEBUG( 
+        "CCSCEngDestinationsHandler::~CCSCEngDestinationsHandler - begin" ); 
+    
+    iCmManager.Close();
+    
+    CSCENGDEBUG( 
+        "CCSCEngDestinationsHandler::~CCSCEngDestinationsHandler - end" ); 
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CCSCEngDestinationsHandler::AvailableSnapIdsL
+// Returns available destination ids in the device.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngDestinationsHandler::AvailableSnapIdsL( 
+    RArray<TUint32>& aSnapIds )
+    {
+    iCmManager.AllDestinationsL( aSnapIds );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCEngDestinationsHandler::SnapNameL
+// Returns destination name based on destination id.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CCSCEngDestinationsHandler::SnapNameL( TUint32 aSnapId )
+    {
+    // Get destination name based on destination id from CM Manager. 
+    // Function leaves if destination wasn't found.
+    HBufC* snapName = NULL;
+    RArray<TUint32> snapIds;
+    CleanupClosePushL( snapIds );
+    AvailableSnapIdsL( snapIds );
+    for ( TInt i = 0; i < snapIds.Count() && !snapName; i++ )
+        {
+        if ( aSnapId == snapIds[ i ] )
+            {
+            snapName = iCmManager.DestinationL( aSnapId ).NameLC();
+            CSCENGDEBUG2( 
+                "CCSCEngDestinationsHandler::SnapNameLC: snapName=%S", 
+                    snapName );
+            CleanupStack::Pop( snapName );
+            }
+        }
+    CleanupStack::PopAndDestroy( &snapIds );
+    
+    if ( !snapName )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    return snapName;
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCEngDestinationsHandler::IsSnapInUseL
+// Returns ETrue if snap is in use.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCSCEngDestinationsHandler::IsSnapInUseL( TUint32 aSnapId )
+    {
+    return iCmManager.DestinationL( aSnapId ).IsConnectedL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/src/cscengecommonitor.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2007-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:  For monitoring ecom events.
+*
+*/
+
+#include "cscenglogger.h"
+#include "cscengecommonitor.h"
+#include "mcscengecomobserver.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngEcomMonitor::CCSCEngEcomMonitor( MCSCEngEcomObserver& aObserver ) 
+    : CActive( EPriorityStandard ),
+    iObserver( aObserver )
+    {    
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCEngEcomMonitor::ConstructL()
+    {
+    CSCENGDEBUG( "CCSCEngEcomMonitor::ConstructL - begin" ); 
+    
+    // Open ECom session and start monitoring count of implementations.
+    CActiveScheduler::Add( this );
+    iEcomSession = REComSession::OpenL();
+    StartMonitoring();
+    
+    CSCENGDEBUG( "CCSCEngEcomMonitor::ConstructL - end" ); 
+    }   
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngEcomMonitor* CCSCEngEcomMonitor::NewL( MCSCEngEcomObserver& aObserver )
+    {    
+    CCSCEngEcomMonitor* self = new ( ELeave ) CCSCEngEcomMonitor( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngEcomMonitor::~CCSCEngEcomMonitor()
+    {
+    CSCENGDEBUG( "CCSCEngEcomMonitor::~CCSCEngEcomMonitor - begin" ); 
+
+    Cancel();
+    iEcomSession.Close();
+    
+    CSCENGDEBUG( "CCSCEngEcomMonitor::~CCSCEngEcomMonitor - end" ); 
+    }
+
+
+// ---------------------------------------------------------------------------
+// From CActive
+// CCSCEngEcomMonitor::RunL
+// ---------------------------------------------------------------------------
+//
+void CCSCEngEcomMonitor::RunL()
+    {
+    CSCENGDEBUG( "CCSCEngEcomMonitor::RunL - begin" );
+    
+    iObserver.NotifyEcomEvent();
+            
+    // Start monitoring changed in ECom session again.    
+    StartMonitoring();
+    
+    CSCENGDEBUG( "CCSCEngEcomMonitor::RunL - end" );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// From CActive
+// CCSCEngEcomMonitor::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CCSCEngEcomMonitor::DoCancel()
+    {
+    // Cancel ECom session notification service.
+    iEcomSession.CancelNotifyOnChange( iStatus );
+    }    
+
+
+// ---------------------------------------------------------------------------
+// CCSCEngEcomMonitor::StartMonitoring
+// Starts monitoring about ECom notifications.
+// ---------------------------------------------------------------------------
+//
+void CCSCEngEcomMonitor::StartMonitoring()
+    {
+    // Attach to ECom session notification service.
+    if ( !IsActive() )
+        {
+        iEcomSession.NotifyOnChange( iStatus );
+        SetActive();
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCSCEngEcomMonitor::ResetAndDestroy
+// Frees memory allocated by array in case of leave.
+// ---------------------------------------------------------------------------
+//
+void CCSCEngEcomMonitor::ResetAndDestroy( TAny* aArray )
+    {
+    CSCENGDEBUG( "CCSCEngEcomMonitor::ResetAndDestroy" );	
+    if ( aArray )
+        {
+        RImplInfoPtrArray* array = 
+            reinterpret_cast<RImplInfoPtrArray*>( aArray );
+        array->ResetAndDestroy();
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/src/cscengservicehandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,615 @@
+/*
+* Copyright (c) 2007-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:  For CSC needed Service Provider Settings handling
+*
+*/
+
+
+#include <spentry.h>
+#include <spproperty.h>
+#include <spsettings.h>
+#include <spnotifychange.h>
+#include <spsettingsvoiputils.h>
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h>
+
+#include "cscenglogger.h"
+#include "cscengservicehandler.h"
+#include "mcscengserviceobserver.h"
+
+const TInt KDummyServiceCount = 1;// only remove cs service, VoIP service is not returned
+const TInt KArrayInitSize = 2;
+
+// SCP-plugin uid for Sip VoIP
+const TInt32 KSipVoIPSubServicePlugId = 0x1027545A;
+// Preferred Telephony value is PS call
+const TInt KRCSEInternetCallPreferred = 1;
+// Preferred Telephony value is CS call
+const TInt KRCSECSCallPreferred = 0;
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngServiceHandler::CCSCEngServiceHandler()
+    {    
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCEngServiceHandler::ConstructL( MCSCEngServiceObserver* aObserver )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::ConstructL - begin" ); 
+    
+    iObserver = aObserver;
+    iServiceSettings = CSPSettings::NewL();
+    iNotifier = CSPNotifyChange::NewL( *this );
+    iSettingsVoIPUtils = CSPSettingsVoIPUtils::NewL();
+           
+    RArray<TUint> serviceIds;
+    iNotifier->NotifyChangeL( serviceIds );
+    
+    CSCENGDEBUG( "CCSCEngServiceHandler::ConstructL - end" ); 
+    }   
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngServiceHandler* CCSCEngServiceHandler::NewL( 
+    MCSCEngServiceObserver* aObserver )
+    {    
+    CCSCEngServiceHandler* self = new (ELeave) CCSCEngServiceHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngServiceHandler::~CCSCEngServiceHandler()
+    {
+    CSCENGDEBUG( 
+        "CCSCEngServiceHandler::~CCSCEngCenrepHandler - begin" ); 
+    
+    iServiceName.Close();
+    delete iSettingsVoIPUtils;
+    delete iServiceSettings;
+    delete iNotifier;
+    
+    CSCENGDEBUG( 
+        "CCSCEngServiceHandler::~CCSCEngCenrepHandler - end" ); 
+    }
+    
+
+// ---------------------------------------------------------------------------
+// For getting all service ids
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngServiceHandler::GetAllServiceIdsL( 
+    RArray<TUint>& aServiceIds )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::GetAllServiceIds - begin" ); 
+    
+    iServiceSettings->FindServiceIdsL( aServiceIds );
+    
+    // Remove 'dummy service's' from service ids list.
+    if ( KDummyServiceCount <= aServiceIds.Count() )
+        {
+        for ( TUint i = 0; i < KDummyServiceCount; i++ )
+            {
+            aServiceIds.Remove( 0 );
+            }
+        }
+        
+    CSCENGDEBUG( "CCSCEngServiceHandler::GetAllServiceIds - end" ); 
+    }
+
+
+// ---------------------------------------------------------------------------
+// For getting service provider settings count
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngServiceHandler::ServiceIdCountL()
+    {
+    CSCENGDEBUG2( 
+        "CCSCEngServiceHandler::ServiceIdCount COUNT=%d", 
+            iServiceSettings->SettingsCountL() );
+    
+    return iServiceSettings->SettingsCountL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// For deleting service
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngServiceHandler::DeleteServiceL( TUint aServiceId )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::DeleteServiceL - begin" );
+    
+    User::LeaveIfError( iServiceSettings->DeleteEntryL( aServiceId ) );
+    
+    CSCENGDEBUG( "CCSCEngServiceHandler::DeleteServiceL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// For getting service name
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC16& CCSCEngServiceHandler::ServiceNameL( 
+    TUint aServiceId )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::ServiceNameL - begin" );
+    
+    iServiceName.Zero();
+    RArray<TUint> serviceIds;
+    CleanupClosePushL( serviceIds );
+    
+    GetAllServiceIdsL( serviceIds );
+    
+    CDesCArray* serviceNames = 
+        new ( ELeave ) CDesCArrayFlat( KArrayInitSize );
+    CleanupStack::PushL( serviceNames );
+    
+    iServiceSettings->FindServiceNamesL( serviceIds, *serviceNames );
+    
+    TBool serviceFound( EFalse );
+    for ( TInt i( 0 ) ; i < serviceIds.Count() && !serviceFound ; i++ )
+        {
+        if ( aServiceId == serviceIds[ i ] )
+            {
+            serviceFound = ETrue;
+            iServiceName.Close();
+            iServiceName.CreateL( serviceNames->MdcaPoint( i ) );
+            }
+        }
+    
+    if ( !serviceFound )
+        {
+        User::Leave( KErrNotFound ); // leave if service not found
+        }
+    
+    CleanupStack::PopAndDestroy( serviceNames );	
+    CleanupStack::PopAndDestroy( &serviceIds );
+    
+    CSCENGDEBUG( "CCSCEngServiceHandler::ServiceNameL - end" );
+            
+    return iServiceName;
+    }
+
+// ---------------------------------------------------------------------------
+// For getting brand id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngServiceHandler::BrandIdL( 
+    TUint aServiceId, TDes16& aBrandId )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::BrandIdL - begin" ); 
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    
+    User::LeaveIfError( iServiceSettings->FindPropertyL( 
+        aServiceId, EPropertyBrandId, *property ) );
+       
+    User::LeaveIfError( property->GetValue( aBrandId ) );
+    
+    CleanupStack::PopAndDestroy( property );
+    
+    CSCENGDEBUG2( "CCSCEngServiceHandler::BrandIdL BRANDID=%S", &aBrandId );
+    
+    CSCENGDEBUG( "CCSCEngServiceHandler::BrandIdL - end" ); 
+    }      
+
+// ---------------------------------------------------------------------------
+// For getting snap id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngServiceHandler::SnapIdL( TUint aServiceId )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::SnapIdL - begin" ); 
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    TInt snapId( 0 );
+    
+    User::LeaveIfError( iServiceSettings->FindPropertyL( 
+        aServiceId, ESubPropertyVoIPPreferredSNAPId, *property ) );
+       
+    User::LeaveIfError( property->GetValue( snapId ) );
+    
+    CleanupStack::PopAndDestroy( property );
+    
+    CSCENGDEBUG( "CCSCEngServiceHandler::SnapIdL - end" ); 
+    
+    return snapId;
+    }  
+
+// ---------------------------------------------------------------------------
+// For getting service setup plug-in id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt32 CCSCEngServiceHandler::ServiceSetupPluginIdL( 
+    TUint aServiceId )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::ServiceSetupPluginId - begin" ); 
+    
+    CSPProperty* property = CSPProperty::NewLC();
+     
+    User::LeaveIfError( iServiceSettings->FindPropertyL( 
+        aServiceId, EPropertyServiceSetupPluginId, *property ) );
+    
+    TInt serviceSetupPluginId( 0 );   
+    User::LeaveIfError( property->GetValue( serviceSetupPluginId ) ); 
+          
+    CleanupStack::PopAndDestroy( property );
+    
+    CSCENGDEBUG( "CCSCEngServiceHandler::ServiceSetupPluginId - end" ); 
+    
+    return serviceSetupPluginId;
+    }      
+
+
+// ---------------------------------------------------------------------------
+// For getting service´s phonebook tab view id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngServiceHandler::ServiceTabViewIdL( TUint aServiceId )
+    {
+    CSPProperty* property = CSPProperty::NewLC();
+     
+    User::LeaveIfError( iServiceSettings->FindPropertyL( 
+        aServiceId, EPropertyContactViewId, *property ) );
+    
+    TInt tabViewId( 0);                   
+    User::LeaveIfError( property->GetValue( tabViewId ) );     
+    
+    CleanupStack::PopAndDestroy( property );
+
+    CSCENGDEBUG2( "CCSCEngServiceHandler::ServiceTabViewIdL: %d", tabViewId );
+    
+    return tabViewId;
+    }      
+
+// ---------------------------------------------------------------------------
+// For getting service´s IM settings id.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngServiceHandler::ImSettingsIdL( TUint aServiceId )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::ImSettingsIdL - begin" ); 
+    
+    CSPProperty* property = CSPProperty::NewLC();
+     
+    User::LeaveIfError( iServiceSettings->FindPropertyL( 
+        aServiceId, ESubPropertyIMSettingsId, *property ) );
+    
+    TInt settingsId( 0 );                   
+    User::LeaveIfError( property->GetValue( settingsId ) );    
+    
+    CleanupStack::PopAndDestroy( property );
+
+    CSCENGDEBUG( "CCSCEngServiceHandler::ImSettingsIdL - end" );
+    
+    return settingsId;
+    }  
+
+// ---------------------------------------------------------------------------
+// For setting service´s IM settings id.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngServiceHandler::SetImSettingsIdL(
+    TUint aServiceId, TInt aSettingsId )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::SetImSettingsIdL - begin" ); 
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    
+    User::LeaveIfError( 
+        property->SetName( ESubPropertyIMSettingsId ) );
+    User::LeaveIfError( property->SetValue( aSettingsId ) );
+    
+    iServiceSettings->AddOrUpdatePropertyL( aServiceId, *property );
+    
+    CleanupStack::PopAndDestroy( property );
+    
+    CSCENGDEBUG( "CCSCEngServiceHandler::SetImSettingsIdL - end" );
+    } 
+
+// ---------------------------------------------------------------------------
+// For getting service´s presence request preference setting
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TOnOff CCSCEngServiceHandler::PresenceReqPrefL( TUint aServiceId )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::PresenceReqPrefL" ); 
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    
+    User::LeaveIfError( iServiceSettings->FindPropertyL( 
+        aServiceId, ESubPropertyPresenceRequestPreference , *property ) );
+    
+    TOnOff onOff = EOn;    
+    User::LeaveIfError( property->GetValue( onOff ) );
+    
+    CleanupStack::PopAndDestroy( property );
+    
+    return onOff;
+    } 
+
+
+// ---------------------------------------------------------------------------
+// For setting service´s presence request preference setting
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngServiceHandler::SetPresenceReqPrefL( 
+    TUint aServiceId, TOnOff aOnOff )
+    {
+    CSCENGDEBUG2( 
+        "CCSCEngServiceHandler::SetPresenceReqPrefL: aOnOff=%d", aOnOff ); 
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    User::LeaveIfError( 
+        property->SetName( ESubPropertyPresenceRequestPreference ) );
+    User::LeaveIfError( property->SetValue( aOnOff ) );
+    
+    iServiceSettings->AddOrUpdatePropertyL( aServiceId, *property );
+    CleanupStack::PopAndDestroy( property );
+    } 
+
+
+// ---------------------------------------------------------------------------
+// For getting service´s handover notification tone preference setting
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TOnOff CCSCEngServiceHandler::HandoverNotifTonePrefL( 
+    TUint aServiceId )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::HandoverNotifTonePrefL" ); 
+
+    CSPProperty* property = CSPProperty::NewLC();
+         
+    User::LeaveIfError( iServiceSettings->FindPropertyL( 
+        aServiceId, ESubPropertyVccHoNotificationToneMode , *property ) );
+         
+    RBuf value( 0 );  
+    CleanupClosePushL( value );
+    value.CreateL( 1 );
+    User::LeaveIfError( property->GetValue( value ) );
+         
+    // convert rbuf to int
+    TInt intValue;
+    TLex temp( value );
+    User::LeaveIfError( temp.Val( intValue ) );
+      
+    CleanupStack::PopAndDestroy( &value );
+    CleanupStack::PopAndDestroy( property );
+         
+    TOnOff onOff = EOONotSet;
+      
+    switch ( intValue )
+        {
+        case 0:
+            {
+            onOff = EOff;
+            }
+            break;
+        case 1:
+            {
+            onOff = EOn;
+            }
+            break;
+        default:
+            {
+            onOff = EOONotSet;
+            }
+            break;
+        }
+
+    CSCENGDEBUG2( "CCSCEngServiceHandler::HandoverNotifTonePrefL: %d", onOff ); 
+      
+    return onOff;
+    }
+        
+
+// ---------------------------------------------------------------------------
+// For setting service´s handover notification tone preference setting
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngServiceHandler::SetHandoverNotifTonePrefL( 
+    TUint aServiceId, TOnOff aOnOff )
+    {
+    CSPProperty* property = CSPProperty::NewLC();
+    User::LeaveIfError( 
+        property->SetName( ESubPropertyVccHoNotificationToneMode ) );
+    
+    RBuf value;
+    CleanupClosePushL( value );
+    value.CreateL( 1 );
+    value.AppendNum( aOnOff );
+    User::LeaveIfError( property->SetValue( value ) );
+       
+    iServiceSettings->AddOrUpdatePropertyL( aServiceId, *property );
+    
+    CleanupStack::PopAndDestroy( &value );
+    CleanupStack::PopAndDestroy( property );
+    }
+        
+
+// ---------------------------------------------------------------------------
+// For finding out if service supports VCC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCSCEngServiceHandler::IsVccSupportedL( TUint aServiceId )
+    {
+    TBool supported( EFalse );
+    
+    TInt vccServiceId( KErrNone );
+    TInt error( KErrNone );
+        
+    //  Array of service provider IDs
+    // is defined as: typedef RArray<TServiceId> RIdArray
+    // in spdefinitions.h
+    RIdArray serviceIdArray;     
+    CleanupClosePushL( serviceIdArray );
+
+    // This should leave if error occurs
+    error = iServiceSettings->FindServiceIdsL( serviceIdArray );    
+    User::LeaveIfError( error );
+            
+    TInt serviceId( KErrNone );
+    TBool foundEntry( EFalse );
+        
+    for ( TInt i( 0 ); i < serviceIdArray.Count() && !foundEntry; i++ )
+        {
+        CSPProperty* property = CSPProperty::NewLC(); 
+        error = iServiceSettings->FindPropertyL(
+            serviceIdArray[i], ESubPropertyVccVDI, *property ); 
+           
+        if( error == KErrNone )
+            {            
+            vccServiceId =  serviceIdArray[i];
+            foundEntry = ETrue;
+            }
+        CleanupStack::PopAndDestroy( property );
+        }
+    
+    CleanupStack::PopAndDestroy( &serviceIdArray );
+    
+    if ( vccServiceId )
+        {
+        CSPProperty* property2 = CSPProperty::NewLC(); 
+        
+        iServiceSettings->FindPropertyL( 
+            vccServiceId,
+            ESubPropertyVccDtVoipServiceId,
+            *property2 );
+
+        TInt error = property2->GetValue( serviceId );
+        User::LeaveIfError( error );
+        CleanupStack::PopAndDestroy( property2 );
+        }    
+    
+    if ( serviceId == aServiceId )
+        {
+        supported = ETrue;
+        }
+    
+    CSCENGDEBUG2( "CCSCEngServiceHandler::IsVccSupportedL: %d", supported );
+    
+    return supported;
+    }
+
+
+// ---------------------------------------------------------------------------
+// For finding out if service supports SIP/VoIP
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCSCEngServiceHandler::IsSipVoIPL( TUint aServiceId )
+    {
+    TBool sipVoIP( EFalse );
+    TInt uid( 0 );
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    
+    User::LeaveIfError( iServiceSettings->FindPropertyL( 
+        aServiceId, EPropertyVoIPSubServicePluginId , *property ) );
+    
+    User::LeaveIfError( property->GetValue( uid ) );
+    
+    if ( KSipVoIPSubServicePlugId == uid )
+        {
+        sipVoIP = ETrue;
+        }
+    
+    CSCENGDEBUG2( "CCSCEngServiceHandler::IsSipVoIP: %d", sipVoIP );
+    
+    CleanupStack::PopAndDestroy( property );
+    
+    return sipVoIP;
+    } 
+
+// ---------------------------------------------------------------------------
+// For finding out if service is the preferred service
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCSCEngServiceHandler::IsPreferredService( TUint aServiceId )
+    const
+    {
+    TUint service( 0 );
+    TInt ret = iSettingsVoIPUtils->GetPreferredService( service );
+    
+    return ( KErrNone == ret && service == aServiceId );
+    } 
+
+// ---------------------------------------------------------------------------
+// For finding out if voip is preferred telephony value
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCSCEngServiceHandler::IsPreferredTelephonyVoip() const
+    {
+    return iSettingsVoIPUtils->IsPreferredTelephonyVoIP();
+    } 
+
+// ---------------------------------------------------------------------------
+// Sets the preferred telephony value
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngServiceHandler::SetVoipAsPrefTelephony( 
+    TBool aValue,
+    TUint aServiceId ) const
+    {
+    TRAPD( err, SetVoipAsPrefTelephonyL( aValue, aServiceId ) );
+    return err;
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets the preferred telephony value
+// ---------------------------------------------------------------------------
+//
+void CCSCEngServiceHandler::SetVoipAsPrefTelephonyL( 
+    TBool aValue, 
+    TUint aServiceId ) const
+    {  
+    TInt value( aValue ? KRCSEInternetCallPreferred : KRCSECSCallPreferred );
+    TInt serviceId( aServiceId );
+          
+    CRepository* repository = CRepository::NewLC( KCRUidRichCallSettings );
+    
+    User::LeaveIfError( repository->Set( KRCSEPreferredTelephony, value ) );
+    User::LeaveIfError( repository->Set( KRCSPSPreferredService, serviceId ) );
+    CleanupStack::PopAndDestroy( repository );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSPNotifyChangeObserver
+// Notifies change in service table
+// ---------------------------------------------------------------------------
+//
+void CCSCEngServiceHandler::HandleNotifyChange( TUint /*aServiceId*/ )
+    {
+    CSCENGDEBUG( "CCSCEngServiceHandler::HandleNotifyChange - begin" );
+   
+    iObserver->NotifyServiceChange();
+     
+    CSCENGDEBUG( "CCSCEngServiceHandler::HandleNotifyChange - end" );  
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/src/cscengservicepluginhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,681 @@
+/*
+* 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:  For CSC needed AIW handling for service plug-ins
+*
+*/
+
+
+#include <eikenv.h>
+#include <bautils.h>
+#include <pathinfo.h>
+#include <ecom/ecom.h>
+#include <SWInstApi.h>
+#include <SWInstDefs.h>
+#include <AiwCommon.hrh>
+#include <cscengine.rsg>
+#include <AiwServiceHandler.h>
+#include <mspnotifychangeobserver.h>
+#include <data_caging_path_literals.hrh>
+
+#include "cscenglogger.h"
+#include "cscengecommonitor.h"
+#include "cscengservicehandler.h"
+#include "cscengservicepluginhandler.h"
+#include "mcscengprovisioningobserver.h"
+
+// Resource file location.
+_LIT( KCSCEngineResourceFile, "cscengine.rsc" ); // file
+
+const TInt KMandatoryParamCount = 3;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngServicePluginHandler::CCSCEngServicePluginHandler(
+    CEikonEnv& aEikEnv,
+    MCSCEngProvisioningObserver& aObserver,
+    CCSCEngServiceHandler& aServiceHandler ) :
+    iEikEnv( aEikEnv ),
+    iObserver( aObserver ),
+    iServiceHandler( aServiceHandler )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCEngServicePluginHandler::ConstructL()
+    {
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::ConstructL - begin" );
+
+    // Attach to AIW Framework.
+    iAiwServiceHandler = CAiwServiceHandler::NewL();  
+    
+    // Load resource file to the memory.    
+    TFileName resourceFile = TParsePtrC( PathInfo::RomRootPath() ).Drive();
+    resourceFile.Append( KDC_RESOURCE_FILES_DIR );
+    resourceFile.Append( KCSCEngineResourceFile );
+    BaflUtils::NearestLanguageFile( iEikEnv.FsSession(), resourceFile );
+    iResourceOffset = iEikEnv.AddResourceFileL( resourceFile );
+        
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::ConstructL - end" );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngServicePluginHandler* CCSCEngServicePluginHandler::NewL(
+    CEikonEnv& aEikEnv,
+    MCSCEngProvisioningObserver& aObserver,
+    CCSCEngServiceHandler& aServiceHandler )
+    {
+    CCSCEngServicePluginHandler* self =
+        CCSCEngServicePluginHandler::NewLC( 
+            aEikEnv, aObserver, aServiceHandler );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngServicePluginHandler* CCSCEngServicePluginHandler::NewLC(
+    CEikonEnv& aEikEnv,
+    MCSCEngProvisioningObserver& aObserver,
+    CCSCEngServiceHandler& aServiceHandler )
+    {
+    CCSCEngServicePluginHandler* self =
+        new ( ELeave ) CCSCEngServicePluginHandler( 
+            aEikEnv, aObserver, aServiceHandler );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngServicePluginHandler::~CCSCEngServicePluginHandler()
+    {
+    CSCENGDEBUG( 
+    	"CCSCEngServicePluginHandler::~CCSCEngServicePluginHandler - begin" );
+    
+    iEikEnv.DeleteResourceFile( iResourceOffset );
+    iServicePluginInfoArray.Reset();
+    iServicePluginInfoArray.Close();      
+    delete iEcomMonitor;
+    delete iAiwServiceHandler;
+    
+    CSCENGDEBUG( 
+    	"CCSCEngServicePluginHandler::~CCSCEngServicePluginHandler - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Initializes CSC supported plugins.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngServicePluginHandler::InitializePluginsL()
+    {
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::InitializePluginsL - begin" );
+
+    // Reset service plugin info array.
+    iServicePluginInfoArray.Reset();
+
+    // Attach to CSC supported plugins and execute initalization.
+    iAiwServiceHandler->AttachL( R_CSCENG_INTEREST_SERVICE_PLUGIN );
+    iAiwServiceHandler->ExecuteServiceCmdL( 
+            KAiwCmdCSCServicePlugins,
+            iAiwServiceHandler->InParamListL(),
+            iAiwServiceHandler->OutParamListL(),
+            EPluginInitialize,
+            this );
+    
+    // Start monitoring service setup plugins.
+    if ( !iEcomMonitor )
+        {
+        iEcomMonitor = CCSCEngEcomMonitor::NewL( *this );
+        }
+        
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::InitializePluginsL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// Informs plugin of provisioning
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngServicePluginHandler::DoProvisioningL(
+    const TUid& aPluginUid, const TUid& aViewUid )
+    {
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::DoProvisioningL - begin" );
+
+    // Set plugins Uid to generic param data.
+    CAiwGenericParamList& paramList = iAiwServiceHandler->OutParamListL();
+    TAiwVariant variant( aPluginUid );
+    TAiwGenericParam genericParamUid( EGenericParamError, variant );
+    paramList.AppendL( genericParamUid );
+
+    // Set view id to be returned to generic param data.
+    variant.Reset();
+    variant.Set( aViewUid );
+    TAiwGenericParam genericParamViewId( EGenericParamError, variant );
+    paramList.AppendL( genericParamViewId );
+
+    // Set bogus iap id to maintain backwards compatibility with older service
+    // plugins
+    TUint32 bogusIap( KErrNone );
+
+    variant.Reset();
+    variant.Set( bogusIap );
+    TAiwGenericParam genericParamIap( EGenericParamError, variant );
+    paramList.AppendL( genericParamIap );
+
+    // Execute service handler command.
+    iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdCSCServicePlugins,
+                                         iAiwServiceHandler->InParamListL(),
+                                         paramList,
+                                         EPluginProvisioning,
+                                         this );
+
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::DoProvisioningL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Launches plugin provided setting view.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngServicePluginHandler::LaunchPluginViewL(
+    const TUid& aPluginUid, const TUid& aViewUid )
+    {
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::LaunchPluginViewL - begin" );
+
+    // Set plugins Uid to generic param data.
+    CAiwGenericParamList& paramList = iAiwServiceHandler->OutParamListL();
+    TAiwVariant variant( aPluginUid );
+    TAiwGenericParam genericParamUid( EGenericParamError, variant );
+    paramList.AppendL( genericParamUid );
+
+    // Set view id to be returned to generic param data.
+    variant.Reset();
+    variant.Set( aViewUid );
+    TAiwGenericParam genericParamViewId( EGenericParamError, variant );
+    paramList.AppendL( genericParamViewId );
+
+    // Execute service handler command.
+    iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdCSCServicePlugins,
+                                         iAiwServiceHandler->InParamListL(),
+                                         paramList,
+                                         EPluginModifySettings,
+                                         this );
+
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::LaunchPluginViewL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Informs plugin from removation.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngServicePluginHandler::DoRemovationL(
+    const TUid& aPluginUid, TBool aDeleteSisPckg )
+    {
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::DoRemovationL - begin" );
+
+    // Set flag for application installer launching.
+    iRunSwinst = aDeleteSisPckg;
+
+    // Set plugins Uid to generic param data.
+    CAiwGenericParamList& paramList = iAiwServiceHandler->OutParamListL();
+    TAiwVariant variant( aPluginUid );
+    TAiwGenericParam genericParamUid( EGenericParamError, variant );
+    paramList.AppendL( genericParamUid );
+
+    // Execute service handler command.
+    iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdCSCServicePlugins,
+                                         iAiwServiceHandler->InParamListL(),
+                                         paramList,
+                                         EPluginRemovation,
+                                         this );
+
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::DoRemovationL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Returns plugin counts from PluginsInfoArray.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngServicePluginHandler::PluginCount( 
+    const TPluginCount aType ) const
+    {
+    TInt count( 0 );
+
+    for ( TInt i = 0; i < iServicePluginInfoArray.Count(); i++ )
+        {
+        switch ( aType )
+            {
+            // CSC supported and initialized plugin count.
+            case EInitialized:
+                count++;
+                break;
+            // CSC supported and unprovisioned plugin count.
+            case EUnprovisioned:
+                if ( !iServicePluginInfoArray[ i ].iProvisioned )
+                    {
+                    count++;
+                    }
+                break;
+            default:
+                break;
+            }
+        }
+
+    CSCENGDEBUG2( "CCSCEngServicePluginHandler::PluginCount: %d", count );
+
+    return count;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Return item from serviceplugininfoarray.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TServicePluginInfo 
+    CCSCEngServicePluginHandler::ItemFromPluginInfoArray( TInt aIndex )
+    {
+    return iServicePluginInfoArray[ aIndex ];
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MAiwNotifyCallBack
+// Handles received callbacks from AIW plugin.
+// ---------------------------------------------------------------------------
+//
+TInt CCSCEngServicePluginHandler::HandleNotifyL(
+    TInt /*aCmdId*/,
+    TInt aEventId,
+    CAiwGenericParamList& /*aEventParamList*/,
+    const CAiwGenericParamList& aInParamList )
+    {
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::HandleNotifyL - begin");
+
+    TInt err( KErrNone );
+
+    switch ( aEventId )
+        {
+        // ===================================================================
+        // Every supported CSC plugin sends callback event when it has
+        // been initialized. Generic parameter include 3 different values.
+        // Initialization parameters are described in CSC Service Plugin
+        // interface description document:
+        // "Example Operator" <- Name shown to user
+        // "00"               <- First value 0 or 1 provides information
+        //                       whether Plugin has modifiable UI or not. This
+        //                       information is needed when provisioning
+        //                       control is given to Plugin.
+        //                    <- Second value presents information whether
+        //                       Plugin requires Active IAP in order to
+        //                       process provisioning.
+        // ===================================================================
+        case KAiwEventStarted:
+            {
+            CSCENGDEBUG(
+            "CCSCEngServicePluginHandler::HandleNotifyL - KAiwEventStarted" );
+
+            // Parse initialization data and append data to the infoarray.
+            SetPluginInitInfoL( aInParamList );
+            
+            TInt index( 0 );
+            TUid pluginUid( KNullUid );
+            
+            GetPluginIndexAndUid( aInParamList, index, pluginUid );
+            
+            iObserver.NotifyServicePluginResponse( 
+                EPluginInitialized, index, pluginUid );
+            break;
+            }
+
+        // ===================================================================
+        // Target plugins sends callback note when provisioning is finished.
+        // Generic parameter include 1 value.
+        // Initialization parameters are described in CSC Service Plugin
+        // interface description document:
+        // "TUid"             <- Plugins uid value [TUid]
+        // ===================================================================
+        case KAiwEventCompleted:
+            {            
+            TInt index( 0 );
+            TUid pluginUid( KNullUid );
+            
+            GetPluginIndexAndUid( aInParamList, index, pluginUid );
+            
+            if ( index < iServicePluginInfoArray.Count() )
+                {
+                iServicePluginInfoArray[ index ].iProvisioned = ETrue;
+                
+                iObserver.NotifyServicePluginResponse( 
+                    EPluginProvisioned, index, pluginUid );
+                }
+            
+            CSCENGDEBUG(
+            "CCSCEngServicePluginHandler::HandleNotifyL KAiwEventCompleted" );
+            break;
+            }
+
+        // ===================================================================
+        // Target plugins sends callback note when plugins modified ui is
+        // ready. Generic parameter include 1 value.
+        // Initialization parameters are described in CSC Service Plugin
+        // interface description document:
+        // "TUid"             <- Plugins uid value [TUid]
+        // ===================================================================
+        case KAiwEventStopped:
+            {
+            TInt index( 0 );
+            TUid pluginUid( KNullUid );
+            
+            GetPluginIndexAndUid( aInParamList, index, pluginUid );
+            
+            iObserver.NotifyServicePluginResponse( 
+               EPluginModified, index, pluginUid );
+                 
+            CSCENGDEBUG(
+              "CCSCEngServicePluginHandler::HandleNotifyL KAiwEventStopped" );
+            break;
+            }
+
+        // ===================================================================
+        // Target plugins sends callback note when plugins setting removation
+        // process is ready. Generic parameter include 1 value.
+        // Initialization parameters are described in CSC Service Plugin
+        // interface description document:
+        // "TUid"             <- Plugins uid value [TUid]
+        // ===================================================================
+        case KAiwEventQueryExit:
+            { 
+            TInt index( 0 );
+            TUid pluginUid( KNullUid );
+            
+            GetPluginIndexAndUid( aInParamList, index, pluginUid );
+            GetPluginViewId( aInParamList );
+            
+            if ( iRunSwinst )
+                {
+                // Try to remove .sis file from the device.
+                TRAP_IGNORE( RemovePluginSisL( pluginUid ) );
+                }
+                
+            iObserver.NotifyServicePluginResponse( 
+                EPluginRemoved, index, pluginUid );
+            
+            CSCENGDEBUG(
+            "CCSCEngServicePluginHandler::HandleNotifyL KAiwEventQueryExit" );   
+            break;
+            }
+
+        // ===================================================================
+        // Target plugins sends callback note if plugins provisioning failed.
+        // Generic parameter include 1 value.
+        // Initialization parameters are described in CSC Service Plugin
+        // interface description document:
+        // "TUid"             <- Plugins uid value [TUid]
+        // ===================================================================
+        case KAiwEventError:
+            {
+            TInt index( 0 );
+            TUid pluginUid( KNullUid );
+            
+            GetPluginIndexAndUid( aInParamList, index, pluginUid );
+            
+            iObserver.NotifyServicePluginResponse( 
+               EPluginError, index, pluginUid );
+
+            CSCENGDEBUG(
+                "CCSCEngServicePluginHandler::HandleNotifyL KAiwEventError" );
+            break;
+            }
+        default:
+            CSCENGDEBUG(
+                "CCSCEngServicePluginHandler::HandleNotifyL: !!DEFAULT!!" );
+            break;
+        }
+
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::HandleNotifyL - end" );
+
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MCSCEngEcomObserver
+// Observer interface for notifying ecom events.
+// ---------------------------------------------------------------------------
+//
+void CCSCEngServicePluginHandler::NotifyEcomEvent()
+    {
+    // Re-initialize service setup plugins.
+    TRAP_IGNORE( InitializePluginsL() );
+    }
+
+
+// ---------------------------------------------------------------------------
+// For Getting plug-ins index in plug-in info array and plug-ins uid.
+// ---------------------------------------------------------------------------
+//
+void CCSCEngServicePluginHandler::GetPluginIndexAndUid( 
+    const CAiwGenericParamList& aInParamList,
+    TInt& aIndex, 
+    TUid& aPluginUid )
+    {
+    const TAiwGenericParam* genericParam = NULL;
+
+    genericParam = aInParamList.FindFirst( aIndex,
+                                           EGenericParamError,
+                                           EVariantTypeTUid );
+
+    aPluginUid = genericParam->Value().AsTUid();
+
+    for ( TInt i = 0; i < iServicePluginInfoArray.Count(); i++ )
+        {
+        if ( aPluginUid == iServicePluginInfoArray[ i ].iPluginsUid )
+            {
+            aIndex = i;
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// For Getting and setting plug-ins view id.
+// ---------------------------------------------------------------------------
+//
+void CCSCEngServicePluginHandler::GetPluginViewId( 
+    const CAiwGenericParamList& aInParamList )
+    {
+    const TAiwGenericParam* genericParam = NULL;
+    TUid pluginUid( KNullUid );
+    TUid viewId( KNullUid );
+    TInt index( 0 );
+    
+    // First is plug-in uid, not needed now
+    genericParam = aInParamList.FindFirst( index,
+                                           EGenericParamError,
+                                           EVariantTypeTUid );
+    
+    pluginUid = genericParam->Value().AsTUid();                              
+                                           
+    // Find next which is view id
+    genericParam = aInParamList.FindNext( index,
+                                          EGenericParamError,
+                                          EVariantTypeTUid );
+    
+    viewId = genericParam->Value().AsTUid();
+
+    for ( TInt i = 0; i < iServicePluginInfoArray.Count(); i++ )
+        {
+        if ( pluginUid == iServicePluginInfoArray[ i ].iPluginsUid )
+            {
+            iServicePluginInfoArray[ i ].iViewId = viewId;
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// For parsing and settings plug-in initialization info
+// ---------------------------------------------------------------------------
+//
+void CCSCEngServicePluginHandler::SetPluginInitInfoL(
+    const CAiwGenericParamList& aInParamList )
+    {
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::SetPluginInitInfoL - begin" );
+
+    if ( KMandatoryParamCount <= aInParamList.Count() )
+        {
+        TServicePluginInfo pluginInfo;
+        TInt index = 0;
+        
+        const TAiwGenericParam* genericParam = NULL;
+
+        // First generic value is plugin Uid.
+        genericParam = aInParamList.FindFirst( index,
+                                               EGenericParamError,
+                                               EVariantTypeTUid );
+
+        pluginInfo.iPluginsUid = genericParam->Value().AsTUid();
+
+        // Second generic value is plugin name.
+        genericParam = aInParamList.FindNext( index,
+                                              EGenericParamError,
+                                              EVariantTypeDesC );
+
+        pluginInfo.iProviderName.Copy( genericParam->Value().AsDes() );
+
+        CSCENGDEBUG2(
+         "CCSCEngServicePluginHandler::SetPluginInitInfoL: PROVIDER NAME: %S",
+             &pluginInfo.iProviderName );
+
+        // Third generic value is modified Ui and needed Iap.
+        genericParam = aInParamList.FindNext( index,
+                                              EGenericParamError,
+                                              EVariantTypeDesC8 );
+
+        TPtrC8 data = genericParam->Value().AsData();
+
+        TInt hasUi = 0;
+        TLex8 lexerUi( data.Left( 1 ) );
+        lexerUi.Val( hasUi );
+
+        pluginInfo.iModifiedUi = hasUi;
+
+        CSCENGDEBUG2(
+           "CCSCEngServicePluginHandler::SetPluginInitInfoL  Ui: %d", hasUi );
+
+        TInt reqIap = 0;
+        TLex8 lexerIap( data.Right( 1 ) );
+        lexerIap.Val( reqIap );
+
+        pluginInfo.iRequiredIap = reqIap;
+
+        CSCENGDEBUG2(
+         "CCSCEngServicePluginHandler::SetPluginInitInfoL  Iap: %d", reqIap );
+        
+        
+        // Check if plug-in is already provisioned
+        pluginInfo.iProvisioned = EFalse;
+        RArray<TUint> serviceIds;
+        CleanupClosePushL( serviceIds );
+        
+        TRAPD( err, iServiceHandler.GetAllServiceIdsL( serviceIds ) );
+         
+        for ( TInt i( 0 ) ; i < serviceIds.Count() && !err ; i++ )
+            {
+            TInt32 pluginUid( 0 );
+            TInt err2( KErrNone );
+            
+            TRAP( err2, pluginUid =
+                iServiceHandler.ServiceSetupPluginIdL( serviceIds[ i ] ) );
+                
+            
+            CSCENGDEBUG2(
+            "CCSCEngServicePluginHandler::SetPluginInitInfoL ERR=%d", err2 );
+            
+                        
+            if ( !err2 && ( pluginInfo.iPluginsUid.iUid == pluginUid ) )
+                {
+                pluginInfo.iProvisioned = ETrue;
+                }
+            }
+        
+        CleanupStack::PopAndDestroy( &serviceIds );
+
+        // Check if the plugin is already in array before appending.
+        TBool found( EFalse );
+        for ( TInt counter( 0 ); 
+            counter < iServicePluginInfoArray.Count();
+            counter++ )
+            {
+            if ( iServicePluginInfoArray[counter].iPluginsUid == 
+                pluginInfo.iPluginsUid )
+                {
+                found = ETrue;
+                }
+            }
+        if ( !found )
+            {
+            iServicePluginInfoArray.Append( pluginInfo );
+            }
+        }
+        
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::SetPluginInitInfoL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Invokes application installer to remove .sis from device.
+// ---------------------------------------------------------------------------
+//
+void CCSCEngServicePluginHandler::RemovePluginSisL( 
+    const TUid& aPluginUid ) const
+    {
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::RemovePluginSisL - begin" );
+    
+    // Create & connect to the software installation server.
+    SwiUI::RSWInstSilentLauncher swInstaller;
+    CleanupClosePushL( swInstaller );
+    User::LeaveIfError( swInstaller.Connect() );
+    
+    // Make silent uninstall via sowtware installation server.
+    SwiUI::TInstallOptionsPckg uninstallOptions;
+    User::LeaveIfError( 
+        swInstaller.SilentUninstall( 
+            aPluginUid , 
+            uninstallOptions, 
+            SwiUI::KSisxMimeType ) );
+    
+    // Close & destroy server after uninstallation.
+    CleanupStack::PopAndDestroy( &swInstaller );
+        
+    CSCENGDEBUG( "CCSCEngServicePluginHandler::RemovePluginSisL - end" );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/src/cscengstartuphandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,402 @@
+/*
+* 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:  For CSC startup handling
+*
+*/
+
+
+#include <e32base.h>
+
+#include "cscenglogger.h"
+#include "cscengstartuphandler.h"
+
+_LIT( KTagURL, "URL=" );
+_LIT( KTagAppUid, "APPUID=" );
+_LIT( KTagAction, "ACTION=" );
+_LIT( KTagServiceId, "SERID=" );
+_LIT( KTagPluginUid, "PLUGINUID=" );
+
+
+
+const TUint KTagUidPrefixLength = 2;
+const TUint KUidLength = 8;
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngStartupHandler::CCSCEngStartupHandler()
+    {    
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCEngStartupHandler::ConstructL()
+    {    
+    CSCENGDEBUG( "CCSCEngStartupHandler::ConstructL begin" );    
+    
+    iAction = EDefaultAction;
+    iServiceId = 0;
+    iPluginUid = KNullUid;
+    iAppUid = KNullUid;
+     
+    CSCENGDEBUG( "CCSCEngStartupHandler::ConstructL end" ); 
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngStartupHandler* CCSCEngStartupHandler::NewL()
+    {
+    CCSCEngStartupHandler* self = new (ELeave) CCSCEngStartupHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngStartupHandler::~CCSCEngStartupHandler()
+    {
+    CSCENGDEBUG( 
+        "CCSCEngStartupHandler::~CCSCEngStartupHandler - begin" ); 
+    
+    delete iURL;
+    
+    CSCENGDEBUG( 
+        "CCSCEngStartupHandler::~CCSCEngStartupHandler - end" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// For setting CSC application startup parameters
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngStartupHandler::SetStartupParametersL( 
+    const TDesC& aParameters )
+    {
+    CSCENGDEBUG( "CCSCEngStartupHandler::SetStartupParameters - begin" );
+    
+    TInt error( KErrNone );   
+
+    SetAction( aParameters );
+    
+    if ( EOpenSettingsUi == GetParamAction() )
+        {
+        SetServiceId( aParameters );
+        }
+    else
+        {
+        SetUid( aParameters, EPluginUid );
+        SetUid( aParameters, EAppUid );
+        SetUrlL( aParameters );
+        }
+    
+    CSCENGDEBUG( "CCSCEngStartupHandler::SetStartupParameters - end" );
+    
+    return error;
+    }
+
+
+// -----------------------------------------------------------------------------
+// For getting parameter action
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngStartupHandler::TAction 
+    CCSCEngStartupHandler::GetParamAction() const
+    {
+    CSCENGDEBUG( "CCSCEngStartupHandler::GetParamAction" );
+    return iAction;
+    }
+
+
+// -----------------------------------------------------------------------------
+// For getting parameter service id
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint CCSCEngStartupHandler::GetParamServiceId() const
+    {
+    CSCENGDEBUG( "CCSCEngStartupHandler::GetParamServiceId" );
+    return iServiceId;
+    }
+
+
+// -----------------------------------------------------------------------------
+// For getting parameter plugin uid
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TUid CCSCEngStartupHandler::GetParamPluginUid() const
+    {
+    CSCENGDEBUG( "CCSCEngStartupHandler::GetParamPluginUid" );
+    return iPluginUid;
+    }
+
+
+// -----------------------------------------------------------------------------
+// For getting parameter application uid
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TUid CCSCEngStartupHandler::GetParamAppUid() const
+    {
+    CSCENGDEBUG( "CCSCEngStartupHandler::GetParamAppUid" );
+    return iAppUid;
+    }    
+
+
+// -----------------------------------------------------------------------------
+// For Getting parameter URL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngStartupHandler::GetParamUrl( TDes& aUrl ) const
+    {
+    CSCENGDEBUG( "CCSCEngStartupHandler::GetParamUrlL - begin" );   
+        
+    if ( !iURL )
+        {
+        return KErrNotFound;
+        }
+    else
+        {
+        aUrl.Copy( iURL->Des() );    
+        }
+    
+    CSCENGDEBUG( "CCSCEngStartupHandler::GetParamUrlL - end" ); 
+        
+    return KErrNone;
+    }   
+
+
+// -----------------------------------------------------------------------------
+// For resetting uid values
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngStartupHandler::ResetUid( TUidType aType )
+    {
+    CSCENGDEBUG( "CCSCEngStartupHandler::ResetUid - begin" );   
+    
+    if ( EPluginUid == aType )
+        {
+        iPluginUid = KNullUid;
+        }
+    else if ( EAppUid == aType )
+        {  
+        iAppUid = KNullUid;
+        }
+    
+    CSCENGDEBUG( "CCSCEngStartupHandler::ResetUid - end" );   
+    }
+
+
+// -----------------------------------------------------------------------------
+// For resetting service id value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngStartupHandler::ResetServiceId()
+    {
+    iServiceId = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// For resetting service id value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngStartupHandler::SetStartedFromHomescreen( 
+    TBool aStartedFromHomescreen )
+    {
+    iStartedFromHomescreen = aStartedFromHomescreen;
+    }
+
+// -----------------------------------------------------------------------------
+// For resetting service id value
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CCSCEngStartupHandler::StartedFromHomescreen() const
+    {
+    return iStartedFromHomescreen;
+    }
+
+// ---------------------------------------------------------------------------
+// For parsing and setting parameter action
+// ---------------------------------------------------------------------------
+//
+void CCSCEngStartupHandler::SetAction( const TDesC& aParameters )
+    {
+    CSCENGDEBUG( "CCSCEngStartupHandler::SetAction - begin" );    
+        
+    TInt start( 0 );
+    
+    // Parse Action parameter
+    start = aParameters.Find( KTagAction );
+    
+    if ( KErrNotFound != start )
+        {
+        start = start + KTagAction().Length();
+        TPtrC pPtr = aParameters.Mid( start, 1 );
+            
+        // Convert string to TUint
+        TUint value( 0 );
+        TLex lex( pPtr );
+        lex.Val( value, EDecimal );
+    
+        // Set action
+        if ( EOpenSettingsUi < iAction )
+            {
+            iAction = EDefaultAction;
+            }
+        else
+            {
+            iAction = static_cast<CCSCEngStartupHandler::TAction> ( value );
+            }    
+        }
+    
+    CSCENGDEBUG( "CCSCEngStartupHandler::SetAction - end" ); 
+    }
+
+
+// ---------------------------------------------------------------------------
+// For parsing and setting service id parameter
+// ---------------------------------------------------------------------------
+//
+void CCSCEngStartupHandler::SetServiceId( const TDesC& aParameters )
+    {
+    CSCENGDEBUG( "CCSCEngStartupHandler::SetServiceId - begin" );   
+        
+    TInt start( 0 );
+    TUint value( 0 );
+
+    // Parse plug-in uid parameter
+    start = aParameters.Find( KTagServiceId );
+        
+    if ( KErrNotFound != start )
+        {
+        // exclude 'SERID='
+        start = start + KTagServiceId().Length();
+        
+        TInt serviceIdLength = aParameters.Length() - start;
+        
+        CSCENGDEBUG2( "CCSCEngStartupHandler::SetServiceId: Length=%d", serviceIdLength );   
+        
+              
+        TPtrC pPtr = aParameters.Mid( start, serviceIdLength );
+        
+        TLex lex( pPtr );
+        lex.Val( value, EDecimal );
+        
+        iServiceId = value;
+        }
+  
+                           
+    CSCENGDEBUG( "CCSCEngStartupHandler::SetServiceId - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// For parsing and setting uid parameters
+// ---------------------------------------------------------------------------
+//
+void CCSCEngStartupHandler::SetUid( 
+    const TDesC& aParameters, TUidType aUidType )
+    {
+    CSCENGDEBUG( "CCSCEngStartupHandler::SetPluginUid - begin" );   
+        
+    TInt start( 0 );
+    TUint value( 0 );
+    
+    if ( EPluginUid == aUidType )
+        {
+         // Parse plug-in uid parameter
+        start = aParameters.Find( KTagPluginUid );
+        
+        if ( KErrNotFound != start )
+            {
+            // exclude 'PLUGINUID=' and '0x'
+            start = start + KTagPluginUid().Length() + KTagUidPrefixLength;
+              
+            TPtrC pPtr = aParameters.Mid( start, KUidLength );
+        
+            TLex lex( pPtr );
+            lex.Val( value, EHex );
+        
+            iPluginUid.iUid = value;
+            }
+  	    }
+  	else
+  	    {
+  	    // Parse application uid parameter
+        start = aParameters.Find( KTagAppUid );
+        
+        if ( KErrNotFound != start )
+            {
+            // exclude 'APPUID=' and '0x'
+            start = start + KTagAppUid().Length() + KTagUidPrefixLength;
+              
+            TPtrC pPtr = aParameters.Mid( start, KUidLength );
+        
+            TLex lex( pPtr );
+            lex.Val( value, EHex );
+        
+            iAppUid.iUid = value;
+            }
+  	    }
+                           
+    CSCENGDEBUG( "CCSCEngStartupHandler::SetPluginUid - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// For parsing and setting parameter URL
+// ---------------------------------------------------------------------------
+//
+void CCSCEngStartupHandler::SetUrlL( const TDesC& aParameters )
+    {
+    CSCENGDEBUG( "CCSCEngStartupHandler::SetUrl - begin" );
+        
+    TInt start( 0 );
+    
+    // Parse URL parameter
+    start = aParameters.Find( KTagURL );
+    
+    if ( KErrNotFound != start )
+        {
+        // exclude 'URL='
+        start = start + KTagURL().Length();
+    
+        TInt urlLength = aParameters.Length() - start;
+        
+        // If iURL exists, delete it first
+        if ( iURL )
+            {
+            delete iURL;
+            iURL = NULL;
+            }
+        
+        // Set URL
+        if ( urlLength )
+            {
+            iURL = HBufC::NewL( urlLength );            
+            iURL->Des().Copy( aParameters.Mid( start, urlLength ) );
+            }
+        }
+    
+    CSCENGDEBUG( "CCSCEngStartupHandler::SetUrl - end" );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/src/cscengtimer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  For timer handling.
+*
+*/
+
+
+#include "cscengtimer.h"
+#include "cscenglogger.h"
+#include "mcscengtimerobserver.h"
+
+const TInt KWaitConnectionToClose = 5000000; // 5 seconds
+const TInt KWaitNoteDelayTime = 20000; // 20 ms
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngTimer::CCSCEngTimer( MCSCEngTimerObserver& aObserver ) 
+    : CTimer( EPriorityStandard ), iObserver( aObserver )
+    {    
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCEngTimer::ConstructL()
+    {
+    CSCENGDEBUG( "CCSCEngTimer::ConstructL - begin" ); 
+    
+    CActiveScheduler::Add( this );
+    CTimer::ConstructL();
+    
+    CSCENGDEBUG( "CCSCEngTimer::ConstructL - end" ); 
+    }   
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngTimer* CCSCEngTimer::NewL( MCSCEngTimerObserver& aObserver )
+    {    
+    CCSCEngTimer* self = new ( ELeave ) CCSCEngTimer( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngTimer::~CCSCEngTimer()
+    {
+    CSCENGDEBUG( "CCSCEngTimer::~CCSCEngTimer - begin" ); 
+    
+    CTimer::Cancel();
+    
+    CSCENGDEBUG( "CCSCEngTimer::~CCSCEngTimer - end" ); 
+    }
+   
+
+// ---------------------------------------------------------------------------
+// Start timer.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngTimer::StartTimer( TTimerType aTimerType )
+    {
+    CSCENGDEBUG( "CCSCEngTimer::StartTimer" ); 
+    
+    TInt error ( KErrNone );
+    
+    if ( CTimer::IsActive() )
+        {
+        CTimer::Cancel();
+        }
+    
+    if ( EConnectionMonitoringTimer == aTimerType )
+        {
+        CTimer::After( KWaitConnectionToClose );
+        }
+    else if ( ENoteDelayTimer == aTimerType )
+        {
+        CTimer::After( KWaitNoteDelayTime );
+        }
+    else
+        {
+        error = KErrArgument;
+        }
+    
+    return error;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Stop timer.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngTimer::StopTimer()
+    {
+    CSCENGDEBUG( "CCSCEngTimer::StopTimer - begin" ); 
+
+    if ( CTimer::IsActive() )
+        {
+        CTimer::Cancel();
+        }
+    
+    CSCENGDEBUG( "CCSCEngTimer::StopTimer - end" ); 
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCEngTimer::RunL
+// ---------------------------------------------------------------------------
+//
+void CCSCEngTimer::RunL()
+    {    
+    iObserver.TimerExpired();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscengine/src/cscenguiextensionpluginhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,390 @@
+/*
+* 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:  For CSC needed Aiw handling for ui extension plug-ins
+*
+*/
+
+
+#include <eikenv.h>
+#include <bautils.h>
+#include <pathinfo.h>
+#include <SWInstApi.h>
+#include <SWInstDefs.h>
+#include <AiwCommon.hrh>
+#include <cscengine.rsg>
+#include <AiwServiceHandler.h>
+#include <data_caging_path_literals.hrh>
+
+#include "cscenglogger.h"
+#include "cscengstartuphandler.h"
+#include "mcscenguiextensionobserver.h"
+#include "cscenguiextensionpluginhandler.h"
+
+// Resource file location.
+_LIT( KCSCEngineResourceFile, "cscengine.rsc" ); // file
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngUiExtensionPluginHandler::CCSCEngUiExtensionPluginHandler( 
+    CEikonEnv& aEikEnv,
+    MCSCEngUiExtensionObserver& aObserver,
+    CCSCEngStartupHandler& aStartupHandler ):
+    iEikEnv( aEikEnv ),
+    iObserver( aObserver ),
+    iStartupHandler( aStartupHandler )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCEngUiExtensionPluginHandler::ConstructL()
+    {
+    CSCENGDEBUG( "CCSCEngUiExtensionPluginHandler::ConstructL - begin" );
+    
+    // Attach to AIW Framework.
+    iServiceHandler = CAiwServiceHandler::NewL();
+    
+    // Load resource file to the memory.    
+    TFileName resourceFile = TParsePtrC( PathInfo::RomRootPath() ).Drive();
+    resourceFile.Append( KDC_RESOURCE_FILES_DIR );
+    resourceFile.Append( KCSCEngineResourceFile );
+    BaflUtils::NearestLanguageFile( iEikEnv.FsSession(), resourceFile );
+    iResourceOffset = iEikEnv.AddResourceFileL( resourceFile );
+    
+    CSCENGDEBUG( "CCSCEngUiExtensionPluginHandler::ConstructL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngUiExtensionPluginHandler* 
+    CCSCEngUiExtensionPluginHandler::NewL( 
+        CEikonEnv& aEikEnv,
+        MCSCEngUiExtensionObserver& aObserver,
+        CCSCEngStartupHandler& aStartupHandler )
+    {
+    CCSCEngUiExtensionPluginHandler* self = 
+        CCSCEngUiExtensionPluginHandler::NewLC( 
+            aEikEnv, aObserver, aStartupHandler );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCEngUiExtensionPluginHandler* 
+    CCSCEngUiExtensionPluginHandler::NewLC( 
+        CEikonEnv& aEikEnv,
+        MCSCEngUiExtensionObserver& aObserver,
+        CCSCEngStartupHandler& aStartupHandler )
+    {
+    CCSCEngUiExtensionPluginHandler* self = 
+        new ( ELeave ) CCSCEngUiExtensionPluginHandler( 
+            aEikEnv, aObserver, aStartupHandler );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCEngUiExtensionPluginHandler::~CCSCEngUiExtensionPluginHandler()
+    {
+    CSCENGDEBUG( 
+     "CCSCEngUiExtensionPluginHandler::~CCSCEngUiExtensionPluginHandler - begin" );
+
+    iEikEnv.DeleteResourceFile( iResourceOffset );
+    iUiExtensionPluginInfoArray.Reset();
+    iUiExtensionPluginInfoArray.Close();   
+    delete iServiceHandler;
+     
+    CSCENGDEBUG( 
+     "CCSCEngUiExtensionPluginHandler::~CCSCEngUiExtensionPluginHandler - end" );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// Initializes CSC supported ui extension plugins.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngUiExtensionPluginHandler::InitializePluginsL()
+    {
+    CSCENGDEBUG( 
+        "CCSCEngUiExtensionPluginHandler::InitializePluginsL - begin" );
+    
+    // Attach to CSC supported ui extension plugins and execute initalization.   
+    iServiceHandler->AttachL( R_CSCENG_INTEREST_UI_EXT_PLUGIN );
+    
+    iServiceHandler->ExecuteServiceCmdL( 
+            KAiwCmdCSCUiExtensionPlugins,
+            iServiceHandler->InParamListL(),
+            iServiceHandler->OutParamListL(),
+            EPluginInitialize,
+            this );
+           
+    CSCENGDEBUG( 
+        "CCSCEngUiExtensionPluginHandler::InitializePluginsL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Launches plugin provided setting view.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCEngUiExtensionPluginHandler::LaunchUiExtensionL( 
+    const TUid& aPluginUid, const TUid& aViewUid, TBool aLaunchedFromAI  )
+    {
+    CSCENGDEBUG( 
+        "CCSCEngUiExtensionPluginHandler::LaunchUiExtensionL - begin" );
+    
+    // Set plugins Uid to generic param data.
+    CAiwGenericParamList& paramList = iServiceHandler->OutParamListL();
+    TAiwVariant variant( aPluginUid );
+    TAiwGenericParam genericParamUid( EGenericParamError, variant );
+    paramList.AppendL( genericParamUid );
+            
+    // Set view id to be returned to generic param data.
+    variant.Reset();
+    variant.Set( aViewUid );
+    TAiwGenericParam genericParamViewId( EGenericParamError, variant );
+    paramList.AppendL( genericParamViewId );
+    
+    // Set URL to generic param data if set in CSC startup.    
+    TBuf<KMaxFileName> url;
+    TInt err = iStartupHandler.GetParamUrl( url );
+    
+    if ( !err )
+        {
+        variant.Reset();
+        variant.Set( url );
+        TAiwGenericParam genericParamURL( EGenericParamError, variant );
+        paramList.AppendL( genericParamURL );
+        }
+    
+    // Execute service handler command.
+    if ( aLaunchedFromAI )
+        {
+        iServiceHandler->ExecuteServiceCmdL( KAiwCmdCSCUiExtensionPlugins, 
+                                             iServiceHandler->InParamListL(),
+                                             paramList,
+                                             EPluginOpenExtensionViewFromAI,
+                                             this );     
+        }
+    else
+        {
+        iServiceHandler->ExecuteServiceCmdL( KAiwCmdCSCUiExtensionPlugins, 
+                                             iServiceHandler->InParamListL(),
+                                             paramList,
+                                             EPluginOpenExtensionView,
+                                             this );        
+        }
+
+                                  
+    CSCENGDEBUG( 
+        "CCSCEngUiExtensionPluginHandler::LaunchUiExtensionL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Returns item from UI Extension plug-in array
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUiExtensionPluginInfo 
+    CCSCEngUiExtensionPluginHandler::ItemFromPluginInfoArray( TInt aIndex )
+    {
+    CSCENGDEBUG( "CCSCEngUiExtensionPluginHandler::ItemFromPluginInfoArray" );
+    
+    return iUiExtensionPluginInfoArray[ aIndex ];
+    }
+
+
+// ---------------------------------------------------------------------------
+// Returns plugin counts from UiExtensionPluginsInfoArray.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCSCEngUiExtensionPluginHandler::PluginCount() const
+    {
+    CSCENGDEBUG2( 
+        "CCSCEngUiExtensionPluginHandler::PluginCount: %d", 
+            iUiExtensionPluginInfoArray.Count() );
+    
+    return iUiExtensionPluginInfoArray.Count();
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MAiwNotifyCallBack
+// Handles received callbacks from AIW plugin.
+// ---------------------------------------------------------------------------
+//
+TInt CCSCEngUiExtensionPluginHandler::HandleNotifyL( 
+    TInt /*aCmdId*/,
+    TInt aEventId,
+    CAiwGenericParamList& /*aEventParamList*/,
+    const CAiwGenericParamList& aInParamList )
+    {
+    CSCENGDEBUG( "CCSCEngUiExtensionPluginHandler::HandleNotifyL - begin");
+    
+    TInt err( KErrNone );
+    
+    switch ( aEventId )
+        {
+        case KAiwEventStarted:
+            {
+            CSCENGDEBUG( 
+             "CCSCEngUiExtensionPluginHandler::HandleNotifyL KAiwEventStarted" );
+            
+            SetPluginInitInfo( aInParamList );
+            
+            TInt index( 0 );
+            TUid pluginUid( KNullUid );
+            
+            GetPluginIndexAndUid( aInParamList, index, pluginUid );
+            
+            iObserver.NotifyUiExtensionPluginResponse( 
+                EPluginInitialized, index, pluginUid );
+            break;
+            }
+        case KAiwEventStopped:
+            {
+            TInt index( 0 );
+            TUid pluginUid( KNullUid );
+            
+            GetPluginIndexAndUid( aInParamList, index, pluginUid );
+            
+            iObserver.NotifyUiExtensionPluginResponse( 
+                EPluginExited, index, pluginUid );
+            
+            CSCENGDEBUG( 
+             "CCSCEngUiExtensionPluginHandler::HandleNotifyL KAiwEventStopped" );
+            break;
+            }
+        case KAiwEventError:
+            {
+            TInt index( 0 );
+            TUid pluginUid( KNullUid );
+            
+            GetPluginIndexAndUid( aInParamList, index, pluginUid );
+            
+            iObserver.NotifyUiExtensionPluginResponse( 
+                EPluginError, index, pluginUid );
+            
+            CSCENGDEBUG( 
+               "CCSCEngUiExtensionPluginHandler::HandleNotifyL KAiwEventError" );
+            break;
+            }
+        default:
+            CSCENGDEBUG( 
+                "CCSCEngUiExtensionPluginHandler::HandleNotifyL: !!DEFAULT!!" );
+            break;
+        }
+    
+    CSCENGDEBUG( "CCSCEngUiExtensionPluginHandler::HandleNotifyL - end" );
+    
+    return err;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// For getting plug-ins index in plug-in info array and plug-ins uid.
+// ---------------------------------------------------------------------------
+//
+void CCSCEngUiExtensionPluginHandler::GetPluginIndexAndUid( 
+    const CAiwGenericParamList& aInParamList,
+    TInt aIndex, 
+    TUid aPluginUid )
+    {
+    const TAiwGenericParam* genericParam = NULL;
+
+    // First and only generic value is plugins uid value.
+    genericParam = aInParamList.FindFirst( aIndex,
+                                           EGenericParamError,
+                                           EVariantTypeTUid );
+
+    aPluginUid = genericParam->Value().AsTUid();
+
+    for ( TInt i = 0; i < iUiExtensionPluginInfoArray.Count(); i++ )
+        {
+        if ( aPluginUid == iUiExtensionPluginInfoArray[ i ].iPluginsUid )
+            {
+            aIndex = i;
+            break;
+            }
+        }
+    }
+    
+
+// ---------------------------------------------------------------------------
+// For parsing and settings plug-in initialization info
+// ---------------------------------------------------------------------------
+//
+void CCSCEngUiExtensionPluginHandler::SetPluginInitInfo(
+    const CAiwGenericParamList& aInParamList )
+    {
+    CSCENGDEBUG( 
+        "CCSCEngUiExtensionPluginHandler::SetPluginInitInfoL - begin" );
+
+    TUiExtensionPluginInfo pluginInfo;
+    
+    TInt index = 0;
+    
+    if ( aInParamList.Count() )
+        {
+        const TAiwGenericParam* genericParam = NULL;
+
+        // First generic value is plugin Uid.
+        genericParam = aInParamList.FindFirst( index,
+                                               EGenericParamError,
+                                               EVariantTypeTUid );
+        
+        pluginInfo.iPluginsUid = genericParam->Value().AsTUid();
+                               
+        // Second generic value is UI extension´s name. 
+        genericParam = aInParamList.FindNext( index,
+                                              EGenericParamError,
+                                              EVariantTypeDesC );
+        
+        pluginInfo.iUiExtensionName.Copy( genericParam->Value().AsDes() );
+
+        // Third generic value is ui extension´s placing info
+        // 0 = listbox, 1 = options menu
+        genericParam = aInParamList.FindNext( index,
+                                              EGenericParamError,
+                                              EVariantTypeTInt32 );
+        
+        TInt32 place = genericParam->Value().AsTInt32();        
+        pluginInfo.iPlace = place;
+
+        CSCENGDEBUG2( 
+            "CCSCEngUiExtensionPluginHandler::SetPluginInitInfoL  Place: %d",
+                place );
+        }
+   
+    iUiExtensionPluginInfoArray.Append( pluginInfo );
+    
+    CSCENGDEBUG( 
+        "CCSCEngUiExtensionPluginHandler::SetPluginInitInfoL - end" );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscgsplugin/data/2001E639.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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:  ECOM plugin resource file for cscgsplugin
+*
+*/
+
+
+#include <registryinfov2.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+	dll_uid     = 0x2001E639;  // dll UID
+	interfaces  =
+		{
+		INTERFACE_INFO
+			{
+			interface_uid   = 0x10207236;  // common UID for all GS plugins
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid  = 0x2001E63A;  // impl uid
+					version_no          = 1;
+					display_name        = "Internet communications settings";
+					default_data        = "0x10283341"; // Parent UID (admin plugin)
+					opaque_data         = "7"; // Order number
+					}
+				};
+			}
+		};
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscgsplugin/data/cscgspluginrsc.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,49 @@
+/*
+* 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:  Resource file for cscgsplugin.
+*
+*/
+
+
+NAME GSIS
+
+#include <csc.loc>
+#include <uikon.rh>
+#include <data_caging_paths_strings.hrh>
+
+
+//----------------------------------------------------
+//
+//
+//    Needed or loading the resource fails!
+//
+//----------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+//----------------------------------------------------
+//
+//    r_csc_gsplugin_caption
+//    Plugin caption.
+//
+//----------------------------------------------------
+//
+RESOURCE TBUF r_cscgsplugin_caption
+    {
+    // from csc.loc
+    buf = qtn_set_folder_conn_service_configurator;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscgsplugin/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 cscgsplugin.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+cscgsplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscgsplugin/group/cscgsplugin.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,74 @@
+/*
+* 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:  Project specification file for cscgsplugin.
+*
+*/
+
+
+#include <data_caging_paths.hrh>    //this is needed for RESOURCE_FILES_DIR
+#include <platform_paths.hrh>
+
+CAPABILITY          CAP_ECOM_PLUGIN
+TARGET              cscgsplugin.dll
+TARGETTYPE          PLUGIN
+UID 0x10009D8D 0x2001E639
+VENDORID            VID_DEFAULT
+
+SOURCEPATH          ../src
+SOURCE              cscgsplugin.cpp
+SOURCE              cscgspluginimplementationtable.cpp
+
+USERINCLUDE         ../data
+USERINCLUDE         ../inc
+USERINCLUDE         ../../cscengine/inc
+USERINCLUDE         ../../cscapplicationui/inc
+
+SYSTEMINCLUDE       .
+SYSTEMINCLUDE       /epoc32/include/cshelp
+SYSTEMINCLUDE       /epoc32/include/ecom
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH          ../data
+
+//ECOM resource definition
+START RESOURCE      2001E639.rss
+TARGET              cscgsplugin.rsc
+TARGETPATH          ECOM_RESOURCE_DIR
+END                 //  ECOM resource definition
+
+START RESOURCE      cscgspluginrsc.rss
+HEADER
+TARGETPATH          RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END 
+
+LIBRARY             apparc.lib
+LIBRARY             avkon.lib
+LIBRARY             bafl.lib
+LIBRARY             commonengine.lib // RConeResourceLoader
+LIBRARY             cone.lib
+LIBRARY             ecom.lib
+LIBRARY             efsrv.lib
+LIBRARY             egul.lib
+LIBRARY             eikcoctl.lib
+LIBRARY             eikcore.lib
+LIBRARY             euser.lib
+LIBRARY             featmgr.lib
+LIBRARY             gsecomplugin.lib
+LIBRARY             gsframework.lib // Base classes
+LIBRARY             ws32.lib
+LIBRARY             aknskins.lib // AknsUtils.h
+LIBRARY             apgrfx.lib // RApaLsSession
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscgsplugin/inc/cscgsplugin.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,196 @@
+/*
+* 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:  cscgsplugin implementation.
+*
+*/
+
+
+#ifndef C_CSCGSPLUGIN_H
+#define C_CSCGSPLUGIN_H
+
+#include <AknServerApp.h>
+#include <ConeResLoader.h>
+#include <gsplugininterface.h>
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include "apadoc.h"
+#endif
+
+class CAknNullService;
+
+
+class TAppInfo
+    {
+    public:
+        TAppInfo( TUid aUid, const TDesC& aFile )
+            : iUid( aUid ), iFile( aFile )
+            {}
+        TUid iUid;
+        TFileName iFile;
+    };
+
+
+/**
+ * Commsconfig GS plugin implementation. 
+ * Launches CSC application from control panel.
+ *
+ * @code
+ * @endcode
+ *
+ * @since S60 5.0
+ */
+class CCscGsPlugin : public CGSPluginInterface,
+                     public MAknServerAppExitObserver // Embedding
+    {
+    public: 
+
+        static CCscGsPlugin* NewL( TAny* aInitParams );
+
+        ~CCscGsPlugin();
+        
+        
+        // from base class CAknView
+
+        /**
+         * From CAknView.
+         *
+         * @since S60 v3.0
+         * @return The ID of view.
+         */
+        TUid Id() const;
+
+        
+        // from base class CGSPluginInterface
+
+        /**
+         * From CGSPluginInterface.
+         */
+        void GetCaptionL( TDes& aCaption ) const;
+        
+        /**
+         * From CGSPluginInterface.
+         */
+        TInt PluginProviderCategory() const;
+      
+        /**
+         * From CGSPluginInterface.
+         */
+        TGSListboxItemTypes ItemType();
+     
+        /**
+         * From CGSPluginInterface.
+         */
+        void GetValue( 
+            const TGSPluginValueKeys aKey,
+            TDes& aValue );
+
+        /**
+         * From CGSPluginInterface.
+         */
+        void HandleSelection( const TGSSelectionTypes aSelectionType );
+        
+        /**
+         * From CGSPluginInterface.
+         */
+        CGulIcon* CreateIconL( const TUid aIconType );
+        
+        /**
+         * From CGSPluginInterface.
+         */
+        TBool Visible() const;
+
+    protected:
+
+
+        CCscGsPlugin();
+
+        void ConstructL();
+
+        
+        // from base class CAknView
+
+        /**
+         * From CAknView.
+         * Creates the Container class object.
+         *
+         * @param aPrevViewId is not used.
+         * @param aCustomMessageId is not used.
+         * @param aCustomMessage is not used.
+         */
+        void DoActivateL( 
+            const TVwsViewId& aPrevViewId,
+            TUid aCustomMessageId,
+            const TDesC8& aCustomMessage );
+
+        /**
+         * From CAknView.
+         * Deletes the Container class object.
+         *
+         */
+        void DoDeactivate();
+
+    private:
+
+        /**
+         * Opens localized resource file.
+         *
+         * @since S60 5.0
+         * @param aResourceFileName resource file name
+         * @param aResourceLoader resource loader
+         */
+        void OpenLocalizedResourceFileL(
+            const TDesC& aResourceFileName,
+            RConeResourceLoader& aResourceLoader );
+
+        /**
+         * Launches csc application.
+         *
+         * @since S60 5.0
+         */
+        void LaunchCscAppL();
+        
+        
+        /**
+         * Launches application as embedded.
+         * 
+         * @since S60 5.0
+         */
+        void EmbedAppL( const TAppInfo& aApp );
+        
+    protected:
+
+        /**
+         * Resource laoder.
+         * Own.
+         */
+        RConeResourceLoader iResources;
+        
+        /**
+         * Nullservice.
+         * Own.
+         */
+        CAknNullService* iNullService;
+        
+        /**
+         * ApaDocument.
+         * Own.
+         */
+        CApaDocument* iEmbedded;
+        
+#ifdef _DEBUG
+    friend class ut_cscgsplugin;
+#endif 
+    };
+
+#endif // C_CSCGSPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscgsplugin/src/cscgsplugin.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,280 @@
+/*
+* 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:  cscgsplugin implementation.
+*
+*/
+
+
+#include <featmgr.h>
+#include <bautils.h>
+#include <gscommon.hrh>
+#include <bldvariant.hrh>
+#include <StringLoader.h>
+#include <AknNullService.h>
+#include <gsparentplugin.h>
+#include <cscgspluginrsc.rsg>
+#include <gsprivatepluginproviderids.h>
+
+#include    "cscgsplugin.h"
+
+const TUid KCscGsPluginImplUid  = { 0x1020E568 };  // dll impl uid
+const TUid KCscAppUid           = { 0x10275458 };  // from cscappui.mmp
+
+_LIT( KCscApp, "z:\\sys\\bin\\csc.exe" );
+_LIT( KCscGsPluginResourceFileName, "cscgspluginrsc.rsc" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCscGsPlugin::CCscGsPlugin()
+    : iResources( *iCoeEnv ), iNullService(NULL)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCscGsPlugin::~CCscGsPlugin()
+    {
+    FeatureManager::UnInitializeLib(); 
+    iResources.Close();
+    delete iNullService;
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCscGsPlugin::ConstructL()
+    {
+    FeatureManager::InitializeLibL(); 
+    OpenLocalizedResourceFileL( KCscGsPluginResourceFileName, iResources );
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCscGsPlugin* CCscGsPlugin::NewL( TAny* /*aInitParams*/ )
+    {
+    CCscGsPlugin* self = new ( ELeave ) CCscGsPlugin();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CAknView.
+// CCscGsPlugin::Id()
+// ---------------------------------------------------------------------------
+//
+TUid CCscGsPlugin::Id() const
+    {
+    return KCscGsPluginImplUid;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CAknView.
+// CCscGsPlugin::DoActivateL()
+// ---------------------------------------------------------------------------
+//
+void CCscGsPlugin::DoActivateL( 
+    const TVwsViewId& /*aPrevViewId*/,
+    TUid /*aCustomMessageId*/,
+    const TDesC8& /*aCustomMessage*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From class CAknView.
+// CCscGsPlugin::DoDeactivate()
+// ---------------------------------------------------------------------------
+//
+void CCscGsPlugin::DoDeactivate()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From class CGSPluginInterface.
+// CCscGsPlugin::GetCaptionL()
+// ---------------------------------------------------------------------------
+//
+void CCscGsPlugin::GetCaptionL( TDes& aCaption ) const
+    {
+    HBufC* result = StringLoader::LoadL( R_CSCGSPLUGIN_CAPTION );
+    
+    if ( result->Des().Length() < aCaption.MaxLength() )
+        {
+        aCaption.Copy( *result );
+        }
+    else
+        {
+        aCaption = KNullDesC;
+        }
+   
+    delete result;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CGSPluginInterface.
+// CCscGsPlugin::PluginProviderCategory()
+// ---------------------------------------------------------------------------
+//
+TInt CCscGsPlugin::PluginProviderCategory() const
+    {
+    return KGSPluginProviderInternal;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CGSPluginInterface.
+// CCscGsPlugin::ItemType()
+// ---------------------------------------------------------------------------
+//
+TGSListboxItemTypes CCscGsPlugin::ItemType()
+    {
+    return EGSItemTypeSettingDialog;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CGSPluginInterface.
+// CCscGsPlugin::GetValue()
+// ---------------------------------------------------------------------------
+//
+void CCscGsPlugin::GetValue( 
+    const TGSPluginValueKeys /*aKey*/,
+    TDes& /*aValue*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From class CGSPluginInterface.
+// CCscGsPlugin::HandleSelection()
+// ---------------------------------------------------------------------------
+//
+void CCscGsPlugin::HandleSelection(
+    const TGSSelectionTypes /*aSelectionType*/ )
+    {
+    TRAP_IGNORE( LaunchCscAppL() );
+    }
+
+// ---------------------------------------------------------------------------
+// From class CGSPluginInterface.
+// CCscGsPlugin::CreateIconL()
+// ---------------------------------------------------------------------------
+//
+CGulIcon* CCscGsPlugin::CreateIconL( const TUid /*aIconType*/ )
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CGSPluginInterface.
+// CCscGsPlugin::Visible()
+// ---------------------------------------------------------------------------
+//
+TBool CCscGsPlugin::Visible() const
+    {
+    TBool visible( ETrue );
+    TBool voipSupported( EFalse );
+    
+    // Im should be also checked from feature manager
+    TBool imSupported( EFalse ); 
+    
+    voipSupported = FeatureManager::FeatureSupported( 
+        KFeatureIdCommonVoip );
+    
+    // If both voip and im are not supported --> set plugin not visible
+    if ( !voipSupported && !imSupported )
+        {
+        visible = EFalse;
+        }
+    
+    return visible;
+    }
+
+// ---------------------------------------------------------------------------
+// CCscGsPlugin::OpenLocalizedResourceFile()
+// ---------------------------------------------------------------------------
+//
+void CCscGsPlugin::OpenLocalizedResourceFileL(
+    const TDesC& aResourceFileName,
+    RConeResourceLoader& aResourceLoader )
+    {
+    RFs fsSession;
+    User::LeaveIfError( fsSession.Connect() );
+    CleanupClosePushL(fsSession);
+
+    // Find the resource file:
+    TParse parse;
+    parse.Set( aResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL );
+    TFileName fileName( parse.FullName() );
+
+    // Get language of resource file:
+    BaflUtils::NearestLanguageFile( fsSession, fileName );
+
+    // Open resource file:
+    aResourceLoader.OpenL( fileName );
+
+    CleanupStack::PopAndDestroy(&fsSession);
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCscGsPlugin::LaunchCscAppL()
+// ---------------------------------------------------------------------------
+//
+void CCscGsPlugin::LaunchCscAppL()
+    {
+    // Get the correct application data
+    RWsSession ws;
+    CleanupClosePushL( ws );
+    User::LeaveIfError( ws.Connect() );
+
+    // Find the task with uid
+    TApaTaskList taskList( ws );
+    TApaTask task = taskList.FindApp( KCscAppUid );
+
+    if ( task.Exists() )
+        {
+        //Bring CSC to foreground.
+        task.BringToForeground();
+        }
+    else
+        {
+        //Launch csc application
+        TAppInfo app( KCscAppUid, KCscApp );
+        iEmbedded = NULL;
+        EmbedAppL( app );
+        }
+    CleanupStack::PopAndDestroy( &ws );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCscGsPlugin::EmbedAppL()
+// ---------------------------------------------------------------------------
+//
+void CCscGsPlugin::EmbedAppL( const TAppInfo& aApp )
+    {
+    // Launch settings app
+    if ( iNullService )
+        {
+        delete iNullService;
+        iNullService = NULL;
+        }
+    iNullService = CAknNullService::NewL( aApp.iUid, this );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscgsplugin/src/cscgspluginimplementationtable.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* 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:  cscgsplugin ecom implementation table.
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+
+#include "cscgsplugin.h"
+
+const TImplementationProxy KCscGsPluginImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 0x2001E63A, CCscGsPlugin::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = sizeof( KCscGsPluginImplementationTable )
+        / sizeof( TImplementationProxy );
+    return KCscGsPluginImplementationTable;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/bwins/cscsettingsuiu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,5 @@
+EXPORTS
+	?LaunchSettingsUiL@CCSCSettingsUi@@QBEXXZ @ 1 NONAME ; void CCSCSettingsUi::LaunchSettingsUiL(void) const
+	?NewL@CCSCSettingsUi@@SAPAV1@AAVCEikonEnv@@@Z @ 2 NONAME ; class CCSCSettingsUi * CCSCSettingsUi::NewL(class CEikonEnv &)
+	?InitializeL@CCSCSettingsUi@@QAEXABVTUid@@IPBVMCoeView@@@Z @ 3 NONAME ; void CCSCSettingsUi::InitializeL(class TUid const &, unsigned int, class MCoeView const *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/data/cscsettingsui.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,663 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSCSettingsUi
+*
+*/
+
+
+NAME CSCS
+
+#include <eikon.rh>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.loc>
+#include <cscsettingsui.loc>
+#include <csc.loc>
+
+#include "cscsettingsui.hrh"
+
+
+// -----------------------------------------------------------------------------
+//
+// Define the resource file signature 
+// This resource should be empty
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+// -----------------------------------------------------------------------------
+//
+// Default Document Name
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_default_document_name
+    {
+    buf="";
+    }
+
+// -----------------------------------------------------------------------------
+//
+// Define default menu and status pane
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE EIK_APP_INFO 
+    {
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_cscsettingsui_mainview_title
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_mainview_title
+    {
+    buf = qtn_voip_settings_title;
+    }
+
+
+// -----------------------------------------------------------------------------
+//
+// r_cscsettingsui_mainview_menubar
+// Menubar for CSCSettingsUi main view.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_cscsettingsui_mainview_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_cscsettingsui_mainview_menu;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_cscsettingsui_mainview_menu
+// Menu for CSCSettingsUi main view "Options".
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_cscsettingsui_mainview_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = ECSCSettingsUiChange;
+            txt = qtn_options_change;
+            flags = EEikMenuItemAction;
+            },
+        MENU_ITEM
+            {
+            command = ECSCSettingsUiOpen;
+            txt = qtn_options_open;
+            flags = EEikMenuItemAction;
+            },
+        MENU_ITEM
+            {
+            command = ECSCSettingsUiDelete;
+            txt = qtn_voip_csc_option_delete_service;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknSoftkeyExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_cscsettingsui_mainview
+// CSCSettingsUi main view resource.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_cscsettingsui_mainview
+    {
+    menubar = r_cscsettingsui_mainview_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    }
+
+//----------------------------------------------------
+//   
+//    r_cscsettingsui_softkeys_options_back_change
+//    Text association with MSK ( CHANGE )
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_cscsettingsui_softkeys_options_back_change
+    {
+    buttons =
+        {
+        CBA_BUTTON 
+            {
+            id=EAknSoftkeyOptions; 
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON 
+            {
+            id=EAknSoftkeyBack; 
+            txt = text_softkey_back; 
+            },
+        CBA_BUTTON 
+            {
+            id=ECSCMSKSettingsUiChange;
+            txt = qtn_msk_change;
+            }
+        };
+    }
+
+//----------------------------------------------------
+//   
+//    r_cscsettingsui_softkeys_options_back_open
+//    Text association with MSK ( OPEN )
+//
+//----------------------------------------------------
+//
+RESOURCE CBA r_cscsettingsui_softkeys_options_back_open
+    {
+    buttons =
+        {
+        CBA_BUTTON 
+            {
+            id=EAknSoftkeyOptions; 
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON 
+            {
+            id=EAknSoftkeyBack; 
+            txt = text_softkey_back; 
+            },
+        CBA_BUTTON 
+            {
+            id=ECSCSettingsUiOpen;
+            txt = qtn_msk_open;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_cscsettingsui_pres_pref_value_on
+// CSCSettingsUi setting item text when hen presence request preference has
+// autoaccpet invitations on.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_pres_pref_accept_automatically
+    {
+    buf = qtn_servtab_settings_auth_pres_value_off;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_cscsettingsui_pres_pref_automatically
+// CSCSettingsUi setting item text when hen presence request preference has
+// autoaccpet invitations off
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_pres_pref_always_ask
+    {
+    buf = qtn_servtab_settings_auth_pres_value_on;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_preferred_service_title
+//    CSCSettingsUi setting preferred service title
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_preferred_service_title
+   {
+   buf = qtn_voip_settings_voip_preferred_setting;
+   } 
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_vcc_preferred_service_title
+//    CSCSettingsUi setting preferred service title when vcc is supported
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_vcc_preferred_service_title
+   {
+   buf = qtn_servtab_settings_voip_preferred_setting;
+   }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_handover_notif_tone_title
+//    CSCSettingsUi setting handover notification tone title
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_handover_notif_tone_title
+   {
+   buf = qtn_servtab_settings_ho_notification_tone_setting;
+   }
+   
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_im_tone_title
+//    CSCSettingsUi setting im tone title
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_im_tone_title
+   {
+   buf = qtn_servtab_settings_im_tone_setting;
+   }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_username_title
+//    CSCSettingsUi setting username title
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_username_title
+   {
+   buf = qtn_servtab_settings_username_setting;
+   } 
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_password_title
+//    CSCSettingsUi setting password title
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_password_title
+   {
+   buf = qtn_servtab_settings_password_setting;
+   } 
+
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_preferred_service_on
+//    CSCSettingsUi setting preferred service on
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_preferred_service_on
+   {
+   buf = qtn_voip_setting_voip_pref_value_yes;
+   } 
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_preferred_service_off
+//    CSCSettingsUi setting preferred service off
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_preferred_service_off
+   {
+   buf = qtn_voip_setting_voip_pref_value_no;
+   } 
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_vcc_preferred_service_on
+//    CSCSettingsUi setting preferred service on when VCC is supported
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_vcc_preferred_service_on
+   {
+   buf = qtn_servtab_setting_vcc_preferred_value_yes;
+   }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_vcc_preferred_service_off
+//    CSCSettingsUi setting preferred service off when VCC is supported
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_vcc_preferred_service_off
+   {
+   buf = qtn_servtab_setting_vcc_preferred_value_no;
+   }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_handover_notif_tone_on
+//    CSCSettingsUi setting handover notification tone on
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_handover_notif_tone_on
+   {
+   buf = qtn_cp_setting_vcc_ho_notif_tone_on;
+   }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_setting_handover_notif_tone_off
+//    CSCSettingsUi setting handover notification tone off
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_setting_handover_notif_tone_off
+   {
+   buf = qtn_cp_setting_vcc_ho_notif_tone_off;
+   }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_handover_notification_tone_query
+//    CSCSettingsUi handover notification tone query
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_cscsettingsui_handover_notification_tone_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_SELECT_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtListQueryControl;
+            id = EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox = LISTBOX
+                    {
+                    // Listbox is constructed dynamically.
+                    };
+                heading = qtn_cp_setting_vcc_ho_notif_tone_title;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_presence_request_pref_query
+//    CSCSettingsUi presence request preference query
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_cscsettingsui_presence_request_pref_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_SELECT_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtListQueryControl;
+            id = EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox = LISTBOX
+                    {
+                    // Listbox is constructed dynamically.
+                    };
+                heading = qtn_servtab_settings_pres_pref_title;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_pref_service_setting_page
+//    CSCSettingsUi preferred service setting page
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_cscsettingsui_pref_service_setting_page
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    label = qtn_voip_setting_voip_preferred_title;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    type = EAknSetListBox;
+    editor_resource_id = r_setting_listbox;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_vcc_pref_service_setting_page
+//    CSCSettingsUi preferred service setting page
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_cscsettingsui_vcc_pref_service_setting_page
+    {
+    number = EAknSettingPageNoOrdinalDisplayed;
+    label = qtn_servtab_settings_vcc_preferred_title;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    type = EAknSetListBox;
+    editor_resource_id = r_setting_listbox;
+    }
+
+// ---------------------------------------------------------------------------
+//   
+//    r_cscsettingsui_username_setting_page
+//    CSCSettingsUi username setting page
+//
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_cscsettingsui_username_setting_page
+    {
+    label = qtn_servtab_setting_username_title;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL;
+    type = EEikCtEdwin;
+    editor_resource_id = r_cscsettingsui_username_setting_page_editor;
+    }
+
+// ---------------------------------------------------------------------------
+//   
+//    r_cscsettingsui_username_setting_page_editor
+//    CSCSettingsUi username setting page editor definition.
+//
+// ---------------------------------------------------------------------------
+//
+RESOURCE EDWIN r_cscsettingsui_username_setting_page_editor
+    {
+    default_case = EAknEditorLowerCase;
+    allowed_case_modes = EAknEditorAllCaseModes;
+    flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+    width = 25;
+    lines = 1;
+    maxlength = 100;
+    }
+
+// ---------------------------------------------------------------------------
+//   
+//    r_cscsettingsui_password_setting_page
+//    CSCSettingsUi password setting page
+//
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_cscsettingsui_password_setting_page
+    {
+    label = qtn_servtab_setting_password_title;
+    softkey_resource = R_AVKON_SOFTKEYS_OK_CANCEL;
+    type = EEikCtSecretEd;
+    editor_resource_id = r_cscsettingsui_password_setting_page_editor;
+    }
+
+// ---------------------------------------------------------------------------
+//   
+//    r_cscsettingsui_password_setting_page_editor
+//    CSCSettingsUi password setting page editor definition.
+//
+// ---------------------------------------------------------------------------
+//
+RESOURCE SECRETED r_cscsettingsui_password_setting_page_editor
+    {
+    num_letters = 50;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_edit_service_connectivity_title
+//    CSCSettingsUi service connectivity query title text.
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE TBUF r_cscsettingsui_edit_service_connectivity_title
+   {
+   buf = qtn_voip_settings_edit_service_connectivity_title;
+   }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_service_connectivity_text
+//    CSCSettingsUi service connectivity setting item text.
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE TBUF r_cscsettingsui_service_connectivity_text
+   {
+   buf = qtn_servtab_settings_connectivity_setting;
+   }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_conserted_service_connectivity_text
+//    CSCSettingsUi conserted service connectivity setting item text.
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE TBUF r_cscsettingsui_conserted_service_connectivity_text
+   {
+   buf = qtn_voip_settings_conserted_service_connectivity;
+   }
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_presence_request_pref_text
+//    CSCSettingsUi presence request preference setting item text
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE TBUF r_cscsettingsui_presence_request_pref_text
+   {
+   buf = qtn_servtab_settings_pres_pref_setting;
+   } 
+
+// -----------------------------------------------------------------------------
+//
+//    r_cscsettingsui_edit_settings_text
+//    CSCSettingsUi edit settings setting item text.
+//
+// -----------------------------------------------------------------------------
+//
+
+RESOURCE TBUF r_cscsettingsui_edit_settings_text
+   {
+   buf = qtn_voip_settings_edit_service_settings;
+   }
+
+// -----------------------------------------------------------------------------
+//
+// r_cscsettingsui_unable_to_edit_setting_note
+// Unable to edit setting note text.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_unable_to_edit_setting_note
+    {
+    buf = qtn_voip_unable_to_edit_setting_note;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_cscsettingsui_unable_to_edit_while_online
+// Unable to edit setting note text.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_unable_to_edit_while_online
+    {
+    buf = qtn_servtab_setting_unable_to_edit_while_online;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_cscsettingsui_no_im_tone_text
+// Listbox text for chat alert tone if no tone selected.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_im_tone_off
+    {
+    buf = qtn_servtab_settings_im_tone_off;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_cscsettingsui_no_im_tone_text
+// No tone selected item text for im tone selection list
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_no_im_tone_text
+    {
+    buf = qtn_servtab_settings_no_im_tone_text;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_cscsettingsui_im_tone_popup_heading
+// Title text for chat alert tone selection list.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_cscsettingsui_im_tone_popup_heading
+    {
+    buf = qtn_servtab_settings_im_tone_popup_heading;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_setting_listbox
+// Common listbox editor resource for setting pages.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_setting_listbox
+    {
+    flags = EEikListBoxMultipleSelection;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/eabi/cscsettingsuiu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,5 @@
+EXPORTS
+	_ZN14CCSCSettingsUi11InitializeLERK4TUidjPK8MCoeView @ 1 NONAME
+	_ZN14CCSCSettingsUi4NewLER9CEikonEnv @ 2 NONAME
+	_ZNK14CCSCSettingsUi17LaunchSettingsUiLEv @ 3 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSCSettingsUi
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/cscsettingsui.loc APP_LAYER_LOC_EXPORT_PATH( cscsettingsui.loc )
+
+PRJ_MMPFILES
+cscsettingsui.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/group/cscsettingsui.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSCSettingsUi
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET            cscsettingsui.dll
+TARGETTYPE        dll
+UID               0x1000008D 0x10282EF5
+
+CAPABILITY        CAP_GENERAL_DLL NetworkControl
+VENDORID          VID_DEFAULT
+
+SOURCEPATH        ../src
+SOURCE            cscsettingsui.cpp
+SOURCE            cscsettingsuiimpl.cpp
+SOURCE            cscsettingsuimodel.cpp
+SOURCE            cscsettingsuimainview.cpp
+SOURCE            cscsettingsuimaincontainer.cpp
+
+START RESOURCE   ../data/cscsettingsui.rss
+HEADER
+TARGETPATH        RESOURCE_FILES_DIR
+TARGET            cscsettingsui.rsc
+LANGUAGE_IDS
+END  // RESOURCE
+
+USERINCLUDE       ../inc
+USERINCLUDE       ../../../inc
+USERINCLUDE       ../../cscengine/inc
+USERINCLUDE       ../../cscapplicationui/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY           cone.lib
+LIBRARY           bafl.lib 
+LIBRARY           avkon.lib
+LIBRARY           euser.lib 
+LIBRARY           efsrv.lib
+LIBRARY           eikctl.lib
+LIBRARY           fbscli.lib
+LIBRARY           eikdlg.lib
+LIBRARY           hlplch.lib
+LIBRARY           eikcore.lib
+LIBRARY           eikcdlg.lib
+LIBRARY           featmgr.lib
+LIBRARY           eikcoctl.lib
+LIBRARY           mediafilelist.lib 
+LIBRARY           aknnotify.lib 
+LIBRARY           cmmanager.lib
+LIBRARY           cscengine.lib
+LIBRARY           platformenv.lib 
+LIBRARY           commonengine.lib 
+LIBRARY           vimpstsettings.lib  // for IM tone path 
+LIBRARY           xspviewservices.lib
+LIBRARY           ecom.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/inc/cscsettingsui.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSCSettingsUi
+*
+*/
+
+
+#ifndef CSCSETTINGSUI_HRH
+#define CSCSETTINGSUI_HRH
+
+// CSCSettingsUi menu commands.
+enum TCSCSettingsUiMenuCommands
+    {
+    ECSCSettingsUiChange = 99,
+    ECSCSettingsUiOpen,
+    ECSCMSKSettingsUiChange,
+    ECSCSettingsUiDelete
+    };
+    
+// CSCSettingsUi preferred service setting list values.
+enum TCSCSettingsInternetPref
+	{
+	ECSCSettingsPrefServiceOn = 0,
+	ECSCSettingsPrefServiceOff
+	};
+
+#endif  // CSCSETTINGSUI_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/inc/cscsettingsuiconstants.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Constants for CSCSettingsUi
+*
+*/
+
+
+#ifndef CSCSETTINGSUICONSTANTS_H
+#define CSCSETTINGSUICONSTANTS_H
+
+// View Ids.
+const TUid KCSCSettingsUiMainViewId        = { 1928 }; // main view
+
+// Resource file location.
+_LIT( KCSCSettingsUiResourceFile, "cscsettingsui.rsc" );  // file
+
+// Default IM message ton
+_LIT( KDefaultTone, "Z:\\Data\\Sounds\\Digital\\Message 2.aac" );
+
+
+// Lengths & sizes.
+const TInt KCSCSettingsUiItemLength = 128;               // setting item
+const TInt KCSCSettingsUiArrayGranularity = 5;          // granularity
+const TInt KCSCSettingsUiBrandingIdLength = 512;        // branding id          
+const TInt KCSCMaxImToneLength = 512;                   // im tone
+
+
+#endif  // CSCSETTINGSUICONSTANTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/inc/cscsettingsuidialog.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,165 @@
+/*
+* 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:  Declarition of CSCSettingsUiDialog
+*
+*/
+
+
+#ifndef C_CSCSETTINGSUIDIALOG_H
+#define C_CSCSETTINGSUIDIALOG_H
+
+class CAknGlobalNote;
+class CAknGlobalMsgQuery;
+class MCSCSettingsUiDialogObserver;
+    
+/**
+ *  CCSCSettingsUiDialog class
+ *  Declarition of CCSCSettingsUiDialog.
+ *
+ *  @lib CSCSettingsUi.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCSettingsUiDialog ) : public CActive
+    {
+    public:
+                
+        /**
+         * Two-phased constructor.
+         * @param aObserver settings ui dialog observer
+         */
+        static CCSCSettingsUiDialog* NewL(
+            MCSCSettingsUiDialogObserver& aObserver );
+
+
+        /**
+         * Two-phased constructor.
+         * @param aObserver settings ui dialog observer
+         */
+        static CCSCSettingsUiDialog* NewLC(
+            MCSCSettingsUiDialogObserver& aObserver );
+        
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCSettingsUiDialog();
+    
+        
+        /**
+         * Launches a service information message query.
+         *
+         * @since S60 v3.2
+         * @param aUsername for protocol profile username
+         * @param aDomain for protocol profile domain
+         * @param aAddress for connected address
+         * @param aSsid for connected network
+         * @param aMac for WLAN MAC address
+         * @param aDisabled ETrue if service is disabled
+         */
+        void LaunchMessageQueryL(
+            const TDesC& aUsername,
+            const TDesC& aDomain,
+            const TDesC& aAddress,
+            const TDesC& aSsid,
+            const TDesC& aMac,
+            TBool aDisabled );
+        
+        
+        /**
+         * Destroys a service information message query.
+         *
+         * @since S60 v3.2
+         */
+        void DestroyMessageQuery();
+        
+    protected:
+
+        // from base class CActive
+   
+        /**
+         * @see CActive.
+         */
+        void RunL();
+
+
+        /**
+         * @see CActive.
+         */
+        void DoCancel();
+        
+    private:
+
+        CCSCSettingsUiDialog( MCSCSettingsUiDialogObserver& aObserver );
+
+        void ConstructL();
+        
+        
+        /**
+         * Creates text for service information message query.
+         *
+         * @since S60 v3.2
+         * @param aText for service information text
+         * @param aUsername for protocol profile username
+         * @param aDomain for protocol profile domain
+         * @param aAddress for connected address
+         * @param aSsid for connected network
+         * @param aMac for WLAN MAC address
+         * @param aDisabled ETrue if service is disabled
+         */
+        void CreateTextForMsgQueryL( 
+            HBufC* aText,
+            const TDesC& aUsername,
+            const TDesC& aDomain,
+            const TDesC& aAddress,
+            const TDesC& aSsid,
+            const TDesC& aMac,
+            TBool aDisabled ) const;
+            
+        
+        /**
+         * Creates an item for service information message query.
+         *
+         * @since S60 v3.2
+         * @param aText for service information text
+         * @param aItem for setting item text
+         * @param aAdditionalValue for additional setting item value
+         * @param aData for setting item value
+         */
+        void CreateItemToMsgQuery( 
+            HBufC* aText,
+            HBufC* aItem,
+            HBufC* aAdditionalValue,
+            const TDesC& aData ) const;
+                
+    private: // Data  
+
+        /**
+         * Reference to settings ui dialog observer.
+         */
+         MCSCSettingsUiDialogObserver& iObserver;
+                        
+        /**
+         * A global message query for service information.
+         * Own.
+         */
+        CAknGlobalMsgQuery* iMsgQuery;
+        
+        /**
+         * Global note Id
+         */
+        TInt iNoteId;
+        
+     };
+
+#endif // C_CSCSETTINGSUIDIALOG_H  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/inc/cscsettingsuiimpl.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declarition of CSCSettingsUiImpl
+*
+*/
+
+
+
+#ifndef C_CSCSETTINGSUIIMPL_H
+#define C_CSCSETTINGSUIIMPL_H
+
+#include "mcscsettingsuimodelobserver.h"
+
+class CEikonEnv;
+class CCSCSettingsUiModel;
+class CCSCSettingsUiMainView;
+class MCoeView;
+
+
+/**
+*  CCSCSettingsUiImpl class
+*  Declarition of CSCSettingsUiImpl.
+*
+*  @lib CSCSettingsUi.lib
+*  @since S60 v3.2
+*/
+NONSHARABLE_CLASS( CCSCSettingsUiImpl ) : public CBase,
+				                          public MCSCSettingsUiModelObserver
+    {
+    public:
+
+        /**
+         * Two-phased constructor.
+         */
+        static CCSCSettingsUiImpl* NewL( CEikonEnv& aEikEnv );
+        
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCSettingsUiImpl();
+       
+
+        /**
+         * Initializes CSC settings UI.
+         * @param   aReturnViewId   Identifier of the view where to return with 
+         *                          "back" key.
+         * @param   aServiceId      Service settings entry identifier.
+         * @param   aDefaultAppView The view to set as the default for utilizing
+         *                          application. If NULL, settings ui view
+         *                          is set as the default view for the 
+         *                          application.
+         * @since   S60 v5.1
+         */
+        void InitializeL( 
+            const TUid& aReturnViewId, 
+            TUint aServiceId,
+            const MCoeView* aDefaultAppView );
+        
+        
+        /**
+         * Launches Converged Service Configurator Settings UI with parameters
+         * given at initialization. 
+         * 
+         * @since    S60 v3.2
+         */
+        void LaunchSettingsUiL();
+
+        
+        /**
+         * From MCSCSettingsUiModelObserver.
+         */
+        void UpdateSoftkeys() const;
+        
+        
+        /**
+         * Returns reference counter.
+         *
+         * @since S60 5.0
+         */
+        TInt& ReferenceCounter();
+
+        
+    private:
+
+        CCSCSettingsUiImpl(
+            CEikonEnv& aEikEnv );
+
+        void ConstructL();
+            
+    private: // data
+                
+        /**
+         * Reference to Eikon environment.
+         */
+        CEikonEnv& iEikEnv;
+        
+        /**
+         * Resource file offset.
+         */
+        TInt iResourceOffset;
+        
+        /**
+         * Main view.
+         * Not own.
+         */
+        CCSCSettingsUiMainView* iMainView;
+        
+        /**
+         * Model
+         * Own.
+         */
+        CCSCSettingsUiModel* iModel;
+        
+        /**
+         * Reference counter ie. how many instances created
+         */    
+        TInt iReferenceCounter;
+        
+#ifdef _DEBUG
+    friend class UT_cscsettingsui;
+#endif        
+        
+    };
+
+#endif // C_CSCSETTINGSUIIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/inc/cscsettingsuilogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,70 @@
+/*
+* 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:  Provides macros for logging
+*
+*/
+
+
+#ifndef CSCSETTINGSUILOGGER_H
+#define CSCSETTINGSUILOGGER_H
+
+#include <e32def.h>
+#include <e32debug.h>
+
+
+//----------------------------------------------------------------------------
+//  USER LOGGING SETTINGS
+//----------------------------------------------------------------------------
+
+#ifndef _DEBUG
+
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = RDebug
+***************************/ 
+
+#define CSCSETUI_DEBUG             0   // UREL BUILD
+
+#else
+
+#define CSCSETUI_DEBUG             1   // UDEB BUILD
+
+#endif // _DEBUG
+
+
+
+//----------------------------------------------------------------------------
+//  LOGGING MACROs (DO NOT EDIT)
+//
+//  USE THESE MACROS IN YOUR CODE
+//----------------------------------------------------------------------------
+
+#if CSCSETUI_DEBUG == 1    // RDebug
+
+#define CSCSETUIDEBUG(AA)           { RDebug::Print(_L(AA)); }
+#define CSCSETUIDEBUG2(AA,BB)       { RDebug::Print(_L(AA),BB); }
+#define CSCSETUIDEBUG3(AA,BB,CC)    { RDebug::Print(_L(AA),BB,CC); }
+#define CSCSETUIDEBUG4(AA,BB,CC,DD) { RDebug::Print(_L(AA),BB,CC,DD); }
+
+#else   // CSCSETUI_DEBUG == 0 or invalid -> Disable loggings
+
+#define CSCSETUIDEBUG(AA)          
+#define CSCSETUIDEBUG2(AA,BB)     
+#define CSCSETUIDEBUG3(AA,BB,CC)    
+#define CSCSETUIDEBUG4(AA,BB,CC,DD) 
+
+#endif  // CSCSETUI_DEBUG
+
+#endif  // CSCSETTINGSUILOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/inc/cscsettingsuimaincontainer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,316 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declarition of CSCSettingsUiMainContainer
+*
+*/
+
+
+#ifndef C_CSCSETTINGSUIMAINCONTAINER_H
+#define C_CSCSETTINGSUIMAINCONTAINER_H
+
+#include "mcscengserviceobserver.h"
+#include "mcscengprovisioningobserver.h"
+
+class CCSCSettingsUiModel;
+class CAknSettingStyleListBox;
+class MCSCEngServiceObserver;
+class MCSCEngProvisioningObserver;
+
+/**
+ *  TListBoxItem class
+ *
+ *  @lib CSCSettingsUi.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( TMainListBoxItem )
+    {
+    public:
+    
+        /** Enumeration of setting items **/
+        enum TSettingItems
+            {
+            EUsername = 0,
+            EPassword,
+            EPreferredService,
+            EVccPreferredService,
+            EHandoverNotifTone,
+            EImTone,
+            EAutoacceptInv,
+            EServiceConn
+            };
+        
+        /**
+         * Constructor.
+         *
+         * @since S60 3.2
+         */
+        TMainListBoxItem()
+            : iItem( EUsername )
+            {}
+
+    public: // data
+
+        /**
+         * Listbox item
+         */
+        TSettingItems iItem;
+    };
+
+/**
+ *  CCSCSettingsUiMainContainer class
+ *  Declarition of CCSCSettingsUiMainContainer.
+ *
+ *  @lib CSCSettingsUi.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCSettingsUiMainContainer ) : public CCoeControl
+    {
+public:
+
+    CCSCSettingsUiMainContainer(
+        CCSCSettingsUiModel& aModel );
+    void ConstructL( const TRect& aRect );
+    virtual ~CCSCSettingsUiMainContainer();
+
+    /**
+     * Updates container and redraws listbox items.
+     *
+     * @since S60 v3.2
+     */
+    void UpdateContainerL();
+
+    /**
+     * Shows a query which changes handover notification tone setting
+     *
+     * @since S60 v5.0
+     */
+    void HandoverNotificationToneQueryL();
+
+    /**
+     * Shows a query which changes presence request preference
+     *
+     * @since S60 v3.2
+     */
+    void PresenceReqPrefQueryL();
+
+    /**
+     * For saving IM tone path to service tab storage.
+     *
+     * @param aTonePath tone path to be saved.
+     * @since S60 v5.0
+     */
+    void SaveImTonePathL( const TDesC& aTonePath );
+
+    /**
+     * Returns handle to the listbox.
+     *
+     * @since S60 v3.2
+     * @return handle to the listbox
+     */        
+    CAknSettingStyleListBox* ListBox();
+
+    /**
+     * Returns selected list box item
+     *
+     * @since S60 v3.2
+     * @return selected list box item
+     */
+    TMainListBoxItem CurrentItem() const;
+
+    /**
+     * Deletes the service in hand.
+     *
+     * @since S60 v5.2
+     */
+    TBool DeleteServiceL();
+
+    /**
+     * Launches cleanup plugin to remove settings.
+     *
+     * @since S60 v5.2
+     * @param aServiceId ID of service to be removed.
+     */ 
+    void LaunchCleanupPluginL( TUint aServiceId ) const;
+
+// from base class CCoeControl
+
+    /**
+     * From CCoeControl.
+     */ 
+    CCoeControl* ComponentControl( TInt aIndex ) const;
+
+    /**
+     * From CCoeControl.
+     */
+    TKeyResponse OfferKeyEventL( 
+        const TKeyEvent& aKeyEvent, 
+        TEventCode aType );
+
+    /**
+     * From CCoeControl.
+     */ 
+    void HandleResourceChange( TInt aType );
+
+private:
+    
+    /**
+     * Creates listbox item for setting items.
+     *
+     * @since S60 v3.2
+     */
+    void ConstructListBoxL();
+
+    /**
+     * Return caption for setting item.
+     *
+     * @since S60 v3.2
+     * @param aItem for setting list item to be constructed
+     * @return setting item caption
+     */
+    HBufC* GetCaptionL( TMainListBoxItem::TSettingItems aItem );
+
+    /**
+     * Get username.
+     *
+     * @since S60 v5.0
+     * @param aUsername username is set to this. 
+     */
+    void GetUsernameL( RBuf& aUsername );
+
+    /**
+     * Get preferred service setting.
+     *
+     * @since S60 v5.0
+     * @param aValue presence pref setting value is stored to this.
+     */
+    void GetPreferredServiceSettingL( RBuf& aValue );
+
+    /**
+     * Get preferred service setting when VCC is supported.
+     *
+     * @since S60 v5.0
+     * @param aValue presence pref setting value is stored to this.
+     */
+    void GetVccPreferredServiceSettingL( RBuf& aValue );
+
+    /**
+     * Get handover notification tone setting.
+     *
+     * @since S60 v5.0
+     * @param aValue handover notification tone setting value is stored 
+     * to this.
+     */
+    void GetHandoverNotificationTonePrefL( RBuf& aValue );
+
+    /**
+     * Get precence preferred setting.
+     *
+     * @since S60 v5.0
+     * @param aValue presence pref setting value is stored to this.
+     */
+    void GetPresencePrefSettingL( RBuf& aValue );
+
+    /**
+     * Get IM message tone setting.
+     *
+     * @since S60 v5.0
+     * @param aValue im tone setting value is stored to this.
+     */
+    void GetImToneSettingL( RBuf& aValue );
+
+    /**
+     * Get SNAP settings.
+     *
+     * @since S60 v5.0
+     * @param aValue snap setting value is stored to this.
+     */
+    void GetSnapSettingL( RBuf& aValue );
+
+    /**
+     * Draws setting items at the first time 
+     * after the initialization is completed.
+     *
+     * @since S60 v3.2
+     */
+    void InitializeSettingItemsL();
+
+    /**
+     * Constructs setting list items.
+     *
+     * @since S60 v3.2
+     * @param aItem for setting list item to be constructed
+     */
+    void MakeSettingItemL( TMainListBoxItem::TSettingItems aItem );
+
+    /**
+     * Cleanup RImplInfoPtrArray
+     *
+     * @since S60 v5.2
+     * @param aArray Array to be destroyed.
+     */
+     static void ResetAndDestroy( TAny* aArray );
+
+// from base class CCoeControl
+
+    /**
+     * From CCoeControl.
+     */
+    TInt CountComponentControls() const;
+
+    /**
+     * From CCoeControl
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+    /**
+     * From CCoeControl.
+     */
+    void SizeChanged();
+
+    /**
+     * From CoeControl.
+     */        
+    void FocusChanged( TDrawNow aDrawNow );
+
+private:  // data
+
+    /**
+     * Reference to model class for settings handling.
+     */
+    CCSCSettingsUiModel& iModel;
+
+    /**
+     * Listbox for main view setting page items.
+     * Own.
+     */
+    CAknSettingStyleListBox* iListBox;    
+
+    /**
+     * Listbox item array
+     */
+    RArray<TMainListBoxItem> iListBoxItemArray;
+
+    /**
+     * Setting item caption
+     */
+    HBufC* iCaption;
+
+#ifdef _DEBUG
+    friend class UT_cscsettingsui;
+#endif        
+
+    };
+
+#endif // C_CSCSETTINGSUIMAINCONTAINER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/inc/cscsettingsuimainview.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,286 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declatirion of CSCSettingsUiMainView
+*
+*/
+
+
+#ifndef C_CSCSETTINGSUIMAINVIEW_H
+#define C_CSCSETTINGSUIMAINVIEW_H
+
+class CCSCSettingsUiModel;
+class CAknRadioButtonSettingPage;
+
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+#include "cscsettingsuimaincontainer.h"
+
+/**
+ *  CCSCSettingsUiMainView class
+ *  Declarition of CCSCSettingsUiMainView.
+ *
+ *  @lib CSCSettingsUi.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCSettingsUiMainView ) : public CAknView,
+                                              public MEikListBoxObserver
+    {
+public: 
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aModel for reference to the model
+     */
+    static CCSCSettingsUiMainView* NewL( 
+        CCSCSettingsUiModel& aModel );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aModel for reference to the model
+     */
+    static CCSCSettingsUiMainView* NewLC( 
+        CCSCSettingsUiModel& aModel );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCSCSettingsUiMainView();
+
+    /**
+     * Processes situation when softkeys need to be changed.
+     *
+     * @since S60 v3.2
+     */
+    void UpdateSoftkeysL();
+
+    /**
+     * Resets service settings when switching services.
+     * 
+     * @since S60 v5.2
+     */
+    void ResetViewL();
+
+// from base class CAknView
+
+    /**
+     * From CAknView.
+     */
+    TUid Id() const;
+
+private:
+
+    CCSCSettingsUiMainView(
+        CCSCSettingsUiModel& aModel );
+    void ConstructL();
+
+    /**
+     * Changes given service name to title pane.
+     *
+     * @since S60 v3.2
+     */   
+    void SetTitleTextL();
+
+    /**
+     * For checking if editing of preferred service setting is allowed
+     *
+     * @since S60 v3.2
+     * @return ETrue if editing allowed
+     */
+    TBool IsEditPreferredServiceSettingAllowedL();
+
+    /**
+     * Shows preferred service setting page.
+     *
+     * @since S60 v5.0
+     */ 
+    void ShowUsernameSettingPageL();
+
+    /**
+     * Shows preferred service setting page.
+     *
+     * @since S60 v3.2
+     */ 
+    void ShowPasswordSettingPageL();        
+
+    /**
+     * Shows preferred service setting page.
+     *
+     * @since S60 v3.2
+     */ 
+    void ShowPrefServiceSettingPageL();
+
+    /**
+     * Shows preferred service setting page when VCC is supported.
+     *
+     * @since S60 v5.0
+     */ 
+    void ShowVccPrefServiceSettingPageL();
+
+    /**
+     * Shows IM tone selection list.
+     *
+     * @since S60 v5.0
+     */ 
+    void ShowImToneSelectionListL();
+
+    /**
+     * Handles 'change' middle softkey selection.
+     * 
+     * @param aListBoxItem listbox item
+     * @since S60 v5.0
+     */ 
+    void HandleMskChangeSelectionL( TMainListBoxItem aListBoxItem );
+
+    /**
+     * Changes preferred telephony setting value.
+     * From VoIP(PS) to CS or vice versa.
+     * @since S60 v3.2
+     */ 
+    void ChangePrefTelephonyValueL();
+
+    /**
+     * Changes handover notify tone value (on/off).
+     * @since S60 v5.0
+     */ 
+    void ChangeHandoverNotifToneValueL();
+
+    /**
+     * Appends resource texts to the des array.
+     *
+     * @since S60 v3.2
+     * @param aList Text array.
+     * @param aItem Text resource id.
+     */ 
+    void AppendItemL(CDesCArrayFlat& aList, TInt aItem);
+
+    /**
+     * Launches Connection Method Settings Ui for editing destinations.
+     *
+     * @since S60 v5.0
+     */   
+    void LaunchCMSettingsUiL();
+
+    /**
+     * Handles returning to previous view where settingsui was launced.
+     *
+     * @since S60 v5.0
+     */
+    void HandleReturnToPreviousViewL( TBool aViewBack = ETrue );
+
+    /**
+     * Handles exist from settingsui.
+     *
+     * @since S60 v5.0
+     */
+    void HandleSettingsUiExitL();
+
+// from base class CEikAppUi
+
+    /**
+     * From CEikAppUi.
+     */
+    void HandleCommandL( TInt aCommand );
+
+// from base class CAknView
+
+    /**
+     * From CAknView.
+     */
+    void DoActivateL( 
+        const TVwsViewId& aPrevViewId, 
+        TUid aCustomMessageId, 
+        const TDesC8& aCustomMessage );
+
+    /**
+     * From CAknView.
+     */
+    void DoDeactivate();
+
+// from base class MEikListBoxObserver
+
+    /**
+     * From MEikListBoxObserver.
+     */
+    void HandleListBoxEventL( 
+        CEikListBox* aListBox, 
+        TListBoxEvent aEventType );
+
+    /**
+     * From MEikListBoxObserver.
+     */
+    void HandleListBoxSelectionL();
+
+    /**
+     * From MEikListBoxObserver.
+     */
+    void DynInitMenuPaneL(
+        TInt aResourceId, 
+        CEikMenuPane* aMenuPane );
+
+private: // data  
+
+    /**
+     * Handle to model class for settings handling.
+     */
+    CCSCSettingsUiModel& iModel;
+
+    /**
+     * Handle to title pane.
+     * Not own.
+     */
+    CAknTitlePane* iTitlePane;
+
+    /**
+     * Container class for main view.
+     * Own.
+     */
+    CCSCSettingsUiMainContainer* iContainer;
+
+    /**
+     * Navigation pane.
+     * Not own.
+     */
+    CAknNavigationControlContainer* iNaviPane;
+
+    /**
+     * Navigation decorator.
+     * Own.
+     */
+    CAknNavigationDecorator* iNaviDecorator;
+
+    /**
+     * Flag for telling if IM tone selection list is open.
+     */
+    TBool iImToneSelectionListOpen;
+
+    /**
+     * Flag for telling if service is deleted.
+     */
+    TBool iDeleted;
+
+    /**
+     * Flag for telling if SNAP list is open.
+     */
+    TBool iSnapListOpen;
+
+#ifdef _DEBUG
+    friend class UT_cscsettingsui;
+#endif
+
+    };
+
+#endif  // C_CSCSETTINGSUIMAINVIEW_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/inc/cscsettingsuimodel.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,241 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declarition of CSCSettingsUiModel
+*
+*/
+
+ 
+#ifndef C_CSCSETTINGSUIMODEL_H
+#define C_CSCSETTINGSUIMODEL_H
+
+#include "mcscengcchobserver.h"
+#include "mcscengserviceobserver.h"
+#include "mcscengprovisioningobserver.h"
+
+class CCSCEngCCHHandler;
+class CCSCEngServiceHandler;
+class CCSCEngBrandingHandler;
+class CCSCEngDestinationsHandler;
+class MCSCSettingsUiModelObserver;
+class CCSCEngServicePluginHandler;
+class MCSCEngProvisioningObserver;
+
+/**
+ *  CCSCSettingsUiModel class
+ *  Declarition of CCSCSettingsUiModel.
+ *
+ *  @lib CSCSettingsUi.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCSettingsUiModel ) : public CBase,
+                                           public MCSCEngCCHObserver,
+                                           public MCSCEngServiceObserver,
+                                           public MCSCEngProvisioningObserver
+    {
+public: 
+        
+    /**
+     * Two-phased constructor.
+     * @param aObserver for settings ui observer
+     * @param aEikEnv for Eikon environment
+     */
+    static CCSCSettingsUiModel* NewL(
+        MCSCSettingsUiModelObserver& aObserver,
+        CEikonEnv& aEikEnv );
+
+
+    /**
+     * Two-phased constructor.
+     * @param aObserver for settings ui observer
+     * @param aEikEnv for Eikon environment
+     */
+    static CCSCSettingsUiModel* NewLC(
+        MCSCSettingsUiModelObserver& aObserver,
+        CEikonEnv& aEikEnv );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCSCSettingsUiModel();
+
+    /**
+     * Returns reference to CSC's Service Provider Settings Handler.
+     *
+     * @since S60 v3.2
+     * @return reference to SPS handle
+     */
+    CCSCEngServiceHandler& SettingsHandler() const;
+
+    /**
+     * Returns reference to CSC's Converged Connection Handler.
+     *
+     * @since S60 v3.2
+     * @return reference to CCH handle
+     */
+    CCSCEngCCHHandler& CCHHandler() const;
+
+    /**
+     * Returns reference to CSC's Destinations Handler.
+     *
+     * @since S60 v3.2
+     * @return reference to Destinations handle
+     */
+    CCSCEngDestinationsHandler& DestinationsHandler() const;
+
+    /**
+     * Returns reference to CSC's Branding Server Handler.
+     *
+     * @since S60 v3.2
+     * @return reference to Branding Server handle
+     */
+    CCSCEngBrandingHandler& BSHandler() const;
+
+    /**
+     * Returns reference to CSC's Service Plugin Handler.
+     *
+     * @since S60 v5.2
+     * @return Reference to Service Plugin Handler.
+     */
+    CCSCEngServicePluginHandler& ServicePluginHandler() const;
+
+    /**
+     * Stores initialization information.
+     * Function leaves if given service doesn't exists.
+     *
+     * @since S60 v3.2
+     * @param aViewId for view id to be activated when exiting
+     * @param aServiceId for service settings entry id
+     */
+    void StoreInitializationDataL(
+        const TUid& aViewId, 
+        TUint aServiceId );
+
+    /**
+     * To notify when softkeys need to be changed.
+     *
+     * @since S60 v3.2
+     */
+    void UpdateSoftkeys();
+
+    /**
+     * Returns uid of the view where to be returned.
+     *
+     * @since S60 v3.2
+     * @return uid of the return view
+     */
+    TUid ReturnViewId() const;
+
+    /**
+     * Returns currently selected service provider entry id.
+     *
+     * @since S60 v3.2
+     * @return id of the currently selected service entry id
+     */
+    TUint CurrentSPEntryId() const;
+
+// from base class MCSCEngCCHObserver
+
+    /**
+     * From MCSCEngCCHObserver.
+     */
+    void ServiceStatusChanged(
+        TUint aServiceId, 
+        TCCHSubserviceType aType, 
+        const TCchServiceStatus& aServiceStatus );       
+
+// from base class MCSCEngServiceObserver
+
+    /**
+     * From MCSCEngServiceObserver.
+     */
+    void NotifyServiceChange();
+
+// from base class MCSCProvisioningObserver
+    
+    /**
+     * From MCSCProvisioningObserver
+     * Notifies when configuring of service plug-in is done.
+     *
+     * @since S60 v3.2
+     * @param aResponse plug-in response type
+     * @param aIndex index
+     * @param aPluginUid plugins uid
+     */
+    void NotifyServicePluginResponse( 
+        const CCSCEngServicePluginHandler::TServicePluginResponse& aResponse, 
+        const TInt aIndex, 
+        const TUid& aPluginUid );
+
+private:
+
+    CCSCSettingsUiModel( 
+        MCSCSettingsUiModelObserver& aObserver,
+        CEikonEnv& aEikEnv );
+
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Reference to settings ui model observer.
+     */
+    MCSCSettingsUiModelObserver& iObserver;
+
+    /**
+     * Reference to Eikon environment.
+     */
+    CEikonEnv& iEikEnv;
+
+    /**
+     * Handle to CSC's Service Provider Settings Handler.
+     * Own.
+     */
+    CCSCEngServiceHandler* iSPSHandler;
+
+    /**
+     * Handle to CSC's Converged Connection Handler.
+     * Own.
+     */
+    CCSCEngCCHHandler* iCCHHandler;
+
+    /**
+     * Handle to CSC's Destinations Handler.
+     * Own.
+     */
+    CCSCEngDestinationsHandler* iDestinationsHandler;
+
+    /**
+     * Handle to CSC's Branding Server Handler.
+     * Own.
+     */
+    CCSCEngBrandingHandler* iBSHandler;
+
+    /**
+     * CSC's Service Plugin Handler.
+     * Own.
+     */
+    CCSCEngServicePluginHandler* iServicePluginHandler;
+
+    /**
+     * Initialization data: Customer application return view id.
+     */
+    TUid iViewId;
+
+    /**
+     * Initialization data: Service Provider Settings Entry id.
+     */
+    TUint iServiceId;      
+    };
+
+#endif // C_CSCSETTINGSUIMODEL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/inc/mcscsettingsuidialogobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* 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:  Observer interface for notifying CSCSettingsUi for 
+*              : completed dialog events.
+*
+*/
+
+
+#ifndef M_CSCSETTINGSUIDIALOGOBSERVER_H
+#define M_CSCSETTINGSUIDIALOGOBSERVER_H
+
+/**
+ *  MCSCSettingsUiDialogObserver class
+ *  
+ *  Declarition of MCSCSettingsUiDialogObserver.
+ *
+ *  @lib CSCSettingsUi.lib
+ *  @since S60 v3.2
+ */
+class MCSCSettingsUiDialogObserver
+    {
+    public:
+        
+        /**
+         * Called when dialog is dismissed from screen.
+         *
+         * @since S60 v3.2
+         * @param aError for error id
+         */
+        virtual void DialogDismissed( TInt aError ) = 0;
+         
+    };
+    
+#endif // M_CSCSETTINGSUIDIALOGOBSERVER_H    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/inc/mcscsettingsuimodelobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* 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:  Observer interface for notifying CSCSettingsUi for 
+*              : completed service events from model.
+*
+*/
+
+
+#ifndef M_CSCSETTINGSUIMODELOBSERVER_H
+#define M_CSCSETTINGSUIMODELOBSERVER_H
+
+#include "cscengcchhandler.h"
+
+/**
+ *  MCSCSettingsUiModelObserver class
+ *  
+ *  Declarition of MCSCSettingsUiModelObserver.
+ *
+ *  @lib CSCSettingsUi.lib
+ *  @since S60 v3.2
+ */
+class MCSCSettingsUiModelObserver
+    {
+    public:
+
+        /**
+         * Called when softkeys need to be changed.
+         *
+         * @since S60 v3.2
+         */
+        virtual void UpdateSoftkeys() const = 0;
+
+    };
+    
+#endif // M_CSCSETTINGSUIMODELOBSERVER_H    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/loc/cscsettingsui.loc	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,433 @@
+/*
+* Copyright (c) 2007-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:  Localization strings for project CSCSettingsUi
+*
+*/
+
+
+// *** GENERIC ITEMS ***
+
+// d:Title pane text for settings view.
+// d:%U includes the name of currently opened service.
+// l:title_pane_t2/opt9
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_title "%U"
+
+
+//*** SETTINGS VIEW ***
+
+// d:The setting list item in settins view.
+// d:Item is used to change service connectivity destinations(SNAPs).
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_service_connectivity "Service connectivity"
+
+// d:The setting list item in settins view.
+// d:Item is used to show service connectivity destination(SNAP).
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_settings_connectivity_setting "Service connectivity"
+
+// d:The setting list item in settins view.
+// d:Item is used to change presence request preference
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_pres_pref_setting "Autoaccept invitations"
+
+// d:The setting list item in settins view.
+// d:Item is used to change friend requests preference
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_settings_pres_pref_setting "Friend requests"
+
+// d:The setting list item in settins view.
+// d:Item opens UI capable provider plugin for editing.
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_edit_service_settings "Advanced settings"
+
+// d:The setting list item in settins view.
+// d:Item opens the view for information about current service. 
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_service_info_popup "Service information"
+
+// d:Title text for autoaccept presence invitations selection query.
+// d:Query allows user to change autoaccept presence invitations on/off.
+// l:main_pane_set_t1 
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_pres_pref_title "Autoaccept invitations"
+
+// d:Title text for autoaccept presence invitations selection query.
+// d:Query allows user to change autoaccept presence invitations
+// d:ask firt/accept automatically.
+// l:main_pane_set_t1 
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_settings_pres_pref_title "Friend requests"
+
+// d:Text for an error note when editing service settings leads to error.
+// l:popup_note_window
+// r:VoIP Rel3.0
+//
+#define qtn_voip_error_note_unable_to_edit_ss "Unable to edit service settings"
+
+// d:The setting list item value in settings view presence request prererence option.
+// l:set_value_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_pres_pref_accept_automatically "On"
+
+// d:The setting list item value in settings view presence request prererence option.
+// l:set_value_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_pres_pref_always_ask "Off"
+
+// d:The setting list item value in settings view friend request preference option.
+// l:set_value_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_settings_auth_pres_value_on "Ask first"
+
+// d:The setting list item value in settings view friend request preference option.
+// l:set_value_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_settings_auth_pres_value_off "Accept automatically"
+
+// d:The setting list item title in settings view preferred service option.
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_voip_preferred_setting "Preferred service"
+
+// d:The setting list item title in settings view preferred service option.
+// l:list_setting_pane_t1
+// r:
+//
+#define qtn_servtab_settings_voip_preferred_setting "Preferred service"
+
+// d:The setting list item title in settings view handover notification tone option.
+// l:list_setting_pane_t1
+// r:
+//
+#define qtn_servtab_settings_ho_notification_tone_setting "Handover Notification tone"
+
+// d:The setting list item title in settings view message tone option.
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_settings_im_tone_setting "Message tone"
+
+// d:The setting list item title in settings view username option.
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_settings_username_setting "Username"
+
+// d:The setting list item title in settings view password option.
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_settings_password_setting "Password"
+
+// d:The setting page item title in settings view preferred service option.
+// l:main_pane_set_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_setting_voip_preferred_title "Preferred service"
+
+// d:The setting page item title in settings view IM tone option.
+// l:main_pane_set_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_setting_im_tone_title "Message tone"
+
+// d:The setting list item in settings view preferred service option.
+// l:list_set_graphic_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_setting_voip_pref_value_yes "Yes"
+
+// d:The setting list item in settings view preferred service option.
+// l:list_set_graphic_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_setting_voip_pref_value_no "No"
+
+// d:The setting page item title in settings view preferred service option.
+// l:main_pane_set_t1
+// r:
+//
+#define qtn_servtab_settings_vcc_preferred_title "Preferred service"
+
+// d:The setting list item in settings view preferred service option.
+// l:list_set_graphic_pane_t1
+// r:
+//
+#define qtn_servtab_setting_vcc_preferred_value_yes "Yes"
+
+// d:The setting list item in settings view preferred service option.
+// l:list_set_graphic_pane_t1
+// r:
+//
+#define qtn_servtab_setting_vcc_preferred_value_no "No"
+
+// d:The setting page item title in settings view handover notification tone option.
+// l:main_pane_set_t1
+// r:
+//
+#define qtn_cp_setting_vcc_ho_notif_tone_title "Handover notification tone"
+
+// d:The setting list item in settings view handover notification tone option.
+// l:list_set_graphic_pane_t1
+// r:
+//
+#define qtn_cp_setting_vcc_ho_notif_tone_on "On"
+
+// d:The setting list item in settings view handover notification tone option.
+// l:list_set_graphic_pane_t1
+// r:
+//
+#define qtn_cp_setting_vcc_ho_notif_tone_off "Off"
+
+// d:Text for an error note when editing preferred service setting leads to error.
+// l:popup_note_window
+// r:VoIP Rel3.0
+//
+#define qtn_voip_unable_to_edit_setting_note "Unable to edit setting during a call"
+
+// d:Text for an info note when changing setting is not allowed because service is logged in
+// l:popup_note_window
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_setting_unable_to_edit_while_online "Unable to edit setting while service is in use. Log out first."
+
+// d:The setting list item in settings view message tone option.
+// l:list_set_graphic_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_settings_im_tone_off "Off"
+
+// d:No im tone text which is set to the ringing tone popup selection list.
+// l:list_single_pane_t1_cp2
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_settings_no_im_tone_text "Off"
+
+// d:Heading text for im tone selection list query
+// l:heading_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_settings_im_tone_popup_heading "Select tone:"
+
+//*** CONNECTIVITY VIEW ***
+
+// d:The setting list item in settins view.
+// d:Item is used to change service connectivity destinations(SNAPs).
+// d:Used when service has only VoIP subservice.
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_conserted_service_connectivity "%U connectivity"
+
+// d:The setting list item in settins view.
+// d:Item is used to change service connectivity destinations(SNAPs).
+// d:Used when service has subservice(s).
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_voip_connectivity "Internet call connectivity"
+
+// d:The setting list item in settins view.
+// d:Item is used to change presence connectivity destinations(SNAPs).
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_presence_connectivity "Presence connectivity"
+
+// d:The setting list item in settins view.
+// d:Item is used to change presence/im connectivity destinations(SNAPs).
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_presenceim_connectivity "Presence/IM connectivity"
+
+// d:The setting list item in settins view.
+// d:Item is used to change im connectivity destinations(SNAPs).
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_im_connectivity "IM connectivity"
+
+// d:The setting list item in settins view.
+// d:Item is used to change voice mailbox connectivity destinations(SNAPs).
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_voicemail_connectivity "Voice mail connectivity"
+
+// d:Title text for service connectivity selection query.
+// d:Query allows user to change destinations(SNAPs) to current service´s all subservices
+// l:heading_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_edit_service_connectivity_title "%U connectivity"
+
+// d:Title text for internet call connectivity selection query.
+// d:Query allows user to change destinations(SNAPs) to current service.
+// l:heading_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_edit_voip_connectivity_title "Internet call connectivity"
+
+// d:Title text for presence connectivity selection query.
+// d:Query allows user to change destinations(SNAPs) to presence subservice.
+// l:heading_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_edit_presence_connectivity_title "Presence connectivity"
+
+// d:Title text for instant messaging connectivity selection query.
+// d:Query allows user to change destinations(SNAPs) to IM subservice.
+// l:heading_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_edit_im_connectivity_title "Instant messaging connectivity"
+
+// d:Title text for presence/im connectivity selection query.
+// d:Query allows user to change destinations(SNAPs) to presence and IM subservices.
+// l:heading_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_pres_im_connectivity_title "Presence/IM connectivity"
+
+// d:Title text for voice mail connectivity selection query.
+// d:Query allows user to change destinations(SNAPs) to vmbx subservice.
+// l:heading_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_edit_voice_mail_connectivity_title "Voice mail connectivity"
+
+// d:The setting list item in settins view.
+// d:Item opens Connection Method Manager User Interface.
+// l:list_setting_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_edit_destinations "Edit destinations"
+
+// d:Text for an info note when connectivity is already using selected destination.
+// l:popup_note_window
+// r:VoIP Rel3.0
+//
+#define qtn_voip_only_destination_in_use_note "Unable to change destination. Already using %U"
+
+// d:Text for an info note when destination changing is not allowed because service is in use
+// l:popup_note_window
+// r:VoIP Rel3.0
+//
+#define qtn_voip_changing_not_allowed_when_in_use "Deactivate the service before editing the settings"
+
+// d:Text for an error note when changing destination is not allowed
+// l:popup_note_window
+// r:VoIP Rel3.0
+//
+#define qtn_voip_changing_dest_not_allowed "Changing destination not allowed"
+
+// d:Text for an error note when changing connectivity has failed.
+// l:popup_note_window
+// r:VoIP Rel3.0
+//
+#define qtn_voip_error_note_changing_connect_failed "Changing connectivity failed"
+
+
+
+// *** SERVICE INFO ***
+
+// d:Service info message query title text
+// l:heading_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_settings_service_info_title "Service information"
+
+// d:Service info message query item for username.
+// d:Item represents username used in registration. 
+// l:popup_info_list_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_service_info_username "Username"
+
+// d:Service info message query item for domain.
+// d:Item represents domain used in registration. 
+// l:popup_info_list_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_service_info_domain "Domain"
+
+// d:Service info message query item for connection address.
+// d:Item represents connection address(IP) used in registration. 
+// l:popup_info_list_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_service_info_connection_address "Connection address"
+
+// d:Service info message query item for WLAN network name.
+// d:Item represents currently used WLAN SSID from Internet Access Point. 
+// l:popup_info_list_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_service_info_wlan_ssid "WLAN SSID"
+
+// d:Service info message query item for WLAN MAC address.
+// d:Item represents device's WLAN MAC address.
+// l:popup_info_list_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_service_info_wlan_mac "WLAN MAC"
+
+// d:Service info message query item value for situation when 
+// d:information is not available for some reason or other.
+// l:popup_info_list_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_serv_info_value_unavailable "Unavailable"
+
+// d:Service info message query item value for situation when
+// d:information is not available because of offline status.
+// l:popup_info_list_pane_t1
+// r:VoIP Rel3.0
+//
+#define qtn_voip_serv_info_value_unavailable_when_offline "Unavailable when offline"
+
+// d:Title text for service password query.
+// l:main_pane_set_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_setting_password_title "Service password"
+
+// d:Title text for service username query.
+// l:main_pane_set_t1
+// r:VoIP Rel3.0
+//
+#define qtn_servtab_setting_username_title "Service username"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/src/cscsettingsui.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSCSettingsUi API methods
+*
+*/
+
+
+#include <cchclient.h>
+
+#include "cscsettingsui.h"
+#include "cscsettingsuiimpl.h"
+#include "cscsettingsuilogger.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUi::CCSCSettingsUi()
+    {    
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUi::ConstructL( CEikonEnv& /*aEikEnv*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCSCSettingsUi* CCSCSettingsUi::NewL( CEikonEnv& aEikEnv )
+    {
+    CCSCSettingsUi* self = new ( ELeave ) CCSCSettingsUi;
+    CleanupStack::PushL( self );
+    
+    CCSCSettingsUiImpl* tlsImpl = (CCSCSettingsUiImpl*)Dll::Tls();
+    if ( !tlsImpl )
+        {    
+        CCSCSettingsUiImpl* impl = CCSCSettingsUiImpl::NewL( aEikEnv );
+        CleanupStack::PushL( impl ),
+        User::LeaveIfError( Dll::SetTls( impl ) );
+        CleanupStack::Pop( impl );
+        self->iImpl = static_cast<CCSCSettingsUiImpl*>( Dll::Tls() );
+        }
+    else
+        {
+        self->iImpl = tlsImpl;
+        }
+    
+    self->iImpl->ReferenceCounter()++;
+    
+    self->ConstructL( aEikEnv );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUi::~CCSCSettingsUi()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUi::~CCSCSettingsUi - begin" );
+    
+    if ( iImpl )
+        {
+        iImpl->ReferenceCounter()--;
+        if ( !iImpl->ReferenceCounter() )
+            {
+            delete iImpl;
+            Dll::FreeTls();
+            }
+        }
+
+    CSCSETUIDEBUG( "CCSCSettingsUi::~CCSCSettingsUi - end" );
+    }
+
+//---------------------------------------------------------------------------
+// CCSCSettingsUi::InitializeL
+// 
+//---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCSettingsUi::InitializeL( const TUid& aReturnViewId, 
+        TUint aServiceId,
+        const MCoeView* aDefaultAppView )
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUi::InitializeL" );
+    
+    iImpl->InitializeL( aReturnViewId, aServiceId, aDefaultAppView );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUi::LaunchSettingsUiL
+// Launches Converged Service Configurator Settings UI.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCSCSettingsUi::LaunchSettingsUiL() const
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUi::LaunchSettingsUiL - begin" );
+    
+    iImpl->LaunchSettingsUiL();
+    
+    CSCSETUIDEBUG( "CCSCSettingsUi::LaunchSettingsUiL - end" );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/src/cscsettingsuidialog.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,309 @@
+/*
+* 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:  Implements CSCSettingsUiDialog methods
+*
+*/
+
+
+#include <avkon.rsg>
+#include <stringloader.h>
+#include <aknglobalnote.h>
+#include <cscsettingsui.rsg>
+#include <aknglobalmsgquery.h>
+
+#include "cscsettingsuilogger.h"
+#include "cscsettingsuidialog.h"
+#include "mcscsettingsuidialogobserver.h"
+
+const TInt KMsgQueryTextMaxLength = 512;
+_LIT( KNextLine, "\n" );
+_LIT( KInvalidConnectionAddress, "::1" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiDialog::CCSCSettingsUiDialog(
+    MCSCSettingsUiDialogObserver& aObserver )
+    : CActive ( EPriorityHigh ),
+    iObserver( aObserver )
+    {
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiDialog::ConstructL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiDialog::ConstructL - begin" );
+    
+    CActiveScheduler::Add( this );
+    
+    CSCSETUIDEBUG( "CCSCSettingsUiDialog::ConstructL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiDialog* CCSCSettingsUiDialog::NewL(
+    MCSCSettingsUiDialogObserver& aObserver )
+    {
+    CCSCSettingsUiDialog* self = CCSCSettingsUiDialog::NewLC( aObserver );
+    CleanupStack::Pop( self );    
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiDialog* CCSCSettingsUiDialog::NewLC(
+    MCSCSettingsUiDialogObserver& aObserver )
+    {
+    CCSCSettingsUiDialog* self = 
+        new ( ELeave ) CCSCSettingsUiDialog( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiDialog::~CCSCSettingsUiDialog()
+    {
+    Cancel();
+    delete iMsgQuery;
+    }
+
+// -----------------------------------------------------------------------------
+// CCSCSettingsUiDialog::LaunchMessageQueryL
+// Launches a service information message query.
+// -----------------------------------------------------------------------------
+//
+void CCSCSettingsUiDialog::LaunchMessageQueryL(
+    const TDesC& aUsername,
+    const TDesC& aDomain,
+    const TDesC& aAddress,
+    const TDesC& aSsid,
+    const TDesC& aMac,
+    TBool aDisabled )
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiDialog::LaunchMessageQueryL" );
+    
+    if ( !IsActive() )
+        {
+        // Create data to be shown in service information message query.
+        HBufC* queryText = HBufC::NewLC( KMsgQueryTextMaxLength );
+        CreateTextForMsgQueryL(
+            queryText,
+            aUsername,
+            aDomain,
+            aAddress,
+            aSsid,
+            aMac,
+            aDisabled );
+        
+        // Create header text to be shown in information message query.
+        HBufC* headerText = StringLoader::LoadLC(
+            R_CSCSETTINGSUI_SERVICE_INFO_TEXT );
+        
+        if ( iMsgQuery )
+            {
+            delete iMsgQuery;
+            iMsgQuery = NULL;
+            }
+        
+        // Show message query with appropriate header and data.
+        iMsgQuery = CAknGlobalMsgQuery::NewL();
+        iMsgQuery->ShowMsgQueryL( 
+            iStatus, 
+            *queryText, 
+            R_AVKON_SOFTKEYS_OK_EMPTY, 
+            *headerText, 
+            KNullDesC );  
+    
+        SetActive();
+        CleanupStack::PopAndDestroy( headerText );
+        CleanupStack::PopAndDestroy( queryText );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCSCSettingsUiDialog::DestroyMessageQuery
+// Destroys a service information message query.
+// -----------------------------------------------------------------------------
+//
+void CCSCSettingsUiDialog::DestroyMessageQuery()
+    {  
+    Cancel();
+    }
+
+
+// ---------------------------------------------------------------------------
+// From CActive
+// CCSCSettingsUiDialog::RunL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiDialog::RunL()
+    {
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// From CActive
+// CCSCSettingsUiDialog::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiDialog::DoCancel()
+    {
+    iMsgQuery->CancelMsgQuery();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCSCSettingsUiDialog::CreateTextForMsgQueryL
+// Creates text for service information message query.
+// -----------------------------------------------------------------------------
+//
+void CCSCSettingsUiDialog::CreateTextForMsgQueryL( 
+    HBufC* aText,
+    const TDesC& aUsername,
+    const TDesC& aDomain,
+    const TDesC& aAddress,
+    const TDesC& aSsid,
+    const TDesC& aMac,
+    TBool aDisabled ) const
+    {  
+    CSCSETUIDEBUG( "CCSCSettingsUiDialog::CreateTextForMsgQueryL - begin" );
+    
+    if ( aText == NULL )
+        {
+        User::Leave( KErrBadHandle );
+        }
+    
+    // Load resources to memory.
+    HBufC* unavailable = StringLoader::LoadLC(
+        R_CSCSETTINGSUI_SERV_INFO_VALUE_UNAVAILABLE );
+    HBufC* unavailbleWhenOffile = StringLoader::LoadLC(
+        R_CSCSETTINGSUI_SERV_INFO_VALUE_UNAVAILABLE_WHEN_OFFLINE );
+    
+    // Add username information to query text.
+    HBufC* resource = StringLoader::LoadLC( 
+        R_CSCSETTINGSUI_SERVICE_INFO_USERNAME_TEXT );
+    CreateItemToMsgQuery( aText, resource, unavailbleWhenOffile, aUsername );
+    CleanupStack::PopAndDestroy( resource );
+    
+     // Add domain information to query text.    
+    resource = StringLoader::LoadLC( 
+        R_CSCSETTINGSUI_SERVICE_INFO_DOMAIN_TEXT ); 
+    
+    if ( aDisabled )
+        {
+        CreateItemToMsgQuery( aText, resource, unavailable, KNullDesC );
+        }
+    else
+        {
+        CreateItemToMsgQuery( aText, resource, unavailbleWhenOffile, aDomain );
+        }
+        
+    CleanupStack::PopAndDestroy( resource );
+        
+    // Add connection address information to query text.
+    resource = StringLoader::LoadLC( 
+        R_CSCSETTINGSUI_SERVICE_INFO_ADDRESS_TEXT );    
+    if ( !aAddress.Compare( KInvalidConnectionAddress ) && !aDisabled )
+        {
+        CreateItemToMsgQuery( 
+            aText, resource, unavailable, KNullDesC );
+        }
+    else if ( !aDisabled )
+        {
+        CreateItemToMsgQuery( 
+            aText, resource, unavailable, aAddress );
+        }    
+    else
+        {
+        CreateItemToMsgQuery( 
+            aText, resource, unavailable, KNullDesC );
+        }
+    
+    CleanupStack::PopAndDestroy( resource );
+        
+    // Add WLAN SSID information to query text.
+    resource = StringLoader::LoadLC( 
+        R_CSCSETTINGSUI_SERVICE_INFO_WLAN_SSID_TEXT );
+    
+    if ( aDisabled )
+        {
+        CreateItemToMsgQuery( aText, resource, unavailable, KNullDesC );
+        }
+    else
+        {
+        CreateItemToMsgQuery( aText, resource, unavailable, aSsid );
+        }
+    
+    CleanupStack::PopAndDestroy( resource );
+        
+    // Add WLAN MAC address information to query text.
+    resource = StringLoader::LoadLC( 
+        R_CSCSETTINGSUI_SERVICE_INFO_WLAN_MAC_TEXT );
+    
+    CreateItemToMsgQuery( aText, resource, unavailable, aMac );
+        
+    CleanupStack::PopAndDestroy( resource );
+    
+    // PopAndDestroy resources.
+    CleanupStack::PopAndDestroy( unavailbleWhenOffile );
+    CleanupStack::PopAndDestroy( unavailable );
+        
+    CSCSETUIDEBUG( "CCSCSettingsUiDialog::CreateTextForMsgQueryL - end" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCSCSettingsUiDialog::CreateItemToMsgQuery
+// Creates an item for service information message query.
+// -----------------------------------------------------------------------------
+//
+void CCSCSettingsUiDialog::CreateItemToMsgQuery( 
+    HBufC* aText,
+    HBufC* aItem,
+    HBufC* aAdditionalValue,
+    const TDesC& aData ) const
+    {  
+    if ( aText && aItem )
+        {
+        aText->Des().Append( *aItem );
+        aText->Des().Append( KNextLine );        
+        if ( aData.Length() )
+            {
+            aText->Des().Append( aData );
+            }
+        else if ( aAdditionalValue )
+            {
+            aText->Des().Append( *aAdditionalValue );
+            }
+        else
+            {
+            // nothing to do
+            }
+                
+        aText->Des().Append( KNextLine );        
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/src/cscsettingsuiimpl.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSCSettingsUiImpl methods.
+*
+*/
+
+
+#include <eikclb.h>
+#include <aknview.h>
+#include <bautils.h>
+#include <aknnavi.h>
+#include <pathinfo.h>
+#include <akntitle.h>
+#include <cchclient.h>
+#include <akncontext.h>
+#include <aknViewAppUi.h>
+#include <xSPViewServices.h>
+#include <data_caging_path_literals.hrh>
+
+#include "cscsettingsui.hrh"
+#include "cscsettingsuiimpl.h"
+#include "cscsettingsuimodel.h"
+#include "cscsettingsuilogger.h"
+#include "cscsettingsuimainview.h"
+#include "cscsettingsuiconstants.h"
+
+
+#define AppUi() (static_cast<CAknViewAppUi*>(iAvkonAppUi) )
+
+// ======== MEMBER FUNCTIONS ========   
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiImpl::CCSCSettingsUiImpl( CEikonEnv& aEikEnv )
+    : iEikEnv( aEikEnv )
+    {  
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiImpl::ConstructL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiImpl::ConstructL - begin" );
+
+    iModel = CCSCSettingsUiModel::NewL( *this, iEikEnv );
+    
+    // Load resource file to the memory.
+    TFileName resourceFile = TParsePtrC( PathInfo::RomRootPath() ).Drive();
+    resourceFile.Append( KDC_RESOURCE_FILES_DIR );
+    resourceFile.Append( KCSCSettingsUiResourceFile );
+    BaflUtils::NearestLanguageFile( iEikEnv.FsSession(), resourceFile );
+    iResourceOffset = iEikEnv.AddResourceFileL( resourceFile );
+     
+    CSCSETUIDEBUG( "CCSCSettingsUiImpl::ConstructL - end" ); 
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiImpl* CCSCSettingsUiImpl::NewL( CEikonEnv& aEikEnv )
+    {
+    CCSCSettingsUiImpl* self = new (ELeave) CCSCSettingsUiImpl( aEikEnv );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiImpl::~CCSCSettingsUiImpl()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUi::~CCSCSettingsUiImpl - begin" );
+    
+    delete iModel;
+    
+    // Remove resource file from the memory.
+    if ( iResourceOffset )
+        {
+        iEikEnv.DeleteResourceFile( iResourceOffset );
+        }
+    
+    CSCSETUIDEBUG( "CCSCSettingsUi::~CCSCSettingsUiImpl - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiImpl::InitializeL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiImpl::InitializeL( 
+        const TUid& aReturnViewId, 
+        TUint aServiceId,
+        const MCoeView* aDefaultAppView )
+    {
+    CSCSETUIDEBUG4( 
+      "CCSCSettingsUiImpl::InitializeL, VIEW ID=%d, SERVICE ID=%d, ISDEFAULTVIEW=%d",
+      aReturnViewId.iUid, aServiceId, NULL == aDefaultAppView );
+    
+    if ( NULL == iMainView )
+        {
+        iMainView = CCSCSettingsUiMainView::NewL( *iModel );
+        AppUi()->AddViewL( iMainView ); // ownership is transferred
+        }
+    else
+        {
+        // Already initialised. Reset view since we're probably switching
+        // between different service settings.
+        iMainView->ResetViewL();
+        }
+    
+    // Set initialization information data. The function leaves if given 
+    // service does not exist.
+    iModel->StoreInitializationDataL( aReturnViewId, aServiceId );
+    
+    ( NULL == aDefaultAppView ) 
+        ? AppUi()->SetDefaultViewL( *iMainView )
+        : AppUi()->SetDefaultViewL( *aDefaultAppView );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiImpl::LaunchSettingsUiL
+// Launches Converged Service Configurator Settings UI.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiImpl::LaunchSettingsUiL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiImpl::LaunchSettingsUiL - begin" );
+    __ASSERT_ALWAYS( NULL != iMainView, User::Leave( KErrNotReady ) );
+    
+    // Activate main view with given service properties.
+    AppUi()->ActivateLocalViewL( KCSCSettingsUiMainViewId );
+    
+    CSCSETUIDEBUG( "CCSCSettingsUiImpl::LaunchSettingsUiL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MCSCSettingsUiModelObserver.
+// CCSCSettingsUiImpl::UpdateSoftkeys
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiImpl::UpdateSoftkeys() const
+    {
+    // Pass notification to main view.
+    CCSCSettingsUiMainView* mainView = 
+        static_cast<CCSCSettingsUiMainView*> 
+            ( AppUi()->View( KCSCSettingsUiMainViewId ) );
+    
+    TVwsViewId activeViewId;
+    AppUi()->GetActiveViewId( activeViewId );                
+    
+    if ( mainView && 
+         KCSCSettingsUiMainViewId == activeViewId.iViewUid )
+        {
+        TRAP_IGNORE( mainView->UpdateSoftkeysL() );
+        }
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiImpl::ReferenceCounter
+// ---------------------------------------------------------------------------
+//
+TInt& CCSCSettingsUiImpl::ReferenceCounter()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiImpl::ReferenceCounter - IN"); 
+    return iReferenceCounter;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/src/cscsettingsuimaincontainer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,970 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSCSettingsUiMainContainer methods
+*
+*/
+
+
+#include <aknlists.h>
+#include <coecntrl.h>
+#include <cchclient.h>
+#include <cmmanagerext.h>
+#include <StringLoader.h>
+#include <spdefinitions.h>
+#include <cscsettingsui.rsg>
+#include <aknlistquerydialog.h>
+#include <cvimpstsettingsstore.h>
+#include <csxhelp/voip.hlp.hrh>
+#include <csc.rsg>
+#include <aknnotedialog.h>
+
+#include "cscconstants.h"
+#include "cscsettingsui.hrh"
+#include "cscsettingsuimodel.h"
+#include "cscsettingsuilogger.h"
+#include "cscengservicehandler.h"
+#include "cscsettingsuiconstants.h"
+#include "cscengdestinationshandler.h"
+#include "cipapputilsaddressresolver.h"
+#include "cscsettingsuimaincontainer.h"
+#include "cscengservicepluginhandler.h"
+#include "cscnoteutilities.h"
+#include "cscengsettingscleanupplugininterface.h"
+
+// Format of the setting item.
+_LIT( KCSCSettingsUiListItemTextFormat, "\t%S\t\t%S" );
+
+_LIT( KDoubleBackSlash, "\\" );
+_LIT( KEmptyPassword, "*****" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiMainContainer::CCSCSettingsUiMainContainer(
+    CCSCSettingsUiModel& aModel )
+    : iModel( aModel )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::ConstructL(
+    const TRect& aRect)
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::ConstructL - begin" );
+
+    CreateWindowL();
+    ConstructListBoxL();
+    SetRect( aRect );
+    ActivateL();
+
+    CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::ConstructL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiMainContainer::~CCSCSettingsUiMainContainer()
+    {
+    CSCSETUIDEBUG( 
+       "CCSCSettingsUiMainContainer::~CCSCSettingsUiMainContainer - begin" );
+    
+    iListBoxItemArray.Reset();
+    iListBoxItemArray.Close();
+    
+    if ( iCaption )
+        {
+        delete iCaption;
+        }
+    
+    delete iListBox;
+    
+    CSCSETUIDEBUG( 
+       "CCSCSettingsUiMainContainer::~CCSCSettingsUiMainContainer - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::UpdateContainerL
+// Updates container and redraws listbox items.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::UpdateContainerL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::UpdateContainerL - begin" );
+
+    // Get listbox items from model.
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+    listBoxItems->Reset();
+    iListBoxItemArray.Reset();
+
+    // Initialize setting items.
+    InitializeSettingItemsL();
+
+    CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::UpdateContainerL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::HandoverNotificationToneQueryL
+// Shows a query which changes handover notification tone setting for service.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::HandoverNotificationToneQueryL()
+    {    
+    CDesCArrayFlat* items = new ( ELeave ) CDesCArrayFlat( 2 );   
+    CleanupStack::PushL( items );
+
+    HBufC* onItem =  StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_ON );
+    items->AppendL( *onItem );
+    CleanupStack::PopAndDestroy( onItem );
+
+    HBufC* offItem =  StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_OFF );
+    items->AppendL( *offItem );
+    CleanupStack::PopAndDestroy( offItem );
+
+    TInt index( 0 );
+    CAknListQueryDialog* dialog = 
+        new ( ELeave ) CAknListQueryDialog( &index );
+
+    dialog->PrepareLC( R_CSCSETTINGSUI_HANDOVER_NOTIFICATION_TONE_QUERY );
+    dialog->SetItemTextArray( items );
+    dialog->SetOwnershipType( ELbmDoesNotOwnItemArray );
+
+    if ( dialog->RunLD() )
+        {
+        // Update setting according user selection
+        if ( 0 == index )
+            {   
+            // Set handover notification tone setting value on
+            iModel.SettingsHandler().SetHandoverNotifTonePrefL( 
+                iModel.CurrentSPEntryId(), EOn );
+            }
+        else if ( 1 == index )
+            {
+            // Set handover notification tone setting value off
+            iModel.SettingsHandler().SetHandoverNotifTonePrefL( 
+                iModel.CurrentSPEntryId(), EOff );
+            }
+        else
+            {
+            // invalid index
+            User::Leave( KErrGeneral );
+            }
+        }
+    else
+        {        
+        // cancelled
+        }
+
+    CleanupStack::PopAndDestroy( items );
+    UpdateContainerL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::PresenceReqPrefQueryL
+// Shows a query which changes presence request preference for service.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::PresenceReqPrefQueryL()
+    {    
+    CDesCArrayFlat* items = new ( ELeave ) CDesCArrayFlat( 2 );   
+    CleanupStack::PushL( items );
+
+    HBufC* alwaysAskItem =  StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_PRES_PREF_ALWAYS_ASK );
+    items->AppendL( *alwaysAskItem );
+    CleanupStack::PopAndDestroy( alwaysAskItem );
+
+    HBufC* autoAcceptItem =  StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_PRES_PREF_ACCEPT_AUTOMATICALLY );
+    items->AppendL( *autoAcceptItem );
+    CleanupStack::PopAndDestroy( autoAcceptItem );
+
+    TInt index( 0 );
+    CAknListQueryDialog* dialog = 
+        new ( ELeave ) CAknListQueryDialog( &index );
+
+    dialog->PrepareLC( R_CSCSETTINGSUI_PRESENCE_REQUEST_PREF_QUERY );
+    dialog->SetItemTextArray( items );
+    dialog->SetOwnershipType( ELbmDoesNotOwnItemArray );
+
+    if ( dialog->RunLD() )
+        {
+        // Update setting according user selection
+        if ( 0 == index )
+            {   
+            // Set presence request preference setting value
+            iModel.SettingsHandler().SetPresenceReqPrefL( 
+                iModel.CurrentSPEntryId(), EOff );
+            }
+        else if ( 1 == index )
+            {
+            // Set presence request preference setting value
+            iModel.SettingsHandler().SetPresenceReqPrefL( 
+                iModel.CurrentSPEntryId(), EOn );
+            }
+        else
+            {
+            // invalid index
+            User::Leave( KErrGeneral );
+            }
+        }
+    else
+        {        
+        // canceled
+        }
+
+    CleanupStack::PopAndDestroy( items );
+    UpdateContainerL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::SaveImTonePathL
+// Saves Im tone path to permanent storage.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::SaveImTonePathL( const TDesC& aTonePath )
+    { 
+    MVIMPSTSettingsStore* settings = CVIMPSTSettingsStore::NewLC();
+
+    User::LeaveIfError( settings->SetL( 
+        iModel.CurrentSPEntryId(), EServiceToneFileName, aTonePath ) );
+
+    CleanupStack::PopAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::ListBox
+// Returns handle to the listbox.
+// ---------------------------------------------------------------------------
+//    
+CAknSettingStyleListBox* CCSCSettingsUiMainContainer::ListBox()
+    {
+    return iListBox;
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::CurrentItemIndex
+// Returns index of selected listbox item. 
+// ---------------------------------------------------------------------------
+//
+TMainListBoxItem CCSCSettingsUiMainContainer::CurrentItem() const
+    {
+    TInt currentItemIndex( iListBox->CurrentItemIndex() );
+    return iListBoxItemArray[ currentItemIndex ];
+    }
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// CCSCSettingsUiMainContainer::ComponentControl
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CCSCSettingsUiMainContainer::ComponentControl( 
+    TInt /*aIndex*/ ) const
+    {
+    return iListBox;
+    }
+
+// -----------------------------------------------------------------------------
+// From class CoeControl
+// For getting help context
+// -----------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::GetHelpContext( 
+    TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KCscHelpUid;
+    aContext.iContext = KSERVTAB_HLP_SETTINGS;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// CCSCSettingsUiMainContainer::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CCSCSettingsUiMainContainer::OfferKeyEventL( 
+    const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    TKeyResponse response = EKeyWasNotConsumed;
+    response = iListBox->OfferKeyEventL( aKeyEvent, aType );
+
+    if ( EKeyUpArrow == aKeyEvent.iCode ||  
+        EKeyDownArrow == aKeyEvent.iCode  )
+        {
+        iModel.UpdateSoftkeys();
+        }
+
+    return response;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// CCSCSettingsUiMainContainer::HandleResourceChange
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::HandleResourceChange( TInt aType )
+    {
+    if( aType == KAknsMessageSkinChange ||
+        aType == KEikDynamicLayoutVariantSwitch )
+        {
+        TRect mainPaneRect;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
+                                           mainPaneRect );
+        SetRect( mainPaneRect );
+        DrawNow();
+        }
+
+    CCoeControl::HandleResourceChange( aType );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::ConstructListBoxL
+// Creates listbox item for setting items.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::ConstructListBoxL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::ConstructListBoxL - begin" );
+
+    // Create listbox and array for listbox items.
+    iListBox = new( ELeave ) CAknSettingStyleListBox;
+    iListBox->ConstructL( this, EAknListBoxSelectionList );    
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+        CEikScrollBarFrame::EOff, 
+        CEikScrollBarFrame::EAuto );
+    iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+    CDesCArrayFlat* itemsArray = 
+        new ( ELeave ) CDesCArrayFlat( KCSCSettingsUiArrayGranularity );  
+    iListBox->Model()->SetItemTextArray( itemsArray );
+
+    // Initialize setting items.
+    InitializeSettingItemsL();
+
+    CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::ConstructListBoxL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::InitializeSettingItemsL
+// Draws setting items at the first time after the initialization is completed
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::InitializeSettingItemsL()
+    {
+    CSCSETUIDEBUG( 
+        "CCSCSettingsUiMainContainer::InitializeSettingItemsL - begin" );
+
+    // Get supported subservices
+    TSupportedSubServices supSubServices;
+    iModel.CCHHandler().SupportedSubServicesL( 
+            iModel.CurrentSPEntryId(), supSubServices );
+
+    // Make username setting
+    MakeSettingItemL ( TMainListBoxItem::EUsername );
+
+    // Make password setting
+    MakeSettingItemL ( TMainListBoxItem::EPassword );
+
+    // Make preferred service setting item if voip subservice is supported
+    if ( supSubServices.iVoIP )
+        {
+        TBool isSipVoip( EFalse );     
+        TRAPD( err, isSipVoip = iModel.SettingsHandler().IsSipVoIPL(
+            iModel.CurrentSPEntryId() ) );
+           
+        if ( !err )
+            {
+            if ( isSipVoip && iModel.SettingsHandler().IsVccSupportedL( 
+                iModel.CurrentSPEntryId() ) )
+                {
+                // If VCC is supported make vcc preferred setting item
+                // and handover notification tone setting item
+                MakeSettingItemL ( TMainListBoxItem::EVccPreferredService );
+                MakeSettingItemL ( TMainListBoxItem::EHandoverNotifTone );
+                }
+            else
+                {
+                // If VCC is not supported make just preferred service setting
+                MakeSettingItemL ( TMainListBoxItem::EPreferredService );
+                }
+            }
+        }
+
+    // Make setting item if IM is supported by service
+    if ( supSubServices.iIm )
+        {
+        // IM tone setting.
+        MakeSettingItemL( TMainListBoxItem::EImTone );
+        }
+
+    // Make setting item if presence is supported by service
+    if ( supSubServices.iPresence )
+        {
+        // Presence request preference
+        MakeSettingItemL( TMainListBoxItem::EAutoacceptInv );
+        }
+
+    // Connectivity setting (cannot be changed)
+    MakeSettingItemL( TMainListBoxItem::EServiceConn );
+
+    CSCSETUIDEBUG( 
+        "CCSCSettingsUiMainContainer::InitializeSettingItemsL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::MakeSettingItemL
+// Constructs setting list items.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::MakeSettingItemL(
+    TMainListBoxItem::TSettingItems aItem )
+    {
+    CSCSETUIDEBUG( 
+        "CCSCSettingsUiMainContainer::MakeSettingItemL - begin" );
+
+    // Get listbox items from model.
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+
+    TBuf<KCSCSettingsUiItemLength> listBoxItemText ( KNullDesC );
+
+    TMainListBoxItem listBoxItem;
+    listBoxItem.iItem = aItem;
+
+    RBuf value;
+    CleanupClosePushL( value );
+
+    value.CreateL( 1 );
+    value.Copy( KNullDesC );
+
+    switch ( aItem  )
+        {
+        case TMainListBoxItem::EUsername:
+            {
+            GetUsernameL( value );
+            break;
+            }
+        case TMainListBoxItem::EPassword:
+            {
+            value.ReAllocL( KEmptyPassword().Length() );
+            value.Copy( KEmptyPassword );
+            break;
+            }
+        case TMainListBoxItem::EPreferredService:
+            {
+            GetPreferredServiceSettingL( value );
+            break;
+            }
+        case TMainListBoxItem::EVccPreferredService:
+            {
+            GetVccPreferredServiceSettingL( value );
+            break;
+            }
+        case TMainListBoxItem::EHandoverNotifTone:
+            {
+            GetHandoverNotificationTonePrefL( value );
+            break;
+            }
+        case TMainListBoxItem::EImTone:
+            {
+            GetImToneSettingL( value );
+            break;
+            }
+        case TMainListBoxItem::EAutoacceptInv:
+            {
+            GetPresencePrefSettingL( value );
+            break;
+            }
+        case TMainListBoxItem::EServiceConn:
+            {
+            TRAP_IGNORE( GetSnapSettingL( value ) );
+            break;
+            }
+        default:
+            User::Leave( KErrArgument );
+            break;
+        }
+
+    listBoxItemText.Format(
+            KCSCSettingsUiListItemTextFormat,
+            GetCaptionL( aItem ),
+            &value );
+
+    CleanupStack::PopAndDestroy( &value );
+
+    // Add to listbox
+    iListBoxItemArray.Append( listBoxItem );
+    listBoxItems->AppendL( listBoxItemText );
+    iListBox->HandleItemAdditionL();
+
+    CSCSETUIDEBUG( 
+        "CCSCSettingsUiMainContainer::MakeSettingItemL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::GetCaptionL
+// Constructs setting list items.
+// ---------------------------------------------------------------------------
+//
+HBufC* CCSCSettingsUiMainContainer::GetCaptionL( 
+    TMainListBoxItem::TSettingItems aItem )
+    {
+    if ( iCaption != NULL )
+        {
+        delete iCaption;
+        iCaption = NULL;
+        }
+
+    switch ( aItem  )
+        {
+        case TMainListBoxItem::EUsername:
+            {
+            iCaption = StringLoader::LoadL(
+                R_CSCSETTINGSUI_SETTING_USERNAME_TITLE );
+            break;
+            }
+        case TMainListBoxItem::EPassword:
+            {
+            iCaption = StringLoader::LoadL(
+                R_CSCSETTINGSUI_SETTING_PASSWORD_TITLE );
+            break;
+            }
+        case TMainListBoxItem::EPreferredService:
+            {
+            iCaption = StringLoader::LoadL(
+                R_CSCSETTINGSUI_SETTING_PREFERRED_SERVICE_TITLE );
+            break;
+            }
+        case TMainListBoxItem::EVccPreferredService:
+            {
+            iCaption = StringLoader::LoadL(
+                R_CSCSETTINGSUI_SETTING_VCC_PREFERRED_SERVICE_TITLE );
+            break;
+            }
+        case TMainListBoxItem::EHandoverNotifTone:
+            {
+            iCaption = StringLoader::LoadL(
+                R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_TITLE );
+            break;
+            }
+        case TMainListBoxItem::EImTone:
+            {
+            iCaption = StringLoader::LoadL( 
+                R_CSCSETTINGSUI_SETTING_IM_TONE_TITLE );
+            break;
+            }
+        case TMainListBoxItem::EAutoacceptInv:
+            {
+            iCaption = StringLoader::LoadL( 
+                R_CSCSETTINGSUI_PRESENCE_REQUEST_PREF_TEXT );
+            break;
+            }
+        case TMainListBoxItem::EServiceConn:
+            {
+            iCaption = StringLoader::LoadL( 
+                R_CSCSETTINGSUI_SERVICE_CONNECTIVITY_TEXT );
+            break;
+            }
+        default:
+            User::Leave( KErrArgument );
+            break;
+        }
+
+    return iCaption;
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::GetUsername
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::GetUsernameL( RBuf& aUsername )
+    {
+    aUsername.ReAllocL( KCCHMaxUsernameLength );
+    User::LeaveIfError( iModel.CCHHandler().GetConnectionParameter( 
+        iModel.CurrentSPEntryId(), ECchUsername, aUsername ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::GetPresencePrefSettingL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::GetPreferredServiceSettingL( RBuf& aValue )
+    {
+    // Select text resource for the current pref telephony value
+    TInt resource = ( iModel.SettingsHandler().IsPreferredTelephonyVoip() &&
+        iModel.SettingsHandler().IsPreferredService(
+        iModel.CurrentSPEntryId() ) ) ?
+        R_CSCSETTINGSUI_SETTING_PREFERRED_SERVICE_ON :
+        R_CSCSETTINGSUI_SETTING_PREFERRED_SERVICE_OFF;
+
+    HBufC* value = StringLoader::LoadLC( resource );
+    aValue.ReAllocL( value->Length() );
+    aValue.Copy( value->Des() );
+    CleanupStack::PopAndDestroy( value );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::GetVccPreferredServiceSettingL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::GetVccPreferredServiceSettingL( RBuf& aValue )
+    {
+    // Select text resource for the current pref telephony value
+    TInt resource = ( iModel.SettingsHandler().IsPreferredTelephonyVoip() &&
+        iModel.SettingsHandler().IsPreferredService(
+        iModel.CurrentSPEntryId() ) ) ?
+        R_CSCSETTINGSUI_SETTING_VCC_PREFERRED_SERVICE_ON :
+        R_CSCSETTINGSUI_SETTING_VCC_PREFERRED_SERVICE_OFF;
+
+    HBufC* value = StringLoader::LoadLC( resource );
+    aValue.ReAllocL( value->Length() );
+    aValue.Copy( value->Des() );
+    CleanupStack::PopAndDestroy( value );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::GetHandoverNotificationToneL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::GetHandoverNotificationTonePrefL( 
+    RBuf& aValue )
+    {
+    HBufC* value = NULL;
+    TOnOff onOff = EOff;
+
+    TRAPD( err, onOff = iModel.SettingsHandler().HandoverNotifTonePrefL( 
+        iModel.CurrentSPEntryId() ) );
+
+    if ( KErrNotFound == err )
+        {
+        iModel.SettingsHandler().SetHandoverNotifTonePrefL( 
+            iModel.CurrentSPEntryId(), EOff );
+        }
+    else if ( err )
+        {
+        User::Leave( err );    
+        }
+    else
+        {
+        // nothing to do
+        }
+
+    if ( EOff == onOff )
+        {
+        value = StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_OFF );
+        }
+    else if ( EOn == onOff)
+        {            
+        value = StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_ON );
+        }
+    else if ( EOONotSet == onOff )
+        {            
+        iModel.SettingsHandler().SetHandoverNotifTonePrefL( 
+            iModel.CurrentSPEntryId(), EOff );
+        
+        value = StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_SETTING_HANDOVER_NOTIF_TONE_OFF );
+        }
+    else
+        {
+        User::Leave( KErrGeneral );     
+        }
+
+    aValue.ReAllocL( value->Length() );
+    aValue.Copy( value->Des() );
+
+    CleanupStack::PopAndDestroy( value );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::GetImToneSettingL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::GetImToneSettingL( RBuf& aValue )
+    {
+    aValue.ReAllocL( KCSCMaxImToneLength );
+
+    MVIMPSTSettingsStore* settings = CVIMPSTSettingsStore::NewLC();
+
+    TInt err = settings->GetL( 
+        iModel.CurrentSPEntryId(), EServiceToneFileName, aValue );
+
+    // If tone path is not found from settings, set Off text
+    if ( KErrNotFound == err || aValue.Length() < 2 )
+        {
+        HBufC* noToneSelected = StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_IM_TONE_OFF );
+
+        User::LeaveIfError( settings->SetL( 
+            iModel.CurrentSPEntryId(), EServiceToneFileName, *noToneSelected ) );       
+
+        // Get tone.
+        User::LeaveIfError( settings->GetL( 
+            iModel.CurrentSPEntryId(), EServiceToneFileName, aValue ) );
+
+        CleanupStack::PopAndDestroy( noToneSelected );
+        }
+    else if ( err )
+        {        
+        User::Leave( err );
+        }
+    else
+        {
+        // KErrNone -> do nothing
+        }
+
+    TInt pos( 0 );    
+    while ( KErrNotFound != pos )
+        {
+        pos = aValue.Find( KDoubleBackSlash );
+        aValue.Delete( 0, pos+1 );
+        }
+
+    CleanupStack::PopAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::GetPresencePrefSettingL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::GetPresencePrefSettingL( RBuf& aValue )
+    {
+    HBufC* value = NULL;
+    TOnOff onOff = EOff;
+
+    TRAPD( err, onOff = iModel.SettingsHandler().PresenceReqPrefL( 
+            iModel.CurrentSPEntryId() ) );
+
+    if ( KErrNotFound == err )
+        {
+        iModel.SettingsHandler().SetPresenceReqPrefL( 
+                iModel.CurrentSPEntryId(), EOff );
+        }
+    else if ( err )
+        {
+        User::Leave( err );    
+        }
+    else
+        {
+        // nothing to do
+        }
+
+    if ( EOff == onOff )
+        {
+        value = StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_PRES_PREF_ALWAYS_ASK );
+        }
+    else if ( EOn == onOff)
+        {            
+        value = StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_PRES_PREF_ACCEPT_AUTOMATICALLY );
+        }
+    else if ( EOONotSet == onOff )
+        {            
+        // Set presence request preference setting default value "off"
+        iModel.SettingsHandler().SetPresenceReqPrefL( 
+            iModel.CurrentSPEntryId(), EOff );
+        
+        value = StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_PRES_PREF_ALWAYS_ASK );
+        }
+    else
+        {
+        User::Leave( KErrGeneral );     
+        }
+
+    aValue.ReAllocL( value->Length() );
+    aValue.Copy( value->Des() );
+
+    CleanupStack::PopAndDestroy( value ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::GetSnapSettingL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::GetSnapSettingL( RBuf& aValue )
+    {
+    // Get Snap name
+    HBufC* snapName = NULL;
+    TInt snapId( 0 );
+    TInt err = iModel.CCHHandler().GetConnectionParameter( 
+       iModel.CurrentSPEntryId(), ECchSnapId, snapId );       
+
+    // If no error, try to get snap name.
+    if ( KErrNone == err )
+        {
+        snapName = iModel.DestinationsHandler().SnapNameL( snapId );
+        
+        if ( snapName )
+           {
+           CleanupStack::PushL( snapName );
+           aValue.ReAllocL( snapName->Length() );
+           aValue.Copy( snapName->Des() );
+           CleanupStack::PopAndDestroy( snapName );
+           }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// CCSCSettingsUiMainContainer::CountComponentControls
+// ---------------------------------------------------------------------------
+//
+TInt CCSCSettingsUiMainContainer::CountComponentControls() const
+    {
+    return 1;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// CCSCSettingsUiMainContainer::SizeChanged
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::SizeChanged()
+    {
+    iListBox->SetRect( Rect() );
+    }
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// CCSCSettingsUiMainContainer::FocusChanged
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::FocusChanged( 
+    TDrawNow aDrawNow )
+    {
+    CCoeControl::FocusChanged( aDrawNow );
+
+    if ( iListBox )
+        {
+        iListBox->SetFocus( IsFocused() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Deletes service.
+// ---------------------------------------------------------------------------
+//
+TBool CCSCSettingsUiMainContainer::DeleteServiceL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::DeleteServiceL - begin" );
+
+    // Show confirmation query for service deletion.
+    // Create confirmation query dialog.
+    TBool isDelete( EFalse );
+    HBufC* string = NULL;
+    CAknQueryDialog* query = 
+        new( ELeave ) CAknQueryDialog( CAknQueryDialog::ENoTone );
+
+    CleanupStack::PushL( query );
+    query->PrepareLC( R_CSC_DELETE_SERVICE_QUERY );
+    string = StringLoader::LoadLC( 
+        R_QTN_CSC_DELETE_SERVICE_QUERY, 
+        iModel.SettingsHandler().ServiceNameL( iModel.CurrentSPEntryId() ) );
+    query->SetPromptL( *string );
+    CleanupStack::PopAndDestroy( string );
+    CleanupStack::Pop( query );
+    if ( query->RunLD() )
+        {
+        // First check if there is a service plugin UID.
+        TInt count = iModel.ServicePluginHandler().PluginCount( 
+            CCSCEngServicePluginHandler::EInitialized );
+
+        TRAPD( err, LaunchCleanupPluginL( iModel.CurrentSPEntryId() ) );
+        if ( KErrNone != err )
+            {
+            iModel.SettingsHandler().DeleteServiceL( 
+                iModel.CurrentSPEntryId() );
+            }
+        isDelete = ETrue;
+        }
+
+    CSCSETUIDEBUG( "CCSCSettingsUiMainContainer::DeleteServiceL - end" );
+    return isDelete;
+    }
+
+// ---------------------------------------------------------------------------
+// Launches cleanup plugin to remove settings.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::LaunchCleanupPluginL( 
+    TUint aServiceId ) const
+    {
+    CSCSETUIDEBUG( 
+        "CCSCSettingsUiMainContainer::LaunchCleanupPluginL - begin" );
+
+    RImplInfoPtrArray implInfoArray;
+    CleanupStack::PushL( TCleanupItem( 
+        ResetAndDestroy, &implInfoArray ) );
+
+    REComSession::ListImplementationsL(
+        KCSCSettingsCleanupPluginInterfaceUid,
+        implInfoArray );
+
+    for ( TInt i( 0 ) ; i < implInfoArray.Count() ; i++ )
+        {                    
+        CCSCEngSettingsCleanupPluginInterface* plugin = 
+            CCSCEngSettingsCleanupPluginInterface::NewL( 
+                implInfoArray[i]->ImplementationUid() );
+
+        CleanupStack::PushL( plugin );
+
+        if ( CCSCEngSettingsCleanupPluginInterface::ESipVoIPCleanupPlugin 
+            == plugin->PluginType() )
+            {
+            plugin->RemoveSettingsL( aServiceId );
+            }
+
+        CleanupStack::PopAndDestroy( plugin );
+        }
+
+    CleanupStack::PopAndDestroy( &implInfoArray );
+    REComSession::FinalClose();
+
+    CSCSETUIDEBUG(
+        "CCSCSettingsUiMainContainer::LaunchCleanupPluginL - end" );
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainContainer::ResetAndDestroy
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainContainer::ResetAndDestroy( TAny* aArray )
+     {
+     if ( aArray )
+         {
+         RImplInfoPtrArray* array = 
+             reinterpret_cast<RImplInfoPtrArray*>( aArray );
+         array->ResetAndDestroy();
+         }
+     }
+
+// End of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/src/cscsettingsuimainview.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1007 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSCSettingsUiMainView methods
+*
+*/
+
+
+#include <hlplch.h>
+#include <aknview.h>
+#include <featmgr.h>
+#include <akntitle.h>
+#include <aknlists.h>
+#include <cchclient.h>
+#include <e32property.h>
+#include <aknViewAppUi.h>
+#include <StringLoader.h>
+#include <cmsettingsui.h>
+#include <xSPViewServices.h>
+#include <aknnotewrappers.h>
+#include <cscsettingsui.rsg>
+#include <ctsydomainpskeys.h>
+#include <akntextsettingpage.h>
+#include <cvimpstsettingsstore.h>
+#include <DRMHelper.h>
+#include <mediafilelist.h>
+#include <aknpasswordsettingpage.h>
+#include <aknradiobuttonsettingpage.h>
+#include <aknnavi.h>
+#include <aknnavide.h>
+#include <vwsdef.h>
+#include <AknDef.h>
+
+#include "cscconstants.h"
+#include "cscsettingsui.hrh"
+#include "cscsettingsuimodel.h"
+#include "cscsettingsuilogger.h"
+#include "cscengservicehandler.h"
+#include "cscengbrandinghandler.h"
+#include "cscsettingsuimainview.h"
+#include "cscsettingsuiconstants.h"
+#include "cscengservicepluginhandler.h"
+#include "cscappui.h"
+
+
+#define AppUi() (static_cast<CAknViewAppUi*>(iAvkonAppUi) )
+
+// Preferred service not set
+const TInt KPrefServiceNotSet = 0;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiMainView::CCSCSettingsUiMainView( 
+    CCSCSettingsUiModel& aModel )
+    : iModel( aModel )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::ConstructL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::ConstructL - begin" );
+        
+    BaseConstructL( R_CSCSETTINGSUI_MAINVIEW );
+    
+    // Get handle to titlepane
+    CEikStatusPane* statusPane = StatusPane();   
+    iTitlePane = static_cast<CAknTitlePane*> 
+        ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+        
+    iImToneSelectionListOpen = EFalse;
+    iSnapListOpen = EFalse;
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::ConstructL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//      
+CCSCSettingsUiMainView* CCSCSettingsUiMainView::NewL( 
+    CCSCSettingsUiModel& aModel )
+    {    
+    CCSCSettingsUiMainView* self = CCSCSettingsUiMainView::NewLC( aModel );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiMainView* CCSCSettingsUiMainView::NewLC( 
+    CCSCSettingsUiModel& aModel )
+    {    
+    CCSCSettingsUiMainView* self = 
+        new ( ELeave ) CCSCSettingsUiMainView( aModel );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiMainView::~CCSCSettingsUiMainView()
+    {
+    CSCSETUIDEBUG( 
+        "CCSCSettingsUiMainView::~CCSCSettingsUiMainView - begin" );
+    
+    // Delete container when view is deactivated.
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+    
+    delete iNaviDecorator;
+    
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::~CCSCSettingsUiMainView - end" );
+    }         
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::UpdateSoftkeysL
+// Processes situation when it�s notified that softkeys need to be changed.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::UpdateSoftkeysL( )
+    {
+    // not used
+    }
+
+
+// ---------------------------------------------------------------------------
+// From CAknView.
+// CCSCSettingsUiMainView::Id
+// ---------------------------------------------------------------------------
+//
+TUid CCSCSettingsUiMainView::Id() const
+    {
+    return KCSCSettingsUiMainViewId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::SetTitleTextL
+// Changes given service name to title pane.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::SetTitleTextL()
+    {
+    // Create text and set it to titlepane.
+    TBuf<KCSCSettingsUiItemLength> titleText ( KNullDesC );
+    TUint entryId = iModel.CurrentSPEntryId();
+    titleText = iModel.SettingsHandler().ServiceNameL( entryId );
+    HBufC* text = StringLoader::LoadLC( 
+        R_CSCSETTINGSUI_MAINVIEW_TITLE, 
+        titleText );
+    iTitlePane->SetTextL( *text );
+    CleanupStack::PopAndDestroy( text );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::IsEditPreferredServiceSettingAllowedL
+//  For checking if editing of preferred service setting is allowed
+// ---------------------------------------------------------------------------
+//
+TBool CCSCSettingsUiMainView::IsEditPreferredServiceSettingAllowedL()
+    {
+    TBool allowed( EFalse );
+    TInt value( KErrNotFound );
+    
+    User::LeaveIfError( 
+            RProperty::Get( 
+                    KPSUidCtsyCallInformation,
+                    KCTsyCallState,
+                    value ) );
+
+    // Editing is allowed if no ongoing call.
+    if ( EPSCTsyCallStateNone == value )
+        {
+        allowed = ETrue;
+        }
+    else
+        {
+        // Show unable to change settings note
+        HBufC* string = NULL;
+        string = StringLoader::LoadL( 
+                R_CSCSETTINGSUI_UNABLE_TO_EDIT_SETTING_NOTE );
+                
+        if ( string )
+            {
+            // Set text and show note.
+            CleanupStack::PushL( string );   
+            CAknInformationNote* note = 
+            new ( ELeave ) CAknInformationNote( ETrue );
+            note->ExecuteLD( *string );
+            CleanupStack::PopAndDestroy( string );
+            }
+        }
+    
+    return allowed;
+    }
+
+// ---------------------------------------------------------------------------
+// From CEikAppUi
+// CCSCSettingsUiMainView::HandleCommandL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::HandleCommandL( TInt aCommand )
+    {
+    CSCSETUIDEBUG2( "CCSCSettingsUiMainView::HandleCommandL: command=%d",
+         aCommand );
+    
+    TMainListBoxItem listBoxItem = iContainer->CurrentItem();
+    
+    switch ( aCommand )
+        { 
+        case ECSCMSKSettingsUiChange:
+            {
+            HandleMskChangeSelectionL( listBoxItem );
+            break;
+            }
+        case ECSCSettingsUiOpen:
+        case ECSCSettingsUiChange:
+            {
+            HandleListBoxSelectionL();
+            break;
+            }   
+        case EAknCmdHelp:
+            {
+            if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+                {
+                CArrayFix<TCoeHelpContext>* buf = AppUi()->AppHelpContextL();
+                    HlpLauncher::LaunchHelpApplicationL(
+                        iEikonEnv->WsSession(), buf );
+                }
+            break;
+            }         
+        case EAknSoftkeyBack:
+            {
+            HandleReturnToPreviousViewL();
+            break;
+            }
+        case ECSCSettingsUiDelete:
+            {
+            CSCSETUIDEBUG( "    HandleCommandL - delete service" );
+            iDeleted = iContainer->DeleteServiceL();
+            HandleReturnToPreviousViewL( EFalse );
+            break;
+            }
+        case EEikCmdExit:
+        case EAknSoftkeyExit:
+            {
+            HandleSettingsUiExitL();
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// CCSCSettingsUiMainView::DoActivateL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::DoActivateL( 
+    const TVwsViewId& /*aPrevViewId*/, 
+    TUid /*aCustomMessageId*/,
+    const TDesC8& /*aCustomMessage*/ )
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoActivateL - begin" );
+
+    // Create container when view is activated.
+    if ( !iContainer )
+        {
+        iContainer = new ( ELeave ) CCSCSettingsUiMainContainer( iModel );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( ClientRect() );
+        AppUi()->AddToStackL( *this, iContainer );
+        iContainer->ListBox()->SetListBoxObserver( this );
+        }
+
+    SetTitleTextL();
+    UpdateSoftkeysL();
+    iContainer->UpdateContainerL();
+
+    if ( !iNaviPane )
+         {
+         iNaviPane = static_cast<CAknNavigationControlContainer*>(
+             iAvkonAppUi->StatusPane()->ControlL(
+             TUid::Uid(EEikStatusPaneUidNavi)));
+         } 
+
+     if ( !iNaviDecorator )
+         {
+         iNaviDecorator = iNaviPane->CreateNavigationLabelL();
+         iNaviPane->PushL( *iNaviDecorator );
+         }
+
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoActivateL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// CCSCSettingsUiMainView::DoDeactivate()
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::DoDeactivate()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoDeactivate - begin" );
+    
+    if ( iNaviPane && iNaviDecorator )
+            {
+            iNaviPane->Pop( iNaviDecorator );
+            }
+   delete iNaviDecorator;
+   iNaviDecorator = NULL;
+    
+    // Delete container when view is deactivated.
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::DoDeactivate - end" );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// From MEikListBoxObserver
+// CSCSettingsUiMainView::HandleListBoxEventL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::HandleListBoxEventL( 
+    CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
+    {
+    TMainListBoxItem listBoxItem = iContainer->CurrentItem();
+    
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemSingleClicked:
+            {
+            if ( TMainListBoxItem::EPreferredService == listBoxItem.iItem || 
+                 TMainListBoxItem::EVccPreferredService == listBoxItem.iItem ||
+                 TMainListBoxItem::EHandoverNotifTone == listBoxItem.iItem )
+                {
+                HandleCommandL( ECSCMSKSettingsUiChange );
+                }
+            else
+                {
+                HandleListBoxSelectionL();
+                }
+            break;
+            }
+ 
+        default:
+           break;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MEikListBoxObserver
+// CCSCSettingsUiMainView::HandleListBoxSelectionL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::HandleListBoxSelectionL() 
+    {        
+    TMainListBoxItem listBoxItem = iContainer->CurrentItem();
+    
+    switch( listBoxItem.iItem )
+        {
+        case TMainListBoxItem::EUsername:
+            ShowUsernameSettingPageL();
+            break;           
+        case TMainListBoxItem::EPassword:
+            ShowPasswordSettingPageL();
+            break;
+        case TMainListBoxItem::EPreferredService:
+            ShowPrefServiceSettingPageL();
+            break;
+        case TMainListBoxItem::EVccPreferredService:
+            ShowVccPrefServiceSettingPageL();
+            break;
+        case TMainListBoxItem::EHandoverNotifTone:
+            iContainer->HandoverNotificationToneQueryL();
+            break;
+        case TMainListBoxItem::EImTone:
+            ShowImToneSelectionListL();
+            break;
+        case TMainListBoxItem::EAutoacceptInv:
+            iContainer->PresenceReqPrefQueryL();
+            break;
+        case TMainListBoxItem::EServiceConn:
+            LaunchCMSettingsUiL();
+            break;
+        default:
+            User::Leave( KErrNotSupported );
+            break;
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// From MEikListBoxObserver
+// CCSCSettingsUiMainView::DynInitMenuPaneL
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::DynInitMenuPaneL( 
+    TInt aResourceId, CEikMenuPane* aMenuPane )
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::DynInitMenuPaneL - begin" );
+    
+    if ( aMenuPane && R_CSCSETTINGSUI_MAINVIEW_MENU == aResourceId )
+        {
+        TMainListBoxItem listBoxItem = iContainer->CurrentItem();
+    
+        switch ( listBoxItem.iItem )
+            {
+            // Hide "Change" and show "Open"
+            case TMainListBoxItem::EServiceConn:
+                aMenuPane->SetItemDimmed( ECSCSettingsUiChange, ETrue );
+                aMenuPane->SetItemDimmed( ECSCSettingsUiOpen, EFalse );
+                break;
+            // Show "Change" and hide "Open"
+            case TMainListBoxItem::EUsername:
+            case TMainListBoxItem::EPassword:
+            case TMainListBoxItem::EPreferredService:
+            case TMainListBoxItem::EVccPreferredService:
+            case TMainListBoxItem::EHandoverNotifTone:
+            case TMainListBoxItem::EAutoacceptInv:     
+            case TMainListBoxItem::EImTone:
+                aMenuPane->SetItemDimmed( ECSCSettingsUiChange, EFalse );
+                aMenuPane->SetItemDimmed( ECSCSettingsUiOpen, ETrue );
+                break;   
+            // Hide both of options. Case should not be possible.       
+            default:
+                 aMenuPane->SetItemDimmed( ECSCSettingsUiChange, ETrue );
+                 aMenuPane->SetItemDimmed( ECSCSettingsUiOpen, ETrue );
+            break;
+            }
+        if ( !(iModel.CCHHandler().IsServiceDisabled( 
+            iModel.CurrentSPEntryId() ) ) )
+            {
+            aMenuPane->SetItemDimmed( ECSCSettingsUiDelete, ETrue );
+            }
+        }
+     
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::DynInitMenuPaneL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::ShowUsernameSettingPageL()
+// Shows username setting page - for username input.
+// ---------------------------------------------------------------------------
+void CCSCSettingsUiMainView::ShowUsernameSettingPageL()
+    {
+    // Editing is allowed if service is disabled.
+    if ( iModel.CCHHandler().IsServiceDisabled( iModel.CurrentSPEntryId() ) )
+        {
+        RBuf username;
+        CleanupClosePushL( username );
+        username.CreateL( KCCHMaxUsernameLength );
+        
+        User::LeaveIfError( 
+            iModel.CCHHandler().GetConnectionParameter( 
+                    iModel.CurrentSPEntryId(), ECchUsername, username ) );
+            
+        CAknTextSettingPage* dlg = 
+            new(ELeave) CAknTextSettingPage( 
+                R_CSCSETTINGSUI_USERNAME_SETTING_PAGE, username );
+        
+        if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+            { 
+            // Set username       
+            User::LeaveIfError( 
+                iModel.CCHHandler().SetConnectionParameter( 
+                    iModel.CurrentSPEntryId(), ECchUsername, username ) );
+            }
+        
+        CleanupStack::PopAndDestroy( &username );
+        
+        iContainer->UpdateContainerL();
+        }
+    else
+        {
+        // Show unable to change settings note
+        HBufC* string = NULL;
+        string = StringLoader::LoadL( 
+                R_CSCSETTINGSUI_UNABLE_TO_EDIT_WHILE_ONLINE );
+        
+        if ( string )
+            {
+            // Set text and show note.
+            CleanupStack::PushL( string );   
+            CAknInformationNote* note = 
+                new ( ELeave ) CAknInformationNote( ETrue );
+            note->ExecuteLD( *string );
+            CleanupStack::PopAndDestroy( string );
+            }
+        }
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::ShowPasswordSettingPageL()
+// Shows password setting page - for password input.
+// ---------------------------------------------------------------------------
+void CCSCSettingsUiMainView::ShowPasswordSettingPageL()
+    {
+    // Editing is allowed if service is disabled.
+    if ( iModel.CCHHandler().IsServiceDisabled( iModel.CurrentSPEntryId() ) )
+        {
+        RBuf password;
+        CleanupClosePushL( password );
+        password.CreateL( KCCHMaxPasswordLength );
+           
+        CAknAlphaPasswordSettingPage* dlg = 
+                new ( ELeave ) CAknAlphaPasswordSettingPage(
+                        R_CSCSETTINGSUI_PASSWORD_SETTING_PAGE, 
+                        password, 
+                        KNullDesC );
+        
+        if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+            {
+            // Set password
+            User::LeaveIfError( 
+                iModel.CCHHandler().SetConnectionParameter( 
+                    iModel.CurrentSPEntryId(), ECchPassword, password ) );
+            }
+           
+        CleanupStack::PopAndDestroy( &password );
+        
+        iContainer->UpdateContainerL();
+        }
+    else
+        {
+        // Show unable to change settings note
+        HBufC* string = NULL;
+        string = StringLoader::LoadL( 
+                R_CSCSETTINGSUI_UNABLE_TO_EDIT_WHILE_ONLINE );
+        
+        if ( string )
+            {
+            // Set text and show note.
+            CleanupStack::PushL( string );   
+            CAknInformationNote* note = 
+                new ( ELeave ) CAknInformationNote( ETrue );
+            note->ExecuteLD( *string );
+            CleanupStack::PopAndDestroy( string );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::ShowPrefServiceSettingPageL()
+// Shows Internet call preferred setting page - for ON/OFF setting items
+// ---------------------------------------------------------------------------
+void CCSCSettingsUiMainView::ShowPrefServiceSettingPageL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::ShowPrefServiceSettingPageL" );
+    
+    if ( IsEditPreferredServiceSettingAllowedL() )
+        {
+        CDesCArrayFlat* items = 
+             new ( ELeave ) CDesCArrayFlat( 2 );
+        CleanupStack::PushL( items );
+           
+        AppendItemL( *items, R_CSCSETTINGSUI_SETTING_PREFERRED_SERVICE_ON );
+        AppendItemL( *items, R_CSCSETTINGSUI_SETTING_PREFERRED_SERVICE_OFF );
+                  
+        // Get current value of the setting
+        TInt value( iModel.SettingsHandler().IsPreferredTelephonyVoip() &&
+                    iModel.SettingsHandler().IsPreferredService( 
+                           iModel.CurrentSPEntryId() ) ? 
+                           ECSCSettingsPrefServiceOn : 
+                           ECSCSettingsPrefServiceOff);
+              
+        CAknRadioButtonSettingPage* dlg = new( ELeave ) 
+            CAknRadioButtonSettingPage( 
+                   R_CSCSETTINGSUI_PREF_SERVICE_SETTING_PAGE,
+                   value, items );
+            
+        if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+            {
+            // Change value of the preferred telephony setting and set
+            // current preferred service id. If preferred telephony value
+            // is changed as voip then we set this service as preferred
+            // service. Otherwise we set preferred service as not set (=0)
+            TUint serviceId( value == ECSCSettingsPrefServiceOn ? 
+                             iModel.CurrentSPEntryId() : 
+                             KPrefServiceNotSet );
+               
+            iModel.SettingsHandler().SetVoipAsPrefTelephony( 
+                    value == ECSCSettingsPrefServiceOn,
+                    serviceId );
+            }
+               
+        CleanupStack::PopAndDestroy( items );   
+        iContainer->UpdateContainerL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::ShowVccPrefServiceSettingPageL()
+// Shows Internet call preferred setting page - for ON/OFF setting items
+// when VCC is supported
+// ---------------------------------------------------------------------------
+void CCSCSettingsUiMainView::ShowVccPrefServiceSettingPageL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::ShowVccPrefServiceSettingPageL" );
+    
+    if ( IsEditPreferredServiceSettingAllowedL() )
+        {
+        CDesCArrayFlat* items = 
+             new ( ELeave ) CDesCArrayFlat( 2 );
+        CleanupStack::PushL( items );
+           
+        AppendItemL( *items, R_CSCSETTINGSUI_SETTING_VCC_PREFERRED_SERVICE_ON );
+        AppendItemL( *items, R_CSCSETTINGSUI_SETTING_VCC_PREFERRED_SERVICE_OFF );
+                  
+        // Get current value of the setting
+        TInt value( iModel.SettingsHandler().IsPreferredTelephonyVoip() &&
+                    iModel.SettingsHandler().IsPreferredService( 
+                           iModel.CurrentSPEntryId() ) ? 
+                           ECSCSettingsPrefServiceOn : 
+                           ECSCSettingsPrefServiceOff);
+              
+        CAknRadioButtonSettingPage* dlg = new( ELeave ) 
+            CAknRadioButtonSettingPage( 
+                   R_CSCSETTINGSUI_VCC_PREF_SERVICE_SETTING_PAGE,
+                   value, items );
+            
+        if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
+            {
+            // Change value of the preferred telephony setting and set
+            // current preferred service id. If preferred telephony value
+            // is changed as voip then we set this service as preferred
+            // service. Otherwise we set preferred service as not set (=0)
+            TUint serviceId( value == ECSCSettingsPrefServiceOn ? 
+                             iModel.CurrentSPEntryId() : 
+                             KPrefServiceNotSet );
+               
+            iModel.SettingsHandler().SetVoipAsPrefTelephony( 
+                    value == ECSCSettingsPrefServiceOn,
+                    serviceId );
+            }
+               
+        CleanupStack::PopAndDestroy( items );   
+        iContainer->UpdateContainerL();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::ShowImToneSelectionListL()
+// ---------------------------------------------------------------------------
+void CCSCSettingsUiMainView::ShowImToneSelectionListL()
+    {    
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::ShowImToneSelectionListL - begin" );
+    
+    if ( !iImToneSelectionListOpen )
+        {
+        iImToneSelectionListOpen = ETrue;
+        CMediaFileList* list = CMediaFileList::NewL();
+        CleanupStack::PushL( list );
+      
+        HBufC* popupTitle = StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_IM_TONE_POPUP_HEADING );
+        
+        HBufC* noTone = StringLoader::LoadLC( 
+            R_CSCSETTINGSUI_NO_IM_TONE_TEXT );
+        
+        list->SetAttrL( 
+            CMediaFileList::EAttrAutomatedType,
+            CDRMHelper::EAutomatedTypeIMAlert );
+        
+        list->SetNullItemL( 
+            *noTone,
+            KNullDesC, 
+            CMediaFileList::EMediaFileTypeAudio,
+            CMediaFileList::ENullItemIconOff );
+        
+        list->SetAttrL( CMediaFileList::EAttrTitle, *popupTitle );
+        
+        TBuf<KCSCMaxImToneLength> toneName;
+        TInt nullItem = KErrNotFound;    
+        
+        TBool result = list->ShowMediaFileListL(
+            &toneName, &nullItem , NULL, NULL );
+       
+        CleanupStack::PopAndDestroy( noTone );
+        CleanupStack::PopAndDestroy( popupTitle );
+        CleanupStack::PopAndDestroy( list );
+        
+        if ( result )
+            {
+            iContainer->SaveImTonePathL( toneName );
+            }
+        else if( KErrNotFound != nullItem )
+            {
+            iContainer->SaveImTonePathL( KNullDesC );
+            }
+        else
+            {
+            // do nothing
+            }
+        
+        iContainer->UpdateContainerL();
+        iImToneSelectionListOpen = EFalse;
+        }
+    
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::ShowImToneSelectionListL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::HandleMskChangeSelectionL()
+// Handles 'change' middle softkey selection.
+// ---------------------------------------------------------------------------
+void CCSCSettingsUiMainView::HandleMskChangeSelectionL(
+    TMainListBoxItem aListBoxItem )
+    {
+    switch ( aListBoxItem.iItem )
+        {
+        case TMainListBoxItem::EPreferredService:
+        case TMainListBoxItem::EVccPreferredService:
+            {
+            ChangePrefTelephonyValueL();
+            }
+            break;
+        case TMainListBoxItem::EHandoverNotifTone:
+            {
+            ChangeHandoverNotifToneValueL();
+            }
+            break;
+        default:
+            {
+            User::Leave( KErrArgument );
+            }
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::ChangePrefTelephonyValueL()
+// Changes the value of the preferred telephony setting
+// ---------------------------------------------------------------------------
+void CCSCSettingsUiMainView::ChangePrefTelephonyValueL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::ChangePrefTelephonyValueL" );
+    
+    if ( IsEditPreferredServiceSettingAllowedL() )
+        {
+        // Check is this service preferred service
+        TBool prefService( 
+                iModel.SettingsHandler().IsPreferredTelephonyVoip() &&
+                iModel.SettingsHandler().IsPreferredService( 
+                iModel.CurrentSPEntryId() ));
+          
+        // Set preferred service id as not set (=0) if preferred telephony
+        // setting is changed as CS.
+        TUint serviceId( prefService ? KPrefServiceNotSet : 
+                                         iModel.CurrentSPEntryId() );
+          
+        // Set preferred telephony setting value and current preferred
+        // service id
+        iModel.SettingsHandler().SetVoipAsPrefTelephony( 
+              !prefService,
+              serviceId );
+          
+        iContainer->UpdateContainerL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::ChangeHandoverNotifToneValueL()
+// Changes the value of the handover notify tone setting.
+// ---------------------------------------------------------------------------
+void CCSCSettingsUiMainView::ChangeHandoverNotifToneValueL()
+    {
+    TOnOff onOff = iModel.SettingsHandler().HandoverNotifTonePrefL( 
+        iModel.CurrentSPEntryId() );
+    
+    if ( EOn == onOff )
+        {
+        iModel.SettingsHandler().SetHandoverNotifTonePrefL( 
+            iModel.CurrentSPEntryId(), EOff );
+        }
+    else
+        {
+        iModel.SettingsHandler().SetHandoverNotifTonePrefL( 
+            iModel.CurrentSPEntryId(), EOn );
+        }
+    
+    iContainer->UpdateContainerL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCSCSettingsUiMainView::AppendItemL
+// Appends resource texts to the des array.
+// -----------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::AppendItemL( 
+    CDesCArrayFlat& aList, TInt aItem )
+    {
+    HBufC* string = StringLoader::LoadLC( aItem );
+    aList.AppendL( *string );
+    CleanupStack::PopAndDestroy( string );
+    }    
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::LaunchCMSettingsUiL
+// Launches Connection Method Settings Ui for editing destinations.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::LaunchCMSettingsUiL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::LaunchCMSettingsUiL" );
+    if ( iSnapListOpen )
+        {
+        CSCSETUIDEBUG( "CCSCSettingsUiMainView::LaunchCMSettingsUiL  end" );
+        return;
+        }
+    
+    // Launch Connection Method Settings Ui.
+    CCmSettingsUi* cmSettingsUi = CCmSettingsUi::NewL();
+    CleanupStack::PushL( cmSettingsUi );
+    iSnapListOpen = ETrue;
+    if ( CCmSettingsUi::EExit == cmSettingsUi->RunSettingsL() )
+        {
+        HandleCommandL( EEikCmdExit );
+        }
+    CleanupStack::PopAndDestroy( cmSettingsUi );
+    iSnapListOpen = EFalse;
+    ResetViewL();
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::LaunchCMSettingsUiL  end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::HandleReturnToPreviousViewL
+// Handles returning to previous view where settingsui was launced.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::HandleReturnToPreviousViewL( TBool aViewBack )
+    {
+    CSCSETUIDEBUG( 
+        "CCSCSettingsUiMainView::HandleReturnToPreviousViewL - IN" );
+
+    if ( iModel.ReturnViewId() != KNullUid )
+        {             
+        TUid tabview( KNullUid );
+
+        // Error code not needed.
+        TRAP_IGNORE( 
+            tabview.iUid = iModel.SettingsHandler().ServiceTabViewIdL( 
+            iModel.CurrentSPEntryId() ) )
+
+        // Launched from phonebookview.
+        // Press Back button, return PhoneBookTabView.
+        if ( aViewBack && tabview.iUid == iModel.ReturnViewId().iUid )
+            {
+            RxSPViewServices viewServices;
+            TInt err = viewServices.Activate( 
+                KPhoneBookTabUid.iUid, 
+                iModel.ReturnViewId().iUid );
+
+            CSCSETUIDEBUG2( "   --> ACTIVATE ERR=%d", err );
+
+            AppUi()->HandleCommandL( EEikCmdExit );
+            }
+        
+        if ( iDeleted && KCSCServiceViewId != iModel.ReturnViewId() )
+            {
+            // Launched from phonebookview.
+            // Press Ok button, return homescreen.
+            TVwsViewId idleId;
+            AknDef::GetPhoneIdleViewId( idleId );
+            ActivateViewL( idleId );
+            AppUi()->HandleCommandL( EEikCmdExit );
+            }
+        else if( !iDeleted && KCSCServiceViewId != iModel.ReturnViewId() )
+            {
+            // Launched from phonebookview.
+            // Press cancel button, return current view.
+            TUid curview = Id();
+            AppUi()->ActivateLocalViewL( curview );
+            }
+        else if( !aViewBack && !iDeleted && KCSCServiceViewId == iModel.ReturnViewId() )
+            {
+            // Launched from service view.
+            // Press cancel button, return current view.
+            TUid curview = Id();
+            AppUi()->ActivateLocalViewL( curview );
+            }
+        else
+            {
+            // Launched from service view.
+            // Press Back button or Press Delete button, activate previous view.
+            AppUi()->ActivateLocalViewL( iModel.ReturnViewId() );
+            }
+        }
+      
+    CSCSETUIDEBUG( 
+        "CCSCSettingsUiMainView::HandleReturnToPreviousViewL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::HandleSettingsUiExitL
+//  Handles exist from settingsui.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::HandleSettingsUiExitL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::HandleSettingsUiExitL - IN" );
+    
+    if ( iModel.ReturnViewId() != KNullUid )
+        {
+        TUid tabview( KNullUid );
+        TRAPD( err, tabview.iUid = iModel.SettingsHandler().ServiceTabViewIdL( 
+            iModel.CurrentSPEntryId() ) )
+        
+        if ( tabview.iUid == iModel.ReturnViewId().iUid && !err )
+            {
+            // Launched from service tab, go back there
+            RxSPViewServices viewServices;
+            viewServices.Activate( 
+                KPhoneBookTabUid.iUid, 
+                iModel.ReturnViewId().iUid );     
+            
+            AppUi()->HandleCommandL( EEikCmdExit );
+            }
+        else
+            { 
+            // Not launched from service tab, just exit
+            AppUi()->HandleCommandL( EEikCmdExit );
+            }        
+        }
+       
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::HandleSettingsUiExitL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiMainView::ResetViewL
+// Resets service settings when switching services
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiMainView::ResetViewL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::ResetViewL - IN" );
+
+    // Do not update view if SNAP list is open because in some cases
+    // there will be problems with title and status bar.
+    if ( iSnapListOpen )
+        {
+        CSCSETUIDEBUG( "CCSCSettingsUiMainView::ResetViewL - OUT" );
+        return;
+        }
+    // Create container when view is activated.
+    if ( !iContainer )
+        {
+        iContainer = new (ELeave) CCSCSettingsUiMainContainer( iModel );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( ClientRect() );
+        AppUi()->AddToStackL( *this, iContainer );
+        iContainer->ListBox()->SetListBoxObserver( this );
+        }
+
+    SetTitleTextL();
+    UpdateSoftkeysL();
+    iContainer->UpdateContainerL();
+
+    CSCSETUIDEBUG( "CCSCSettingsUiMainView::ResetViewL - OUT" );
+    }
+
+// End of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsettingsui/src/cscsettingsuimodel.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,269 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CSCSettingsUiModel methods
+*
+*/
+
+
+#include <eikenv.h>
+#include <cchclient.h>
+#include <cmmanagerext.h>
+#include <AknIconUtils.h>
+#include <mspnotifychangeobserver.h>
+
+#include "cscsettingsui.hrh"
+#include "cscengcchhandler.h"
+#include "cscsettingsuimodel.h"
+#include "cscsettingsuilogger.h"
+#include "cscengservicehandler.h"
+#include "cscengbrandinghandler.h"
+#include "cscsettingsuiconstants.h"
+#include "cscengdestinationshandler.h"
+#include "mcscsettingsuimodelobserver.h"
+#include "cscengservicepluginhandler.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiModel::CCSCSettingsUiModel( 
+    MCSCSettingsUiModelObserver& aObserver,
+    CEikonEnv& aEikEnv )
+    : iObserver( aObserver ),
+    iEikEnv( aEikEnv )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiModel::ConstructL()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiModel::ConstructL - begin" );
+
+    // Create handle to CSC's Service Provider Settings Handler.
+    iSPSHandler = CCSCEngServiceHandler::NewL( this );
+
+    // Create handle to CSC's Converged Connection Handler.
+    iCCHHandler = CCSCEngCCHHandler::NewL( *this );
+
+    // Create handle to CSC's Destinations Handler.
+    iDestinationsHandler = CCSCEngDestinationsHandler::NewL();
+
+    // Create handle to CSC's Branding Server Handler.
+    iBSHandler = CCSCEngBrandingHandler::NewL();
+
+    // Create CSC's Service Plugin Handler.
+    iServicePluginHandler = CCSCEngServicePluginHandler::NewL( 
+        iEikEnv, *this, *iSPSHandler );
+
+    CSCSETUIDEBUG( "CCSCSettingsUiModel::ConstructL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiModel* CCSCSettingsUiModel::NewL( 
+    MCSCSettingsUiModelObserver& aObserver,
+    CEikonEnv& aEikEnv )
+    {
+    CCSCSettingsUiModel* self = 
+        CCSCSettingsUiModel::NewLC( aObserver, aEikEnv );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiModel* CCSCSettingsUiModel::NewLC(
+    MCSCSettingsUiModelObserver& aObserver,
+    CEikonEnv& aEikEnv )
+    {
+    CCSCSettingsUiModel* self = 
+        new ( ELeave ) CCSCSettingsUiModel( aObserver, aEikEnv );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSettingsUiModel::~CCSCSettingsUiModel()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiModel::~CCSCSettingsUiModel - begin" );
+    
+    delete iBSHandler;
+    delete iSPSHandler;
+    delete iCCHHandler;
+    delete iDestinationsHandler;
+    delete iServicePluginHandler;
+    
+    CSCSETUIDEBUG( "CCSCSettingsUiModel::~CCSCSettingsUiModel - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiModel::SettingsHandler
+// Returns reference to CSC's Service Provider Settings Handler.
+// ---------------------------------------------------------------------------
+//
+CCSCEngServiceHandler& CCSCSettingsUiModel::SettingsHandler() const
+    {
+    return *iSPSHandler;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiModel::CCHHandler
+// Returns reference to CSC's Converged Connection Handler.
+// ---------------------------------------------------------------------------
+//
+CCSCEngCCHHandler& CCSCSettingsUiModel::CCHHandler() const
+    {
+    return *iCCHHandler;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiModel::DestinationsHandler
+// Returns reference to CSC's Destinations Handler.
+// ---------------------------------------------------------------------------
+//
+CCSCEngDestinationsHandler& CCSCSettingsUiModel::DestinationsHandler() const
+    {
+    return *iDestinationsHandler;
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiModel::BSHandler
+// Returns reference to CSC's Branding Server Handler.
+// ---------------------------------------------------------------------------
+//
+CCSCEngBrandingHandler& CCSCSettingsUiModel::BSHandler() const
+    {
+    return *iBSHandler;
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiModel::ServicePluginHandler
+// Returns reference to CSC's Service Plugin Handler.
+// ---------------------------------------------------------------------------
+//
+CCSCEngServicePluginHandler& CCSCSettingsUiModel::ServicePluginHandler() const
+    {
+    return *iServicePluginHandler;
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiModel::StoreInitializationDataL
+// Stores initialization information.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiModel::StoreInitializationDataL(
+    const TUid& aViewId,
+    TUint aServiceId )
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiModel::StoreInitializationDataL - begin" );
+
+    // View id for customer application return view id.
+    iViewId = aViewId;
+
+    // Check that service exists in service table.
+    RArray<TUint> spEntryIds;
+    CleanupClosePushL( spEntryIds );
+    iSPSHandler->GetAllServiceIdsL( spEntryIds );
+    User::LeaveIfError( spEntryIds.Find( aServiceId ) );
+    CleanupStack::PopAndDestroy( &spEntryIds );
+    iServiceId = aServiceId;
+
+    CSCSETUIDEBUG( "CCSCSettingsUiModel::StoreInitializationDataL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiModel::UpdateSoftkeys
+// To notify when softkeys need to be changed.
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiModel::UpdateSoftkeys()
+    {
+    CSCSETUIDEBUG( "CCSCSettingsUiModel::UpdateSoftkeys - begin" );
+   
+    iObserver.UpdateSoftkeys();
+    
+    CSCSETUIDEBUG( "CCSCSettingsUiModel::UpdateSoftkeys - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiModel::ReturnViewId
+// Returns uid of the view where to be returned.
+// ---------------------------------------------------------------------------
+//
+TUid CCSCSettingsUiModel::ReturnViewId() const
+    {
+    return iViewId;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCSCSettingsUiModel::CurrentSPEntryId
+// Returns currently selected service provider entry id.
+// ---------------------------------------------------------------------------
+//
+TUint CCSCSettingsUiModel::CurrentSPEntryId() const
+    {
+    return iServiceId;
+    }
+
+// ---------------------------------------------------------------------------
+// From MCSCEngCCHObserver.
+// CCSCSettingsUiModel::ServiceStatusChanged
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiModel::ServiceStatusChanged(
+    TUint /*aServiceId*/, 
+    TCCHSubserviceType /*aType*/, 
+    const TCchServiceStatus& /*aServiceStatus*/ )
+    {
+    // Not used.
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MCSCEngServiceObserver.
+// CCSCSettingsUiModel::NotifyServiceChange
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiModel::NotifyServiceChange()
+    {
+    // Not used.
+    }
+
+// ---------------------------------------------------------------------------
+// From MCSCProvisioningObserver.
+// CCSCSettingsUiModel::NotifyServicePluginResponse
+// ---------------------------------------------------------------------------
+//
+void CCSCSettingsUiModel::NotifyServicePluginResponse( 
+    const CCSCEngServicePluginHandler::TServicePluginResponse& /*aResponse*/,
+    const TInt /*aIndex*/, const TUid& /*aPluginUid*/ )
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/data/2000B007.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2002-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 cscsipvoipcleanupplugin
+*
+*/
+
+
+#include <registryinfov2.rh>
+//#include <cscengsettingscleanupplugininterface.h>
+
+#include "cscsvcpluginuids.hrh"
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid     = KCSCSvcPluginDllUid;
+    interfaces  = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid   = KCSCSvcPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid  = KCSCSvcPluginImplUid;
+                    version_no          = 1;
+                    }
+                };
+            }
+        };
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 cscsipvoipcleanupplugin
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+cscsipvoipcleanupplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/group/cscsipvoipcleanupplugin.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 cscsipvoipcleanupplugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../inc/cscsvcpluginuids.hrh"
+
+CAPABILITY      CAP_ECOM_PLUGIN
+TARGET          cscsipvoipcleanupplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D KCSCSvcPluginDllUid
+
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          cscsvcplugin.cpp
+SOURCE          cscsvcpluginhandler.cpp
+SOURCE          cscsvcpluginsiphandler.cpp
+SOURCE          cscsvcpluginrcsehandler.cpp
+SOURCE          cscsvcplugincenrephandler.cpp
+SOURCE          cscsvcpluginimplementationtable.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../data
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+SYSTEMINCLUDE   ../../../inc
+
+SOURCEPATH      ../data
+
+//ECOM resource definition
+START RESOURCE      2000B007.rss
+TARGET              cscsipvoipcleanupplugin.rsc
+END //  ECOM resource definition
+
+LIBRARY         ecom.lib
+LIBRARY         bafl.lib
+LIBRARY         rcse.lib
+LIBRARY         euser.lib
+LIBRARY         estor.lib
+LIBRARY         efsrv.lib
+LIBRARY         commdb.lib
+LIBRARY         sipcodec.lib
+LIBRARY         cmmanager.lib
+LIBRARY         inetprotutil.lib
+LIBRARY         sipprofilecli.lib
+LIBRARY         xdmsettingsapi.lib
+LIBRARY         centralrepository.lib
+LIBRARY         presencesettingsapi.lib
+LIBRARY         serviceprovidersettings.lib
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/inc/cscsvcplugin.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_CSCSVCPLUGIN_H
+#define C_CSCSVCPLUGIN_H
+
+#include <e32base.h>
+
+#include "cscengsettingscleanupplugininterface.h"
+
+class CCSCSvcPluginHandler;
+
+/**
+ *  An instance of class CCSCSvcPlugin.
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+class CCSCSvcPlugin : public CCSCEngSettingsCleanupPluginInterface
+    {
+    public:
+
+        static CCSCSvcPlugin* NewL();
+
+				/**
+         * Destructor.
+         */
+        ~CCSCSvcPlugin();
+        
+        
+        // From base class CCSCEngSettingsCleanupPluginInterface
+        
+        /**
+         * From CCSCEngSettingsCleanupPluginInterface
+         * Get plugin type.
+         *
+         * @since S60 v3.2
+         */
+        TCSCPluginType PluginType() const;
+
+        /**
+         * From CCSCEngSettingsCleanupPluginInterface
+         * Remove settings based on service id.
+         *
+         * @since S60 v3.2
+         */
+        void RemoveSettingsL( TUint32 aServiceId );
+
+
+    private:
+              
+        CCSCSvcPlugin();
+
+        void ConstructL();
+
+    
+    private:  // data
+    
+    	/*
+         * Handle to CCSCSvcPluginHandler.
+         * Own.
+         */
+        CCSCSvcPluginHandler* iSvcPluginHandler;
+    };
+
+#endif  // C_CSCSVCPLUGIN_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/inc/cscsvcplugincenrephandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,82 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_CSCSVCPLUGINCENREPHANDLER_H
+#define C_CSCSVCPLUGINCENREPHANDLER_H
+
+
+class CRepository;
+
+
+/**
+ *  An instance of class CCSCSvcPluginCenrepHandler.
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS (CCSCSvcPluginCenrepHandler) : public CBase
+    {
+    public:
+
+        static CCSCSvcPluginCenrepHandler* NewL();
+
+				/**
+         * Destructor.
+         */
+        ~CCSCSvcPluginCenrepHandler();
+
+
+        /**
+         * Destroys IAP spesific NAT/FW settings based on IAP id.
+         * Function leaves on failure.
+         *
+         * @since S60 v3.2
+         * @param aIapId for IAP id
+         */
+        void RemoveIapSpecificNatfwSettingsL( TInt aIapId );
+
+
+        /**
+         * Destroys Domain spesific NAT/FW settings based on domain name.
+         * Function leaves on failure.
+         *
+         * @since S60 v3.2
+         * @param aIapId for IAP id
+         */
+        void RemoveDomainSpecificNatfwSettingsL( const TDesC8& aDomainName );
+
+
+    private:
+                
+        CCSCSvcPluginCenrepHandler();
+
+        void ConstructL();
+
+    
+    private: // data
+            
+        /*
+         * Handle to NAT/FW repository.
+         * Own.
+         */
+        CRepository* iNatfwRepository;      
+    };
+
+#endif  // C_CSCSVCPLUGINCENREPHANDLER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/inc/cscsvcpluginhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,141 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_CSCSVCPLUGINHANDLER_H
+#define C_CSCSVCPLUGINHANDLER_H
+
+#include <e32base.h>
+#include <badesca.h>
+
+class CCSCSvcPluginSipHandler;
+class CCSCSvcPluginRcseHandler;
+class CCSCSvcPluginCenrepHandler;
+ 
+/**
+ *  An instance of class CCSCSvcPluginHandler.
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS ( CCSCSvcPluginHandler ) : public CBase
+    {
+    public:
+
+        static CCSCSvcPluginHandler* NewL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCSvcPluginHandler();
+     
+     		
+     		/**
+         * Removes settings based on service id.
+         * Function leaves on failure.
+         *
+         * @since S60 v3.2
+         * @param aServiceId service id
+         */
+        void RemoveSettingsL( TUint32 aServiceId );   
+                
+    private:
+
+        CCSCSvcPluginHandler();
+
+        void ConstructL();
+ 
+        
+        /**
+         * Search settings data based on service id.
+         * Function leaves on failure.
+         *
+         * @since S60 v3.2
+         * @param aServiceId service id
+         */
+        void SearchSettingsDataL( TUint32 aServiceId );
+        
+        
+        /**
+         * For removing SIP/VoIP profiles and NAT/FW settings.
+         * Function leaves on failure.
+         *
+         * @since S60 v3.2
+         * @param aServiceId service id
+         */
+        void RemoveProfilesL( TUint32 aServiceId );
+        
+        
+    private: // data
+    
+        /*
+         * Handles events concerning Richcall Setting Engine.
+         * Own.
+         */
+        CCSCSvcPluginRcseHandler* iRcseHandler;
+        
+        /*
+         * Handles events concerning SIP Profile Registry.
+         * Own.
+         */
+        CCSCSvcPluginSipHandler* iSipHandler;
+        
+        /*
+         * Handles events concerning Central Repository.
+         * Own.
+         */
+        CCSCSvcPluginCenrepHandler* iCenRepHandler;
+    
+        /*
+         * VoIP profile id.
+         */
+        TUint32 iVoIPProfileId;
+        
+        /*
+         * SIP profile ids appended to the VoIP profile.
+         * Own.
+         */
+        RArray<TUint32> iSipProfileIds;
+        
+        /*
+         * IAP ids linked to SIP profile ids.
+         * Own.
+         */
+        RArray<TUint32> iIapIds;
+        
+        /*
+         * SNAP ID
+         * Own.
+         */
+        TInt iSNAPId;
+        
+        /*
+         * Presence ID
+         * Own.
+         */
+        TInt iPresenceId;
+        
+        /*
+         * Domain names linked to SIP profile ids.
+         * Own.
+         */
+        CDesC8ArrayFlat* iDomainNames;
+        
+        
+    };
+
+#endif  // C_CSCSVCPLUGINHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/inc/cscsvcpluginlogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,70 @@
+/*
+* 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:  Provides macros for logging
+*
+*/
+
+
+#ifndef CSCSVCPLUGINLOGGER_H
+#define CSCSVCPLUGINLOGGER_H
+
+#include <e32def.h>
+#include <e32debug.h>
+
+
+//----------------------------------------------------------------------------
+//  USER LOGGING SETTINGS
+//----------------------------------------------------------------------------
+
+#ifndef _DEBUG
+
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = RDebug
+***************************/ 
+
+#define CSCSVCPLUGIN_DEBUG             0   // UREL BUILD
+
+#else
+
+#define CSCSVCPLUGIN_DEBUG             1   // UDEB BUILD
+
+#endif // _DEBUG
+
+
+
+//----------------------------------------------------------------------------
+//  LOGGING MACROs (DO NOT EDIT)
+//
+//  USE THESE MACROS IN YOUR CODE
+//----------------------------------------------------------------------------
+
+#if CSCSVCPLUGIN_DEBUG == 1    // RDebug
+
+#define CSCSVCPLUGINDEBUG(AA)           { RDebug::Print(_L(AA)); }
+#define CSCSVCPLUGINDEBUG2(AA,BB)       { RDebug::Print(_L(AA),BB); }
+#define CSCSVCPLUGINDEBUG3(AA,BB,CC)    { RDebug::Print(_L(AA),BB,CC); }
+#define CSCSVCPLUGINDEBUG4(AA,BB,CC,DD) { RDebug::Print(_L(AA),BB,CC,DD); }
+
+#else   // CSCENG_DEBUG == 0 or invalid -> Disable loggings
+
+#define CSCSVCPLUGINDEBUG(AA)          
+#define CSCSVCPLUGINDEBUG2(AA,BB)     
+#define CSCSVCPLUGINDEBUG3(AA,BB,CC)    
+#define CSCSVCPLUGINDEBUG4(AA,BB,CC,DD) 
+
+#endif  // CSCSVCPLUGIN_DEBUG
+
+#endif  // CSCSVCPLUGINLOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/inc/cscsvcpluginrcsehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,103 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_CSCSVCPLUGINRCSEHANDLER_H
+#define C_CSCSVCPLUGINRCSEHANDLER_H
+
+class CRCSEProfileEntry;
+class CRCSEProfileRegistry;
+class CCSCSvcPluginSpSettHandler;
+
+/**
+ *  An instance of class CCSCSvcPluginRcseHandler.
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+class CCSCSvcPluginRcseHandler : public CBase
+    {
+    public:
+
+        static CCSCSvcPluginRcseHandler* NewL();
+
+	    /**
+         * Destructor.
+         */
+        ~CCSCSvcPluginRcseHandler();
+
+         
+        /**
+         * Returns VoIP profile id for corresponding EasyVoIP plugin.
+         * Also returns SIP profile reference ids if any 
+         * was found from VoIP profile entry.
+         * Function leaves on failure.
+         *
+         * @since S60 v3.2
+         * @param aServiceId service id
+         * @param aProfileId for VoIP profile id to be returned
+         * @param aSipProfileIds for SIP profile references appended to entry
+         */
+        void GetProfileIdsL( 
+            TUint32 aServiceId, 
+            TUint32& aProfileId,
+            RArray<TUint32>& aSipProfileIds );
+        
+        /**
+         * Destroys VoIP profile from RCSE based on VoIP profile id.
+         * Function leaves on failure.
+         *
+         * @since S60 v3.2
+         * @param aProfileId for VoIP profile id to be deleted
+         */
+        void RemoveProfileL( TUint32 aProfileId );
+                
+
+    private:
+         
+        CCSCSvcPluginRcseHandler();
+
+        void ConstructL();
+        
+        
+       /**
+        * For deleting RPointerArray in case of leave.
+        *
+        * @since S60 v3.2
+        * @param aPointerArray for pointer array to be deleted
+        */
+        static void ResetAndDestroy( TAny* aPointerArray );
+
+    
+    private: // data
+            
+        /*
+         * Handle to Richcall Setting Engine profile registry.
+         * Own.
+         */
+        CRCSEProfileRegistry* iRcseProfileRegistry;  
+        
+        /*
+         * Handle to CCSCSvcPluginRcseHandler.
+         * Own.
+         */
+        CCSCSvcPluginSpSettHandler* iSpSettHandler;  
+    };
+
+#endif  // C_CSCSVCPLUGINRCSEHANDLER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/inc/cscsvcpluginsiphandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,135 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_CSCSVCPLUGINSIPHANDLER_H
+#define C_CSCSVCPLUGINSIPHANDLER_H
+
+
+#include <e32base.h>
+#include <sipprofileregistryobserver.h>
+
+class CSIPManagedProfile;
+class CSIPManagedProfileRegistry;
+
+
+/**
+ *  CCSCSvcPluginSipHandler class
+ *
+ *  @lib
+ *  @since S60 v3.2
+ */
+class CCSCSvcPluginSipHandler : public CBase,
+                                public MSIPProfileRegistryObserver
+    {
+    public:
+
+        static CCSCSvcPluginSipHandler* NewL();
+        
+        /**
+         * Destructor.
+         */
+        ~CCSCSvcPluginSipHandler();
+
+                    
+        /**
+         * Sets SIP setting registration mode.
+         * Function leaves on failure.
+         *
+         * @since S60 v3.2
+         * @param aId for SIP profile id
+         * @param aRegMode SIP registration mode
+         */
+        void SetRegistrationModeL( TUint32 aId, TBool aRegMode );
+
+        
+        /**
+         * Gets SIP profile access point Id.
+         * Function leaves on failure.
+         *
+         * @since S60 v3.2
+         * @param aId for SIP profile id
+         * @param aApId Access point Id
+         */
+        void GetApIdL( TUint32 aId,  TUint32& aApId );
+
+        /**
+         * Gets SIP profile user's address-of-record.
+         * Function leaves on failure.
+         *
+         * @since S60 v3.2
+         * @param aId for SIP profile id
+         * @param aUserAor user's address-of-record
+         */
+        void GetUserAorL( TUint32 aId,  TDes8& aUserAor );
+        
+        /**
+         * Destroys SIP profile from SIP Stack based on SIP profile id.
+         * Function leaves on failure.
+         *
+         * @since S60 v3.2
+         * @param aProfileId for SIP profile id to be deleted
+         */
+        void RemoveProfileL( TUint32 aProfileId );
+
+
+        // from base class MSIPProfileRegistryObserver
+    
+        /** 
+         * From MSIPProfileRegistryObserver 
+         * SIP profile information event.
+         *
+         * @since S60 v3.0
+         * @param aProfileId is id for profile
+         * @param aEvent type of information event
+         */
+        void ProfileRegistryEventOccurred(
+            TUint32 aSIPProfileId, 
+            TEvent aEvent );
+
+        
+        /**
+         * From MSIPProfileRegistryObserver
+         * An asynchronous error has occurred related to SIP profile.
+         *
+         * @since S60 v3.0
+         * @param aSIPProfileId the id of failed profile 
+         * @param aError a error code
+         */
+        void ProfileRegistryErrorOccurred(
+            TUint32 aSIPProfileId,
+            TInt aError );
+  
+
+    private:
+         
+        CCSCSvcPluginSipHandler();
+
+        void ConstructL();
+
+    private: // data
+    
+        /*
+         * Handle to SIP managed profile registry.
+         * Own.
+         */
+        CSIPManagedProfileRegistry* iSipProfileRegistry;
+    };
+
+#endif  // C_CSCSVCPLUGINSIPHANDLER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/inc/cscsvcpluginuids.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* 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:  Needed uids are defined here
+*
+*/
+
+
+#ifndef CSCSVCPLUGINUIDS_HRH
+#define CSCSVCPLUGINUIDS_HRH
+
+#define KCSCSvcPluginInterfaceUid 0x2000B009
+#define KCSCSvcPluginImplUid 0x2000B008
+#define KCSCSvcPluginDllUid 0x2000B007
+
+#endif // CSCSVCPLUGINUIDS_HRH
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/src/cscsvcplugin.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* 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:  
+*
+*/
+
+
+#include "cscsvcplugin.h"
+#include "cscsvcpluginlogger.h"
+#include "cscsvcpluginhandler.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPlugin::CCSCSvcPlugin()
+    { 
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPlugin::ConstructL()
+    {
+    CSCSVCPLUGINDEBUG("CCSCSvcPlugin::ConstructL - begin");
+    
+    iSvcPluginHandler = CCSCSvcPluginHandler::NewL();
+    
+    CSCSVCPLUGINDEBUG("CCSCSvcPlugin::ConstructL - end");
+    }
+
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPlugin* CCSCSvcPlugin::NewL()
+    {
+    CCSCSvcPlugin* self = new ( ELeave ) CCSCSvcPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPlugin::~CCSCSvcPlugin()
+    {
+    CSCSVCPLUGINDEBUG("CCSCSvcPlugin::~CCSCSvcPlugin - begin");
+     
+    delete iSvcPluginHandler;
+    
+    CSCSVCPLUGINDEBUG("CCSCSvcPlugin::~CCSCSvcPlugin - end");
+    }
+
+
+// ---------------------------------------------------------------------------
+// For getting csc setting cleanup plugin type.
+// ---------------------------------------------------------------------------
+//
+CCSCEngSettingsCleanupPluginInterface::TCSCPluginType 
+    CCSCSvcPlugin::PluginType() const
+    {
+    return CCSCEngSettingsCleanupPluginInterface::ESipVoIPCleanupPlugin;
+    }
+
+
+// ---------------------------------------------------------------------------
+// For removing setting based on service id.
+// ---------------------------------------------------------------------------
+//   
+void CCSCSvcPlugin::RemoveSettingsL( TUint32 aServiceId )
+    {
+    CSCSVCPLUGINDEBUG2(
+        "CCSCSvcPlugin::RemoveSettingsL - begin: SERVICE ID=%d", aServiceId );
+    
+    iSvcPluginHandler->RemoveSettingsL( aServiceId );
+    
+    CSCSVCPLUGINDEBUG(
+      "CCSCSvcPlugin::RemoveSettingsL - end");
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/src/cscsvcplugincenrephandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,144 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <e32debug.h>
+#include <centralrepository.h>
+#include <unsafprotocolsinternalcrkeys.h>
+
+#include "cscsvcpluginlogger.h"
+#include "cscsvcplugincenrephandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginCenrepHandler::CCSCSvcPluginCenrepHandler()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginCenrepHandler::ConstructL()
+    {    
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginCenrepHandler::ConstructL - begin");
+    
+    iNatfwRepository = CRepository::NewL( KCRUidUNSAFProtocols );
+    
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginCenrepHandler::ConstructL - end");
+    }
+
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginCenrepHandler* CCSCSvcPluginCenrepHandler::NewL()
+    {
+    CCSCSvcPluginCenrepHandler* self = 
+        new ( ELeave ) CCSCSvcPluginCenrepHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginCenrepHandler::~CCSCSvcPluginCenrepHandler()
+    {
+    CSCSVCPLUGINDEBUG(
+        "CCSCSvcPluginCenrepHandler::~CCSCSvcPluginCenrepHandler - begin");
+    
+    delete iNatfwRepository;
+    
+    CSCSVCPLUGINDEBUG(
+        "CCSCSvcPluginCenrepHandler::~CCSCSvcPluginCenrepHandler - end");
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destroys IAP spesific NAT/FW settings based on IAP id.
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginCenrepHandler::RemoveIapSpecificNatfwSettingsL(
+    TInt aIapId )
+    {
+    CSCSVCPLUGINDEBUG(
+       "CCSCSvcPluginCenrepHandler::RemoveIapSpecificNatfwSettingsL - begin");
+    
+    // Get IAP specific keys from Central Repository.
+    RArray<TUint32> keys;
+    CleanupClosePushL( keys );
+    User::LeaveIfError(
+        iNatfwRepository->FindEqL( 
+            KUNSAFProtocolsIAPIdMask, 
+            KUNSAFProtocolsFieldTypeMask, 
+            aIapId, 
+            keys ) );
+    
+    for ( TInt i( 0 ) ; i < keys.Count() ; i++ )
+        {
+        TUint32 errorKey( 0 );
+        iNatfwRepository->Delete( keys[ i ], KUNSAFProtocolsIAPIdMask, errorKey );
+        }
+     
+    CleanupStack::PopAndDestroy( &keys );  
+    
+    CSCSVCPLUGINDEBUG(
+       "CCSCSvcPluginCenrepHandler::RemoveIapSpecificNatfwSettingsL - end");
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destroys Domain spesific NAT/FW settings based on domain name.
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginCenrepHandler::RemoveDomainSpecificNatfwSettingsL(
+    const TDesC8& aDomainName )
+    {  
+    CSCSVCPLUGINDEBUG(
+    "CCSCSvcPluginCenrepHandler::RemoveDomainSpecificNatfwSettingsL - begin");
+    
+    // Get domain specific keys from Central Repository.
+    RArray<TUint32> keys;
+    CleanupClosePushL( keys );
+    User::LeaveIfError( 
+        iNatfwRepository->FindEqL( 
+            KUNSAFProtocolsDomainMask, 
+            KUNSAFProtocolsFieldTypeMask, 
+            aDomainName, 
+            keys ) );
+    
+    for ( TInt i( 0 ) ; i < keys.Count() ; i++ )
+        {
+        TUint32 errorKey( 0 );
+        iNatfwRepository->Delete( keys[ i ], KUNSAFProtocolsTableMask, errorKey );
+        }
+         
+    CleanupStack::PopAndDestroy( &keys );
+    
+    CSCSVCPLUGINDEBUG(
+      "CCSCSvcPluginCenrepHandler::RemoveDomainSpecificNatfwSettingsL - end");
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/src/cscsvcpluginhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,283 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <spproperty.h>
+#include <spsettings.h>
+#include <cmmanagerext.h>
+#include <XdmSettingsApi.h>
+#include <pressettingsapi.h>
+#include <cmpluginwlandef.h>
+#include <cmdestinationext.h>
+#include <XdmSettingsCollection.h>
+
+#include "cscsvcpluginlogger.h"
+#include "cscsvcpluginhandler.h"
+#include "cscsvcpluginsiphandler.h"
+#include "cscsvcpluginrcsehandler.h"
+#include "cscsvcplugincenrephandler.h"
+
+// At-character in SIP profile public username.
+_LIT8( KSvcPluginAtCharacter, "@" );
+
+// Maximum lengths of the setting values.
+const TInt KSvcPluginSettingLength = 256;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginHandler::CCSCSvcPluginHandler()
+    {    
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginHandler::ConstructL()
+    {
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginHandler::ConstructL - begin");
+        
+    iRcseHandler = CCSCSvcPluginRcseHandler::NewL();
+    iSipHandler = CCSCSvcPluginSipHandler::NewL();
+    iCenRepHandler = CCSCSvcPluginCenrepHandler::NewL();
+    
+    // Create descriptor array for domain names.
+    iDomainNames = new ( ELeave ) CDesC8ArrayFlat( 1 );
+    
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginHandler::ConstructL - end");
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginHandler* CCSCSvcPluginHandler::NewL()
+    {
+    CCSCSvcPluginHandler* self = new (ELeave) CCSCSvcPluginHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginHandler::~CCSCSvcPluginHandler()
+    {
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginHandler::~CCSCSvcPluginHandler - begin");
+    
+    iIapIds.Close();
+    iSipProfileIds.Close();
+
+    if ( iDomainNames )
+        {
+        iDomainNames->Reset();
+        }
+    delete iDomainNames;
+    delete iRcseHandler;
+    delete iSipHandler;
+    delete iCenRepHandler;
+    
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginHandler::~CCSCSvcPluginHandler - end");
+    }
+
+
+// ---------------------------------------------------------------------------
+// For settings removation.
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginHandler::RemoveSettingsL( TUint32 aServiceId )
+    {
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginHandler::RemoveSettingsL - begin");
+    
+    // Search data based on service id
+    SearchSettingsDataL( aServiceId );
+        
+    // Unregister. (SIP profiles are set to when needed mode.)
+    for ( TInt i = 0; i < iSipProfileIds.Count(); i++ )
+        {
+        iSipHandler->SetRegistrationModeL( iSipProfileIds[ i ], EFalse );
+        }
+    
+    // Remove all profiles/settings.
+    RemoveProfilesL( aServiceId );
+    
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginHandler::RemoveSettingsL - end");
+    }
+
+// ---------------------------------------------------------------------------
+// Searches all settings data from databases. 
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginHandler::SearchSettingsDataL( TUint32 aServiceId )
+    {
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginHandler::SearchSettingsDataL - begin");
+    
+    // Reset member variables to default values.
+    iVoIPProfileId = KErrNone;
+    iSNAPId = KErrNone;
+    iPresenceId = KErrNone;
+    iSipProfileIds.Reset();
+    iIapIds.Reset();
+    iDomainNames->Reset();
+       
+    // Get SNAP ID from service table
+    CSPSettings* spSettings = CSPSettings::NewLC();
+    CSPProperty* property = CSPProperty::NewLC();
+    
+    TInt err =  spSettings->FindPropertyL( 
+        aServiceId, ESubPropertyVoIPPreferredSNAPId, *property );
+    
+    if ( !err )
+        {
+        property->GetValue( iSNAPId );
+        }
+    
+    TInt err2( KErrNone );
+    err2 =  spSettings->FindPropertyL( 
+        aServiceId, ESubPropertyPresenceSettingsId, *property );
+    
+    if ( !err2 )
+        {
+        property->GetValue( iPresenceId );
+        }
+        
+    CleanupStack::PopAndDestroy( property );
+    CleanupStack::PopAndDestroy( spSettings );
+        
+    // Get VoIP profile id and SIP reference ids from RCSE handler.
+    iRcseHandler->GetProfileIdsL( 
+        aServiceId,
+        iVoIPProfileId,
+        iSipProfileIds );
+    
+    for ( TInt i = 0; i < iSipProfileIds.Count(); i++ )
+        {
+        // Get Access Point Id from SIP profile and append it to id array.
+        TUint32 accessPointId = 0;
+        iSipHandler->GetApIdL( iSipProfileIds[ i ], accessPointId );
+        
+        if ( accessPointId )
+            {
+            iIapIds.Append( ( TUint32 ) accessPointId );
+            }
+            
+        // Get Domain name from SIP profile and append it to desc array.
+        TBuf8<KSvcPluginSettingLength> publicUsername( KNullDesC8 );
+        iSipHandler->GetUserAorL( iSipProfileIds[ i ], publicUsername );
+
+        TInt location = publicUsername.Find( KSvcPluginAtCharacter );
+        
+        if ( KErrNotFound != location )
+            {
+            iDomainNames->AppendL( publicUsername.Mid( location + 1 ) );
+            }
+        }
+    
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginHandler::SearchSettingsDataL - end");
+    }
+    
+// ---------------------------------------------------------------------------
+// Removes settings.
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginHandler::RemoveProfilesL( TUint32 aServiceId )
+    {
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginHandler::RemoveProfilesL - begin");
+        
+    // Destroy VoIP profile from RCSE. 
+    iRcseHandler->RemoveProfileL( iVoIPProfileId );
+    
+    // Remove entry from service table
+    CSPSettings* spSettings = CSPSettings::NewLC();
+    spSettings->DeleteEntryL( aServiceId );
+    CleanupStack::PopAndDestroy( spSettings );
+          
+    // Destroy SIP profiles from SIP Stack.
+    for ( TInt i = 0; i < iSipProfileIds.Count(); i++ )
+        {
+        iSipHandler->RemoveProfileL( iSipProfileIds[ i ] );
+        }
+    
+    // Destroy IAP specific NAT/FW settings.
+    for ( TInt i = 0; i < iIapIds.Count(); i++ )
+        {
+        // Trapped, because function leaves 
+        // if iap spesific keys wasn't found from repostiory.
+        TRAP_IGNORE( iCenRepHandler->RemoveIapSpecificNatfwSettingsL( 
+            iIapIds[ i ] ) );
+        }
+      
+    // Destroy Domain specific NAT/FW settings.
+    for ( TInt i = 0; i < iDomainNames->Count(); i++ )
+        {
+        // Trapped, because function leaves 
+        // if domain spesific keys wasn't found from repostiory.
+        TRAP_IGNORE( iCenRepHandler->RemoveDomainSpecificNatfwSettingsL( 
+            iDomainNames->MdcaPoint( i ) ) );
+        }
+    
+     // Delete SNAP
+    if ( iSNAPId )
+        {
+        RCmManagerExt manager;
+        CleanupClosePushL( manager );
+        manager.OpenL();     
+        RCmDestinationExt dest;
+        CleanupClosePushL( dest );
+        dest = manager.DestinationL ( iSNAPId );
+        
+        // Delete SNAP only if it´s not Internet SNAP.
+        TUint32 internetSnapId( KErrNone );
+        internetSnapId = dest.MetadataL( CMManager::ESnapMetadataInternet );
+        if( internetSnapId == KErrNone )
+            {
+            // May leave if some connection method inside SNAP is in use
+            TRAP_IGNORE( dest.DeleteLD() );
+            }
+        
+        CleanupStack::PopAndDestroy( &dest );        
+        CleanupStack::PopAndDestroy( &manager );
+        
+        CSCSVCPLUGINDEBUG( 
+            "CEgpSettingsController::RemoveProfilesL SNAP deleted" );
+        }
+    
+     // Delete presence and xdm settings
+    if ( iPresenceId )
+        {
+        TPresSettingsSet presSettingSet;
+                
+        // Delete xmd settings
+        PresSettingsApi::SettingsSetL( iPresenceId, presSettingSet );        
+        TXdmSettingsApi::RemoveCollectionL( presSettingSet.iXDMSetting );
+              
+        // Delete presence settings
+        TInt err = PresSettingsApi::RemoveSetL( iPresenceId );
+        
+        CSCSVCPLUGINDEBUG2( 
+         "CCSCSvcPluginHandler::RemoveProfilesL presence and xdm deleted, ERR=%d", err );
+        }
+    
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginHandler::RemoveProfilesL - begin");
+    }    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/src/cscsvcpluginimplementationtable.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+
+#include "cscsvcplugin.h"
+#include "cscsvcpluginuids.hrh"
+
+const TImplementationProxy KCSCSvcPluginImplementationTable[] = 
+  {
+  IMPLEMENTATION_PROXY_ENTRY( KCSCSvcPluginImplUid, CCSCSvcPlugin::NewL )
+  };
+
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Gate/factory function
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+  {
+  aTableCount = sizeof(KCSCSvcPluginImplementationTable) 
+        / sizeof(TImplementationProxy);
+  return KCSCSvcPluginImplementationTable;
+  }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/src/cscsvcpluginrcsehandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <e32base.h>
+#include <crcseprofileregistry.h>
+
+#include "cscsvcpluginlogger.h"
+#include "cscsvcpluginrcsehandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginRcseHandler::CCSCSvcPluginRcseHandler()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginRcseHandler::ConstructL()
+    {    
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginRcseHandler::ConstructL - begin");
+    
+    iRcseProfileRegistry = CRCSEProfileRegistry::NewL();
+    
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginRcseHandler::ConstructL - end");
+    }
+
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginRcseHandler* CCSCSvcPluginRcseHandler::NewL()
+    {
+    CCSCSvcPluginRcseHandler* self = 
+        new ( ELeave ) CCSCSvcPluginRcseHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginRcseHandler::~CCSCSvcPluginRcseHandler()
+    {
+    CSCSVCPLUGINDEBUG(
+        "CCSCSvcPluginRcseHandler::~CCSCSvcPluginRcseHandler - begin");
+    
+    delete iRcseProfileRegistry; 
+    
+    CSCSVCPLUGINDEBUG(
+        "CCSCSvcPluginRcseHandler::~CCSCSvcPluginRcseHandler - end");
+    }
+
+
+// ---------------------------------------------------------------------------
+// Returns VoIP profile id for corresponding EasyVoIP plugin.
+// Also returns SIP profile reference ids if any 
+// was found from VoIP profile entry.
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginRcseHandler::GetProfileIdsL( 
+    TUint32 aServiceId, 
+    TUint32& aProfileId,
+    RArray<TUint32>& aSipProfileIds )
+    {
+    CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::GetProfileIdsL - begin");
+    
+    CleanupClosePushL( aSipProfileIds );
+    
+    RPointerArray<CRCSEProfileEntry> entries;
+    TCleanupItem clItem( ResetAndDestroy, &entries );
+    CleanupStack::PushL( clItem );
+
+    // Get VoIP setting id
+    iRcseProfileRegistry->FindByServiceIdL( aServiceId, entries );
+                            
+    if ( entries.Count() )
+        {
+        aProfileId = entries[ 0 ]->iId;
+                            
+	    // Check profile for SIP references and append ids to array.
+	    for ( TInt j = 0; j < entries[ 0 ]->iIds.Count(); j++ )
+	        {
+	        TUint32 id = entries[ 0 ]->iIds[ j ].iProfileId;
+	        User::LeaveIfError( aSipProfileIds.Append( id ) );
+	        }
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+        
+    CleanupStack::PopAndDestroy(); // clItem    
+    CleanupStack::Pop();
+    
+    CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::GetProfileIdsL - end");
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destroys VoIP profile from RCSE based on VoIP profile id.
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginRcseHandler::RemoveProfileL(
+    TUint32 aProfileId )
+    {    
+    CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::RemoveProfileL - begin");
+    
+    // Destroy VoIP profile from RCSE.
+    CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();
+    iRcseProfileRegistry->FindL( aProfileId, *entry );
+    iRcseProfileRegistry->DeleteL( aProfileId );
+    CleanupStack::PopAndDestroy( entry );
+    
+    CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::RemoveProfileL - end");
+    }
+
+
+// ---------------------------------------------------------------------------
+// For deleting RPointerArray in case of leave
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginRcseHandler::ResetAndDestroy( TAny* aPointerArray )
+    {
+    CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::ResetAndDestroy - begin");
+    
+    if ( aPointerArray )
+        {
+        RPointerArray<CRCSEProfileEntry>* array =
+            static_cast<RPointerArray<CRCSEProfileEntry>*>( aPointerArray );
+        array->ResetAndDestroy();
+        array->Close();
+        }
+    
+    CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::ResetAndDestroy - end");
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/cscsipvoipcleanupplugin/src/cscsvcpluginsiphandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,166 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <uriutils.h>
+#include <sipmanagedprofile.h>
+#include <sipmanagedprofileregistry.h>
+
+#include "cscsvcpluginlogger.h"
+#include "cscsvcpluginsiphandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginSipHandler::CCSCSvcPluginSipHandler()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginSipHandler::ConstructL()
+    {
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginSipHandler::ConstructL - begin");
+    
+    iSipProfileRegistry = CSIPManagedProfileRegistry::NewL( *this );
+    
+    CSCSVCPLUGINDEBUG("CCSCSvcPluginSipHandler::ConstructL - end");
+    }
+
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginSipHandler* CCSCSvcPluginSipHandler::NewL()
+    {
+    CCSCSvcPluginSipHandler* self = 
+        new ( ELeave ) CCSCSvcPluginSipHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCSCSvcPluginSipHandler::~CCSCSvcPluginSipHandler()
+    {
+    CSCSVCPLUGINDEBUG(
+        "CCSCSvcPluginSipHandler::~CCSCSvcPluginSipHandler - begin");
+    
+    delete iSipProfileRegistry;
+    
+    CSCSVCPLUGINDEBUG(
+        "CCSCSvcPluginSipHandler::~CCSCSvcPluginSipHandler - end");
+    }
+
+    
+// ---------------------------------------------------------------------------
+// Destroys SIP profile from SIP Stack based on SIP profile id.
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginSipHandler::RemoveProfileL(
+    TUint32 aProfileId )
+    {    
+    CSCSVCPLUGINDEBUG( "CCSCSvcPluginSipHandler::RemoveProfileL - begin");
+    
+    // Destroy VoIP profile from RCSE.
+    CSIPManagedProfile* profile = 
+        static_cast<CSIPManagedProfile*> 
+            ( iSipProfileRegistry->ProfileL( aProfileId ) );
+            
+    CleanupStack::PushL( profile );
+    if ( !iSipProfileRegistry->IsInUseL( *profile ) )
+        {
+        iSipProfileRegistry->DestroyL( *profile );
+        }
+    CleanupStack::PopAndDestroy( profile );
+    
+    CSCSVCPLUGINDEBUG( "CCSCSvcPluginSipHandler::RemoveProfileL - end");
+    }
+
+
+// ---------------------------------------------------------------------------
+// SIP profile information event.
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginSipHandler::ProfileRegistryEventOccurred( 
+    TUint32 /*aSIPProfileId*/, 
+    TEvent /*aEvent*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// An asynchronous error has occurred related to SIP profile.
+// ---------------------------------------------------------------------------
+//
+void CCSCSvcPluginSipHandler::ProfileRegistryErrorOccurred(
+    TUint32 /*aSIPProfileId*/,
+    TInt /*aError*/ )
+    {
+    }
+    
+void CCSCSvcPluginSipHandler::SetRegistrationModeL( TUint32 aId, TBool aRegMode )
+	{
+    CSIPManagedProfile* profile = static_cast<CSIPManagedProfile*> 
+            ( iSipProfileRegistry->ProfileL( aId ) );
+            
+    CleanupStack::PushL( profile );
+    User::LeaveIfError( profile->SetParameter( KSIPAutoRegistration, aRegMode ) );
+    // Save profile back to the persistent storage.
+    iSipProfileRegistry->SaveL( *profile );
+    CleanupStack::PopAndDestroy( profile );
+	
+	}
+
+void CCSCSvcPluginSipHandler::GetApIdL( TUint32 aId,  TUint32& aApId )
+	{
+    CSIPProfile* profile = iSipProfileRegistry->ProfileL( aId );
+    CleanupStack::PushL( profile );
+    User::LeaveIfError( profile->GetParameter( KSIPAccessPointId, aApId ) );
+    CleanupStack::PopAndDestroy( profile );
+	}
+
+void CCSCSvcPluginSipHandler::GetUserAorL( TUint32 aId,  TDes8& aUserAor )
+	{
+    CSIPProfile* profile = iSipProfileRegistry->ProfileL( aId );
+    CleanupStack::PushL( profile );
+    const TDesC8* aor( NULL );
+    User::LeaveIfError( profile->GetParameter( KSIPUserAor, aor ) );
+    if ( aor )
+        {
+        if( aor->Length() <= aUserAor.MaxLength() )
+            {
+            aUserAor.Copy( *aor );
+            }
+        else
+            {
+            User::Leave( KErrOverflow );
+            }
+        }
+    CleanupStack::PopAndDestroy( profile );
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* 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:  This file provides the information required for building the
+*                CSC Application.
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+../rom/csc.iby CORE_APP_LAYER_IBY_EXPORT_PATH( csc.iby )
+
+../rom/cscresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH( cscresources.iby )
+
+//ROM SIS stub
+../sis/commsconfig_stub.sis    /epoc32/data/z/system/install/commsconfig_stub.sis
+PRJ_MMPFILES
+
+//gnumakefile ../cscapplicationui/group/icons_dc.mk
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE csc_aif.mif
+OPTION HEADERFILE csc.mbg
+OPTION SOURCEFILE iconlist.txt
+END
+
+
+//  Help exports
+#include "../help/group/bld.inf"
+
+//subcomponent includes
+#include "../cscgsplugin/group/bld.inf"
+#include "../cscsipvoipcleanupplugin/group/bld.inf"
+#include "../cscengine/group/bld.inf"
+#include "../cscsettingsui/group/bld.inf"
+#include "../cscapplicationui/group/bld.inf"
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/group/iconlist.txt	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,3 @@
+-c8,8 qgn_prop_set_service.svg
+-c8,8 qgn_prop_voip_new_service.svg
+-c8,8 qgn_prop_set_voip_advanced.svg
Binary file commsconfig/help/data/xhtml.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/help/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 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/voip.hlp.hrh	MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/voip.hlp.hrh)
+../rom/cscapplicationuihelps_variant.iby		CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(cscapplicationuihelps_variant.iby)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/help/inc/voip.hlp.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* 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:
+*
+*/
+	
+//
+// voip.hlp.hrh generated by CSXHelp Utilities.
+//           
+
+#ifndef __VOIP_HLP_HRH__
+#define __VOIP_HLP_HRH__
+
+_LIT(KSMSVO_HLP_CS_VIDEO_AND_XSP_VOIP, "SMSVO_HLP_CS_VIDEO_AND_XSP_VOIP"); // 
+_LIT(KVOIP_HLP_CSC, "VOIP_HLP_CSC"); // 
+_LIT(KVOIP_HLP_SERVCATALOG, "VOIP_HLP_SERVCATALOG"); // 
+_LIT(KSERVTAB_HLP_SETTINGS, "SERVTAB_HLP_SETTINGS"); // 
+
+#endif 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/help/rom/cscapplicationuihelps_variant.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,11 @@
+#ifndef __CSCHELPS_VARIANT_IBY__
+#define __CSCHELPS_VARIANT_IBY__
+
+#if defined(FF_S60_HELPS_IN_USE)
+    data=LOCALISE(DATAZ_/resource/xhtml/%02d/0x1020E566/contents.zip, RESOURCE_FILES_DIR/xhtml/%02d/0x1020E566/contents.zip)
+    data=LOCALISE(DATAZ_/resource/xhtml/%02d/0x1020E566/index.xml, RESOURCE_FILES_DIR/xhtml/%02d/0x1020E566/index.xml)
+    data=LOCALISE(DATAZ_/resource/xhtml/%02d/0x1020E566/keywords.xml, RESOURCE_FILES_DIR/xhtml/%02d/0x1020E566/keywords.xml)
+    data=LOCALISE(DATAZ_/resource/xhtml/%02d/0x1020E566/meta.xml, RESOURCE_FILES_DIR/xhtml/%02d/0x1020E566/meta.xml)
+#endif
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/rom/csc.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* 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: 
+*       IBY file for CSC Application
+*
+*
+*/
+
+
+#ifndef CSC_IBY__
+#define CSC_IBY__
+
+
+    file=ABI_DIR/BUILD_DIR/cscengine.dll      SHARED_LIB_DIR/cscengine.dll
+    file=ABI_DIR/BUILD_DIR/cscsettingsui.dll  SHARED_LIB_DIR/cscsettingsui.dll
+
+    DATA=DATAZ_/RESOURCE_FILES_DIR/cscengine.rsc RESOURCE_FILES_DIR/cscengine.rsc
+
+    ECOM_PLUGIN( cscgsplugin.dll,2001E639.rsc )
+
+		// stub SIS, provides support for SIS upgrading
+		data=ZSYSTEM/install/commsconfig_stub.sis    System/Install/commsconfig_stub.sis
+    ECOM_PLUGIN( cscsipvoipcleanupplugin.dll,2000B007.rsc )
+
+    SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,CSC)
+    
+    S60_APP_EXE(CSC)
+    S60_APP_AIF_ICONS(CSC)
+    S60_UPGRADABLE_APP_REG_RSC(CSC)
+
+
+#endif // CSC_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/rom/cscresources.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* 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: 
+*       Resources IBY file for CSC Application
+*
+*
+*/
+
+
+#ifndef CSCRESOURCES_IBY
+#define CSCRESOURCES_IBY
+
+
+DATA=DATAZ_/RESOURCE_FILES_DIR/cscsettingsui.rsc	RESOURCE_FILES_DIR/cscsettingsui.rsc
+DATA=DATAZ_/RESOURCE_FILES_DIR/cscgspluginrsc.rsc   RESOURCE_FILES_DIR/cscgspluginrsc.rsc
+
+S60_APP_RESOURCE(CSC)
+S60_APP_CAPTION(CSC)
+
+
+#endif //CSCRESOURCES_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/sis/commsconfig_stub.pkg	Wed Sep 01 12:29:57 2010 +0100
@@ -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:
+;
+;Language
+&EN
+
+;Header
+#{"Commsconfig"}, (0x200159B6), 1, 0, 0, TYPE=SISAPP   
+
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+;Dependency for S60 3rd Edition
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+
+;binaries
+""-"z:\sys\bin\cscsipvoipcleanupplugin.dll"
+""-"z:\sys\bin\cscsettingsui.dll"
+""-"z:\sys\bin\cscengine.dll"
+""-"z:\sys\bin\CSC.exe"
+
+""-"z:\private\10003a3f\import\apps\csc_reg.r*"
+""-"z:\resource\apps\csc.r*"
+""-"z:\resource\apps\cscengine.r*"
+""-"z:\resource\apps\cscsettingsui.r*"
+""-"z:\resource\apps\cscsipvoipcleanupplugin.r*"
+""-"z:\resource\apps\csc_aif.mif"
+
Binary file commsconfig/sis/commsconfig_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/commsconfig/sis/commsconfig_upgrade.pkg	Wed Sep 01 12:29:57 2010 +0100
@@ -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:
+;
+;Language
+&EN
+
+;Header
+#{"Commsconfig"}, (0x200159B6), 1, 0, 0, TYPE=PU
+
+
+;Localised VendorID
+%{"Nokia"}
+
+;VendorID
+:"Nokia"
+
+;Dependency for S60 3rd Edition
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+
+;binaries
+"\epoc32\RELEASE\armv5\UDEB\cscsipvoipcleanupplugin.dll"-"!:\sys\bin\cscsipvoipcleanupplugin.dll"
+"\epoc32\RELEASE\armv5\UDEB\cscsettingsui.dll"-"!:\sys\bin\cscsettingsui.dll"
+"\epoc32\RELEASE\armv5\UDEB\cscengine.dll"-"!:\sys\bin\cscengine.dll"
+"\epoc32\RELEASE\armv5\UDEB\CSC.exe"-"!:\sys\bin\CSC.exe"
+
+"\epoc32\data\Z\private\10003a3f\apps\csc_reg.rsc"-"!:\private\10003a3f\import\apps\csc_reg.rsc"
+"\epoc32\data\Z\resource\apps\csc.rsc"-"!:\resource\apps\csc.rsc"
+"\epoc32\data\Z\resource\cscengine.rsc"-"!:\resource\apps\cscengine.rsc"
+"\epoc32\data\Z\resource\cscsettingsui.rsc"-"!:\resource\apps\cscsettingsui.rsc"
+"\epoc32\data\Z\resource\plugins\cscsipvoipcleanupplugin.rsc"-"!:\resource\apps\cscsipvoipcleanupplugin.rsc"
+"\epoc32\data\Z\resource\apps\csc_aif.mif"-"!:\resource\apps\csc_aif.mif"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclient/bwins/cchclientU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,30 @@
+EXPORTS
+	??0RCCHClient@@QAE@XZ @ 1 NONAME ; RCCHClient::RCCHClient(void)
+	??0RCCHServer@@QAE@XZ @ 2 NONAME ; RCCHServer::RCCHServer(void)
+	??1RCCHClient@@UAE@XZ @ 3 NONAME ; RCCHClient::~RCCHClient(void)
+	?Close@RCCHClient@@QAEXXZ @ 4 NONAME ; void RCCHClient::Close(void)
+	?Connect@RCCHServer@@QAEHXZ @ 5 NONAME ; int RCCHServer::Connect(void)
+	?DisableService@RCCHClient@@QBEXABVTServiceSelection@@AAVTRequestStatus@@@Z @ 6 NONAME ; void RCCHClient::DisableService(class TServiceSelection const &, class TRequestStatus &) const
+	?DisableServiceCancel@RCCHClient@@QBEXXZ @ 7 NONAME ; void RCCHClient::DisableServiceCancel(void) const
+	?Disconnect@RCCHServer@@QAEXXZ @ 8 NONAME ; void RCCHServer::Disconnect(void)
+	?EnableService@RCCHClient@@QBEXABVTServiceSelection@@AAVTRequestStatus@@H@Z @ 9 NONAME ; void RCCHClient::EnableService(class TServiceSelection const &, class TRequestStatus &, int) const
+	?EnableServiceCancel@RCCHClient@@QBEXXZ @ 10 NONAME ; void RCCHClient::EnableServiceCancel(void) const
+	?FreeService@RCCHClient@@QAEHABVTServiceSelection@@@Z @ 11 NONAME ; int RCCHClient::FreeService(class TServiceSelection const &)
+	?GetConnectionInfo@RCCHClient@@QBEXABVTServiceSelection@@AAV?$TPckgBuf@VTServiceConnectionInfo@@@@AAVTRequestStatus@@@Z @ 12 NONAME ; void RCCHClient::GetConnectionInfo(class TServiceSelection const &, class TPckgBuf<class TServiceConnectionInfo> &, class TRequestStatus &) const
+	?GetConnectionInfoCancel@RCCHClient@@QBEXXZ @ 13 NONAME ; void RCCHClient::GetConnectionInfoCancel(void) const
+	?GetServiceInfo@RCCHClient@@QBEHABVTServiceSelection@@AAVTDes16@@@Z @ 14 NONAME ; int RCCHClient::GetServiceInfo(class TServiceSelection const &, class TDes16 &) const
+	?GetServiceState@RCCHClient@@QBEHABVTServiceSelection@@AAW4TCCHSubserviceState@@@Z @ 15 NONAME ; int RCCHClient::GetServiceState(class TServiceSelection const &, enum TCCHSubserviceState &) const
+	?GetServicesCancel@RCCHClient@@QBEXXZ @ 16 NONAME ; void RCCHClient::GetServicesCancel(void) const
+	?GetServicesL@RCCHClient@@QAEXAAV?$CArrayFixFlat@VTCCHService@@@@AAVTRequestStatus@@@Z @ 17 NONAME ; void RCCHClient::GetServicesL(class CArrayFixFlat<class TCCHService> &, class TRequestStatus &)
+	?GetServicesL@RCCHClient@@QAEXABVTServiceSelection@@AAV?$CArrayFixFlat@VTCCHService@@@@AAVTRequestStatus@@@Z @ 18 NONAME ; void RCCHClient::GetServicesL(class TServiceSelection const &, class CArrayFixFlat<class TCCHService> &, class TRequestStatus &)
+	?IsReserved@RCCHClient@@QBEHABVTServiceSelection@@@Z @ 19 NONAME ; int RCCHClient::IsReserved(class TServiceSelection const &) const
+	?Open@RCCHClient@@QAEHABVRCCHServer@@@Z @ 20 NONAME ; int RCCHClient::Open(class RCCHServer const &)
+	?RegisterToServer@RCCHClient@@QBEXAAVTRequestStatus@@@Z @ 21 NONAME ; void RCCHClient::RegisterToServer(class TRequestStatus &) const
+	?RegisterToServerCancel@RCCHClient@@QBEXXZ @ 22 NONAME ; void RCCHClient::RegisterToServerCancel(void) const
+	?ReserveService@RCCHClient@@QAEHABVTServiceSelection@@@Z @ 23 NONAME ; int RCCHClient::ReserveService(class TServiceSelection const &)
+	?SetConnectionInfo@RCCHClient@@QAEXABV?$TPckgBuf@VTServiceConnectionInfo@@@@AAVTRequestStatus@@@Z @ 24 NONAME ; void RCCHClient::SetConnectionInfo(class TPckgBuf<class TServiceConnectionInfo> const &, class TRequestStatus &)
+	?SetConnectionInfoCancel@RCCHClient@@QBEXXZ @ 25 NONAME ; void RCCHClient::SetConnectionInfoCancel(void) const
+	?StartServer@RCCHServer@@IBEHXZ @ 26 NONAME ; int RCCHServer::StartServer(void) const
+	?SubscribeToEvents@RCCHClient@@QBEXABVTServiceSelection@@AAV?$TPckgBuf@VTServiceStatus@@@@AAVTRequestStatus@@@Z @ 27 NONAME ; void RCCHClient::SubscribeToEvents(class TServiceSelection const &, class TPckgBuf<class TServiceStatus> &, class TRequestStatus &) const
+	?SubscribeToEventsCancel@RCCHClient@@QBEXXZ @ 28 NONAME ; void RCCHClient::SubscribeToEventsCancel(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclient/eabi/cchclientU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,36 @@
+EXPORTS
+	_ZN10RCCHClient11FreeServiceERK17TServiceSelection @ 1 NONAME
+	_ZN10RCCHClient12GetServicesLER13CArrayFixFlatI11TCCHServiceER14TRequestStatus @ 2 NONAME
+	_ZN10RCCHClient12GetServicesLERK17TServiceSelectionR13CArrayFixFlatI11TCCHServiceER14TRequestStatus @ 3 NONAME
+	_ZN10RCCHClient14ReserveServiceERK17TServiceSelection @ 4 NONAME
+	_ZN10RCCHClient17SetConnectionInfoERK8TPckgBufI22TServiceConnectionInfoER14TRequestStatus @ 5 NONAME
+	_ZN10RCCHClient4OpenERK10RCCHServer @ 6 NONAME
+	_ZN10RCCHClient5CloseEv @ 7 NONAME
+	_ZN10RCCHClientC1Ev @ 8 NONAME
+	_ZN10RCCHClientC2Ev @ 9 NONAME
+	_ZN10RCCHClientD0Ev @ 10 NONAME
+	_ZN10RCCHClientD1Ev @ 11 NONAME
+	_ZN10RCCHClientD2Ev @ 12 NONAME
+	_ZN10RCCHServer10DisconnectEv @ 13 NONAME
+	_ZN10RCCHServer7ConnectEv @ 14 NONAME
+	_ZN10RCCHServerC1Ev @ 15 NONAME
+	_ZN10RCCHServerC2Ev @ 16 NONAME
+	_ZNK10RCCHClient10IsReservedERK17TServiceSelection @ 17 NONAME
+	_ZNK10RCCHClient13EnableServiceERK17TServiceSelectionR14TRequestStatusi @ 18 NONAME
+	_ZNK10RCCHClient14DisableServiceERK17TServiceSelectionR14TRequestStatus @ 19 NONAME
+	_ZNK10RCCHClient14GetServiceInfoERK17TServiceSelectionR6TDes16 @ 20 NONAME
+	_ZNK10RCCHClient15GetServiceStateERK17TServiceSelectionR19TCCHSubserviceState @ 21 NONAME
+	_ZNK10RCCHClient16RegisterToServerER14TRequestStatus @ 22 NONAME
+	_ZNK10RCCHClient17GetConnectionInfoERK17TServiceSelectionR8TPckgBufI22TServiceConnectionInfoER14TRequestStatus @ 23 NONAME
+	_ZNK10RCCHClient17GetServicesCancelEv @ 24 NONAME
+	_ZNK10RCCHClient17SubscribeToEventsERK17TServiceSelectionR8TPckgBufI14TServiceStatusER14TRequestStatus @ 25 NONAME
+	_ZNK10RCCHClient19EnableServiceCancelEv @ 26 NONAME
+	_ZNK10RCCHClient20DisableServiceCancelEv @ 27 NONAME
+	_ZNK10RCCHClient22RegisterToServerCancelEv @ 28 NONAME
+	_ZNK10RCCHClient23GetConnectionInfoCancelEv @ 29 NONAME
+	_ZNK10RCCHClient23SetConnectionInfoCancelEv @ 30 NONAME
+	_ZNK10RCCHClient23SubscribeToEventsCancelEv @ 31 NONAME
+	_ZNK10RCCHServer11StartServerEv @ 32 NONAME
+	_ZTI10RCCHClient @ 33 NONAME ; #<TI>#
+	_ZTV10RCCHClient @ 34 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclient/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* 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 Converged Connection
+                 Handler Client (RCCH)
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+cchclient.mmp
+
+PRJ_TESTMMPFILES
+//../../internal/tsrc/EUnit_CCH/group/mt_cchclient.mmp
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclient/group/cchclient.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* 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 Converged Connection
+*                Client API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET                  cchclient.dll
+TARGETTYPE              dll
+UID                     0x1000008d 0x10275455 
+
+CAPABILITY              CAP_CLIENT_DLL
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  cchclient.cpp
+SOURCE                  cchserver.cpp
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../inc           // CCH's internal headers
+
+APP_LAYER_SYSTEMINCLUDE 
+
+LIBRARY                 euser.lib
+LIBRARY                 flogger.lib         // for logging purposes
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclient/src/cchclient.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,460 @@
+/*
+* 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:  RCCHClient implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchclient.h"
+#include "cchlogger.h" 
+#include "cchclientserver.h"
+#include "cchclientserverinternal.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// RCCHClient::RCCHClient
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RCCHClient::RCCHClient()
+    {
+    // No implementation required
+    iService = NULL;
+    }
+    
+EXPORT_C RCCHClient::~RCCHClient()
+    {
+    delete iService;
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::Open
+// Open subsession
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RCCHClient::Open( const RCCHServer& aRCCHServer )
+    {
+    CCHLOGSTRING( "RCCHClient::Open" );
+    return RSubSessionBase::CreateSubSession( 
+        aRCCHServer, ECCHOpenSubSession );
+    }
+
+// -----------------------------------------------------------------------------
+// RCCHClient::Close
+// Close subsession
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::Close()
+    {
+    CCHLOGSTRING( "RCCHClient::Close" );
+    RSubSessionBase::CloseSubSession( ECCHCloseSubSession );
+    }
+    
+// ---------------------------------------------------------------------------
+// RCCHClient::RegisterToServer
+// Send register message to server.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::RegisterToServer( TRequestStatus& aReqStatus ) const
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECCHServerRegister, args, aReqStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::RegisterToServerCancel
+// Cancel register server request
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::RegisterToServerCancel( ) const
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECCHServerRegisterCancel, args );
+    }
+
+
+// ---------------------------------------------------------------------------
+// RCCHClient::SubscribeToEvents
+// Subscribe to specific service events.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::SubscribeToEvents( 
+    const TServiceSelection& aServiceSelection,
+    TPckgBuf<TServiceStatus>& aServiceStatus,
+    TRequestStatus& aReqStatus ) const
+    {
+    const TIpcArgs args( 
+        aServiceSelection.iServiceId, aServiceSelection.iType, 
+            &aServiceStatus );
+    SendReceive( ECCHSubscribeToEvents, args, aReqStatus );
+    }
+                                     
+// ---------------------------------------------------------------------------
+// RCCHClient::SubscribeToEvents
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::SubscribeToEventsCancel() const
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECCHSubscribeToEventsCancel, args );
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::GetServicesL
+// Client queries for all services and sub-services.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::GetServicesL( 
+    CArrayFixFlat<TCCHService>& aServices,
+    TRequestStatus& aReqStatus )
+    {
+    TUint32 count( 0 );
+    TPckgBuf<TUint32> countPckg( count );
+    User::LeaveIfError( 
+        SendReceive( ECCHServiceCount, TIpcArgs( 
+            &countPckg, ECCHUnknown ) ) );
+        
+    for ( TInt i( 0 ); i < countPckg(); i++ )
+        {
+        TCCHService service;  
+        aServices.AppendL( service );
+        }
+        
+    if ( countPckg() )
+        {
+        TUint32 length = countPckg() * sizeof( TCCHService );
+            
+        if ( !iService )
+            {
+            iService = new (ELeave) TPtr8( reinterpret_cast<TText8*>( 
+                &aServices[ 0 ] ), length, length );
+            }
+        else
+            {
+            iService->Set( reinterpret_cast<TText8*>( 
+                &aServices[ 0 ] ), length, length );
+            }
+        
+        const TIpcArgs args( KErrNotFound, ECCHUnknown, iService );
+        SendReceive( ECCHGetServices, args, aReqStatus );
+        }
+    else
+        {
+        const TIpcArgs args( TIpcArgs::ENothing );
+        SendReceive( ECCHGetServices, args, aReqStatus );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::GetServicesL
+// Get services which contains this type of sub-services
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::GetServicesL( 
+    const TServiceSelection& aServiceSelection,
+    CArrayFixFlat<TCCHService>& aServices,
+    TRequestStatus& aReqStatus )
+    {
+    TUint32 count( 0 );
+    TPckgBuf<TUint32> countPckg( count );
+    
+    // If some Service has selected Service count must be one,
+    // otherwise we have to ask how many Services is enough
+    if ( aServiceSelection.iServiceId !=  0 )
+        {
+        countPckg = 1;
+        }
+    else
+        {
+        User::LeaveIfError( 
+            SendReceive( ECCHServiceCount, TIpcArgs( &countPckg, 
+                aServiceSelection.iType ) ) );    
+        }        
+    
+    for ( TInt i( 0 ); i < countPckg(); i++ )
+        {
+        TCCHService service;
+        aServices.AppendL( service );
+        }    
+        
+    if ( countPckg() )
+        {
+        TUint32 length = countPckg() * sizeof( TCCHService );
+    
+        if ( !iService )
+            {
+            iService = new (ELeave) TPtr8( reinterpret_cast<TText8*>( 
+                &aServices[ 0 ] ), length, length );
+            }
+        else
+            {
+            iService->Set( reinterpret_cast<TText8*>( 
+                &aServices[ 0 ] ), length, length );
+            }
+            
+        const TIpcArgs args( aServiceSelection.iServiceId, 
+            aServiceSelection.iType, 
+            iService );
+        SendReceive( ECCHGetServices, args, aReqStatus );
+        }
+    else
+        {
+        const TIpcArgs args( TIpcArgs::ENothing );
+        SendReceive( ECCHGetServices, args, aReqStatus );
+        } 
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::GetServicesCancel
+// Cancel get services request
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::GetServicesCancel() const
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECCHGetServicesCancel, args );
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::GetServiceState
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RCCHClient::GetServiceState(
+    const TServiceSelection& aServiceSelection,
+    TCCHSubserviceState& aState ) const
+    {
+    TPckgBuf<TCCHSubserviceState> statePckg( aState );    
+    const TIpcArgs args( 
+        aServiceSelection.iServiceId, aServiceSelection.iType, &statePckg );    
+    TInt error =  SendReceive( ECCHGetServiceState, args );
+    aState = statePckg();
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::EnableService
+// Enable services. All sub-services under the service are enabled.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::EnableService(
+    const TServiceSelection& aServiceSelection,
+    TRequestStatus& aReqStatus,
+    TBool aConnectivityCheck ) const
+    {
+    const TIpcArgs args( 
+        aServiceSelection.iServiceId, aServiceSelection.iType, 
+            aConnectivityCheck );
+    SendReceive( ECCHEnableService, args, aReqStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::EnableServiceCancel
+// Cancels enable services request.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::EnableServiceCancel() const
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECCHEnableServiceCancel, args );
+    }
+    
+// ---------------------------------------------------------------------------
+// RCCHClient::DisableService
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::DisableService(
+    const TServiceSelection& aServiceSelection,
+    TRequestStatus& aReqStatus ) const
+    {
+    const TIpcArgs args( 
+        aServiceSelection.iServiceId, aServiceSelection.iType );
+    SendReceive( ECCHDisableService, args, aReqStatus );
+    }
+    
+// ---------------------------------------------------------------------------
+// RCCHClient::DisableServiceCancel
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::DisableServiceCancel() const
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECCHDisableServiceCancel, args );
+    }    
+
+// ---------------------------------------------------------------------------
+// RCCHClient::GetServiceInfo
+// Get service specifics information about service and protocol
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RCCHClient::GetServiceInfo(
+    const TServiceSelection& aServiceSelection,
+    TDes& aBuffer ) const
+    {
+    TPckgBuf<TServiceConnectionInfo> serviceConnInfoPckg;
+    serviceConnInfoPckg().SetServiceId( aServiceSelection.iServiceId );
+    serviceConnInfoPckg().SetType( aServiceSelection.iType );
+    serviceConnInfoPckg().SetParameter( aServiceSelection.iParameter );
+    
+    // only service id, type and parameter values are used from 
+    // TServiceConnectionInfo 
+    const TIpcArgs args( &serviceConnInfoPckg, &aBuffer ); 
+    return SendReceive( ECCHGetServiceInfo, args ); 
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::SetConnectionInfo
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::SetConnectionInfo(
+    const TPckgBuf<TServiceConnectionInfo>& aServiceConnInfo,
+    TRequestStatus& aReqStatus )
+    {
+    const TIpcArgs args( &aServiceConnInfo );
+    SendReceive( ECCHSetConnectionInfo, args, aReqStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RCCHClient::SetConnectionInfoCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RCCHClient::SetConnectionInfoCancel() const
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECCHSetConnectionInfoCancel, args );
+    }
+                                         
+// -----------------------------------------------------------------------------
+// RCCHClient::GetConnectionInfo
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+EXPORT_C void RCCHClient::GetConnectionInfo(
+    const TServiceSelection& aServiceSelection,
+    TPckgBuf<TServiceConnectionInfo>& aServiceConnInfo,
+    TRequestStatus& aReqStatus ) const
+    {
+    aServiceConnInfo().SetServiceId( aServiceSelection.iServiceId );
+    aServiceConnInfo().SetType( aServiceSelection.iType );
+    aServiceConnInfo().SetParameter( aServiceSelection.iParameter );
+    // only service id, type and parameter values are used from 
+    // TServiceConnectionInfo 
+    const TIpcArgs args( &aServiceConnInfo ); 
+    SendReceive( ECCHGetConnectionInfo, args, aReqStatus );
+    }
+
+// -----------------------------------------------------------------------------
+// RCCHClient::GetConnectionInfoCancel
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+
+EXPORT_C void RCCHClient::GetConnectionInfoCancel() const
+    {
+    const TIpcArgs args( TIpcArgs::ENothing );
+    SendReceive( ECCHGetConnectionInfoCancel, args );
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::ReserveService
+// Reserves the service for exclusive use
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RCCHClient::ReserveService(
+    const TServiceSelection& aServiceSelection ) 
+    {
+    const TIpcArgs args( 
+        aServiceSelection.iServiceId, aServiceSelection.iType );
+    return SendReceive( ECCHReserveService, args ); 
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::FreeService
+// Frees the exclusive service reservation
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RCCHClient::FreeService(
+    const TServiceSelection& aServiceSelection )
+    {
+    const TIpcArgs args( 
+        aServiceSelection.iServiceId, aServiceSelection.iType );
+    return SendReceive( ECCHFreeService, args ); 
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHClient::IsReserved
+// Returns true if the service is reserved for exclusive use
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool RCCHClient::IsReserved(
+    const TServiceSelection& aServiceSelection ) const
+    { 
+    TPckgBuf<TBool> reserved;
+    const TIpcArgs args( 
+        aServiceSelection.iServiceId, aServiceSelection.iType,&reserved );
+    SendReceive( ECCHIsReserved, args ); 
+    return reserved();
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclient/src/cchserver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2006-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  RCCHServer implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <cchclientserver.h>
+
+#include "cchserver.h"
+#include "cchlogger.h" 
+#include "cchclientserverinternal.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+const TUint8 KCCHServerStartAttempts = 2;
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// RCCHServer::RCCHServer
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C RCCHServer::RCCHServer() : RSessionBase()
+    {
+    CCHLOGSTRING( "RCCHServer::RCCHClient" );    
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHServer::Connect
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RCCHServer::Connect()
+    {
+    CCHLOGSTRING( "RCCHServer::Connect" );
+    TInt error( KErrNone );
+    TUint8 retry = KCCHServerStartAttempts;
+    
+    for ( ;; )
+        {
+        error = CreateSession( KCCHServerName, 
+                               Version(), 
+                               KCCHMessageSlots );
+
+        CCHLOGSTRING2
+            ("RCCHServer CreateSession result: %d", error );
+        
+        if ( KErrNotFound != error && KErrServerTerminated != error )
+            {
+            break;
+            }
+        
+        // Need to restart server
+        if ( 0 == --retry )
+            {
+            break;
+            }                    
+        error = StartServer();
+        CCHLOGSTRING2
+            ( "RCCHServer::Connect, StartServer() returned %d", error );
+        
+        if ( KErrNone != error && KErrAlreadyExists != error )
+            {
+            break;
+            }
+        }
+
+    return error;    
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHServer::Disconnect
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void RCCHServer::Disconnect()
+    {
+    CCHLOGSTRING( "RCCHServer::Disconnect" );
+    RHandleBase::Close();
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHServer::Version
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TVersion RCCHServer::Version() const
+    {
+    return ( TVersion( KCCHServMajorVersionNumber,
+                       KCCHServMinorVersionNumber,
+                       KCCHServBuildVersionNumber ) );
+    }
+
+// ---------------------------------------------------------------------------
+// RCCHServer::StartServer
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt RCCHServer::StartServer() const
+    {
+    CCHLOGSTRING( "RCCHServer::StartServer" );
+    TInt error( KErrNone );
+    RProcess server;
+    const TUidType serverUid( KNullUid, KNullUid, KCCHServerUid );
+    error = server.Create( KCCHServerExe, KNullDesC, serverUid );
+    
+    if ( KErrNone == error )
+        {
+        TRequestStatus status;
+        server.Rendezvous( status );
+        
+        if ( status != KRequestPending )
+            {
+            server.Kill( 0 );   // abort startup
+            }
+        else
+            {
+            server.Resume();    // logon OK - start the server
+            }
+            
+        CCHLOGSTRING( "RCCHServer::StartServer(): Started" );
+        
+        User::WaitForRequest( status );     // 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
+        
+        error = 
+            ( server.ExitType() == EExitPanic ) ? KErrGeneral : status.Int();
+        server.Close();
+        }
+    return error;
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/bwins/cchu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,18 @@
+EXPORTS
+	??0CCch@@IAE@XZ @ 1 NONAME ; CCch::CCch(void)
+	??0TCchServiceStatus@@QAE@XZ @ 2 NONAME ; TCchServiceStatus::TCchServiceStatus(void)
+	??1CCch@@UAE@XZ @ 3 NONAME ; CCch::~CCch(void)
+	?CchUiApi@CCch@@QBEAAVMCchUi@@XZ @ 4 NONAME ; class MCchUi & CCch::CchUiApi(void) const
+	?ConnectivityDialogsAllowed@CCch@@QBEHXZ @ 5 NONAME ; int CCch::ConnectivityDialogsAllowed(void) const
+	?ConstructL@CCch@@AAEXXZ @ 6 NONAME ; void CCch::ConstructL(void)
+	?Error@TCchServiceStatus@@QBEHXZ @ 7 NONAME ; int TCchServiceStatus::Error(void) const
+	?GetService@CCch@@QAEPAVCCchService@@H@Z @ 8 NONAME ; class CCchService * CCch::GetService(int)
+	?GetServiceIds@CCch@@QBEHAAV?$RArray@H@@@Z @ 9 NONAME ; int CCch::GetServiceIds(class RArray<int> &) const
+	?GetServices@CCch@@QAEHW4TCCHSubserviceType@@AAV?$RPointerArray@VCCchService@@@@@Z @ 10 NONAME ; int CCch::GetServices(enum TCCHSubserviceType, class RPointerArray<class CCchService> &)
+	?NewL@CCch@@SAPAV1@XZ @ 11 NONAME ; class CCch * CCch::NewL(void)
+	?NewLC@CCch@@SAPAV1@XZ @ 12 NONAME ; class CCch * CCch::NewLC(void)
+	?SetConnectivityDialogsAllowed@CCch@@QAEXH@Z @ 13 NONAME ; void CCch::SetConnectivityDialogsAllowed(int)
+	?SetError@TCchServiceStatus@@QAEXH@Z @ 14 NONAME ; void TCchServiceStatus::SetError(int)
+	?SetState@TCchServiceStatus@@QAEXW4TCCHSubserviceState@@@Z @ 15 NONAME ; void TCchServiceStatus::SetState(enum TCCHSubserviceState)
+	?State@TCchServiceStatus@@QBE?AW4TCCHSubserviceState@@XZ @ 16 NONAME ; enum TCCHSubserviceState TCchServiceStatus::State(void) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/bwins/cchuinotifu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+	?NotifierArray@@YAPAV?$CArrayPtr@VMEikSrvNotifierBase2@@@@XZ @ 1 NONAME ; class CArrayPtr<class MEikSrvNotifierBase2> * NotifierArray(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/data/cchuinotif.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,471 @@
+/*
+* 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:  Resource definitions for project CCH UI
+*
+*/
+
+
+NAME CNOT
+
+#include <avkon.rh>
+#include <eikon.rh>
+#include <avkon.loc>
+#include <avkon.rsg>
+#include <eikon.rsg>
+#include <avkon.mbg>
+#include <cchui.loc>
+
+
+RESOURCE RSS_SIGNATURE { }
+RESOURCE TBUF { buf=""; }
+
+
+// ---------------------------------------------------------------------------
+// r_cchuinotif_username_pwd_dialog
+// Multiline dialog for username and password
+// ---------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_cchuinotif_username_pwd_dialog
+    {
+    title   = "";
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    flags   = EEikDialogFlagWait;
+    items   =
+        {
+        DLG_LINE
+            {
+            type    = EAknCtMultilineQuery;
+            id      = EMultilineFirstLine;
+            control = AVKON_DATA_QUERY
+                {
+                layout = EMultiDataFirstEdwin;
+                label = qtn_servtab_service_auth_username_query;
+                control = EDWIN
+                    {
+                    default_case = EAknEditorLowerCase;
+                    allowed_case_modes = EAknEditorAllCaseModes;
+                    flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                    width = 25;
+                    lines = 1;
+                    maxlength = 100;
+                    };
+                };
+            },
+        DLG_LINE
+            {
+            type    = EAknCtMultilineQuery;
+            id      = EMultilineSecondLine;
+            control = AVKON_DATA_QUERY
+                {
+                layout = EMultiDataSecondSecEd;
+                label = qtn_servtab_service_auth_password_query;
+                control = SECRETED
+                    {
+                    num_letters = 100;
+                    };
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_cchuinotif_no_connections_available
+// No connections available query
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LIST_QUERY r_cchuinotif_no_connections_available
+    {
+    flags = EGeneralQueryFlags;
+    softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items = 
+        {
+         AVKON_LIST_QUERY_DLG_LINE 
+            {
+            control = AVKON_LIST_QUERY_CONTROL_WITH_MSGBOX
+                {
+                actuallisttype = EAknCtSinglePopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    flags = EAknListBoxSelectionList;
+                    };
+
+                heading = r_qtn_cchuinotif_no_connections_heading;
+                };
+            }
+        };
+    }
+    
+// ---------------------------------------------------------------------------
+// r_cchuinotif_change_connection_query
+// Change connection query
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LIST_QUERY r_cchuinotif_change_connection_query
+    {
+    flags = EGeneralQueryFlags;
+    softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items = 
+        {
+         AVKON_LIST_QUERY_DLG_LINE 
+            {
+            control = AVKON_LIST_QUERY_CONTROL_WITH_MSGBOX
+                {
+                actuallisttype = EAknCtSinglePopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    flags = EAknListBoxSelectionList;
+                    };
+
+                heading = r_qtn_cchuinotif_change_connection_heading;
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_cchuinotif_select_gprs_dialog
+// Select GPRS access point dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LIST_QUERY r_cchuinotif_select_gprs_dialog
+    {
+    flags = EGeneralQueryFlags;
+    softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items = 
+        {
+        DLG_LINE 
+            {
+            type = EAknCtListQueryControl;
+            id = EListQueryControl;
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    flags = EAknListBoxSelectionList;
+                    };
+
+                heading = r_qtn_cchuinotif_select_gprs_access_point_heading;
+                };
+            }
+        };
+    }    
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_no_connections_heading
+// No connections query heading
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_no_connections_heading
+    { 
+    buf = qtn_servtab_no_conn_available_prompt_text;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_change_current_connection_heading
+// Change current connection query heading
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_change_current_connection_heading
+    { 
+    buf = qtn_servtab_change_current_conn_prompt;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_change_connection_heading
+// Change connection query heading
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_change_connection_heading
+    { 
+    buf = qtn_servtab_change_new_conn_query;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_select_gprs_access_point_heading
+// Query heading for gprs selection
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_select_gprs_access_point_heading
+    { 
+    buf = qtn_servtab_prmpt_select_gprs_access_point; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_no_connections_heading
+// No connections query heading
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_no_connections_defined_heading
+    { 
+    buf = qtn_servtab_no_conn_defined_prompt_text; 
+    }    
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_connect_when_av_text
+// Connect when available selection item for no connection available dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_connect_when_av_text
+    { 
+    buf = qtn_servtab_no_coverage_connect_when_av; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_servtab_prmpt_no_wlan_found
+// Heading for no wlan networks found dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_servtab_prmpt_no_wlan_found
+    { 
+    buf = qtn_servtab_prmpt_no_wlan_found; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_search_wlan_not_def_text
+// Search WLAN selection item for no connection defined dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_search_wlan_not_def_text
+    { 
+    buf = qtn_servtab_no_ap_defined_search_wlan; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_search_wlan_not_found_text
+// Search WLAN selection item for no connection found dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_search_wlan_not_found_text
+    { 
+    buf = qtn_servtab_no_wlan_found_search_wlan; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_search_wlan_no_coverage_text
+// Search WLAN selection item for no connection available dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_search_wlan_no_coverage_text
+    { 
+    buf = qtn_servtab_no_coverage_search_wlan; 
+    }
+    
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_search_wlan_change_current_connection_text
+// Search WLAN selection item for change current connection dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_search_wlan_change_current_connection_text
+    { 
+    buf = qtn_servtab_chng_current_conn_search_wlan; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_search_wlan_change_connection_text
+// Search WLAN selection item for change connection dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_search_wlan_change_connection_text
+    { 
+    buf = qtn_servtab_chng_conn_search_wlan; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_use_gprs_not_def_text
+// Use_gprs selection item for no connection defined dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_use_gprs_not_def_text
+    { 
+    buf = qtn_servtab_no_ap_defined_use_gprs; 
+    }    
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_use_gprs_not_found_text
+// Use_gprs selection item for no connection found dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_use_gprs_not_found_text
+    { 
+    buf = qtn_servtab_no_wlan_found_use_gprs; 
+    }    
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_use_gprs_no_coverage_text
+// Use_gprs selection item for no connection coverage dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_use_gprs_no_coverage_text
+    { 
+    buf = qtn_servtab_no_coverage_use_gprs; 
+    } 
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_use_gprs_change_current_connection_text
+// Use_gprs selection item for change current connection dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_use_gprs_change_current_connection_text
+    { 
+    buf = qtn_servtab_chng_current_conn_use_gprs; 
+    } 
+
+// ---------------------------------------------------------------------------
+// r_qtn_cchuinotif_use_gprs_change_connection_text
+// Use_gprs selection item for change connection dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cchuinotif_use_gprs_change_connection_text
+    { 
+    buf = qtn_servtab_chng_conn_use_gprs;
+    } 
+
+// ---------------------------------------------------------------------------
+// r_qtn_servtab_conn_establsh_failed_permanently_note_text
+// Info note for incomplete settings case
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_servtab_conn_establsh_failed_permanently_note_text
+    { 
+    buf = qtn_servtab_conn_establsh_failed_permanently; 
+    }     
+    
+// ---------------------------------------------------------------------------
+// r_qtn_voip_wrong_sip_auth_note_text
+// Info note for wrong username/password.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_voip_wrong_sip_auth_note_text
+    { 
+    buf = qtn_voip_wrong_sip_auth_note;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_voip_changing_connectivity_failed_note_text
+// Info note for changing connectivity failed.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_voip_changing_connectivity_failed_note_text
+    { 
+    buf = qtn_voip_error_note_changing_connect_failed;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_voip_error_in_connection_note_text
+// Info note for error in connection. 
+// Used when access point is not usable for calling.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_voip_error_in_connection_note_text
+    { 
+    buf = qtn_voip_error_in_connection;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_servtab_ap_voip_not_supported_query_text
+// Query text for situation when access point is not usable for VoIP call.
+// Used when access point is used also by other services.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_servtab_ap_voip_not_supported_query_text
+    { 
+    buf = qtn_servtab_ap_voip_not_supported_query;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_servtab_ap_voip_not_supported_query_text
+// Query text for situation when access point is not usable for VoIP call.
+// Used when accesspoint is not used by other services.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_servtab_ap_voip_not_supported_reconnect_query_text
+    { 
+    buf = qtn_voip_calls_not_supported_reconnect_query;
+    }
+
+// -----------------------------------------------------------------------------
+// r_cchuinotif_change_connection_confirmation_query
+// Change connection confirmation query. Used when connection only changed.
+// -----------------------------------------------------------------------------
+//     
+RESOURCE DIALOG r_cchuinotif_change_connection_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationLayout;
+                label = r_qtn_servtab_ap_voip_not_supported_query_text;
+                };
+            }
+        };
+    }  
+
+// -----------------------------------------------------------------------------
+// r_cchuinotif_remove_and_change_connection_confirmation_query
+// Change connection confirmation query. Used when old connection is removed
+// and new one taken to use.
+// -----------------------------------------------------------------------------
+//     
+RESOURCE DIALOG r_cchuinotif_remove_and_change_connection_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationLayout;
+                label = r_qtn_servtab_ap_voip_not_supported_reconnect_query_text;
+                };
+            }
+        };
+    }  
+
+// ---------------------------------------------------------------------------
+// r_cchuinotif_wait_dialog
+// wait dialog
+// ---------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_cchuinotif_wait_dialog
+    {
+    flags = EAknWaitNoteFlags | EEikDialogFlagNotifyEsc;
+    buttons=R_AVKON_SOFTKEYS_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                singular_label= "";
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+     }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/eabi/cchuinotifu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z13NotifierArrayv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/ecom/200195A6.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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:  Resource definitions for project CCH UI Notifier plugin
+*
+*/
+
+
+#include "uikon.hrh"
+#include <registryinfov2.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = 0x200195A6;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KUikonUidPluginInterfaceNotifiers;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x200195A7;
+                    version_no = 1;
+                    display_name = "cchui plugin";
+                    default_data = "cchui plugin";
+                    opaque_data	 = "0";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/ecom/cchuinotifwrapper.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,118 @@
+/*
+* 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:  ECOM wrapper for CCH UI Notifier plugin
+*
+*/
+
+
+#include <AknNotifierWrapper.h> // link against aknnotifierwrapper.lib
+#include <implementationproxy.h>
+
+#include "cchuicommon.hrh"
+
+const TInt KMaxSynchReplyBufLength = 256;
+const TInt KCchUiNotifierPriority  = 
+    MEikSrvNotifierBase2::ENotifierPriorityVHigh;
+const TInt KCchUiNotifierArrayIncrement = 1;
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CleanupArray.
+// ---------------------------------------------------------------------------
+//
+void CleanupArray(TAny* aArray)
+    {
+    CArrayPtrFlat<MEikSrvNotifierBase2>*     
+        subjects=static_cast<CArrayPtrFlat<MEikSrvNotifierBase2>*>(aArray);
+    TInt lastInd = subjects->Count()-1;
+    for (TInt i=lastInd; i >= 0; i--)
+        subjects->At(i)->Release();             
+    delete subjects;
+    }
+
+
+// ---------------------------------------------------------------------------
+// DoCreateNotifierArrayL.
+// ---------------------------------------------------------------------------
+//
+CArrayPtr<MEikSrvNotifierBase2>* DoCreateNotifierArrayL()
+    {       
+    CArrayPtrFlat<MEikSrvNotifierBase2>* subjects=
+        new (ELeave)CArrayPtrFlat<MEikSrvNotifierBase2>(
+                KCchUiNotifierArrayIncrement);
+    
+    CleanupStack::PushL(TCleanupItem(CleanupArray, subjects));
+
+    // Create Wrappers
+
+    // Session owning notifier
+    CAknCommonNotifierWrapper* master = 
+        CAknCommonNotifierWrapper::NewL( KCchUiNotifierUid,
+                                   KCchUiNotifierChannel,
+                                   KCchUiNotifierPriority,
+                                   _L("cchuinotif.dll"),
+                                   KMaxSynchReplyBufLength);               
+               
+    subjects->AppendL( master );
+    
+    CleanupStack::Pop();    // array cleanup
+    return(subjects);
+    }
+
+// ---------------------------------------------------------------------------
+// NotifierArray.
+// ---------------------------------------------------------------------------
+//
+CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
+    // old Lib main entry point
+    {            
+    CArrayPtr<MEikSrvNotifierBase2>* array = 0;
+    TRAPD(ignore, array = DoCreateNotifierArrayL());
+    if (ignore != KErrNone) 
+        {
+        ignore = KErrNone;
+        }
+    return array;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ImplementationTable.
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+#ifdef __EABI__
+    {{0x200195A7},(TFuncPtr)NotifierArray}
+#else
+    {{0x200195A7},NotifierArray}
+#endif
+    };
+
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy.
+// ---------------------------------------------------------------------------
+//
+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/convergedconnectionhandler/cchclientapi/cchuinotif/ecom/cchuinotifwrapper.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,49 @@
+/*
+* 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:  Project definition file for project CCH UI Notifier plugin
+*                ECOM wrapper.
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET                  cchuinotifwrapper.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x200195A6
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              .
+SOURCE                  cchuinotifwrapper.cpp
+
+START RESOURCE  		200195A6.rss
+#ifdef SYMBIAN_SECURE_ECOM 
+TARGET 					cchuinotifwrapper.rsc
+#endif
+END // RESOURCE
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE			/epoc32/include/ecom
+
+LIBRARY                 ecom.lib
+LIBRARY                 euser.lib
+LIBRARY                 aknnotifierwrapper.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CCH UI Notifier plugin
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/cchui.loc 		     APP_LAYER_LOC_EXPORT_PATH( cchui.loc )
+
+PRJ_MMPFILES
+../group/cchuinotif.mmp
+../ecom/cchuinotifwrapper.mmp
+
+PRJ_TESTEXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/group/cchuinotif.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,77 @@
+/*
+* 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:  Project definition file for project CCH UI Notifier plugin
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET                  cchuinotif.dll
+TARGETTYPE              dll
+UID                     0x101fdfae 0x200195A8
+TARGETPATH		SHARED_LIB_DIR
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  cchuinotifier.cpp
+SOURCE                  cchuinotifiermain.cpp
+SOURCE                  cchuinotifierimpl.cpp
+SOURCE                  cchuiiconfileprovider.cpp
+SOURCE                  cchuipluginbrandinghandler.cpp
+SOURCE                  cchuinotifconnectionhandler.cpp
+SOURCE                  cchuicallstatelistener.cpp
+
+START RESOURCE          ../data/cchuinotif.rss
+HEADER
+TARGETPATH              APP_RESOURCE_DIR
+// LANG                 SC
+LANGUAGE_IDS
+END // RESOURCE
+
+USERINCLUDE     		../inc
+USERINCLUDE     		../loc
+USERINCLUDE     		../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY                 cone.lib
+LIBRARY                 bafl.lib
+LIBRARY                 egul.lib
+LIBRARY                 avkon.lib
+LIBRARY                 efsrv.lib
+LIBRARY                 euser.lib
+LIBRARY                 esock.lib
+LIBRARY                 estor.lib
+LIBRARY                 eikdlg.lib
+LIBRARY                 eiksrv.lib
+LIBRARY                 aknicon.lib
+LIBRARY                 eikcore.lib
+LIBRARY                 featmgr.lib
+LIBRARY                 aknskins.lib
+LIBRARY                 charconv.lib 
+LIBRARY                 eikcoctl.lib
+LIBRARY                 eiksrvui.lib 
+LIBRARY                 bsclient.lib
+LIBRARY                 cmmanager.lib
+LIBRARY                 commonengine.lib
+LIBRARY                 sipprofilecli.lib
+LIBRARY                 centralrepository.lib
+LIBRARY                 aknnotifierwrapper.lib
+LIBRARY                 serviceprovidersettings.lib
+LIBRARY         		RCSE.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuicallstatelistener.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,111 @@
+/*
+* 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: CCH UI Call State Listener
+*
+*/
+
+#ifndef C_CCHUICALLSTATELISTENER_H
+#define C_CCHUICALLSTATELISTENER_H
+
+
+#include <e32property.h>
+#include <e32base.h>
+
+class MCchUiCallStateObserver;
+
+
+/**
+*  Class for listening call state changes.
+ *
+ *  @code
+ *    CCchUiCallStateListener listener =
+ *        CCchUiCallStateListener::NewL( *this );
+ *  @endcode
+ *
+ *  @lib cchuinotif.lib
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CCchUiCallStateListener ) : public CActive
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aObserver callback observer
+     */
+    static CCchUiCallStateListener* NewL( MCchUiCallStateObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchUiCallStateListener();
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive
+     * See base class.
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * See base class.
+     */
+    void DoCancel();
+
+private:
+
+    CCchUiCallStateListener( MCchUiCallStateObserver& aObserver );
+
+    /**
+     * Handle state change.
+     *
+     * @since S60 v5.0
+     */
+    void HandleChange();
+
+    /**
+     * Start listening call state changes.
+     *
+     * @since S60 v5.0
+     */
+    void IssueRequest();
+
+private: // data
+
+    /*
+     * Property handle used to get property value
+     */
+    RProperty iProperty;
+
+    /**
+     * Call state
+     */
+    TInt iCallState;
+
+    /**
+     * CCH UI call state observer for callbacks
+     */
+    MCchUiCallStateObserver& iObserver;
+    
+    // For unit testing
+    friend class t_cchuicallstatelistener;
+    
+    };
+
+#endif // C_CCHUICALLSTATELISTENER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuicallstateobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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: CCH UI call state callback observer
+*
+*/
+
+#ifndef M_CCHUICALLSTATEOBSERVER_H
+#define M_CCHUICALLSTATEOBSERVER_H
+
+
+/**
+ *  MCchUiCallStateObserver
+ *
+ *  @since S60 v5.0
+ */
+class MCchUiCallStateObserver
+    {
+
+public:
+
+    /**
+     * Callback for notifying of a call state change
+     *
+     * @since S60 v5.0
+     * @param  aCallState state from CTSYDomainPSKeys.h
+     */
+    virtual void CallStateChanged( TInt aCallState ) = 0;
+    
+    };
+
+
+#endif // M_CCHUICALLSTATEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuinotifconnectionhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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_CCCHUINOTIFCONNECTIONHANDLER_H
+#define C_CCCHUINOTIFCONNECTIONHANDLER_H
+
+#include <badesca.h>
+#include <e32base.h>
+#include <e32const.h>
+#include <rconnmon.h>
+#include <cmmanagerext.h>
+#include <wlanmgmtcommon.h> // TWlanConnectionSecurityMode
+#include <cmpluginwlandef.h>
+
+#include "cchuicommon.hrh"
+
+class RCmDestinationExt;
+class CmConnectionMethodExt;
+
+/**
+ * Connection Handler for notifier plugin.
+ * This class implements the access to SNAPs.
+ *
+ * @code
+ * @endcode
+ *
+ * @lib cchui.lib
+ * @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCchUiNotifConnectionHandler ): public CBase
+    {
+public:
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCchUiNotifConnectionHandler* NewL();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCchUiNotifConnectionHandler* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchUiNotifConnectionHandler();
+    
+    
+    /**
+     * Gets all gprs access points in internet snap to array.
+     *
+     * @since S60 5.0
+     * @param aIaps will store iap names
+     * @param aIapIds will store iap ids
+     */
+    TUint32 GetGprsAccessPointsL( 
+        CDesCArray& aIaps, 
+        RArray<TUint32>& aIapIds );
+    
+    /**
+     * Gets connection name.
+     *
+     * @since S60 5.0
+     * @param aIapid current connection iap id
+     * @param aServiceName service name
+     * @param aIapName accesspoint name to be stored here
+     */
+    void ConnectionNameL(  
+        TUint aIapid, 
+        TDesC& aServiceName,
+        RBuf& aIapName );
+    
+    /**
+     * Gets all but specified service´s destinations.
+     *
+     * @since S60 5.0
+     * @param aServiceName services name which destination can be ignored.
+     * @param aDestinationIds will store destination ids
+     */    
+    void GetDestinationsL(
+        TDesC& aServiceName,
+        RArray<TUint32>& aDestinationIds );
+
+    /**
+     * Gets service´s destination Id where the given iapid belongs.
+     *
+     * @since S60 9.2
+     * @param aIapId internet accesspoint Id.
+     * @param aError error code in return 
+     * @param aDestinationId returns destination id
+     */
+    void GetDestinationL( 
+        TUint aIapId, TInt& aError, TUint32& aDestinationId );
+    
+    /**
+     * Gets all access point ids from snap.
+     *
+     * @since S60 5.0
+     * @param aIapIds will store iap ids
+     * @param aDestinationId id of destination to use
+     */
+    void GetAccessPointsFromSnapL(
+        RArray<TUint32>& aIapIds, 
+        TUint32 aDestinationId );
+    
+    /**
+     * Gets all gprs accesspoints id's from the service's snap.
+     *
+     * @since S60 9.2
+     * @param aIapIds will store iap ids
+     * @param aDestinationId id of destination to use
+     * @return error. KErrNotFound if no gprs accesspoints
+     */
+    TInt GetGprsAccessPointsSetToServiceSnapL(
+        CDesCArray& aIaps, RArray<TUint32>& aIapIds, TUint aIapId );
+    
+    /**
+     * Checks given connection methods equality   
+     *
+     * @since S60 9.2
+     * @param aIapId Iap Id.
+     * @param aIapIdToCompare Iap Id to compare.
+     * @return ETrue if equals
+     */
+    TBool IsConnectionMethodSimilarL(
+        TUint32 aIapId, TUint32 aIapIdToCompare );
+    
+private:
+
+    CCchUiNotifConnectionHandler();
+    
+    void ConstructL();
+        
+    /**
+     * Fills GPRS access point names and ids from provided destination.
+     *
+     * @since S60 5.0
+     * @param aIaps will store iap names
+     * @param aIapIds will store iap ids
+     * @param aDestination destination to use
+     */    
+    void GetGprsAccessPointsFromSnapL( 
+        CDesCArray& aIaps, RArray<TUint32>& aIapIds, 
+        RCmDestinationExt& aDestination );
+
+private: // data
+
+    /**
+     * Handle to connection method manager.
+     * Own.
+     */
+    RCmManagerExt iCmManagerExt;
+    
+    CCHUI_UNIT_TEST( T_CCchUiNotifConnectionHandler )
+    };
+
+#endif // C_CCCHUINOTIFCONNECTIONHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuinotifier.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,276 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Notifier base class definition
+*
+*/
+
+
+
+#ifndef C_CCHUINOTIFIER_H
+#define C_CCHUINOTIFIER_H
+
+#include <eikenv.h>
+#include <eiknotapi.h>
+#include <data_caging_path_literals.hrh> 
+#include <AknNotiferAppServerApplication.h>
+
+#include "cchuicommon.hrh"
+
+class CSPSettings;
+class CAknQueryDialog;
+class CAknTextQueryDialog;
+
+/**
+ *  Defines base class for notifier implementation(s).
+ *  Provides implementation that is common for all notifier
+ *  implementation.
+ *
+ *  @code
+ *  @endcode
+ *
+ *  @lib cchuinotif.lib
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCCHUiNotifierBase ): 
+    public CActive, public MEikSrvNotifierBase2
+    {
+public:
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHUiNotifierBase();
+
+protected:
+
+    CCCHUiNotifierBase();
+    
+    virtual void ConstructL();
+   
+    /**
+     * Complete Client/Server message and Nulled the reply slot.
+     *
+     * @since S60 5.0
+     * @param aErr  Error code for client notification.
+     */
+    void CompleteMessage( TInt aErr );
+    
+    /**
+     * Scans for resource file. Ownership of returned value
+     * is passed.
+     *
+     * @since S60 5.0
+     * @param aSession file server session
+     * @param aFileName file name
+     * @param aFilePath file path
+     * @return resource file path and name
+     */    
+    HBufC* ScanFileL( 
+        RFs& aSession, 
+        const TDesC& aFileName,
+        const TDesC& aFilePath );
+     
+    /**
+     * Resolves service name.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id
+     * @param aServiceName resolved service name
+     */
+    void GetServiceNameL( TUint aServiceId, TDes& aServiceName );
+    
+    /**
+     * Get current connections name.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id
+     * @param aIapId iap id
+     * @param aIapName iap name to be stored to this
+     */    
+    void CurrentConnectionNameL( 
+        TUint aServiceId, 
+        TUint aIapid, 
+        RBuf& aIapName );
+    
+    /**
+     * Resolves if service is SIP/VoIP.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id
+     * @return ETrue if service is SIP/VoIP
+     */
+    TBool IsSIPVoIPL( TUint aServiceId );
+
+    /**
+     * Checks if phone is in offline mode.
+     *
+     * @since S60 5.0
+     * @return ETrue if phone is in offline mode.
+     */    
+    TBool IsPhoneOfflineL() const;    
+    
+    /**
+     * Checks if there is GPRS IAPs available in Internet SNAP.
+     *
+     * @since S60 5.0
+     * @return ETrue if phone is in offline mode.
+     */    
+    TBool IsGprsIapsAvailableL() const;
+    
+    /**
+     * Checks if connection is used by other services.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id.
+     * @param aIapId access point id.
+     * @return ETrue if connection used by other services.
+     */    
+    TBool ConnectionUsedByOthersL( TUint aServiceId, TInt aIapId );
+
+// from base class MEikSrvNotifierBase2
+
+    /**
+     * From MEikSrvNotifierBase2.
+     * Called when a notifier is first loaded 
+     * to allow any initial construction that is required.
+     *
+     * @return A structure containing priority and channel info.
+     */
+    virtual TNotifierInfo RegisterL() = 0;
+    
+    /**
+     * From MEikSrvNotifierBase2.
+     * The notifier has been deactivated 
+     * so resources can be freed and outstanding messages completed.
+     */
+    virtual void Cancel();
+
+    /**
+     * From MEikSrvNotifierBase2.
+     * Asynchronic notifier launch.
+     *
+     * @param aBuffer A buffer containing received parameters
+     * @param aReturnVal The return value to be passed back.
+     * @param aMessage Should be completed when the notifier is deactivated.
+     * @return A pointer to return value.
+     */
+    virtual void StartL(
+        const TDesC8& aBuffer, 
+        TInt aReplySlot, 
+        const RMessagePtr2& aMessage );
+        
+    
+private:
+
+// from base class MEikSrvNotifierBase2
+
+    /**
+     * From MEikSrvNotifierBase2.
+     * Called when all resources allocated by notifiers should be freed.
+     */
+    virtual void Release();
+    
+    /**
+     * From MEikSrvNotifierBase2.
+     * Called when all resources allocated by notifiers should be freed.
+     * 
+     * @return A structure containing priority and channel info.
+     */
+    virtual TNotifierInfo Info() const;
+    
+    /**
+     * From MEikSrvNotifierBase2.
+     * Synchronic notifier launch.
+     *
+     * @param aBuffer Received parameter data.
+     * @return A pointer to return value.
+     */
+    virtual TPtrC8 StartL( const TDesC8& aBuffer );
+        
+    /**
+     * From MEikSrvNotifierBase2.
+     * Updates a currently active notifier.
+     *
+     * @param aBuffer The updated data.
+     * @return A pointer to return value.
+     */
+    virtual TPtrC8 UpdateL( const TDesC8& aBuffer );
+    
+    /**
+     * From CActive Gets called when a request is cancelled.
+     * @param None.
+     * @return None.
+     */
+    virtual void DoCancel();  
+       
+    /**
+     * From CActive Gets called when a request is cancelled.
+     * @param None.
+     * @return None.
+     */
+    virtual void RunL();
+    
+protected: // data
+
+    /**
+     * Pointer to service provider settings.
+     * Own.
+     */
+    CSPSettings* iSettings;
+    
+    /**
+     * Local eikonenv.
+     * Own.
+     */
+    CEikonEnv* iEikEnv;
+    
+    /**
+     * Received message.
+     */
+    RMessagePtr2 iMessage;
+    
+    /**
+     * Notifier parameters structure.
+     */
+    TNotifierInfo iInfo;
+    
+    /**
+     * Reply slot.
+     */
+    TInt iReplySlot;
+    
+    /**
+     * Flag for eikon env.
+     */
+    TInt iResourceFileFlag;
+    
+    /**
+     * Dialog mode.
+     */
+    MCchUiObserver::TCchUiDialogType    iDialogMode;
+    
+    /**
+     * Service id.
+     */
+    TUint   iServiceId;
+    
+    /**
+     * Flag to determine if application key is blocked.
+     */
+    TBool iAppKeyBlocked;
+    
+    CCHUI_UNIT_TEST( T_CchUiNotifierBase )
+    };
+
+#endif // C_CCHUINOTIFIER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuinotifierimpl.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,426 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Actual notifier class implementation.
+*
+*/
+
+
+#ifndef C_CCHUINOTIFIERIMPL_H
+#define C_CCHUINOTIFIERIMPL_H
+
+#include <cchuiobserver.h> // for dialog types
+#include <AknQueryDialog.h>
+#include <sipprofileregistryobserver.h>
+
+#include "cchuinotifier.h" // Base class
+#include "cchuicommon.hrh"
+#include "cchuicallstateobserver.h"
+
+class CSIPManagedProfile;
+class CSIPManagedProfileRegistry;
+class CCchUiPluginBrandingHandler;
+class CCchUiCallStateListener;
+
+/**
+ *  Implementation class for notifier.
+ *  Implements specific notifier, extends base class functionality.
+ *
+ *  @code
+ *  @endcode
+ *
+ *  @lib cchuinotif.lib
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCCHUiNotifierImpl ): public CCCHUiNotifierBase,
+                                         public MCchUiCallStateObserver,
+                                         public MSIPProfileRegistryObserver
+    {
+public:
+    
+    static CCCHUiNotifierImpl* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHUiNotifierImpl();
+
+protected:
+    
+    /**
+     * From MEikSrvNotifierBase2.
+     * The notifier has been deactivated 
+     * so resources can be freed and outstanding messages completed.
+     */
+    void Cancel();
+    
+private:
+
+    CCCHUiNotifierImpl();
+    
+    void ConstructL();
+    
+    /**
+     * Shows username/password query.
+     *
+     * @since S60 5.0
+     * @param aReplySlot Reply slot.
+     * @param aMessage Should be completed when the notifier is deactivated.
+     * @param aServiceId Service id to which this note related to.
+     * @param aUserName service username.
+     */
+    void ShowUsernamePasswordQueryL( 
+        TInt aReplySlot, 
+        const RMessagePtr2& aMessage, 
+        TUint aServiceId,
+        const TDesC& aUserName );
+    
+    /**
+     * Shows no connections available query
+     *
+     * @since S60 5.0
+     * @param aReplySlot Reply slot.
+     * @param aMessage Should be completed when the notifier is deactivated.
+     * @param aServiceId Service id to which this note related to.
+     * @param aNoConnectionsDefined If ETrue, no connections defined query 
+     * is used
+     */
+    void ShowNoConnectionsQueryL(
+        TInt aReplySlot, 
+        const RMessagePtr2& aMessage,
+        TUint aServiceId,
+        TBool aNoConnectionsDefined );
+    
+    /**
+     * Shows change connection query.
+     *
+     * @since S60 5.0
+     * @param aReplySlot Reply slot.
+     * @param aMessage Should be completed when the notifier is deactivated.
+     * @param aServiceId Service id to which this note related to.
+     * @param aIapid iap id of currently used connection
+     */
+    void ShowChangeConnectionQueryL(
+        TInt aReplySlot, 
+        const RMessagePtr2& aMessage,
+        TUint aServiceId,
+        TInt aIapid );
+    
+    /**
+     * Shows defective settings info note.
+     *
+     * @since S60 5.0
+     * @param aReplySlot Reply slot.
+     * @param aMessage Should be completed when the notifier is deactivated.
+     * @param aServiceId Service id to which this note related to.
+     */    
+    void ShowDefectiveSettingsL( 
+        TInt aReplySlot, 
+        const RMessagePtr2& aMessage,
+        TUint aServiceId );
+    
+    /**
+     * Shows error in connection info note.
+     *
+     * @since S60 5.0
+     * @param aReplySlot Reply slot.
+     * @param aMessage Should be completed when the notifier is deactivated.
+     * @param aServiceId Service id to which this note related to.
+     */    
+    void ShowErrorInConnectionNoteL( 
+        TInt aReplySlot, 
+        const RMessagePtr2& aMessage,
+        TUint aServiceId );
+    
+    /**
+     * Shows invalid username/password note.
+     *
+     * @since S60 5.0
+     * @param aReplySlot Reply slot.
+     * @param aMessage Should be completed when the notifier is deactivated.
+     * @param aServiceId Service id to which this note related to.
+     */    
+    void ShowInvalidUsernamePasswordNoteL(
+        TInt aReplySlot, 
+        const RMessagePtr2& aMessage,
+        TUint aServiceId );
+    
+    /**
+     * Shows confirmation note to change connection.
+     *
+     * @since S60 5.0
+     * @param aReplySlot Reply slot.
+     * @param aMessage Should be completed when the notifier is deactivated.
+     * @param aServiceId Service id to which this note related to.
+     * @param aIapid iap id of currently used connection.
+     */    
+    void ShowConfirmChangeConnectionL( 
+        TInt aReplySlot, 
+        const RMessagePtr2& aMessage, 
+        TUint aServiceId, 
+        TInt aIapid  );
+        
+    /**
+     * Return a handle to CCchUiPluginBrandingHandler.
+     *
+     * @since S60 5.0
+     * @return A handler to CCchUiPluginBrandingHandler.
+     */
+    CCchUiPluginBrandingHandler& BrandingHandlerL();
+
+    /**
+     * Fills list items for no connections available query. aListItems will
+     * contain shown items as text, aCommandArray will contain the corresponding
+     * commands. When query is dismissed, item selection can be mapped to command
+     * in aCommandArray.
+     *
+     * @since S60 5.0
+     * @param aListItems array for list items
+     * @param aCommandArray array for commands
+     * @param aServiceId service id
+     */
+    void FillNoConnectionsAvailableListboxL( 
+        CDesCArray& aListItems, 
+	    RArray<TCchUiOperationCommand>& aCommandArray,
+	    TUint aServiceId );   
+	    
+    /**
+     * Fills list items for no connections defined query. aListItems will
+     * contain shown items as text, aCommandArray will contain the corresponding
+     * commands. When query is dismissed, item selection can be mapped to command
+     * in aCommandArray.
+     *
+     * @since S60 5.0
+     * @param aListItems array for list items
+     * @param aCommandArray array for commands
+     */
+    void FillNoConnectionsDefinedListboxL( 
+        CDesCArray& aListItems, 
+	    RArray<TCchUiOperationCommand>& aCommandArray );   	    
+
+    /**
+     * Fills list items for no connections are found query. aListItems will
+     * contain shown items as text, aCommandArray will contain the corresponding
+     * commands. When query is dismissed, item selection can be mapped to command
+     * in aCommandArray.
+     *
+     * @since S60 5.0
+     * @param aListItems array for list items
+     * @param aCommandArray array for commands
+     */
+    void FillNoConnectionsFoundListboxL( 
+        CDesCArray& aListItems, 
+	    RArray<TCchUiOperationCommand>& aCommandArray );
+    
+    /**
+     * Fills list items for change current connection query. aListItems will
+     * contain shown items as text, aCommandArray will contain the corresponding
+     * commands. When query is dismissed, item selection can be mapped to command
+     * in aCommandArray.
+     *
+     * @since S60 5.0
+     * @param aListItems array for list items
+     * @param aCommandArray array for commands
+     */
+    void FillChangeCurrentConnectionListboxL( 
+        CDesCArray& aListItems, 
+        RArray<TCchUiOperationCommand>& aCommandArray );
+    
+    /**
+     * Fills list items for change connection query. aListItems will
+     * contain shown items as text, aCommandArray will contain the corresponding
+     * commands. When query is dismissed, item selection can be mapped to command
+     * in aCommandArray.
+     *
+     * @since S60 5.0
+     * @param aListItems array for list items
+     * @param aCommandArray array for commands
+     */
+    void FillChangeConnectionListboxL( 
+        CDesCArray& aListItems, 
+        RArray<TCchUiOperationCommand>& aCommandArray ); 
+
+    /**
+     * Shows custom GPRS access point selection. User can select GPRS access
+     * point from list which is formed from access points in Internet SNAP.
+     *
+     * @since S60 5.0
+     * @param aServiceId, service id
+     * @return Error code.
+     */
+    TInt ShowGprsSelectionL( TUint aServiceId );
+    
+    /**
+     * Returns ETrue if VoIP over WCDMA is allowed.
+     *
+     * @since S60 5.0
+     * @return ETrue if allowed.
+     */
+    TBool IsVoIPOverWCDMAAllowedL();
+
+    /**
+     * Returns ETrue if current service SNAP is missing gprs accespoints
+     * which are set to the internet SNAP.
+     *
+     * @since S60 9.2
+     * @return ETrue if the internet snap has gprs connection
+     *         which are not in the services snap.
+     */
+    TBool IsServiceSnapMissingInternetGprsApsL() const;
+    
+    /**
+     * Returns internet GPRS IAP's informations which are not
+     * in the current service snap.
+     * 
+     * @since S60 9.2
+     * @param aIaps Iap names in return.
+     * @param aIapIds IapIds in return.
+     * @return internet SNAP ID.
+     */
+    TUint32 InternetGprsApsMissingFromServiceSnapL(
+        CDesCArray& aIaps, RArray<TUint32>& aIapIds ) const;
+
+    /**
+     * For deleting RPointerArray in case of leave.
+     *
+     * @since S60 5.0
+     * @param aPointerArray for pointer array to be deleted
+     */
+     static void ResetAndDestroy( TAny* aPointerArray );
+    
+// from base class CCCHUiNotifierBase
+
+    /**
+     * From CCCHUiNotifierBase.
+     * Called when a notifier is first loaded.     
+     *
+     * @since S60 5.0
+     * @return A structure containing priority and channel info.
+     */
+    TNotifierInfo RegisterL();
+    
+    /**
+     * From CCCHUiNotifierBase.
+     * Updates a currently active notifier.
+     *
+     * @since S60 5.0
+     * @param aBuffer The updated data.
+     * @return A pointer to return value.
+     */
+    TPtrC8 UpdateL( const TDesC8& aBuffer );
+    
+    /**
+     * From CCCHUiNotifierBase.
+     * Used in asynchronous notifier launch to 
+     * store received parameters into members variables and 
+     * make needed initializations.
+     *
+     * @since S60 5.0
+     * @param aBuffer A buffer containing received parameters
+     * @param aReplySlot Reply slot.
+     * @param aMessage Should be completed when the notifier is deactivated.
+     */
+    void StartL(
+        const TDesC8& aBuffer,
+        TInt aReplySlot, 
+        const RMessagePtr2& aMessage );
+
+    /** 
+     * From CActive
+     */
+    void RunL();
+    
+    
+    // from base class MSIPProfileRegistryObserver
+      
+    /** 
+     * From MSIPProfileRegistryObserver 
+     * SIP profile information event.
+     *
+     * @since S60 v3.0
+     * @param aProfileId is id for profile
+     * @param aEvent type of information event
+     */
+    void ProfileRegistryEventOccurred(
+        TUint32 aSIPProfileId, 
+        TEvent aEvent );
+
+          
+    /**
+     * From MSIPProfileRegistryObserver
+     * An asynchronous error has occurred related to SIP profile.
+     *
+     * @since S60 v3.0
+     * @param aSIPProfileId the id of failed profile 
+     * @param aError a error code
+     */
+     void ProfileRegistryErrorOccurred(
+         TUint32 aSIPProfileId,
+         TInt aError );
+    
+public:
+
+// from base class MCchUiCallStateObserver
+
+    /**
+     * From MCchUiCallStateObserver.
+     * @see MCchUiCallStateObserver.
+     */
+    void CallStateChanged( TInt aCallState );
+
+private: // data
+
+    /**
+     * Branding handler. Lifetime of this pointer must be the same as 
+     * for icons fetched using it.
+     * Own.
+     */
+    CCchUiPluginBrandingHandler* iBrandingHandler;
+    
+    /**
+     * Result parameters.
+     */
+    TCCHUiNotifierParams iResultParams;
+
+    /**
+     * Handle to created CAknListQueryDialog.
+     * Own.
+     */
+    CAknListQueryDialog* iListQueryDialog;
+
+    /**
+     * Listener for call state changes.
+     * Own.
+     */
+    CCchUiCallStateListener* iCallStateListener;
+    
+    /**
+     * Service ID.
+     */
+    TUint iServiceId;
+    
+    /**
+     * Current connection IAP ID.
+     */
+    TUint iCurrentConnectionIapId;
+
+    /*
+     * Handle to SIP managed profile registry.
+     * Own.
+     */
+    CSIPManagedProfileRegistry* iSipProfileRegistry;
+    
+    CCHUI_UNIT_TEST( T_CchUiNotifierImpl )
+    };
+
+#endif // C_CCHUINOTIFIERIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuipluginbrandinghandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* 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:  Provides access to branded data.
+*
+*/
+
+
+#ifndef C_CCHUIPLUGINBRANDINGHANDLER_H
+#define C_CCHUIPLUGINBRANDINGHANDLER_H
+
+#include <e32base.h>
+
+#include "cchuicommon.hrh"
+
+class MBSAccess;
+class CFbsBitmap;
+class CBSFactory;
+class CSPSettings;
+
+
+/**
+ *  Branding Server handler.
+ *  This class handles to use of branding server. It can be used
+ *  to retrieve icons or complete files by brand id.
+ *
+ *  @code
+ *   CCchUiPluginBrandingHandler* handler = 
+ *      CCchUiPluginBrandingHandler::NewLC( aSpSettings );
+ *   CFbsBitmap* bitmap = NULL;
+ *   CFbsBitmap* mask = NULL;
+ *   handler->RetrieveServiceIconL( aServiceId, *bitmap, *mask );
+ *   // Handle bitmap, mask here. You still own those.
+ *   CleanupStack::PopAndDestroy( handler ); 
+ *  @endcode
+ *
+ *  @lib cchuinotif.lib
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCchUiPluginBrandingHandler ): public CBase
+    {
+public:
+    
+    /**
+     * Two-phased constructor.
+     * 
+     * @since S60 5.0
+     * @param aServiceId Service id.
+     */
+    static CCchUiPluginBrandingHandler* NewL( 
+        CSPSettings& aSpSettings );
+    
+    /**
+     * Two-phased constructor.
+     * 
+     * @since S60 5.0
+     * @param aServiceId Service id.
+     */
+    static CCchUiPluginBrandingHandler* NewLC( 
+        CSPSettings& aSpSettings );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchUiPluginBrandingHandler();
+    
+    /**
+     * Retrieves specific branded service icon from branding server.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id
+     * @param aBitmap stores retrieved icon
+     * @param aMask stores retrieved icon mask
+     */
+    void RetrieveServiceIconL(
+        TUint32 aServiceId,
+        CFbsBitmap*& aBitmap, 
+        CFbsBitmap*& aMask );
+
+private:
+
+    CCchUiPluginBrandingHandler( CSPSettings& aSpSettings );
+    
+    void ConstructL();
+    
+    
+    /**
+     * Prepares branding access.
+     *
+     * @since S60 5.0
+     * @param aServiceId Service id.
+     */
+    void PrepareBrandingAccessL( TUint32 aServiceId );
+
+    /**
+     * Releases branding access.
+     *
+     * @since S60 5.0
+     */
+    void ReleaseBrandingAccess();
+    
+
+private: // data
+
+    /**
+     * Reference to service provider settings.
+     * Not own.
+     */
+    CSPSettings& iSpSettings;
+    
+    /**
+     * Branding server factory.
+     * Own.
+     */
+    CBSFactory* iFactory;
+    
+    /**
+     * Branding server access.
+     * Own.
+     */
+    MBSAccess* iAccess;
+    
+    CCHUI_UNIT_TEST( T_CchUiPluginBrandingHandler )
+    };
+
+#endif // C_CCHUIPLUGINBRANDINGHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/inc/cchuipluginiconfileprovider.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,105 @@
+/*
+* 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:  Implements icon file provider for branding usage.
+*
+*/
+
+
+
+#ifndef C_CCHUIPLUGINICONFILEPROVIDER_H
+#define C_CCHUIPLUGINICONFILEPROVIDER_H
+
+#include <e32base.h>
+#include <AknsItemID.h>
+#include <AknIconUtils.h>
+
+
+/**
+ *  Icon File Provider.
+ *  Provides functionality to get icon file handle. Required to use
+ *  when handling icon data fetched from branding server. Lifetime of
+ *  the file handles must be maintained by using this provider. Otherwise
+ *  usage of icon data (even in framework) might lead to a crash.
+ *
+ *  @code
+ *   CCchUiPluginIconFileProvider* fp = 
+ *      CCchUiPluginIconFileProvider::NewL( aFile );
+ *   CleanupStack::PushL( fp );
+ *
+ *   AknIconUtils::CreateIconLC( aBitmap, aMask,
+ *                              *ifp,
+ *                               bsBitmap.BitmapId(), 
+ *                               bsBitmap.BitmapMaskId() ); 
+ *   CleanupStack::Pop( fp ); // framework frees via handle
+ *
+ *  @endcode
+ *
+ *  @lib cchuinotif.lib
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCchUiPluginIconFileProvider ): 
+    public CBase, public MAknIconFileProvider
+    {
+public:
+    
+    /**
+     * Two-phased constructor.
+     * 
+     * @since S60 5.0
+     * @param aFile File handle.
+     */
+    static CCchUiPluginIconFileProvider* NewL( RFile& aFile );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CCchUiPluginIconFileProvider();
+    
+
+// from base class MAknIconFileProvider
+    
+    /**
+     * From MAknIconFileProvider.
+     * Returns an open file handle to the icon file.
+     *
+     * @param aFile Icon file should be opened in this file handle, which
+     * is an empty file handle, when the AknIcon framework calls this 
+     * method. The AknIcon framework takes care of closing the file handle
+     * after having used it.
+     * @param aType Icon file type.
+     */
+    void RetrieveIconFileHandleL( RFile& aFile, const TIconFileType aType );
+    
+    /**
+     * From MAknIconFileProvider.
+     * With this method, AknIcon framework informs that it does not use
+     * this MAknIconFileProvider instance any more.  
+     */
+    void Finished();
+
+private:
+
+    CCchUiPluginIconFileProvider( RFile& aFile );
+
+    
+private: // data
+
+    /**
+     * Reference to file handle.
+     * Not own.
+     */
+    RFile& iFile;
+    };
+
+#endif // C_CCHUIPLUGINICONFILEPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/loc/cchui.loc	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2007-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: 
+*     Localization strings for project CCH UI
+*
+*/
+
+
+// d:Listbox heading for no connections available note.
+// l:loc_type_pane
+// r:5.0.1
+//
+#define qtn_servtab_no_conn_available_prompt_text "No connections available"
+
+// d:Listbox heading for no connections defined note.
+// l:loc_type_pane
+// r:5.0.1
+//
+#define qtn_servtab_no_conn_defined_prompt_text "No connections defined"
+
+// d:Listbox heading for no WLAN networks found note.
+// l:loc_type_pane
+// r:5.0.1
+//
+#define qtn_servtab_prmpt_no_wlan_found "No WLAN networks found"
+
+// d:Username input box heading text
+// l:popup_query_data_code_window_t4/opt2
+// r:5.0.1
+//
+#define qtn_servtab_service_auth_username_query "Service username:"
+
+// d:Password input box heading text
+// l:popup_query_data_code_window_t4/opt2
+// r:5.0.1
+//
+#define qtn_servtab_service_auth_password_query "Service password:" 
+
+// d:No connections defined selection item for connect when available
+// l:list_single_pane_t1_cp2
+// r:5.0.1
+//
+#define qtn_servtab_no_coverage_connect_when_av "Connect when available"
+
+// d:No connections defined selection item for searching wlan
+// l:list_single_pane_t1_cp2
+// r:5.0.1
+//
+#define qtn_servtab_no_ap_defined_search_wlan "Search for WLAN" 
+
+// d:No connections found selection item for searching wlan
+// l:list_single_pane_t1_cp2
+// r:5.0.1
+// 
+#define qtn_servtab_no_wlan_found_search_wlan "Search for WLAN" 
+
+// d:No connections available selection item for searching wlan
+// l:list_single_pane_t1_cp2
+// r:5.0.1
+//   
+#define qtn_servtab_no_coverage_search_wlan "Search for WLAN" 
+  
+// d:No connections defined selection item for using GPRS
+// l:list_single_pane_t1_cp2
+// r:5.0.1
+//
+#define qtn_servtab_no_ap_defined_use_gprs "Allow GPRS use" 
+
+// d:No connections found selection item for using GPRS
+// l:list_single_pane_t1_cp2
+// r:5.0.1
+//
+#define qtn_servtab_no_wlan_found_use_gprs "Allow GPRS use" 
+
+// d:No connections available selection item for using GPRS
+// l:list_single_pane_t1_cp2
+// r:5.0.1
+//
+#define qtn_servtab_no_coverage_use_gprs "Allow GPRS use" 
+ 
+// d:Listbox heading for selecting gprs connection
+// l:heading_pane_t1
+// r:5.0.1
+//
+#define qtn_servtab_prmpt_select_gprs_access_point "Select access point:"
+
+// d:Info note for defective settings registration
+// l:popup_note_window
+// r:5.0.1
+// 
+#define qtn_servtab_conn_establsh_failed_permanently "Connecting %U failed due to defective settings. Contact your service provider."
+
+// d:Info text when connection establishment fails because of wrong username and/or password
+// l:popup_note_window
+// r:5.0.1
+// 
+#define qtn_voip_wrong_sip_auth_note "Invalid username or password"
+
+// d:Confirmation query text when creating an internet call is not possible
+// d:Used when access point is used also by some other service.
+// d:%U stands for the name of the access point in use
+// l:popup_note_window
+// r:5.0.1
+// 
+#define qtn_servtab_ap_voip_not_supported_query "%U connection does not support calls. Do you want to change connection?"
+
+// d:Confirmation query text when creating an internet call is not possible
+// d:Used when accesspoint is not used by any other service.
+// d:%U stands for the name of the access point in use
+// l:popup_note_window
+// r:5.0.1
+// 
+#define qtn_voip_calls_not_supported_reconnect_query "%U connection does not support calling. Remove it and create new connection?"
+
+// d:Listbox heading for changing connection note when connected.
+// d:%U stands for the name of the access point in use
+// l:loc_type_pane
+// r:5.0.1
+//
+#define qtn_servtab_change_current_conn_prompt "Current connection: %U"
+
+// d:Changing connection selection item for searching wlan when connected
+// l:list_single_pane_t1_cp2
+// r:5.0.1
+//   
+#define qtn_servtab_chng_current_conn_search_wlan "Search for WLAN"
+
+// d:Changing connection selection item for using GPRS when connected
+// l:list_single_pane_t1_cp2
+// r:5.0.1
+//
+#define qtn_servtab_chng_current_conn_use_gprs "Allow GPRS use"
+
+// d:Listbox heading for changing connection note when not connected.
+// l:loc_type_pane
+// r:5.0.1
+//
+#define qtn_servtab_change_new_conn_query "Currently not connected"
+
+// d:Changing connection selection item for searching wlan when not connected
+// l:list_single_pane_t1_cp2
+// r:5.0.1
+//   
+#define qtn_servtab_chng_conn_search_wlan "Search for WLAN"
+
+// d:Changing connection selection item for using GPRS when not connected
+// l:list_single_pane_t1_cp2
+// r:5.0.1
+//
+#define qtn_servtab_chng_conn_use_gprs "Allow GPRS use"
+
+// d:Information note text if changing the connectivity fails
+// l:popup_note_window
+// r:5.0.1
+// 
+#define qtn_voip_error_note_changing_connect_failed "Changing connectivity failed"
+
+// d:Information note text if accesspoint is not usable (does not support internet calls)
+// l:popup_note_window
+// r:5.0.1
+// 
+#define qtn_voip_error_in_connection "Error in connection"
+ 
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuicallstatelistener.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,124 @@
+/*
+* 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: CCH UI Call State Listener
+*
+*/
+
+
+#include <ctsydomainpskeys.h>
+
+#include  "cchuicallstatelistener.h"
+#include  "cchuicallstateobserver.h"
+#include  "cchuilogger.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// CCchUiCallStateListener::CCchUiCallStateListener
+// ---------------------------------------------------------------------------
+//
+CCchUiCallStateListener::CCchUiCallStateListener(
+    MCchUiCallStateObserver& aObserver ):
+    CActive( CActive::EPriorityStandard ),
+    iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    
+    iProperty.Attach( KPSUidCtsyCallInformation, KCTsyCallState );
+    IssueRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUiCallStateListener::NewL
+// ---------------------------------------------------------------------------
+//
+CCchUiCallStateListener* CCchUiCallStateListener::NewL(
+    MCchUiCallStateObserver& aObserver )
+    {
+    CCchUiCallStateListener* self = new ( ELeave ) CCchUiCallStateListener(
+        aObserver );
+    CCHUIDEBUG2( "CCchUiCallStateListener::NewL this=%d", (TInt)self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUiCallStateListener::~CCchUiCallStateListener
+// ---------------------------------------------------------------------------
+//
+CCchUiCallStateListener::~CCchUiCallStateListener()
+    {
+    CCHUIDEBUG( "CCchUiCallStateListener::~CCchUiCallStateListener - Start" );
+    
+    Cancel();
+    iProperty.Close();
+    
+    CCHUIDEBUG( "CCchUiCallStateListener::~CCchUiCallStateListener - End" );
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive
+// CCchUiCallStateListener::RunL
+// ---------------------------------------------------------------------------
+//
+void CCchUiCallStateListener::RunL()
+    { 
+    if ( iStatus.Int() == KErrNone )
+        {
+        HandleChange();
+        }
+    IssueRequest();
+    }
+
+// ----------------------------------------------------------
+// From class CActive
+// CCchUiCallStateListener::DoCancel
+// ----------------------------------------------------------
+//
+void CCchUiCallStateListener::DoCancel()
+    {
+    iProperty.Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUiCallStateListener::HandleChange
+// ---------------------------------------------------------------------------
+//
+void CCchUiCallStateListener::HandleChange()
+    {
+    CCHUIDEBUG( "CCchUiCallStateListener::HandleChange - Start" );
+    
+    TInt err = RProperty::Get( KPSUidCtsyCallInformation,
+                               KCTsyCallState,
+                               iCallState );
+    if ( err == KErrNone )
+        {
+        iObserver.CallStateChanged( iCallState );
+        }
+    
+    CCHUIDEBUG( "CCchUiCallStateListener::HandleChange - End" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUiCallStateListener::IssueRequest
+// ---------------------------------------------------------------------------
+//
+void CCchUiCallStateListener::IssueRequest()
+    {
+    if ( !IsActive() )
+        {
+        iProperty.Subscribe( iStatus );
+        SetActive();
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuiiconfileprovider.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* 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:  Implements icon file provider for avkon icon framework
+*
+*/
+
+
+#include <aknappui.h>
+#include <AknIconUtils.h>
+
+#include "cchuipluginiconfileprovider.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+CCchUiPluginIconFileProvider::CCchUiPluginIconFileProvider( RFile& aFile ):
+    iFile( aFile )
+    {
+    }
+
+CCchUiPluginIconFileProvider* 
+    CCchUiPluginIconFileProvider::NewL( RFile& aFile )
+    {
+    CCchUiPluginIconFileProvider* self = 
+        new( ELeave ) CCchUiPluginIconFileProvider( aFile );
+    return self;
+    }
+
+CCchUiPluginIconFileProvider::~CCchUiPluginIconFileProvider()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From class MAknIconFileProvider.
+// ---------------------------------------------------------------------------
+//
+void CCchUiPluginIconFileProvider::RetrieveIconFileHandleL(
+    RFile& aFile, const TIconFileType /*aType*/ )
+    {
+    User::LeaveIfError( aFile.Duplicate( iFile ) );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MAknIconFileProvider.
+// ---------------------------------------------------------------------------
+//
+void CCchUiPluginIconFileProvider::Finished()
+    {
+    delete this;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuinotifconnectionhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,427 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provider access to SNAPs
+*
+*/
+
+
+#include <cmmanagerdef.h>
+#include <cmpluginwlandef.h> // bearer type
+#include <cmdestinationext.h>
+#include <cmconnectionmethoddef.h>
+#include <cmconnectionmethodext.h>
+#include <cmpluginpacketdatadef.h>
+
+#include "cchuilogger.h"
+#include "cchuinotifconnectionhandler.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+CCchUiNotifConnectionHandler::CCchUiNotifConnectionHandler()
+    {
+    }
+
+void CCchUiNotifConnectionHandler::ConstructL()
+    {
+    iCmManagerExt.OpenL();
+    }
+
+CCchUiNotifConnectionHandler* CCchUiNotifConnectionHandler::NewL()
+    {
+    CCchUiNotifConnectionHandler* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CCchUiNotifConnectionHandler* CCchUiNotifConnectionHandler::NewLC()
+    {
+    CCchUiNotifConnectionHandler* self =
+        new (ELeave) CCchUiNotifConnectionHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+CCchUiNotifConnectionHandler::~CCchUiNotifConnectionHandler()
+    {
+    iCmManagerExt.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Gets GPRS access points from Internet SNAP
+// ---------------------------------------------------------------------------
+//
+TUint32 CCchUiNotifConnectionHandler::GetGprsAccessPointsL( 
+    CDesCArray& aIaps, RArray<TUint32>& aIapIds )
+    {    
+    CCHUIDEBUG( "CCchUiNotifConnectionHandler::GetGprsAccessPointsL - IN" );
+    
+    TUint32 internetSnapId = KErrNone;
+    RArray<TUint32> destIds = RArray<TUint32>( 1 );
+    CleanupClosePushL( destIds );
+    iCmManagerExt.AllDestinationsL( destIds );
+    
+    for ( TInt index = 0 ; index < destIds.Count() ; index++ )
+        {
+        RCmDestinationExt refDestination = 
+            iCmManagerExt.DestinationL( destIds[index] );
+        CleanupClosePushL( refDestination );    
+        
+        if ( refDestination.MetadataL( CMManager::ESnapMetadataInternet ) )
+            {
+            // Get all GPRS access point from this destination
+            GetGprsAccessPointsFromSnapL( aIaps, aIapIds, refDestination );
+            internetSnapId = refDestination.Id();
+            }
+        CleanupStack::PopAndDestroy( &refDestination );
+        }
+    CleanupStack::PopAndDestroy( &destIds );
+    
+    CCHUIDEBUG( "CCchUiNotifConnectionHandler::GetGprsAccessPointsL - OUT" );
+    
+    return internetSnapId;
+    } 
+
+// ---------------------------------------------------------------------------
+// Gets connection name.
+// ---------------------------------------------------------------------------
+//
+void CCchUiNotifConnectionHandler::ConnectionNameL( 
+    TUint aIapId, TDesC& aServiceName, RBuf& aIapName )
+    {    
+    CCHUIDEBUG( "CCchUiNotifConnectionHandler::ConnectionNameL - IN" );
+    
+    if ( aIapId )
+        {
+        RCmConnectionMethodExt connMethod = 
+        iCmManagerExt.ConnectionMethodL( aIapId );
+        CleanupClosePushL( connMethod );
+        
+        HBufC* connName = connMethod.GetStringAttributeL( 
+            CMManager::ECmName );
+        CleanupStack::PushL( connName );
+                    
+        aIapName.CreateL( connName->Des().Length() );
+        aIapName.Copy( connName->Des() );
+                    
+        CleanupStack::PopAndDestroy( connName );              
+        CleanupStack::PopAndDestroy( &connMethod );
+        }
+    else
+        {
+        RArray<TUint32> destinationIds;
+        CleanupClosePushL( destinationIds );
+        iCmManagerExt.AllDestinationsL( destinationIds );
+        
+        for ( TInt i( 0 ) ; i < destinationIds.Count() ; i++ )
+            {
+            RCmDestinationExt dest = 
+                iCmManagerExt.DestinationL( destinationIds[ i ] );
+            CleanupClosePushL( dest );
+
+            HBufC* destName = dest.NameLC();
+            if ( destName->Des().Compare( aServiceName ) == 0  )
+                {
+                // Get highest priority connecton method from snap
+                RCmConnectionMethodExt cm = dest.ConnectionMethodL( 0 );
+                CleanupClosePushL( cm );
+                
+                HBufC* cmName = NULL;
+                cmName = cm.GetStringAttributeL( CMManager::ECmName );
+                
+                if ( cmName )
+                    {
+                    CleanupStack::PushL( cmName );
+                    aIapName.CreateL( cmName->Des().Length() );
+                    aIapName.Copy( cmName->Des() );
+                    CleanupStack::PopAndDestroy( cmName );
+                    }
+                
+                CleanupStack::PopAndDestroy( &cm );
+                }
+            
+            CleanupStack::PopAndDestroy( destName );
+            CleanupStack::PopAndDestroy( &dest );
+            }
+        
+        CleanupStack::PopAndDestroy( &destinationIds );
+        }
+    
+    CCHUIDEBUG2( "ConnectionNameL - NAME=%S", &aIapName );
+        
+    CCHUIDEBUG( 
+            "CCchUiNotifConnectionHandler::ConnectionNameL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Gets all but specified service´s destinations.
+// ---------------------------------------------------------------------------
+//
+void CCchUiNotifConnectionHandler::GetDestinationsL( 
+    TDesC& aServiceName, RArray<TUint32>& aDestinationIds )
+    {  
+    CCHUIDEBUG( "CCchUiNotifConnectionHandler::GetDestinationsL - IN" );
+    
+    iCmManagerExt.AllDestinationsL( aDestinationIds );
+    
+    // Remove our services destination from destination ids.
+    for ( TInt i( 0 ) ; i < aDestinationIds.Count() ; i++ )
+        {
+        RCmDestinationExt refDestination = 
+        iCmManagerExt.DestinationL( aDestinationIds[ i ] );
+        CleanupClosePushL( refDestination );
+               
+        HBufC* destName = refDestination.NameLC();
+               
+        if ( destName->Des().Compare( aServiceName ) == 0 )
+            {
+            CCHUIDEBUG( 
+                "GetDestinationsL - remove current service´s destination" );
+            
+            aDestinationIds.Remove( i );
+            aDestinationIds.Compress();
+            }
+               
+        CleanupStack::PopAndDestroy( destName );      
+        CleanupStack::PopAndDestroy( &refDestination );
+        }
+    
+    CCHUIDEBUG( "CCchUiNotifConnectionHandler::GetDestinationsL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUiNotifConnectionHandler::GetDestinationL
+// ---------------------------------------------------------------------------
+//
+void CCchUiNotifConnectionHandler::GetDestinationL( 
+    TUint aIapId, TInt& aError, TUint32& aDestinationId )
+    {
+    CCHUIDEBUG2(
+        "CCchUiNotifConnectionHandler::GetDestinationL - IN aIapID = %d", &aIapId );
+    
+    aError = KErrNotFound;
+    RArray<TUint32> destinationIds;
+    CleanupClosePushL( destinationIds );
+    
+    iCmManagerExt.AllDestinationsL( destinationIds );
+    
+    // Find our service destination from Iap ids.
+    for ( TInt i( 0 ) ; i < destinationIds.Count() && KErrNone != aError; i++ )
+        {
+        RCmDestinationExt refDestination = 
+            iCmManagerExt.DestinationL( destinationIds[ i ] );
+        CleanupClosePushL( refDestination );
+        
+        HBufC* destName = refDestination.NameLC();
+        RCmConnectionMethodExt connectionMethod;
+        CleanupClosePushL( connectionMethod );
+        
+        TRAPD( error, connectionMethod =
+            refDestination.ConnectionMethodByIDL( aIapId ) );
+        
+        if ( KErrNone == error )
+            {
+            CCHUIDEBUG( 
+                "GetDestinationsL - IapID found from destination" );
+            aDestinationId = destinationIds[ i ];
+            aError = KErrNone;
+            }
+        CleanupStack::PopAndDestroy( &connectionMethod );
+        CleanupStack::PopAndDestroy( destName );
+        CleanupStack::PopAndDestroy( &refDestination );
+        }
+    
+    CleanupStack::PopAndDestroy( &destinationIds );
+
+    CCHUIDEBUG( "CCchUiNotifConnectionHandler::GetDestinationL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Gets all access point ids from SNAP.
+// ---------------------------------------------------------------------------
+//
+void CCchUiNotifConnectionHandler::GetAccessPointsFromSnapL( 
+    RArray<TUint32>& aIapIds, TUint32 aDestinationId )
+    {    
+    CCHUIDEBUG( 
+        "CCchUiNotifConnectionHandler::GetAccessPointsFromSnapL - IN" );
+
+    CleanupClosePushL(aIapIds);
+    
+    RCmDestinationExt destination = 
+                iCmManagerExt.DestinationL( aDestinationId );
+    CleanupClosePushL( destination );
+    
+    for ( TInt index = 0 ; 
+        index < destination.ConnectionMethodCount() ; index++ )
+        {
+        RCmConnectionMethodExt connMethod = 
+            destination.ConnectionMethodL( index );
+        CleanupClosePushL( connMethod );      
+        TUint32 iapId = connMethod.GetIntAttributeL( CMManager::ECmIapId );
+        aIapIds.AppendL( iapId );
+        CleanupStack::PopAndDestroy( &connMethod );
+        }
+
+    CleanupStack::PopAndDestroy( &destination );
+    CleanupStack::Pop();
+    
+    CCHUIDEBUG( 
+        "CCchUiNotifConnectionHandler::GetAccessPointsFromSnapL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Gets GPRS access points from Internet SNAP
+// ---------------------------------------------------------------------------
+//
+void CCchUiNotifConnectionHandler::GetGprsAccessPointsFromSnapL( 
+    CDesCArray& aIaps, 
+    RArray<TUint32>& aIapIds, 
+    RCmDestinationExt& aDestination )
+    {    
+    CCHUIDEBUG( 
+        "CCchUiNotifConnectionHandler::GetGprsAccessPointsFromSnapL - IN" );
+
+    __ASSERT_ALWAYS( aDestination.ConnectionMethodCount(), 
+        User::Leave( KErrNotFound ) );
+
+    for ( TInt index = 0 ; 
+        index < aDestination.ConnectionMethodCount() ; index++ )
+        {
+        RCmConnectionMethodExt connMethod = 
+            aDestination.ConnectionMethodL( index );
+        CleanupClosePushL( connMethod );
+        
+        if ( KUidPacketDataBearerType == connMethod.GetIntAttributeL( 
+                CMManager::ECmBearerType ) )
+            {
+            HBufC* connName = 
+                connMethod.GetStringAttributeL( CMManager::ECmName );
+            CleanupStack::PushL( connName );
+            
+            CCHUIDEBUG( "GetGprsAccessPointsFromSnapL - iap name ok" );
+            
+            aIaps.AppendL( *connName );
+            CleanupStack::PopAndDestroy( connName );    
+            TUint32 iapId = connMethod.GetIntAttributeL( CMManager::ECmIapId );
+            aIapIds.AppendL( iapId );
+            
+            CCHUIDEBUG2( "GetGprsAccessPointsFromSnapL - iap id: %d", iapId );
+            }
+        CleanupStack::PopAndDestroy( &connMethod );
+        }
+
+    CCHUIDEBUG( 
+        "CCchUiNotifConnectionHandler::GetGprsAccessPointsFromSnapL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUiNotifConnectionHandler::GetGprsAccessPointsSetToServiceSnapL
+// ---------------------------------------------------------------------------
+//
+TInt CCchUiNotifConnectionHandler::GetGprsAccessPointsSetToServiceSnapL(
+    CDesCArray& aIaps, RArray<TUint32>& aIapIds, TUint aIapId )
+    {
+    CCHUIDEBUG2( 
+        "CCchUiNotifConnectionHandler::GetGprsAccessPointsSetToServiceSnapL - IN aIapId = %d", aIapId );
+    
+    TUint32 destinationId = 0;
+    TInt error;
+    GetDestinationL( aIapId, error, destinationId );
+    if ( KErrNone == error )
+        {
+        CCHUIDEBUG2( 
+            "GetGprsAccessPointsSetToServiceSnapL - destinationId = %d", destinationId );
+        
+        RCmDestinationExt refDestination;
+        CleanupClosePushL( refDestination );
+        TRAPD( error,
+            refDestination = iCmManagerExt.DestinationL( destinationId ) );
+        CCHUIDEBUG2(
+            "GetGprsAccessPointsSetToServiceSnapL -Destination error %d", error );
+        
+        if ( KErrNone == error )
+            {
+            GetGprsAccessPointsFromSnapL( aIaps, aIapIds, refDestination );
+            }
+        CleanupStack::PopAndDestroy( &refDestination );
+        }
+
+    CCHUIDEBUG2(
+        "CCchUiNotifConnectionHandler::GetGprsAccessPointsSetToServiceSnapL -return %d", error );
+    
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUiNotifConnectionHandler::IsConnectionMethodSimilarL
+// ---------------------------------------------------------------------------
+//
+TBool CCchUiNotifConnectionHandler::IsConnectionMethodSimilarL(
+    TUint32 aIapId, TUint32 aIapIdToCompare )
+    {
+    CCHUIDEBUG( "CCchUiNotifConnectionHandler::IsConnectionMethodSimilarL - IN" );
+    
+    TBool returnVal = EFalse;
+    TUint32 bearerType = iCmManagerExt.GetConnectionMethodInfoIntL(
+        aIapId, CMManager::ECmBearerType );
+    if ( bearerType == iCmManagerExt.GetConnectionMethodInfoIntL(
+        aIapIdToCompare, CMManager::ECmBearerType ) )
+        {
+        HBufC* buffer = NULL;
+        HBufC* bufferToCompare = NULL;
+        
+        switch( bearerType )
+            {
+            case KUidWlanBearerType:
+                CCHUIDEBUG( "IsConnectionMethodSimilarL - KUidWlanBearerType" );
+                buffer = iCmManagerExt.GetConnectionMethodInfoStringL(
+                    aIapId, CMManager::EWlanSSID );
+                CCHUIDEBUG( "GetConnectionMethodInfoStringL - aIapId EWlanSSID OUT" );
+                CleanupStack::PushL( buffer );
+                bufferToCompare = iCmManagerExt.GetConnectionMethodInfoStringL(
+                    aIapIdToCompare, CMManager::EWlanSSID );
+                if ( buffer->Compare( *bufferToCompare ) == 0 )
+                    {
+                    returnVal = ETrue;
+                    }
+                CleanupStack::PopAndDestroy( buffer );
+                delete bufferToCompare;
+                bufferToCompare = NULL;
+                break;
+            case KUidPacketDataBearerType:
+                CCHUIDEBUG( "IsConnectionMethodSimilarL - KUidPacketDataBearerType" );
+                buffer = iCmManagerExt.GetConnectionMethodInfoStringL(
+                    aIapId, CMManager::EPacketDataAPName );
+                CleanupStack::PushL( buffer );
+                bufferToCompare = iCmManagerExt.GetConnectionMethodInfoStringL(
+                    aIapIdToCompare, CMManager::EPacketDataAPName );
+                if ( buffer->Compare( *bufferToCompare ) == 0 )
+                    {
+                    returnVal = ETrue;
+                    }
+                CleanupStack::PopAndDestroy( buffer );
+                delete bufferToCompare;
+                bufferToCompare = NULL;
+                break;
+            default:
+			    CCHUIDEBUG( "IsConnectionMethodSimilarL - Bearer type unknown" );
+                break;
+            }
+        }
+    CCHUIDEBUG2(
+        "CCchUiNotifConnectionHandler::IsConnectionMethodSimilarL -return = %d", returnVal );
+    
+    return returnVal;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuinotifier.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,464 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 base class for notifier implementations
+*
+*/
+
+
+#include <eikenv.h>
+#include <bautils.h>
+#include <featmgr.h>
+#include <spentry.h> 
+#include <spsettings.h>
+#include <spproperty.h>
+#include <cchuinotif.rsg>
+#include <StringLoader.h>
+#include <aknnotewrappers.h>
+#include <centralrepository.h>
+#include <cenrepnotifyhandler.h>
+#include <CoreApplicationUIsSDKCRKeys.h> // KCRUidCoreApplicationUIs, 
+                                         // KCoreAppUIsNetworkConnectionAllowed
+#include <AknNotiferAppServerApplication.h>  // Application Key enable/disable
+
+#include "cchuilogger.h"
+#include "cchuinotifier.h"
+#include "cchuinotifconnectionhandler.h"
+
+_LIT( KResourceDir, "\\resource\\apps\\" );
+_LIT( KResourceFileName, "cchuinotif.r*" );
+
+// SCP-plugin uid for Sip VoIP
+const TInt32 KSipVoIPSubServicePlugId = 0x1027545A;
+
+// ======== MEMBER FUNCTIONS ========
+
+CCCHUiNotifierBase::CCCHUiNotifierBase(): 
+    CActive(EPriorityStandard), iAppKeyBlocked( EFalse )
+    {
+    CActiveScheduler::Add(this);
+    }
+
+void CCCHUiNotifierBase::ConstructL()
+    {      
+    CCHUIDEBUG( "CCCHUiNotifierBase::ConstructL - IN" );
+    
+    iEikEnv = CEikonEnv::Static();
+
+    // load the resource file
+    CCHUIDEBUG( "ConstructL - load resource");
+   
+    HBufC* resourceFile = ScanFileL( iEikEnv->FsSession(), 
+        TFileName( KResourceFileName ), TFileName( KResourceDir ) );
+    
+    if ( resourceFile )
+        {
+        CCHUIDEBUG( "ConstructL - resource ready, adding");   
+        
+        CleanupStack::PushL( resourceFile );
+        iResourceFileFlag = iEikEnv->AddResourceFileL(
+            *resourceFile );    
+        CleanupStack::PopAndDestroy( resourceFile );
+        
+        CCHUIDEBUG( "ConstructL - resource added");    
+        }
+    
+    iSettings = CSPSettings::NewL();
+    
+    CCHUIDEBUG( "CCCHUiNotifierBase::ConstructL - OUT" );
+    }
+
+CCCHUiNotifierBase::~CCCHUiNotifierBase()
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::~CCCHUiNotifierBase - IN" );
+    
+    if( iAppKeyBlocked )
+        {
+        (void) ((CAknNotifierAppServerAppUi*)
+            iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse);    
+        }
+    
+    Cancel();    
+    
+    delete iSettings;
+    CompleteMessage( KErrDied );  
+    iEikEnv->DeleteResourceFile( iResourceFileFlag );
+    
+    CCHUIDEBUG( "CCCHUiNotifierBase::~CCCHUiNotifierBase - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CompleteMessage.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierBase::CompleteMessage( TInt aErr )
+    {      
+    CCHUIDEBUG2( "CCCHUiNotifierBase::CompleteMessage - err: %d", aErr );
+    
+    if( !iMessage.IsNull() )
+        {
+        CCHUIDEBUG( "CompleteMessage - do complete");
+        iMessage.Complete( aErr );
+        }
+    
+    iReplySlot = NULL;                    
+    }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// Cancelling method.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierBase::Cancel()
+    {   
+    CCHUIDEBUG( "CCCHUiNotifierBase::Cancel - IN" );
+        
+    // Complete with KErrCancel
+    CompleteMessage(KErrCancel);        
+    CActive::Cancel();
+    
+    CCHUIDEBUG( "CCCHUiNotifierBase::Cancel - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// RunL
+// From CActive.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierBase::RunL(  )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::RunL" );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// Release itself. Call to destructor.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierBase::Release()
+    { 
+    CCHUIDEBUG( "CCCHUiNotifierBase::Release");
+    delete this;
+    }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// Return registered information.
+// ---------------------------------------------------------------------------
+//
+CCCHUiNotifierBase::TNotifierInfo CCCHUiNotifierBase::Info() const
+    {      
+    CCHUIDEBUG( "CCCHUiNotifierBase::Info");
+    return iInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// Synchronic notifier launch. Does nothing here.
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CCCHUiNotifierBase::StartL( const TDesC8& /*aBuffer*/ )
+    {    
+    CCHUIDEBUG( "CCCHUiNotifierBase::StartL");
+    TPtrC8 ret( KNullDesC8 );
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// Asynchronic notifier launch.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierBase::StartL( 
+    const TDesC8& /*aBuffer*/, 
+    TInt aReplySlot, 
+    const RMessagePtr2& aMessage )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::StartL2 - IN");
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
+    
+    SetActive();
+    
+    iStatus = KRequestPending;
+    TRequestStatus* stat = &iStatus;
+    User::RequestComplete(stat, KErrNone);
+
+    CCHUIDEBUG( "CCCHUiNotifierBase::StartL2 - OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// Notifier update. Not supported.
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CCCHUiNotifierBase::UpdateL( const TDesC8& /*aBuffer*/ )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::UpdateL");
+    TPtrC8 ret( KNullDesC8 );
+    return ret;
+    }
+    
+// ----------------------------------------------------------
+// CCCHUiNotifierBase::DoCancel
+// This method will be called by framework (CActive)
+// if active object is still active.
+// Does nothing here.
+// ----------------------------------------------------------
+//
+void CCCHUiNotifierBase::DoCancel()
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::DoCancel - IN");
+    
+    // Complete request when active object is still active
+    TRequestStatus* stat = &iStatus;
+    if (iStatus != KErrCancel)
+        {
+        User::RequestComplete(stat, KErrNone);
+        }
+        
+    CCHUIDEBUG( "CCCHUiNotifierBase::DoCancel - OUT");
+    }
+
+// -----------------------------------------------------------------------------
+// Scan resource file.
+// -----------------------------------------------------------------------------
+//
+HBufC* CCCHUiNotifierBase::ScanFileL( 
+    RFs& aSession, 
+    const TDesC& aFileName, 
+    const TDesC& aFilePath )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::ScanFileL");     
+    
+    TFindFile search( aSession ); 
+    CDir* dirlist; 
+    HBufC* fullName = NULL;
+    TFileName filename( aFileName );
+    TInt err = search.FindWildByDir( filename, aFilePath, dirlist ); 
+    
+    CCHUIDEBUG2( "ScanFileL - FindWildByDir err: %d", err );    
+    
+    if ( err == KErrNone )
+        {
+        CCHUIDEBUG2( "ScanFileL - dir list count: %d", dirlist->Count() );      
+        
+        if ( 0 < dirlist->Count() )
+            {
+            CCHUIDEBUG( "ScanFileL - Parsing full entry" );
+            
+            TParse fullentry;
+            fullentry.Set( (*dirlist)[0].iName, &search.File(), NULL ); 
+            TFileName nearestFile( fullentry.FullName() );
+            BaflUtils::NearestLanguageFile( aSession, nearestFile );   
+            fullName = HBufC::NewL( nearestFile.Length() );
+            fullName->Des().Copy( nearestFile );  
+            }
+        delete dirlist; 
+        
+        CCHUIDEBUG2( "ScanFileL - full name: %S", fullName );             
+        }     
+    
+    return fullName;
+    }  
+
+// ---------------------------------------------------------------------------
+// Resolves service name.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierBase::GetServiceNameL( 
+    TUint aServiceId, TDes& aServiceName )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::GetServiceNameL" );	
+	CSPEntry* entry = CSPEntry::NewLC();
+	TRAPD( err, iSettings->FindEntryL( aServiceId, *entry ) );
+	if ( !err )
+	    {
+	    aServiceName = entry->GetServiceName();
+	    }
+	CleanupStack::PopAndDestroy( entry );    
+    CCHUIDEBUG( "CCCHUiNotifierBase::GetServiceNameL OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Resolves current connection name.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierBase::CurrentConnectionNameL( 
+    TUint aServiceId, TUint aIapId, RBuf& aIapName )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::CurrentConnectionNameL - IN" );    
+   
+    CCchUiNotifConnectionHandler* connHandler = 
+            CCchUiNotifConnectionHandler::NewLC();
+    
+    RBuf serviceName;
+    CleanupClosePushL( serviceName );
+    serviceName.CreateL( KServiceNameLength );
+    GetServiceNameL( aServiceId, serviceName );
+    
+    // get connection name
+    connHandler->ConnectionNameL( aIapId, serviceName, aIapName );
+    
+    CleanupStack::PopAndDestroy( &serviceName );
+    CleanupStack::PopAndDestroy( connHandler );
+    
+    CCHUIDEBUG( "CCCHUiNotifierBase::CurrentConnectionNameL - OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// Resolves if service is SIP/VoIP.
+// ---------------------------------------------------------------------------
+//
+TBool CCCHUiNotifierBase::IsSIPVoIPL( TUint aServiceId )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::IsSIPVoIPL" );
+    
+    TInt uid( 0 );
+    TBool sipVoIP( EFalse );
+       
+    CSPProperty* property = CSPProperty::NewLC();
+       
+    User::LeaveIfError( iSettings->FindPropertyL( 
+            aServiceId, EPropertyVoIPSubServicePluginId , *property ) );
+       
+    User::LeaveIfError( property->GetValue( uid ) );
+       
+    if ( KSipVoIPSubServicePlugId == uid )
+        {
+        sipVoIP = ETrue;
+        }
+       
+    CleanupStack::PopAndDestroy( property );
+       
+    CCHUIDEBUG2( "CCCHUiNotifierBase::IsSIPVoIPL: %d", sipVoIP );
+    
+    return sipVoIP;
+    }
+    
+// -----------------------------------------------------------------------------
+// Checks if phone is in offline mode.
+// -----------------------------------------------------------------------------
+//
+TBool CCCHUiNotifierBase::IsPhoneOfflineL() const
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::IsPhoneOfflineL" );	
+    
+    if ( FeatureManager::FeatureSupported( KFeatureIdOfflineMode ) )
+        {
+        CRepository* repository = CRepository::NewLC(KCRUidCoreApplicationUIs);
+        TInt connAllowed = ECoreAppUIsNetworkConnectionAllowed;
+        repository->Get( KCoreAppUIsNetworkConnectionAllowed, connAllowed );
+        CleanupStack::PopAndDestroy( repository ); 
+        if ( !connAllowed )
+            {
+            CCHUIDEBUG( "IsPhoneOfflineL - phone is in offline" );	        
+            return ETrue;
+            }
+        }
+    
+    CCHUIDEBUG( "IsPhoneOfflineL - phone is not in offline" );	
+    return EFalse;
+    }    
+
+// -----------------------------------------------------------------------------
+// Checks if there are GPRS IAPs available in Internet SNAP.
+// -----------------------------------------------------------------------------
+//
+TBool CCCHUiNotifierBase::IsGprsIapsAvailableL() const
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::IsGprsIapsAvailableL" );   
+    
+    TBool available( EFalse );
+    
+    CCchUiNotifConnectionHandler* connHandler = 
+        CCchUiNotifConnectionHandler::NewLC();
+    
+    RArray<TUint32> gprsIapIds;
+    CleanupClosePushL( gprsIapIds );
+    
+    // Array for iap names. No use here, we need just iap count.
+    CDesCArray* iapNames = new (ELeave) CDesCArrayFlat( 3 );
+    CleanupStack::PushL( iapNames );            
+    
+    TRAPD( err, connHandler->GetGprsAccessPointsL( *iapNames, gprsIapIds ) );
+    
+    if ( gprsIapIds.Count() && !err )
+        {     
+        CCHUIDEBUG( "IsGprsIapsAvailableL - gprs iaps available" );      
+        available = ETrue;
+        }
+    
+    CleanupStack::PopAndDestroy( iapNames );
+    CleanupStack::PopAndDestroy( &gprsIapIds );
+    CleanupStack::PopAndDestroy( connHandler );
+    
+    CCHUIDEBUG( "IsGprsIapsAvailableL gprs iaps not available" );
+    return available;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if connection is used by other services.
+// -----------------------------------------------------------------------------
+//
+TBool CCCHUiNotifierBase::ConnectionUsedByOthersL( 
+    TUint aServiceId, TInt aIapId )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierBase::ConnectionUsedByOthersL" );
+    
+    TBool usedByOthers( EFalse );
+    
+    RArray<TUint32> destIds;
+    CleanupClosePushL( destIds );
+     
+    CCchUiNotifConnectionHandler* connHandler = 
+            CCchUiNotifConnectionHandler::NewLC();
+    
+    RBuf serviceName;
+    CleanupClosePushL( serviceName );
+    serviceName.CreateL( KServiceNameLength );
+    GetServiceNameL( aServiceId, serviceName );
+    
+    CCHUIDEBUG( "ConnectionUsedByOthersL - get destinations" );
+    
+    // Get all but our services destinations.
+    connHandler->GetDestinationsL( serviceName, destIds );
+    
+    CleanupStack::PopAndDestroy( &serviceName );
+    
+    for ( TInt i( 0 ) ; i < destIds.Count() ; i++ )
+        {
+        RArray<TUint32> iapIds;
+        CleanupClosePushL( iapIds );
+     
+        connHandler->GetAccessPointsFromSnapL( iapIds, destIds[ i ] );
+        
+        TInt index = iapIds.Find( aIapId );
+        
+        if ( KErrNotFound != index  )
+            {
+            CCHUIDEBUG( 
+            "ConnectionUsedByOthersL - iap is used by other service(s)" );
+            
+            usedByOthers = ETrue;
+            }
+        
+        CleanupStack::PopAndDestroy( &iapIds );
+        }
+     
+    CleanupStack::PopAndDestroy( connHandler );
+    CleanupStack::PopAndDestroy( &destIds );
+    
+    return usedByOthers;
+    }
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuinotifierimpl.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1347 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Actual notifier implementation
+*
+*/
+
+
+#include <eikenv.h>
+#include <bautils.h>
+#include <eikclbd.h>
+#include <eikimage.h>
+#include <cchuinotif.rsg>
+#include <StringLoader.h>
+#include <aknnotewrappers.h>
+#include <cenrepnotifyhandler.h>
+#include <ctsydomainpskeys.h>
+#include <crcseprofileregistry.h>
+#include <sipprofile.h>
+#include <sipmanagedprofileregistry.h>
+#include <AknNotiferAppServerApplication.h>  // Application Key enable/disable
+
+#include "cchuilogger.h"
+#include "cchuicommon.hrh"
+#include "cchuinotifierimpl.h"
+#include "cchuipluginbrandinghandler.h"
+#include "cchuinotifconnectionhandler.h"
+#include "cchuicallstatelistener.h"
+
+const TUint32 KBearerSettingWlanOnly = 1;
+
+// ======== MEMBER FUNCTIONS ========
+
+CCCHUiNotifierImpl::CCCHUiNotifierImpl()
+    {
+    }
+
+CCCHUiNotifierImpl* CCCHUiNotifierImpl::NewL()
+    {
+    CCCHUiNotifierImpl* self = new (ELeave) CCCHUiNotifierImpl();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+void CCCHUiNotifierImpl::ConstructL()
+    {
+    CCCHUiNotifierBase::ConstructL();
+    iCallStateListener = CCchUiCallStateListener::NewL( *this );
+    iSipProfileRegistry = CSIPManagedProfileRegistry::NewL( *this );
+    }
+
+CCCHUiNotifierImpl::~CCCHUiNotifierImpl()
+    {
+    CCHUIDEBUG( "CCCHUiNotifierImpl::~CCCHUiNotifierImpl - IN" );	
+    
+    if ( iAppKeyBlocked )
+        {
+        // Remove application key blocking
+        (void) ((CAknNotifierAppServerAppUi*)
+            iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse);    
+        iAppKeyBlocked = EFalse;
+        }
+    
+    CCCHUiNotifierBase::Cancel();
+    iListQueryDialog = NULL;
+    delete iBrandingHandler;
+    delete iCallStateListener;
+    
+    CCHUIDEBUG( "CCCHUiNotifierImpl::~CCCHUiNotifierImpl - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// RunL
+// From CActive.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::RunL(  )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierImpl::RunL - IN" );
+
+    switch( iDialogMode )
+        {
+        // Only ECchUiDialogTypeNoConnectionAvailable is launched via RunL
+        // currently.
+        case MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable:
+            {
+            CCHUIDEBUG( "CCCHUiNotifierImpl::RunL - ECchUiDialogTypeNoConnectionAvailable" );               
+            ShowNoConnectionsQueryL( iReplySlot, iMessage, iServiceId, EFalse );
+            }
+            break;    
+
+        default:
+            {
+            CCHUIDEBUG( "CCCHUiNotifierImpl::RunL - Does nothing" );
+            }
+            break;    
+        }    
+        
+    CCHUIDEBUG( "   CCCHUiNotifierImpl::RunL - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MEikSrvNotifierBase2.
+// Cancelling method.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::Cancel()
+    {
+    CCHUIDEBUG( "CCCHUiNotifierImpl::Cancel - IN" );
+    if ( iListQueryDialog )
+        {
+        delete iListQueryDialog;
+        iListQueryDialog = NULL;
+        CCCHUiNotifierBase::Cancel();
+        }
+    
+    CCHUIDEBUG( "CCCHUiNotifierImpl::Cancel - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Shows username & password query.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::ShowUsernamePasswordQueryL(
+    TInt aReplySlot, 
+    const RMessagePtr2& aMessage, 
+    TUint aServiceId,
+    const TDesC& aUserName )
+    { 
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowUsernamePasswordQueryL - IN" );
+    
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
+    
+    HBufC* userName = HBufC::NewLC( KUserNameLength );
+    HBufC* passWord = HBufC::NewLC( KPasswordLength );
+
+    // Set current username
+    userName->Des().Copy( aUserName );
+    
+    TPtr ptrUserName( userName->Des() );
+    TPtr ptrPassWord( passWord->Des() );
+
+    CCHUIDEBUG( "ShowUsernamePasswordQueryL - create query");	
+    
+    CAknMultiLineDataQueryDialog* dlg = CAknMultiLineDataQueryDialog::NewL( 
+        ptrUserName, ptrPassWord );
+     
+    // Block application key while showing query
+    (void) ((CAknNotifierAppServerAppUi*)
+        iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); 
+    iAppKeyBlocked = ETrue;
+    
+    if ( dlg->ExecuteLD( R_CCHUINOTIF_USERNAME_PWD_DIALOG ) )
+        {	
+        iResultParams.iDialogMode = 
+            MCchUiObserver::ECchUiDialogTypeAuthenticationFailed;
+        iResultParams.iServiceId = aServiceId;
+        iResultParams.iUsername = *userName;
+        iResultParams.iPwd = *passWord;
+        iMessage.WriteL( iReplySlot, 
+                         TPckgBuf<TCCHUiNotifierParams>( iResultParams ) );
+        CompleteMessage(KErrNone);                              
+        }
+    else
+        {
+        CCHUIDEBUG( "ShowUsernamePasswordQueryL - cancelled" );	
+        CompleteMessage( KErrCancel );
+        }
+    
+    // Remove application key blocking
+    (void) ((CAknNotifierAppServerAppUi*)
+        iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse);    
+    iAppKeyBlocked = EFalse;
+    
+    CleanupStack::PopAndDestroy( passWord );
+    CleanupStack::PopAndDestroy( userName );
+    
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowUsernamePasswordQueryL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Shows no connections query.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::ShowNoConnectionsQueryL(
+    TInt aReplySlot, 
+    const RMessagePtr2& aMessage, 
+    TUint aServiceId,
+    TBool aNoConnectionsDefined )
+    { 
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowNoConnectionsQueryL - IN" );	
+    
+    iServiceId = aServiceId;
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
+
+    CDesCArray* arrayforDialog = new (ELeave) CDesCArrayFlat( 3 );
+    CleanupStack::PushL( arrayforDialog );  
+    
+    CCHUIDEBUG( "ShowNoConnectionsQueryL - form content" );	
+
+    RArray<TCchUiOperationCommand> commandArray;
+    CleanupClosePushL( commandArray );
+
+    TInt result = KErrNotFound;
+    MCchUiObserver::TCchUiDialogType currentType = 
+        MCchUiObserver::ECchUiDialogTypeNotSet;
+    HBufC* string = NULL;
+    if ( aNoConnectionsDefined )
+        {
+        string = StringLoader::LoadLC( 
+            R_QTN_CCHUINOTIF_NO_CONNECTIONS_DEFINED_HEADING );
+        FillNoConnectionsDefinedListboxL( *arrayforDialog, commandArray );                        
+        currentType = MCchUiObserver::ECchUiDialogTypeNoConnectionDefined;            
+        }
+    else
+        {
+        string = StringLoader::LoadLC( 
+            R_QTN_CCHUINOTIF_NO_CONNECTIONS_HEADING );
+        FillNoConnectionsAvailableListboxL( 
+                *arrayforDialog, commandArray, aServiceId );
+        currentType = MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable;
+        }
+
+    iListQueryDialog = new (ELeave) CAknListQueryDialog( &result );
+    iListQueryDialog->PrepareLC( R_CCHUINOTIF_NO_CONNECTIONS_AVAILABLE );
+
+    iListQueryDialog->MessageBox()->SetMessageTextL( string );
+
+    CCHUIDEBUG( "ShowNoConnectionsQueryL - form heading" );	
+    
+    // Set heading ie. service name
+    HBufC* serviceName = HBufC::NewLC( KServiceNameLength );
+    TPtr serviceNamePtr( serviceName->Des() );
+    GetServiceNameL( aServiceId, serviceNamePtr );    
+    CCHUIDEBUG( "ShowNoConnectionsQueryL - set heading" );  
+    iListQueryDialog->QueryHeading()->SetTextL( serviceNamePtr );
+    CCHUIDEBUG( "ShowNoConnectionsQueryL - heading set ok" );   
+    CleanupStack::PopAndDestroy(); // serviceName
+    CCHUIDEBUG( "ShowNoConnectionsQueryL - proceed to list items" );    
+      
+    CCHUIDEBUG( "ShowNoConnectionsQueryL - set item array" );   
+    iListQueryDialog->SetItemTextArray( arrayforDialog );
+    iListQueryDialog->SetOwnershipType( ELbmDoesNotOwnItemArray );
+      
+    CCHUIDEBUG( "ShowNoConnectionsQueryL - retrieve branded icon" );    
+    CFbsBitmap* myBitmap = NULL;
+    CFbsBitmap* myMask = NULL;
+    TRAPD( err, BrandingHandlerL().RetrieveServiceIconL( 
+        aServiceId, myBitmap, myMask ) );
+    CCHUIDEBUG2( "ShowNoConnectionsQueryL - brand err: %d", err );  
+      
+    if ( !err && iListQueryDialog->QueryHeading() )
+        {
+        CleanupStack::PushL( myBitmap );
+        CleanupStack::PushL( myMask );
+        CEikImage* image = new (ELeave) CEikImage();
+        image->SetPicture( myBitmap, myMask );     
+        CleanupStack::Pop( myMask );
+        CleanupStack::Pop( myBitmap );     
+        CleanupStack::PushL( image );    
+        iListQueryDialog->QueryHeading()->SetHeaderImageL( image );
+        iListQueryDialog->QueryHeading()->ActivateL();
+        CleanupStack::PopAndDestroy( image );
+        }
+    else if ( !err )
+        {
+        delete myMask;
+        delete myBitmap;
+          }
+    else
+        {
+        // Error occurred in RetrieveServiceIconL. Nothing to do.
+        }
+         
+    // Block application key while showing query
+    (void) ((CAknNotifierAppServerAppUi*)
+        iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); 
+    iAppKeyBlocked = ETrue;
+    
+    CCHUIDEBUG( "ShowNoConnectionsQueryL - run dialog" );   
+    iListQueryDialog->RunLD();
+    CCHUIDEBUG( "ShowNoConnectionsQueryL - run dialog done" );
+
+    // write result, result now holds the item number
+    if ( KErrNotFound != result )
+        {
+        iResultParams.iDialogMode = currentType;
+        iResultParams.iServiceId = aServiceId;
+        iResultParams.iOperationCommand = commandArray[ result ];        
+        TInt error = KErrNone;  
+        if ( ECchUiCommandCopyGprs == commandArray[ result ] )
+            {
+            error = ShowGprsSelectionL( aServiceId );
+            }
+        if ( !error )
+            {
+            CCHUIDEBUG( "ShowNoConnectionsQueryL - write and complete" );   
+            iMessage.WriteL( iReplySlot, 
+                TPckgBuf<TCCHUiNotifierParams>( iResultParams ) );
+            CompleteMessage( KErrNone );  
+            }
+        else
+            {
+            CCHUIDEBUG( "ShowNoConnectionsQueryL - complete with cancel" ); 
+            CompleteMessage( error );
+            }
+        }
+    else
+        {
+        CCHUIDEBUG( "ShowNoConnectionsQueryL - complete with cancel" ); 
+        CompleteMessage( KErrCancel );
+        }
+    
+    // Remove application key blocking
+    (void) ((CAknNotifierAppServerAppUi*)
+        iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse);    
+    iAppKeyBlocked = EFalse;
+    
+    CleanupStack::PopAndDestroy( string );
+    CleanupStack::PopAndDestroy( &commandArray );
+    CleanupStack::PopAndDestroy( arrayforDialog );    
+      
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowNoConnectionsQueryL - OUT" );   
+    }
+
+// ---------------------------------------------------------------------------
+// Shows change connection query.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::ShowChangeConnectionQueryL(
+    TInt aReplySlot,
+    const RMessagePtr2& aMessage,
+    TUint aServiceId, 
+    TInt aIapId )
+    { 
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowChangeConnectionQueryL - IN" );   
+    
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
+
+    CDesCArray* arrayforDialog = new (ELeave) CDesCArrayFlat( 3 );
+    CleanupStack::PushL( arrayforDialog );
+    
+    CCHUIDEBUG( "ShowChangeConnectionQueryL - form content" ); 
+
+    RArray<TCchUiOperationCommand> commandArray;
+    CleanupClosePushL( commandArray );
+
+    TInt result = KErrNotFound;
+    MCchUiObserver::TCchUiDialogType type = 
+        MCchUiObserver::ECchUiDialogTypeChangeConnection;
+    HBufC* string = NULL;
+       
+    RBuf iapName;
+    CleanupClosePushL( iapName );
+    
+    // If we have current connection, show it in query heading
+    if ( aIapId )
+        {
+        CurrentConnectionNameL( 
+            aServiceId, 
+            aIapId,
+            iapName );
+        
+        string = StringLoader::LoadLC( 
+            R_QTN_CCHUINOTIF_CHANGE_CURRENT_CONNECTION_HEADING, iapName ); 
+        
+        FillChangeCurrentConnectionListboxL( *arrayforDialog, commandArray );
+        }
+    else // otherwise show in heading that we have no current connection
+        {
+        string = StringLoader::LoadLC( 
+            R_QTN_CCHUINOTIF_CHANGE_CONNECTION_HEADING );
+        
+        FillChangeConnectionListboxL( *arrayforDialog, commandArray );
+        }
+    
+    iListQueryDialog = new (ELeave) CAknListQueryDialog( &result );
+    iListQueryDialog->PrepareLC( R_CCHUINOTIF_CHANGE_CONNECTION_QUERY );
+
+    iListQueryDialog->MessageBox()->SetMessageTextL( string );
+    
+    CCHUIDEBUG( "ShowChangeConnectionQueryL - form heading" ); 
+    // Set heading ie. service name
+    HBufC* serviceName = HBufC::NewLC( KServiceNameLength );
+    TPtr serviceNamePtr( serviceName->Des() );
+    GetServiceNameL( aServiceId, serviceNamePtr );    
+    CCHUIDEBUG( "ShowChangeConnectionQueryL - set heading" );  
+    iListQueryDialog->QueryHeading()->SetTextL( serviceNamePtr );
+    CCHUIDEBUG( "ShowChangeConnectionQueryL - heading set ok" );   
+    CleanupStack::PopAndDestroy(); // serviceName
+    CCHUIDEBUG( "ShowChangeConnectionQueryL - proceed to list items" );    
+    
+    CCHUIDEBUG( "ShowChangeConnectionQueryL - set item array" );   
+    iListQueryDialog->SetItemTextArray( arrayforDialog );
+    iListQueryDialog->SetOwnershipType( ELbmDoesNotOwnItemArray );
+
+    CCHUIDEBUG( "ShowChangeConnectionQueryL - retrieve branded icon" );    
+
+    CFbsBitmap* myBitmap = NULL;
+    CFbsBitmap* myMask = NULL;
+    TRAPD( err, BrandingHandlerL().RetrieveServiceIconL( 
+        aServiceId, myBitmap, myMask ) );
+
+    CCHUIDEBUG2( "ShowChangeConnectionQueryL - brand err: %d", err );
+    
+    if ( !err && iListQueryDialog->QueryHeading() )
+        {
+        CleanupStack::PushL( myBitmap );
+        CleanupStack::PushL( myMask );
+        CEikImage* image = new (ELeave) CEikImage();
+        image->SetPicture( myBitmap, myMask );      
+        CleanupStack::Pop( myMask );
+        CleanupStack::Pop( myBitmap );    
+        CleanupStack::PushL( image );               
+        iListQueryDialog->QueryHeading()->SetHeaderImageL( image );
+        iListQueryDialog->QueryHeading()->ActivateL();
+        CleanupStack::PopAndDestroy( image );
+        }
+    else if ( !err )
+        {
+        delete myMask;
+        delete myBitmap;
+        }
+    else
+        {
+        // Error occurred in RetrieveServiceIconL. Nothing to do.
+        }
+   
+    // Block application key while showing query
+    (void) ((CAknNotifierAppServerAppUi*)
+        iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); 
+    iAppKeyBlocked = ETrue;
+    
+    CCHUIDEBUG( "ShowChangeConnectionQueryL - run dialog" );
+    
+    // List query dialog is deleted via RunLD except if there is
+    // incoming call at the same time the dialog is shown on screen.
+    // In case of incoming call CallStateChanged() method handles
+    // the deletion
+    iListQueryDialog->RunLD();
+    // coverity[check_after_deref]
+    if( iListQueryDialog )
+        {
+        // write result, result now holds the item number
+        if ( KErrNotFound != result )
+            {
+            iResultParams.iDialogMode = type;
+            iResultParams.iServiceId = aServiceId;
+            iResultParams.iOperationCommand = commandArray[ result ];    
+            TInt error = KErrNone;
+            if ( ECchUiCommandCopyGprs == commandArray[ result ] )
+                {
+                error = ShowGprsSelectionL( aServiceId );
+                }
+            if ( !error )
+                {
+                CCHUIDEBUG( "ShowChangeConnectionQueryL - write and complete" );  
+                iMessage.WriteL( iReplySlot, 
+                    TPckgBuf<TCCHUiNotifierParams>( iResultParams ) );
+                CompleteMessage( KErrNone );    
+                }
+            else
+                {
+                CCHUIDEBUG( "ShowChangeConnectionQueryL - complete with cancel" ); 
+                CompleteMessage( error );
+                }
+            }
+        else
+            {
+            CCHUIDEBUG( "ShowChangeConnectionQueryL - complete with cancel" ); 
+            CompleteMessage( KErrCancel );
+            }
+        
+        iListQueryDialog = NULL;
+        }
+    
+    // Remove application key blocking
+    (void) ((CAknNotifierAppServerAppUi*)
+        iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse);    
+    iAppKeyBlocked = EFalse;
+    
+    CleanupStack::PopAndDestroy( string );    
+    CleanupStack::PopAndDestroy( &iapName );   
+    CleanupStack::PopAndDestroy( &commandArray );
+    CleanupStack::PopAndDestroy( arrayforDialog );
+    
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowChangeConnectionQueryL - OUT" );   
+    }
+	
+// ---------------------------------------------------------------------------
+// Shows defective settings error note.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::ShowDefectiveSettingsL( 
+    TInt aReplySlot, 
+	const RMessagePtr2& aMessage, 
+	TUint aServiceId )
+	{ 
+	CCHUIDEBUG( "CCCHUiNotifierImpl::ShowDefectiveSettingsL - IN" );
+
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
+    
+    // Get service name
+    HBufC* serviceName = HBufC::NewLC( KServiceNameLength );
+    TPtr serviceNamePtr( serviceName->Des() );
+    GetServiceNameL( aServiceId, serviceNamePtr ); 
+    
+    // Show info note about defective settings
+    HBufC* defectiveText = StringLoader::LoadLC( 
+        R_QTN_SERVTAB_CONN_ESTABLSH_FAILED_PERMANENTLY_NOTE_TEXT, serviceNamePtr );
+    CAknInformationNote* note = 
+        new( ELeave ) CAknInformationNote( ETrue );
+    note->SetTimeout(CAknNoteDialog::ELongTimeout);
+    note->ExecuteLD( *defectiveText );   
+    CleanupStack::PopAndDestroy( defectiveText );     
+    CleanupStack::PopAndDestroy( serviceName );
+    
+    iResultParams.iDialogMode = 
+        MCchUiObserver::ECchUiDialogTypeDefectiveSettings;
+    iResultParams.iServiceId = aServiceId;
+    iMessage.WriteL( iReplySlot, 
+                     TPckgBuf<TCCHUiNotifierParams>( iResultParams ) );
+    CompleteMessage(KErrNone);                              
+
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowDefectiveSettingsL - OUT" );	
+	}    	
+	
+// ---------------------------------------------------------------------------
+// Shows error in connection error note.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::ShowErrorInConnectionNoteL( 
+    TInt aReplySlot, 
+    const RMessagePtr2& aMessage, 
+    TUint aServiceId )
+    { 
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowErrorInConnectionL - IN" ); 
+
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
+    
+    // Show info note about error in connection 
+    //(access point not suitable for internet calls)
+    HBufC* noteText = StringLoader::LoadLC( 
+        R_QTN_VOIP_ERROR_IN_CONNECTION_NOTE_TEXT );
+    CAknInformationNote* note = 
+        new( ELeave ) CAknInformationNote( ETrue );
+    note->SetTimeout(CAknNoteDialog::ELongTimeout);
+    note->ExecuteLD( *noteText );   
+    CleanupStack::PopAndDestroy( noteText );
+    
+    iResultParams.iDialogMode = 
+        MCchUiObserver::ECchUiDialogTypeErrorInConnection;
+    iResultParams.iServiceId = aServiceId;
+    iMessage.WriteL( iReplySlot, 
+                     TPckgBuf<TCCHUiNotifierParams>( iResultParams ) );
+    CompleteMessage(KErrNone);                              
+
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowErrorInConnectionL - OUT" ); 
+    }  
+
+// ---------------------------------------------------------------------------
+// Shows invalid username/password note.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::ShowInvalidUsernamePasswordNoteL( 
+    TInt aReplySlot, 
+    const RMessagePtr2& aMessage, 
+    TUint aServiceId )
+    { 
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowInvalidUsernamePasswordNoteL - IN" );
+
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
+        
+    // Show info note about invalid username password
+    HBufC* textForNote = StringLoader::LoadLC( 
+        R_QTN_VOIP_WRONG_SIP_AUTH_NOTE_TEXT );
+    CAknInformationNote* note = 
+        new( ELeave ) CAknInformationNote( ETrue );
+    note->SetTimeout(CAknNoteDialog::ELongTimeout);
+    note->ExecuteLD( *textForNote );   
+    CleanupStack::PopAndDestroy( textForNote );
+        
+    iResultParams.iDialogMode = 
+        MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed;
+    iResultParams.iServiceId = aServiceId;
+    iMessage.WriteL( iReplySlot, 
+                     TPckgBuf<TCCHUiNotifierParams>( iResultParams ) );
+    CompleteMessage(KErrNone);                              
+
+    CCHUIDEBUG( 
+        "CCCHUiNotifierImpl::ShowInvalidUsernamePasswordNoteL - OUT" );
+    } 
+
+// ---------------------------------------------------------------------------
+// Shows confirmation note to change connection.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::ShowConfirmChangeConnectionL( 
+    TInt aReplySlot, 
+    const RMessagePtr2& aMessage,
+    TUint aServiceId,
+    TInt aIapId )
+    { 
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowConfirmChangeConnectionL - IN" ); 
+    
+    CCHUIDEBUG2( 
+        "ShowConfirmChangeConnectionL - aServiceId: %d", aServiceId );
+    CCHUIDEBUG2( 
+        "ShowConfirmChangeConnectionL - aIapId: %d", aIapId );
+
+    iMessage = aMessage;
+    iReplySlot = aReplySlot;
+        
+    // Show confirmation note to change connection
+    RBuf iapName;
+    CleanupClosePushL( iapName );
+        
+    CurrentConnectionNameL( 
+        aServiceId, 
+        aIapId,
+        iapName );
+    
+    HBufC* textForQuery = NULL;
+    CAknQueryDialog* query = 
+               new( ELeave ) CAknQueryDialog( CAknQueryDialog::ENoTone );
+    
+    CleanupStack::PushL( query );
+    
+    TBool askToRemoveOldConnection( EFalse );
+     
+    // Check if current connection is used by any other service
+    if ( aIapId && !ConnectionUsedByOthersL( aServiceId, aIapId ) )
+        {
+        // connection not used by others -> ask to remove old connection
+        askToRemoveOldConnection = ETrue;
+        }
+    
+    if ( askToRemoveOldConnection )
+        {
+        CCHUIDEBUG( 
+            "ShowConfirmChangeConnectionL - ask to remove connection" );
+        
+        query->PrepareLC( 
+            R_CCHUINOTIF_REMOVE_AND_CHANGE_CONNECTION_CONFIRMATION_QUERY );
+        
+        textForQuery = StringLoader::LoadLC( 
+            R_QTN_SERVTAB_AP_VOIP_NOT_SUPPORTED_RECONNECT_QUERY_TEXT, 
+            iapName );
+        }
+    else
+        {
+        CCHUIDEBUG( 
+            "ShowConfirmChangeConnectionL - ask to change connection" );
+        
+        query->PrepareLC( R_CCHUINOTIF_CHANGE_CONNECTION_CONFIRMATION_QUERY );
+        
+        textForQuery = StringLoader::LoadLC( 
+            R_QTN_SERVTAB_AP_VOIP_NOT_SUPPORTED_QUERY_TEXT, iapName );  
+        }
+    
+    CCHUIDEBUG( "ShowConfirmChangeConnectionL - set prompt" );
+    
+    query->SetPromptL( *textForQuery );    
+    CleanupStack::PopAndDestroy( textForQuery );
+    CleanupStack::Pop( query );
+       
+    // Block application key while showing query
+    (void) ((CAknNotifierAppServerAppUi*)
+        iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); 
+    iAppKeyBlocked = ETrue;
+    
+    // Run query
+    if( query->RunLD() )
+        {
+        iResultParams.iDialogMode = 
+            MCchUiObserver::ECchUiDialogTypeConfirmChangeConnection;
+        iResultParams.iServiceId = aServiceId;
+       
+        if ( askToRemoveOldConnection )
+            {
+            CCHUIDEBUG( 
+                "ShowConfirmChangeConnectionL - set remove old connection");
+            
+            iResultParams.iRemoveOldConnection = ETrue;
+            iResultParams.iCurrentConnectionIapId = aIapId;
+            }     
+        else
+            {
+            iResultParams.iRemoveOldConnection = EFalse;
+            }
+            
+        iMessage.WriteL( iReplySlot, 
+                         TPckgBuf<TCCHUiNotifierParams>( iResultParams ) );
+        
+        CCHUIDEBUG( "ShowConfirmChangeConnectionL - complete message" ); 
+        
+        CompleteMessage( KErrNone );                  
+        }
+    else
+        {
+        CCHUIDEBUG( "ShowConfirmChangeConnectionL - canceled" );
+        
+        CompleteMessage( KErrCancel );
+        }
+    
+    // Remove application key blocking
+    (void) ((CAknNotifierAppServerAppUi*)
+        iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse);    
+    iAppKeyBlocked = EFalse;
+    
+    CleanupStack::PopAndDestroy( &iapName );
+    
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ShowConfirmChangeConnectionL - OUT" );
+    } 
+
+// ---------------------------------------------------------------------------
+// Shows gprs iap selection.
+// ---------------------------------------------------------------------------
+//
+TInt CCCHUiNotifierImpl::ShowGprsSelectionL( TUint aServiceId )
+	{ 
+	CCHUIDEBUG( "CCCHUiNotifierImpl::ShowGprsSelectionL - IN" );	
+	
+	TInt error = KErrNone;
+    RArray<TUint32> iapIds;
+    CleanupClosePushL( iapIds );
+
+    CDesCArray* arrayforDialog = new (ELeave) CDesCArrayFlat( 3 );
+    CleanupStack::PushL( arrayforDialog );            
+    CCHUIDEBUG( "ShowGprsSelectionL - form content" );	
+
+    TInt result = KErrNotFound;
+    HBufC* string = StringLoader::LoadLC( 
+        R_QTN_CCHUINOTIF_SELECT_GPRS_ACCESS_POINT_HEADING );
+
+    CAknListQueryDialog* dialog = new (ELeave) CAknListQueryDialog( &result );
+    dialog->PrepareLC( R_CCHUINOTIF_SELECT_GPRS_DIALOG );
+
+    CCHUIDEBUG( "ShowGprsSelectionL - form heading" );	
+	dialog->QueryHeading()->SetTextL( *string );
+	    
+    CCHUIDEBUG( "ShowGprsSelectionL - set item array" );	
+    
+    TUint sourceSnap = KErrNone;
+    // Fill array here
+    sourceSnap = InternetGprsApsMissingFromServiceSnapL(
+        *arrayforDialog, iapIds );
+    
+    CCHUIDEBUG( "ShowGprsSelectionL - set item array" );	
+    dialog->SetItemTextArray( arrayforDialog );
+    dialog->SetOwnershipType( ELbmDoesNotOwnItemArray );
+      
+    // Block application key while showing query
+    (void) ((CAknNotifierAppServerAppUi*)
+        iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); 
+    iAppKeyBlocked = ETrue;
+    
+    CCHUIDEBUG( "ShowGprsSelectionL - run dialog" );
+    
+    dialog->RunLD();
+
+    // write result, result now holds the item number
+    if ( KErrNotFound != result )
+        {
+        iResultParams.iServiceId = aServiceId;
+        iResultParams.iGprsSourceSnap = sourceSnap;
+        iResultParams.iGprsIapId = iapIds[ result ];
+        }
+    else
+        {
+        error = KErrCancel;
+        }
+    
+    // Remove application key blocking
+    (void) ((CAknNotifierAppServerAppUi*)
+        iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse);    
+    iAppKeyBlocked = EFalse;
+
+    CleanupStack::PopAndDestroy( string );
+    CleanupStack::PopAndDestroy( arrayforDialog );     
+    CleanupStack::PopAndDestroy( &iapIds );
+
+    CCHUIDEBUG2( "CCCHUiNotifierImpl::ShowGprsSelectionL -return %d", error );
+    return error;
+	}   	
+
+// ---------------------------------------------------------------------------
+// Returns handle to branding handler.
+// ---------------------------------------------------------------------------
+//
+CCchUiPluginBrandingHandler& CCCHUiNotifierImpl::BrandingHandlerL()
+    {
+    if ( !iBrandingHandler )
+        {
+        iBrandingHandler = 
+            CCchUiPluginBrandingHandler::NewL( *iSettings );    
+        }
+    return *iBrandingHandler;
+    }
+
+// ---------------------------------------------------------------------------
+// Fills list items and commands for no connections available dialog
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::FillNoConnectionsAvailableListboxL( 
+	CDesCArray& aListItems, 
+	RArray<TCchUiOperationCommand>& aCommandArray,
+	TUint aServiceId )
+	{
+	CCHUIDEBUG( 
+	    "CCCHUiNotifierImpl::FillNoConnectionsAvailableListboxL - IN" );	
+	
+	HBufC* connectWhenAv = StringLoader::LoadLC( 
+        R_QTN_CCHUINOTIF_CONNECT_WHEN_AV_TEXT );
+	HBufC* searchWlan = StringLoader::LoadLC( 
+		R_QTN_CCHUINOTIF_SEARCH_WLAN_NO_COVERAGE_TEXT );	
+	HBufC* useGprs = StringLoader::LoadLC( 
+		R_QTN_CCHUINOTIF_USE_GPRS_NO_COVERAGE_TEXT );	
+	    
+	// Item is available only for SIP protocol services.
+	// Check if service supports SIP/VoIP.
+	TBool sipVoip( EFalse );
+	TRAPD( err, sipVoip = IsSIPVoIPL( aServiceId ) );
+	
+	if ( !err && sipVoip && IsVoIPOverWCDMAAllowedL() )
+	    {
+	    aListItems.AppendL( *connectWhenAv );
+	    aCommandArray.AppendL( ECchUiCommandConnectWhenAvailable );
+	    }
+    
+    aListItems.AppendL( *searchWlan );
+    aCommandArray.AppendL( ECchUiCommandSearchWlan );
+    
+    if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() 
+            && IsVoIPOverWCDMAAllowedL() )
+        {
+        aListItems.AppendL( *useGprs );	
+        aCommandArray.AppendL( ECchUiCommandCopyGprs );    
+        }
+
+    CleanupStack::PopAndDestroy( useGprs );	
+    CleanupStack::PopAndDestroy( searchWlan );	
+    CleanupStack::PopAndDestroy( connectWhenAv );
+    
+    CCHUIDEBUG( 
+        "CCCHUiNotifierImpl::FillNoConnectionsAvailableListboxL - OUT" ); 
+	}
+
+// ---------------------------------------------------------------------------
+// Fills list items and commands for no connections defined dialog.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::FillNoConnectionsDefinedListboxL( 
+	CDesCArray& aListItems, RArray<TCchUiOperationCommand>& aCommandArray )
+	{
+	CCHUIDEBUG( 
+	    "CCCHUiNotifierImpl::FillNoConnectionsDefinedListboxL - IN" );	
+
+    CleanupClosePushL( aCommandArray );
+	
+	HBufC* searchWlan = StringLoader::LoadLC( 
+		R_QTN_CCHUINOTIF_SEARCH_WLAN_NOT_DEF_TEXT );
+	
+	HBufC* useGprs = StringLoader::LoadLC( 
+		R_QTN_CCHUINOTIF_USE_GPRS_NOT_DEF_TEXT );	
+	
+    aListItems.AppendL( *searchWlan );
+    aCommandArray.AppendL( ECchUiCommandSearchWlan );
+
+    if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() 
+            && IsVoIPOverWCDMAAllowedL() )
+        {
+        aListItems.AppendL( *useGprs );	
+        aCommandArray.AppendL( ECchUiCommandCopyGprs );    
+        }
+
+    CleanupStack::PopAndDestroy( useGprs );	
+    CleanupStack::PopAndDestroy( searchWlan );	
+    CleanupStack::Pop( &aCommandArray );
+    
+    CCHUIDEBUG( 
+        "CCCHUiNotifierImpl::FillNoConnectionsDefinedListboxL - OUT" );  	    
+	}
+	
+// ---------------------------------------------------------------------------
+// Fills list items and commands for no connections defined dialog
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::FillNoConnectionsFoundListboxL( 
+	CDesCArray& aListItems, RArray<TCchUiOperationCommand>& aCommandArray )
+	{
+	CCHUIDEBUG( "CCCHUiNotifierImpl::FillNoConnectionsFoundListboxL - IN" );	
+	
+	CleanupClosePushL( aCommandArray );
+
+	HBufC* searchWlan = StringLoader::LoadLC( 
+		R_QTN_CCHUINOTIF_SEARCH_WLAN_NOT_FOUND_TEXT );	
+	
+	HBufC* useGprs = StringLoader::LoadLC( 
+		R_QTN_CCHUINOTIF_USE_GPRS_NOT_FOUND_TEXT );	
+	
+    aListItems.AppendL( *searchWlan );
+    aCommandArray.AppendL( ECchUiCommandSearchWlan );
+
+    if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() 
+            && IsVoIPOverWCDMAAllowedL() )
+        {
+        aListItems.AppendL( *useGprs );	
+        aCommandArray.AppendL( ECchUiCommandCopyGprs );    
+        }
+
+    CleanupStack::PopAndDestroy( useGprs );	
+    CleanupStack::PopAndDestroy( searchWlan );	
+    CleanupStack::Pop( &aCommandArray );
+    
+    CCHUIDEBUG( "CCCHUiNotifierImpl::FillNoConnectionsFoundListboxL - OUT" );  
+	}	
+
+// ---------------------------------------------------------------------------
+// Fills list items and commands for change current connection dialog
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::FillChangeCurrentConnectionListboxL( 
+    CDesCArray& aListItems, RArray<TCchUiOperationCommand>& aCommandArray )
+    {
+    CCHUIDEBUG( 
+        "CCCHUiNotifierImpl::FillChangeCurrentConnectionListboxL - IN" ); 
+    
+    HBufC* searchWlan = StringLoader::LoadLC( 
+        R_QTN_CCHUINOTIF_SEARCH_WLAN_CHANGE_CURRENT_CONNECTION_TEXT );  
+        
+    HBufC* useGprs = StringLoader::LoadLC( 
+        R_QTN_CCHUINOTIF_USE_GPRS_CHANGE_CURRENT_CONNECTION_TEXT ); 
+        
+    aListItems.AppendL( *searchWlan );
+    aCommandArray.AppendL( ECchUiCommandSearchWlan );
+    
+    if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() &&
+        IsVoIPOverWCDMAAllowedL() &&
+        IsServiceSnapMissingInternetGprsApsL() )
+        {
+        aListItems.AppendL( *useGprs ); 
+        aCommandArray.AppendL( ECchUiCommandCopyGprs ); 
+        }
+
+    CleanupStack::PopAndDestroy( useGprs ); 
+    CleanupStack::PopAndDestroy( searchWlan );
+    
+    CCHUIDEBUG( 
+            "CCCHUiNotifierImpl::FillChangeCurrentConnectionListboxL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL
+// ---------------------------------------------------------------------------
+//
+TBool CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL() const
+    {
+    CCHUIDEBUG( 
+        "CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL - IN" );
+    
+    TBool isMissingGPRSIap = EFalse;
+    
+    RArray<TUint32> iapIds;
+    CleanupClosePushL( iapIds );
+    
+    CDesCArray* iaps = new (ELeave) CDesCArrayFlat( 1 );
+    CleanupStack::PushL( iaps );
+    
+    InternetGprsApsMissingFromServiceSnapL( *iaps, iapIds );
+    
+    if ( iapIds.Count() )
+        {
+        isMissingGPRSIap = ETrue;
+        }
+    CleanupStack::PopAndDestroy( iaps );
+    CleanupStack::PopAndDestroy( &iapIds );
+    
+    CCHUIDEBUG2( 
+        "CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL - return: %d", isMissingGPRSIap );
+    
+    return isMissingGPRSIap;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL
+// ---------------------------------------------------------------------------
+//
+TUint32 CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL(
+    CDesCArray& aIaps, RArray<TUint32>& aIapIds ) const
+    {
+    CCHUIDEBUG( 
+        "CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL - IN" );
+    
+    TUint32 internetSnapId = KErrNone;
+    
+    CCchUiNotifConnectionHandler* connHandler = 
+        CCchUiNotifConnectionHandler::NewLC();
+    
+    CDesCArray* voipGprsIaps = new (ELeave) CDesCArrayFlat( 1 );
+    CleanupStack::PushL( voipGprsIaps );
+    
+    RArray<TUint32> voipGprsIapIds;
+    CleanupClosePushL( voipGprsIapIds );
+
+    connHandler->GetGprsAccessPointsSetToServiceSnapL(
+        *voipGprsIaps, voipGprsIapIds, iCurrentConnectionIapId );
+
+    CDesCArray* internetGprsIapNames = new (ELeave) CDesCArrayFlat( 2 );
+    CleanupStack::PushL( internetGprsIapNames );
+    
+    RArray<TUint32> internetGprsIapIds;
+    CleanupClosePushL( internetGprsIapIds );
+    
+    TRAPD( err, internetSnapId = connHandler->GetGprsAccessPointsL(
+        *internetGprsIapNames, internetGprsIapIds ) );
+    CCHUIDEBUG2( "-GetGprsAccessPointsL -Trap err = %d", err );
+    
+    if ( !KErrNone == err && !KErrNotFound == err )
+        {
+        User::Leave( err );
+        }
+    
+    for ( TInt i( 0 ); i < internetGprsIapIds.Count(); i++ )
+        {
+        TBool found = EFalse;
+        for ( TInt j( 0 ); j < voipGprsIapIds.Count() && !found; j++ )
+            {
+            found = connHandler->IsConnectionMethodSimilarL(
+                internetGprsIapIds[ i ], voipGprsIapIds[ j ] ); 
+            }
+        if ( !found )
+            {
+            CCHUIDEBUG2(
+                "IsVoIPSNAPMissingInternetGPRSAp -missing GPRS AP id: %d", internetGprsIapIds[ i ] );
+            aIapIds.AppendL( internetGprsIapIds[ i ] );
+            aIaps.AppendL( internetGprsIapNames->MdcaPoint( i ) );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &internetGprsIapIds );
+    CleanupStack::PopAndDestroy( internetGprsIapNames );
+    CleanupStack::PopAndDestroy( &voipGprsIapIds );
+    CleanupStack::PopAndDestroy( voipGprsIaps );
+    CleanupStack::PopAndDestroy( connHandler );
+    
+    CCHUIDEBUG( "CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL - OUT" );
+    
+    return internetSnapId;
+    }
+
+// ---------------------------------------------------------------------------
+// Fills list items and commands for change connection dialog.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::FillChangeConnectionListboxL( 
+    CDesCArray& aListItems, RArray<TCchUiOperationCommand>& aCommandArray )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierImpl::FillChangeConnectionListboxL - IN" ); 
+    
+    HBufC* searchWlan = StringLoader::LoadLC( 
+        R_QTN_CCHUINOTIF_SEARCH_WLAN_CHANGE_CONNECTION_TEXT );  
+           
+    HBufC* useGprs = StringLoader::LoadLC( 
+        R_QTN_CCHUINOTIF_USE_GPRS_CHANGE_CONNECTION_TEXT ); 
+           
+    aListItems.AppendL( *searchWlan );
+    aCommandArray.AppendL( ECchUiCommandSearchWlan );
+
+    if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() 
+            && IsVoIPOverWCDMAAllowedL() )
+        {
+        aListItems.AppendL( *useGprs ); 
+        aCommandArray.AppendL( ECchUiCommandCopyGprs ); 
+        }
+
+    CleanupStack::PopAndDestroy( useGprs ); 
+    CleanupStack::PopAndDestroy( searchWlan );
+       
+    CCHUIDEBUG( "CCCHUiNotifierImpl::FillChangeConnectionListboxL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Check if VoIP over WCDMA is allowed
+// ---------------------------------------------------------------------------
+//
+TBool CCCHUiNotifierImpl::IsVoIPOverWCDMAAllowedL()
+    {
+    CCHUIDEBUG( "CCCHUiNotifierImpl::IsVoIPOverWCDMAAllowed - IN" );
+    
+    TBool allowed( EFalse );
+    CRCSEProfileRegistry* cRCSEProfileRegistry;
+    cRCSEProfileRegistry = CRCSEProfileRegistry::NewLC();
+    
+    RPointerArray<CRCSEProfileEntry> entries;
+   
+    CleanupStack::PushL( TCleanupItem ( ResetAndDestroy, &entries ) );  //CS
+ 
+    cRCSEProfileRegistry->FindByServiceIdL( iServiceId, entries );
+    if( entries.Count() )
+        {
+        RArray<TSettingIds> settingIdArray;
+        CleanupClosePushL( settingIdArray );    // CS 3
+        settingIdArray = entries[ 0 ]->iIds;
+        TInt sipProfileId( KErrNotFound );
+        for ( TUint i( 0 ) ; i < settingIdArray.Count() ; i++ )
+            {
+            if ( settingIdArray[ i ].iProfileType == 
+                CRCSEProfileEntry::EProtocolSIP )
+                {
+                sipProfileId = settingIdArray[ i ].iProfileId;
+                }
+            }
+        TUint32 bearerSetting( KErrNone );
+        if ( KErrNotFound != sipProfileId )
+            {
+            CSIPProfile* profile = 
+                iSipProfileRegistry->ProfileL( sipProfileId );
+            CleanupStack::PushL( profile ); // CS 4
+            User::LeaveIfError( 
+                profile->GetParameter( KBearerType, bearerSetting ) );
+            if ( KBearerSettingWlanOnly != bearerSetting )
+                {
+                allowed = ETrue;
+                }
+            CleanupStack::PopAndDestroy( profile ); // CS 3
+            }
+        CleanupStack::Pop( &settingIdArray ); // CS 2
+        }
+    
+    CleanupStack::PopAndDestroy( &entries ); // clItem    CS 1
+    
+    CleanupStack::PopAndDestroy(); //cRCSEProfileRegistry   CS 0
+    
+    return allowed;
+    }
+
+// ---------------------------------------------------------------------------
+// For deleting RPointerArray in case of leave
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::ResetAndDestroy( TAny* aPointerArray )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ResetAndDestroy - IN" );
+    if ( aPointerArray )
+        {
+        RPointerArray<CRCSEProfileEntry>* array =
+            reinterpret_cast<RPointerArray<CRCSEProfileEntry>*>( aPointerArray );
+        TInt i = array->Count();
+        array->ResetAndDestroy();
+        array->Close();
+        }
+    CCHUIDEBUG( "CCCHUiNotifierImpl::ResetAndDestroy - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// From class CCCHUiNotifierBase.
+// ---------------------------------------------------------------------------
+//
+CCCHUiNotifierImpl::TNotifierInfo CCCHUiNotifierImpl::RegisterL()
+    {
+    iInfo.iUid=KCchUiNotifierUid;
+    iInfo.iChannel=KCchUiNotifierChannel;
+    iInfo.iPriority=ENotifierPriorityVHigh;
+    return iInfo;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CCCHUiNotifierBase.
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CCCHUiNotifierImpl::UpdateL( const TDesC8& /*aBuffer*/ )
+    {
+    TPtrC8 ret( KNullDesC8 );
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CCCHUiNotifierBase.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::StartL(
+    const TDesC8& aBuffer, 
+    TInt aReplySlot, 
+    const RMessagePtr2& aMessage)
+    {
+    CCHUIDEBUG( "CCCHUiNotifierImpl::StartL - IN" );
+    
+    __ASSERT_DEBUG( iMessage.IsNull(), User::Leave( KErrAlreadyExists ) );
+    
+    // Read aBuffer for control information
+    TCCHUiNotifierParams param;
+    TPckgC<TCCHUiNotifierParams> pckg(param);
+    pckg.Set( aBuffer );
+
+    CCCHUiNotifierBase::StartL( aBuffer, aReplySlot, aMessage );    
+    iDialogMode = pckg().iDialogMode;
+    iServiceId = pckg().iServiceId;
+    iCurrentConnectionIapId = pckg().iCurrentConnectionIapId;
+    
+    switch( pckg().iDialogMode )
+        {
+        case MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed:
+            {
+            CCHUIDEBUG( "StartL - wrong username/password" ); 
+            ShowInvalidUsernamePasswordNoteL( 
+                aReplySlot, aMessage, pckg().iServiceId );
+            }
+            break;
+        case MCchUiObserver::ECchUiDialogTypeAuthenticationFailed:
+            {
+            CCHUIDEBUG( "StartL - auth failed" );	
+            ShowUsernamePasswordQueryL( 
+                aReplySlot, aMessage, pckg().iServiceId, pckg().iUsername );
+            }
+            break;
+
+        case MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable:
+            {
+            CCHUIDEBUG( "StartL - no connections" );	            
+            // Do nothing here. Uses RunL to show notifier instead. 
+            // Needed for cancel functionality.
+            }
+            break;    
+        case MCchUiObserver::ECchUiDialogTypeNoConnectionDefined:
+            {
+            CCHUIDEBUG( "StartL - no conn defined" );	                        
+            ShowNoConnectionsQueryL( 
+                aReplySlot, aMessage, pckg().iServiceId, ETrue );
+            }
+            break;
+        case MCchUiObserver::ECchUiDialogTypeDefectiveSettings:
+            {
+            CCHUIDEBUG( "StartL - defective settings" );	                        
+            ShowDefectiveSettingsL( 
+                aReplySlot, aMessage, pckg().iServiceId );
+            }
+            break;          
+        case MCchUiObserver::ECchUiDialogTypeErrorInConnection:
+            {
+            CCHUIDEBUG( "StartL - error in connection" );                            
+            ShowErrorInConnectionNoteL( 
+                aReplySlot, aMessage, pckg().iServiceId );
+            }
+            break;
+        case MCchUiObserver::ECchUiDialogTypeConfirmChangeConnection:
+            {
+            CCHUIDEBUG( "StartL - confirm change connection" );                            
+            ShowConfirmChangeConnectionL( 
+                aReplySlot,
+                aMessage,
+                pckg().iServiceId, 
+                pckg().iCurrentConnectionIapId );
+            }
+            break;
+        case MCchUiObserver::ECchUiDialogTypeChangeConnection:
+            {
+            CCHUIDEBUG( "StartL - change connection" );                        
+            ShowChangeConnectionQueryL( 
+                aReplySlot,
+                aMessage,
+                pckg().iServiceId,
+                pckg().iCurrentConnectionIapId );
+            }
+            break;     
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+            break;    
+        }
+    
+    CCHUIDEBUG( "CCCHUiNotifierImpl::StartL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MCchUiCallStateObserver.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::CallStateChanged( TInt aCallState )
+    {
+    CCHUIDEBUG( "CCCHUiNotifierImpl::CallStateChangedL - Start" );
+    
+    switch( aCallState )
+        {
+        case EPSCTsyCallStateRinging:
+            {
+            if ( iListQueryDialog )
+                {
+                delete iListQueryDialog;
+                iListQueryDialog = NULL;
+                
+                CompleteMessage( KErrCancel );
+                CCCHUiNotifierBase::Cancel();
+                }
+            }
+            break;
+        default:
+            {
+            // Nothing to do.
+            }
+            break;
+        }
+    
+    CCHUIDEBUG( "CCCHUiNotifierImpl::CallStateChangedL - End" );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::ProfileRegistryEventOccurred( 
+    TUint32 /*aSIPProfileId*/, 
+    TEvent /*aEvent*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNotifierImpl::ProfileRegistryErrorOccurred(
+    TUint32 /*aSIPProfileId*/,
+    TInt /*aError*/ )
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuinotifiermain.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* 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:  Implements notifier creation, required for notifier fw.
+*
+*/
+
+
+#include <eikenv.h>
+#include <cenrepnotifyhandler.h>
+
+#include "cchuinotifierimpl.h"
+
+const TInt KCchUiNotifierArrayIncrement = 10;
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Instantiate notifiers.
+// ---------------------------------------------------------------------------
+//
+LOCAL_C void CreateCchUiNotifiersL( 
+    CArrayPtrFlat<MEikSrvNotifierBase2>* aNotifiers )
+    {
+    __ASSERT_ALWAYS( aNotifiers, User::Leave( KErrArgument ) );
+    CCCHUiNotifierImpl* notifierImpl = 
+        CCCHUiNotifierImpl::NewL();
+    CleanupStack::PushL( notifierImpl );
+    aNotifiers->AppendL( notifierImpl );
+    CleanupStack::Pop( notifierImpl );
+    }
+
+// ---------------------------------------------------------------------------
+// Creates a notifiers array.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CArrayPtr<MEikSrvNotifierBase2>* NotifierArray()
+    {    
+    CArrayPtrFlat<MEikSrvNotifierBase2>* notifiers = NULL;
+
+    TRAPD(err, notifiers = 
+               new (ELeave)CArrayPtrFlat<MEikSrvNotifierBase2>( 
+                       KCchUiNotifierArrayIncrement ));
+               
+    if ( err == KErrNone )
+        {
+        if( notifiers )
+            {
+            TRAPD( err2, CreateCchUiNotifiersL( notifiers ));
+            if( err2 )
+                {
+                TInt count = notifiers->Count();
+                while(count--)
+                    (*notifiers)[count]->Release();
+                delete notifiers;
+                notifiers = NULL;
+                }
+            }
+        }
+    else
+        {   
+        }
+        
+    return notifiers;
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuipluginbrandinghandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,229 @@
+/*
+* 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:  Implements access to branding server
+*
+*/
+
+
+#include <coemain.h>
+#include <spentry.h>
+#include <mbsaccess.h>
+#include <AknsUtils.h>
+#include <cbsbitmap.h>
+#include <cbsfactory.h>
+#include <mbselement.h>
+#include <spsettings.h>
+#include <spproperty.h>
+#include <spdefinitions.h>
+
+#include "cchuipluginbrandinghandler.h"
+#include "cchuipluginiconfileprovider.h"
+
+_LIT8( KDefaultAppId, "xsp" );
+_LIT8( KBrandedBitmapItemId, "service_passive_image_small" );
+
+const TUint KIconWidth( 20 );
+const TUint KIconHeight( 20 );
+const TUint KBrandStringMaxLength( 255 );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+CCchUiPluginBrandingHandler::CCchUiPluginBrandingHandler( 
+    CSPSettings& aSpSettings ):
+    iSpSettings( aSpSettings )
+    {
+    }
+
+void CCchUiPluginBrandingHandler::ConstructL()
+    {
+    }
+
+CCchUiPluginBrandingHandler* CCchUiPluginBrandingHandler::NewL(
+    CSPSettings& aSpSettings )
+    {
+    CCchUiPluginBrandingHandler* self = NewLC( aSpSettings );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CCchUiPluginBrandingHandler* CCchUiPluginBrandingHandler::NewLC(
+    CSPSettings& aSpSettings )
+    {
+    CCchUiPluginBrandingHandler* self = 
+        new (ELeave) CCchUiPluginBrandingHandler( aSpSettings );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+CCchUiPluginBrandingHandler::~CCchUiPluginBrandingHandler()
+    {
+    delete iFactory;
+    iFactory = NULL;
+    if ( iAccess )
+        {
+        iAccess->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Retrieves service icon.
+// ---------------------------------------------------------------------------
+//
+void CCchUiPluginBrandingHandler::RetrieveServiceIconL( 
+    TUint32 aServiceId, CFbsBitmap*& aBitmap, CFbsBitmap*& aMask )
+    {
+    // start fetching of branding image     
+    // get structure containing the info needed to load brand image
+    MBSElement* bitmapItem = NULL;
+    
+    // Access must be created and destroyed for each call since this is
+    // common implementation for all services, otherwise brand data
+    // fetching might fail or return data from another service.
+    PrepareBrandingAccessL( aServiceId );
+    
+    bitmapItem = iAccess->GetStructureL( KBrandedBitmapItemId() );
+    CleanupClosePushL( *bitmapItem );
+
+    // get info from the bitmap element
+    const CBSBitmap& bsBitmap = bitmapItem->BitmapDataL();
+    
+    RFile bitmapFile;
+    CleanupClosePushL( bitmapFile ); 
+    
+    // get the bitmap file from where we can load the bitmap
+    iAccess->GetFileL( bsBitmap.BitmapFileId(), bitmapFile );    
+    
+    TInt err = KErrNotFound;
+    CFbsBitmap* skinBitmap = NULL;
+    
+    // Try getting skinned images first
+    if ( CCoeEnv::Static() )
+        {
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();    
+
+        TAknsItemID itemId;
+        itemId.Set( bsBitmap.SkinIdMajor(), bsBitmap.SkinIdMinor() );
+        
+        TRAP( err, skinBitmap = AknsUtils::CreateBitmapL( skin, itemId ) );
+        }
+    
+    if ( err == KErrNotFound )
+        {
+        // no skin bitmap found
+        
+        // icon server take ownership of icon file provider
+        // File provider duplicates the file handle, close the original
+        // Duplication needed because lifetime of image is different than
+        // this file handle's.        
+        CCchUiPluginIconFileProvider* ifp = 
+            CCchUiPluginIconFileProvider::NewL( bitmapFile );
+        CleanupStack::PushL( ifp );
+        
+        AknIconUtils::CreateIconLC( aBitmap, aMask,
+                                    *ifp,
+                                    bsBitmap.BitmapId(), 
+                                    bsBitmap.BitmapMaskId() );   
+        CleanupStack::Pop( aMask );
+        CleanupStack::Pop( aBitmap );
+        CleanupStack::Pop( ifp );
+        }
+    else if ( err )
+        {
+        User::Leave( err );
+        }
+    else
+        {
+        aBitmap = skinBitmap;
+        aMask = NULL;
+        }
+    // Icons must be initialized with setsize in order to use them
+    TSize size( KIconWidth, KIconHeight );
+    if ( aBitmap )
+        {
+        AknIconUtils::SetSize( aBitmap, size );
+        }
+    
+    if ( aMask )
+        {
+        AknIconUtils::SetSize( aMask, size );
+        }
+        
+    CleanupStack::PopAndDestroy( &bitmapFile );
+    CleanupStack::PopAndDestroy( bitmapItem );
+    ReleaseBrandingAccess();
+    }
+
+// ---------------------------------------------------------------------------
+// Prepares branding access.
+// ---------------------------------------------------------------------------
+//
+void CCchUiPluginBrandingHandler::PrepareBrandingAccessL( TUint32 aServiceId )
+    {
+    ReleaseBrandingAccess();
+    
+    HBufC8* brandiId8 = HBufC8::NewLC( KBrandStringMaxLength );
+    TPtr8 brandiId8Ptr( brandiId8->Des() );
+    
+    HBufC* brandId = HBufC::NewLC( KBrandStringMaxLength );
+    TPtr brandiIdPtr( brandId->Des() );
+    
+    CSPProperty* idProperty = CSPProperty::NewLC();
+    iSpSettings.FindPropertyL( aServiceId,
+                                EPropertyBrandId,
+                                *idProperty );    
+    if ( idProperty )
+        {
+        idProperty->GetValue( brandiIdPtr );
+        brandiId8Ptr.Copy( brandiIdPtr );
+        }
+    CleanupStack::PopAndDestroy( idProperty );        
+    CleanupStack::PopAndDestroy( brandId );        
+
+    // default to english
+    TInt brandLanguage = ELangInternationalEnglish; 
+    CSPProperty* lanProperty = CSPProperty::NewLC();
+    iSpSettings.FindPropertyL( aServiceId,
+                                EPropertyBrandLanguage,
+                                *lanProperty );    
+    if ( lanProperty )
+        {
+        lanProperty->GetValue( brandLanguage );
+        brandLanguage = ((TLanguage) (brandLanguage));
+        }
+    CleanupStack::PopAndDestroy( lanProperty );
+    
+    iFactory = CBSFactory::NewL( brandiId8Ptr, KDefaultAppId );
+    iAccess = iFactory->CreateAccessL( brandiId8Ptr, 
+            ((TLanguage) ( brandLanguage )) );
+    CleanupStack::PopAndDestroy( brandiId8 );
+    }
+
+// ---------------------------------------------------------------------------
+// Releases branding access.
+// ---------------------------------------------------------------------------
+//
+void CCchUiPluginBrandingHandler::ReleaseBrandingAccess()
+    {
+    if ( iAccess )
+        {
+        iAccess->Close();
+        iAccess = NULL;
+        }
+    delete iFactory;    
+    iFactory = NULL;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/eabi/cchu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,30 @@
+EXPORTS
+	_ZN17TCchServiceStatus8SetErrorEi @ 1 NONAME
+	_ZN17TCchServiceStatus8SetStateE19TCCHSubserviceState @ 2 NONAME
+	_ZN17TCchServiceStatusC1Ev @ 3 NONAME
+	_ZN17TCchServiceStatusC2Ev @ 4 NONAME
+	_ZN4CCch10ConstructLEv @ 5 NONAME
+	_ZN4CCch10GetServiceEi @ 6 NONAME
+	_ZN4CCch11GetServicesE18TCCHSubserviceTypeR13RPointerArrayI11CCchServiceE @ 7 NONAME
+	_ZN4CCch29SetConnectivityDialogsAllowedEi @ 8 NONAME
+	_ZN4CCch4NewLEv @ 9 NONAME
+	_ZN4CCch5NewLCEv @ 10 NONAME
+	_ZN4CCchC1Ev @ 11 NONAME
+	_ZN4CCchC2Ev @ 12 NONAME
+	_ZN4CCchD0Ev @ 13 NONAME
+	_ZN4CCchD1Ev @ 14 NONAME
+	_ZN4CCchD2Ev @ 15 NONAME
+	_ZNK17TCchServiceStatus5ErrorEv @ 16 NONAME
+	_ZNK17TCchServiceStatus5StateEv @ 17 NONAME
+	_ZNK4CCch13GetServiceIdsER6RArrayIiE @ 18 NONAME
+	_ZNK4CCch26ConnectivityDialogsAllowedEv @ 19 NONAME
+	_ZNK4CCch8CchUiApiEv @ 20 NONAME
+	_ZTI15CCchServiceImpl @ 21 NONAME ; #<TI>#
+	_ZTI18CCchClientObserver @ 22 NONAME ; #<TI>#
+	_ZTI4CCch @ 23 NONAME ; #<TI>#
+	_ZTI8CCchImpl @ 24 NONAME ; #<TI>#
+	_ZTV15CCchServiceImpl @ 25 NONAME ; #<VT>#
+	_ZTV18CCchClientObserver @ 26 NONAME ; #<VT>#
+	_ZTV4CCch @ 27 NONAME ; #<VT>#
+	_ZTV8CCchImpl @ 28 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -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 Converged Connection
+                 Handler Client 
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+cch.mmp
+
+PRJ_TESTMMPFILES
+//../../internal/tsrc/EUnit_CchAPI/group/UT_CchAPI.mmp
+
+#include "../cchuinotif/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/group/cch.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* 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 Converged Connection
+*                Client API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET                  cch.dll
+TARGETTYPE              dll
+UID                     0x1000008d 0x20011117 
+
+CAPABILITY              CAP_CLIENT_DLL
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  cch.cpp
+SOURCE                  cchimpl.cpp
+SOURCE                  cchserviceimpl.cpp 
+SOURCE                  cchtypes.cpp
+SOURCE                  cchclientobserver.cpp
+SOURCE                  cchuiprivateapi.cpp
+SOURCE                  cchuiapiimpl.cpp
+SOURCE                  cchuispshandler.cpp
+SOURCE                  cchuicchhandler.cpp
+SOURCE                  cchuinotehandler.cpp
+SOURCE                  cchuiconnectionhandler.cpp
+SOURCE                  cchuiglobalqueryhandler.cpp
+SOURCE                  cchuiclientobserver.cpp
+SOURCE                  cchuitimer.cpp
+SOURCE			cchserviceimplasynchroniser.cpp
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../inc           // CCH's internal headers
+
+APP_LAYER_SYSTEMINCLUDE 
+
+LIBRARY                 euser.lib
+LIBRARY                 flogger.lib          // for logging purposes
+LIBRARY                 cchclient.lib
+LIBRARY                 ecom.lib
+LIBRARY                 cone.lib 
+LIBRARY                 bafl.lib
+LIBRARY                 efsrv.lib
+LIBRARY                 estor.lib
+LIBRARY                 connmon.lib
+LIBRARY                 featmgr.lib
+LIBRARY                 commsdat.lib
+LIBRARY                 aknnotify.lib
+LIBRARY                 cmmanager.lib
+LIBRARY                 platformenv.lib
+LIBRARY                 commonengine.lib
+LIBRARY                 wepsecuritysettingsui.lib
+LIBRARY                 wpasecuritysettingsui.lib
+LIBRARY                 connectionuiutilities.lib
+LIBRARY                 serviceprovidersettings.lib
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchclientobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  cch client api implementation class
+*
+*/
+
+
+
+#ifndef C_CCHCLIENTOBSERVER_H
+#define C_CCHCLIENTOBSERVER_H
+
+#include <e32base.h>
+#include <ccherror.h>
+#include <cchtypes.h>
+
+#include "cch.h"
+
+
+/**
+ *  Class for basic cch functionality, getting services
+ *
+ *  @code
+ *   ?good_class_usage_example(s)
+ *  @endcode
+ *
+ *  @lib cch
+ */
+class CCchClientObserver : public CActive
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * 
+     * @param aCchService Cch service factory
+     */
+    static CCchClientObserver* NewL( CCchServiceImpl& aCchService ) ;
+    
+    /**
+     * Two-phased constructor.
+     * 
+     * @param aCchService Cch service factory
+     */
+    static CCchClientObserver* NewLC( CCchServiceImpl& aCchService );
+    
+    /**
+     * Destructor.
+     */
+    ~CCchClientObserver();
+
+    /**
+     * @deprecated Do not use this anymore, change to AddObserver!
+     * 
+     * Adds observer for listening service events
+     *
+     * @param aObserver Event observing class
+     */
+    void SetObserver( MCchServiceStatusObserver& aObserver );
+    
+    /**
+     * @deprecated Do not use this anymore, change to 
+     * RemoveObserver method with paramater
+     * 
+     * Removes the observer of service events
+     */
+    void RemoveObserver( );
+
+    /**
+     * Adds observer for listening service events
+     *
+     * @param aObserver Event observing class
+     * @return KErrAlreadyExist Observer already added
+     *         KErrNone Observer was added
+     */
+    TInt AddObserver( MCchServiceStatusObserver& aObserver );
+    
+    /**
+     * Removes the observer of service events
+     *
+     * @param aObserver Event observing class
+     * @return KErrNotFound Observer was not found
+     *         KErrNone Observer was removed
+     */
+    TInt RemoveObserver( MCchServiceStatusObserver& aObserver );
+    
+private:
+    
+    /**
+     * The constructor
+     * 
+     * @param aCchService Cch service factory
+     */
+	CCchClientObserver( CCchServiceImpl& aCchService );
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private: //from CActive
+
+	/**
+	 * @see CActive.
+	 */
+	void RunL();
+	
+	/**
+	 * @see CActive.
+	 */
+	void DoCancel();
+	
+	/**
+	 * @see CActive.
+	 */
+	TInt RunError( TInt aError );
+	
+private: // data
+	
+	/**
+	 * cch service factory, not own
+	 */
+	CCchServiceImpl& iCchService;
+	
+	/**
+	 * Service observer, not own
+	 */
+	MCchServiceStatusObserver* iBackwardSupportObserver;
+	
+	/**
+	 * Stores service status information
+	 */
+    TPckgBuf<TServiceStatus> iServiceStatus;
+
+    // Observers
+    RPointerArray<MCchServiceStatusObserver> iObservers;
+    
+#ifdef CCHUNITTEST
+    friend class UT_CCchService;
+#endif
+    };
+
+#endif // C_CCHCLIENTOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchimpl.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  cch client api implementation class
+*
+*/
+
+
+
+#ifndef C_CCHIMPL_H
+#define C_CCHIMPL_H
+
+#include <e32base.h>
+#include <ccherror.h>
+#include <cchtypes.h>
+#include "cch.h"
+#include "cchclient.h"
+#include "cchuiprivateapi.h"
+#include "cchuicommon.hrh"
+
+class CCchService;
+class CCchServiceImpl;
+
+// flag cchui support on. This is temporary fix until cchui is integrated into builds. 
+#define CCHAPI_USE_CCHUI
+
+#ifdef CCHAPI_USE_CCHUI
+class CCchUiPrivateApi;
+#else 
+#define CCchUiPrivateApi TInt 
+#endif
+
+// DATA TYPES
+typedef RPointerArray<CCchServiceImpl> RServiceImplArray;
+
+/**
+ *  Class for basic cch functionality, getting services
+ *
+ *  @code
+ *   ?good_class_usage_example(s)
+ *  @endcode
+ *
+ *  @lib cch
+ */
+class CCchImpl : public CActive 
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCchImpl* NewL( CCch& aCch );
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCchImpl* NewLC( CCch& aCch );
+    
+    /**
+     * Destructor.
+     */
+    ~CCchImpl();
+    
+    /**
+     * Returns the RCCHClient
+     * 
+     * @return The used client
+     */
+    RCCHClient& CchClient();
+    
+    /**
+     * Returns one service
+     *
+     * @param aId Service id
+     * @return Cch service or NULL if service not found
+     */
+    CCchService* GetService( TInt aId );
+    
+    /**
+     * Returns service ids of all configured services
+     *
+     * @param  aIds Array of TInt to be filled with service ids
+     * @return Symbian error code
+     */
+    TInt GetServiceIds( RArray<TInt>& aIds );
+    
+    /**
+     * Returns services fulfilling the search criteria
+     *
+     * @param aType Service type
+     * @param aServices Array of CCchService to be filled 
+     * @return Symbian error code
+     */
+    TInt GetServices( TCCHSubserviceType aType, 
+                               RPointerArray<CCchService>& aServices );
+    
+    
+    /**
+     * Returns ETrue if connectivity dialogs are allowed in service enabling.
+     *
+     * @return ETrue if connectivity dialogs are allowed in service enabling
+     */
+    TBool ConnectivityDialogsAllowed() const;
+        
+    
+    /**
+     * For allowing/disallowing connectivity dialogs showing in 
+     * service enabling.
+     * 
+     * @param aConnectivityDialogsAllowed Boolean to set connectivity dialogs
+     *        allowed/disallowed
+     */ 
+    void SetConnectivityDialogsAllowed( TBool aConnectivityDialogsAllowed );
+    
+    
+    /**
+     * For getting cchui api.
+     * 
+     * @return reference to cchui api.
+     */
+    MCchUi& CchUiApi() const;
+    
+    
+    /**
+     * Finds out if corresponding Cch service exists already
+     *
+     * @param aServiceId Service Id
+     * @return Index of the service or KErrNotFound if does not exist
+     */
+    TInt FindService( TInt aServiceId ) const;
+    
+private: //from CActive
+
+	/**
+	 * @see CActive.
+	 */
+	void RunL();
+	
+	/**
+	 * @see CActive.
+	 */
+	void DoCancel();
+	
+	/**
+	 * @see CActive
+	 */
+	TInt RunError(TInt aError);
+	
+private:
+    
+    /**
+     * The constructor
+     */
+	CCchImpl();
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL( CCch& aCch );
+    
+    /**
+     * Queries the services from CCH client.
+     * 
+     * @param aType Type of the service
+     * @param aServices Array of CCchServices to be filled
+     */
+    void GetServicesL( TCCHSubserviceType aType, 
+            RPointerArray<CCchService>& aServices );
+    
+    /**
+     * Queries the services from CCH client.
+     * 
+     * @param aServiceId If of the service
+     * @param aType Type of the service
+     * @param aServices Array of CCchServices to be filled
+     * @return Symbian error
+     */
+    TInt GetCchServicesL( TInt aServiceId, TCCHSubserviceType aType, 
+			CArrayFixFlat<TCCHService>& aServices );
+    
+    /**
+     * Queries a service from CCH Client by id.
+     * @param	aId The id of the queried service
+     * @return	Pointer to the queried service
+     */
+    CCchServiceImpl* GetServiceL( TInt aId );
+    
+    
+    /**
+     * Returns service ids of all configured services, leave function
+     *
+     * @param  aIds Array of TInt to be filled with service ids
+     */
+    void GetServiceIdsL( RArray<TInt>& aIds );
+
+private: // data
+
+    /**
+     * Own: CCH Server
+     */
+    RCCHServer iCchServer;
+    
+    /**
+     * Own: CCH Client
+     */
+    RCCHClient iCchClient;
+    
+    /**
+     * array the for new cch services
+     */
+    RServiceImplArray iCchServiceImpls;
+    
+    /**
+     * Own: Cch UI handling interface
+     */    
+    CCchUiPrivateApi* iCchUi;
+    
+    /**
+     * Flag which indicates if cchui connectivity dialogs are used when
+     * enabling service.
+     */  
+    TBool iConnectivityDialogsAllowed;
+    
+    CCHUI_UNIT_TEST( UT_CchUi )
+    };
+
+#endif // C_CCHIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchserviceimpl.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,283 @@
+/*
+* 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:  cch client api implementation class
+*
+*/
+
+
+
+#ifndef C_CCHSERVICEIMPL_H
+#define C_CCHSERVICEIMPL_H
+
+#include <e32base.h>
+#include <ccherror.h>
+#include <cchtypes.h>
+//from cchclient
+#include "cchimpl.h"
+#include "cch.h"
+
+
+class CCchClientObserver;
+class CCchImpl;
+class CCchServiceImplAsynchroniser;
+#ifdef CCHAPI_USE_CCHUI
+class CCchUiPrivateApi;
+#else 
+#define CCchUiPrivateApi TInt 
+#endif
+
+/**
+ *  Class for basic cch functionality, getting services
+ *
+ *  @code
+ *   ?good_class_usage_example(s)
+ *  @endcode
+ *
+ *  @lib cch
+ */
+class CCchServiceImpl : public CCchService
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * 
+     * @param aCch Cch service factory
+     * @param aServiceId Id of the service
+     * @param aCchUi CCH connectivity UI handling API
+     */
+    static CCchServiceImpl* NewL( CCchImpl& aCch, 
+                                  TInt aServiceId,
+                                  CCchUiPrivateApi& aCchUi );
+    
+    /**
+     * Two-phased constructor.
+     * 
+     * @param aCch Cch service factory
+     * @param aServiceId Id of the service
+     * @param aCchUi CCH connectivity UI handling API
+     */
+    static CCchServiceImpl* NewLC( CCchImpl& aCch, 
+                                   TInt aServiceId,
+                                   CCchUiPrivateApi& aCchUi );
+    
+    /**
+     * Destructor.
+     */
+    ~CCchServiceImpl();
+
+public: // from CCchService
+
+    /**
+     * Launches service enable. See CCchServiceObserver for status changes.
+     *
+     * @param aType Type of service
+     * @return Symbian error
+     */
+    TInt Enable( TCCHSubserviceType aType );
+    
+    /**
+     * Launches service disable. See CCchServiceObserver for status changes.
+     *
+     * @param aType Type of service
+     * @return Symbian error
+     */
+    TInt Disable( TCCHSubserviceType aType );
+    
+    /**
+     * Returns the current service state
+     *
+     * @param aType Type of service
+     * @param aStatus Status of the service, return value
+     * @return Symbian error code
+     */
+    TInt GetStatus( TCCHSubserviceType aType, TCchServiceStatus& aStatus ) const;
+    
+    /**
+     * Returns the connection parameters
+     *
+     * @param aType Type of service
+     * @param aParameter Connection parameter of the service
+     * @param aValue value of the parameter
+     * @return Symbian error code
+     */
+    TInt GetConnectionParameter( TCCHSubserviceType aType, TCchConnectionParameter aParameter, TInt& aValue ) const;
+    
+    /**
+     * Returns the connection parameters
+     *
+     * @param aType Type of service
+     * @param aParameter Connection parameter of the service
+     * @param aValue value of the parameter
+     * @return Symbian error code
+     */
+    TInt GetConnectionParameter( TCCHSubserviceType aType, 
+                                 TCchConnectionParameter aParameter, 
+                                 RBuf& aValue ) const;
+    
+    /**
+     * Sets the connection parameters
+     *
+     * @param aType The type of service
+     * @param aParameter Connection parameter of the service
+     * @param aValue value of the parameter
+     * @return Symbian error code
+     */
+    TInt SetConnectionParameter( TCCHSubserviceType aType, 
+                                 TCchConnectionParameter aParameter, 
+                                 TInt aValue );
+    
+    /**
+     * Sets the connection parameters
+     *
+     * @param aType The type of service
+     * @param aParameter Connection parameter of the service
+     * @param aValue value of the parameter
+     * @return Symbian error code
+     */
+    TInt SetConnectionParameter( TCCHSubserviceType aType, 
+                                 TCchConnectionParameter aParameter, 
+                                 const TDesC& aValue );
+    
+    /**
+     * Reserves the service for exclusive usage
+     *
+     * @param aType Type of service
+     * @return Symbian error code
+     */
+    TInt Reserve( TCCHSubserviceType aType );
+    
+    /**
+     * Frees the service of exclusive usage
+     *
+     * @param aType Type of service
+     * @return Symbian error code
+     */
+    TInt Free( TCCHSubserviceType aType );
+    
+    /**
+     * Is the service reserved
+     *
+     * @param aType Type of service
+     * @param aReserved True if the service is reserved
+     * @return Symbian error code
+     */
+    TInt IsReserved( TCCHSubserviceType aType, 
+                     TBool& aReserved ) const;
+    
+    /**
+     * Returns the service id
+     *
+     * @return Service id
+     */
+    TInt ServiceId() const;
+    
+    /**
+     * @deprecated Do not use this anymore, change to AddObserver!
+     *
+     * Adds observer for listening service events
+     *
+     * @param aObserver Event observing class
+     */
+    void SetObserver( MCchServiceStatusObserver& aObserver );
+    
+    /**
+     * @deprecated Do not use this anymore, change to 
+     * RemoveObserver method with paramater
+     * 
+     * Removes the observer of service events
+     */
+    void RemoveObserver( );
+
+    /**
+     * Adds observer for listening service events
+     *
+     * @param aObserver Event observing class
+     * @return KErrAlreadyExist Observer already added
+     *         KErrNone Observer was added
+     */
+    TInt AddObserver( MCchServiceStatusObserver& aObserver );
+    
+    /**
+     * Removes the observer of service events
+     *
+     * @param aObserver Event observing class
+     * @return KErrNotFound Observer was not found
+     *         KErrNone Observer was removed
+     */
+    TInt RemoveObserver( MCchServiceStatusObserver& aObserver );
+    
+    /**
+     * Checks if the type is supported
+     *
+     * @param aType Type of service
+     * @param aSupported True if the service type is supported
+     * @return Symbian error code
+     */
+    TInt IsSupported( TCCHSubserviceType aType, TBool& aSupported ) const;
+    
+private:
+    
+    /**
+     * The constructor
+     * 
+     * @param aCch Cch service factory
+     * @param aServiceId The id of the service
+     */
+	CCchServiceImpl( CCchImpl& aCch, 
+	                 TInt aServiceId, 
+                     CCchUiPrivateApi& aCchUi );
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+public:
+
+	CCchImpl* CchImpl() const;
+	
+private: // data
+
+	/**
+	 * cch service factory, not own
+	 */
+	CCchImpl& iCch;
+	
+	/**
+	 * Service Id
+	 */
+	TInt iServiceId; 
+	
+	/**
+	 * Service observer
+	 */
+	CCchClientObserver* iObserver;
+	/**
+	 * CCH connectivity UI handling private API
+	 */	
+	CCchUiPrivateApi& iCchUi;
+	
+	/**
+	 * CCH server request handler
+	 */	
+	CCchServiceImplAsynchroniser* iAsynchroniser;
+
+#ifdef CCHUNITTEST
+    friend class UT_CCchService;
+#endif
+    };
+
+#endif // C_CCHSERVICEIMPL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchserviceimplasynchroniser.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+#ifndef CCHSERVICEIMPLASYNCHRONISER_H
+#define CCHSERVICEIMPLASYNCHRONISER_H
+
+#include <e32base.h>	// For CActive, link against: euser.lib
+#include <e32std.h>		// For RTimer, link against: euser.lib
+//from cchclient
+#include <cchtypes.h>
+#include "cchimpl.h"
+#include "cch.h"
+
+class CCchImpl;
+
+#ifdef CCHAPI_USE_CCHUI
+class CCchUiPrivateApi;
+#else 
+#define CCchUiPrivateApi TInt 
+#endif
+
+
+
+NONSHARABLE_CLASS ( CCchServiceImplAsynchroniser) : public CActive
+    {
+public:
+
+    enum TCchServiceImplState
+        {
+        EIdle = 0,
+        EEnabling = 1,
+        EDisabling = 2 
+        };
+    // Cancel and destroy
+    ~CCchServiceImplAsynchroniser();
+
+    // Two-phased constructor.
+    static CCchServiceImplAsynchroniser* NewL(CCchImpl& aCch, TInt iServiceId, CCchUiPrivateApi& aCchUi);
+
+    // Two-phased constructor.
+    static CCchServiceImplAsynchroniser* NewLC(CCchImpl& aCch, TInt iServiceId, CCchUiPrivateApi& aCchUi);
+
+    void Enable( TCCHSubserviceType aType );
+    
+    void Disable( TCCHSubserviceType aType );
+
+private:
+    // C++ constructor
+    CCchServiceImplAsynchroniser(CCchImpl& aCch, TInt iServiceId, CCchUiPrivateApi& aCchUi);
+
+    // Second-phase constructor
+    void ConstructL();
+
+private:
+    // From CActive
+    // Handle completion
+    void RunL();
+
+    // How to cancel me
+    void DoCancel();
+
+    // Override to handle leaves from RunL(). Default implementation causes
+    // the active scheduler to panic.
+    TInt RunError(TInt aError);
+
+private:
+    CCchImpl& iCch;
+    TInt iServiceId;
+    CCchUiPrivateApi& iCchUi; 
+    TCchServiceImplState iState;
+    };
+
+#endif // CCHSERVICEIMPLASYNCHRONISER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchuiapiimpl.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,400 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+#ifndef C_CCHUIAPIIMPL_H
+#define C_CCHUIAPIIMPL_H
+
+#include <cch.h>
+#include <e32base.h>
+#include <cchuiobserver.h>
+
+#include "mcchuinoteresultobserver.h"
+
+class CCchUiSpsHandler;
+class CCchUiCchHandler;
+class CCCHUiNoteHandler;
+class CCchUiClientObserver;
+class CCchUiConnectionHandler;
+
+/**
+ *  CchUiApiImpl class
+ *  Implementation class for CchUiApi.
+ *  Do the actual things of CchUiApi
+ *
+ *  @since @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCchUiApiImpl ) : public CBase,
+                                     public MCchUiNoteResultObserver,
+                                     public MCchServiceStatusObserver
+    {
+public:
+    
+    /**
+     * Two-phased constructor.
+     * @param aObserver reference to observer insterested in CCH UI events
+     */
+    static CCchUiApiImpl* NewL( CCch& aCch );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchUiApiImpl();
+       
+    /**
+     * Adds observer for listening cchui events.
+     *
+     * @since S60 5.0
+     * @param aObserver Event observing class
+     */  
+    void AddObserverL( MCchUiObserver& aObserver );
+    
+    /**
+     * Removes the observer of cchui events.
+     *
+     * @since S60 5.0
+     * @param aObserver Event observing class
+     */ 
+    void RemoveObserver( MCchUiObserver& aObserver );
+    
+    /**
+     * Shows specific dialog or note.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id of the service that the
+     *        note is shown for. Service id is used to fetch
+     *        service specific data. 
+     * @param aDialog specifies dialog to be shown
+     */        
+    void ShowDialogL( 
+        TUint32 aServiceId, 
+        MCchUiObserver::TCchUiDialogType aDialog );
+       
+    /**
+     * Configures visualization params.
+     *
+     * @since S60 5.0
+     * @param aAllowedNotes array of allowed notes
+     * @param aAllowedSubServices allowed sub services
+     * @return None
+     */            
+    void ConfigureVisualizationL( 
+        RArray<MCchUiObserver::TCchUiDialogType>& aAllowedNotes,
+        RArray<TCCHSubserviceType>& aAllowedSubServices );
+       
+    /**
+     * Cancels all notes. Same behaviour can be achieved by deleting
+     * this instance. Client can use this method to dismiss note and keep this 
+     * API instance in order to show some other notes in the future.
+     * If there is nothing to dismiss, call to this method does nothing.
+     *
+     * @since S60 5.0
+     */
+    void CancelNotes();    
+        
+    /**
+     * Starts observing events for specific service defined by aServiceId
+     *
+     * @since S60 5.0
+     * @param aService, service identifier
+     * @param aEnableResult, enable result error code
+     */    
+    void ManualEnableResultL( TUint aServiceId, TInt aEnableResult );
+    
+    
+// from base class MCchUiNoteResultObserver
+    
+    /**
+     * From MCchUiNoteResultObserver.
+     * Called when certain dialog has completed without errors.
+     *
+     * @since S60 5.0
+     * @param aCompleteCode Complete code.
+     * @param aResultParams Result params of the dialog.
+     */
+    void DialogCompletedL( 
+        TInt aCompleteCode, 
+        TCCHUiNotifierParams aResultParams );
+            
+// from base class MCchServiceStatusObserver    
+
+    /**
+     * Observer implementation for service specific events.
+     * by aServiceId.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id
+     * @param aType sub service type
+     * @param aServiceStatus service status
+     */ 
+    void ServiceStatusChanged( 
+        TInt aServiceId, 
+        TCCHSubserviceType aType, 
+        const TCchServiceStatus& aServiceStatus );
+    
+protected: // constructor
+
+    CCchUiApiImpl();
+    
+    void ConstructL( CCch& aCch );
+    
+protected: // functions    
+    /**
+     * Handles authentication failed dialog result.
+     *
+     * @since S60 5.0
+     * @param aCompleteCode Complete code of the dialog.
+     * @param aResultParams Result parameters from the dialog.
+     */    
+    void DoHandleAuthenticationFailedCompleteL( 
+        TInt aCompleteCode, 
+        TCCHUiNotifierParams aResultParams );
+                
+    /**
+     * Handles no connections dialog result.
+     *
+     * @since S60 5.0
+     * @param aCompleteCode Complete code of the dialog.
+     * @param aResultParams Result parameters from the dialog.
+     */          
+    void DoHandleNoConnectionsCompleteL( 
+        TInt aCompleteCode, 
+        TCCHUiNotifierParams aResultParams );
+    
+    /**
+     * Handles change connection confirmation note result.
+     *
+     * @since S60 5.0
+     * @param aCompleteCode Complete code of the dialog.
+     * @param aResultParams Result parameters from the dialog.
+     */          
+    void DoHandleConfirmChangeConnectionCompleteL( 
+        TInt aCompleteCode, 
+        TCCHUiNotifierParams aResultParams );
+    
+    /**
+     * Handles change connection query result.
+     *
+     * @since S60 5.0
+     * @param aCompleteCode Complete code of the dialog.
+     * @param aResultParams Result parameters from the dialog.
+     */          
+    void DoHandleChangeConnectionCompleteL( 
+        TInt aCompleteCode, 
+        TCCHUiNotifierParams aResultParams );
+            
+    /**
+     * Handles service specific error.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id
+     * @param aType subservice type
+     * @param aServiceStatus service status
+     */                      
+    void DoHandleServiceErrorL( 
+        TInt aServiceId, 
+        TCCHSubserviceType aType,
+        const TCchServiceStatus& aServiceStatus );
+
+    /**
+     * Handles service specific status event.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id
+     * @param aType subservice type
+     * @param aServiceStatus service status
+     */                      
+    void DoHandleServiceEventL( 
+        TInt aServiceId, 
+        TCCHSubserviceType aType,
+        const TCchServiceStatus& aServiceStatus );   
+    
+    /**
+     * Handles search wlan dialog result.
+     *
+     * @since S60 5.0
+     * @param aCompleteCode Complete code of the dialog.
+     * @param aResultParams Result parameters from the dialog.
+     */   
+    void HandleSearchWlanCompleteL( 
+        TInt& aCompleteCode, 
+        TCCHUiNotifierParams& aResultParams );
+    
+    /**
+     * Handles search access points error code.
+     *
+     * @since S60 5.0
+     * @param aErr error code to handle.
+     * @param aCompleteCode Complete code of the dialog.
+     * @param aResultParams Result parameters from the dialog.
+     */  
+    void HandleSearchAccessPointsErrorL( 
+        TInt aErr,
+        TInt& aCompleteCode, 
+        TCCHUiNotifierParams& aResultParams );
+    
+    /**
+     * Handles search wlan dialog result when use gprs selected.
+     *
+     * @since S60 5.0
+     * @param aCompleteCode Complete code of the dialog.
+     * @param aResultParams Result parameters from the dialog.
+     */   
+    void HandleCopyGprsCompleteL( 
+        TInt& aCompleteCode, 
+        TCCHUiNotifierParams& aResultParams );
+    
+    /**
+     * Handle changing to new connection.
+     *
+     * @since S60 5.0
+     * @param aCompleteCode Complete code of the dialog.
+     * @param aResultParams Result parameters from the dialog.
+     */   
+    void HandleChangeConnectionL( 
+        TInt& aCompleteCode, 
+        TCCHUiNotifierParams& aResultParams );
+    
+    /**
+     * Informs event to all observers.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id.
+     */                                 
+    void InformObserversL( TInt aServiceId );
+            
+    /**
+     * Checks if specific dialog is allowed. If client has not configured,
+     * all dialogs are allowed.
+     *
+     * @since S60 5.0
+     * @param aDialog dialog to be checked.
+     * @return TBool, ETrue if aDialog is allowed
+     */                                         
+    TBool DialogIsAllowed( MCchUiObserver::TCchUiDialogType aDialog );
+    
+    /**
+     * Checks if specific sub service is allowed. If client has not configured,
+     * only voip sub service is allowed.
+     *
+     * @since S60 5.0
+     * @param aSubService sub service to be checked.
+     * @return TBool, ETrue if aSubService is allowed
+     */                                     
+    TBool SubServiceIsAllowed( TCCHSubserviceType aSubService );
+    
+    /**
+     * Checks subservice state is allowed for showing dialogs.
+     *
+     * @since S60 5.0
+     * @param aState sub service state
+     * @return TBool, ETrue if state is allowed for showing dialogs
+     */                                     
+    TBool StateIsAllowed( const TCCHSubserviceState aState );
+    
+    /**
+     * Handles re-enabling of service.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id
+     */  
+    void HandleServiceReEnablingL( TUint aServiceId );
+    
+    /**
+     * Handles manual enable errors.
+     *
+     * @since S60 5.0
+     * @param aService, service identifier
+     * @param aEnableResult, enable result error code
+     */    
+    void HandleManualEnableErrorL( TUint aServiceId, TInt aEnableResult );
+           
+private: // data
+
+    /**
+     * Array of encapsulated observers (clients)
+     * Own.
+     */
+	RPointerArray<CCchUiClientObserver> iObservers;
+
+    /**
+     * CCH handler.
+     * Own.
+     */
+	CCchUiCchHandler* iCCHHandler;
+
+    /**
+     * Controller class for dialogs.
+     * Own.
+     */
+    CCCHUiNoteHandler* iNoteController;
+    
+    /**
+     * Service settings handler.
+     * Own.
+     */
+    CCchUiSpsHandler* iSpsHandler;    
+    
+    /**
+     * Connection handler. Handles iaps & snaps.
+     * Own.
+     */
+    CCchUiConnectionHandler* iConnectionHandler;
+        
+    /**
+     * Own. Stores service ids of the monitored services
+     */        
+    RArray<TUint> iObservervedServices;
+    
+    /**
+     * Own. Stores allowed notes (client provided)
+     */            
+    RArray<MCchUiObserver::TCchUiDialogType> iAllowedNotes;
+    
+    /**
+     * Own. Stores allowed sub services (client provided)
+     */            
+    RArray<TCCHSubserviceType> iAllowedSubServices; 
+    
+    /**
+     * Flag for indicating if re-enabling of service needs  
+     * after service disabled event.
+     */  
+    TBool iReEnableService;
+    
+    /**
+     * For iap id which can be removed when change connection 
+     * performed succesfully.
+     */  
+    TInt iRemovableConnection;
+    
+    /**
+     * Service which we have added cch observer.
+     */  
+    TInt iObservedService;
+    
+    /**
+     * Stores last cchui operation result.
+     */  
+    MCchUiObserver::TCchUiOperationResult iLastOperationResult;
+    
+    CCHUI_UNIT_TEST( UT_CchUi )
+    };
+
+#endif  // C_CCHUIAPIIMPL_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchuicchhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,198 @@
+/*
+* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+#ifndef C_CCCHUICCHHANDLER_H
+#define C_CCCHUICCHHANDLER_H
+
+#include <cch.h>
+#include "cchuicommon.hrh"
+
+/**
+ * CCH Handler.
+ * This class implements CCH handling.
+ *
+ * @code
+ *  // Create intance and get snap used by service.
+ *  iCCHHandler = CCchUiCchHandler::NewL();
+ *  TInt serviceId( KServiceId );
+ *  TInt snapId( KErrNone );
+ *  iCCHHandler->GetConnectionSnapId( serviceId, snapId );
+ * @endcode
+ *
+ * @lib cchui.lib
+ * @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCchUiCchHandler ) : public CBase
+    {    
+public:
+            
+    /**
+     * Two-phased constructor.
+     */
+    static CCchUiCchHandler* NewL( CCch& aCch  );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CCchUiCchHandler();
+
+    
+    /**
+     * Get snap id.
+     *
+     * @since S60 5.0
+     * @param aServiceId Service id.
+     * @param aSnapId Snap id will be stored here.
+     * @param aErr error code
+     */
+    void GetConnectionSnapIdL( TInt aServiceId, TInt& aSnapId, TInt& aErr );
+    
+    /**
+     * Set snap id.
+     *
+     * @since S60 5.0
+     * @param aServiceId Service id.
+     * @param aSnapId Snap id to be set.
+     * @param aErr error code.
+     */
+    void SetConnectionSnapIdL( TInt aServiceId, TInt aSnapId, TInt& aErr );
+           
+    /**
+     * Get service username.
+     *
+     * @since S60 5.0
+     * @param aServiceId Service id.
+     * @param aUserName service username.
+     * @param aErr error code.
+     */
+    void GetUsernameL( TInt aServiceId, RBuf& aUserName, TInt& aErr );
+    
+    /**
+     * Set username for service.
+     *
+     * @since S60 5.0
+     * @param aResultParams Contains needed info to set username.
+     * @param aErr
+     */
+    void SetUsernameL( TCCHUiNotifierParams aResultParams, TInt& aErr );
+    
+    /**
+     * Set password for service.
+     *
+     * @since S60 5.0
+     * @param aResultParams Contains needed info to set password.
+     * @param aErr error code.
+     */
+    void SetPasswordL( TCCHUiNotifierParams aResultParams, TInt& aErr );
+    
+    /**
+     * Starts observing for service events for service specified
+     * by aServiceId.
+     *
+     * @since S60 5.0
+     * @param aServiceId service identifier
+     * @param aObserver observer for service events
+     */    
+    void StartObservingL( 
+            TUint aServiceId, 
+            MCchServiceStatusObserver& aObserver );
+        
+    /**
+     * Stops observing for specific service defined by aServiceId
+     *
+     * @since S60 5.0
+     * @param aServiceId service identifier
+     * @param aObserver observer for service events
+     */            
+    void StopObservingL( 
+            TUint aServiceId, 
+            MCchServiceStatusObserver& aObserver );
+    
+    /**
+     * For checking service state.
+     *
+     * @since S60 5.0
+     * @param aServiceId service identifier
+     * @param aSubServiceType subservice type
+     * @param aErr Symbian error code
+     * @return subservice state
+     */            
+    TCCHSubserviceState GetServiceStateL( 
+            TUint aServiceId, 
+            TCCHSubserviceType aSubServiceType,
+            TInt& aErr );
+    
+    /**
+     * For getting current connections iap id.
+     * Is left as zero if no current connection exists.
+     *
+     * @since S60 5.0
+     * @param aServiceId service identifier
+     * @param aSubServiceType subservice type
+     * @param aIapId current connection iap id to be stored here
+     * @param aErr error code to be stored here
+     */            
+    void GetCurrentConnectionIapIdL( 
+            TUint aServiceId, 
+            TCCHSubserviceType aSubServiceType,
+            TInt& aIapId,
+            TInt& aErr );
+    
+    /**
+     * Enables service
+     *
+     * @since S60 5.0
+     * @param aServiceId service identifier
+     */                
+    void EnableL( TUint aServiceId );
+
+    /**
+     * Disables service
+     *
+     * @since S60 5.0
+     * @param aServiceId service identifier
+     */                
+    void DisableL( TUint aServiceId );    
+    
+    /**
+     * For checking if all subservices are disabled
+     *
+     * @since S60 5.0
+     * @param aServiceId service identifier
+     * @param aState checked state
+     * @return ETrue if all subservices are in checked state
+     */                
+    TBool AllSubservicesInStateL( TUint aServiceId, 
+        TCCHSubserviceState aState );  
+        
+private:
+
+    CCchUiCchHandler( CCch& aCch );    
+ 
+private: // data
+    
+    /**
+     * Handle to CCH Client API.
+     * Not own.
+     */
+    CCch& iCchClientApi;
+    
+    CCHUI_UNIT_TEST( UT_CchUi )
+    };
+
+#endif // C_CCCHUICCHHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchuiclientobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* 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:  Encapsulates singleton client and provided observer
+*
+*/
+
+
+
+#ifndef C_CCHUICLIENTOBSERVER_H
+#define C_CCHUICLIENTOBSERVER_H
+
+#include <e32base.h>
+#include <e32const.h>
+
+class MCchUiObserver;
+
+/**
+ * This class stores client provider reference and api instance used to create
+ * it. Those can be mapped when api instance is deleted to remove observer. 
+ * This way singleton instance will not call observers that are already deleted.
+ * This class implements the use of Service provider settings.
+ *
+ * @code
+ * @endcode
+ *
+ * @lib cchui.lib
+ * @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCchUiClientObserver ): public CBase
+    {
+public:
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCchUiClientObserver* NewL( MCchUiObserver& aObserver);
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCchUiClientObserver* NewLC( MCchUiObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchUiClientObserver();
+      
+    /**
+     * Return observer.
+     *
+     * @since S60 5.0
+     * @return observer reference
+     */
+    MCchUiObserver& Observer();
+
+private:
+
+    CCchUiClientObserver( MCchUiObserver& aObserver );
+
+private: // data
+
+    /**
+     * Observer reference.
+     */
+    MCchUiObserver& iObserver;
+    };
+
+#endif // C_CCHUICLIENTOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchuicommon.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* 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:  Resource header for project CCH UI
+*
+*/
+
+
+#ifndef CCHUI_HRH
+#define CCHUI_HRH
+
+#include <cchuiobserver.h>
+
+const TInt KUserNameLength = 100;
+const TInt KPasswordLength = 100;
+const TUid KCchUiNotifierUid = { 0x200195A8 };
+const TUid KCchUiNotifierChannel = { 0x200195A8 };
+const TInt KServiceNameLength = 100;
+
+enum TCchUiOperationCommand
+    {
+    ECchUiNoCommand = 0,
+    ECchUiCommandConnectWhenAvailable,
+    ECchUiCommandSearchWlan,
+    ECchUiCommandCopyGprs,
+    ECchUiCommandGprsNotFound,
+    ECchUiCommandEnableCancelled
+    };
+
+NONSHARABLE_CLASS( TCCHUiNotifierParams )
+    /** Notifier params for CCH UI */
+    {
+public:
+    /** Dialog mode */
+    MCchUiObserver::TCchUiDialogType    iDialogMode;
+    /** Username. */
+    TBuf<KUserNameLength> iUsername;
+    /** Password */
+    TBuf<KUserNameLength> iPwd;
+    /** Service id for which dialog was shown */
+    TUint   iServiceId;
+    /** Command that user selected from dialog */
+    TCchUiOperationCommand  iOperationCommand;
+    /** stores gprs iap source snap when gprs iap is copied to service snap */
+    TUint   iGprsSourceSnap;
+    /** stores gprs iap id when gprs iap is copied to service snap */
+    TUint   iGprsIapId;
+    /** stores current connection iap id if we have one, othewise it´s zero */
+    TUint iCurrentConnectionIapId;
+    /** stores flag if current connection can be removed after change connection */
+    TBool iRemoveOldConnection;
+    };
+typedef TPckgBuf<TCCHUiNotifierParams> TCCHUiNotifierParamsPckg;
+
+#ifdef CCHUI_EUNIT
+#define CCHUI_UNIT_TEST(ClassName) friend class ClassName;
+#else 
+#define CCHUI_UNIT_TEST(ClassName)
+#endif // CCHUI_EUNIT
+
+#endif // CCHUI_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchuiconnectionhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,264 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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_CCCHUICONNECTIONHANDLER_H
+#define C_CCCHUICONNECTIONHANDLER_H
+
+#include <e32base.h>
+#include <e32const.h>
+#include <rconnmon.h>
+#include <cmmanagerext.h>
+#include <wlanmgmtcommon.h> // TWlanConnectionSecurityMode
+#include <cmpluginwlandef.h>
+
+#include "cchuicommon.hrh"
+#include "mcchuitimerobserver.h"
+
+class CCchUiCchHandler;
+class CCchUiSpsHandler;
+class RCmDestinationExt;
+class CmConnectionMethodExt;
+class CConnectionUiUtilities;
+
+
+/**
+ * Connection Handler.
+ * This class implements the creation and altering of connections and SNAPs.
+ *
+ * @code
+ *  // Create CCH handler and SPS handler and give them as parameters when
+ *  // you create Connection  handler.
+ *  iCCHHandler = CCchUiCchHandler::NewL();    
+ *  iSpsHandler = CCchUiSpsHandler::NewL();
+ *  iConnectionHandler = CCchUiConnectionHandler::NewL( 
+ *       *iCCHHandler, *iSpsHandler );
+ * @endcode
+ *
+ * @lib cchui.lib
+ * @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCchUiConnectionHandler ): public CBase
+    {
+public:
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @param aCchUiCchHandler CCH handler reference.
+     * @param aSpsHandler Service settings handler reference.
+     */
+    static CCchUiConnectionHandler* NewL(
+        CCchUiCchHandler& aCchUiCchHandler,
+        CCchUiSpsHandler& aSpsHandler );
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @param aCchUiCchHandler CCH handler reference.
+     * @param aSpsHandler Service settings handler reference.
+     */
+    static CCchUiConnectionHandler* NewLC(
+        CCchUiCchHandler& aCchUiCchHandler,
+        CCchUiSpsHandler& aSpsHandler );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchUiConnectionHandler();
+    
+    
+    /**
+     * Displays a dialog to select one wlan access point from all
+     * available and adds access point to snap (creates snap if
+     * it doesn't exist).
+     *
+     * @since S60 5.0
+     * @param aServiceId Service id.
+     * @param aSnapId Snap id of the service. Snap is verified before use.
+     * @param aServiceName Service name (used as snap name if needed)
+     */
+    void SearchAccessPointsL(
+        TUint aServiceId, 
+        TUint32 aSnapId, 
+        const TDesC& aServiceName );
+            
+    /**
+     * Copies iap from specific SNAP to another.
+     *
+     * @since S60 5.0
+     * @param aServiceId service id
+     * @param aServiceName service name
+     * @param aSourceIap source IAP
+     * @param aTargetSnap target SNAP
+     */         
+    void CopyIapToServiceSnapL( 
+        TUint aServiceId,
+        const TDesC& aServiceName,
+        TUint32 aSourceIap, 
+        TUint32 aTargetSnap );
+    
+    /**
+     * Removes connection from specific service´s SNAP.
+     *
+     * @since S60 5.0
+     * @param aServiceName service´s name
+     * @param aIapId access point id to be removed
+     */            
+    void RemoveConnectionL( const TDesC& aServiceName, TInt aIapId );
+    
+    /**
+     * Returns ETrue if wlan search (query) is ongoing.
+     *
+     * @since S60 5.0
+     * @return ETrue if wlan search ongoing.
+     */ 
+    TBool SearchWlanOngoing();
+       
+private:
+
+    CCchUiConnectionHandler(
+        CCchUiCchHandler& aCchUiCchHandler,
+        CCchUiSpsHandler& aSpsHandler );
+    
+    void ConstructL();
+    
+    /**
+     * Checks if connection method already exists.
+     *
+     * @since S60 5.0
+     * @param aDestination Target destination.
+     * @param aSsid SSID of the connection method.
+     * @param aSecurityMode Security mode of the candidate.
+     * @param aAlreadyExists If access point already exists, this is ETrue.
+     * @param aHidden Is candidate hidden or not.
+     * @return TInt Iap id of the new connection method or KErrNotFound.
+     */
+    TInt ConnectionMethodAlreadyExistsL( 
+        RCmDestinationExt& aDestination, 
+        const TDesC& aSsid, 
+        CMManager::TWlanSecMode aSecurityMode,
+        TBool& aAlreadyExists,
+        TBool aHidden );
+    
+    /**
+     * Checks if connection method already exists.
+     *
+     * @since S60 9.2
+     * @param aIapId internet accespoint ID.
+     * @param aTargetSnap target destination.
+     * @return ETrue if exists.
+     */
+    TBool ConnectionMethodAlreadyExistsL(
+        TUint32 aIapId, RCmDestinationExt& aTargetSnap ) const;
+    
+    /**
+     * Adds new connection method to snap.
+     *
+     * @since S60 5.0
+     * @param aDestination Target destination.
+     * @param aSsid SSID of the connection method.
+     * @param aSecurityMode Security mode of the connection method.
+     * @param aAlreadyExists If access point already exists, this is ETrue.
+     * @param aSetHidden Set iap hidden.
+     * @return TInt Iap id of the new connection method or old
+     *         if already existed.
+     */
+    TInt AddNewConnectionMethodL( 
+        RCmDestinationExt& aDestination,
+        const TDesC& aSsid,
+        TWlanConnectionSecurityMode aSecurityMode,
+        TBool& aAlreadyExists,
+        TBool aSetHidden );
+    
+    /**
+     * Saves security settings to created connection method.
+     *
+     * @since S60 5.0
+     * @param aSecMode Security mode.
+     * @param aKey Key.
+     * @param aHex Use hex.
+     * @param aIapId Iap id.
+     */
+    void SaveSecuritySettingsL(
+        const TWlanConnectionSecurityMode aSecMode, 
+        const HBufC* aKey, 
+        const TBool aHex, 
+        const TUint32 aIapId );
+            
+    /**
+     * Sets specific SNAP in use for specific service.
+     *
+     * @since S60 5.0
+     * @param aServiceId Service id of the service to be handled.
+     * @param aSNAPId Snap id to set.
+     */
+    void SetSnapToUseL( 
+        TUint aServiceId, 
+        TUint32 aSNAPId );    
+       
+    /**
+     * Creates SNAP for service. Ownership is passed.
+     *
+     * @since S60 5.0
+     * @param aServiceName service name
+     * @return Created destination, ownership is passed.
+     */            
+    RCmDestinationExt CreateServiceSnapL( 
+        const TDesC& aServiceName );
+                
+private: // data
+
+    /**
+     * Reference to CCH handler.
+     * Not own.
+     */
+    CCchUiCchHandler& iCCHHandler;
+    
+    /**
+     * Reference to service settings handler.
+     * Not own.
+     */
+    CCchUiSpsHandler& iSpsHandler;
+    
+    /**
+     * Pointer to connection ui utilities.
+     * Own.
+     */
+    CConnectionUiUtilities* iConnUiUtils;
+        
+    /**
+     * Handle to connection method manager.
+     * Own.
+     */
+    RCmManagerExt iCmManagerExt;
+    
+    /**
+     * Handle to connection monitor. Required to resolve hidden/public status.
+     * Own.
+     */
+    RConnectionMonitor iConnMon;
+    
+    /**
+     * Flag for determining if search wlan search (query) is ongoing
+     */
+    TBool iSearchWlanOngoing;
+    
+    CCHUI_UNIT_TEST( UT_CchUi )
+    };
+
+#endif // C_CCCHUICONNECTIONHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchuiglobalqueryhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,149 @@
+/*
+* 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:  Class handling notifier plugin usage.
+*
+*/
+
+
+#ifndef C_CCHUIGLOBALQUERYHANDLER_H
+#define C_CCHUIGLOBALQUERYHANDLER_H
+
+#include <AknNotify.h>
+#include <AknsItemID.h>
+#include <AknNotifyStd.h>
+#include <AknQueryDialog.h>
+
+#include "cchuicommon.hrh"
+
+class CAknSDData;
+
+
+/**
+ * Global query handler.
+ * This class handles qlobal query usage in cchui.
+ *
+ * @code
+ *  //Example how to show change connection query. You need to inherint class
+ *  //that is using globalqueryhandler from CActive to get result in 
+ *  //RunL when dialog is completed.
+ *  iGlobalQueryHandler = CCchUiGlobalQueryHandler::NewL();
+ *  TInt serviceId( KServiceId );
+ *  MCchUiObserver::TCchUiDialogType dialog = 
+ *      MCchUiObserver::ECchUiDialogTypeChangeConnection;
+ *  iGlobalQueryHandler->ShowMsgQueryL( dialog, iStatus, serviceId );
+ *  SetActive();
+ * @endcode
+ *
+ * @lib cchui.lib
+ * @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCchUiGlobalQueryHandler ): public CBase
+    {
+public:
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCchUiGlobalQueryHandler* NewL();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCchUiGlobalQueryHandler* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchUiGlobalQueryHandler();
+    
+    
+    /**
+     * Shows global message query asynchronously.
+     *
+     * @since S60 5.0
+     * @param aNote Note mode.
+     * @param aStatus Asynchronic observer iStatus.
+     * @param aServiceId Service id.
+     * @param aIapId iap id.
+     * @param aUserName service username.
+     */
+    void ShowMsgQueryL( 
+        MCchUiObserver::TCchUiDialogType aNote,
+        TRequestStatus& aStatus,
+        TUint aServiceId,
+        TUint aIapId,
+        RBuf& aUserName );
+       
+    /**
+     * Update the softkeys of the message query.
+     *
+     * @since S60 5.0
+     * @param aSoftkeys New resource for softkeys.
+     */
+    void UpdateMsgQuery( TInt aSoftkeys );
+    
+    /**
+     * Cancel the message query.
+     *
+     * @since S60 5.0
+     */
+    void CancelMsgQuery();
+    
+    /**
+     * Returns result params.
+     *
+     * @since S60 5.0
+     * @return Result params.
+     */
+    TCCHUiNotifierParams ResultParams();
+    
+    
+private:
+
+    CCchUiGlobalQueryHandler();
+    
+    void ConstructL();
+    
+
+private: // data
+    
+    /**
+     * Handle to RNotifier.
+     */
+    RNotifier iNotify;
+    
+    /**
+     * Global query command.
+     */
+    TAknGlobalQueryCmd iCmd;
+    
+    /**
+     * Notifier params package.
+     */
+    TCCHUiNotifierParamsPckg iPckg;
+    
+    /**
+     * Contains resource id for softkeys.
+     */
+    TInt iSoftkeys;
+    
+    /**
+     * State of iNotify
+     */
+    TBool iNotifyStarted;
+    
+    CCHUI_UNIT_TEST( UT_CchUi )
+    };
+
+#endif // C_CCHUIGLOBALQUERYHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchuilogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,75 @@
+/*
+* 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:  Logger definitions
+*
+*/
+
+
+#ifndef CCHUILOGGER_H
+#define CCHUILOGGER_H
+
+#include <e32def.h>
+#include <e32svr.h>
+
+//----------------------------------------------------------------------------
+//  USER LOGGING SETTINGS
+//----------------------------------------------------------------------------
+
+#ifndef _DEBUG
+
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = RDebug
+***************************/ 
+
+#define CCHUI_DEBUG             0   // UREL BUILD
+
+#else
+
+#define CCHUI_DEBUG             1   // UDEB BUILD
+
+#endif // _DEBUG
+
+
+
+//----------------------------------------------------------------------------
+//  LOGGING MACROs (DO NOT EDIT)
+//
+//  USE THESE MACROS IN YOUR CODE
+//----------------------------------------------------------------------------
+
+#if CCHUI_DEBUG == 1    // RDebug
+
+#define CCHUI_TP_PRINT(s) L##s
+#define CCHUI_STRA_PRINT(s) CCHUI_TP_PRINT(s)
+#define CCHUI_STR_PRINT(t) CCHUI_STRA_PRINT("[CCHUI]") L##t
+#define CCHUI_LIT_PRINT(s) TPtrC((const TText *) CCHUI_STR_PRINT(s))
+
+#define CCHUIDEBUG(AA)           { RDebug::Print(CCHUI_LIT_PRINT(AA)); }
+#define CCHUIDEBUG2(AA,BB)       { RDebug::Print(CCHUI_LIT_PRINT(AA),BB); }
+#define CCHUIDEBUG3(AA,BB,CC)    { RDebug::Print(CCHUI_LIT_PRINT(AA),BB,CC); }
+#define CCHUIDEBUG4(AA,BB,CC,DD) { RDebug::Print(CCHUI_LIT_PRINT(AA),BB,CC,DD); }
+
+#else   // CCHUI_DEBUG == 0 or invalid -> Disable loggings
+
+#define CCHUIDEBUG(AA)          
+#define CCHUIDEBUG2(AA,BB)     
+#define CCHUIDEBUG3(AA,BB,CC)    
+#define CCHUIDEBUG4(AA,BB,CC,DD) 
+
+#endif  // CCHUI_DEBUG
+
+#endif  // CCHUILOGGER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchuinotehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,147 @@
+/*
+* 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:  Main class for note handling.
+*
+*/
+
+
+#ifndef C_CCHUINOTEHANDLER_H
+#define C_CCHUINOTEHANDLER_H
+
+#include <e32base.h>
+#include <badesca.h>
+
+#include "cchuicommon.hrh"
+
+class CCchUiGlobalQueryHandler;
+class MCchUiNoteResultObserver;
+
+/**
+ * Note handler.
+ * Note handling for cchui.
+ *
+ * @code
+ *  // Example how to launch change connection query.
+ *  iNoteController = CCCHUiNoteHandler::NewL( *this );
+ *  TInt serviceId( KServiceId ); 
+ *  MCchUiObserver::TCchUiDialogType dialog = 
+ *      MCchUiObserver::ECchUiDialogTypeChangeConnection;
+ *  iNoteController->LaunchNoteL( dialog, serviceId );  
+ * @endcode
+ *
+ * @lib cchui.lib
+ * @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCCHUiNoteHandler ): public CActive
+    {
+public:
+    
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver Reference to note result observer.
+     */
+    static CCCHUiNoteHandler* NewL( 
+        MCchUiNoteResultObserver& aObserver );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHUiNoteHandler();
+    
+    /**
+     * Launch note.
+     *
+     * @since S60 5.0
+     * @param aNote Note type.
+     * @param aServiceId Service id.
+     * @param aIapId iap id.
+     * @param aUsername service username.
+     */
+    void LaunchNoteL( 
+        MCchUiObserver::TCchUiDialogType aNote, 
+        TUint aServiceId,
+        TUint aIapId,
+        RBuf& aUserName );
+      
+    /**
+     * Check if there is active note.
+     *
+     * @since S60 5.0
+     * @retun ETrue if there is active note
+     */
+    TBool ActiveDialogExists();
+    
+    /**
+     * Cancels querys.
+     *
+     * @since S60 5.0
+     */
+    void CancelOldNotes();
+    
+    /**
+     * Returns current note.
+     *
+     * @since S60 5.0
+     */    
+    MCchUiObserver::TCchUiDialogType CurrentNote();
+        
+private:
+
+    CCCHUiNoteHandler( MCchUiNoteResultObserver& aObserver );
+    
+    void ConstructL();
+    
+// from base class CActive
+    
+    /**
+     * From CActive.
+     * Called when asynchronous event occurs.
+     */
+    void RunL();
+       
+    /**
+     * From CActive.
+     * Called when this active object is canceled.
+     */
+    void DoCancel();
+       
+    /**
+     * From CActive.
+     * Asynchronous error.
+     */
+    TInt RunError( TInt aError );
+    
+private: // data
+
+    /**
+     * Global dialog handler.
+     * Own.
+     */
+    CCchUiGlobalQueryHandler* iGlobalQueryHandler;
+
+    /**
+     * Note result observer.
+     */
+    MCchUiNoteResultObserver& iObserver;
+    
+    /**
+     * Current active note.
+     */
+    MCchUiObserver::TCchUiDialogType iCurrentNote;
+
+    CCHUI_UNIT_TEST( UT_CchUi )
+    };
+
+#endif // C_CCHUINOTEHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchuiprivateapi.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,173 @@
+/*
+* 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:  Declares private API for the CCH UI component.
+*
+*/
+
+
+#ifndef C_CCHUIPRIVATEAPI_H
+#define C_CCHUIPRIVATEAPI_H
+
+#include <e32base.h>
+#include <cchui.h>
+
+#include "cchuicommon.hrh"
+
+class CCchUiApiImpl;
+class CCch;
+
+/**
+ *  CCH UI Private API - provides means to control CCH UI.
+ *  
+ *  This API hides the actual implementation from clients. 
+ *  In essence this API provides internal access to connectivity UI logic. 
+ *
+ *  @code
+ *  @endcode
+ *
+ *  @lib cchui.lib
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCchUiPrivateApi ) : public CBase, public MCchUi
+    {
+    public:
+        
+        /**
+         * Two-phased constructor.
+         * @param aObserver reference to observer insterested in CCH UI events
+         * Ownership is not taken.
+         */
+        static CCchUiPrivateApi* NewL( CCch& aCch );
+
+        /**
+         * Destructor.
+         */
+        ~CCchUiPrivateApi();
+
+
+        /**
+         * Tells CCH UI that manual enable has proceeded and visualization should
+         * be handled according to events and provided result code.
+         *
+         * @since S60 5.0
+         * @param aServiceId service id of the service that the dialog is 
+         *        shown for. Service id is used to fetch service specific data.
+         * @param aEnableResult result of the enable operation. If enable specific
+                  error, error is handled here instead of event listening
+         */
+        void ManualEnableResultL( TUint32 aServiceId,
+            TInt aEnableResult );
+        
+        
+        // from base class MCchUi
+        
+        /**
+         * From MCchUi. 
+         * Adds observer for listening cchui events.
+         *
+         * @since S60 5.0
+         * @param aObserver Event observing class
+         */
+        void AddObserverL( MCchUiObserver& aObserver );
+        
+        /**
+         * From MCchUi.
+         * Removes the observer of cchui events.
+         * 
+         * @since S60 5.0
+         * @param aObserver Event observing class
+         */
+        void RemoveObserver( MCchUiObserver& aObserver );
+        
+        /**
+         * From MCchUi.
+         * Shows global note/dialog. See observer definition for available notes. 
+         *
+         * @since S60 5.0
+         * @param aServiceId service id of the service that the dialog is 
+         *        shown for. Service id is used to fetch service specific data.
+         * @param aDialog defines which dialog is shown.
+         * @leave KErrAlreadyExists Failed to show dialog because another 
+         * note already shown.
+         */
+        void ShowDialogL( 
+            TUint32 aServiceId, 
+            MCchUiObserver::TCchUiDialogType aDialog );
+        
+        /**
+         * From MCchUi.
+         * Allows client to configure visualization of connectivity events. This
+         * only effects the automatically shown connectivity notes. Client can
+         * still use separate methods in this API to show specific notes by
+         * itself. 
+         * 
+         * By default all notes are allowed.
+         *
+         * @since S60 5.0
+         * @param aAllowedNotes array of allowed notes
+         * @param aAllowedSubServices array of allowed subservices
+         */
+        void ConfigureVisualizationL( 
+            RArray<MCchUiObserver::TCchUiDialogType>& aAllowedNotes,
+            RArray<TCCHSubserviceType>& aAllowedSubServices );    
+        
+        /**
+         * From MCchUi.
+         * Cancels all notes shown by CCH UI. 
+         * If there is nothing to dismiss, call to this method does nothing.
+         *
+         * @since S60 5.0
+         */
+        void CancelNotes();   
+        
+        /**
+         * Reserved for future use.
+         *
+         * @since S60 5.0
+         */  
+        void Reserved1();  
+        
+        /**
+         * Reserved for future use.
+         *
+         * @since S60 5.0
+         */  
+        void Reserved2();  
+        
+    private: // Constructors
+    
+    	    /**
+    	    * C++ default constructor.
+    	    */
+    	    CCchUiPrivateApi();
+
+    	    /**
+    	    * By default Symbian 2nd phase constructor is private.
+    	    */
+    	    void ConstructL( CCch& aCch );
+        
+
+    private: // data
+
+        /**
+         * CCHUI API implementation.
+         * Own.
+         */
+        CCchUiApiImpl* iImpl;
+        
+    CCHUI_UNIT_TEST( UT_CchUi )
+    };
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchuispshandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,107 @@
+/*
+* 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:  Provides access to service provider settings
+*
+*/
+
+
+#ifndef C_CCHUISPSHANDLER_H
+#define C_CCHUISPSHANDLER_H
+
+#include <e32base.h>
+#include <e32const.h>
+
+class CSPSettings;
+
+/**
+ * Service provider settings handler.
+ * This class implements the use of Service provider settings.
+ *
+ * @code
+ *  CCchUiSpsHandler* spsHandler = CCchUiSpsHandler::NewLC();
+ *  spsHandler->SetTemporaryIapIdL( aServiceId, aIapId );
+ *  CleanupStack::PopAndDestroy( spsHandler );
+ * @endcode
+ *
+ * @lib cchui.lib
+ * @since S60 5.0
+ */
+NONSHARABLE_CLASS( CCchUiSpsHandler ): public CBase
+    {
+public:
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCchUiSpsHandler* NewL();
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CCchUiSpsHandler* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchUiSpsHandler();
+      
+    /**
+     * Sets temporary iap id for the sevice.
+     *
+     * @since S60 5.0
+     * @param aServiceId Service id.
+     * @param aIapId Iap id to be set.
+     */
+    void SetTemporaryIapIdL( 
+        TUint32 aServiceId, 
+        TUint32 aIapId );
+    
+    /**
+     * Sets SNAP id for specific service.
+     *
+     * @since S60 5.0
+     * @param aServiceId Service id.
+     * @param aSnapId Snap id to be set.
+     */
+    void SetSnapIdL( 
+        TUint32 aServiceId,
+        TUint32 aSnapId );    
+
+    /**
+     * Resolves service name.
+     *
+     * @since S60 5.0
+     * @param aServiceId Service id.
+     * @param aServiceName, will store service name
+     */
+    void ServiceNameL( 
+        TUint32 aServiceId, 
+        TDes& aServiceName );
+
+private:
+
+    CCchUiSpsHandler();
+    
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Service provider settings.
+     * Own.
+     */
+    CSPSettings* iSettings;
+    };
+
+#endif // C_CCHUISPSHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/cchuitimer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2009-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 for timer handling.
+*
+*/
+
+
+
+#ifndef C_CCHUITIMER_H
+#define C_CCHUITIMER_H
+
+#include <e32base.h> 
+
+#include "cchuicommon.hrh"
+
+class MCchUiTimerObserver;
+
+/**
+ * An instance of CCchUiTimer
+ * For timer handling.
+ *
+ * @lib cch.lib
+ * @since Series 60 5.0
+ */
+NONSHARABLE_CLASS( CCchUiTimer ) : public CTimer
+    {    
+    public:
+
+        /**
+         * Enumeration which indicates timer type
+         */
+        enum TTimerType
+            {
+            EReservedTimerType1 = 0
+            };
+    
+        /**
+         * Two-phased constructor.
+         */ 
+        static CCchUiTimer* NewL( 
+            MCchUiTimerObserver& aObserver );
+
+
+        /**
+         * Destructor.
+         */
+        virtual ~CCchUiTimer();
+
+        
+        /**
+         * Start timer.
+         *
+         * @since S60 v5.0
+         * @return KErrNone when timer started successfully
+         */
+        TInt StartTimer( TTimerType aType );
+        
+        
+        /**
+         * Stop timer.
+         *
+         * @since S60 v5.0
+         */
+        void StopTimer();
+        
+
+    protected: 
+    
+        // from base class CTimer
+        
+        /**
+         * From CTimer. Called when timer expires.
+         */
+        void RunL();
+        
+               
+    private:
+
+        CCchUiTimer( MCchUiTimerObserver& aObserver );
+
+        void ConstructL();
+        
+        
+    private:  // data
+        
+        /**
+         * Reference for observer.
+         */
+        MCchUiTimerObserver& iObserver;
+
+    CCHUI_UNIT_TEST( UT_CchUi )
+    };
+
+#endif // C_CCHUITIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/mcchuinoteresultobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* 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:  Internal note result observer definition
+*
+*/
+
+
+#ifndef M_CCHUINOTERESULTOBSERVER_H
+#define M_CCHUINOTERESULTOBSERVER_H
+
+#include <e32base.h>
+
+#include "cchuicommon.hrh"
+
+/**
+ * CCH UI note result observer.
+ *
+ * @code
+ *  inherit in header:
+ *  class CMyClass : public CBase, public MCchUiObserver
+ * @endcode
+ *
+ * @lib cchui.lib
+ * @since S60 5.0
+ */
+NONSHARABLE_CLASS( MCchUiNoteResultObserver )
+    {
+public:
+
+    /**
+     * Gets called when certain dialog has completed.
+     *
+     * @since S60 5.0
+     * @param aCompleteCode Complete code.
+     * @param aResultParams Result parameters of the completed dialog.
+     */
+    virtual void DialogCompletedL( 
+        TInt aCompleteCode, 
+        TCCHUiNotifierParams aResultParams ) = 0;
+    };
+
+
+#endif // M_CCHUINOTERESULTOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/inc/mcchuitimerobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2009-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:  Observer interface for notifying timer expiration
+*
+*/
+
+
+#ifndef M_CCHUITIMEROBSERVER_H
+#define M_CCHUITIMEROBSERVER_H
+
+#include "cchuitimer.h"
+
+/**
+ *  MCchUiTimerObserver class
+ *
+ *  Observer interface for notifying timer expiration.
+ *
+ *  @lib cch.lib
+ *  @since S60 v5.0
+ */
+class MCchUiTimerObserver
+    {
+    public:
+    
+        /**
+         * Should be called when the timer expires
+         *
+         * @since S60 v5.0
+         */
+        virtual void TimerExpired() = 0;            
+    };
+    
+#endif // M_CCHUITIMEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cch.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,161 @@
+/*
+* 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:  cch client api
+*
+*/
+
+
+// INCLUDE FILES
+#include "cch.h"
+#include "cchimpl.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCch::CCch
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCch::CCch() :
+iImplementation ( NULL )
+    {
+    
+    }
+    
+EXPORT_C CCch::~CCch()
+    {
+    delete iImplementation;
+    }
+
+// ---------------------------------------------------------------------------
+// CCch::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCch::ConstructL()
+    {
+    iImplementation = CCchImpl::NewL( *this );
+    
+    }
+// ---------------------------------------------------------------------------
+// CCch::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCch* CCch::NewL( )
+    {
+    CCch* self = CCch::NewLC( );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCch::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCch* CCch::NewLC( )
+    {
+    CCch* self = new (ELeave) CCch( );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCch::GetService
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCchService* CCch::GetService( TInt aId )
+	{
+	return iImplementation->GetService( aId );
+	}
+
+// ---------------------------------------------------------------------------
+// CCch::GetServiceIds
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCch::GetServiceIds( RArray<TInt>& aIds ) const
+	{
+	return iImplementation->GetServiceIds( aIds );
+	}
+
+// ---------------------------------------------------------------------------
+// CCch::GetServices
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CCch::GetServices( TCCHSubserviceType aType, 
+        RPointerArray<CCchService>& aServices )
+	{
+	return iImplementation->GetServices( aType, aServices );
+	}
+
+// ---------------------------------------------------------------------------
+// CCch::ConnectivityDialogsAllowed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CCch::ConnectivityDialogsAllowed() const
+    {
+    return iImplementation->ConnectivityDialogsAllowed();
+    }
+  
+// ---------------------------------------------------------------------------
+// CCch::SetConnectivityDialogsAllowed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCch::SetConnectivityDialogsAllowed( 
+    TBool aConnectivityDialogsAllowed )
+    {
+    iImplementation->SetConnectivityDialogsAllowed( 
+        aConnectivityDialogsAllowed );
+    }
+
+// ---------------------------------------------------------------------------
+// CCch::CchUiApi
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MCchUi& CCch::CchUiApi() const
+    {
+    return iImplementation->CchUiApi();
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchclientobserver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,334 @@
+/*
+* 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:  Cch client api
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchimpl.h"
+#include "cchclientobserver.h"
+#include "cchlogger.h"
+#include "cchserviceimpl.h"
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::CCchClientObserver
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCchClientObserver::CCchClientObserver( CCchServiceImpl& aCchService )
+: CActive ( EPriorityStandard )
+, iCchService( aCchService )
+, iBackwardSupportObserver( NULL )
+    {
+    CActiveScheduler::Add( this );
+    }
+    
+CCchClientObserver::~CCchClientObserver()
+    {
+    iObservers.Reset();
+
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCchClientObserver::ConstructL()
+    {
+    CCHLOGSTRING( "CCchClientObserver::ConstructL: IN" );
+
+    CCHLOGSTRING( "CCchClientObserver::ConstructL: OUT" );
+    }
+// ---------------------------------------------------------------------------
+// CCchClientObserver::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchClientObserver* CCchClientObserver::NewL( CCchServiceImpl& aCchService )
+    {
+    CCHLOGSTRING( "CCchClientObserver::NewL: IN" );
+    CCchClientObserver* self = 
+        CCchClientObserver::NewLC( aCchService );
+    CleanupStack::Pop( self );
+    CCHLOGSTRING( "CCchClientObserver::NewL: OUT" );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchClientObserver* CCchClientObserver::NewLC( CCchServiceImpl& aCchService )
+    {
+    CCHLOGSTRING( "CCchClientObserver::NewLC: IN" );
+    CCchClientObserver* self = 
+        new (ELeave) CCchClientObserver( aCchService );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CCHLOGSTRING( "CCchClientObserver::NewLC: OUT" );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::SetObserver
+// ---------------------------------------------------------------------------
+//
+void CCchClientObserver::SetObserver( MCchServiceStatusObserver& aObserver )
+    {
+    CCHLOGSTRING( "CCchClientObserver::SetObserver: IN - deprecated use AddObserver" );
+    
+    // This is for old API user support remove this when all are using new API
+    if( iBackwardSupportObserver )
+        {
+        // remove existing observer
+        CCHLOGSTRING( "CCchClientObserver::SetObserver: removing old observer" );
+        RemoveObserver();
+        }
+    
+    CCHLOGSTRING( "CCchClientObserver::SetObserver: adding new observer" );
+    // This is for old API user support remove this when all are using new API
+    AddObserver( aObserver );
+    iBackwardSupportObserver = &aObserver;
+
+    CCHLOGSTRING( "CCchClientObserver::SetObserver: OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCchClientObserver::RemoveObserver
+// ---------------------------------------------------------------------------
+//
+void CCchClientObserver::RemoveObserver( )
+    {    
+    CCHLOGSTRING( "CCchClientObserver::RemoveObserver: IN - deprecated use the one with parameter" );
+    
+    if( iBackwardSupportObserver )
+    	{
+    	// remove using observer set in SetObserver. This is for old API user support
+    	// remove this when all are using new API
+    	RemoveObserver( *iBackwardSupportObserver );
+    	iBackwardSupportObserver = NULL;
+    	}
+    
+    CCHLOGSTRING( "CCchClientObserver::RemoveObserver: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::AddObserver
+// ---------------------------------------------------------------------------
+//
+TInt CCchClientObserver::AddObserver( 
+    MCchServiceStatusObserver& aObserver )
+    {
+    CCHLOGSTRING2( "CCchClientObserver::AddObserver: IN count=%d", iObservers.Count() );
+    
+    TInt index = iObservers.Find( &aObserver );
+
+    // Insert if not already observing
+    if ( index == KErrNotFound )
+        {
+        CCHLOGSTRING( "CCchClientObserver::AddObserver: observer added" );
+        iObservers.Append( &aObserver );
+        }     
+    else
+        {
+        CCHLOGSTRING( "CCchClientObserver::AddObserver: observer KErrAlreadyExists" );
+        return KErrAlreadyExists;   
+        }
+
+    if ( iObservers.Count() )
+        {
+        if ( !IsActive() )
+            {
+            iCchService.CchImpl()->CchClient().SubscribeToEvents( 
+                    TServiceSelection( iCchService.ServiceId(), ECCHUnknown ), 
+                    iServiceStatus, 
+                    iStatus );
+            
+            CCHLOGSTRING( "CCchClientObserver::AddObserver: setting active" );
+            
+            SetActive();
+            }
+        
+        CCHLOGSTRING( "CCchClientObserver::AddObserver: subscrbing to events"  );
+      
+        }
+    else
+        {
+        CCHLOGSTRING( "CCchClientObserver::AddObserver: already subscribed subscrbing to events - skipping"  );
+        }
+    
+    CCHLOGSTRING2( "CCchClientObserver::AddObserver: OUT count=%d", iObservers.Count() );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::RemoveObserver
+// ---------------------------------------------------------------------------
+//
+TInt CCchClientObserver::RemoveObserver( 
+    MCchServiceStatusObserver& aObserver )
+    {
+    CCHLOGSTRING( "CCchClientObserver::RemoveObserver: IN" );
+    CCHLOGSTRING2( "CCchClientObserver::RemoveObserver IN: COUNT=%d", iObservers.Count() );
+    
+    TInt index = iObservers.Find( &aObserver );
+    
+    if ( index == KErrNotFound )
+        {
+        CCHLOGSTRING("CCchClientObserver::RemoveObserver - observer NOT found KErnotFound returned" );
+        return KErrNotFound;   
+        }
+    else
+        {
+        CCHLOGSTRING( "CCchClientObserver::RemoveObserver: removing observer"  );
+        
+        // Observer found.
+        iObservers.Remove( index );
+        iObservers.Compress();
+        
+        // Cancel subcribe to events and free up memory.
+        if ( !iObservers.Count() )
+            {
+            CCHLOGSTRING( "CCchClientObserver::RemoveObserver: unsubscrbing from events"  );                  
+            iCchService.CchImpl()->CchClient().SubscribeToEventsCancel( );      
+            iObservers.Reset();
+            }
+        }
+
+    CCHLOGSTRING2( "CCchClientObserver::RemoveObserver OUT: COUNT=%d", iObservers.Count() );
+    
+    CCHLOGSTRING( "CCchClientObserver::RemoveObserver: OUT" );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CCchClientObserver::DoCancel()
+    {
+    CCHLOGSTRING( "CCchClientObserver::DoCancel: IN" );
+	
+	CCHLOGSTRING( "CCchClientObserver::DoCancel: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::RunL
+// ---------------------------------------------------------------------------
+//
+void CCchClientObserver::RunL()
+    {
+    TServiceStatus serviceStatus = iServiceStatus();
+    CCHLOGSTRING( "CCchClientObserver::RunL: IN" );
+
+    //if someone is observing and correct service is changed
+    if ( iObservers.Count() && ( serviceStatus.ServiceId() == iCchService.ServiceId() ) )
+    	{
+    	TCchServiceStatus status;
+    	
+    	status.SetError( serviceStatus.iError );
+    	status.SetState( serviceStatus.iState );
+
+    	CCHLOGSTRING2( "CCchClientObserver::RunL: count=%d", iObservers.Count() );
+    	
+    	// If observer array can change while iterating it add support for that.
+    	// Then there is a need to iterate starting from beginning until done and save 
+    	// already notified observers etc
+    	TInt count( iObservers.Count() );
+    	
+ 	    for( TInt i=0; i < count; i++ )
+            {
+            CCHLOGSTRING2( "CCchClientObserver::RunL: looping observers: %d", i );
+            
+            // If some client removes observer in middle of iteration start from beginning of array again.
+            if ( count > iObservers.Count() )
+                {
+                CCHLOGSTRING( "CCchClientObserver::RunL: Start from beginning of array" );
+                
+                i = 0;
+                count = iObservers.Count();
+                }
+            
+            if( iObservers[ i ] )
+                {
+                CCHLOGSTRING2( "CCchClientObserver::RunL: send service status changed to client: %d", i );
+                iObservers[ i ]->ServiceStatusChanged( iCchService.ServiceId(), 
+                    serviceStatus.Type(), status );
+                }
+            }
+        }
+    
+    if ( iObservers.Count() )
+        {
+        if ( !IsActive() )
+            {
+            CCHLOGSTRING( "CCchClientObserver::RunL: Subscribing " );
+            iCchService.CchImpl()->CchClient().SubscribeToEvents( 
+                    TServiceSelection( iCchService.ServiceId(), ECCHUnknown ),
+                    iServiceStatus,
+                    iStatus );
+            
+            CCHLOGSTRING( "CCchClientObserver::RunL: Setting active" );
+            SetActive();    
+           }
+        } 
+
+
+    CCHLOGSTRING( "CCchClientObserver::RunL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CCchClientObserver::RunError( TInt /*aError*/ )
+    {
+    CCHLOGSTRING( "CCchClientObserver::RunError: IN OUT" );
+    return KErrNone;
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchimpl.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,434 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  cch client api implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchimpl.h"
+#include "cchlogger.h"
+#include "cch.h"
+#include "cchserviceimpl.h"
+
+#ifdef CCHAPI_USE_CCHUI
+#include "cchuiprivateapi.h"
+#endif
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCchImpl::CCchImpl
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCchImpl::CCchImpl()
+     : CActive ( EPriorityStandard ),
+       iCchUi(0), 
+       iConnectivityDialogsAllowed( EFalse )
+	{
+	CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchImpl::destructor
+// ---------------------------------------------------------------------------
+//    
+CCchImpl::~CCchImpl()
+    {
+    CCHLOGSTRING( "CCchImpl::~CCchImpl: IN" );
+    
+    delete iCchUi;
+
+    iCchServiceImpls.ResetAndDestroy();
+    iCchServiceImpls.Close();
+    Cancel();
+    
+    iCchClient.Close();
+    iCchServer.Close();
+    
+    CCHLOGSTRING( "CCchImpl::~CCchImpl: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchImpl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCchImpl::ConstructL( CCch& aCch )
+    {
+    CCHLOGSTRING( "CCchImpl::ConstructL: IN" );
+
+    User::LeaveIfError( iCchServer.Connect() );
+    User::LeaveIfError( iCchClient.Open( iCchServer ) );
+
+#ifdef CCHAPI_USE_CCHUI
+    iCchUi = CCchUiPrivateApi::NewL( aCch );
+#endif
+
+    iCchClient.RegisterToServer( iStatus );
+    SetActive();
+    
+    CCHLOGSTRING( "CCchImpl::ConstructL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchImpl::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchImpl* CCchImpl::NewL( CCch& aCch )
+    {
+    CCHLOGSTRING( "CCchImpl::NewL: IN" );
+    CCchImpl* self = 
+        CCchImpl::NewLC( aCch );
+    CleanupStack::Pop( self );
+    CCHLOGSTRING( "CCchImpl::NewL: OUT" );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchImpl::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchImpl* CCchImpl::NewLC( CCch& aCch )
+    {
+    CCHLOGSTRING( "CCchImpl::NewLC: IN" );
+    CCchImpl* self = 
+        new (ELeave) CCchImpl( );
+    CleanupStack::PushL( self );
+    self->ConstructL( aCch );
+    CCHLOGSTRING( "CCchImpl::NewLC: OUT" );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchImpl::NewLC
+// Returns the RCCHClient 
+// ---------------------------------------------------------------------------
+//
+RCCHClient& CCchImpl::CchClient( )
+	{
+	CCHLOGSTRING( "CCchImpl::CchClient: IN OUT" );
+	return iCchClient;
+	}
+
+// ---------------------------------------------------------------------------
+// CCchImpl::GetService
+// ---------------------------------------------------------------------------
+//
+CCchService* CCchImpl::GetService( TInt aId )
+	{
+	CCHLOGSTRING( "CCchImpl::GetService: IN" );
+	
+	CCchServiceImpl* cchServiceImpl = NULL;
+	
+	TInt idx = FindService( aId );
+	if( idx == KErrNotFound )
+		{
+		TInt error = KErrNone;
+	    TRAP( error, cchServiceImpl = GetServiceL( aId ) );
+		}
+	else
+		{
+		cchServiceImpl = iCchServiceImpls[ idx ];
+		}
+	CCHLOGSTRING( "CCchImpl::GetService: OUT" );
+	return cchServiceImpl;
+	}
+
+// ---------------------------------------------------------------------------
+// CCchImpl::GetServiceL
+// ---------------------------------------------------------------------------
+//
+CCchServiceImpl* CCchImpl::GetServiceL( TInt aId )
+	{
+	CCchServiceImpl* cchServiceImpl = NULL;	
+	
+	CArrayFixFlat<TCCHService>* cchServices =
+		new ( ELeave ) CArrayFixFlat<TCCHService>( 1 );
+	CleanupStack::PushL( cchServices );
+	if( KErrNone == GetCchServicesL( aId, ECCHUnknown , *cchServices ) )
+		{
+		if( cchServices->Count() )
+		    {
+    		TCCHService service = cchServices->At( 0 );
+    		cchServiceImpl = CCchServiceImpl::NewL( *this, 
+    		                                        service.iServiceId, 
+    		                                        *iCchUi );
+    		
+    		TInt error = iCchServiceImpls.Append( cchServiceImpl );
+    		if( error == KErrNone )
+    			{
+    			cchServiceImpl = iCchServiceImpls[ iCchServiceImpls.Count() - 1 ];
+    			}
+    		else
+    			{
+    			delete cchServiceImpl;
+    			cchServiceImpl = NULL;
+    			}
+		    }
+		}
+	cchServices->Reset();
+	CleanupStack::PopAndDestroy( cchServices );
+	return cchServiceImpl;
+	}
+
+
+// ---------------------------------------------------------------------------
+// CCchImpl::GetCchServiceL
+// ---------------------------------------------------------------------------
+//
+TInt CCchImpl::GetCchServicesL( TInt aServiceId, TCCHSubserviceType aType, 
+								CArrayFixFlat<TCCHService>& aServices )
+	{
+	TServiceSelection selection( aServiceId, aType, ECchInitial  );
+    TRequestStatus status = KErrNone;
+
+    iCchClient.GetServicesL( selection, aServices, status );			
+	//even the cchclient api seems to be asynchronous, 
+	//this method is completed immediately
+	User::WaitForRequest( status );
+	return status.Int();
+	}
+	
+// ---------------------------------------------------------------------------
+// CCchImpl::GetServiceIdsL
+// ---------------------------------------------------------------------------
+//
+void CCchImpl::GetServiceIdsL( RArray<TInt>& aIds )
+    {
+	CCHLOGSTRING( "CCchImpl::GetServiceIdsL: IN" );
+
+	TRequestStatus status( KErrNone );
+    CArrayFixFlat<TCCHService>* cchServices = new (ELeave) CArrayFixFlat<TCCHService>(1);
+    CleanupStack::PushL( cchServices );
+
+    iCchClient.GetServicesL( *cchServices, status );
+	    
+	//even the cchclient api seems to be asynchronous, 
+	//this method is completed immediately	
+	User::WaitForRequest( status );
+	if( KErrNone == status.Int() )
+		{
+		for ( TInt i = 0; i < cchServices->Count(); i++ )
+			{
+			TCCHService service = cchServices->At( i );
+			User::LeaveIfError( aIds.Append( service.iServiceId ) );
+			}
+		}
+	else
+		{
+		User::Leave( status.Int() );
+		}	
+    CleanupStack::PopAndDestroy( cchServices );
+
+	CCHLOGSTRING( "CCchImpl::GetServiceIdsL: OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCchImpl::GetServiceIds
+// ---------------------------------------------------------------------------
+//
+TInt CCchImpl::GetServiceIds( RArray<TInt>& aIds )
+	{
+	TRAPD( err, GetServiceIdsL( aIds ) );
+	
+	return err;
+	}
+
+// ---------------------------------------------------------------------------
+// CCchImpl::GetServices
+// ---------------------------------------------------------------------------
+//
+TInt CCchImpl::GetServices( TCCHSubserviceType aType, 
+        RPointerArray<CCchService>& aServices )
+	{
+	TInt err = KErrNone;
+	TRAP( err, GetServicesL( aType, aServices ) );
+	return err;
+	}
+
+// ---------------------------------------------------------------------------
+// CCchImpl::GetServicesL
+// ---------------------------------------------------------------------------
+//
+void CCchImpl::GetServicesL( TCCHSubserviceType aType, 
+        RPointerArray<CCchService>& aServices )
+    {
+    CCHLOGSTRING( "CCchImpl::GetServicesL: IN" );
+
+    CleanupClosePushL( aServices );  // CS: 1
+    
+    TInt error = KErrNone;
+    TServiceSelection selection( 0, aType, ECchInitial );
+
+    CCchServiceImpl* cchServiceImpl = NULL;
+    CArrayFixFlat<TCCHService>* cchServices;
+    cchServices = new (ELeave) CArrayFixFlat<TCCHService>(1);
+    CleanupStack::PushL( cchServices );  // CS: 2
+    error = GetCchServicesL( 0, aType, *cchServices );
+    
+    if( KErrNone == error )
+        {
+        for ( TInt i = 0; i < cchServices->Count(); i++ )
+            {
+            TCCHService service = cchServices->At( i );
+            TInt idx = FindService( service.iServiceId );
+            
+            if( KErrNotFound == idx )
+                {
+                cchServiceImpl = CCchServiceImpl::NewLC( *this, // CS: 3
+                    service.iServiceId, *iCchUi );
+                iCchServiceImpls.AppendL( cchServiceImpl );
+                CleanupStack::Pop( cchServiceImpl );  // CS: 2
+                }
+            else
+                {
+                cchServiceImpl = iCchServiceImpls[ idx ];
+                }
+            
+            aServices.AppendL( cchServiceImpl );
+            }
+        }
+    
+    cchServices->Reset();
+    CleanupStack::PopAndDestroy( cchServices );  // CS: 1
+    User::LeaveIfError( error );
+    CleanupStack::Pop( &aServices );  // CS: 0
+    
+    CCHLOGSTRING( "CCchImpl::GetServicesL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::FindService
+// ---------------------------------------------------------------------------
+//
+TInt CCchImpl::FindService( TInt aServiceId ) const
+    {
+    TBool exist = EFalse;
+    TInt index = KErrNotFound;
+    CCHLOGSTRING2( "CCchImpl::FindService: serviceId %d", aServiceId );
+    for ( TInt i = 0; i < iCchServiceImpls.Count() && !exist; i++ )
+        {
+        exist = iCchServiceImpls[i]->ServiceId() == aServiceId;
+        index = i;
+        }
+    return !exist ? KErrNotFound : index;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::ConnectivityDialogsAllowed
+// ---------------------------------------------------------------------------
+//
+TBool CCchImpl::ConnectivityDialogsAllowed() const
+    {
+    CCHLOGSTRING( "CCchImpl::ConnectivityDialogsAllowed" );
+    CCHLOGSTRING2( "  --> iConnectivityDialogsAllowed=%d", 
+        iConnectivityDialogsAllowed );
+    
+    return iConnectivityDialogsAllowed;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::SetConnectivityDialogsAllowed
+// ---------------------------------------------------------------------------
+//
+void CCchImpl::SetConnectivityDialogsAllowed( 
+    TBool aConnectivityDialogsAllowed )
+    {
+    iConnectivityDialogsAllowed = aConnectivityDialogsAllowed;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::CchUiApi
+// ---------------------------------------------------------------------------
+//
+MCchUi& CCchImpl::CchUiApi() const
+    {
+    return *iCchUi;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchImpl::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CCchImpl::DoCancel()
+    {
+    CCHLOGSTRING( "CCchImpl::DoCancel: IN" );
+	iCchClient.RegisterToServerCancel();
+	CCHLOGSTRING( "CCchImpl::DoCancel: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchImpl::RunL
+// ---------------------------------------------------------------------------
+//
+void CCchImpl::RunL()
+    {
+    CCHLOGSTRING( "CCchImpl::RunL: IN" );
+    if ( iStatus.Int() == KErrServerTerminated )
+        {
+        // clean
+        Cancel();
+        iCchClient.Close();
+        iCchServer.Close();
+        
+        // create new
+        User::LeaveIfError( iCchServer.Connect() );
+        User::LeaveIfError( iCchClient.Open( iCchServer ) );
+
+        iCchClient.RegisterToServer( iStatus );
+        SetActive();
+        }
+    CCHLOGSTRING( "CCchImpl::RunL: OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCchImpl::RunL
+// ---------------------------------------------------------------------------
+//
+TInt CCchImpl::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }    
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchserviceimpl.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,584 @@
+/*
+* 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:  Cch client api
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32def.h>
+
+#include "cchserviceimpl.h"
+#include "cchlogger.h"
+#include "cchimpl.h"
+#include "cchclientobserver.h"
+#include "cchclientserverinternal.h"
+#include "cchserviceimplasynchroniser.h"
+
+#ifdef CCHAPI_USE_CCHUI
+#include "cchuiprivateapi.h"
+#endif
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::CCchServiceImpl
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCchServiceImpl::CCchServiceImpl( CCchImpl& aCch, 
+                                  TInt aServiceId, 
+                                  CCchUiPrivateApi& aCchUi )
+    : iCch( aCch ), 
+      iServiceId( aServiceId ), 
+      iCchUi( aCchUi )
+	{
+	
+    }
+    
+CCchServiceImpl::~CCchServiceImpl()
+    {
+    if( iObserver )
+    	{
+    	RemoveObserver();
+    	}
+    delete iObserver;
+    delete iAsynchroniser;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCchServiceImpl::ConstructL()
+    {
+    CCHLOGSTRING( "CCchServiceImpl::ConstructL: IN" );
+    iObserver = CCchClientObserver::NewL( *this );
+    iAsynchroniser = CCchServiceImplAsynchroniser::NewL(iCch, iServiceId, iCchUi );
+    CCHLOGSTRING( "CCchServiceImpl::ConstructL: OUT" );
+    }
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchServiceImpl* CCchServiceImpl::NewL( CCchImpl& aCch, 
+                                        TInt aServiceId,
+                                        CCchUiPrivateApi& aCchUi )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::NewL: IN" );
+    CCchServiceImpl* self = 
+        CCchServiceImpl::NewLC( aCch, aServiceId, aCchUi );
+    CleanupStack::Pop( self );
+    CCHLOGSTRING( "CCchServiceImpl::NewL: OUT" );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchServiceImpl* CCchServiceImpl::NewLC( CCchImpl& aCch, TInt aServiceId,
+    CCchUiPrivateApi& aCchUi )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::NewLC: IN" );
+    CCchServiceImpl* self = 
+        new (ELeave) CCchServiceImpl( aCch, aServiceId, aCchUi );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CCHLOGSTRING( "CCchServiceImpl::NewLC: OUT" );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::Enable
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::Enable( TCCHSubserviceType aType )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::Enable: IN" );
+    TInt error = KErrNone;
+    if (iCch.ConnectivityDialogsAllowed())
+        {
+        CCHLOGSTRING( "CCchServiceImpl::Enable: Async mode" );
+        iAsynchroniser->Enable(aType);
+        }
+    else
+        {
+        CCHLOGSTRING( "CCchServiceImpl::Enable: Sync mode" );
+        TServiceSelection selection( iServiceId, aType );
+        TRequestStatus status = KErrNone;
+        iCch.CchClient().EnableService( selection, status, EFalse );
+   
+        //even the cchclient api seems to be asynchronous, 
+        //this method is completed immediately
+        User::WaitForRequest( status );
+        error = status.Int();
+        }
+        
+    CCHLOGSTRING2( " CCchServiceImpl::Enable: return  %d", error );
+    
+	CCHLOGSTRING( "CCchServiceImpl::Enable: OUT" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::Disable
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::Disable( TCCHSubserviceType aType )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::Disable: IN" );
+  
+    iAsynchroniser->Disable(aType);
+    CCHLOGSTRING( "CCchServiceImpl::Disable: OUT" );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::GetStatus
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::GetStatus( TCCHSubserviceType aType, 
+                                 TCchServiceStatus& aStatus ) const
+    {
+    CCHLOGSTRING( "CCchServiceImpl::GetStatus: IN" );
+    TCCHSubserviceState state( ECCHUninitialized );
+    TServiceSelection selection( iServiceId, aType );
+    TInt error = iCch.CchClient().GetServiceState( selection, state );
+    //if this is a cch error, return it in the structure, otherwise in return
+    if( KCCHErrorInvalidIap >= error || KErrNone == error )
+    	{
+        aStatus.SetError( error );
+        aStatus.SetState( state );
+        error = KErrNone;
+    	}
+    CCHLOGSTRING( "CCchServiceImpl::GetStatus: OUT" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::GetConnectionParameter
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::GetConnectionParameter( TCCHSubserviceType aType, 
+		TCchConnectionParameter aParameter, TInt& aValue ) const
+    {
+    CCHLOGSTRING( "CCchServiceImpl::GetConnectionParameter: IN" );
+    TRequestStatus status = KErrNone;
+    
+    switch( aParameter )
+    {
+    	case ECchIapId:
+    	case ECchSnapId:
+    	case ECchSnapLocked:
+        case ECchPasswordSet:
+        case ECchReserved:
+    		{
+    		TServiceSelection selection( iServiceId, aType, aParameter );
+    	    TServiceConnectionInfo serviceConnInfo;
+    	    TPckgBuf<TServiceConnectionInfo> serviceConnInfoPckg;
+    	    
+    		iCch.CchClient().GetConnectionInfo( selection, 
+    	    		serviceConnInfoPckg, status );
+    	    //even the cchclient api seems to be asynchronous, 
+    		//this method is completed immediately
+    		User::WaitForRequest( status );
+    		if ( KErrNone == status.Int() )
+    	        {
+    	        serviceConnInfo = serviceConnInfoPckg();
+    	        if( ECchSnapId == aParameter )
+    	        	{
+    	        	aValue = serviceConnInfo.iSNAPId;
+    	        	}
+    	        else if( ECchIapId == aParameter )
+    	        	{
+    	        	aValue = serviceConnInfo.iIapId;
+    	        	}
+    	        else if( ECchSnapLocked == aParameter )
+    	        	{
+    	        	aValue = serviceConnInfo.iSNAPLocked;
+    	        	}
+    	        else  if( ECchPasswordSet == aParameter )
+                    {
+                    aValue = serviceConnInfo.iPasswordSet;
+                    }
+                else  if( ECchReserved == aParameter )
+                    {
+                    aValue = serviceConnInfo.iReserved;
+                    }
+    	        }
+    		}
+    		break;
+        default:
+            {
+            status = KErrArgument;
+            }
+            break;
+    }
+    
+	CCHLOGSTRING( "CCchServiceImpl::GetConnectionParameter: OUT" );
+    return status.Int();
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::SetConnectionParameter
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::SetConnectionParameter( TCCHSubserviceType aType, 
+		TCchConnectionParameter aParameter, TInt aValue )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::SetConnectionParameter: IN" );
+    TPckgBuf<TServiceConnectionInfo> serviceConnInfoPckg;
+    TRequestStatus status = KErrNone;
+    TInt error = KErrNone;
+    
+    switch( aParameter )
+    {
+    	case ECchIapId:
+    	case ECchSnapId:
+        case ECchReserved:
+    		{
+    		serviceConnInfoPckg().SetServiceId( iServiceId );
+    	    serviceConnInfoPckg().SetType( aType );
+    	    if( ECchSnapId == aParameter )
+	        	{
+	        	serviceConnInfoPckg().iSNAPId = aValue;
+	        	}
+	        else if ( ECchIapId == aParameter )
+	        	{
+	        	serviceConnInfoPckg().iIapId = aValue;
+	        	}
+            else  // ECchReserved == aParameter
+                {
+                serviceConnInfoPckg().SetParameter( aParameter );
+                serviceConnInfoPckg().iReserved = aValue;
+                }
+    	    iCch.CchClient().SetConnectionInfo( serviceConnInfoPckg, status );
+    	    //even the cchclient api seems to be asynchronous, 
+    		//this method is completed immediately
+    		User::WaitForRequest( status );
+    		error = status.Int();
+    		}
+    		break;
+    	case ECchSnapLocked:
+        case ECchPasswordSet:
+    		{
+    		error = KErrNotSupported;
+    		}
+    		break;
+        default:
+            {
+            error = KErrArgument;
+            }
+            break;
+    }
+    
+    CCHLOGSTRING( "CCchServiceImpl::SetConnectionParameter: OUT" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::GetConnectionParameters
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::GetConnectionParameter( TCCHSubserviceType aType, 
+		TCchConnectionParameter aParameter, RBuf& aValue ) const
+    {
+    CCHLOGSTRING( "CCchServiceImpl::GetConnectionParameter: IN" );
+    TServiceSelection selection( iServiceId, aType, aParameter );
+    TRequestStatus status = KErrNone;
+    TInt error = KErrNone; 
+    
+    switch( aParameter )
+    {
+        case ECchServiceInfo:
+    		{
+    		error = iCch.CchClient().GetServiceInfo( selection, aValue );
+    		}
+    		break;
+
+        case ECchUsername:
+            {
+            TServiceConnectionInfo serviceConnInfo;
+            TPckgBuf<TServiceConnectionInfo> serviceConnInfoPckg;
+            
+            iCch.CchClient().GetConnectionInfo( selection,serviceConnInfoPckg, status );
+            //even the cchclient api seems to be asynchronous, 
+            //this method is completed immediately
+            User::WaitForRequest( status );
+
+            serviceConnInfo = serviceConnInfoPckg();
+            aValue = serviceConnInfo.iUsername;
+            }
+            break;
+        case ECchPassword:
+            {
+            error = KErrNotSupported;
+            }
+            break;
+        default:
+            {
+            error = KErrArgument;
+    		}
+    		break;
+    }
+    
+	CCHLOGSTRING( "CCchServiceImpl::GetConnectionParameter: OUT" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::SetConnectionParameters
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::SetConnectionParameter( TCCHSubserviceType aType, 
+		TCchConnectionParameter aParameter, const TDesC& aValue )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::SetConnectionParameter: IN" );
+    CCHLOGSTRING2( "    aValue:     %S", &aValue );
+
+    // Type of subservice has to be ECCHUnknown for username and password
+    __ASSERT_ALWAYS( aType == ECCHUnknown,
+                    User::Panic( KNullDesC, KErrArgument ) );
+    
+    TPckgBuf<TServiceConnectionInfo> serviceConnInfoPckg;
+    TRequestStatus status = KErrNone;
+    TInt error = KErrNone;
+
+    switch( aParameter )
+    {
+        case ECchUsername:
+            {
+            serviceConnInfoPckg().SetServiceId( iServiceId );
+            serviceConnInfoPckg().SetType( aType );
+            serviceConnInfoPckg().SetParameter( aParameter );
+
+            if ( aValue.Length() < KCCHMaxUsernameLength )
+                {
+                serviceConnInfoPckg().iUsername.Append( aValue );
+                
+                iCch.CchClient().SetConnectionInfo( serviceConnInfoPckg, status );
+                //even the cchclient api seems to be asynchronous, 
+                //this method is completed immediately
+                User::WaitForRequest( status );
+                error = status.Int();
+                }
+            else
+                {
+                error = KErrArgument;
+                }
+            }
+            break;
+        case ECchPassword:
+            {
+            serviceConnInfoPckg().SetServiceId( iServiceId );
+            serviceConnInfoPckg().SetType( aType );
+            serviceConnInfoPckg().SetParameter( aParameter );
+            if ( aValue.Length() < KCCHMaxPasswordLength )
+                {
+                serviceConnInfoPckg().iPassword.Append( aValue );
+                
+                iCch.CchClient().SetConnectionInfo( serviceConnInfoPckg, status );
+                //even the cchclient api seems to be asynchronous, 
+                //this method is completed immediately
+                User::WaitForRequest( status );
+                error = status.Int();
+                }
+            else
+                {
+                error = KErrArgument;
+                }
+            }
+            break;
+        default:
+            {
+            error = KErrArgument;
+            }
+            break;
+    }
+    
+    CCHLOGSTRING( "CCchServiceImpl::SetConnectionParameter: OUT" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::Reserve
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::Reserve( TCCHSubserviceType aType )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::Reserve: IN" );
+    TServiceSelection selection( iServiceId, aType );
+    TInt error = iCch.CchClient().ReserveService( selection );
+    CCHLOGSTRING( "CCchServiceImpl::Reserve: OUT" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::Free
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::Free( TCCHSubserviceType aType )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::Free: IN" );
+    TServiceSelection selection( iServiceId, aType );
+    TInt error = iCch.CchClient().FreeService( selection );
+    CCHLOGSTRING( "CCchServiceImpl::Free: OUT" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::IsReserved
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::IsReserved( TCCHSubserviceType aType, 
+                                   TBool& aReserved ) const
+    {
+    CCHLOGSTRING( "CCchServiceImpl::IsReserved: IN" );
+    TServiceSelection selection( iServiceId, aType );
+    aReserved = iCch.CchClient().IsReserved( selection );
+    CCHLOGSTRING( "CCchServiceImpl::IsReserved: OUT" );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::ServiceId
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::ServiceId() const
+    {
+    CCHLOGSTRING( "CCchServiceImpl::ServiceId: IN" );
+    return iServiceId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchServiceImpl::IsSupported
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::IsSupported( TCCHSubserviceType aType, 
+                                   TBool& aSupported ) const
+    {
+    CCHLOGSTRING( "CCchServiceImpl::IsSupported: IN" );
+    TCCHSubserviceState state( ECCHUninitialized );
+    TServiceSelection selection( iServiceId, aType );
+    TInt error = iCch.CchClient().GetServiceState( selection, state );
+    if( error == KErrNone ||
+    	error <= KCCHErrorInvalidIap ) // cch errors are ok
+    	{
+    	aSupported = ETrue;
+    	}
+    else
+    	{
+    	aSupported = EFalse;
+    	}
+	
+	CCHLOGSTRING( "CCchServiceImpl::IsSupported: OUT" );
+    return error;
+    }      
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::SetObserver
+// ---------------------------------------------------------------------------
+//
+void CCchServiceImpl::SetObserver( MCchServiceStatusObserver& aObserver )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::SetObserver: IN - deprecated - do not use this anymore " );
+    iObserver->SetObserver( aObserver );
+    CCHLOGSTRING( "CCchServiceImpl::SetObserver: OUT  - deprecated - do not use this anymore " );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCchClientObserver::RemoveObserver
+// ---------------------------------------------------------------------------
+//
+void CCchServiceImpl::RemoveObserver( )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::RemoveObserver: IN - deprecated - do not use this anymore " );
+    iObserver->RemoveObserver( );
+    CCHLOGSTRING( "CCchServiceImpl::RemoveObserver: OUT - deprecated - do not use this anymore " );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::AddObserver
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::AddObserver( 
+                      MCchServiceStatusObserver& aObserver )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::AddObserver: IN" );
+    TInt err = iObserver->AddObserver( aObserver );
+    CCHLOGSTRING( "CCchServiceImpl::AddObserver: OUT" );
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::RemoveObserver
+// ---------------------------------------------------------------------------
+//
+TInt CCchServiceImpl::RemoveObserver( 
+                     MCchServiceStatusObserver& aObserver )
+    {
+    CCHLOGSTRING( "CCchServiceImpl::RemoveObserver: IN" );
+    TInt err = iObserver->RemoveObserver( aObserver );
+    CCHLOGSTRING( "CCchServiceImpl::RemoveObserver: OUT" );
+    
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCchClientObserver::CchImpl
+// ---------------------------------------------------------------------------
+//
+CCchImpl* CCchServiceImpl::CchImpl() const
+	{
+	return &iCch;
+	}
+
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchserviceimplasynchroniser.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,143 @@
+/*
+* 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:  cch client api implementation
+*
+*/
+
+
+#include "cchserviceimplasynchroniser.h"
+#include "cchlogger.h"
+
+CCchServiceImplAsynchroniser::CCchServiceImplAsynchroniser(CCchImpl& aCch, TInt aServiceId, CCchUiPrivateApi& aCchUi) :
+    CActive(EPriorityStandard),// Standard priority
+    iCch( aCch ),
+    iServiceId( aServiceId ),
+    iCchUi( aCchUi ),
+    iState ( EIdle )
+
+    {
+    }
+
+CCchServiceImplAsynchroniser* CCchServiceImplAsynchroniser::NewLC(CCchImpl& aCch, TInt aServiceId, CCchUiPrivateApi& aCchUi)
+    {
+    CCchServiceImplAsynchroniser* self =
+            new (ELeave) CCchServiceImplAsynchroniser(aCch, aServiceId, aCchUi );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+CCchServiceImplAsynchroniser* CCchServiceImplAsynchroniser::NewL(CCchImpl& aCch, TInt aServiceId, CCchUiPrivateApi& aCchUi)
+    {
+    CCchServiceImplAsynchroniser* self =
+            CCchServiceImplAsynchroniser::NewLC(aCch, aServiceId, aCchUi );
+    CleanupStack::Pop(); // self;
+    return self;
+    }
+
+void CCchServiceImplAsynchroniser::Enable( TCCHSubserviceType aType )
+    {
+    CCHLOGSTRING( "CCchServiceImplAsynchroniser::Enable IN" );
+    if (iState == EIdle)
+        {
+        iState = EEnabling;
+        TServiceSelection selection( iServiceId, aType );
+        SetActive();
+        iCch.CchClient().EnableService( selection, iStatus, EFalse );
+        }
+    else
+        {
+        CCHLOGSTRING( "CCchServiceImplAsynchroniser already active" );
+        }
+    CCHLOGSTRING( "CCchServiceImplAsynchroniser::Enable OUT" );
+    }
+
+void CCchServiceImplAsynchroniser::Disable( TCCHSubserviceType aType )
+    {
+    CCHLOGSTRING( "CCchServiceImplAsynchroniser::Disable IN" );
+    if (iState != EIdle)
+        {
+        Cancel();
+        }
+        iState = EDisabling;
+        TRequestStatus status = KErrNone;
+        TServiceSelection selection( iServiceId, aType );
+        SetActive();
+        iCch.CchClient().DisableService( selection, iStatus );
+
+    CCHLOGSTRING( "CCchServiceImplAsynchroniser::Disable OUT" );
+    }
+
+
+void CCchServiceImplAsynchroniser::ConstructL()
+    {
+       CActiveScheduler::Add(this); // Add to scheduler
+    }
+
+CCchServiceImplAsynchroniser::~CCchServiceImplAsynchroniser()
+    {
+    Cancel(); // Cancel any request, if outstanding
+    // Delete instance variables if any
+    }
+
+void CCchServiceImplAsynchroniser::DoCancel()
+    {
+    if ( EEnabling == iState ) 
+            { 
+            iCch.CchClient().EnableServiceCancel(); 
+            } 
+        else if ( EDisabling == iState ) 
+            { 
+            iCch.CchClient().DisableServiceCancel(); 
+            } 
+    }
+
+void CCchServiceImplAsynchroniser::RunL()
+    {
+	CCHLOGSTRING( "CCchServiceImplAsynchroniser::RunL IN" );
+    if (iStatus.Int() != KErrCancel)
+        {
+        switch (iState)
+            {
+            case EEnabling:
+                {
+                if ( iCch.ConnectivityDialogsAllowed() )
+                    {
+                    iCchUi.ManualEnableResultL( iServiceId, iStatus.Int() );
+                    }
+                CCHLOGSTRING( "CCchServiceImplAsynchroniser::RunL EEnabling done" );
+                iState = EIdle;
+                break;
+                }
+            case EDisabling:
+                {
+				CCHLOGSTRING( "CCchServiceImplAsynchroniser::RunL EDisabling done" );
+                iState = EIdle;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+
+            }
+        }
+    iState = EIdle;
+    CCHLOGSTRING( "CCchServiceImplAsynchroniser::RunL OUT" );
+    }
+
+TInt CCchServiceImplAsynchroniser::RunError(TInt aError)
+    {
+    return aError;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchtypes.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,95 @@
+/*
+* 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:  Cch basic types
+*
+*/
+
+
+// INCLUDE FILES
+#include "cch.h"
+#include "cchtypes.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// --------------------------------------------------------------------------
+// TCchServiceStatus::TCchServiceStatus
+// --------------------------------------------------------------------------
+//
+EXPORT_C TCchServiceStatus::TCchServiceStatus()
+: iState( ECCHUninitialized )
+, iError( KErrNone )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// TCchServiceStatus::State
+// --------------------------------------------------------------------------
+//
+EXPORT_C TCCHSubserviceState TCchServiceStatus::State() const
+	{ 
+	return iState; 
+	}
+
+// --------------------------------------------------------------------------
+// TCchServiceStatus::Error
+// --------------------------------------------------------------------------
+//	
+EXPORT_C TInt TCchServiceStatus::Error() const
+	{ 
+	return iError; 
+	}
+
+// --------------------------------------------------------------------------
+// TCchServiceStatus::SetState
+// --------------------------------------------------------------------------
+//
+EXPORT_C void TCchServiceStatus::SetState( TCCHSubserviceState aState )
+	{ 
+	iState = aState; 
+	}
+
+// --------------------------------------------------------------------------
+// TCchServiceStatus::SetError
+// --------------------------------------------------------------------------
+//
+EXPORT_C void TCchServiceStatus::SetError( TInt aError )
+	{ 
+	iError = aError; 
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchuiapiimpl.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1387 @@
+/*
+* 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:  Implementation of class CCchUiApiImpl.
+*
+*/
+
+
+#include "cchuilogger.h"
+#include "cchuiapiimpl.h"
+#include "cchuiobserver.h"
+#include "cchuispshandler.h"
+#include "cchuicchhandler.h"
+#include "cchuinotehandler.h"
+#include "cchuiclientobserver.h"
+#include "cchuiconnectionhandler.h"
+
+const TInt KServiceNameMaxLength = 255;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CCchUiApiImpl* CCchUiApiImpl::NewL( CCch& aCch )
+    {
+    CCchUiApiImpl* cchUiApiImpl = 
+        new ( ELeave ) CCchUiApiImpl();
+    CleanupStack::PushL( cchUiApiImpl );
+    cchUiApiImpl->ConstructL( aCch );
+    CleanupStack::Pop( cchUiApiImpl ); 
+    return cchUiApiImpl;
+    }    
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CCchUiApiImpl::CCchUiApiImpl(): 
+    iReEnableService( EFalse ),
+    iRemovableConnection( KErrNone ),
+    iObservedService( 0 )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::ConstructL( CCch& aCch )
+    {
+    iCCHHandler = CCchUiCchHandler::NewL( aCch );    
+    iSpsHandler = CCchUiSpsHandler::NewL();
+    iNoteController = CCCHUiNoteHandler::NewL( *this );
+    iConnectionHandler = CCchUiConnectionHandler::NewL( 
+        *iCCHHandler, *iSpsHandler );
+    // voip sub service is by default the supported one. 
+    // Client can overwrite these
+    iAllowedSubServices.AppendL( ECCHVoIPSub );   
+    
+    iLastOperationResult = 
+          MCchUiObserver::ECchUiClientOperationResultNotSet;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCchUiApiImpl::~CCchUiApiImpl()
+    {    
+    if ( iObservedService && iCCHHandler )
+        {
+        TRAP_IGNORE( iCCHHandler->StopObservingL( 
+           iObservedService, *this ) );
+        }
+    
+    iAllowedNotes.Close();
+    iAllowedSubServices.Close();    
+    iObservervedServices.Close();
+    iObservers.ResetAndDestroy();
+    iObservers.Close();
+    delete iCCHHandler;
+    delete iNoteController;
+    delete iSpsHandler;
+    delete iConnectionHandler;      
+    }
+
+// ---------------------------------------------------------------------------
+// AddObserver.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::AddObserverL( MCchUiObserver& aObserver  )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::AddObserver - IN"); 
+        
+    // Check if already exists
+    TBool alreadyExists = EFalse;
+    for ( TInt i( 0 ) ; i < iObservers.Count() ; i++ )
+        {        
+        if ( &aObserver == &iObservers[ i ]->Observer() )
+            {
+            CCHUIDEBUG( "AddObserver - already exists");           
+            alreadyExists = ETrue;
+            }
+        }
+    
+    if ( !alreadyExists )
+        {
+        CCHUIDEBUG( "AddObserver - add observer"); 
+        
+        CCchUiClientObserver* capsulatedObs = 
+            CCchUiClientObserver::NewLC( aObserver );
+        
+        iObservers.AppendL( capsulatedObs );     
+        CleanupStack::Pop( capsulatedObs );
+        } 
+    
+    CCHUIDEBUG( "CCchUiApiImpl::AddObserver - OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// RemoveObserver.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::RemoveObserver( MCchUiObserver& aObserver  )
+    {
+    for ( TInt i = 0 ; i < iObservers.Count() ; i++ )
+        {
+        if ( &aObserver == &iObservers[ i ]->Observer() )
+            {           
+            delete iObservers[ i ];
+            iObservers.Remove( i );
+               
+            CCHUIDEBUG( "RemoveObserver - observer removed" );
+            }
+        }
+    iObservers.Compress();
+    }
+
+// ---------------------------------------------------------------------------
+// Show dialog.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::ShowDialogL( 
+    TUint32 aServiceId, 
+    MCchUiObserver::TCchUiDialogType aDialog )
+    {
+    CCHUIDEBUG2( "CCchUiApiImpl::ShowDialogL - aServiceId: %d", 
+        aServiceId );            
+    CCHUIDEBUG2( "CCchUiApiImpl::ShowDialogL - aDialog: %d", 
+        aDialog );      
+    
+    TInt err( KErrNone );
+    
+    // Get current connection iap id
+    TInt iapId( KErrNone );
+    iCCHHandler->GetCurrentConnectionIapIdL(
+        aServiceId, ECCHUnknown, iapId, err );
+    
+    // Get current service username
+    RBuf userName;
+    CleanupClosePushL( userName );
+    userName.CreateL( KServiceNameLength );
+    iCCHHandler->GetUsernameL( aServiceId, userName, err );
+    
+    if ( KErrNone == err || KErrNotFound == err )
+        {
+        CCHUIDEBUG( "ShowDialogL -Launch note" );
+        iNoteController->LaunchNoteL( aDialog, aServiceId, iapId, userName );
+        }
+    else // leave if error code other that KErrNone or KErrNotFound
+        {
+        CCHUIDEBUG2( "ShowDialogL - leave with err=%d", err );
+        User::Leave( err );
+        }
+    
+    CleanupStack::PopAndDestroy( &userName );
+    }
+    
+// ---------------------------------------------------------------------------
+// Get currently showing dialog.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::ConfigureVisualizationL( 
+    RArray<MCchUiObserver::TCchUiDialogType>& aAllowedNotes,
+    RArray<TCCHSubserviceType>& aAllowedSubServices )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::ConfigureVisualizationL - IN" );
+    
+    CCHUIDEBUG2( "ConfigureVisualizationL - aAllowedNotes count=%d", 
+        aAllowedNotes.Count() );
+    CCHUIDEBUG2( "ConfigureVisualizationL - aAllowedSubServices count=%d", 
+        aAllowedSubServices.Count() );
+    
+    TBool subServicesHandled = EFalse;
+    TBool dialogsHandled = EFalse;
+    
+    // Reset old data
+    iAllowedNotes.Reset();
+    iAllowedSubServices.Reset();
+
+    if ( KErrNotFound != aAllowedNotes.Find( 
+        MCchUiObserver::ECchUiDialogTypeNotSet ) )
+        {
+        CCHUIDEBUG( "ConfigureVisualizationL - all dialogs are supported" );
+        dialogsHandled = ETrue;
+        }
+    
+    for ( TInt noteIndex = 0 ; 
+          noteIndex < aAllowedNotes.Count() && !dialogsHandled ; 
+          noteIndex++ )
+        {
+        CCHUIDEBUG2( "ConfigureVisualizationL - appending allowed note: %d",
+            aAllowedNotes[ noteIndex ] );
+        iAllowedNotes.AppendL( aAllowedNotes[ noteIndex ] );
+        }
+    
+    if ( KErrNotFound != aAllowedSubServices.Find( ECCHUnknown ) )
+        {
+        CCHUIDEBUG( 
+            "ConfigureVisualizationL - all sub services are supported" );
+        iAllowedSubServices.AppendL( ECCHUnknown );
+        subServicesHandled = ETrue;
+        }
+    for ( TInt servIndex = 0 ; 
+          servIndex < aAllowedSubServices.Count() && subServicesHandled ; 
+          servIndex++ )
+        {
+        CCHUIDEBUG2( 
+            "ConfigureVisualizationL - appending allowed sub service: %d", 
+            aAllowedSubServices[ servIndex ] );
+        iAllowedSubServices.AppendL( aAllowedSubServices[ servIndex ] );
+        }    
+    
+    CCHUIDEBUG( "CCchUiApiImpl::ConfigureVisualizationL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Cancel notes/dialogs.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::CancelNotes()
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::CancelNotes" );            
+    iNoteController->CancelOldNotes();
+    }
+
+// ---------------------------------------------------------------------------
+// Manual enable has proceeded
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::ManualEnableResultL( 
+    TUint aServiceId, 
+    TInt aEnableResult )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::ManualEnableResultL - IN" );    
+        
+    if ( KErrNone == aEnableResult )
+        {
+        CCHUIDEBUG( "ManualEnableStartedL - start observing service" );
+        iCCHHandler->StartObservingL( aServiceId, *this );   
+          
+        iObservedService = aServiceId;
+               
+        // Check if id already exists in observed services
+        TInt err = iObservervedServices.Find( aServiceId ); 
+               
+        // Append id only if it is not found.
+        if ( KErrNotFound == err )
+            {
+            CCHUIDEBUG( "ManualEnableStartedL - add to observerd services" );
+            iObservervedServices.AppendL( aServiceId );
+            }   
+        }
+    else
+        {
+        HandleManualEnableErrorL( aServiceId, aEnableResult );
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::ManualEnableStartedL - OUT" );    
+    }    
+   
+// ---------------------------------------------------------------------------
+// Manual enable error handling.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::HandleManualEnableErrorL( 
+    TUint aServiceId, 
+    TInt aEnableResult )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::HandleManualEnableErrorL - IN" );    
+    CCHUIDEBUG2( "  ---> aEnableResult: %d", aEnableResult );
+    
+    MCchUiObserver::TCchUiDialogType dialogType = 
+        MCchUiObserver::ECchUiDialogTypeNotSet;
+    
+    switch ( aEnableResult )
+        {
+        case KCCHErrorAccessPointNotDefined:
+            {
+            dialogType = MCchUiObserver::ECchUiDialogTypeNoConnectionDefined;
+            }
+            break;
+        case KCCHErrorAuthenticationFailed:
+            {
+            dialogType = MCchUiObserver::ECchUiDialogTypeAuthenticationFailed;    
+            }
+            break;
+        case KCCHErrorInvalidSettings:
+            {
+            dialogType = MCchUiObserver::ECchUiDialogTypeDefectiveSettings;            
+            }
+            break;
+            
+        case KCCHErrorBandwidthInsufficient:
+            {
+            dialogType = MCchUiObserver::ECchUiDialogTypeErrorInConnection; 
+            }
+            break;
+        case KCCHErrorInvalidIap:
+        case KCCHErrorNetworkLost:
+        case KCCHErrorServiceNotResponding:
+            {
+            dialogType = MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable;
+            }
+            break;           
+        default:
+            break;
+        }
+    
+    // show dialog if dialog type set and dialog allowed
+    if ( ( MCchUiObserver::ECchUiDialogTypeNotSet != dialogType ) &&
+        ( DialogIsAllowed( dialogType ) ) )
+        {
+        ShowDialogL( aServiceId, dialogType );
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::HandleManualEnableErrorL - OUT" );    
+    }
+
+// ---------------------------------------------------------------------------
+// Handle dialog completed situation.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::DialogCompletedL( 
+    TInt aCompleteCode, 
+    TCCHUiNotifierParams aResultParams )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::DialogCompletedL - IN");            
+    CCHUIDEBUG2( "DialogCompletedL - complete code=%d", aCompleteCode );            
+    CCHUIDEBUG2( "DialogCompletedL - dialog mode=%d", 
+            aResultParams.iDialogMode  );        
+    
+    switch ( aResultParams.iDialogMode )
+        {        
+        case MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed:
+            {
+            // Show username/password query.
+            __ASSERT_ALWAYS( DialogIsAllowed( 
+                MCchUiObserver::ECchUiDialogTypeAuthenticationFailed ), 
+                User::Leave( KErrNotSupported ) );
+            
+            CancelNotes();
+            ShowDialogL( 
+                aResultParams.iServiceId, 
+                MCchUiObserver::ECchUiDialogTypeAuthenticationFailed );
+            }
+            break; 
+        case MCchUiObserver::ECchUiDialogTypeAuthenticationFailed:
+            {
+            DoHandleAuthenticationFailedCompleteL( 
+                aCompleteCode, aResultParams );
+            }
+            break;  
+        case MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable:
+        case MCchUiObserver::ECchUiDialogTypeNoConnectionDefined:        
+            {
+            DoHandleNoConnectionsCompleteL( 
+                aCompleteCode, aResultParams );
+            }
+            break;
+        
+        case MCchUiObserver::ECchUiDialogTypeDefectiveSettings:
+            {
+            // Defective settings is permanent type of condition.
+            iCCHHandler->DisableL( aResultParams.iServiceId );
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+            }
+            break;           
+        case MCchUiObserver::ECchUiDialogTypeErrorInConnection:
+            {
+            // Show confirm change connection query
+            __ASSERT_ALWAYS( DialogIsAllowed( 
+                MCchUiObserver::ECchUiDialogTypeConfirmChangeConnection ), 
+                User::Leave( KErrNotSupported ) );
+                        
+            CancelNotes();
+            ShowDialogL( 
+                aResultParams.iServiceId, 
+                MCchUiObserver::ECchUiDialogTypeConfirmChangeConnection );
+            }
+            break;
+        case MCchUiObserver::ECchUiDialogTypeConfirmChangeConnection:
+            {
+            DoHandleConfirmChangeConnectionCompleteL( 
+                aCompleteCode, aResultParams );
+            }
+            break;
+        case MCchUiObserver::ECchUiDialogTypeChangeConnection:
+            {
+            DoHandleChangeConnectionCompleteL( 
+                aCompleteCode, aResultParams );
+            }
+            break;            
+        default:
+            CCHUIDEBUG( "DialogCompletedL - default switch case" );  
+            break;    
+        }    
+    
+    CCHUIDEBUG( "CCchUiApiImpl::DialogCompletedL - OUT" );  
+    }
+
+// ---------------------------------------------------------------------------
+// Checks if specific note is allowed
+// ---------------------------------------------------------------------------
+//
+TBool CCchUiApiImpl::DialogIsAllowed( 
+    MCchUiObserver::TCchUiDialogType aDialog )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::DialogIsAllowed");
+    CCHUIDEBUG2( "CCchUiApiImpl::DialogIsAllowed - allowed notes count=%d", 
+        iAllowedNotes.Count() );
+    CCHUIDEBUG2( "CCchUiApiImpl::DialogIsAllowed - aDialog find result=%d", 
+        iAllowedNotes.Find( aDialog ) );
+    
+    TBool ret = EFalse;
+    if ( !iAllowedNotes.Count() ) return ETrue; // not configured, all allowed
+    else if ( KErrNotFound != iAllowedNotes.Find( 
+        MCchUiObserver::ECchUiDialogTypeNotSet ) ) return ETrue;
+    else if ( KErrNotFound != iAllowedNotes.Find( aDialog ) ) return ETrue;
+    
+    CCHUIDEBUG2( "DialogIsAllowed - return: %d", ret );
+    return ret;            
+    }
+
+// ---------------------------------------------------------------------------
+// Checks if specific sub service  is allowed
+// ---------------------------------------------------------------------------
+//
+TBool CCchUiApiImpl::SubServiceIsAllowed( TCCHSubserviceType aSubService )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::SubServiceIsAllowed");            
+    
+    CCHUIDEBUG2( "SubServiceIsAllowed - allowed subserv=%d", 
+        iAllowedSubServices.Count() );
+    CCHUIDEBUG2( "SubServiceIsAllowed - aSubService find=%d", 
+        iAllowedSubServices.Find( aSubService ) );
+    CCHUIDEBUG2( "SubServiceIsAllowed - all supported=%d", 
+        iAllowedSubServices.Find( ECCHUnknown ) );
+    
+    // If subservice type is ECCHUnknown -> subservice is allowed, other
+    // types are checked from array.
+    TBool allowed = EFalse;
+    TInt result = iAllowedSubServices.Find( aSubService );
+    
+    if ( ECCHUnknown == aSubService )
+        {
+        allowed = ETrue;
+        }
+    else if ( KErrNotFound != result )
+        {
+        allowed = ETrue;
+        }
+    else
+        {
+        allowed = EFalse;
+        }
+
+    CCHUIDEBUG2( "SubServiceIsAllowed - return: %d", allowed );
+    return allowed;
+    }
+
+// ---------------------------------------------------------------------------
+// Checks subservice state is allowed for showing dialogs.
+// ---------------------------------------------------------------------------
+//
+TBool CCchUiApiImpl::StateIsAllowed( const TCCHSubserviceState aState )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::StateIsAllowed");  
+    
+    TBool allowed( EFalse );
+    
+    switch ( aState )
+        {
+        case ECCHUninitialized:
+        case ECCHDisabled:
+        case ECCHDisconnecting:
+            {
+            CCHUIDEBUG( "CCchUiApiImpl::StateIsAllowed: Not allowed");
+            }
+            break;           
+        case ECCHConnecting:
+        case ECCHEnabled:
+            {
+            CCHUIDEBUG( "CCchUiApiImpl::StateIsAllowed: Allowed");
+            allowed = ETrue;
+            }
+            break;
+        default:
+            CCHUIDEBUG( "CCchUiApiImpl::StateIsAllowed: DEFAULT case");
+            break;
+        }
+    
+    return allowed;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles re-enabling of service.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::HandleServiceReEnablingL( TUint aServiceId )
+    {
+    if ( iRemovableConnection )
+        {
+        CCHUIDEBUG( 
+            "DoHandleServiceEventL - removing old connection" );
+        
+        RBuf serviceName;
+        CleanupClosePushL( serviceName );
+        serviceName.CreateL( KServiceNameMaxLength );
+        
+        iSpsHandler->ServiceNameL( 
+                aServiceId,
+                serviceName );
+        
+        // Remove old connection
+        iConnectionHandler->RemoveConnectionL( 
+            serviceName, iRemovableConnection );
+        
+        CleanupStack::PopAndDestroy( &serviceName );
+        }
+    
+    CCHUIDEBUG( "HandleServiceReEnablingL - Re-Enabling service" );
+    
+    iReEnableService = EFalse;
+    iCCHHandler->EnableL( aServiceId );    
+    }
+
+// ---------------------------------------------------------------------------
+// Handle authentication failed completed situation.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::DoHandleAuthenticationFailedCompleteL( 
+    TInt aCompleteCode, 
+    TCCHUiNotifierParams aResultParams )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::DoHandleAuthenticationFailedCompleteL - IN");            
+        
+    switch ( aCompleteCode )
+        {
+        case KErrNone:
+            {
+            TInt err( KErrNone );
+                    
+            // Set username
+            iCCHHandler->SetUsernameL( aResultParams, err );   
+                    
+            // If no error set also password
+            if ( !err )
+                {       
+                iCCHHandler->SetPasswordL( aResultParams, err );
+                }
+            else
+                {
+                iLastOperationResult = 
+                    MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+                }
+                    
+            // Both username and password set succesfully.
+            if ( !err )
+                {   
+                iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultCredentialsChanged;
+                }
+            else
+                {
+                iLastOperationResult = 
+                    MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+                }
+            
+            aCompleteCode = err;
+            break;
+            }
+        case KErrAlreadyExists:
+            {
+            // dialog active, do nothing
+            break;
+            }
+        case KErrCancel:
+            {        
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultUserCancelled;
+            break;
+            }
+        default:
+            {
+            CCHUIDEBUG( 
+               "DoHandleAuthenticationFailedCompleteL - switch default case");
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+            break;
+            }
+        }
+    
+    switch ( iLastOperationResult )
+        {
+        case MCchUiObserver::ECchUiClientOperationResultCredentialsChanged:
+            {
+            iCCHHandler->EnableL( aResultParams.iServiceId );
+            break;
+            }
+        default:
+            {
+            iCCHHandler->DisableL( aResultParams.iServiceId );
+            break;
+            }
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::DoHandleAuthenticationFailedCompleteL - OUT");       
+    }
+    
+
+// ---------------------------------------------------------------------------
+// Handle no connections complete situation.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::DoHandleNoConnectionsCompleteL( 
+    TInt aCompleteCode, 
+    TCCHUiNotifierParams aResultParams )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::DoHandleNoConnectionsCompleteL - IN"); 
+
+    if ( KErrNone == aCompleteCode )
+        {
+        switch( aResultParams.iOperationCommand )
+            {
+            case ECchUiCommandSearchWlan:
+                {
+                HandleSearchWlanCompleteL( 
+                        aCompleteCode, aResultParams );
+                break;
+                }
+            case ECchUiCommandCopyGprs:
+                {
+                HandleCopyGprsCompleteL( 
+                        aCompleteCode, aResultParams );                
+                break;
+                }
+            case ECchUiCommandGprsNotFound:
+                {
+                CCHUIDEBUG( " -> GPRS was not found"); 
+                iLastOperationResult = 
+                    MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+                break;
+                }    
+            case ECchUiCommandEnableCancelled:
+                {
+                iLastOperationResult = 
+                    MCchUiObserver::ECchUiClientOperationResultUserCancelled;
+                break;
+                }
+            case ECchUiCommandConnectWhenAvailable:
+                {
+                iLastOperationResult = 
+                    MCchUiObserver::ECchUiClientOperationResultNotSet;
+                break;
+                }
+            default:
+                {
+                CCHUIDEBUG( " -> !DEFAULT!"); 
+                iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+                }
+                break;
+            }
+        }
+    else if ( KErrAlreadyExists == aCompleteCode )
+        {
+        // dialog active, do nothing
+        }
+    else if ( KErrCancel == aCompleteCode )
+        {
+        iLastOperationResult = 
+            MCchUiObserver::ECchUiClientOperationResultUserCancelled;
+        }
+    else
+        {
+        iLastOperationResult = 
+            MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+        }
+    
+    if ( iLastOperationResult != 
+        MCchUiObserver::ECchUiClientOperationResultNotSet )
+        {
+        InformObserversL( aResultParams.iServiceId );
+        }
+       
+    switch ( iLastOperationResult )
+        {
+        case MCchUiObserver::ECchUiClientOperationResultAccessPointAdded:
+            {
+            // New access point was added --> enable service
+            iCCHHandler->EnableL( aResultParams.iServiceId );
+            break;
+            }
+        case MCchUiObserver::ECchUiClientOperationResultNotSet:
+            {
+            // If no operation result set, do nothing
+            break;
+            }
+        // By default disable service
+        default:
+            {
+            CCHUIDEBUG( " -> !DEFAULT!");
+            CCHUIDEBUG( " -> Disabling service");
+            iCCHHandler->DisableL( aResultParams.iServiceId );
+            break;
+            }
+        }       
+    
+    CCHUIDEBUG( "CCchUiApiImpl::DoHandleNoConnectionsCompleteL - OUT"); 
+    }
+  
+// ---------------------------------------------------------------------------
+// Handle change connection confirmation note complete situation.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::DoHandleConfirmChangeConnectionCompleteL( 
+    TInt aCompleteCode, 
+    TCCHUiNotifierParams aResultParams )
+    {    
+    CCHUIDEBUG( 
+        "CCchUiApiImpl::DoHandleConfirmChangeConnectionCompleteL - IN"); 
+    
+    switch( aCompleteCode )
+        {
+        case KErrNone:
+            {            
+            // show change connection query
+            __ASSERT_ALWAYS( DialogIsAllowed( 
+                MCchUiObserver::ECchUiDialogTypeChangeConnection ), 
+                User::Leave( KErrNotSupported ) );
+            
+            // Set removable connection which is removed when connection
+            // is changed successfully
+            if ( aResultParams.iRemoveOldConnection )
+                {
+                iRemovableConnection = aResultParams.iCurrentConnectionIapId;
+                }
+            
+            CancelNotes();
+            ShowDialogL( 
+                aResultParams.iServiceId, 
+                MCchUiObserver::ECchUiDialogTypeChangeConnection );
+            break;
+            }
+        case KErrCancel:
+            {      
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultUserCancelled;
+            break;
+            }
+        default:
+            {
+            CCHUIDEBUG( 
+            "DoHandleConfirmChangeConnectionCompleteL - default switch case");
+            
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+            break;
+            }
+        }
+    
+    CCHUIDEBUG( 
+            "CCchUiApiImpl::DoHandleConfirmChangeConnectionCompleteL - OUT"); 
+    }
+
+// ---------------------------------------------------------------------------
+// Handle change connection query complete situation.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::DoHandleChangeConnectionCompleteL( 
+    TInt aCompleteCode, 
+    TCCHUiNotifierParams aResultParams )
+    {  
+    CCHUIDEBUG( "CCchUiApiImpl::DoHandleChangeConnectionCompleteL - IN"); 
+        
+    switch( aCompleteCode )
+        {
+        case KErrNone:
+            {
+            HandleChangeConnectionL( 
+                aCompleteCode, aResultParams );
+            break;
+            }
+        case KErrCancel:
+            {
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultUserCancelled;
+            break;
+            }
+        default:
+            {
+            CCHUIDEBUG( 
+                "DoHandleChangeConnectionCompleteL - default switch case"); 
+            
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+            
+            break;
+            }
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::DoHandleChangeConnectionCompleteL - OUT"); 
+    }
+
+// ---------------------------------------------------------------------------
+// Handles search wlan dialog result.
+// ---------------------------------------------------------------------------
+//    
+void CCchUiApiImpl::HandleSearchWlanCompleteL( 
+    TInt& aCompleteCode, 
+    TCCHUiNotifierParams& aResultParams )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::HandleSearchWlanCompleteL - IN"); 
+    
+    CCHUIDEBUG( "HandleSearchWlanCompleteL - begin wlan search"); 
+    
+    TInt err( KErrNone );
+    TInt snapId( KErrNone );
+    
+    iCCHHandler->GetConnectionSnapIdL( 
+        aResultParams.iServiceId, snapId, err );
+                    
+    if ( !err )
+        {
+        CCHUIDEBUG2( 
+            "HandleSearchWlanCompleteL - service snap is: %d", snapId ); 
+                        
+        HBufC* serviceName = HBufC::NewLC( KServiceNameMaxLength );
+        TPtr serviceNamePtr( serviceName->Des() );
+        
+        CCHUIDEBUG( "HandleSearchWlanCompleteL - get service name");    
+                        
+        iSpsHandler->ServiceNameL( 
+            aResultParams.iServiceId, serviceNamePtr );
+                        
+        CCHUIDEBUG( "HandleSearchWlanCompleteL - proceed to wlan search");                 
+                        
+        TRAP( err, iConnectionHandler->SearchAccessPointsL(
+                aResultParams.iServiceId,
+                snapId,
+                serviceNamePtr ) ); 
+                        
+        CCHUIDEBUG2( "HandleSearchWlanCompleteL - wlan search err: %d", err );          
+                        
+        CleanupStack::PopAndDestroy( serviceName );
+        
+        HandleSearchAccessPointsErrorL( 
+                err, aCompleteCode, aResultParams );
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::HandleSearchWlanCompleteL - OUT"); 
+    }
+    
+// ---------------------------------------------------------------------------
+// Handles search access points error code.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::HandleSearchAccessPointsErrorL( 
+    TInt aErr,
+    TInt& aCompleteCode, 
+    TCCHUiNotifierParams& /*aResultParams*/ )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::HandleSearchAccessPointsErrorL - IN" );
+    
+    switch ( aErr )
+        {
+        case KErrNone:
+            {
+            CCHUIDEBUG( 
+                "HandleSearchAccessPointsErrorL - access point added" );             
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultAccessPointAdded;
+            break;
+            }
+        case KErrCancel: // user cancel
+            {
+            CCHUIDEBUG( "HandleSearchAccessPointsErrorL - error, cancelled");           
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultUserCancelled;
+            break;
+            }
+        default: // other errors
+            {
+            CCHUIDEBUG( 
+              "HandleSearchAccessPointsErrorL - error, set general failure");
+               
+            aCompleteCode = aErr;
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+            }
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::HandleSearchAccessPointsErrorL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Handles search wlan dialog result when use gprs selected.
+// ---------------------------------------------------------------------------
+//    
+void CCchUiApiImpl::HandleCopyGprsCompleteL( 
+    TInt& /*aCompleteCode*/, 
+    TCCHUiNotifierParams& aResultParams )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::HandleCopyGprsCompleteL - IN" );
+    
+    // User selected gprs access point which will now be stored in
+    // service snap
+    TInt snapId( KErrNone );
+                    
+    HBufC* serviceName = HBufC::NewLC( KServiceNameMaxLength );
+    TPtr serviceNamePtr( serviceName->Des() );
+    
+    iSpsHandler->ServiceNameL( 
+            aResultParams.iServiceId,
+            serviceNamePtr );
+                
+    TInt err( KErrNone );
+    iCCHHandler->GetConnectionSnapIdL( 
+            aResultParams.iServiceId, 
+            snapId,
+            err );
+                    
+    if ( !err )
+        {
+        CCHUIDEBUG2( 
+            "HandleCopyGprsCompleteL - proceed, target snap is: %d", snapId );        
+        CCHUIDEBUG2( 
+            "HandleCopyGprsCompleteL - proceed, service id is: %d",
+            aResultParams.iServiceId ); 
+        CCHUIDEBUG2( "HandleCopyGprsCompleteL - gprs iap id is: %d", 
+            aResultParams.iGprsIapId );                 
+                        
+        iConnectionHandler->CopyIapToServiceSnapL( 
+                aResultParams.iServiceId, serviceNamePtr, 
+                aResultParams.iGprsIapId, snapId );
+                        
+        CCHUIDEBUG( "HandleCopyGprsCompleteL - copy gprs iap done ok");                 
+                        
+        CleanupStack::PopAndDestroy( serviceName );
+                        
+        iLastOperationResult = 
+            MCchUiObserver::ECchUiClientOperationResultAccessPointAdded;
+                       
+        CCHUIDEBUG( "  -> copy gprs iap done ok, enable");                 
+        iCCHHandler->EnableL( aResultParams.iServiceId );
+        }
+    else
+        {
+        iLastOperationResult = 
+            MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+        User::Leave( err );
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::HandleCopyGprsCompleteL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Handles changing to new connection.
+// ---------------------------------------------------------------------------
+//    
+void CCchUiApiImpl::HandleChangeConnectionL( 
+    TInt& aCompleteCode, 
+    TCCHUiNotifierParams& aResultParams )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::HandleChangeConnectionL - IN" );        
+    
+    switch ( aResultParams.iOperationCommand )
+        {
+        case ECchUiCommandSearchWlan:
+            {
+            CCHUIDEBUG( "HandleChangeConnectionL - search wlan");                 
+            HandleSearchWlanCompleteL( 
+                aCompleteCode, aResultParams );
+            break;
+            }
+        case ECchUiCommandCopyGprs:
+            {
+            CCHUIDEBUG( "HandleChangeConnectionL - copy gprs");       
+            HandleCopyGprsCompleteL( 
+                aCompleteCode, aResultParams );
+            break;
+            }
+        default:
+            {
+            CCHUIDEBUG( "HandleChangeConnectionL - default switch case");
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultGeneralFailure;
+            break;
+            }
+        }
+    
+    switch ( iLastOperationResult )
+        {
+        case MCchUiObserver::ECchUiClientOperationResultAccessPointAdded:
+            {
+            iLastOperationResult = 
+                MCchUiObserver::ECchUiClientOperationResultConnectionChanged;
+                            
+            CCHUIDEBUG( "HandleChangeConnectionL - re-enable service");
+                            
+            // Disable service and set iReEnable flag so that after service
+            // has disconnected we can connect with new access point.
+            iCCHHandler->StartObservingL( aResultParams.iServiceId, *this );
+            
+            iReEnableService = ETrue;
+                
+            iObservedService = aResultParams.iServiceId;
+            
+            InformObserversL( aResultParams.iServiceId );
+            iCCHHandler->DisableL( aResultParams.iServiceId );
+                            
+            // Check if id already exists in observed services
+            TInt error = iObservervedServices.Find( 
+                aResultParams.iServiceId );
+                            
+            // Append id only if it is not found.
+            if ( KErrNotFound == error )
+                {
+                CCHUIDEBUG( 
+                   "HandleChangeConnectionL add to observerd services" );
+                iObservervedServices.AppendL( aResultParams.iServiceId );
+                }           
+            break;
+            }
+        default:
+            break;
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::HandleChangeConnectionL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Observer implementation for service events.
+// ---------------------------------------------------------------------------
+//    
+void CCchUiApiImpl::ServiceStatusChanged( 
+    TInt aServiceId, 
+    TCCHSubserviceType aType, 
+    const TCchServiceStatus& aServiceStatus )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::ServiceStatusChanged - IN");
+    
+    CCHUIDEBUG2( "ServiceStatusChanged - aServiceId: %d", 
+        aServiceId ); 
+    CCHUIDEBUG2( "ServiceStatusChanged - aError: %d", 
+        aServiceStatus.Error() ); 
+    CCHUIDEBUG2( "ServiceStatusChanged - aState: %d",
+        aServiceStatus.State() ); 
+    CCHUIDEBUG2( "ServiceStatusChanged - aType: %d", 
+        aType ); 
+    
+    TInt observedPos = iObservervedServices.Find( aServiceId );
+    
+    CCHUIDEBUG2( "  ->  observed position: %d", observedPos ); 
+    
+    if ( KErrNotFound != observedPos )
+        {
+        switch ( aServiceStatus.Error() )
+            {
+            case KErrNone:
+                {
+                TRAP_IGNORE( DoHandleServiceEventL( 
+                        aServiceId, aType, aServiceStatus ) );
+                break;
+                }
+            default: // all error codes but KErrNone
+                {
+                TRAP_IGNORE( DoHandleServiceErrorL( 
+                        aServiceId, aType, aServiceStatus ) );
+                break;
+                }
+            }
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::ServiceStatusChanged - OUT");
+    }    
+    
+// ---------------------------------------------------------------------------
+// Observer implementation for service events.
+// ---------------------------------------------------------------------------
+//    
+void CCchUiApiImpl::DoHandleServiceErrorL( 
+    TInt aServiceId, 
+    TCCHSubserviceType aType, 
+    const TCchServiceStatus& aServiceStatus )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::DoHandleServiceErrorL - IN"); 
+    
+    CCHUIDEBUG2( "DoHandleServiceErrorL - aServiceId: %d", 
+        aServiceId ); 
+    CCHUIDEBUG2( "DoHandleServiceErrorL - aError: %d", 
+        aServiceStatus.Error() );
+    CCHUIDEBUG2( "DoHandleServiceErrorL - aState: %d", 
+        aServiceStatus.State() ); 
+
+    // Check that sub service is allowed
+    __ASSERT_ALWAYS( SubServiceIsAllowed( aType ), 
+        User::Leave( KErrNotSupported ) );
+    
+    // Double-check subservice state
+    TInt err( KErrNone );
+    TCCHSubserviceState state = iCCHHandler->GetServiceStateL( 
+        aServiceId, aType, err );
+    
+    if ( err )
+        {
+        User::Leave( err );
+        }
+    
+    // Check that dialog showing is allowed.
+    __ASSERT_ALWAYS( ( StateIsAllowed( state ) || 
+       KCCHErrorInvalidSettings == aServiceStatus.Error() ) &&
+       !iConnectionHandler->SearchWlanOngoing(),
+       User::Leave( KErrNotSupported ) );
+    
+    switch ( aServiceStatus.Error() )
+        {
+        case KCCHErrorAuthenticationFailed:
+            {
+            __ASSERT_ALWAYS( DialogIsAllowed( 
+                MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed ),
+                User::Leave( KErrNotSupported ) );
+                         
+            ShowDialogL( 
+                aServiceId, 
+                MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed );
+            }
+            break;
+        
+        case KCCHErrorInvalidSettings:
+            {
+            __ASSERT_ALWAYS( DialogIsAllowed( 
+                MCchUiObserver::ECchUiDialogTypeDefectiveSettings ), 
+                User::Leave( KErrNotSupported ) );
+
+            ShowDialogL( 
+                aServiceId, 
+                MCchUiObserver::ECchUiDialogTypeDefectiveSettings );
+            }
+            break;
+        
+        case KCCHErrorInvalidIap:
+        case KCCHErrorNetworkLost:
+        case KCCHErrorServiceNotResponding:
+            {
+            __ASSERT_ALWAYS( DialogIsAllowed( 
+                MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable ), 
+                User::Leave( KErrNotSupported ) );
+            
+            ShowDialogL( 
+                aServiceId, 
+                MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable );
+            }
+            break;
+        
+        case KCCHErrorAccessPointNotDefined:
+            {
+            __ASSERT_ALWAYS( DialogIsAllowed( 
+                MCchUiObserver::ECchUiDialogTypeNoConnectionDefined ), 
+                User::Leave( KErrNotSupported ) );
+            
+            ShowDialogL(
+                aServiceId, 
+                MCchUiObserver::ECchUiDialogTypeNoConnectionDefined );
+            }
+            break;
+        case KCCHErrorBandwidthInsufficient:
+            {
+            __ASSERT_ALWAYS( DialogIsAllowed( 
+                MCchUiObserver::ECchUiDialogTypeErrorInConnection ), 
+                User::Leave( KErrNotSupported ) );
+                  
+            ShowDialogL( 
+                aServiceId, 
+                MCchUiObserver::ECchUiDialogTypeErrorInConnection );
+            }
+            break;
+            
+        case KErrCancel:
+            {
+            CCHUIDEBUG( "CCchUiApiImpl::DoHandleServiceErrorL - cancelled"); 
+            CancelNotes();
+            }
+            break;            
+            
+        default:
+            break;
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::DoHandleServiceErrorL - OUT"); 
+    }
+    
+// ---------------------------------------------------------------------------
+// Observer implementation for service events.
+// ---------------------------------------------------------------------------
+//    
+void CCchUiApiImpl::DoHandleServiceEventL( 
+    TInt aServiceId, 
+    TCCHSubserviceType aType, 
+    const TCchServiceStatus& aServiceStatus )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::DoHandleServiceEventL - IN" );
+    
+    CCHUIDEBUG2( "DoHandleServiceEventL - aServiceId:   %d", 
+        aServiceId ); 
+    CCHUIDEBUG2( "DoHandleServiceEventL - aError:       %d", 
+        aServiceStatus.Error() ); 
+    CCHUIDEBUG2( "DoHandleServiceEventL - aState:       %d", 
+        aServiceStatus.State() );
+    CCHUIDEBUG2( "DoHandleServiceEventL - aType:        %d", 
+        aType );
+    
+    // Check that sub service is allowed
+    __ASSERT_ALWAYS( SubServiceIsAllowed( aType ), 
+        User::Leave( KErrNotSupported ) );
+    
+    switch ( aServiceStatus.State() )
+        {
+        case ECCHDisabled:
+            {
+            CCHUIDEBUG( "DoHandleServiceEventL - disabled event" );
+            
+            // Check if all subservices are disabled
+            TBool allSubserviceDisabled = 
+                iCCHHandler->AllSubservicesInStateL( aServiceId, ECCHDisabled );
+            
+            CCHUIDEBUG2( "DoHandleServiceEventL - all disabled=%d", 
+                allSubserviceDisabled );
+            
+            // If all subservices are disabled stop observing service events.
+            if ( allSubserviceDisabled )
+                {
+                TInt observedPos = iObservervedServices.Find( aServiceId );
+                                 
+                if ( KErrNotFound != observedPos )
+                    {
+                    CCHUIDEBUG( 
+                        "DoHandleServiceEventL - removed observed service" );
+                    iObservervedServices.Remove( observedPos );    
+                    }
+                                                                                        
+                CCHUIDEBUG( "DoHandleServiceEventL - stop observing" );                              
+                iCCHHandler->StopObservingL( aServiceId, *this );
+                iObservedService = 0;
+                }
+             
+            if ( iReEnableService )
+                {
+                if ( allSubserviceDisabled )
+                    {
+                    CCHUIDEBUG( "DoHandleServiceEventL - Re-Enable service" );
+                    HandleServiceReEnablingL( aServiceId );
+                    }
+                else
+                    {
+                    // do nothing and wait next disabled event
+                    // to see if then all subservices are disabled
+                    }
+                }
+            else if ( allSubserviceDisabled && !iReEnableService )
+                {
+                CCHUIDEBUG( "DoHandleServiceEventL - all subservices disabled" );
+                                
+                // Service is in disabled state. Inform cchui observers.
+                InformObserversL( aServiceId );
+                
+                iLastOperationResult = 
+                    MCchUiObserver::ECchUiClientOperationResultNotSet;
+                }
+            else
+                {
+                CCHUIDEBUG( "DoHandleServiceEventL - all subservices not disabled" );
+                // not all subservices are disable, do nothing
+                }
+            }
+            break;
+            
+        case ECCHEnabled:
+            {      
+            if ( iReEnableService && iCCHHandler->AllSubservicesInStateL( aServiceId, ECCHEnabled ) )
+                {
+                CCHUIDEBUG( "DoHandleServiceEventL - reset re-enabling" );
+                // Just in case set re-enable flag to EFalse
+                iReEnableService = EFalse;
+                }
+            
+            CCHUIDEBUG( "DoHandleServiceEventL - service is enabled" );
+            
+            // Cancel notes and stop observing only if no active dialog exists
+            // which needs user action
+            if ( !iNoteController->ActiveDialogExists() && !iReEnableService )
+                {              
+                CancelNotes(); 
+                
+                TInt observedPos = iObservervedServices.Find( aServiceId );
+                if ( KErrNotFound != observedPos )
+                    {
+                    CCHUIDEBUG( 
+                        "DoHandleServiceEventL - removed observed service" );
+                    iObservervedServices.Remove( observedPos );    
+                    }
+                         
+                CCHUIDEBUG( "DoHandleServiceEventL - stop observing" );              
+                iCCHHandler->StopObservingL( aServiceId, *this );
+                iObservedService = 0;
+                
+                // Service is in enabled state. Inform cchui observers.
+                InformObserversL( aServiceId );
+                
+                iLastOperationResult = 
+                    MCchUiObserver::ECchUiClientOperationResultNotSet;
+                } 
+            
+            if ( iNoteController && 
+                MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable ==
+                iNoteController->CurrentNote() )
+                {
+                CCHUIDEBUG( "DoHandleServiceEventL - cancel notifier" );
+                // Connection enabled again so this notify can be canceled.
+                CancelNotes();
+                }
+            }
+            break;     
+        default:
+            CCHUIDEBUG( "DoHandleServiceEventL - default switch case" );
+            break;
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::DoHandleServiceEventL - OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// Informs observers about cch ui results.
+// ---------------------------------------------------------------------------
+//
+void CCchUiApiImpl::InformObserversL( TInt aServiceId )
+    {
+    CCHUIDEBUG( "CCchUiApiImpl::InformObserversL - IN"); 
+
+    for ( TInt index = 0 ; index < iObservers.Count() ; index++ )
+        {    
+        CCHUIDEBUG2( "InformObserversL - aServiceId: %d", aServiceId ); 
+        CCHUIDEBUG2( "InformObserversL - iLastOperationResult: %d", 
+            iLastOperationResult ); 
+        
+        iObservers[index]->Observer().ConnectivityDialogsCompletedL( 
+            aServiceId,
+            iLastOperationResult );
+        }
+    
+    CCHUIDEBUG( "CCchUiApiImpl::InformObserversL - OUT"); 
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchuicchhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,345 @@
+/*
+* 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:  Provider access to CCH
+*
+*/
+
+
+#include "cchuilogger.h"
+#include "cchuicchhandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+CCchUiCchHandler::CCchUiCchHandler( CCch& aCch ):
+    iCchClientApi( aCch )
+    {    
+    }
+
+CCchUiCchHandler* CCchUiCchHandler::NewL( CCch& aCch )
+    {
+    CCchUiCchHandler* self = 
+           new ( ELeave ) CCchUiCchHandler( aCch );
+    return self;
+    }
+
+CCchUiCchHandler::~CCchUiCchHandler()
+    {
+    CCHUIDEBUG( "CCchUiCchHandler::~CCchUiCchHandler - IN" );
+    CCHUIDEBUG( "CCchUiCchHandler::~CCchUiCchHandler - OUT" ); 
+    }
+
+// ---------------------------------------------------------------------------
+// Gets snap that service uses.
+// ---------------------------------------------------------------------------
+//
+void CCchUiCchHandler::GetConnectionSnapIdL( 
+    TInt aServiceId, TInt& aSnapId, TInt& aErr )
+    {  
+    CCHUIDEBUG( "CCchUiCchHandler::GetConnectionSnapIdL - IN" );   
+    
+    CCchService* service = 
+        iCchClientApi.GetService( aServiceId );
+        
+    User::LeaveIfNull( service );
+    
+    aErr = service->GetConnectionParameter( 
+        ECCHUnknown, ECchSnapId, aSnapId );
+    
+    CCHUIDEBUG( "CCchUiCchHandler::GetConnectionSnapIdL - OUT" );
+    } 
+
+// ---------------------------------------------------------------------------
+// Sets snap for service.
+// ---------------------------------------------------------------------------
+//
+void CCchUiCchHandler::SetConnectionSnapIdL( 
+    TInt aServiceId, TInt aSnapId, TInt& aErr )
+    {  
+    CCHUIDEBUG( "CCchUiCchHandler::SetConnectionSnapIdL - IN" );    
+    
+    CCchService* service = iCchClientApi.GetService( aServiceId );
+    User::LeaveIfNull( service );
+    
+    aErr = service->SetConnectionParameter( 
+        ECCHUnknown, ECchSnapId, aSnapId );
+    
+    CCHUIDEBUG( "CCchUiCchHandler::SetConnectionSnapIdL - OUT" );  
+    } 
+
+// ---------------------------------------------------------------------------
+// Gets service username.
+// ---------------------------------------------------------------------------
+//
+void CCchUiCchHandler::GetUsernameL( 
+    TInt aServiceId, RBuf& aUserName, TInt& aErr )
+    {      
+    CCHUIDEBUG( "CCchUiCchHandler::GetUsernameL - IN" );       
+    
+    CCchService* service = iCchClientApi.GetService( aServiceId );
+    User::LeaveIfNull( service );
+
+    aErr = service->GetConnectionParameter( 
+            ECCHUnknown, ECchUsername, aUserName );
+    
+    CCHUIDEBUG( "CCchUiCchHandler::GetUsernameL - OUT" );       
+    }
+
+// ---------------------------------------------------------------------------
+// Sets username for service.
+// ---------------------------------------------------------------------------
+//
+void CCchUiCchHandler::SetUsernameL( 
+    TCCHUiNotifierParams aResultParams, TInt& aErr )
+    {      
+    CCHUIDEBUG( "CCchUiCchHandler::SetUsernameL - IN" );       
+    
+    CCchService* service = 
+        iCchClientApi.GetService( aResultParams.iServiceId );
+    User::LeaveIfNull( service );
+
+    aErr = service->SetConnectionParameter( 
+        ECCHUnknown, ECchUsername, aResultParams.iUsername );
+    
+    CCHUIDEBUG( "CCchUiCchHandler::SetUsernameL - OUT" );     
+    }
+    
+// ---------------------------------------------------------------------------
+// Sets password for service.
+// ---------------------------------------------------------------------------
+//
+void CCchUiCchHandler::SetPasswordL( 
+    TCCHUiNotifierParams aResultParams, TInt& aErr )
+    {         
+    CCHUIDEBUG( "CCchUiCchHandler::SetPasswordL - IN" );                 
+    
+    CCchService* service = 
+        iCchClientApi.GetService( aResultParams.iServiceId );
+    User::LeaveIfNull( service );
+    
+    aErr = service->SetConnectionParameter( 
+      ECCHUnknown, ECchPassword, aResultParams.iPwd );
+    
+    CCHUIDEBUG( "CCchUiCchHandler::SetPasswordL - OUT" );  
+    }
+
+// ---------------------------------------------------------------------------
+// Starts observing for service events
+// ---------------------------------------------------------------------------
+//
+void CCchUiCchHandler::StartObservingL( 
+    TUint aServiceId, MCchServiceStatusObserver& aObserver )
+    {         
+    CCHUIDEBUG2( "CCchUiCchHandler::StartObservingL: service: %d", 
+        aServiceId );                 
+    CCchService* service = iCchClientApi.GetService( aServiceId );
+    User::LeaveIfNull( service );
+    
+    TInt err = service->AddObserver( aObserver );
+    
+    if ( KErrNone != err && KErrAlreadyExists != err )
+        {
+        CCHUIDEBUG2( "CCchUiCchHandler::StartObservingL: ERR: %d", 
+                err );        
+        
+        User::Leave( err );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// Enables service
+// ---------------------------------------------------------------------------
+//
+void CCchUiCchHandler::EnableL( TUint aServiceId )
+    {         
+    CCHUIDEBUG( "CCchUiCchHandler::EnableL - IN" );    
+    
+    CCchService* service = iCchClientApi.GetService( aServiceId );
+    User::LeaveIfNull( service );  
+    service->Enable( ECCHUnknown );
+    
+    CCHUIDEBUG( "CCchUiCchHandler::EnableL - OUT" );                 
+    }    
+    
+// ---------------------------------------------------------------------------
+// Disables service
+// ---------------------------------------------------------------------------
+//
+void CCchUiCchHandler::DisableL( TUint aServiceId )
+    {
+    CCHUIDEBUG( "CCchUiCchHandler::DisableL - IN" );     
+    
+    CCchService* service = iCchClientApi.GetService( aServiceId );
+    User::LeaveIfNull( service );
+    service->Disable( ECCHUnknown );
+    
+    CCHUIDEBUG( "CCchUiCchHandler::DisableL - OUT" );                 
+    }    
+    
+// ---------------------------------------------------------------------------
+// CCchUiCchHandler::AllSubservicesInStateL
+// ---------------------------------------------------------------------------
+//
+TBool CCchUiCchHandler::AllSubservicesInStateL( 
+    TUint aServiceId,
+    TCCHSubserviceState aState )
+    {         
+    CCHUIDEBUG( "CCchUiCchHandler::AllSubservicesInStateL - IN" );
+    CCHUIDEBUG2( "CCchUiCchHandler::AllSubservicesInStateL : %d", aState );
+    
+    CCchService* service = iCchClientApi.GetService( aServiceId );
+    User::LeaveIfNull( service );
+      
+    RArray<TCCHSubserviceType> types;
+    CleanupClosePushL( types );
+    types.AppendL( ECCHVoIPSub );
+    types.AppendL( ECCHPresenceSub );
+    types.AppendL( ECCHIMSub );
+    types.AppendL( ECCHVMBxSub );
+    
+    TBool response( ETrue ); 
+
+    for ( TInt i( 0 ) ; i < types.Count() ; i++ )
+        {        
+        TBool supported( EFalse );
+        TInt err = service->IsSupported( types[ i ], supported );
+                
+        if ( supported && !err )
+            {            
+            TCCHSubserviceState state = 
+                GetServiceStateL( aServiceId, types[ i ], err );
+            
+            if ( aState != state && !err )
+                {                
+                response = EFalse;
+                i = types.Count(); // End loop
+                }
+            }       
+        }
+
+    CleanupStack::PopAndDestroy( &types );
+    
+    CCHUIDEBUG2( "CCchUiCchHandler::AllSubservicesInStateL : %d", response );
+    CCHUIDEBUG( "CCchUiCchHandler::AllSubservicesInStateL - OUT" );
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// Stops observing for specific service
+// ---------------------------------------------------------------------------
+//
+void CCchUiCchHandler::StopObservingL( 
+    TUint aServiceId, MCchServiceStatusObserver& aObserver )
+    {         
+    CCHUIDEBUG( "CCchUiCchHandler::StopObservingL - IN" );   
+    
+    CCchService* service = iCchClientApi.GetService( aServiceId );
+    User::LeaveIfNull( service );
+      
+    TInt err = service->RemoveObserver( aObserver );
+    
+    if ( KErrNone != err && KErrNotFound != err )
+        {
+        CCHUIDEBUG2( "CCchUiCchHandler::StopObservingL: ERR: %d", 
+                       err );        
+        
+        User::Leave( err );
+        }
+    
+    CCHUIDEBUG( "CCchUiCchHandler::StopObservingL - OUT");                          
+    }    
+    
+// ---------------------------------------------------------------------------
+//  For checking service state.
+// ---------------------------------------------------------------------------
+//
+TCCHSubserviceState CCchUiCchHandler::GetServiceStateL( 
+    TUint aServiceId, TCCHSubserviceType aSubServiceType, TInt& aErr )
+    {         
+    CCHUIDEBUG( "CCchUiCchHandler::GetServiceStateL"); 
+    
+    CCchService* service = iCchClientApi.GetService( aServiceId );
+    User::LeaveIfNull( service );
+    
+    TCchServiceStatus serviceStatus;
+    aErr = service->GetStatus( aSubServiceType, serviceStatus );
+    
+    CCHUIDEBUG2( "GetServiceStateL STATE=%d", serviceStatus.State() );
+    
+    return serviceStatus.State();
+    }   
+
+// ---------------------------------------------------------------------------
+//  For getting current connections iap id.
+// ---------------------------------------------------------------------------
+//
+void CCchUiCchHandler::GetCurrentConnectionIapIdL( 
+    TUint aServiceId,
+    TCCHSubserviceType aSubServiceType,
+    TInt& aIapId,
+    TInt& aErr )
+    {     
+    CCHUIDEBUG( "CCchUiCchHandler::GetCurrentConnectionIapIdL - IN" );         
+    
+    CCchService* service = iCchClientApi.GetService( aServiceId );
+    User::LeaveIfNull( service );
+    
+    aErr = service->GetConnectionParameter(
+            aSubServiceType,
+            ECchIapId,
+            aIapId );
+    
+    // Check that atleast some subservice is really in enabled state 
+    //(connection exists), if not set iap id to 0
+    if ( aIapId )
+        {
+        TBool enabledSubServiceFound( EFalse );
+        
+        RArray<TCCHSubserviceType> types;
+        CleanupClosePushL( types );
+        types.AppendL( ECCHVoIPSub );
+        types.AppendL( ECCHPresenceSub );
+        types.AppendL( ECCHIMSub );
+        types.AppendL( ECCHVMBxSub );
+        
+        for ( TInt i( 0 ) ; i < types.Count() ; i++ )
+            {
+            TBool supported( EFalse );
+            TInt err = service->IsSupported( types[ i ], supported );
+            
+            if ( supported && !err )
+                {
+                TCCHSubserviceState state = GetServiceStateL( 
+                    aServiceId, types[ i ], err );
+                
+                if ( ECCHEnabled == state && !err )
+                    {
+                    // Enabled subservice found, end loop
+                    enabledSubServiceFound = ETrue;
+                    i = types.Count();
+                    }              
+                }       
+            }
+        
+        // Set aIapId to zero if no subservices in enabled state
+        if ( !enabledSubServiceFound )
+            {
+            aIapId = 0;
+            }
+        
+        CleanupStack::PopAndDestroy( &types );
+        }
+    
+    CCHUIDEBUG( "CCchUiCchHandler::GetCurrentConnectionIapIdL - OUT" );
+    } 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchuiclientobserver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,57 @@
+/*
+* 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:  Implementation of class CCchUiClientObserver.
+*
+*/
+
+
+#include "cchuiclientobserver.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+CCchUiClientObserver::CCchUiClientObserver( 
+    MCchUiObserver& aObserver ):
+    iObserver( aObserver )
+    {
+    }
+
+CCchUiClientObserver* CCchUiClientObserver::NewL( 
+    MCchUiObserver& aObserver )
+    {
+    CCchUiClientObserver* self = NewLC( aObserver );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CCchUiClientObserver* CCchUiClientObserver::NewLC( 
+    MCchUiObserver& aObserver )
+    {
+    CCchUiClientObserver* self = new (ELeave) CCchUiClientObserver( 
+        aObserver );
+    CleanupStack::PushL(self);
+    return self;
+    }
+
+CCchUiClientObserver::~CCchUiClientObserver()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Returns observer reference
+// ---------------------------------------------------------------------------
+//
+MCchUiObserver& CCchUiClientObserver::Observer()
+    {
+    return iObserver;
+    }         
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchuiconnectionhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,853 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provider WLAN search and SNAP handling functionality
+*
+*/
+
+
+// Search WLAN
+#include <cmmanagerdef.h>
+#include <cmpluginwlandef.h> // bearer type
+#include <cmdestinationext.h>
+#include <cmconnectionmethoddef.h>
+#include <ConnectionUiUtilities.h>
+#include <cmconnectionmethodext.h>
+#include <WEPSecuritySettingsUI.h>
+#include <WPASecuritySettingsUI.h>
+#include <cmmanager.h>
+#include <cmpluginpacketdatadef.h>
+
+#include "cchuilogger.h"
+#include "cchuicchhandler.h"
+#include "cchuispshandler.h"
+#include "cchuiconnectionhandler.h"
+
+const TInt KSsidLength = 256;
+const TInt KCmHighestPriority = 0;
+const TInt KDestinationArrayGranularity = 10;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+CCchUiConnectionHandler::CCchUiConnectionHandler(
+    CCchUiCchHandler& aCchHandler,
+    CCchUiSpsHandler& aSpsHandler ):
+    iCCHHandler( aCchHandler ),
+    iSpsHandler( aSpsHandler ),
+    iSearchWlanOngoing( EFalse )
+    {
+    }
+
+void CCchUiConnectionHandler::ConstructL()
+    {
+    iConnUiUtils = CConnectionUiUtilities::NewL();
+    iCmManagerExt.OpenL();
+    User::LeaveIfError( iConnMon.ConnectL() );
+    }
+
+CCchUiConnectionHandler* CCchUiConnectionHandler::NewL(
+    CCchUiCchHandler& aCchHandler,
+    CCchUiSpsHandler& aSpsHandler )
+    {
+    CCchUiConnectionHandler* self = NewLC( 
+        aCchHandler, aSpsHandler );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CCchUiConnectionHandler* CCchUiConnectionHandler::NewLC(
+    CCchUiCchHandler& aCchHandler,
+    CCchUiSpsHandler& aSpsHandler )
+    {
+    CCchUiConnectionHandler* self =
+        new (ELeave) CCchUiConnectionHandler( 
+            aCchHandler, aSpsHandler );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+CCchUiConnectionHandler::~CCchUiConnectionHandler()
+    {
+    delete iConnUiUtils;
+    iCmManagerExt.Close();
+    iConnMon.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Searches access poinsts and adds selected access point to snap
+// ---------------------------------------------------------------------------
+//
+void CCchUiConnectionHandler::SearchAccessPointsL( 
+    TUint aServiceId, 
+    TUint32 aSnapId, 
+    const TDesC& aServiceName )
+    {    
+    CCHUIDEBUG( "CCchUiConnectionHandler::SearchAccessPointsL - IN" );
+    
+    // SSID of the WLAN network selected by user
+    TWlanSsid ssid; 
+    
+    // Connection mode of the WLAN network
+    TWlanConnectionMode connectionMode; 
+    
+    // Security mode of the WLAN network
+    TWlanConnectionSecurityMode securityMode; 
+    
+    // Flag for determining if hidden wlan
+    TBool hiddenWlan( EFalse );
+    
+    CCHUIDEBUG( 
+        "CCchUiConnectionHandler::SearchAccessPointsL - begin search wlan" );
+        
+    // Set flag which indicates that search wlan query is open
+    iSearchWlanOngoing = ETrue;
+    
+    TBool ret = iConnUiUtils->SearchWLANNetwork( 
+        ssid, connectionMode, securityMode );
+        
+    iSearchWlanOngoing = EFalse;
+    
+    if ( !ret )
+        {        
+        //ret is ETrue if user pressed OK softkey. Otherwise leave
+        //with cancel
+        User::Leave( KErrCancel );
+        }
+    
+    CCHUIDEBUG( 
+      "CCchUiConnectionHandler::SearchAccessPointsL - search wlan finished" ); 
+    
+    // Check if hidden wlan
+    TUint32 easyWlanId( 0 );
+    easyWlanId = iCmManagerExt.EasyWlanIdL();
+    
+    if ( easyWlanId )
+        {
+        RCmConnectionMethodExt cmConnMethodExt = 
+            iCmManagerExt.ConnectionMethodL( easyWlanId );
+        CleanupClosePushL( cmConnMethodExt );
+        
+        if ( cmConnMethodExt.GetBoolAttributeL( CMManager::EWlanScanSSID ) )
+            {
+        CCHUIDEBUG( 
+             "CCchUiConnectionHandler::SearchAccessPointsL - hidden wlan" );
+        
+            hiddenWlan = ETrue;
+            }
+        
+        CleanupStack::PopAndDestroy( &cmConnMethodExt );
+        }
+    
+    HBufC* ssid16 = HBufC::NewL( KSsidLength );
+    CleanupStack::PushL( ssid16 );
+    
+    TPtr ssid16Ptr( ssid16->Des() );
+    ssid16Ptr.Copy( ssid );
+
+    //  Check if the snap returned by Cch really exists.
+    if ( aSnapId )
+        {
+        RArray<TUint32> destIds = RArray<TUint32>( 1 );
+        CleanupClosePushL( destIds );
+        iCmManagerExt.AllDestinationsL( destIds );
+        
+        TBool found( EFalse );
+        for ( TInt index = 0 ; index < destIds.Count() ; index++ )
+            {
+            if ( destIds[index] == aSnapId )
+                {
+                found = ETrue;
+                }
+            }
+        CleanupStack::PopAndDestroy( &destIds );
+        
+        // Reset snap id if the snap doesn't exist.
+        if ( !found )
+            {
+            aSnapId = 0;
+            }
+        }
+
+    if ( !aSnapId )
+        {
+        RCmDestinationExt newDestination = 
+            CreateServiceSnapL( aServiceName );
+        CleanupClosePushL( newDestination );
+        
+        TBool alreadyExists = EFalse;
+
+        TInt iapId = AddNewConnectionMethodL( 
+            newDestination, 
+            *ssid16, 
+            securityMode,
+            alreadyExists,
+            hiddenWlan );
+        
+        if ( KErrCancel == iapId )
+            {
+            //Leave with cancel if user pressed Cancel softkey
+            CleanupStack::PopAndDestroy( &newDestination );
+            CleanupStack::PopAndDestroy( ssid16 );
+            User::Leave( KErrCancel );
+            }
+
+        if ( !alreadyExists )
+            {
+            iSpsHandler.SetTemporaryIapIdL( aServiceId, iapId );
+            }
+        
+        // Now the snap is created, set it to use with cch
+        SetSnapToUseL( aServiceId, newDestination.Id() );
+        
+        // Self created, write id to service table in order to remove
+        // in service uninstall
+        TRAP_IGNORE( iSpsHandler.SetSnapIdL( 
+            aServiceId, newDestination.Id() ) );
+        
+        CleanupStack::PopAndDestroy( &newDestination );
+        CleanupStack::PopAndDestroy( ssid16 );
+        }
+    else
+        {
+        RCmDestinationExt destination = 
+            iCmManagerExt.DestinationL( aSnapId );
+        CleanupClosePushL( destination );
+        
+        TBool alreadyExists = EFalse;
+        TInt iapId = AddNewConnectionMethodL( 
+            destination,
+            *ssid16,
+            securityMode,
+            alreadyExists, 
+            hiddenWlan );
+        
+        CleanupStack::PopAndDestroy( &destination );
+        CleanupStack::PopAndDestroy( ssid16 );
+        
+        if ( KErrCancel == iapId )
+            {
+            //Leave with cancel if user pressed Cancel softkey
+            User::Leave( KErrCancel );
+            }
+
+        if ( !alreadyExists )
+            {
+            iSpsHandler.SetTemporaryIapIdL( 
+                aServiceId, iapId );
+            }
+        else
+            {
+            // Get current connection iap id
+            TInt currentIapId( KErrNone );
+            TInt error( KErrNone );
+            iCCHHandler.GetCurrentConnectionIapIdL(
+                aServiceId, ECCHUnknown, currentIapId, error );
+            
+            CCHUIDEBUG2( "CCchUiConnectionHandler::SearchAccessPointsL - error:            %d", error );
+            CCHUIDEBUG2( "CCchUiConnectionHandler::SearchAccessPointsL - current iap id:   %d", currentIapId );
+            CCHUIDEBUG2( "CCchUiConnectionHandler::SearchAccessPointsL - selected iap id:  %d", iapId );
+            
+            // if selected iap is same as current iap no need to continue
+            // because if we continue there will be unnecessary disable enable loop
+            if ( currentIapId == iapId )
+                {
+                User::Leave( KErrCancel );
+                }
+            }
+        
+        SetSnapToUseL( aServiceId, aSnapId ); 
+        }
+    
+    // Reset Easy Wlan EWlanScanSSID parameter to EFalse
+    if ( easyWlanId && hiddenWlan )
+        {
+        RCmConnectionMethodExt cmConnMethodExt = 
+            iCmManagerExt.ConnectionMethodL( easyWlanId );
+        CleanupClosePushL( cmConnMethodExt );
+        cmConnMethodExt.SetBoolAttributeL( CMManager::EWlanScanSSID, EFalse );
+        cmConnMethodExt.UpdateL();
+        CleanupStack::PopAndDestroy( &cmConnMethodExt );
+        }
+    
+    CCHUIDEBUG( "CCchUiConnectionHandler::SearchAccessPointsL - OUT" );
+    } 
+
+// ---------------------------------------------------------------------------
+// Check if connnection method already exists. If exists, connection method
+// id is returned, othewise KErrNotFound.
+// ---------------------------------------------------------------------------
+//
+TInt CCchUiConnectionHandler::ConnectionMethodAlreadyExistsL( 
+    RCmDestinationExt& aDestination,
+    const TDesC& aSsid,
+    CMManager::TWlanSecMode aSecurityMode,
+    TBool& aAlreadyExists,
+    TBool aHidden )
+    {
+    CCHUIDEBUG( "CCchUiConnectionHandler::ConnectionMethodAlreadyExistsL" );
+    
+    TInt connectionMethodId = KErrNotFound;
+    for ( TInt i=0 ; 
+          i < aDestination.ConnectionMethodCount() && !aAlreadyExists ; 
+          i++ )
+        {
+        HBufC* refSsid( NULL );
+        
+        RCmConnectionMethodExt cm = aDestination.ConnectionMethodL(i);
+        CleanupClosePushL( cm );
+        
+        // If snap contains non wlan iaps, this will leave so trap
+        TRAPD( err, refSsid = cm.GetStringAttributeL( CMManager::EWlanSSID ));
+        if ( refSsid && !err )
+            {
+            CleanupStack::PushL( refSsid );
+            
+            if ( refSsid->Compare( aSsid ) == 0 )
+                {
+                CCHUIDEBUG( "Matching wlan SSID Found" );
+                
+                // check security and hidden
+                TBool refHidden = cm.GetBoolAttributeL( 
+                   CMManager::EWlanScanSSID );
+                TUint refSecurity = cm.GetIntAttributeL( 
+                    CMManager::EWlanSecurityMode );
+                
+                // ref AP security mode is stored as EWlanSecModeWpa in case of EWlanSecModeWpa2
+                TBool exception( EFalse ); 
+                
+                if ( aSecurityMode == CMManager::EWlanSecModeWpa2 && 
+                     refSecurity == CMManager::EWlanSecModeWpa )
+                    {
+                    exception = ETrue;
+                    }
+                
+                if ( refHidden == aHidden &&
+                    ( refSecurity == aSecurityMode || exception ) )
+                    {              
+                    connectionMethodId = 
+                        cm.GetIntAttributeL( CMManager::ECmIapId );
+                    aAlreadyExists = ETrue;
+                    }
+                }
+            CleanupStack::PopAndDestroy( refSsid );
+            }
+        else if ( KErrNoMemory == err )
+            {
+            User::Leave( err );
+            }
+        else
+            {
+            // for note from code analysis tool
+            }
+        CleanupStack::PopAndDestroy( &cm );
+        }
+    
+    CCHUIDEBUG2( "ConnectionMethodAlreadyExistsL connection method id=%d", 
+         connectionMethodId );
+    
+    return connectionMethodId;
+    }
+
+// ---------------------------------------------------------------------------
+// Add new connection method.
+// ---------------------------------------------------------------------------
+//
+TInt CCchUiConnectionHandler::AddNewConnectionMethodL( 
+    RCmDestinationExt& aDestination, 
+    const TDesC& aSsid,
+    TWlanConnectionSecurityMode aSecurityMode,
+    TBool& aAlreadyExists,
+    TBool aSetHidden )
+    {
+    CCHUIDEBUG( "CCchUiConnectionHandler::AddNewConnectionMethodL" );
+    
+    CMManager::TWlanSecMode securityModeToSet = CMManager::EWlanSecModeOpen;
+    switch ( aSecurityMode )
+        {
+        case EWlanConnectionSecurityOpen:
+            {
+            securityModeToSet = CMManager::EWlanSecModeOpen;
+            }
+            break;
+        
+        case EWlanConnectionSecurityWep:
+            {
+            securityModeToSet = CMManager::EWlanSecModeWep;
+            }
+            break;
+        
+        case EWlanConnectionSecurity802d1x:
+            {
+            securityModeToSet = CMManager::EWlanSecMode802_1x;
+            }
+            break;
+        
+        case EWlanConnectionSecurityWpa:
+            {
+            securityModeToSet = CMManager::EWlanSecModeWpa;
+            }
+            break;
+        
+        case EWlanConnectionSecurityWpaPsk:
+            {
+            securityModeToSet = CMManager::EWlanSecModeWpa2;
+            }
+            break;
+            
+        default:
+            break;
+        }    
+    
+    // Check is iap with same ssid already exists
+    RArray<TUint32> destArray;
+    CleanupClosePushL( destArray );
+    
+    iCmManagerExt.AllDestinationsL( destArray );
+    
+    for ( TInt i( 0 ); i < destArray.Count(); i++ )
+        {
+        RCmDestinationExt destination =
+            iCmManagerExt.DestinationL( destArray[ i ] );
+        CleanupClosePushL( destination );
+        
+        TInt connectionId = ConnectionMethodAlreadyExistsL( 
+            destination, aSsid, securityModeToSet, aAlreadyExists, aSetHidden );
+        
+        if ( aAlreadyExists && KErrNotFound != connectionId )
+           {
+           RCmConnectionMethodExt connectionMethod =
+               destination.ConnectionMethodByIDL( connectionId );
+           CleanupClosePushL( connectionMethod );
+           if ( destination.Id() != aDestination.Id() )
+               {
+               CCHUIDEBUG( "Copy existing connection method to destination" );
+               
+               aDestination.AddConnectionMethodL( 
+                   connectionMethod.CreateCopyL() );
+               }
+           TRAP_IGNORE( aDestination.ModifyPriorityL( 
+               connectionMethod, KCmHighestPriority ) );
+           aDestination.UpdateL();
+           
+           CleanupStack::PopAndDestroy( &connectionMethod );
+           CleanupStack::PopAndDestroy( &destination );
+           CleanupStack::PopAndDestroy( &destArray );
+           return connectionId;
+           }
+        CleanupStack::PopAndDestroy( &destination );
+        }
+    CleanupStack::PopAndDestroy( &destArray );
+    
+    TInt ret = KErrNone;
+    
+    RCmConnectionMethodExt newConnMethod = 
+        aDestination.CreateConnectionMethodL( KUidWlanBearerType );
+    CleanupClosePushL( newConnMethod );
+    
+    // Set attributes
+    newConnMethod.SetStringAttributeL( CMManager::ECmName, aSsid );
+    newConnMethod.SetStringAttributeL( CMManager::EWlanSSID, aSsid );
+    
+    if ( aSetHidden )
+        {
+        newConnMethod.SetBoolAttributeL( 
+            CMManager::EWlanScanSSID, ETrue );
+        }
+    
+    newConnMethod.SetIntAttributeL( 
+        CMManager::EWlanSecurityMode, securityModeToSet );
+
+    TRAP_IGNORE( aDestination.ModifyPriorityL( 
+        newConnMethod, KCmHighestPriority ));
+    
+    aDestination.UpdateL();
+    ret = newConnMethod.GetIntAttributeL( CMManager::ECmIapId );
+
+    CConnectionUiUtilities* connUiUtils = CConnectionUiUtilities::NewL();
+    CleanupStack::PushL( connUiUtils );
+    
+    TInt createdUid( 0 );
+    createdUid = newConnMethod.GetIntAttributeL( CMManager::EWlanServiceId );
+
+    HBufC* key = HBufC::NewL( KWlanWpaPskMaxLength );
+    CleanupStack::PushL( key );
+    TPtr keyPtr( key->Des() );
+    
+    TBool hex = EFalse;  
+    
+    if ( securityModeToSet == CMManager::EWlanSecModeWep )    
+        {
+        if ( connUiUtils->EasyWepDlg( &keyPtr, hex ) )
+            {
+            SaveSecuritySettingsL( aSecurityMode, key, hex, createdUid );
+            }
+        else
+            {
+            aDestination.DeleteConnectionMethodL( newConnMethod );
+            aDestination.UpdateL();
+            
+            ret = KErrCancel;
+            }
+        }
+    else if ( securityModeToSet == CMManager::EWlanSecModeWpa || 
+              securityModeToSet == CMManager::EWlanSecModeWpa2 )
+        {
+        if ( connUiUtils->EasyWpaDlg( &keyPtr ) )
+            {
+            SaveSecuritySettingsL( aSecurityMode, key, hex, createdUid );
+            }
+        else
+            {
+            aDestination.DeleteConnectionMethodL( newConnMethod );
+            aDestination.UpdateL();
+            
+            ret = KErrCancel;
+            }
+        }
+    else
+        {
+        CCHUIDEBUG( "AddNewConnectionMethodL - WlanConnectionSecurityOpen" );
+        }
+    CleanupStack::PopAndDestroy( key );          
+    CleanupStack::PopAndDestroy( connUiUtils );   
+    CleanupStack::PopAndDestroy( &newConnMethod );
+    
+    CCHUIDEBUG2( "AddNewConnectionMethodL - return: %d", ret );
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Save security settings.
+// ---------------------------------------------------------------------------
+//
+void CCchUiConnectionHandler::SaveSecuritySettingsL(
+    const TWlanConnectionSecurityMode aSecMode, 
+    const HBufC* aKey, 
+    const TBool aHex, 
+    const TUint32 aIapId )
+    {
+    CCHUIDEBUG( "CCchUiConnectionHandler::SaveSecuritySettingsL - IN" );
+    
+    CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
+    CleanupStack::PushL( db );
+    switch ( aSecMode )
+        {
+        case EWlanConnectionSecurityWep:
+            {
+            CWEPSecuritySettings* wepSecSettings = 
+                CWEPSecuritySettings::NewL();
+            CleanupStack::PushL( wepSecSettings );            
+            wepSecSettings->LoadL( aIapId, *db );            
+            User::LeaveIfError( 
+                wepSecSettings->SetKeyDataL( 0, *aKey, aHex ) );
+            wepSecSettings->SaveL( aIapId, *db );             
+            CleanupStack::PopAndDestroy( wepSecSettings ); 
+            break;
+            }
+        case EWlanConnectionSecurityWpaPsk:
+            {   
+            CWPASecuritySettings* wpaSecSettings = 
+                CWPASecuritySettings::NewL( ESecurityModeWpa );
+            CleanupStack::PushL( wpaSecSettings );           
+            wpaSecSettings->LoadL( aIapId, *db );            
+            User::LeaveIfError( wpaSecSettings->SetWPAPreSharedKey( *aKey ) );
+            wpaSecSettings->SaveL( aIapId, *db, ESavingBrandNewAP, 0 ) ;            
+            CleanupStack::PopAndDestroy( wpaSecSettings );         
+            break;                     
+            }
+        case EWlanConnectionSecurityWpa:            
+        case EWlanConnectionSecurity802d1x: 
+            {
+            CWPASecuritySettings* wpaSecSettings = 
+                    CWPASecuritySettings::NewL( 
+                        aSecMode == EWlanConnectionSecurityWpa ? 
+                        ESecurityModeWpa : ESecurityMode8021x );
+            CleanupStack::PushL( wpaSecSettings );            
+            wpaSecSettings->LoadL( aIapId, *db );            
+            wpaSecSettings->SaveL( aIapId, *db, ESavingBrandNewAP, 0 );             
+            CleanupStack::PopAndDestroy( wpaSecSettings );   
+            break;
+            }
+        default:
+            // Fore example EWlanConnectionSecurityOpen -> no need to save
+            // any security settings.
+            break;
+        }
+    CleanupStack::PopAndDestroy( db ); // db
+    
+    CCHUIDEBUG( "CCchUiConnectionHandler::SaveSecuritySettingsL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets SNAP into use via CCH. 
+// ---------------------------------------------------------------------------
+//
+void CCchUiConnectionHandler::SetSnapToUseL( 
+    TUint aServiceId, TUint32 aSNAPId )
+    {
+    CCHUIDEBUG( "CCchUiConnectionHandler::SetSnapToUseL - IN" );
+    
+    CCHUIDEBUG2( "SetSnapToUseL - aServiceId: %d", aServiceId );
+    CCHUIDEBUG2( "SetSnapToUseL - aSNAPId: %d", aSNAPId );
+    
+    TInt err( KErrNone );
+    iCCHHandler.SetConnectionSnapIdL( aServiceId, aSNAPId, err );
+    
+    if ( err )
+        {
+        User::Leave( err );
+        }
+    
+    CCHUIDEBUG( "CCchUiConnectionHandler::SetSnapToUseL - OUT" );
+    } 
+
+// ---------------------------------------------------------------------------
+// CCchUiConnectionHandler::ConnectionMethodAlreadyExistsL
+// ---------------------------------------------------------------------------
+//
+TBool CCchUiConnectionHandler::ConnectionMethodAlreadyExistsL(
+    TUint32 aIapId, RCmDestinationExt& aTargetSnap ) const
+    {
+    CCHUIDEBUG( "CCchUiConnectionHandler::ConnectionMethodAlreadyExistsL - IN" );
+    
+    TBool returnVal = EFalse;
+    TInt conMethodCount = aTargetSnap.ConnectionMethodCount();
+
+    for ( TInt i( 0 ) ; i < conMethodCount && !returnVal; i ++ )
+        {
+        RCmConnectionMethodExt cm = aTargetSnap.ConnectionMethodL( i );
+        CleanupClosePushL( cm );
+        
+        TUint32 bearerType = cm.GetIntAttributeL( CMManager::ECmBearerType );
+        if ( bearerType == iCmManagerExt.GetConnectionMethodInfoIntL(
+            aIapId, CMManager::ECmBearerType ) )
+            {
+            HBufC* buffer = NULL;
+            HBufC* bufferToCompare = NULL;
+            
+            switch( bearerType )
+                {
+                case KUidWlanBearerType:
+                    CCHUIDEBUG( "ConnectionMethodAlreadyExistsL - KUidWlanBearerType" );
+                    buffer = iCmManagerExt.GetConnectionMethodInfoStringL(
+                        aIapId, CMManager::EWlanSSID );
+                    CleanupStack::PushL( buffer );
+                    bufferToCompare =
+                        cm.GetStringAttributeL( CMManager::EWlanSSID );
+                    if ( buffer->Compare( *bufferToCompare ) == 0 )
+                        {
+                        returnVal = ETrue;
+                        }
+                    CleanupStack::PopAndDestroy( buffer );
+                    delete bufferToCompare;
+                    bufferToCompare = NULL;
+                    break;
+                case KUidPacketDataBearerType:
+                    CCHUIDEBUG( "ConnectionMethodAlreadyExistsL - KUidPacketDataBearerType" );
+                    buffer = iCmManagerExt.GetConnectionMethodInfoStringL(
+                        aIapId, CMManager::EPacketDataAPName );
+                    CleanupStack::PushL( buffer );
+                    bufferToCompare =
+                        cm.GetStringAttributeL( CMManager::EPacketDataAPName );
+                    if ( buffer->Compare( *bufferToCompare ) == 0 )
+                        {
+                        returnVal = ETrue;
+                        }
+                    CleanupStack::PopAndDestroy( buffer );
+                    delete bufferToCompare;
+                    bufferToCompare = NULL;
+                    break;
+                default:
+                    break;
+                }
+            }
+        CleanupStack::PopAndDestroy( &cm );
+        }
+    CCHUIDEBUG2( "CCchUiConnectionHandler::ConnectionMethodAlreadyExistsL - return = %d", returnVal );
+    
+    return returnVal;
+    }
+
+// ---------------------------------------------------------------------------
+// Copies specific iap from specific snap to target snap
+// ---------------------------------------------------------------------------
+//
+void CCchUiConnectionHandler::CopyIapToServiceSnapL( 
+    TUint aServiceId, 
+    const TDesC& aServiceName, 
+    TUint32 aSourceIap, 
+    TUint32 aTargetSnap )
+    {
+    CCHUIDEBUG( "CCchUiConnectionHandler::CopyIapToServiceSnapL - IN" );
+    
+    CCHUIDEBUG3( "CopyIapToServiceSnapL - aSourceIap: %d, aTargetSnap: %d", 
+        aSourceIap, aTargetSnap );
+    
+    RCmDestinationExt targetSnap;
+    TRAPD( err, ( targetSnap = iCmManagerExt.DestinationL( aTargetSnap ) ) );
+    CCHUIDEBUG2( " -> get target snap err: %d", err );
+    if ( err )
+        {
+        CCHUIDEBUG( "CopyIapToServiceSnapL - Create snap for service");
+        
+        targetSnap = CreateServiceSnapL( aServiceName );
+        CleanupClosePushL( targetSnap );
+        // Now the snap is created, set it to use with cch
+        SetSnapToUseL( aServiceId, targetSnap.Id() );
+        }
+    else
+        {
+        CleanupClosePushL( targetSnap );
+        }
+    
+    if( !ConnectionMethodAlreadyExistsL( aSourceIap, targetSnap ) )
+        {
+        CCHUIDEBUG( 
+            "CopyIapToServiceSnapL - connection not exists -> add connection" );
+        
+        RCmConnectionMethodExt sourceConn = 
+            iCmManagerExt.ConnectionMethodL( aSourceIap );       
+        CleanupClosePushL( sourceConn );
+        
+        RCmConnectionMethodExt newConnection = sourceConn.CreateCopyL();
+        CleanupClosePushL( newConnection );
+        targetSnap.AddConnectionMethodL( newConnection );
+        CleanupStack::PopAndDestroy( &newConnection );
+        CleanupStack::PopAndDestroy( &sourceConn );
+        
+        targetSnap.UpdateL();
+        }
+    
+    CleanupStack::PopAndDestroy( &targetSnap ); 
+    
+    CCHUIDEBUG( "CCchUiConnectionHandler::CopyIapToServiceSnapL - OUT" );
+    }     
+    
+// ---------------------------------------------------------------------------
+// Removes connection method from SNAP.
+// ---------------------------------------------------------------------------
+//
+void CCchUiConnectionHandler::RemoveConnectionL( 
+    const TDesC& aServiceName, TInt aIapId )
+    {
+    CCHUIDEBUG( "CCchUiConnectionHandler::RemoveConnectionL - IN" );
+    CCHUIDEBUG2( "RemoveConnectionL - aServiceName=%S", &aServiceName );
+    CCHUIDEBUG2( "RemoveConnectionL - aIapId=%d", aIapId );
+    
+    RArray<TUint32> destIds = RArray<TUint32>( 1 );
+    CleanupClosePushL( destIds );
+    iCmManagerExt.AllDestinationsL( destIds );
+    
+    for ( TInt i( 0 ) ; i < destIds.Count() ; i++ )
+        {
+        RCmDestinationExt dest = iCmManagerExt.DestinationL( destIds[ i ] );
+        CleanupClosePushL( dest );
+        
+        HBufC* destName = dest.NameLC();        
+        if ( destName->Des().Compare( aServiceName ) == 0 )
+            {
+            CCHUIDEBUG( "RemoveConnectionL - get connection method");
+            
+            RCmConnectionMethodExt connMethod = 
+                   iCmManagerExt.ConnectionMethodL( aIapId );        
+            
+            CCHUIDEBUG( "RemoveConnectionL - remove connection method");
+            
+            dest.RemoveConnectionMethodL( connMethod );
+            dest.UpdateL();
+            
+            CCHUIDEBUG( "RemoveConnectionL - connection method removed");
+            }
+        
+        CleanupStack::PopAndDestroy( destName );
+        CleanupStack::PopAndDestroy( &dest );
+        }
+    
+    CleanupStack::PopAndDestroy( &destIds );
+    
+    CCHUIDEBUG( "CCchUiConnectionHandler::RemoveConnectionL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Returns ETrue if wlan search (query) is ongoing.
+// ---------------------------------------------------------------------------
+//
+TBool CCchUiConnectionHandler::SearchWlanOngoing()
+    {    
+    CCHUIDEBUG2( "CCchUiConnectionHandler::SearchWlanOngoing ongoing=%d",
+        iSearchWlanOngoing );
+    
+    return iSearchWlanOngoing;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Creates service snap
+// ---------------------------------------------------------------------------
+//
+RCmDestinationExt CCchUiConnectionHandler::CreateServiceSnapL(
+    const TDesC& aServiceName )
+    {
+    CCHUIDEBUG( "CCchUiConnectionHandler::CreateServiceSnapL" );
+
+    // Create snap again, user might have deleted it
+    RCmDestinationExt newDestination;
+    
+    // Check if snap with service name already exists.
+    TBool snapAlreadyExists = EFalse;
+    RArray<TUint32> destIdArray = 
+        RArray<TUint32>( KDestinationArrayGranularity );
+    CleanupClosePushL( destIdArray );
+    
+    CCHUIDEBUG( "CreateServiceSnapL - check if snap exists");
+    
+    iCmManagerExt.AllDestinationsL( destIdArray );
+    
+    CCHUIDEBUG2( "CreateServiceSnapL - destination count: %d", 
+        destIdArray.Count() );
+    
+    for ( TInt i = 0; 
+          i < destIdArray.Count() && !snapAlreadyExists; 
+          i++ )
+        {
+        RCmDestinationExt dest = 
+            iCmManagerExt.DestinationL( destIdArray[i] );
+        CleanupClosePushL( dest );
+        HBufC* destName = dest.NameLC();
+        if ( *destName == aServiceName )
+            {
+            CCHUIDEBUG( "CreateServiceSnapL - snap already exists" );
+            snapAlreadyExists = ETrue;
+            newDestination = iCmManagerExt.DestinationL( destIdArray[i] );
+            }
+        CleanupStack::PopAndDestroy( destName );
+        CleanupStack::PopAndDestroy( &dest );
+        }
+    CleanupStack::PopAndDestroy( &destIdArray );                
+    
+    if ( !snapAlreadyExists )
+        {
+        newDestination = 
+            iCmManagerExt.CreateDestinationL( aServiceName );
+        CleanupClosePushL( newDestination );
+        newDestination.SetMetadataL( 
+            CMManager::ESnapMetadataHiddenAgent, ETrue );
+        newDestination.UpdateL();    
+        CleanupStack::Pop( &newDestination );
+        }
+    
+    return newDestination;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchuiglobalqueryhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,144 @@
+/*
+* 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:  Implementation of class CCchUiGlobalQueryHandler.
+*
+*/
+
+#include <s32mem.h>
+#include <AknPanic.h>
+#include <aknSDData.h>
+#include <AknNotifyStd.h>
+#include <AknNotifySignature.h>
+#include <cenrepnotifyhandler.h>
+
+#include "cchuilogger.h"
+#include "cchuiglobalqueryhandler.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+CCchUiGlobalQueryHandler::CCchUiGlobalQueryHandler() :
+    iNotifyStarted( EFalse )
+    {
+    }
+
+void CCchUiGlobalQueryHandler::ConstructL()
+    {
+    CCHUIDEBUG( "CCchUiGlobalQueryHandler::ConstructL - IN" );
+    
+    User::LeaveIfError( iNotify.Connect() );
+    
+    CCHUIDEBUG( "CCchUiGlobalQueryHandler::ConstructL - OUT" );
+    }
+
+CCchUiGlobalQueryHandler* CCchUiGlobalQueryHandler::NewL()
+    {
+    CCchUiGlobalQueryHandler* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CCchUiGlobalQueryHandler* CCchUiGlobalQueryHandler::NewLC()
+    {
+    CCchUiGlobalQueryHandler* self = new(ELeave) CCchUiGlobalQueryHandler;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+CCchUiGlobalQueryHandler::~CCchUiGlobalQueryHandler()
+    {
+    CCHUIDEBUG( "CCchUiGlobalQueryHandler::~CCchUiGlobalQueryHandler - IN ");        
+    
+    CancelMsgQuery();
+    iNotify.Close();
+    
+    CCHUIDEBUG( "CCchUiGlobalQueryHandler::~CCchUiGlobalQueryHandler - OUT ");        
+    }
+
+// ---------------------------------------------------------------------------
+// Show query.
+// ---------------------------------------------------------------------------
+//
+void CCchUiGlobalQueryHandler::ShowMsgQueryL( 
+    MCchUiObserver::TCchUiDialogType aNote,
+    TRequestStatus& aStatus,
+    TUint aServiceId,
+    TUint aIapId,
+    RBuf& aUserName )
+    {
+    CCHUIDEBUG( "CCchUiGlobalQueryHandler::ShowMsgQueryL - IN" );
+    CCHUIDEBUG2( "ShowMsgQueryL - aNote: %d", aNote );
+    CCHUIDEBUG2( "ShowMsgQueryL - aServiceId: %d", aServiceId );
+    
+    iPckg().iDialogMode = aNote;
+    iPckg().iServiceId = aServiceId;
+    iPckg().iCurrentConnectionIapId = aIapId;
+    iPckg().iUsername.Copy( aUserName );
+    
+    iNotify.StartNotifierAndGetResponse( 
+        aStatus, 
+        KCchUiNotifierUid,
+        iPckg, 
+        iPckg );
+    
+    iNotifyStarted = ETrue;
+    
+    CCHUIDEBUG( "CCchUiGlobalQueryHandler::ShowMsgQueryL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Update query.
+// ---------------------------------------------------------------------------
+//
+void CCchUiGlobalQueryHandler::UpdateMsgQuery( TInt aSoftkeys )
+    {
+    CCHUIDEBUG( "CCchUiGlobalQueryHandler::UpdateMsgQuerys - IN" );
+    
+    iSoftkeys = aSoftkeys;
+    iCmd = EAknUpdateGlobalQuery;
+    TPckgBuf<SAknNotifierPackage<SAknGlobalMsgQueryParams> > pckg;
+    pckg().iParamData.iCmd = iCmd;
+    pckg().iParamData.iSoftkeys = iSoftkeys;
+
+    TPckgBuf<TInt> ret;
+    iNotify.UpdateNotifier( KCchUiNotifierUid, pckg, ret);
+    
+    CCHUIDEBUG( "CCchUiGlobalQueryHandler::UpdateMsgQuerys - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Cancel query.
+// ---------------------------------------------------------------------------
+//
+void CCchUiGlobalQueryHandler::CancelMsgQuery()
+    {
+    CCHUIDEBUG( "CCchUiGlobalQueryHandler::CancelMsgQuery - IN" );
+    
+    if ( iNotifyStarted )
+        {
+        iNotify.CancelNotifier( KCchUiNotifierUid );
+        iNotifyStarted = EFalse;
+        }
+    
+    CCHUIDEBUG( "CCchUiGlobalQueryHandler::CancelMsgQuery - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Get notifier parameters.
+// ---------------------------------------------------------------------------
+//
+TCCHUiNotifierParams CCchUiGlobalQueryHandler::ResultParams()
+    {
+    return iPckg();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchuinotehandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,220 @@
+/*
+* 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:  Implementation of class CCCHUiNoteHandler.
+*
+*/
+
+
+#include <avkon.rsg>
+#include <AknGlobalNote.h>
+#include <AknQueryDialog.h>
+#include <AknGlobalMsgQuery.h> 
+#include <cenrepnotifyhandler.h>
+
+#include "cchuilogger.h"
+#include "cchuinotehandler.h"
+#include "cchuiglobalqueryhandler.h"
+#include "mcchuinoteresultobserver.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+CCCHUiNoteHandler::CCCHUiNoteHandler( 
+    MCchUiNoteResultObserver& aObserver ) : 
+    CActive ( EPriorityHigh ),
+    iObserver( aObserver ),
+    iCurrentNote( MCchUiObserver::ECchUiDialogTypeNotSet )
+    {  
+    }
+
+void CCCHUiNoteHandler::ConstructL()
+    {
+    CCHUIDEBUG( "CCCHUiNoteHandler::ConstructL - IN" );
+    
+    CActiveScheduler::Add( this );
+    iGlobalQueryHandler = CCchUiGlobalQueryHandler::NewL();
+    
+    CCHUIDEBUG( "CCCHUiNoteHandler::ConstructL - OUT" );
+    }
+
+CCCHUiNoteHandler* CCCHUiNoteHandler::NewL( 
+    MCchUiNoteResultObserver& aObserver )
+    {
+    CCCHUiNoteHandler* self = 
+        new( ELeave ) CCCHUiNoteHandler( aObserver );  
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CCCHUiNoteHandler::~CCCHUiNoteHandler()
+    {
+    CCHUIDEBUG( "CCCHUiNoteHandler::~CCCHUiNoteHandler - IN" );
+    
+    Cancel();
+    delete iGlobalQueryHandler;
+    iGlobalQueryHandler = NULL;
+    
+    CCHUIDEBUG( "CCCHUiNoteHandler::~CCCHUiNoteHandler - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Launch note.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNoteHandler::LaunchNoteL( 
+    MCchUiObserver::TCchUiDialogType aNote, 
+    TUint aServiceId,
+    TUint aIapId,
+    RBuf& aUserName )
+    {
+    CCHUIDEBUG( "CCCHUiNoteHandler::LaunchNoteL - IN");
+    CCHUIDEBUG2( "LaunchNoteL - aNote: %d", aNote );
+    CCHUIDEBUG2( "LaunchNoteL - aServiceId: %d", aServiceId );
+    CCHUIDEBUG2( "LaunchNoteL - aIapId: %d", aIapId );
+    CCHUIDEBUG2( "LaunchNoteL - aUserName: %S", &aUserName );
+    CCHUIDEBUG2( "LaunchNoteL - IsActive: %d", IsActive() );
+    
+    // If already showing note => leave with KErrAlreadyExists to signal
+    // client as API definition dictates.
+    __ASSERT_ALWAYS( !IsActive(), User::Leave( KErrAlreadyExists ));
+    switch ( aNote )
+        {
+        case MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed:
+        case MCchUiObserver::ECchUiDialogTypeAuthenticationFailed:
+        case MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable:
+        case MCchUiObserver::ECchUiDialogTypeNoConnectionDefined:      
+        case MCchUiObserver::ECchUiDialogTypeConfirmChangeConnection:
+        case MCchUiObserver::ECchUiDialogTypeChangeConnection:
+        case MCchUiObserver::ECchUiDialogTypeDefectiveSettings:
+        case MCchUiObserver::ECchUiDialogTypeErrorInConnection:
+            {
+            iCurrentNote = aNote;
+            iGlobalQueryHandler->ShowMsgQueryL(
+                    aNote, iStatus, aServiceId, aIapId, aUserName );
+            SetActive();
+            }
+            break;        
+        
+        default:
+            {
+            CCHUIDEBUG( "LaunchNoteL - default switch case" );
+            User::Leave( KErrNotSupported );
+            }
+            break;        
+        }
+    CCHUIDEBUG( "CCCHUiNoteHandler::LaunchNoteL - OUT" );     
+    }
+
+// ---------------------------------------------------------------------------
+// Active dialog check. By dialog we mean dialog which needs user action.
+// ---------------------------------------------------------------------------
+//
+TBool CCCHUiNoteHandler::ActiveDialogExists()
+    {
+    CCHUIDEBUG( "CCCHUiNoteHandler::ActiveDialogExists" );
+    
+    switch ( iCurrentNote )
+        {
+        case MCchUiObserver::ECchUiDialogTypeAuthenticationFailed:
+        case MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable:
+        case MCchUiObserver::ECchUiDialogTypeNoConnectionDefined:     
+        case MCchUiObserver::ECchUiDialogTypeConfirmChangeConnection:
+        case MCchUiObserver::ECchUiDialogTypeChangeConnection:
+            {
+            return ETrue;
+            }
+        case MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed:
+        case MCchUiObserver::ECchUiDialogTypeDefectiveSettings:
+        case MCchUiObserver::ECchUiDialogTypeErrorInConnection:    
+        default:
+             {
+             return EFalse;
+             }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CancelOldNotes.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNoteHandler::CancelOldNotes()
+    {
+    CCHUIDEBUG( "CCCHUiNoteHandler::CancelOldNotes - IN" );
+    
+    if ( iGlobalQueryHandler && IsActive() )
+        {
+        iGlobalQueryHandler->CancelMsgQuery();
+        Cancel();
+        }
+    
+    CCHUIDEBUG( "CCCHUiNoteHandler::CancelOldNotes - OUT" );
+    }
+  
+// ---------------------------------------------------------------------------
+// Returns current note.
+// ---------------------------------------------------------------------------
+//    
+MCchUiObserver::TCchUiDialogType CCCHUiNoteHandler::CurrentNote()
+    {
+    return iCurrentNote;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive
+// RunL.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNoteHandler::RunL()
+    {
+    CCHUIDEBUG2( "CCCHUiNoteHandler::RunL, status: %d", iStatus.Int() );    
+    
+    TInt status = iStatus.Int();
+    if ( iGlobalQueryHandler )
+        {
+        iCurrentNote = MCchUiObserver::ECchUiDialogTypeNotSet;
+        
+        TRAP_IGNORE( iObserver.DialogCompletedL( status, 
+            iGlobalQueryHandler->ResultParams() ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive
+// DoCancel.
+// ---------------------------------------------------------------------------
+//
+void CCCHUiNoteHandler::DoCancel()
+    {
+    CCHUIDEBUG( "CCCHUiNoteHandler::DoCancel - IN" ); 
+    
+    if ( iGlobalQueryHandler )
+    	{
+    	CCHUIDEBUG( "DoCancel - cancel message query");
+    	iGlobalQueryHandler->CancelMsgQuery();
+    	}
+    
+    CCHUIDEBUG( "CCCHUiNoteHandler::DoCancel - OUT" );  
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// RunError.
+// ---------------------------------------------------------------------------
+//
+TInt CCCHUiNoteHandler::RunError( TInt /*aError*/ )
+    {         
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchuiprivateapi.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,149 @@
+/*
+* 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:  Implementation of class CCchUiPrivateApi.
+*
+*/
+
+
+#include <cch.h>
+#include "cchuiprivateapi.h"
+#include "cchuiapiimpl.h"
+#include "cchuilogger.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//    
+CCchUiPrivateApi::CCchUiPrivateApi()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//    
+void CCchUiPrivateApi::ConstructL( CCch& aCch )
+    {
+    iImpl = CCchUiApiImpl::NewL( aCch );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//    
+CCchUiPrivateApi* CCchUiPrivateApi::NewL( CCch& aCch )
+    {
+    CCHUIDEBUG( "CCchUiPrivateApi::NewL" );
+    
+    CCchUiPrivateApi* privateApi = new ( ELeave ) CCchUiPrivateApi();
+    CleanupStack::PushL( privateApi );
+    privateApi->ConstructL( aCch );
+    CleanupStack::Pop( privateApi ); 
+    return privateApi;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//    
+CCchUiPrivateApi::~CCchUiPrivateApi()
+    {
+    CCHUIDEBUG( "CCchUiPrivateApi::~CCchUiPrivateApi - IN" );
+
+    delete iImpl;
+    
+    CCHUIDEBUG( "CCchUiPrivateApi::~CCchUiPrivateApi - OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// Manual enable has proceeded
+// ---------------------------------------------------------------------------
+//
+void CCchUiPrivateApi::ManualEnableResultL( 
+    TUint32 aServiceId, TInt aEnableResult )
+    {
+    CCHUIDEBUG2( "CCchUiPrivateApi::ManualEnableStartedL - aServiceId: %d", 
+        aServiceId );
+    CCHUIDEBUG2( "CCchUiPrivateApi::ManualEnableStartedL - aEnableResult: %d", 
+        aEnableResult );        
+    iImpl->ManualEnableResultL( aServiceId, aEnableResult );
+    }
+    
+// ---------------------------------------------------------------------------
+// AddObserver
+// ---------------------------------------------------------------------------
+//
+void CCchUiPrivateApi::AddObserverL( MCchUiObserver& aObserver )
+    {
+    iImpl->AddObserverL( aObserver );
+    }
+
+// ---------------------------------------------------------------------------
+// RemoveObserver
+// ---------------------------------------------------------------------------
+//
+void CCchUiPrivateApi::RemoveObserver( MCchUiObserver& aObserver )
+    {
+    iImpl->RemoveObserver( aObserver );
+    }
+
+// ---------------------------------------------------------------------------
+// ShowDialogL
+// ---------------------------------------------------------------------------
+//
+void CCchUiPrivateApi::ShowDialogL( 
+    TUint32 aServiceId, 
+    MCchUiObserver::TCchUiDialogType aDialog )
+    {
+    iImpl->ShowDialogL( aServiceId, aDialog );
+    }
+
+// ---------------------------------------------------------------------------
+// ConfigureVisualizationL
+// ---------------------------------------------------------------------------
+//
+void CCchUiPrivateApi::ConfigureVisualizationL( 
+    RArray<MCchUiObserver::TCchUiDialogType>& aAllowedNotes,
+    RArray<TCCHSubserviceType>& aAllowedSubServices )
+    {
+    iImpl->ConfigureVisualizationL( aAllowedNotes, aAllowedSubServices );
+    }
+
+// ---------------------------------------------------------------------------
+// CancelNotes
+// ---------------------------------------------------------------------------
+//
+void CCchUiPrivateApi::CancelNotes()
+    {
+    iImpl->CancelNotes();
+    }
+
+// ---------------------------------------------------------------------------
+// Reserved1
+// ---------------------------------------------------------------------------
+//
+void CCchUiPrivateApi::Reserved1()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Reserved2
+// ---------------------------------------------------------------------------
+//
+void CCchUiPrivateApi::Reserved2()
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchuispshandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,124 @@
+/*
+* 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:  Implementation of class CCchUiSpsHandler.
+*
+*/
+
+
+#include <spentry.h>
+#include <spsettings.h>
+#include <spproperty.h>
+#include <spdefinitions.h>
+
+#include "cchuilogger.h"
+#include "cchuispshandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+CCchUiSpsHandler::CCchUiSpsHandler()
+    {
+    }
+
+void CCchUiSpsHandler::ConstructL()
+    {
+    CCHUIDEBUG( "CCchUiSpsHandler::ConstructL - IN" );
+    
+    iSettings = CSPSettings::NewL();
+    
+    CCHUIDEBUG( "CCchUiSpsHandler::ConstructL - OUT" );
+    }
+
+CCchUiSpsHandler* CCchUiSpsHandler::NewL()
+    {
+    CCchUiSpsHandler* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CCchUiSpsHandler* CCchUiSpsHandler::NewLC()
+    {
+    CCchUiSpsHandler* self = new (ELeave) CCchUiSpsHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+CCchUiSpsHandler::~CCchUiSpsHandler()
+    {
+    delete iSettings;
+    }
+
+// ---------------------------------------------------------------------------
+// Set temprorary iap id.
+// ---------------------------------------------------------------------------
+//
+void CCchUiSpsHandler::SetTemporaryIapIdL( 
+    TUint32 aServiceId, TUint32 aIapId )
+    {
+    CCHUIDEBUG( "CCchUiSpsHandler::SetTemporaryIapIdL - IN" );    
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    User::LeaveIfError( 
+        property->SetName( ESubPropertyVoIPTemporaryIAPId ) );
+    User::LeaveIfError( property->SetValue( aIapId ) );
+            
+    iSettings->AddOrUpdatePropertyL( aServiceId, *property );
+    CleanupStack::PopAndDestroy( property );
+    
+    CCHUIDEBUG( "CCchUiSpsHandler::SetTemporaryIapIdL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Set snap id.
+// ---------------------------------------------------------------------------
+//
+void CCchUiSpsHandler::SetSnapIdL( 
+    TUint32 aServiceId, TUint32 aSnapId )
+    {
+    CCHUIDEBUG( "CCchUiSpsHandler::SetSnapIdL - IN" );    
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    User::LeaveIfError( 
+        property->SetName( ESubPropertyVoIPPreferredSNAPId ) );
+    User::LeaveIfError( property->SetValue( aSnapId ) );
+        
+    iSettings->AddOrUpdatePropertyL( aServiceId, *property );
+    CleanupStack::PopAndDestroy( property );
+    
+    CCHUIDEBUG( "CCchUiSpsHandler::SetSnapIdL - OUT" );    
+    }      
+    
+// ---------------------------------------------------------------------------
+// Resolves service name
+// ---------------------------------------------------------------------------
+//
+void CCchUiSpsHandler::ServiceNameL( 
+    TUint32 aServiceId, TDes& aServiceName )
+    {
+    CCHUIDEBUG( "CCchUiSpsHandler::ServiceNameL - IN" );    
+	
+    CSPEntry* entry = CSPEntry::NewLC();
+	TInt err = iSettings->FindEntryL( aServiceId, *entry );
+	
+	if ( !err )
+	    {
+	    aServiceName = entry->GetServiceName();
+	    }
+	
+	CleanupStack::PopAndDestroy( entry );    
+    
+	CCHUIDEBUG( "CCchUiSpsHandler::ServiceNameL - OUT" );    
+    }          
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchclientapi/src/cchuitimer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2009-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:  For timer handling.
+*
+*/
+
+
+#include "cchuitimer.h"
+#include "mcchuitimerobserver.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCchUiTimer::CCchUiTimer( MCchUiTimerObserver& aObserver ) 
+    : CTimer( EPriorityStandard ), iObserver( aObserver )
+    {    
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CCchUiTimer::ConstructL()
+    {    
+    CActiveScheduler::Add( this );
+    CTimer::ConstructL();
+    }   
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCchUiTimer* CCchUiTimer::NewL( MCchUiTimerObserver& aObserver )
+    {    
+    CCchUiTimer* self = new ( ELeave ) CCchUiTimer( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CCchUiTimer::~CCchUiTimer()
+    {    
+    CTimer::Cancel();
+    }
+   
+
+// ---------------------------------------------------------------------------
+// Start timer.
+// ---------------------------------------------------------------------------
+//
+TInt CCchUiTimer::StartTimer( TTimerType /*aTimerType*/ )
+    {    
+    TInt error ( KErrNone );
+    
+    if ( CTimer::IsActive() )
+        {
+        CTimer::Cancel();
+        }
+        
+    return error;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Stop timer.
+// ---------------------------------------------------------------------------
+//
+void CCchUiTimer::StopTimer()
+    {
+    if ( CTimer::IsActive() )
+        {
+        CTimer::Cancel();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CCchUiTimer::RunL()
+    {    
+    iObserver.TimerExpired();
+    }
Binary file convergedconnectionhandler/cchserver/cenrep/10282CE5.txt has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/cenrep/cchprivatecrkeys.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* 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:  Private Central Repository definitions of the
+*                iptelephony's cch subsystem
+*
+*/
+
+
+#ifndef CCHPRIVATECRKEYS_H
+#define CCHPRIVATECRKEYS_H
+
+
+const TUid KCRUidCch = { 0x10282CE5 }; 
+
+/**
+* Indicates if WLAN VoIP warning text, that comes when it is not possible to
+* establish and/or get emergency call through when user resides inside WLAN VoIP area,
+* should be shown. Target is to show this warning to the user only once by SysAp.
+* Possible values: 1 = warning already shown, 0 = warning not shown yet.
+*/
+const TUint32 KCCHVoIPEmergencyWarningShown = 0x00000001;
+enum TCCHVoIPEmergencyWarningShown
+    {
+    ECCHVoIPEmergencyWarningNotYetShown = 0,
+    ECCHVoIPEmergencyWarningAlreadyShown = 1
+    };
+
+/**
+* Indicates if WLAN VoIP warning should be shown at all 
+* Possible values: 1 = Warning should be shown, 0 = Warning should not be shown.
+*/
+const TUint32 KCCHVoIPShowEmergencyWarningOnOff = 0x00000002;
+enum TCCHVoIPEmergencyWarningOnOff
+    {
+    ECCHVoIPEmergencyWarningOnOffDoNotShowWarning = 0,
+    ECCHVoIPEmergencyWarningOnOffShowWarning = 1
+    };
+
+/**
+* Indicates if WLAN scan was activated before service enable
+* Possible values: 0 = not defined, 1 = was enabled, 2 = was not enabled
+*/
+const TUint32 KCCHWasWlanScanActivatedBeforeServiceEnabling = 0x00000003;
+enum TCCHWasWlanScanActivatedBeforeServiceEnabling
+    {
+    ECCHWlanScanNotDefined = 0,
+    ECCHWlanScanWasEnabled = 1,
+    ECCHWlanScanWasNotEnabled = 2
+    };
+
+/**
+* Indicates count of CCH server startups, if startup flag is set to ON
+*/
+const TUint32 KCCHStartupCounter = 0x00000004;
+
+
+/**
+* Indicates if gprs roaming cost warning text, that comes when gprs connection
+* is tried to use first time, should be shown. Target is to show this warning
+* to the user only once by Cch. 1 = warning already shown, 0 = warning not shown yet.
+*/
+const TUint32 KCCHGprsRoamingCostWarningShown = 0x00000005;
+enum TCCHGprsRoamingCostWarningShown
+    {
+    ECCHGprsRoamingCostWarningNotYetShown = 0,
+    ECCHGprsRoamingCostWarningAlreadyShown = 1
+    };
+
+#endif      // CCHPRIVATECRKEYS_H
+
+// End of File
+
Binary file convergedconnectionhandler/cchserver/cenrep/keys_cch.xls has changed
Binary file convergedconnectionhandler/cchserver/conf/cch.confml has changed
Binary file convergedconnectionhandler/cchserver/conf/cch_10282CE5.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/data/cch.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2004-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resources for cch
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME    CCHS
+
+//  INCLUDES
+#include <eikon.rh>
+#include "cch.loc"
+
+//  RESOURCE DEFINITIONS 
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf="CCHServer"; }
+
+//   LOCALIZED STRINGS 
+
+RESOURCE TBUF r_qtn_first_emergency_warning_note { buf = qtn_voip_em_call_readiness_note; }
+RESOURCE TBUF r_qtn_voip_em_call_error_note_no_cs { buf = qtn_voip_em_call_error_note_no_cs; }
+RESOURCE TBUF r_qtn_voip_do_not_show_warning { buf = qtn_voip_do_not_show_warning; }
+RESOURCE TBUF r_qtn_servtab_allow_gprs_when_roaming_query { buf = qtn_servtab_allow_gprs_when_roaming_query; }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,36 @@
+/*
+* 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 Converged Connection
+                 Handler Client (CCH)
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../conf/cch.confml           APP_LAYER_CONFML(cch.confml) 		    
+../conf/cch_10282CE5.crml    APP_LAYER_CRML(cch_10282CE5.crml)
+../loc/cch.loc 		     APP_LAYER_LOC_EXPORT_PATH( cch.loc )
+
+PRJ_MMPFILES
+cchserver.mmp
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/group/cchserver.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,82 @@
+/*
+* 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 CCH server
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+MACRO           TRACE_ENTRY_EXIT_POINT
+MACRO           TRACE_ENTRY_CCHSERVER
+
+TARGET                  cchserver.exe
+TARGETTYPE              EXE
+// Since this is an exe with no GUI implementations, 
+// just use zero UID for UID2
+UID                     0x00000000 0x10275456
+EPOCSTACKSIZE           0x5000 
+CAPABILITY              CAP_SERVER NetworkControl
+VENDORID                VID_DEFAULT
+SOURCEPATH              ../src
+SOURCE                  cchconnmonhandler.cpp
+SOURCE                  cchcommdbwatcher.cpp
+SOURCE                  cchrequeststorage.cpp
+SOURCE                  cchspshandler.cpp
+SOURCE                  cchserverbase.cpp
+SOURCE                  cchserviceinfo.cpp
+SOURCE                  cchsubserviceinfo.cpp
+SOURCE                  cchservicehandler.cpp
+SOURCE                  cchsession.cpp
+SOURCE                  cchpluginhandler.cpp
+SOURCE                  cchplugin.cpp
+SOURCE                  cchsubsession.cpp
+SOURCE                  cchetelnetworkstatusnotifier.cpp
+SOURCE                  cchfeaturemanager.cpp
+SOURCE                  cchnotehandler.cpp
+SOURCE                  cchuihandler.cpp
+SOURCE                  cchwlanextension.cpp 
+SOURCE                  cchwakeupeventnotifier.cpp
+SOURCE                  cchstartupcounter.cpp
+SOURCE                  cchactivescheduler.cpp
+
+START RESOURCE ../data/cch.rss
+HEADER
+TARGETPATH APP_RESOURCE_DIR
+LANGUAGE_IDS
+END  // RESOURCE
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../cenrep
+USERINCLUDE             ../../inc           // CCH's internal headers
+
+APP_LAYER_SYSTEMINCLUDE 
+
+LIBRARY                 euser.lib
+LIBRARY                 flogger.lib         // for logging purposes
+LIBRARY                 connmon.lib
+LIBRARY                 cmmanager.lib
+LIBRARY                 ecom.lib            // for plug-ins
+LIBRARY                 serviceprovidersettings.lib
+LIBRARY                 aknnotify.lib
+LIBRARY                 centralrepository.lib
+LIBRARY                 etel.lib
+LIBRARY                 featmgr.lib
+LIBRARY                 etelmm.lib
+LIBRARY                 efsrv.lib
+LIBRARY                 bafl.lib
+LIBRARY                 commdb.lib
+LIBRARY                 apengine.lib
+LIBRARY                 avkon.lib
+LIBRARY                 commonengine.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchactivescheduler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,85 @@
+/*
+* 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:  CCchActiveScheduler declaration
+*
+*/
+
+#ifndef C_CCHACTIVESCHEDULER_H
+#define C_CCHACTIVESCHEDULER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHServerBase;
+
+/**
+ * Class provides active scheduler for CCH server
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+class CCchActiveScheduler : public CActiveScheduler
+    {
+
+public:
+
+    /**
+     * Default constructor
+     */
+    CCchActiveScheduler();
+
+    /**
+     * Destructor
+     */
+    ~CCchActiveScheduler();
+    
+public:
+    
+    /**
+     * Server setter
+     * @param aServer pointer to server
+     */
+    void SetServer( CCCHServerBase* aServer );
+    
+public: 
+
+    /**
+     * Error occurred while scheduling
+     * @param aError error code
+     */
+    void Error( TInt aError ) const;
+    
+private:
+    
+    /**
+     * Server handle
+     */
+    CCCHServerBase* iServer;
+    };
+
+#endif // C_CCHACTIVESCHEDULER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchcommdbwatcher.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,240 @@
+/*
+* 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:  CCCHCommDbWatcher declaration
+*
+*/
+
+
+#ifndef C_CCHCOMMDBWATCHER_H
+#define C_CCHCOMMDBWATCHER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <commdb.h>
+#include <cmmanager.h>
+#include <commsdattypesv1_1.h>
+
+// CONSTANTS
+// Stop requesting new notifications after this many consecutive errors
+const TInt KCchConnCenRepErrorThreshold = 80;
+
+// MACROS
+// None
+
+// DATA TYPES
+class TDestinationData
+	{
+	public:
+	inline TDestinationData(): iDestId(0), iIapCount(0), iWlanIaps(0){}
+	inline TDestinationData(TInt aDestId, TInt aIapCount):
+		iDestId(aDestId), iIapCount(aIapCount), iWlanIaps(0){}
+	TInt iDestId;	//CMM Destination ID
+	TInt iIapCount; //Number of IAPs under this destination
+	TInt iWlanIaps; //Number of WLAN IAPs under this destination
+	};
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class MCCHCommDbWatcherObserver;
+class CRepository;
+
+// CLASS DECLARATION
+
+/**
+ *  CCCHCommDbWatcher declaration
+ *  Handles CommsDb changes and notifies CCHServiceHandler at IAP count changes
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHCommDbWatcher ) : public CActive
+    {
+
+public: // Constructors and destructor
+
+    static CCCHCommDbWatcher* NewL( MCCHCommDbWatcherObserver& aObserver );
+
+    static CCCHCommDbWatcher* NewLC( MCCHCommDbWatcherObserver& aObserver );
+
+    ~CCCHCommDbWatcher();
+
+public: // new functions
+	
+    /**
+     * Returns number of IAPs that have WLAN bearer type
+     * @param aSNAPId ID of SNAP to check. Use value KErrNotFound 
+     *        to get number of WLAN IAPS without SNAP binding
+     * @param aWLANIapsOnly if ETrue, returns WLAN iap count in given SNAP
+     * @param aUpdateDestinations if ETrue, update destination before checking  
+     * @return number of IAPs in given SNAP. KErrNotFound if no IAPS
+     * @since Series 60 3.2
+     */
+    TInt GetIapCountFromSnap( TInt aSNAPId, TBool aWLANIapsOnly, TBool aUpdateDestinations = EFalse );
+     
+    /**
+     * Checks is IAP's bearer type WLAN AP.
+     * @param aIapId of IAP to check.
+     * @return ETrue if given IAP id is WLAN AP, otherwise EFalse.
+     * @since Series 60 3.2
+     */
+    TBool IsWlanApL( TInt aIapId );
+    
+	/**
+     * Checks is IAP's bearer type VPN AP.
+     * @param aIapId of IAP to check.
+     * @return ETrue if given IAP id is VPN AP, otherwise EFalse.
+     */
+    TBool IsVpnApL( TInt aIapId );
+    
+	/**
+     * IAP's bearer getter.
+     * @param aIapId.
+     * @return TUint32 bearer type.
+     */
+    TUint32 GetBearerL( TInt aIapId );
+    
+	/**
+     * Removes IAPs which are not linked to VPN AP.
+     * @param aIapIds all connected iaps, afterward only linked IAPs.
+	 * @param aIAPId VPN IAP to check.
+     */
+    void RemoveOtherThanVpnIapsL( RArray<TUint>& aIaps, TUint aIAPId );
+        
+
+protected: // From base classes
+
+    /**
+     * From CActive
+     * @since Series 60 3.2
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * @since Series 60 3.2
+     */
+    TInt RunError( TInt aError ); 
+
+    /**
+     * From CActive
+     * @since Series 60 3.2
+     */
+    void DoCancel();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCCHCommDbWatcher( MCCHCommDbWatcherObserver& aObserver );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    
+    /*
+     * Request notifications of cenrep changes
+	 * @return KErrNone if succesful
+     */
+    TInt RequestNotifications();
+    
+    /**
+     * Check changes in IAPs / SNAP configurations
+     * @param aChanged will be ETrue if there has been changes to 
+     *  either total WLAN AP count or SNAP/IAP configuration
+     * @param aSNAPId will contain ID of the changed SNAP that 
+     *  contains now more WLAN Iaps
+     */
+    void CheckIapsL( TBool& aChanged, TInt& aSNAPId );
+    
+	/**
+	 * Count number of Iaps in an array of TDestinationData.
+	 * Helper function to detect new iap additions
+	 * @param aArray Array to count from
+	 * @return total number of IAPs from the given destinations array
+     * @since S60 3.2
+	 */
+    TInt CountIapsFromArray( RArray<TDestinationData>& aArray ) const;
+
+	/**
+	 * Updates internal iDestinations store after a SNAP configuration change.
+     * Determines also the SNAP where WLAN iap(s) were added.
+	 * @param aDestinations current Snap configuration attained from cmmanager
+     * @param aChanged will be ETrue if there is a new WLAN iap
+     * @param aSNAPId holds the SNAP id of the added WLAN iap
+     * @since S60 3.2
+	 */
+    void UpdateDestinationStore( RArray<TDestinationData>& aDestinations,
+        TBool& aChanged,
+        TInt& aSNAPId);
+    
+    /**
+     * Updates IAPs / SNAPs configurations and notifies our client if 
+     * there is some changes.
+     * @return TInt general symbian error code.
+     */
+    TInt UpdateIapTable();
+    
+    /**
+     * Open connection to cmmanager 
+     * @return RCmManager reference to cmmanager
+     */
+    RCmManager& CmManagerL();
+    
+    /**
+     * Initializes destinations. 
+     */
+    void InitializeDestination();
+
+private: // data
+
+	///not own: observer to notify when there are changes in WLAN IAP/SNAPs
+	MCCHCommDbWatcherObserver& iObserver;
+
+	///own: Commsdb access to get notifications about changes
+    CCommsDatabase*				iCommDb;
+    
+    // Central repository to get notifications of commsdat changes
+    CRepository* iRepository;
+    
+    // Table id for iap table
+    TUint32 iTableId;
+    
+	///own: array holding information about iap count per destination
+	//      index 0 will contain count of iaps not bound to any
+	//      destination
+	RArray<TDestinationData>   iDestinations;
+
+	//own, connectionmethodmanager
+	RCmManager				   iCmm;
+	
+	// indicates is cmmanager open
+	TBool                      iCmmOpen;
+	
+	// Holds the last cmmanager error
+	TInt                       iLastError;
+	
+	// Error counter for cenrep notification request errors
+	TInt                       iErrorCounter;
+	
+	// Indicates do we have to use force when asking snap's iap
+	TBool                      iUseForce;
+    };
+
+#endif // C_CCHCOMMDBWATCHER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchcommdbwatcherobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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:  MCCHCommDbWatcherObserver class definition. A virtual class.
+*
+*/
+
+
+#ifndef MCCHCOMMDBWATCHEROBSERVER_H
+#define MCCHCOMMDBWATCHEROBSERVER_H
+
+// CLASS DECLARATION
+/**
+*  MCCHCommDbWatcherObserver
+*  
+*  @lib   cchserver
+*  @since 3.2
+*/
+
+class MCCHCommDbWatcherObserver
+	{
+public:
+    /**
+    * Called when new WLAN IAP(s) are added to comms db
+    * @param aSnapID ID of the SNAP where IAP count increased
+    * @since S60 3.2
+    */
+	virtual void HandleWLANIapAdded( TInt aSnapID ) = 0;		
+	};
+
+
+#endif // MCCHCOMMDBWATCHEROBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchconnmonhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,321 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCCHConnMonHandler declaration
+*
+*/
+
+
+#ifndef C_CCHCONNMONHANDLER_H
+#define C_CCHCONNMONHANDLER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <rconnmon.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHServerBase;
+class MCCHConnMonHandlerNotifier;
+
+// CLASS DECLARATION
+class TCCHConnectionInfo
+    {
+public:
+    TUint iIapId;
+    TUint iConnId;
+    };
+
+/**
+ *  CCCHConnMonHandler declaration
+ *  Handles Connection Monitor for CCH server
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHConnMonHandler ) : public CActive,
+                                          private MConnectionMonitorObserver
+    {
+public: // Constructors and destructor
+
+    /**
+     * State's of object
+     */
+    enum TCCHConnMonHandlerState
+        {
+          EUninitialized,   /// Uninitialized
+          EInitialized,     /// Initalized
+          EGetIAPS,
+          EGetSNAPs,
+          EGetIAP,
+          EGetConnectionCount,
+          EError            /// Error condition
+        };
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCCHConnMonHandler* NewL( CCCHServerBase& aServer );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCCHConnMonHandler* NewLC( CCCHServerBase& aServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHConnMonHandler();
+
+public: // New functions
+
+    /**
+     * Scan available networks
+     *
+     * @since S60 9.2
+     * @param aWlanScan ETrue if WLAN network scan needed
+     * @param aObserver Completion notified by method
+     *        NetworkScanningCompletedL() if set.
+     */
+    void ScanNetworks( TBool aWlanScan = EFalse,
+	    MCCHConnMonHandlerNotifier* aObserver = NULL );
+
+    /**
+     * Cancel network scanning
+     * @since S60 3.2
+     */
+    void ScanNetworksCancel();
+
+    /**
+     * Is Snap available
+     * @since S60 3.2
+     * @param aSNAPId
+     * @return ETrue if SNAP is available
+     */
+    TBool IsSNAPAvailable( TUint aSNAPId ) const;
+
+    /**
+     * Is IAP available
+     * @since S60 3.2
+     * @param aIapId
+     * @return ETrue if IAP is available
+     */
+    TBool IsIapAvailable( TUint aIapId ) const;
+
+    /**
+     * Sets observer to notify if SNAPs availability is changed
+     *
+     * @since S60 9.2
+     * @param aObserver Notifies by method
+     *        SNAPsAvailabilityChanged(). NULL turns off notify.
+     */
+    void SetSNAPsAvailabilityChangeListener( MCCHConnMonHandlerNotifier* aObserver );
+        
+	/**
+     * Collects all connected IAP Ids and Connection Ids to array.
+     */
+    void StartMonitoringConnectionChanges();
+	
+	/**
+     * Connected IAPs getter.
+     * @param aIapIds
+     */
+    void StopMonitoringConnectionChanges( RArray<TUint>& aIapIds );
+
+protected: // From base classes
+
+    /**
+     * From CActive
+     * @since Series 60 3.0
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * @since Series 60 3.0
+     */
+    void DoCancel();
+
+private: // From MConnectionMonitorObserver
+
+    /**
+     * @see MConnectionMonitorObserver, called when ConnMon event occured.
+     */
+    void EventL( const CConnMonEventBase &aConnMonEvent );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCCHConnMonHandler( CCCHServerBase& aServer );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Get IAPs from Connection Monitor and performs network scan
+     * @since S60 3.2
+     * @param aBearerId Bearer specific connection id.
+     */
+    void GetIaps( TConnMonBearerId aBearerId );
+
+    /**
+     * Updates available IAP Array
+     * @since S60 3.2
+     * @param aIaps available IAPs
+     */
+    void UpdateIapArray( TConnMonIapInfo aIaps );
+
+    /**
+     * Get SNAPs from Connection Monitor
+     * @since S60 3.2
+     */
+    void GetSNAPs();
+
+    /**
+     * Updates available SNAP array
+     * @since S60 3.2
+     * @param aSNAPs available SNAPs
+     */
+    void UpdateSnapArray( TConnMonSNAPInfo aSNAPs );
+
+    /**
+     * Request SNAP/IAP availability notifications from Connection Monitor.
+     * @since S60 3.2
+     */
+    void NotifyL() ;
+
+    /**
+     * Stops notifications.
+     * @since S60 3.2
+     */
+    void StopNotify();
+
+    /**
+     * Call back function to the CPeriodic.
+     * 
+     * @since S60 9.2
+     * @param aAny A pointer to this class.
+     * @return Error code
+     */
+    static TInt PeriodicTimerCallBack(TAny* aAny);
+        
+	/**
+     * Connection count solver.
+     */
+    void GetConnectionCount();
+	
+	/**
+     * IAP Id solver.
+     */
+    void GetIapId();
+	
+	/**
+     * Remove connected IAP id from connected IAPs array.
+	 * @param aConnId disconnected connection id.
+     */
+    void RemoveIapId( TUint aConnId );
+
+private: // data
+
+    /**
+     * State of active object
+     */
+    TCCHConnMonHandlerState         iState;
+
+    /**
+     * Handle to server
+     */
+    CCCHServerBase&                 iServer;
+
+    /**
+     * Connection Monitor
+     */
+    RConnectionMonitor              iConnMon;
+
+    /**
+     * Package buffer for getting available IAPs
+     */
+    TConnMonIapInfoBuf              iIapsBuf;
+
+    /**
+     * Package buffer for getting available SNAPs
+     */
+    TConnMonSNAPInfoBuf             iSNAPbuf;
+
+    /**
+     * SNAP array
+     */
+    RArray<TUint>                   iAvailableSNAPs;
+
+    /**
+     * IAP Array
+     */
+    RArray<TUint>                   iAvailableIAPs;
+
+    /**
+     * Connection change listener timer.
+     * owns.
+     */
+    CPeriodic* iConnChangeListenerTimer;
+    
+    /**
+     * Network scanning observer
+     */
+    MCCHConnMonHandlerNotifier* iNetworkScanningObserver;
+	
+    /**
+     * SNAPs availability change observer
+     */
+    MCCHConnMonHandlerNotifier* iSNAPsAvailabilityObserver;
+    
+	/**
+     * pending async request
+     */
+    RArray<TCCHConnMonHandlerState> iPendingRequests;
+	
+	/**
+     * Unsolved connection ids
+     */
+    RArray<TUint>                   iUnsolvedConnIds;
+	
+	/**
+     * Connected IAP Ids
+     */
+    RArray<TCCHConnectionInfo>      iConnIapIds;
+	
+	/**
+     * Async helpers
+     */
+    TUint                           iConnIapId;
+    TUint                           iConnId;
+    TUint                           iConnCount;
+    };
+
+#endif // C_CCHCONNMONHANDLER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchconnmonhandlernotifier.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCCHServerBase declaration
+*
+*/
+
+#ifndef M_CCHCONNMONHANDLERNOTIFIER_H
+#define M_CCHCONNMONHANDLERNOTIFIER_H
+
+#include <rconnmon.h>
+
+/**
+ *  MCCHConnMonHandlerNotifier declaration
+ *  @lib cchserver.exe
+ *  @since S60 9.2
+ */
+class MCCHConnMonHandlerNotifier
+    {
+
+public:
+    
+    /**
+     * Informs observer when network scanning is completed.
+     * 
+     * @since S60 9.2
+     * @param aSNAPs SNAPs info.
+     * @param aError Error code
+     */
+    virtual void NetworkScanningCompletedL( const TConnMonSNAPInfo& aSNAPs, TInt aError ) = 0;
+    
+    /**
+     * Informs observer when SNAPs availability is changed
+     * 
+     * @since S60 9.2
+     * @param aError Error code.
+     *        KErrTimeOut if SNAP availability is not changed in defined time.
+     */
+    virtual void SNAPsAvailabilityChanged( TInt aError ) = 0;
+
+    };
+
+#endif // M_CCHCONNMONHANDLERNOTIFIER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchetelnetworkstatusnotifier.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,153 @@
+/*
+* 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:  CCchEtelNetworkStatusNotifier handles cch's CTelephony 
+*              : related observing functionality.
+*
+*/
+
+
+#ifndef CCHETELNETWORKSTATUSNOTIFIER_H
+#define CCHETELNETWORKSTATUSNOTIFIER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <etelmm.h>
+
+// FORWARD DECLARATIONS
+
+class MCchEtelNetworkStatusObserver;
+
+// CLASS DECLARATION
+/**
+*  CCchEtelNetworkStatusNotifier
+*  
+*  @lib   cchserver
+*  @since 3.2
+*/
+
+enum TCCHEtelConnectionState
+    {
+    ECCHEtelConnect = 0,
+    ECCHEtelLoadModule,
+    ECCHEtelOpenPhone,
+    ECCHEtelConnected
+    };
+    
+class CCchEtelNetworkStatusNotifier : 
+              public CActive
+{
+public:
+
+    /**
+    * Two-phased constructor.
+    */         
+    static CCchEtelNetworkStatusNotifier* NewL( 
+        MCchEtelNetworkStatusObserver& aEtelNetworkStatusObserver );
+
+    /**
+    * Destructor.
+    */
+    ~CCchEtelNetworkStatusNotifier();
+
+public: // Other functions
+    
+    /**
+    * Returns whether network status is no-service
+    *
+    * @since S60 3.1
+    * @param None
+    * @return TBool ETrue	if network status is no-service
+    *				EFalse 	if network status is something else 
+    *                           than no-service
+    */
+    TBool IsNetworkStatusNoService() const; 
+
+    /**
+    * Connects to etel
+    *
+    * @since S60 3.2
+    * @param None
+    * @return None
+    */
+    void Connect(); 
+
+
+protected:
+
+    // From CActive
+    void RunL();
+    void DoCancel();
+
+private:
+
+    /**
+    * Constructors.
+    */         
+    CCchEtelNetworkStatusNotifier( MCchEtelNetworkStatusObserver& aEtelNetworkStatusObserver );
+    void ConstructL();
+
+    /*
+    * Order notification
+    */
+    void OrderNotification();
+
+private:
+    /**
+     * ETel server
+     */
+    RTelServer                                      iEtelServer;
+    /**
+     * phone
+     */
+    RMobilePhone                                    iPhone;
+    /*
+    * observer, not own
+    */
+    MCchEtelNetworkStatusObserver&                  iEtelNetworkStatusObserver;  
+    
+    /*
+    * current cs network registration status
+    */    
+    RMobilePhone::TMobilePhoneRegistrationStatus    iRegistrationStatus;
+ 
+    /*
+     * Last cs network registration status
+     */    
+    RMobilePhone::TMobilePhoneRegistrationStatus    iLastRegistrationStatus;
+    
+    /*
+     * Is notification already ordered?
+     */    
+    TBool                                            iNotified;
+  
+    /*
+    * delay before next try to connect to etel
+    */    
+    TInt                                            iDelay;
+    
+    /*
+    * status of etel connection
+    */    
+    TCCHEtelConnectionState                         iState;
+    
+    /*
+    * connection timer
+    */    
+    RTimer                                          iTimer;
+ 
+};
+
+#endif // CCHETELNETWORKSTATUSNOTIFIER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchetelnetworkstatusobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* 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:  MCchEtelNetworkStatusObserver handles cch's CTelephony 
+*              : related observing functionality.
+*
+*/
+
+
+#ifndef CCHETELNETWORKSTATUSOBSERVER_H
+#define CCHETELNETWORKSTATUSOBSERVER_H
+
+// INCLUDES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+*  MCchEtelNetworkStatusObserver
+*  
+*  @lib   cchserver
+*  @since 3.2
+*/
+
+class MCchEtelNetworkStatusObserver
+{
+public:
+
+    /**
+    * Called when CS coverage out
+    */         
+    virtual void MobileNetworkNoService( ) = 0;
+
+private:
+
+    
+};
+
+#endif // CCHETELNETWORKSTATUSOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchfeaturemanager.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCchFeatureManager
+*                Reads phone features
+*
+*/
+
+
+#ifndef CCHFEATUREMANAGER_H
+#define CCHFEATUREMANAGER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CRepository;
+
+// CLASS DECLARATION
+/**
+*  CCchFeatureManager
+*  
+*  @lib   cchserver
+*  @since 3.2* 
+*/
+class CCchFeatureManager: public CBase
+{
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCchFeatureManager* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchFeatureManager();
+    
+    /**
+     * Returns whether VoIP is supported.
+     *
+     * @since S60 3.2
+     * @return ETrue if feature is supported
+     */  
+    TBool VoIPSupported() const;
+    
+    /**
+     * Checks is phone in offline-mode.
+     *
+     * @since S60 3.2
+     * @return ETrue if phone is in offline-mode
+     */  
+    TBool OfflineMode() const;
+       
+    /**
+     * Returns whether Cover Display is supported.
+     *
+     * @since S60 3.2
+     * @return ETrue if feature is supported
+     */  
+    TBool CoverDisplaySupported() const;
+
+private:
+
+    /**
+     * Constructors
+     */         
+    CCchFeatureManager();
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private:
+    
+    /**
+    * VoIP support status.
+    */
+    TBool iVoIPSupported;
+    
+    /**
+    * Cover display support status.
+    */
+    TBool iCoverDisplaySupported;
+    
+    /**
+    * Offline mode
+    */
+    CRepository* iOfflineRepository;
+};
+
+#endif // CCHFEATUREMANAGER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchnotehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,184 @@
+/*
+* 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:  CCH note handler.
+*
+*/
+
+#ifndef CCHNOTEHANDLER_H
+#define CCHNOTEHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <AknGlobalMsgQuery.h>
+#include <centralrepository.h>
+
+#include "cchclientserverinternal.h"
+
+// CLASS DECLARATION
+class CCCHServerBase;
+
+/**
+*  Global message query information
+*
+*  @since Series60 5.0
+*/
+class TGlobalMsgQueryInfo
+    {
+    public:
+        // Message text resource Id
+        TInt iResourceId;
+        
+        // Softkey Id
+        TInt iSoftkeyId;
+        
+        // Secondary display index
+        TInt iSecondaryDisplayIndex;
+    };
+
+/**
+*  Handles cch global note showing.
+*
+*  @since Series60 5.0
+*/
+class CCchNoteHandler: public CActive
+    {
+    
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        *
+        * @param aCchCenRep cch central repository.
+        * @param aCoverDisplaySupported ETrue if cover display supported.
+        * @return new instance.
+        */
+        static CCchNoteHandler* NewL( CCCHServerBase& aServer );
+            
+        /**
+        * Destructor.
+        */
+        virtual ~CCchNoteHandler();
+       
+    public: // new function
+    
+       /**
+        * Lauches Emergency note.
+        * @since Series60 5.0
+        * 
+        * @param aCchGlobalNoteType cch global note type.
+        * @param aSoftKeyConfig softkey configuration.
+        * @param aType type of confirmation query.
+        * @param aSecondaryDisplayIndex secondary display index.
+        */
+        void LaunchGlobalNoteL(
+            const TInt aResourceID, 
+            const TInt aSoftKeyConfig,
+            const TInt aSecondaryDisplayIndex );
+
+        /**
+         * detects if query is being displayed
+         */
+        TBool CanBeDestroyed();
+            
+        /**
+        * Return CCH Central Repository reference
+        */
+        CRepository* CchCenRep();
+                    
+    private: //from base class
+    
+        /**
+        * @see CActive.
+        */
+        void RunL();
+
+        /**
+        * @see CActive.
+        */
+        void DoCancel();
+        
+        /**
+        * @see CActive.
+        */
+        TInt RunError( TInt aError );
+                    
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CCchNoteHandler( CCCHServerBase& aServer );
+
+        /**
+        * 2nd phase constructor
+        */
+        void ConstructL();
+   
+        /**
+        * Deletes all temporary instances.
+        */
+        void DeleteAllL();
+
+        /**
+        * Load notification resource
+        */
+        HBufC* LoadResourceL( TInt aResourceID );
+        
+        /**
+        * Scan the file location
+        */
+        HBufC* ScanFileL( const TDesC& aFileName, 
+                        const TDesC& aFilePath );
+                        
+        /**
+        * 
+        */
+        void DoLaunchGlobalNoteL( const TInt aResourceId, 
+                const TInt aSoftKeyConfig,
+                const TInt aSecondaryDisplayIndex );                        
+
+    private:    // Data  
+                        
+        // Akn global message query 
+        CAknGlobalMsgQuery*          iGlobalMsgQuery;
+        
+        // central repository, not own but can be deleted
+        CRepository*      	         iCchCenRep; 
+        
+        // Handle to server
+        CCCHServerBase&             iServer;
+
+        // do we have secondary display?
+        TBool                        iCoverDisplaySupported;
+        
+        // resource file path + name
+        HBufC*                       iResourceFile;
+        
+        // Current resource Id
+        TInt                         iResourceId;
+        
+        // should I commit suicide
+        TBool                        iDie;       
+        
+        // File session
+        RFs                          iFsSession;
+        
+        // Message query information array
+        RArray<TGlobalMsgQueryInfo> iMsgQueryInfoArray;
+    };
+
+#endif      // CCHNOTEHANDLER_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchplugin.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  CCCHPlugin declaration
+*
+*/
+
+
+#ifndef C_CCHPLUGIN_H
+#define C_CCHPLUGIN_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "cchserviceobserver.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCchService;
+class MCCHServiceNotifier;
+
+// CLASS DECLARATION
+
+/**
+ *  CCCHPlugin declaration
+ *  Class contains plug-in's information
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHPlugin ) : public CBase,
+                                  public MCchServiceObserver
+    {
+
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCCHPlugin* NewL( TUid aUid );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHPlugin();
+    
+public: // New functions
+
+    /**
+     * Check Plug-ins Uid
+     * @since S60 3.2
+     * @param aUid Plug-in's Uid
+     * @return TBool ETrue if Uid is same that this Plug-in's Uid
+     */
+    TBool CheckUid( const TUid aUid ) const;
+    
+    /**
+     * Return pointer to CCHService plug-in
+     * @since S60 3.2
+     * @return Pointer to CCHService plug-in
+     */
+    CCchService* Plugin() const;
+
+    /**
+     * Adds a observer for plugin events.
+     * @since S60 3.2
+     * @param aObserver Pointer to observer.
+     */
+    void SetServiceNotifier( MCCHServiceNotifier* aObserver );
+
+    /**
+     * Removes a observer for plugin events.
+     * @since S60 3.2
+     * @param aObserver Pointer to observer.
+     */
+    void RemoveServiceNotifier( MCCHServiceNotifier* aObserver );
+    
+private:
+
+    /**
+     * CCchService implementation have to use this callback
+     * method when service state changed. 
+     * @since S60 3.2
+     * @param aServiceId Service which state has changed
+     * @param aType Subservice's type. 
+     * @param aState A new state of the service.
+     */
+    void ServiceStateChanged( const TServiceSelection aServiceSelection,
+        TCCHSubserviceState aState, TInt aError );    
+    
+private:
+    
+    /**
+     * C++ default constructor.
+     */
+    CCCHPlugin( TUid aUid );
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL( TUid aUid );
+
+private: // data
+    
+    /**
+     * Loaded plug-in
+     */
+    CCchService*                        iPlugin;
+    
+    /**
+     * Plug-ins Uid
+     */
+    TUid                                iUid;
+    
+    /**
+     * Plug-ins observers
+     */
+    RPointerArray<MCCHServiceNotifier>  iObservers;
+    
+    };
+
+#endif // C_CCHPLUGIN_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchpluginhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,346 @@
+/*
+* 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:  CCCHPluginHandler declaration
+*
+*/
+
+
+#ifndef C_CCHPLUGINHANDLER_H
+#define C_CCHPLUGINHANDLER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <ecom/implementationinformation.h>
+
+#include "cchclientserver.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHServerBase;
+class CCCHPlugin; 
+class REComSession;
+class MCCHServiceNotifier;
+
+// CLASS DECLARATION
+
+/**
+ *  CCCHPluginHandler declaration
+ *  Class handles plug-in's for CCH server
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHPluginHandler ) : public CBase
+    {
+
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCCHPluginHandler* NewL( CCCHServerBase& aServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHPluginHandler();
+    
+public: // New functions
+    
+    /**
+     * Load all available plug-ins
+     * @since S60 3.2
+     */
+    void LoadPluginsL();
+
+    /**
+     * Load a certain Plug-in
+     * @since S60 3.2
+     * @param aUid Plug-ins Uid
+     */
+    void LoadPluginsL( const TUid& aUid );
+    
+    /**
+     * Unloads a certain Plug-in
+     * @since S60 3.2
+     * @param aUid Plug-ins Uid
+     */
+    void UnloadPlugin( const TUid& aUid );
+
+    /**
+     * Enable a certain Service
+     * @since S60 3.2
+     * @param aServiceId Service to enable
+     * @param aUids Uids-array contains Connectivity Plug-ins Uids
+     * @param aType Subservice's type to enable
+     * @param aObserver Pointer to observer.
+     * @param aIapId Used IAP Id
+     * @param aConnectivityCheck Is value is True Connectivity Plug-in will
+     * make test call to check is the connection truly working.
+     */
+    void EnableServiceL( const TUint32 aServiceId,
+                         const RArray<TUid>& aUids,
+                         const TCCHSubserviceType aType,
+                         MCCHServiceNotifier* aNotifier,
+                         const TUint32 aIapId = 0,
+                         const TBool aConnectivityCheck = EFalse );
+
+    /**
+     * Disable a certain Service
+     * @since S60 3.2
+     * @param aServiceId Service to disable
+     * @param aUids Uids-array contains Connectivity Plug-ins Uids
+     * @param aType Subservice's type to disable
+     */
+    void DisableServiceL( const TUint32 aServiceId,
+                          const RArray<TUid>& aUids,
+                          const TCCHSubserviceType aType ) const;
+
+    /**
+     * Get a certain Service's state
+     * @since S60 3.2
+     * @param aServiceId Used Service Id
+     * @param aUid Service's Uid 
+     * @param aType Subservice's type
+     * @param aState On completion contains Service's state
+     * @param aError Returns the current error
+     */
+    void GetServiceState( const TUint32 aServiceId,
+                          const TUid aUid,
+                          const TCCHSubserviceType aType,
+                          TCCHSubserviceState& aState,
+                          TInt& aError );
+
+    /**
+     * Get a certain Service's network(SNAP/IAP) information
+     * @since S60 3.2
+     * @param aServiceId Used Service Id
+     * @param aUid Service's Uid 
+     * @param aType Subservice's type
+     * @param aSnapId On completion contains Service's SNAP Id
+     * @param aIapId On completion contains Service's IAP Id
+     * @param aSNAPLocked On completion contains ETrue if Service's SNAP Id cannot be edited
+     * @return General symbian error code.
+     */
+    TInt GetServiceNetworkInfo( const TUint32 aServiceId,
+                                const TUid aUid,
+                                const TCCHSubserviceType aType,
+                                TUint32& aSnapId,
+                                TUint32& aIapId,
+                                TBool& aSNAPLocked,
+                                TBool& aPasswordSet);
+
+    /**
+     * Set Service to use given SNAP Id
+     * @since S60 3.2
+     * @param aServiceId Used Service Id
+     * @param aUids Uids-array contains Connectivity Plug-ins Uids
+     * @param aType Subservice's type
+     * @param aSnapId Set Service to use this SNAP Id
+     */
+    void SetSnapIdL( const TUint32 aServiceId,
+                     const RArray<TUid>& aUids,
+                     const TCCHSubserviceType aType,
+                     const TUint32 aSnapId );
+
+    /**
+     * Set Service to use given IAP Id
+     * @since S60 3.2
+     * @param aServiceId Used Service Id
+     * @param aUids Uids-array contains Connectivity Plug-ins Uids
+     * @param aType Subservice's type
+     * @param aIapId Set Service to use this IAP Id
+     * @leave Symbian error code
+     */
+    void SetIapIdL( const TUint32 aServiceId,
+                    const RArray<TUid>& aUids,
+                    const TCCHSubserviceType aType,
+                    const TUint32 aIapId );
+
+    /**
+     * Set Service to use given username
+     * @since S60 3.2
+     * @param aServiceId Used Service Id
+     * @param aUids Uids-array contains Connectivity Plug-ins Uids
+     * @param aType Subservice's type
+     * @param aUsername Set Service to use this username
+     * @return In case of an error leaves. 
+     *         KErrNotFound or symbian error code.
+     *         KErrArgument if passed argument(s) is/are incorrect
+     */
+    void SetUsernameL( const TUint32 aServiceId,
+                       const RArray<TUid>& aUids,
+                       const TCCHSubserviceType aType,
+                       const TDesC& aUsername );
+
+    /**
+     * Returns the connection parameters
+     * @since S60 3.2.3
+     * Uid Plug-in uid.
+     * @param aServiceSelection Selected service, ID and type
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    TInt GetConnectionParameter( const TUid aUid,
+                                 const TServiceSelection& aServiceSelection, 
+                                 RBuf& aValue );
+
+    
+    /**
+     * Set Service to use given password
+     * @since S60 3.2
+     * @param aServiceId Used Service Id
+     * @param aUids Uids-array contains Connectivity Plug-ins Uids
+     * @param aType Subservice's type
+     * @param aUsername Set Service to use this password
+     * @return In case of an error leaves. 
+     *         KErrNotFound or symbian error code.
+     *         KErrArgument if passed argument(s) is/are incorrect
+     */
+    void SetPasswordL( const TUint32 aServiceId,
+                       const RArray<TUid>& aUids,
+                       const TCCHSubserviceType aType,
+                       const TDesC& aPassword );
+    
+    /**
+     * Get Service's protocol information
+     * @since S60 3.2
+     * @param aServiceId Used Service Id
+     * @param aUid Service's Uid 
+     * @param aType Subservice's type
+     * @param aBuffer On completion contains Service's information
+     * @return General symbian error code.
+     */
+    TInt GetServiceInfo( const TUint32 aServiceId,
+                         const TUid aUid,
+                         const TCCHSubserviceType aType,
+                         TDes& aBuffer );
+
+    /**
+     * Reserve service for exclusive use
+     * @since S60 3.2
+     * @param aServiceId Used Service Id
+     * @param aUid Service's Uid 
+     * @param aType Subservice's type
+     * @return General symbian error code.
+     */
+    TInt ReserveService( const TUint32 aServiceId,
+                         const TUid aUid,
+                         const TCCHSubserviceType aType );
+
+    
+    /**
+     * Free exlusive service reservation
+     * @since S60 3.2
+     * @param aServiceId Used Service Id
+     * @param aUid Service's Uid 
+     * @param aType Subservice's type
+     * @return General symbian error code.
+     */
+    TInt FreeService( const TUint32 aServiceId,
+                         const TUid aUid,
+                         const TCCHSubserviceType aType );
+    
+    /**
+     * Returns the service's reservation status
+     * @since S60 3.2
+     * @param aServiceId Used Service Id
+     * @param aUid Service's Uid 
+     * @param aType Subservice's type
+     * @return Reservation status.
+     */
+    TBool IsReserved( const TUint32 aServiceId,
+                         const TUid aUid,
+                         const TCCHSubserviceType aType ) const;
+                         
+    /**
+     * Is Service available via these IAPs
+     * @since S60 3.2
+     * @param aServiceId Used Service Id
+     * @param aUid Service's Uid 
+     * @param aType Subservice's type
+     * @param aIapIdArray Id array of the currently available IAPs.
+     * @return ETrue if service is available.
+     */
+    TBool IsAvailableL( const TUint aServiceId,
+                        const TUid aUid,
+                        const TCCHSubserviceType aType,
+                        RArray<TUint32>& aIapIds ) const;
+                                                 
+    /**
+     * Adds a observer for Plug-in events.
+     * @since S60 3.2
+     * @param aObserver Pointer to observer.
+     */
+    void SetServiceNotifier( MCCHServiceNotifier* aObserver );
+
+    /**
+     * Removes a observer for Plug-in events.
+     * @since S60 3.2
+     * @param aObserver Pointer to observer.
+     */
+    void RemoveServiceNotifier( MCCHServiceNotifier* aObserver );
+        
+private:
+
+    /**
+     * Find Plug-in's index number
+     * @since S60 3.2
+     * @param aUid Plug-in's Uid
+     * @param TInt Plug-in's index number or KErrNotFound
+     */
+    TInt Find( const TUid& aUid ) const;
+    
+    /**
+     * Cleanup RImplInfoPtrArray
+     * @since S60 3.2
+     * @param aArray Which to be destroyed
+     */
+    static void ResetAndDestroy( TAny* aArray );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCCHPluginHandler( CCCHServerBase& aServer );
+    
+private: // data
+
+    /**
+     * Server handle
+     */
+    CCCHServerBase&                 iServer;
+    
+    /**
+     * Array of loaded Plug-ins
+     */
+    RPointerArray<CCCHPlugin>       iPlugins;
+
+    };
+
+#endif // C_CCHPLUGINHANDLER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchrequeststorage.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  CCCHRequestStorage declaration
+*
+*/
+
+
+#ifndef C_CCHREQUESTSTORAGE_H
+#define C_CCHREQUESTSTORAGE_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "cchclientserverinternal.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHServerBase;
+class CCCHSubsession;
+
+// DATA TYPES
+/**
+ * Storage entry structure.
+ */
+class TCCHStorageEntry
+    {
+public:
+    /**
+     * Request type
+     */
+    TCCHCommands            iRequest; 
+    /**
+     * IPC message
+     */
+    RMessage2*              iMessage;
+    /**
+     * Pointer to subsession. Not own
+     */
+    const CCCHSubsession*   iSubsession;
+    };
+
+// CLASS DECLARATION
+
+/**
+ *  CCCHRequestStorage declaration
+ *  Storage for asynchronous requests.
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHRequestStorage ) : public CBase
+    {
+public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCCHRequestStorage* NewL( CCCHServerBase& aServer );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCCHRequestStorage* NewLC( CCCHServerBase& aServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHRequestStorage();
+
+public: // New functions
+
+    /**
+     * Add new request into storage.
+     * @since S60 3.2
+     * @param aRequest IPC of request.
+     * @param aMessage Message object of request.
+     * @param aSubsession Pointer to subsession of request.
+     */
+    void AddRequestL( TCCHCommands aRequest,
+                      const RMessage2& aMessage,
+                      const CCCHSubsession* aSubsession );
+
+    /**
+     * Complete and remove request from storage.
+     * @since S60 3.2
+     * @param aRequest IPC of request.
+     * @param aSubSession Pointer to subsession of request.
+     * @param aError Request is completed with this value.
+     * @return KErrNone if successfull, KErrNotFound if request is not found.
+     */
+    TInt CompleteRequest( TCCHCommands aRequest,
+                          const CCCHSubsession* aSubsession,
+                          TInt aError );
+    
+    /**
+     * Complete and remove request from storage. Also writes
+     * TAny back to the client
+     * @since S60 3.2
+     * @param aRequest IPC of request.
+     * @param aSubSession Pointer to subsession of request.
+     * @param aParams TAny parameter, which returns back to the client
+     * @param aError Request is completed with this value.
+     * @return KErrNone if successfull, KErrNotFound if request is not found.
+     */
+    TInt CompleteRequestL( TCCHCommands aRequest,
+                           const CCCHSubsession* aSubsession,
+                           TAny* aParams,
+                           TInt aError );
+                                                    
+    /**
+     * Remove all requests by session pointer from storage.
+     * @since S60 3.2
+     * @param aSubSession Subsession pointer.
+     * @return KErrNone if successfull, KErrNotFound if no requests are found.
+     */
+    TInt RemoveRequestsBySession( const CCCHSubsession* aSubsession );
+    
+    /**
+     * Add session to request storage.
+     * @since S60 3.2
+     * @param aSubSession Subsession pointer.
+     */
+    void AddSession( CCCHSubsession* aSubsession );
+    
+    /**
+     * Remove session from request storage.
+     * @since S60 3.2
+     * @param aSubSession Subsession pointer.
+     * @return KErrNone if successfull, KErrNotFound if no requests are found.
+     */
+    TInt RemoveSession( const CCCHSubsession* aSubsession );
+    
+    /**
+     * Notify client about subservice state change
+     * @since S60 3.2
+     * @param aNewState Service's new information, which writes 
+     * back to the client
+     */
+    void NotifyServiceStatesChange( TServiceStatus aNewStatus );
+
+    /**
+     * Starts to scan available network
+     * @since S60 3.2
+     */
+    void ScanNetworks();
+
+    /**
+     * Cancels scanning request.
+     * @since S60 3.2
+     */
+    void ScanNetworksCancel();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCCHRequestStorage( CCCHServerBase& aServer );
+
+    /**
+     * Delete request from storage
+     * @since S60 3.2
+     * @param aIndex Index of request in storage.
+     */
+    void DeleteRequest( TInt aIndex );
+
+private: // data
+
+    /**
+     * Server handle
+     */
+    CCCHServerBase&             iServer;
+
+    /**
+     * Array of requests.
+     */
+    RArray<TCCHStorageEntry>    iRequests;
+    
+    /**
+     * Array of subsessions.
+     */
+    RArray<CCCHSubsession*>     iSubsessions;
+
+    };
+
+#endif // C_CCHREQUESTSTORAGE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchsecondarydisplayapi.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,78 @@
+/*
+* 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:  The set of messages provided to Secondary Display software by
+*              : cch application.
+*
+*/
+
+#ifndef CCH_SECONDARY_DISPLAY_API_H
+#define CCH_SECONDARY_DISPLAY_API_H
+
+// INCLUDES
+#include <e32base.h>
+
+/*
+* ==============================================================================
+* This file contains the following sections:
+*   - Dialog definitions
+*   - Command definitions
+*   - Event definitions
+*   - Parameter definitions
+* ==============================================================================
+*/
+
+namespace SecondaryDisplay
+{
+	
+// The category UID for the messages in this header file.
+//
+const TUid KCatCch = {0x10282CE6};
+
+/*
+* ==============================================================================
+* Dialogs shown by Cch subsystem. These messages are handled using the
+* Secondary Display support in Avkon.
+* ==============================================================================
+*/
+enum TSecondaryDisplayCchDialogs
+    {
+    /**
+    * No note. Error condition if this comes to CoverUI
+    */
+    ECmdNoNote = 0,
+    
+    /**
+    * A command for showing the VoIP "Do not show this emergency call warning in the future" 
+    * query on secondary display. 
+    */
+    ECmdShowDoNotShowVoipEmergencyCallWarningQuery,
+
+    /**
+    * A command for showing the query about VoIP call readiness being reached
+    * first time on secondary display.
+    */
+    ECmdShowVoipEmergencyCallReadinessQuery,
+
+    /**
+    * A command for showing the query about only having VoIP call capability
+    * on secondary display.
+    */
+    ECmdShowVoipEmergencyCallErrorNoteNoCsQuery,
+    };
+
+} // namespace SecondaryDisplay
+
+#endif      // CCH_SECONDARY_DISPLAY_API_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchserverbase.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,355 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCCHServerBase declaration
+*
+*/
+
+
+#ifndef C_CCHSERVERBASE_H
+#define C_CCHSERVERBASE_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <cchclientserver.h>
+#include "cchwakeupeventobserver.h"
+#include "cchconnmonhandlernotifier.h"
+
+// CONSTANTS
+
+// Security Policy
+const TUint KCCHRangeCount = 2;
+
+const TInt KCCHRanges[ KCCHRangeCount ] =
+    {
+    0,  /// Session
+    24, // Non implemented requests (requests out of range)
+    };
+
+const TUint8 KCCHElementsIndex[ KCCHRangeCount ] =
+    {
+    0,
+    CPolicyServer::ENotSupported,
+    };
+
+const CPolicyServer::TPolicyElement KCCHElements[] =
+    {
+        {
+        _INIT_SECURITY_POLICY_C1( ECapabilityNetworkServices ),
+            CPolicyServer::EFailClient
+        },
+        // Policy "0"; Fail call if ECapabilityNetworkServices not present
+    };
+
+const CPolicyServer::TPolicy KCCHPolicy =
+    {
+    CPolicyServer::EAlwaysPass,     // Connection attempts allowed
+    KCCHRangeCount,                 // Range count
+    KCCHRanges,                     // Ranges
+    KCCHElementsIndex,              // Elements index
+    KCCHElements,                   // Elements
+    };
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHRequestStorage;
+class CCCHPluginHandler;
+class CCCHSPSHandler;
+class CCCHServiceHandler;
+class CCCHConnMonHandler;
+class CCchFeatureManager;
+class CCchWakeUpEventNotifier;
+class CCchStartupCounter;
+
+// CLASS DECLARATION
+
+/**
+ *  CCCHServerBase declaration
+ *  The server of CCH services.
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHServerBase ) : public CPolicyServer,
+			                          public MCchWakeUpEventObserver,
+			                          public MCCHConnMonHandlerNotifier
+    {
+
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCCHServerBase* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCCHServerBase* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHServerBase();
+
+public: // New functions
+
+    /**
+     * Notify the server that a session has been created.
+     * @since S60 3.2
+     */
+    void NotifySessionCreatedL();
+
+    /**
+     * Notify the server that a session has been closed.
+     * @since S60 3.2
+     */
+    void NotifySessionClosed();
+
+    /**
+     * Panic the client.
+     * @since S60 3.2
+     * @param aMessage The panic message
+     * @param aPanic The panic code.
+     */
+    void PanicClient( const RMessage2& aMessage, TInt aPanic );
+
+    /**
+     * Panic the server.
+     * @since S60 3.2
+     * @param aPanic The panic code.
+     */
+    void PanicServer( TInt aPanic );
+
+    /**
+     * Gives reference to container for object containers.
+     * @since S60 3.2
+     * @return Container for object containers.
+     */
+    CObjectConIx& ObjectContainerIx();
+
+    /**
+     * Return reference to CCCHRequestStorage
+     * @since S60 3.2
+     * @return Reference to CCCHRequestStorage
+     */
+    CCCHRequestStorage& RequestStorage();
+
+    /**
+     * Return reference to CCCHConnMonHandler
+     * @since S60 3.2
+     * @return Reference to CCCHConnMonHandler
+     */
+    CCCHConnMonHandler& ConnMonHandler();
+
+    /**
+     * Return reference to CCCHConnMonHandler
+     * @since S60 3.2
+     * @return Reference to CCCHConnMonHandler
+     */
+    CCCHSPSHandler& SPSHandler();
+    
+    /**
+     * Return reference to CCCHPluginHandler
+     * @since S60 3.2
+     * @return Reference to CCCHPluginHandler
+     */
+    CCCHPluginHandler& PluginHandler();
+    
+    /**
+     * Return reference to CCCHServiceHandler
+     * @since S60 3.2
+     * @return Reference to CCCHServiceHandler
+     */
+    CCCHServiceHandler& ServiceHandler();
+    
+    /**
+     * Return reference to CCCHFeatureManager
+     * @since S60 3.2
+     * @return Reference to CCCHFeatureManager
+     */
+    CCchFeatureManager& FeatureManager();
+    
+    /**
+     * Create startup counter.
+     * @since S60 3.2
+     */
+    void CreateStartupCounterL();
+             
+    /**
+     * Reset startup counter.
+     * @since S60 3.2
+     */
+    void ResetStartupCounterL();
+
+    /**
+     * Indicates if the voip emergency note has been shown or not.
+     * @since S60 3.2
+     */
+    TBool VoIPEmergencyNoteShown();
+    
+    /**
+     * Sets the voip emergency note shown flag.
+     * @since S60 3.2
+     */
+    void SetVoIPEmergencyNoteShown( TBool aShown );
+    
+    /**
+     * Restarts server.
+     * @since S60 3.2
+     */
+    void Restart();
+    
+public: // Methods from base classes
+
+    /**
+     * (From CServer2) Creates a new session for a client.
+     *
+     * @param aVersion (OUT) The version of the server.
+     * @param aMessage IPC message
+     * @return A new instance of CWLMSession.
+     */
+     virtual CSession2*  NewSessionL(
+            const TVersion& aVersion,
+            const RMessage2& aMessage ) const;
+     
+     /**
+      * (From MCchWakeUpEventObserver) Creates a new session for a client.
+      *
+      * Switch server to monitoring mode
+      */
+     void WakeUp();
+
+private: // From MCCHConnMonHandlerNotifier
+    
+    void NetworkScanningCompletedL( const TConnMonSNAPInfo& aSNAPs, TInt aError );
+    
+    void SNAPsAvailabilityChanged( TInt aError );
+         
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCCHServerBase();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Shutdowns server
+     */
+    void ShutDownServerL();
+
+    /**
+     * Initialize server and it's components
+     */
+    void InitServerObjectsL();
+    
+    /**
+     * Switch server to monitoring mode
+     */
+    void StartMinimalServerL();
+ 
+    TBool IsServerShutdownAllowedL();
+    
+    /**
+     * Release all dynamic memory allocations and other resources
+     */
+    void ReleaseAllResources();
+	
+    /**
+     * Starts service
+     */
+    void ServiceStartupL();
+        
+    template <class T>T& ConstructObject( CCCHServerBase* aThis, T*& aObject );
+    template <class T>T& ConstructObject( T*& aObject );
+
+
+private: // data
+
+    /**
+     * Session counter
+     */
+    TInt                iSessionCounter;
+
+    /**
+     * Object container factory for sessions
+     */
+    CObjectConIx*       iObjectConIx;
+
+    /**
+     * Storage for asynchronous requests.
+     */
+    CCCHRequestStorage* iRequestStorage;
+
+    /**
+     * Object for handling ConnMon
+     */
+    CCCHConnMonHandler* iConnMonHandler;
+
+    /**
+     * Object for handling Service Provider Settings
+     */
+    CCCHSPSHandler*     iSPSHandler;
+    
+    /**
+     * Object for handling Plug-ins.
+     */
+    CCCHPluginHandler*  iPluginHandler;
+    
+    /**
+     * Object for handling Services
+     */
+    CCCHServiceHandler* iServiceHandler;
+    
+    /**
+     * Cch's feature manager
+     */
+    CCchFeatureManager* iFeatureManager;
+    
+    /**
+     * Wake-up event notifer
+     */
+    CCchWakeUpEventNotifier *iWakeUpEventNotifier;
+    
+    /**
+     * Counts startups
+     */
+    CCchStartupCounter* iStartupCounter;
+    
+    /**
+     * Have we already shown the emergency call note?
+     */    
+    TBool iVoIPEmergencyNoteShown;
+    
+    /**
+     * Have we already initialized the server objects?
+     */    
+    TBool iServerObjectsInit;  
+    };
+
+#endif // C_CCHSERVERBASE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchservicehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,530 @@
+/*
+* Copyright (c) 2007-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:  CCCHServiceHandler declaration
+*
+*/
+
+
+#ifndef C_CCHSERVICEHANDLER_H
+#define C_CCHSERVICEHANDLER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <mspnotifychangeobserver.h>
+
+#include "cchserviceinfo.h"
+#include "cchsubserviceinfo.h"
+#include "cchservicenotifier.h"
+#include "cchclientserver.h"
+#include "cchcommdbwatcherobserver.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHServiceInfo;
+class CCCHServerBase;
+class CCCHSubserviceInfo;
+class CSPNotifyChange;
+class CCchUIHandler;
+class CCchWlanExtension;
+class CCCHCommDbWatcher;
+
+// DATA TYPES
+typedef RPointerArray<CCCHServiceInfo> RServiceArray;
+
+// CLASS DECLARATION
+
+/**
+ *  CCCHServiceHandler declaration
+ *  Handles services and service related components
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHServiceHandler ) : public CBase,
+                                          private MCCHServiceNotifier,
+                                          private MSPNotifyChangeObserver,
+                                          private MCCHCommDbWatcherObserver
+    {
+
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCCHServiceHandler* NewL( CCCHServerBase& aServer );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCCHServiceHandler* NewLC( CCCHServerBase& aServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHServiceHandler();
+
+public: // New functions
+
+    /**
+     * Initialize object
+     * @since S60 3.2
+     */
+    void InitServiceHandlerL();
+
+    /**
+     * Update service and subservice's state
+     * @since S60 3.2
+     * @param aReadSettingTable If ETrue class reads and updates 
+     * all services from Service Provider Settings
+     */
+    void UpdateL( TBool aReadSettingTable = EFalse );
+
+    /**
+     * Enables service
+     * @since S60 3.2
+     * @param aServiceSelection Service to enable
+     * @param aConnectivityCheck Is value is True Connectivity Plug-in will
+     * make test call to check is the connection truly working.
+     * @return General symbian error code.
+     */
+    TInt EnableService( const TServiceSelection aServiceSelection,
+                        const TBool aConnectivityCheck );
+
+    /**
+     * Disables service
+     * @since S60 3.2
+     * @param aServiceSelection Service to disable
+     * @return General symbian error code.
+     */
+    TInt DisableService( const TServiceSelection aServiceSelection );
+
+    /**
+     * Set new connection information to Service
+     * @since S60 3.2
+     * @param aServiceConnInfo Connection information
+     * @return General symbian error code.
+     */
+    TInt SetConnectionInfo( const TServiceConnectionInfo aServiceConnInfo );
+
+    /**
+     * Get connection information from Service
+     * @since S60 3.2
+     * @param aServiceSelection Selected Service
+     * @param aServiceConnInfo On completion contains Service's 
+     * connection infomation
+     * @return General symbian error code.
+     */
+    TInt GetConnectionInfo( TServiceConnectionInfo& aServiceConnInfo );
+
+    /**
+     * Is any service's startup-flag set to true
+     * @since S60 3.2
+     * @return ETrue if startup-flag is set to true
+     */
+    TBool IsStartupFlagSet() const;
+    
+    /**
+     * Subservice's enable at startup info setter. 
+     * Method does not change value for permanently. 
+     * CCCHSPSHandler::SetLoadAtStartUpL sets value for permanently. 
+     * @since S60 3.2
+     * @param aServiceSelection Service which owns startup flag
+     * @param aLoadAtStartUp New startup flag
+     * @return KErrNotFound if service or subservice does not exist
+     */
+    TInt SetStartupFlag( const TServiceSelection aServiceSelection, 
+        TBool aLoadAtStartUp ) const;
+    
+    /**
+     * Load Plug-ins
+     * @since S60 3.2
+     */
+    void LoadPluginsL();
+    
+    /**
+     * Unloads Plug-in(s) of certain service; if all
+     * subservices in one plugin are disabled, those are unloaded.
+     * @since S60 3.2
+     */
+    void UnloadDisabledPluginsL( );
+    
+    /**
+     * Checks if certain subservice exists in certain state
+     * @param aType Subservice type
+     * @param aState Subservice state to be checked
+     * @since S60 3.2
+     */
+    TBool Exists( TCCHSubserviceType aType, 
+                  TCCHSubserviceState aState,
+                  TInt aError ) const;
+                                  
+    /**
+     * Count of Services
+     * @since S60 3.2
+     * @param aMessage IPC message;
+     */
+    void ServiceCountL( RMessage2 aMessage ) const;
+    
+    /**
+     * Get all services and subservices.
+     * @since S60 3.2
+     * @param aMessage IPC message
+     */
+    void GetServicesL( RMessage2 aMessage );
+
+    /** 
+     * Get state of service or subservice of a certain service
+     * @since S60 3.2
+     * @param aMessage IPC message
+     * @return General symbian error code.
+     */
+    TInt GetServiceState( const RMessage2 aMessage );
+
+    /** 
+     * Get state of service
+     * @since S60 3.2
+     * @param aServiceId Service which to be checked
+     * @return A state of the service.
+     */
+    TCCHSubserviceState CCCHServiceHandler::ServiceState(
+            const TUint aServiceId );
+    
+    /** 
+     * Get info of service or subservice of a certain service
+     * @since S60 3.2
+     * @param aMessage IPC message
+     * @return General symbian error code.
+     */
+    TInt GetServiceInfo( const RMessage2 aMessage );
+
+    /** 
+     * Reserves the service for exclusive use
+     * @since S60 3.2
+     * @param aMessage IPC message
+     * @return General symbian error code.
+     */
+    TInt ReserveService( const RMessage2 aMessage );
+
+    /** 
+     * Frees the exclusive service reservation
+     * @since S60 3.2
+     * @param aMessage IPC message
+     * @return General symbian error code.
+     */
+    TInt FreeService( const RMessage2& aMessage );
+    
+    /** 
+     * Is the service exclusively reserved?
+     * @since S60 3.2
+     * @param aMessage IPC message
+     * @return ETrue if service is reserved for exclusive use.
+     */
+    void IsReserved( RMessage2 aMessage ) const;
+    
+    /**
+     * Service exist
+     * @since S60 3.2
+     * @param aSelection Checked Service
+     * @return TInt index if found else KErrNotFound 
+     */
+    TInt ServiceExist( TServiceSelection aSelection ) const;
+    
+    /**
+     * Find service by service id
+     * @since S60 3.2
+     * @param serviceId
+     * @return TInt position within the iServices array or KErrNotFound
+     */
+    TInt FindService( TUint32 aServiceId ) const;
+    
+    /**
+     * Subscribe to service change notifies
+     * @since S60 3.2
+     */
+    void EnableNotifyChange();
+    
+    /**
+     * Cancel service change notifies
+     * @since S60 3.2
+     */
+    void DisableNotifyChange();
+        
+    /**
+     * Get all subservice types which uses given Plug-in uid.
+     * @since S60 3.2
+     * @param aServiceId Service which to be checked
+     * @param aSubserviceTypes On completion contains subservice types.
+     */
+    void GetSubserviceTypesL( const TUint aServiceId, 
+        RArray<TCCHSubserviceType>& aSubserviceTypes ) const;
+    
+    /**
+     * Disables Wlan scan if needed
+     */
+    void DisableWlanScan();
+    
+    /**
+     * Handle restart situation, all services and subservices
+     * goes to disabled state.
+     */
+    void HandleRestartL();
+    
+protected: // From base classes
+    
+    /**
+     * Determines if we should start recovery
+     * @since S60 3.2
+     * @param aServiceId Service which state has changed
+     * @param aError Subservice's error. 
+     * @return ETrue if recovery is needed
+     */
+
+    TBool IsRecoveryNeeded( const TCCHSubserviceState aState, 
+                            TInt aError );
+                               
+    /**
+     * Service state notifier.
+     * @since S60 3.2
+     * @param aServiceId Service which state has changed
+     * @param aSubService Subservice's type. 
+     * @param aState A new state of the service.
+     */
+    void StateChangedL( const TUint aServiceId,
+                        const TCCHSubserviceType aSubService,
+                        const TCCHSubserviceState aState,
+                        const TInt aError );
+        
+    /**
+     * Handle notify change event.
+     * From MSPNotifyChangeObserver;
+     *
+     * @since S60 3.2
+     * @param aServiceId The service ID of changed service
+     */
+    void HandleNotifyChange( TServiceId aServiceId );
+    
+    /**
+     * Handle error
+     * 
+     * @since S60 3.2
+     */
+    void HandleError( TInt aError );
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCCHServiceHandler( CCCHServerBase& aServer );
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Add service to service array
+     * @since S60 3.2
+     * @param aService service information
+     */
+    void AddServiceL( TCCHService& aService );
+    
+    /**
+     * Counts how many Service contains this kind of Subservice
+     * @since S60 3.2
+     * @param aType Subservice's type
+     * @return TInt Count of Service
+     */
+    TInt ServiceCount( const TCCHSubserviceType aType ) const;
+
+    /**
+     * Starts connection recovery timer
+     * @param aFunction The function to call after the time out
+     */
+    void StartConnectionRecoveryTimer( TInt (*aFunction)(TAny* aPtr) );
+
+    /**
+     * Cancels the connection recovery timer
+     */
+    void CancelConnectionRecoveryTimer();
+    
+    /**
+     * Connection recovery callback
+     * @param aSelf this object
+     */
+    static TInt ConnectionRecoveryEvent( TAny* aSelf );
+    
+    /**
+     * Handles connection recovery event
+     */
+    void HandleConnectionRecovery();
+    
+    /**
+     * Starts plugin unload timer
+     * @param aFunction The function to call after the time out
+     */
+    void StartPluginUnloadTimer();
+
+    /**
+     * Cancels the connection recovery timer
+     */
+    void CancelPluginUnloadTimer();
+    
+    /**
+     * Starts handle notify delay timer
+     * @param aFunction The function to call after the time out
+     */
+    void StartHandleNotifyDelayTimer();
+
+    /**
+     * Cancels the handler notify delay timer
+     */
+    void CancelHandleNotifyDelayTimer();
+    
+    /**
+     * Plugin unload callback
+     * @param aSelf this object
+     */
+    static TInt PluginUnloadEvent( TAny* aSelf );
+    
+    /**
+     * Handle notify event callback
+     * @param aSelf this object
+     */
+    static TInt HandleNotifyEvent( TAny* aSelf );
+    
+    /**
+     * Handles plugin unload event
+     */
+    void HandlePluginUnload();
+    
+    /**
+     * Handles delayed notify event
+     */
+    void HandleDelayedNotifyEvent();
+    
+    /**
+     * From MCCHCommDbWatcherObserver, handles commsdb events
+     */
+    void HandleWLANIapAdded( TInt aSNAPId );
+    
+    /**
+     * Checks if there is wlan iap used, second part
+     */
+    TBool UsesWlanIap( const TServiceSelection& aServiceSelection );
+    
+    /**
+     * Checks if there is wlan iap used
+     */
+    TBool HasWlanIap( const TServiceSelection& aServiceSelection );
+    
+    /**
+     * Checks if IAP or SNAP is defined for certain subservice
+     */
+    TBool IsConnectionDefinedL( const TServiceSelection& aServiceSelection );
+    
+    /**
+     * Checks if IAP or SNAP is defined for certain service
+     */
+    TBool IsServiceConnectivityDefinedL( const TServiceSelection& aServiceSelection );
+    
+private: // data
+
+    /**
+     * Handle to server
+     */
+    CCCHServerBase&                 iServer;
+
+    /**
+     * Service array
+     */
+    RServiceArray                   iServices;
+    
+    /**
+     * Pointer to CSPNotifyChange
+     */
+    CSPNotifyChange*                iNotifier;
+    
+    /**
+     * Service id array
+     */
+    RIdArray                        iServiceIds;
+    
+    /**
+     * UI handler to show VoIP small icon etc.
+     */
+    CCchUIHandler*                  iCchUIHandler;
+    
+    /**
+     * Connection recovery timer. Owned.
+     */
+    CPeriodic* iConnectionRecoveryTimer;
+    
+    /**
+     * Plugin unload timer. Owned.
+     */
+    CPeriodic* iPluginUnloadTimer;
+    
+    /**
+     * Handle notify delay timer. Owned.
+     */
+    CPeriodic* iHandleNotifyDelayTimer;
+    
+    /**
+     * Recovery trial counter
+     */
+    TInt iConnectionRecoveryTry;
+    
+    /**
+     * Services that require recovery
+     */
+    RArray<TServiceSelection> iServicesInRecovery;
+    
+    /**
+     * Recovery intervals
+     */
+    RArray<TInt> iRecoveryInterval;
+    
+    /**
+     * WLAN extension
+     */
+    CCchWlanExtension* iWlanExtension;
+    
+    /**
+     * CommsDb watcher
+     */
+    CCCHCommDbWatcher* iCommDbWatcher;
+    
+    /**
+     * Disable SPSettings notifications
+     */
+    TBool iCancelNotify;
+    
+    /**
+     * Service id of delayed handle notify event
+     */
+    TServiceId iDelayedHandleNotifyServiceId;
+    };
+
+#endif // C_CCHSERVICEHANDLER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchserviceinfo.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,366 @@
+/*
+* 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:  CCCHServiceInfo declaration
+*
+*/
+
+
+#ifndef C_CCHSERVICEINFO_H
+#define C_CCHSERVICEINFO_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <cchclientserver.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// FORWARD DECLARATIONS
+class CCCHSubserviceInfo;
+class CCCHServerBase;
+class MCCHServiceNotifier;
+
+// DATA TYPES
+typedef RPointerArray<CCCHSubserviceInfo> RSubserviceArray;
+
+// FUNCTION PROTOTYPES
+// None
+
+// CLASS DECLARATION
+
+/**
+ *  CCCHServiceInfo declaration
+ *  Contains Service information
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHServiceInfo ) : public CBase
+    {
+
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCCHServiceInfo* NewL( CCCHServerBase& aServer );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCCHServiceInfo* NewLC( CCCHServerBase& aServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHServiceInfo();
+
+public: // New functions
+    
+    /**
+     * ServiceId getter
+     * @since S60 3.2
+     * @return TUint Service's Id
+     */
+    TUint32 GetServiceId() const;
+    
+    /**
+     * ServiceId setter
+     * @since S60 3.2
+     * @param aServiceId Service's Id
+     */
+    void SetServiceId( TUint32 aServiceId );
+    
+    /**
+     * Name getter
+     * @since S60 3.2
+     * @return const TDesC Service's name
+     */
+    const TDesC GetName() const;
+    
+    /**
+     * Name setter
+     * @since S60 3.2
+     * @param aName Service's name
+     */
+    void SetName( const TDesC& aName );
+    
+    /**
+     * Enable given service
+     * @since S60 3.2
+     * @param aServiceType Service's Subservice type
+     * @param aConnectivityCheck Is value is True Connectivity Plug-in will
+     * make test call to check is the connection truly working.
+     * @param aObserver Pointer to observer.
+     */
+    void EnableL( const TCCHSubserviceType aServiceType, 
+                  const TBool aConnectivityCheck,
+                  MCCHServiceNotifier* aNotifier );
+    
+    /**
+     * Disable given service
+     * @since S60 3.2
+     * @param aServiceType Service's Subservice type
+     */
+    void DisableL( const TCCHSubserviceType aServiceType );
+    
+    /**
+     * Connection information setter
+     * @since S60 3.2
+     * @param aServiceConnInfo Service's new connection information
+     */
+    void SetConnectionInfoL( const TServiceConnectionInfo aServiceConnInfo );
+    
+    /**
+     * Connection information getter
+     * @since S60 3.2
+     * @param aServiceConnInfo On completion contains Service's 
+     * connection(SNAP/IAP) information
+     */
+    void GetConnectionInfoL( TServiceConnectionInfo& aServiceConnInfo ) const;
+    
+    /**
+     * Is service enabled
+     * @since S60 3.2
+     * @return ETrue if service is enabled.
+     */
+    TBool IsEnabled() const;
+    
+    /**
+     * Add new Subservice to Service
+     * @since S60 3.2
+     * @param aSubservice Subservice information
+     */
+    void AddSubserviceL( TCCHSubservice& aSubservice );
+    
+    /**
+     * Subservice getter
+     * @since S60 3.2
+     * @param aType Subservice's type
+     */
+    CCCHSubserviceInfo& GetSubserviceL( TCCHSubserviceType aType ) const;
+    
+    /**
+     * Update service and subservice's states
+     * @since S60 3.2
+     * @param aReadServiceTable If ETrue class reads/updates all Services 
+     * directly from Service Provider Settings 
+     */ 
+    void UpdateL( TBool aReadServiceTable = EFalse );
+    
+    /**
+     * Update service and subservice's states
+     * @since S60 3.2
+     * @param aType Subservice's type
+     * @param aState Service's new state
+     */ 
+    void SetStateL( const TCCHSubserviceType aType, 
+                    const TInt aState );
+
+    /**
+     * Update service and subservice's states
+     * @since S60 3.2
+     * @param aPluginUid plugin uid wich services are updated
+     * @param aState Service's new state
+     */ 
+    void SetStateL( const TUid& aPluginUid, 
+                    const TCCHSubserviceState& aState );
+    /**
+     * Update service and subservice's error
+     * @since S60 3.2
+     * @param aType Subservice's type
+     * @param aError Service's error
+     */ 
+    void SetErrorL( const TCCHSubserviceType aType, 
+                    const TInt aError );
+    /**
+     * Update service and subservice's states
+     * @since S60 3.2
+     * @return TInt Count of subservices
+     */ 
+    TInt SubserviceCount() const;
+    
+    /**
+     * Get Plug-in's Uid
+     * @since S60 3.2
+     * @param aSubserviceIndex Index of subservice
+     * @return TUid Subservice's Uid
+     */ 
+    TUid GetUidL( TInt aSubserviceIndex ) const;
+    
+    /**
+     * Fill Service's information
+     * @since S60 3.2
+     * @param aService On completion contains service and subservice information
+     */
+    void FillServiceInfo( TCCHService& aService );
+    
+    /**
+     * Get Service's status
+     * @since S60 3.2
+     * @param aType Subservice's type
+     * @param aState in return, state of subservice
+     * @return error code, KErrNotFound if subservice is not existing
+     */ 
+    TInt GetStatus( TCCHSubserviceType aType, TCCHSubserviceState& aState ) const;
+
+    
+    /**
+     * Get Service's error
+     * @since S60 3.2
+     * @param aType Subservice's type
+     * @return TInt Current error of subservice
+     */ 
+    TInt GetError( TCCHSubserviceType aType ) const;
+    
+    /**
+     * Reserve a service
+     * @since S60 3.2
+     * @param aType Subservice's type
+     */ 
+    void ReserveServiceL( TCCHSubserviceType aType );    
+    
+    /**
+     * Free the service reservation
+     * @since S60 3.2
+     * @param aType Subservice's type
+     */ 
+    void FreeServiceL( TCCHSubserviceType aType ); 
+    
+    /**
+     * Return the service reference count
+     * @since S60 3.2
+     * @param aType Subservice's type
+     * @return Reference count
+     */ 
+    TBool IsReservedL( TCCHSubserviceType aType ) const;
+    
+    /**
+     * Get Service's protocol information
+     * @since S60 3.2
+     * @param aBuffer On completion contains selected service's protocol
+     * information.
+     * @param aType Subservice's type
+     */ 
+    void GetServiceInfoL( TDes& aBuffer, TCCHSubserviceType aType ) const;
+    
+    /**
+     * Subservice exist
+     * @since S60 3.2
+     * @param aType Subservice's type
+     * @return ETrue if Subservice exits or type is not specified.
+     */ 
+    TBool SubserviceExist( TCCHSubserviceType aType ) const;
+    
+    /**
+     * Find subservice by type
+     * @since S60 3.2
+     * @param aType Subservice's type
+     * @return TInt position within iSubservices array or KErrNotFound
+     */
+    TInt FindSubservice( TCCHSubserviceType aType ) const;
+    
+    /**
+     * Is any Subservice's startup-flag set to true
+     * @since S60 3.2
+     * @return ETrue if any startup-flag is set to true
+     */
+    TBool StartupFlagSet() const;
+    
+    /**
+     * Is Subservice's startup-flag set to true
+     * @since S60 3.2
+     * @param aSubserviceIndex Subservice's index
+     * @return ETrue if startup-flag is set to true
+     */
+    TBool StartupFlagSet( TInt aSubserviceIndex ) const;
+    
+    /**
+     * Subservice's enable at startup info setter
+     * @since S60 3.2
+     * @param aType Subservice's type
+     * @param aLoadAtStartUp Enable Subservice at the startup
+     */
+    TInt SetStartupFlag( TCCHSubserviceType aType, TBool aLoadAtStartUp ) const;
+    
+    /**
+     * Gets Subservice's type
+     * @since S60 3.2
+     * @param aSubserviceIndex Subservice's index
+     * @return TCCHSubserviceType type of Subservice
+     */
+    TCCHSubserviceType GetSubserviceType( TInt aSubserviceIndex ) const;
+    
+    /**
+     * Gets services state
+     * @since S60 3.2
+     * @return TCCHSubserviceStates Status of service
+     */
+    TCCHSubserviceState GetState() const;
+    
+private:
+    
+    /**
+     * Exception errors cases
+     * @since S60 3.2
+     */
+    void HandleErrorExceptions();
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCCHServiceInfo( CCCHServerBase& aServer );
+    
+private: // data
+    
+    /**
+     * Handle to server
+     */
+    CCCHServerBase&                 iServer;
+    
+    /**
+     * Service Id
+     */
+    TUint32                         iServiceId;
+
+    /**
+     * Service provider name
+     */
+    TBuf<KCCHMaxServiceNameLength>  iServiceName;
+    
+    /**
+     * Subservice objects array
+     */
+    RSubserviceArray                iSubservices;
+
+    /**
+     * Is Servie enabled
+     */
+    TBool                           iIsEnabled;
+    
+    /**
+    * Reserved, obsolote. When adding next new parameter (TInt)
+    * rename Reserved to that, implementation is ready then.
+    */
+    TBool                           iReserved;
+    };
+
+#endif // C_CCHSERVICEINFO_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchservicenotifier.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,72 @@
+/*
+* 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:  MCCHServiceNotifier declaration
+*
+*/
+
+
+#ifndef M_CCHSERVICENOTIFIER_H
+#define M_CCHSERVICENOTIFIER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+    
+/**
+ *  MCCHServiceNotifier declaration.
+ *  Service state notifier. 
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+class MCCHServiceNotifier
+    {
+
+public: // New functions
+
+    /**
+     * Service state notifier.
+     * @since S60 3.2
+     * @param aServiceId Service which state has changed
+     * @param aType Subservice's type. 
+     * @param aState A new state of the service.
+     */
+    virtual void StateChangedL( const TUint aServiceId,
+                                const TCCHSubserviceType aType,
+                                const TCCHSubserviceState aState,
+                                const TInt aError ) = 0;
+
+private:
+    
+    };
+
+#endif // M_CCHSERVICENOTIFIER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchsession.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,112 @@
+/*
+* 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:  CCCHSession declaration
+*
+*/
+
+
+#ifndef C_CCHSESSION_H
+#define C_CCHSESSION_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHServerBase;
+
+// CLASS DECLARATION
+
+/**
+ *  CCCHSession declaration
+ *  Server side counterpart for client's Session classes.
+ *  Each connection has own session in server.
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHSession ) : public CSession2
+    {
+
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCCHSession* NewL( CCCHServerBase& aServer );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCCHSession* NewLC( CCCHServerBase& aServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHSession();
+
+public: // New functions
+
+    /**
+     * Service dispatcher from CSession.
+     * @since S60 3.2
+     * @param aMessage Message received form client.
+     */
+    void ServiceL( const RMessage2& aMessage );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCCHSession( CCCHServerBase& aServer );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Handle to server
+     */
+    CCCHServerBase&             iCCHServer;
+
+    /**
+     * Subsessions
+     */
+    CObjectCon*                 iSubsessions;
+
+    /**
+     * Subsession id generator.
+     */
+    CObjectIx*                  iObjectIx;
+    
+    };
+
+#endif // C_CCHSESSION_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchspshandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCCHSPSHandler declaration
+*
+*/
+
+
+#ifndef C_CCHSPSHANDLER_H
+#define C_CCHSPSHANDLER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <cchclientserver.h>
+#include <spproperty.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHServerBase;
+class CSPSettings;
+
+// CLASS DECLARATION
+
+/**
+ *  CCCHSPSHandler declaration.
+ *  Service provider settings handler is used to access service and
+ *  sub-service configuration data.
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHSPSHandler ) : public CBase
+    {
+
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCCHSPSHandler* NewL( CCCHServerBase& aServer );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCCHSPSHandler* NewLC( CCCHServerBase& aServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHSPSHandler();
+
+public: // New functions
+
+    /**
+     * Get service count
+     * @since S60 3.2
+     * @return TInt Count of services
+     */
+    TInt GetServicesCountL() const;
+    
+    /**
+     * Get service ids
+     * @since S60 3.2
+     * @param aServiceIds On completion contains service ids
+     */
+    void GetServiceIdsL( RArray<TUint>& aServiceIds ) const;
+    
+    /**
+     * Get service's information
+     * @since S60 3.2
+     * @param aServiceId Used Service
+     * @param aService On completion, contains service information
+     */
+    void GetServiceInfoL( const TUint32 aServiceId, TCCHService& aService ) const;
+    
+    /**
+     * Get connectivity Plug-in's Uid
+     * @since S60 3.2
+     * @param aSerivceId Used Service
+     * @param aType Subservice's type
+     * @param aUid On completion, contains Plug-ins Uid
+     */
+    void GetConnectivityPluginUidL( TUint32 aServiceId,
+        TCCHSubserviceType aType, 
+        TUid& aUid ) const;
+        
+    /**
+     * Get Service's load at startup information
+     * @since S60 3.2
+     * @param aServiceId Used Service
+     * @param aType Subservice's type
+     * @param aOnOff On completion, contains Service's startup info
+     */                
+    void LoadAtStartUpL( TUint32 aServiceId,
+        TCCHSubserviceType aType,
+        TBool& aOnOff ) const;
+    
+    /**
+     * Set Service's load at startup information to service table
+     * @since S60 3.2
+     * @param aServiceId Used Service
+     * @param aType Subservice's type
+     * @param aOnOff 
+     */    
+    void SetLoadAtStartUpL( const TUint32 aServiceId,
+        const TCCHSubserviceType aType,
+        const TBool aOnOff ) const;
+        
+private:
+
+    /**
+     * Changes Subservice's type to property type and name
+     * @since S60 3.2
+     * @param aType Subservice's type
+     * @param aPropertyType On completion, contains property's type
+     * @param aPropertyName On completion, contains property's name
+     */                
+    void ChangeToPropertyStyleL( TCCHSubserviceType aType,
+        TSPItemType& aPropertyType,
+        TServicePropertyName& aPropertyName ) const;
+       
+    /**
+     * Checks is given subservice valid.
+     * @since S60 3.2
+     * aServiceId Used Service
+     * @param aPropertyName Property's name
+     * @return ETrue if subservice is valid, otherwise EFalse.
+     */  
+    TBool ValidSubserviceL( const TUint32 aServiceId, 
+        TServicePropertyName aPropertyName ) const;
+        
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCCHSPSHandler( CCCHServerBase& aServer );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Handle to server
+     */
+    CCCHServerBase&                 iServer;
+
+    /**
+     * CSPSettings. Own
+     */
+    CSPSettings*                    iSettings;
+    
+    };
+
+#endif // C_CCHSPSHANDLER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchspsnotifier.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  MCCHSPSNotifier declaration
+*
+*/
+
+
+#ifndef M_CCHSPSNOTIFIER_H
+#define M_CCHSPSNOTIFIER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <spdefinitions.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+    
+/**
+ *  MCCHServiceNotifier declaration.
+ *  Service notifier for CCH server
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+class MCCHSPSNotifier
+    {
+
+public: // New functions
+
+    /**
+     * Service table notifier.
+     * @since S60 3.2
+     * @param aServiceIds New Service Id -array
+     */
+    virtual void ServiceTableChangeNotifyL( RIdArray& aServiceIds ) = 0;
+
+private:
+
+    };
+
+#endif // M_CCHSPSNOTIFIER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchstartupcounter.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  CCchStartupCounter declaration
+*
+*/
+
+
+#ifndef C_CCHSTARTUPCOUNTER_H
+#define C_CCHSTARTUPCOUNTER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <cchclientserver.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHServerBase;
+class CRepository;
+
+// CLASS DECLARATION
+
+/**
+ *  CCchStartupCounter declaration
+ *  Class handles CCH server's startup situation
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCchStartupCounter ) : public CBase
+    {
+    
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCchStartupCounter* NewL( CCCHServerBase& aServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchStartupCounter();
+    
+public: // New functions
+    
+    /**
+     * Startup has occured.
+     * @since S60 3.2
+     */
+    void StartupOccuredL();
+        
+    /**
+     * Reset startup counter cenrep-value.
+     * @since S60 3.2
+     */
+    void ResetStartupCounter();
+    
+private:
+    
+    /**
+     * Handles startup exceptions.
+     * @since S60 3.2
+     */
+    void HandleStartupExceptionsL();
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCchStartupCounter( CCCHServerBase& aServer );
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    
+private: // data
+
+    /**
+     * Server handle
+     */
+    CCCHServerBase& iServer;
+    
+    /**
+     * Startup counter repository
+     */
+    CRepository*    iStartupRepository;
+    };
+
+#endif // C_CCHSTARTUPCOUNTER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchsubserviceinfo.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,274 @@
+/*
+* Copyright (c) 2007-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:  CCCHSubserviceInfo declaration
+*
+*/
+
+
+#ifndef C_CCHSUBSERVICEINFO_H
+#define C_CCHSUBSERVICEINFO_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <cchclientserver.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHServerBase;
+
+// CLASS DECLARATION
+
+/**
+ *  CCCHSubserviceInfo declaration
+ *  Contains Subservice information
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHSubserviceInfo ) : public CBase
+    {
+
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCCHSubserviceInfo* NewL( TUint aServiceId, 
+                                     CCCHServerBase& aServer );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCCHSubserviceInfo* NewLC( TUint aServiceId, 
+                                      CCCHServerBase& aServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHSubserviceInfo();
+
+public: // New functions
+    
+    /**
+     * SubserviceId setter
+     * @since S60 3.2
+     * @param aSubserviceId Subservice Id
+     */
+    void SetSubserviceId( const TUint aSubserviceId );
+    
+    /** 
+     * Plug-in Uid's setter
+     * @since S60 3.2
+     * @param aPluginUid Subservice's Plug-in's Uid
+     */
+    void SetPluginUid( const TUid aPluginUid );
+    
+    /** 
+     * Plug-in Uid's getter
+     * @since S60 3.2
+     * @param TUid Subservice's Plug-in's Uid
+     */
+    TUid GetPluginUid() const;
+    
+    /**
+     * Subservice type setter
+     * @since S60 3.2
+     * @param aType Type of Subservice
+     */
+    void SetType( const TCCHSubserviceType aType );
+    
+    /**
+     * Subservice type getter
+     * @since S60 3.2
+     * @return TCCHSubserviceType type of subservice
+     */
+    TCCHSubserviceType Type();
+    
+    /**
+     * Subservice state setter
+     * @since S60 3.2
+     * @param aState Current state of Subservice
+     */
+    void SetState( const TCCHSubserviceState aState );
+    
+    /**
+     * Error setter
+     * @since S60 3.2
+     * @param aState Current error of Subservice
+     */
+    void SetError( const TInt aError  );
+    
+    /**
+     * IAP Id setter
+     * @since S60 3.2
+     * @param aIapId Currently used IAP Id
+     */
+    void SetIapId( const TUint32 aIapId );
+    
+    /**
+     * SNAP Id setter
+     * @since S60 3.2
+     * @param aSNAPid Currently used SNAP Id
+     */
+    void SetSNAPId( const TUint32 aSNAPid );
+    
+    /**
+     * Update state of Subservice
+     * @since S60 3.2
+     */
+    void Update();
+    
+    /**
+     * Is this Subservice enabled
+     * @since S60 3.2
+     * @return ETrue if Subservice is enabled
+     */
+    TBool IsEnabled() const;
+    
+    /**
+     * Subservice error getter
+     * @since S60 3.2
+     * @return TCCHSubserviceStates Current state of Subservice
+     */     
+    TInt GetError();
+    
+    /**
+     * Subservice state getter
+     * @since S60 3.2
+     * @return TCCHSubserviceStates Current state of Subservice
+     */     
+    TCCHSubserviceState GetState();
+    
+    /**
+     * Get Subservice information
+     * @since S60 3.2
+     * @param aSubservice On completion contains subservice information
+     */
+    void FillSubserviceInfo( TCCHSubservice& aSubservice );
+    
+    /**
+     * Subservice's enable at startup info setter
+     * @since S60 3.2
+     * @param aLoadAtStartUp Enable Subservice at the startup
+     */
+    void SetStartupFlag( TBool aLoadAtStartUp );
+    
+    /**
+     * Subservice's enable at startup info getter
+     * @since S60 3.2
+     * @param ETrue If Subservice have to enable at the startup
+     */
+    TBool GetStartUpFlag() const;
+    
+    /**
+     * Status has changed
+     * @since S60 3.2
+     */
+    void StatusChanged();
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCCHSubserviceInfo( TUint aServiceId, CCCHServerBase& aServer );
+
+    /**
+     * Update connection related member variables from SIP Connection Provider
+     * @since S60 3.2
+     */
+    void GetServiceNetworkInfo();
+    
+private: // data
+
+    /**
+     * Service Id, this service owns this subservice
+     */
+    TUint32                         iServiceId;
+    
+    /**
+     * Handle to server
+     */
+    CCCHServerBase&                 iServer;
+    
+    /**
+     * Subservice's Id
+     */
+    TUint                           iSubserviceId;
+
+    /**
+     * Subservice's Plug-in's Uid
+     */
+    TUid                            iPluginUid;
+    
+    /**
+     * Subservice's type
+     */
+    TCCHSubserviceType              iType;
+    
+    /**
+     * Current state of subservice
+     */
+    TCCHSubserviceState             iState;
+    
+    /**
+     * Current error of subservice
+     */
+    TInt                            iError;
+    
+    /**
+     * Subservice's IAP
+     */
+    TUint32                         iIapId;
+    
+    /**
+     * Subservice's SNAP
+     */
+    TUint32                         iSNAPId;
+    
+    /**
+     * Can SNAP be edited
+     */
+    TBool                           iSNAPLocked;
+    
+    /**
+     * Is password set.
+     */
+    TBool                           iPasswordSet;
+    
+     /**
+     * Enable at start-up
+     */
+    TBool                           iEnableAtStartUp;
+
+     /**
+     * Previous state of subservice
+     */
+    TCCHSubserviceState             iPreviousState;    
+    };
+
+#endif // C_CCHSUBSERVICEINFO_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchsubsession.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  CCCHSubsession declaration
+*
+*/
+
+
+#ifndef C_CCHSUBSESSION_H
+#define C_CCHSUBSESSION_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHServerBase;
+class TCCHStorageEntry;
+class TCCHServiceSelection;
+// CLASS DECLARATION
+
+/**
+ *  CCCHSubsession declaration
+ *  Subsession for services.
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCCHSubsession ) : public CObject
+    {
+
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCCHSubsession* NewL( CCCHServerBase& aServer );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCCHSubsession* NewLC( CCCHServerBase& aServer );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCCHSubsession();
+
+public: // New functions
+
+    /**
+     * Handles the messages.
+     * @since S60 3.2
+     * @param aMessage IPC message
+     */
+    void ServiceL( const RMessage2& aMessage );
+    
+    /**
+     * Service event occured.
+     * @since S60 3.2
+     * @param aNewStatus Service which status has changed.
+     */
+    void ServiceEventOccured( TServiceStatus aNewStatus );
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCCHSubsession( CCCHServerBase& aServer );
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    
+    /**
+     * Try complete.
+     */
+    void CompleteMessage();
+    
+private: // data
+
+    /**
+     * Handle to server
+     */
+    CCCHServerBase& iServer;
+    
+    /**
+     * Currently pending request
+     */
+    RMessage2* iMessage;
+    
+    /**
+     * Register message;
+     */
+    RMessage2* iRegisterMessage; 
+    
+    /**
+     * Type of service we are listening to
+     */
+    TServiceSelection iSubscribedService;
+    
+    /**
+     * Event queue.
+     */
+    RArray<TServiceStatus> iEventQueue;
+    
+    /**
+     * Do we queue events.
+     */
+    TBool iQueueEvents;
+    };
+
+#endif // C_CCHSUBSESSION_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchuihandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,240 @@
+/*
+* 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:  CCchUIHandler declaration
+*
+*/
+
+
+#ifndef C_CCHUIHANDLER_H
+#define C_CCHUIHANDLER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include "cchetelnetworkstatusobserver.h"
+#include "cchfeaturemanager.h"
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CCCHServiceHandler;
+class CCCHServerBase;
+class CRepository;
+class CCchNoteHandler;
+class CCchEtelNetworkStatusNotifier; 
+class MCchEtelNetworkStatusObserver;
+
+// CLASS DECLARATION
+
+/**
+ *  CCchUIHandler declaration
+ *  Displays handles CCH's UI, emergency notes, small icons
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+class CCchUIHandler : public CActive, 
+                      public MCchEtelNetworkStatusObserver
+    {
+
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCchUIHandler* NewL( 
+        CCCHServerBase& aServer,
+        CCCHServiceHandler& aCCchServiceHandler );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCchUIHandler* NewLC( 
+        CCCHServerBase& aServer,
+        CCCHServiceHandler& aCCchServiceHandler );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchUIHandler();
+
+public: // New functions
+
+    /**
+    * shows emergency warning note.
+    * @param: TInt
+    * @return void
+    */
+    void ShowEmergencyWarningNoteL( TBool aVoIPEnabledFirstTime );
+    
+    /**
+    * Updates the user interface (e.g. voip small icon)
+    * @param: TInt
+    * @return void
+    */
+    void UpdateUI( );
+    
+    /**
+    * Checks gprs first usage. If used first time shows 
+    * gprs roaming cost warning note.
+    * @return void
+    */
+    void CheckGprsFirstUsageL();
+    
+    /**
+    * Return network connections allowed status.
+    * @return ETrue if network connections are allowed
+    */
+    TBool NetworkConnectionsAllowed() const;
+    
+    /**
+     * Waits one second to give enought time to end async requests
+     */
+    void Destroy();
+    
+    /**
+     * Is cost warning already shown
+     * @return TBool if cost warning already shown ETrue 
+     */
+    TBool IsCostWarningSeen() const;
+
+public: // From MCchEtelNetworkStatusObserver
+
+    /**
+    * This is a callback function which is called when CS 
+    * has gone out of coverage 
+    */
+    void MobileNetworkNoService( );
+
+    /**
+    Implements cancellation of an outstanding request.
+    @see CActive::Cancel
+    */
+    virtual void DoCancel();
+
+
+    /**
+    Handles an active object's request completion event.
+    */
+    virtual void RunL();
+    
+    /**
+    Handles leaving of RunL.
+    */
+    virtual TInt RunError(TInt aError);
+    
+private:
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * C++ default constructor.
+     */
+    CCchUIHandler( 
+        CCCHServerBase& aServer, 
+        CCCHServiceHandler& aCCchServiceHandler );
+    
+    /**
+    * Sets the indicator's aIndicator state to state aState.
+    * @param TInt aIndicator 
+    * @param TInt aState
+    * @return void
+    */
+    void SetIndicatorStateL( TInt aIndicator, TInt aState ) const;
+
+    /**
+    * Called when VoIP status is changed
+    * @param aStatus for VoIP status
+    */
+    void HandleVoipStateChanged( TBool aStatus );
+    
+    /**
+    * Called (from HandleVoipStateChanged) when VoIP status is changed
+    * @param aStatus for VoIP status
+    */
+    void HandleVoipStateChangedL( TBool aStatus );
+    
+    /**
+     * Checks offline status from KCRUidCoreApplicationUIs cenrep
+     * and starts to monitor changes in offline status
+     */
+    void MonitorOfflineStatusL();
+
+private: // data
+
+    /**
+     * Handle to server
+     */
+    CCCHServerBase& iServer;
+
+    /**
+     * Handle to service handler
+     */
+    CCCHServiceHandler& iCCchServiceHandler;
+
+    /**
+     * Note handler
+     */
+    CCchNoteHandler* iNoteHandler;
+    
+    /**
+     * ETel observer
+     */
+    CCchEtelNetworkStatusNotifier* iCchEtelNetworkStatusNotifier;
+    
+    /**
+     * Are we showing the VoIP small indicator?
+     */    
+    TBool iVoIPSmallIndicatorShown;
+    
+    /**
+     * Cch's repository
+     */ 
+    CRepository* iCchRepository;
+    
+    /**
+     * Repository for monitoring offline mode
+     */ 
+    CRepository* iOfflineRepository;
+    
+    /**
+     * is the connection allowed
+     */ 
+    TInt iNetworkConnectionAllowed;
+    
+    /**
+     * Reference to RTimer 
+     */
+    RTimer iTimer;
+
+    /**
+     * Should I commit suicide
+     */
+    TBool iDie;
+    };
+
+#endif // C_CCHUIHANDLER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchwakeupeventnotifier.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,198 @@
+/*
+* 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:  cchwakeupeventnotifier declaration
+*
+*/
+
+
+#ifndef C_CCHWAKEUPEVENTNOTIFIER_H
+#define C_CCHWAKEUPEVENTNOTIFIER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <mspnotifychangeobserver.h>
+#include "cchetelnetworkstatusobserver.h"
+
+// CONSTANTS
+
+// Security Policy
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CSPNotifyChange;
+class CCchEtelNetworkStatusNotifier;
+class MCchWakeUpEventObserver;
+class CRepository;
+// CLASS DECLARATION
+
+/**
+ *  CCchWakeUpEventNotifier declaration
+ *  The server of CCH services.
+ *  @lib cchserver.exe
+ *  @since S60 3.2
+ */
+NONSHARABLE_CLASS( CCchWakeUpEventNotifier ) : public CActive,
+                            public MCchEtelNetworkStatusObserver,
+                            public MSPNotifyChangeObserver
+    {
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    static CCchWakeUpEventNotifier* NewL( 
+            MCchWakeUpEventObserver& aWakeUpEventObserver );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CCchWakeUpEventNotifier* NewLC( 
+            MCchWakeUpEventObserver& aWakeUpEventObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CCchWakeUpEventNotifier();
+
+public: // New functions
+
+    /**
+     * Starts observering change events.
+     */
+    void StartL();
+    
+    /**
+     * Stops observering change events.
+     */
+    void Stop();
+    
+private: 
+    
+    /**
+     * Starts offline timer
+     * @param aFunction The function to call after the time out
+     */
+    void StartOfflineTimer( TInt (*aFunction)(TAny* aPtr) );
+
+    /**
+     * Cancels the offline timer
+     */
+    void CancelOfflineTimer();
+        
+    /**
+     * Offline tiemout callback
+     * @param aSelf this object
+     */
+    static TInt OfflineTimeout( TAny* aSelf );
+        
+    /**
+     * Handles offline timeout
+     */
+    void HandleOfflineTimeout();
+
+public: // From CActive
+    
+    /**
+    * Implements cancellation of an outstanding request.
+    * @see CActive::Cancel
+    */
+    virtual void DoCancel();
+
+
+    /**
+    * Handles an active object's request completion event.
+    */
+    virtual void RunL();
+    
+    /**
+    * Handles leaving of RunL.
+    */
+    virtual TInt RunError( TInt aError );
+
+     
+public: // From MCchEtelNetworkStatusObserver
+    
+    /**
+    * This is a callback function which is called when CS 
+    * has gone out of coverage 
+    */         
+    virtual void MobileNetworkNoService( );
+
+public: // From MSPNotifyChangeObserver
+    
+    /**
+    * Handle notify change event
+    * 
+    * @param aServiceId the service ID of added/changed/deleted service
+    * @since S60 3.2
+    */
+    virtual void HandleNotifyChange( TServiceId aServiceId );
+
+    /**
+    * Handle error
+    * 
+    * @param aError error code
+    * @since S60 3.2
+    */
+    virtual void HandleError( TInt aError );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CCchWakeUpEventNotifier( MCchWakeUpEventObserver& aWakeUpEventObserver );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+
+private: // data
+
+    // Observer of wake up events
+    MCchWakeUpEventObserver& iWakeUpEventObserver;
+
+    // Change notifer of spsettings
+    CSPNotifyChange* iSPSNotifier;
+    
+    // Mobile network notifer
+    CCchEtelNetworkStatusNotifier* iCchEtelNetworkNotifier;
+    
+    // Repository for monitoring offline mode
+    CRepository* iOfflineRepository;
+
+    // Are we in state that network connection is allowed
+    TInt iNetworkConnectionAllowed;
+    
+    // Indicates is change events observation started.
+    TBool iObservationOngoing;
+    
+    // Offline timer. Owned.
+    CPeriodic* iOfflineTimer;
+    };
+
+#endif // C_CCHWAKEUPEVENTNOTIFIER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchwakeupeventobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* 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:  MWakeUpEventObserver defines interface that is used 
+*                when reporting wake-up events.
+*
+*/
+
+
+#ifndef MCCHWAKEUPEVENTOBSERVER_H
+#define MCCHWAKEUPEVENTOBSERVER_H
+
+// INCLUDES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+/**
+*  MCchWakeUpEventObserver
+*  
+*  @lib   cchserver
+*  @since 3.2
+*/
+
+class MCchWakeUpEventObserver
+{
+public:
+
+    /**
+    * Called when some requested event has occured
+    */         
+    virtual void WakeUp( ) = 0;
+
+private:
+
+    
+};
+
+#endif // MCCHWAKEUPEVENTOBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/cchwlanextension.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  
+*        class definition for CCchWlanExtension
+*
+*/
+
+
+#ifndef CCHWLANEXTENSION_H
+#define CCHWLANEXTENSION_H
+
+// INCLUDES
+#include <commdb.h>
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CRepository;
+
+// CLASS DECLARATION
+
+/**
+*  CCchWlanExtension class.
+*  @since 3.2
+*  Extension class for WLAN functionality.
+*/
+class CCchWlanExtension : public CBase
+    {
+public: // Constructors and destructor
+    
+    /**
+    * Two-phased constructor
+    */      
+    static CCchWlanExtension* NewL( );
+
+    /**
+    * Destructor.
+    */      
+    ~CCchWlanExtension();
+
+public:
+
+    /**
+    * Activates wlan scan if not activated
+    */
+    void EnableWlanScanL();
+    
+    /**
+    * Activates wlan scan, disables it first
+    */
+    void ForceEnableWlanScanL();
+    
+    /**
+    * Deactivates wlan scan
+    */
+    void DisableWlanScanL();
+
+private:
+        
+    /**
+    * Checks WLAN availability setting status.
+    * @since S60 3.2
+    * @return Show WLAN availability scan rate
+    */ 
+    TUint32 CheckAvailabilityStatusL();
+    
+    /**
+    * Sets WLAN availability switch based on scan rate given.
+    * @since S60 3.2
+    * @param aScanRate for WLAN setting data value to be set
+    */
+    void SetAvailabilitySwitchL( TUint32 aScanRate );
+        
+private:
+    
+    /**
+    * C++ default constructor
+    */
+    CCchWlanExtension( );
+
+    /**
+    * Symbian OS default constructor
+    * @return void
+    */
+    void ConstructL();
+
+private: // data
+        
+    // Pointer to Access Point Comms Database
+    CCommsDatabase* iAPCommsDatabase;
+    
+    // Pointer to Access Point Comms Database
+    CCommsDatabase* iWLANCommsDatabase;
+    
+    //Central repository
+    CRepository* iCchRepository;
+    
+    //Last saved scan interval
+    TUint32 iLastSavedScanInterval;
+    };
+
+#endif // CCHWLANEXTENSION_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/inc/mcchnotehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* 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:  MCchNoteHandler class definition. A virtual class.
+*
+*/
+
+
+#ifndef MCCHNOTEHANDLER_H
+#define MCCHNOTEHANDLER_H
+
+#include "cchclientserverinternal.h"
+
+// CLASS DECLARATION
+/**
+*  MCchNoteHandler
+*  
+*  @lib   cchserver
+*  @since 5.0
+*/
+
+class MCchNoteHandler
+    {
+    public:
+
+    /**
+    * Launches cch global note.
+    * @since Series60 5.0
+    * 
+    * @param aCchGlobalNoteType cch global note type.
+    * @param aSoftKeyConfig softkey configuration.
+    * @param aType type of confirmation query.
+    * @param aSecondaryDisplayIndex secondary display index.
+    */
+    virtual void LaunchGlobalNoteL( 
+        const TCCHGlobalNoteType aCchGlobalNoteType,
+        const TInt aResourceID, 
+        const TInt aSoftKeyConfig,
+        const TInt aSecondaryDisplayIndex )=0;
+                
+    };
+
+#endif // MCCHNOTEHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/loc/cch.loc	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 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:  Localisation strings for cch
+*
+*/
+
+
+// d: Information note when VoIP call readiness is reached first time. 
+// l: popup_info_list_pane_t1
+// w:
+// r:3.2
+//
+#define qtn_voip_em_call_readiness_note "Emergency calls: Outside cellular network coverage, if you dial an emergency call, the call will be attempted by using Internet telephony. The capability for an emergency call using Internet telephony depends on the availability of WLAN network and your Internet call provider’s implementation of emergency call capabilities. Contact your Internet call provider to check the Internet telephony emergency call capability."
+
+// d: Information note when there is only VoIP call capability
+// l: popup_info_list_pane_t1
+// w:
+// r:3.2
+//
+#define qtn_voip_em_call_error_note_no_cs "Your device is currently outside cellular network coverage. If you dial an emergency call, the call will be attempted by using Internet telephony. The capability for an emergency call using Internet telephony depends on the availability of a WLAN network and your Internet call provider’s implementation of emergency call capabilities. Contact your Internet call provider to check the Internet telephony emergency call capability."
+
+// d: Confirmation query when there is only VoIP call capability 
+// l: popup_note_window
+// w:
+// r:3.2
+//
+#define qtn_voip_do_not_show_warning "Do not show this emergency call warning in the future"
+
+// d: Information note when GPRS used first time.
+// l: popup_note_window
+// r: 5.0.1
+//
+#define qtn_servtab_allow_gprs_when_roaming_query "Please note that using service outside home network via GPRS connection may be more costly."
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchactivescheduler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,89 @@
+/*
+* 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:  CCchActiveScheduler implementation
+*
+*/
+
+// INCLUDE FILES
+#include "cchlogger.h"
+#include "cchactivescheduler.h"
+#include "cchserverbase.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// -----------------------------------------------------------------------------
+// CCchActiveScheduler::CCchActiveScheduler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCchActiveScheduler::CCchActiveScheduler()
+    {
+    }
+
+// Destructor
+CCchActiveScheduler::~CCchActiveScheduler()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCchActiveScheduler::SetServer
+//
+// -----------------------------------------------------------------------------
+//
+void CCchActiveScheduler::SetServer( 
+    CCCHServerBase* aServer )
+    {
+    iServer = aServer;
+    }
+
+// -----------------------------------------------------------------------------
+// CCchActiveScheduler::Error
+//
+// -----------------------------------------------------------------------------
+//
+void CCchActiveScheduler::Error( 
+    TInt aError ) const
+    {
+    CCHLOGSTRING2("CCchActiveScheduler::Error: %d", aError);
+
+    if ( KErrServerTerminated == aError )
+        {
+        CCHLOGSTRING("CCchActiveScheduler - Server terminated");
+        if ( iServer )
+            {
+            iServer->Restart();
+            }
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchcommdbwatcher.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,607 @@
+/*
+* 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:  CCCHCommDbWatcher implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <cmdestination.h>
+#include <cmconnectionmethoddef.h>
+#include <cmpluginwlandef.h>
+#include <cmpluginvpndef.h>
+#include <centralrepository.h>
+#include <commsdat.h>
+
+#include "cchcommdbwatcher.h"
+#include "cchcommdbwatcherobserver.h"
+#include "cchlogger.h"
+#include "d32dbms.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+const TInt KDefaultGranularity = 5;
+const TInt KMaxCheckAttempts   = 3;
+// Repository for CommsDat
+const TUid KCDCommsRepositoryId = { 0xCCCCCC00 };
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHCommDbWatcher::CCCHCommDbWatcher
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHCommDbWatcher::CCCHCommDbWatcher( MCCHCommDbWatcherObserver& aObserver ) :
+    CActive( CActive::EPriorityStandard ), 
+    iObserver( aObserver ), 
+    iTableId( KCDTIdIAPRecord )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCCHCommDbWatcher::ConstructL()
+    {
+    CCHLOGSTRING( "CCCHCommDbWatcher::ConstructL IN" );
+    
+    iRepository = CRepository::NewL( KCDCommsRepositoryId );
+    iDestinations = RArray<TDestinationData>( KDefaultGranularity );
+    
+    InitializeDestination();
+    TInt err( RequestNotifications() );
+    User::LeaveIfError( err );
+    CCHLOGSTRING( "CCCHCommDbWatcher::ConstructL OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHCommDbWatcher* CCCHCommDbWatcher::NewL( 
+    MCCHCommDbWatcherObserver& aObserver )
+    {
+    CCCHCommDbWatcher* self = CCCHCommDbWatcher::NewLC( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHCommDbWatcher* CCCHCommDbWatcher::NewLC( 
+    MCCHCommDbWatcherObserver& aObserver )
+    {
+    CCCHCommDbWatcher* self = new (ELeave) CCCHCommDbWatcher( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// Destructor
+CCCHCommDbWatcher::~CCCHCommDbWatcher()
+    {
+    CCHLOGSTRING( "CCCHCommDbWatcher::~CCCHCommDbWatcher" );
+    iDestinations.Close();
+    // Cancel outstanding request, if exists
+    Cancel();
+    delete iRepository;
+    if ( iCmmOpen )
+        {
+        iCmm.Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::RequestNotifications()
+// 
+// ---------------------------------------------------------------------------
+//
+TInt CCCHCommDbWatcher::RequestNotifications()
+    {
+    CCHLOGSTRING( "CCCHCommDbWatcher::RequestNotifications()" );   
+    CCHLOGSTRING2( "Calling iRepository->NotifyRequest() for table 0x%08X", iTableId );
+    TInt err = iRepository->NotifyRequest( iTableId, KCDMaskShowRecordType, iStatus );
+
+    if ( KErrNone == err )
+        {
+        SetActive();
+        }
+    else
+        {
+        CCHLOGSTRING2( "ERROR, iRepository->NotifyRequest() <%d>", err );
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::CmManagerL
+// 
+// ---------------------------------------------------------------------------
+//
+RCmManager& CCCHCommDbWatcher::CmManagerL()
+    {
+    // Remove this method and open cmmanager connection in ConstructL
+    // after cmmanager is refactored -> to become a server, schedule is unknown
+    if ( !iCmmOpen )
+        {
+        CCHLOGSTRING( "CCCHCommDbWatcher::CmManagerL open connection" );
+        iCmm.OpenL();
+        iCmmOpen = ETrue;
+        }
+    
+    return iCmm; 
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::GetWLANIapCountFromSnap
+//
+// ---------------------------------------------------------------------------
+//
+TInt CCCHCommDbWatcher::GetIapCountFromSnap( 
+    TInt aSNAPId, 
+    TBool aWLANIapsOnly,
+    TBool aUpdateDestinations )
+    {
+    CCHLOGSTRING( "CCCHCommDbWatcher::GetIapCountFromSnap - Forced CheckIapsL" );
+
+    // Remove this error check after cmmanager is refactored -> to become 
+    // a server, schedule is unknown
+    // Force destination update if we are pending unlock event
+    if ( iLastError || iUseForce || aUpdateDestinations )
+        {
+        CCHLOGSTRING( "CCCHCommDbWatcher::GetIapCountFromSnap - Forced DESTINATION UPDATE" );
+        InitializeDestination();
+        iUseForce = EFalse;
+        }
+    
+    TInt iaps( KErrNotFound );
+    for ( TInt i = 0; iaps == KErrNotFound && i < iDestinations.Count(); i++ )
+        {
+        if ( iDestinations[ i ].iDestId == aSNAPId )
+            {
+            iaps = 0; //if destination is not found, KErrNotFound is returned
+            if ( aWLANIapsOnly )
+                {
+                iaps = iDestinations[ i ].iWlanIaps;
+                }
+            else
+                {
+                iaps = iDestinations[ i ].iIapCount;
+                }
+            }
+        }
+        
+    return iaps;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::IsVpnApL
+//
+// ---------------------------------------------------------------------------
+//
+TBool CCCHCommDbWatcher::IsVpnApL(
+    TInt aIapId )
+    {
+    CCHLOGSTRING( "CCCHCommDbWatcher::IsVpnApL: IN" );
+    TBool response( KPluginVPNBearerTypeUid == GetBearerL( aIapId ) );
+    CCHLOGSTRING3( "CCCHCommDbWatcher::IsVpnApL: iap id: %d is vpn ap: %d", 
+            aIapId, response );
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::IsWLANAPL
+//
+// ---------------------------------------------------------------------------
+//
+TBool CCCHCommDbWatcher::IsWlanApL( 
+    TInt aIapId )
+    {
+    CCHLOGSTRING( "CCCHCommDbWatcher::IsWLANAPL: IN" );
+    TBool response( KUidWlanBearerType == GetBearerL( aIapId ) );
+    
+    CCHLOGSTRING3( "CCCHCommDbWatcher::IsWLANAPL: iap id: %d is wlan ap: %d", 
+        aIapId, response );
+    return response;
+    }
+   
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::GetBearerL
+//
+// ---------------------------------------------------------------------------
+//
+TUint32 CCCHCommDbWatcher::GetBearerL( 
+    TInt aIapId )
+    {
+    return CmManagerL().ConnectionMethodL( aIapId ).GetIntAttributeL( 
+            CMManager::ECmBearerType );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::RunL
+//
+// ---------------------------------------------------------------------------
+//
+void CCCHCommDbWatcher::RunL()
+    {
+    if ( iStatus.Int() < KErrNone )
+        {
+        CCHLOGSTRING2( "CCCHCommDbWatcher::RunL: error <%d>", iStatus.Int() );
+        iErrorCounter++;
+        if ( iErrorCounter > KCchConnCenRepErrorThreshold )
+            {
+            CCHLOGSTRING2( "Over %d consecutive errors, stopping notifications permanently",
+                    KCchConnCenRepErrorThreshold );
+            return;
+            }
+        }
+    else
+        {
+        iErrorCounter = 0;
+        UpdateIapTable();
+        }
+
+    CCHLOGSTRING2( "CCCHCommDbWatcher::RunL: CenRep event 0x%08X", iStatus.Int() );
+
+    TInt err( RequestNotifications() );
+    User::LeaveIfError( err );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::DoCancel
+//
+// ---------------------------------------------------------------------------
+//
+void CCCHCommDbWatcher::DoCancel()
+    {
+    iRepository->NotifyCancel( iTableId, KCDMaskShowRecordType );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::RunError
+//
+// ---------------------------------------------------------------------------
+//
+
+TInt CCCHCommDbWatcher::RunError( TInt /*aError*/ )
+    {
+    TInt err( RequestNotifications() );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::CheckIapsL
+//
+// ---------------------------------------------------------------------------
+//
+void CCCHCommDbWatcher::CheckIapsL( TBool& aChanged, TInt& aSNAPId )
+	{
+    CCHLOGSTRING2( "CCCHCommDbWatcher::CheckIapsL: IN Current iap count %d",
+            CountIapsFromArray( iDestinations ) );
+
+
+  	RArray<TUint32> destIdArray = RArray<TUint32>( KDefaultGranularity );
+    CleanupClosePushL( destIdArray ); // CS:1
+  	RArray<TDestinationData> currentDestinations = RArray<TDestinationData>( 
+  		KDefaultGranularity ); 
+    CleanupClosePushL( currentDestinations );	 // CS:2
+
+    //Get count of iaps that do not belong to any destination
+    RArray<TUint32> cmMethods = RArray<TUint32>( KDefaultGranularity );
+    CleanupClosePushL( cmMethods ); // CS:3
+    CmManagerL().ConnectionMethodL( cmMethods );
+        
+    TDestinationData destinationlessIaps( KErrNotFound, cmMethods.Count() );
+    CCHLOGSTRING2( "CCCHCommDbWatcher::CheckIapsL: cmMethods count %d",
+            cmMethods.Count() );
+    for ( TInt i = 0; i < cmMethods.Count(); i++ )
+        {
+   	    RCmConnectionMethod cm = CmManagerL().ConnectionMethodL( cmMethods[ i ] );
+        CleanupClosePushL( cm ); // CS:4
+        
+        if( KUidWlanBearerType == 
+            cm.GetIntAttributeL( CMManager::ECmBearerType ) )
+            {
+            destinationlessIaps.iWlanIaps++;
+            }
+        CleanupStack::PopAndDestroy( &cm ); // CS:3
+        }
+        
+    CleanupStack::PopAndDestroy( &cmMethods ); // CS:2
+    currentDestinations.Append( destinationlessIaps ); 
+
+    //Get count of iaps per destination
+    CmManagerL().AllDestinationsL( destIdArray );
+    CCHLOGSTRING2( "CCCHCommDbWatcher::CheckIapsL: destination count %d",
+                destIdArray.Count() )
+    for ( TInt i = 0; i < destIdArray.Count(); i++ )
+        {
+        RCmDestination destination = CmManagerL().DestinationL( destIdArray[ i ] );
+        CleanupClosePushL( destination ); // CS:3
+        TDestinationData destinationInfo( 
+            destination.Id(), destination.ConnectionMethodCount() );
+		 
+         for ( TInt k = 0; k < destinationInfo.iIapCount; k++ )
+			 {
+			 RCmConnectionMethod cm = destination.ConnectionMethodL( k );
+			 CleanupClosePushL( cm ); // CS:4
+             
+			 if( KUidWlanBearerType == 
+			 	 cm.GetIntAttributeL( CMManager::ECmBearerType ) )
+				 {
+				 destinationInfo.iWlanIaps++;				 	
+				 }
+		     CleanupStack::PopAndDestroy( &cm ); // CS:3
+			 }
+            
+		 currentDestinations.Append( destinationInfo );
+		 CleanupStack::PopAndDestroy( &destination ); // CS:2
+	     }
+    
+	destIdArray.Close();
+    
+    UpdateDestinationStore( currentDestinations, aChanged, aSNAPId );
+    
+    CleanupStack::PopAndDestroy( &currentDestinations ); // CS:1
+    CleanupStack::PopAndDestroy( &destIdArray ); // CS:0
+	
+    CCHLOGSTRING2( "CCCHCommDbWatcher::CheckIapsL: OUT changed: %d", aChanged );
+	}
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::CountIapsFromArray
+//
+// ---------------------------------------------------------------------------
+//
+TInt CCCHCommDbWatcher::CountIapsFromArray( 
+    RArray<TDestinationData>& aArray ) const
+	{
+	TInt iaps = 0;
+	for ( TInt i=0; i<aArray.Count(); i++ )
+		{
+		iaps+= aArray[i].iIapCount;
+		}
+	return iaps;	
+	}
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::UpdateDestinationStore
+//
+// ---------------------------------------------------------------------------
+//
+void CCCHCommDbWatcher::UpdateDestinationStore( 
+    RArray<TDestinationData>& aDestinations,
+    TBool& aChanged,
+    TInt& aSNAPId )
+    {
+	//Now compare fetched data with store
+	TInt iapsBefore = CountIapsFromArray ( iDestinations );
+	TInt iapsAfter  = CountIapsFromArray ( aDestinations );
+
+    aSNAPId = KErrNotFound;
+    aChanged = EFalse;
+
+    //no further checking is needed if iap count decreased
+    if ( iapsAfter >= iapsBefore )
+		{
+        //compare store with current setup for changes
+        //only change in WLAN iap count is reported
+		for ( TInt i = 0; !aChanged && i < aDestinations.Count(); i++ )
+			{
+            TBool alreadyexists = EFalse;
+			for ( TInt j = 0; !aChanged && j < iDestinations.Count(); j++ )
+				{
+                if ( aDestinations[i].iDestId == iDestinations[j].iDestId )
+                    {
+                    alreadyexists = ETrue;
+                    // Do not update snap id if destination is -1, this means 
+                    // that cmmanager hasn't moved iap to the right destination yet
+                    if ( aDestinations[i].iWlanIaps > 
+                         iDestinations[j].iWlanIaps )
+					    {
+                        if ( KErrNotFound == aDestinations[ i ].iDestId )
+                            {
+                            // If destination -1 is the only updated destination
+                            // we have to use force next time when asking GetIapCountFromSnap
+                            iUseForce = ETrue;
+                            CCHLOGSTRING( "CCCHCommDbWatcher - USE THE FORCE NEXT TIME" );
+                            }
+                        else
+                            {
+                            //wlan iap count increased in comp[i]
+                            aSNAPId = aDestinations[i].iDestId;
+                            aChanged = ETrue;
+                            iUseForce = EFalse;
+                            CCHLOGSTRING2( "CCCHCommDbWatcher - snap id: %d", aSNAPId );
+                            }
+                        }
+                    }
+				}
+                
+            //if there is a new SNAP, check wlan iap count in the new IAP
+            if ( !alreadyexists && aDestinations[i].iWlanIaps > 0 )
+                {
+                aSNAPId = aDestinations[i].iDestId;
+                aChanged = ETrue;
+                CCHLOGSTRING2( "CCCHCommDbWatcher new snap id: %d", aSNAPId );
+                }
+			}
+		}
+		
+	//update store
+	iDestinations.Reset();
+	for ( TInt i=0; i < aDestinations.Count(); i++ )
+		{
+		iDestinations.Append( aDestinations[i] );					
+        // Destinations are refreshed, set last error to kerrnone
+        iLastError = KErrNone;
+		}
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::UpdateIapTable
+//
+// ---------------------------------------------------------------------------
+//
+TInt CCCHCommDbWatcher::UpdateIapTable()
+    {
+    TBool configurationChanged( EFalse );
+    TInt changedSnapId( KErrNotFound );
+    TInt error( KErrNone );
+    TRAP( error, CheckIapsL( configurationChanged, changedSnapId ) );
+            
+    if ( error == KErrNone )
+        {
+        if( configurationChanged )
+            {
+            // new IAP(s) added, notify observer
+            iObserver.HandleWLANIapAdded( changedSnapId );
+            }
+        }
+    
+    CCHLOGSTRING2( "CCCHCommDbWatcher::UpdateIapTable: CActive iStatus : %d", iStatus.Int() );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::InitializeDestination
+//
+// ---------------------------------------------------------------------------
+//
+void CCCHCommDbWatcher::InitializeDestination()
+    {
+    //call CheckWLANIapsL to get initial iap/snap list to array 
+    //we're not interested in the return value at this point
+    TBool configurationChanged( EFalse );
+    TInt changedSnapId( 0 );
+    // Loop, because transaction might pend and error(KErrLocked) may occur
+    TInt error( KErrNone );
+    for ( TInt i( 0 ); i < KMaxCheckAttempts; i++ )
+        {
+        TRAP( error, CheckIapsL( configurationChanged, changedSnapId ) ); 
+        CCHLOGSTRING2( 
+            "CCCHCommDbWatcher::InitializeDestination; error: %d", error );
+        if( KErrNone == error || KErrNotFound == error )
+            {
+            break;
+            }
+        }
+        
+    if( error )
+        {
+        iLastError = error;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHCommsDbWatcher::RemoveOtherThanVpnIapsL
+//
+// ---------------------------------------------------------------------------
+//
+void CCCHCommDbWatcher::RemoveOtherThanVpnIapsL(
+    RArray<TUint>& aIapIds,
+    TUint aIAPId )
+    {
+    CCHLOGSTRING2( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL; IAP ID:  %d", aIAPId );
+    CCHLOGSTRING2( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL; IAPs count before: %d", aIapIds.Count() );
+    
+    TUint32 iapId( KErrNone );
+    RArray<TUint> iaps;
+    CleanupClosePushL( iaps );
+    RCmConnectionMethod cm = CmManagerL().ConnectionMethodL( aIAPId );
+    CleanupClosePushL( cm );
+	
+    TUint32 realIap( cm.GetIntAttributeL( CMManager::ECmNextLayerIapId ) );
+    CCHLOGSTRING2( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL: real iap  %d ", realIap );
+    TUint32 realSnap( cm.GetIntAttributeL( CMManager::ECmNextLayerSNAPId ) );
+    CCHLOGSTRING2( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL: real snap %d", realSnap );
+            
+    if ( realIap )
+        {
+        CCHLOGSTRING( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL: VPN linked to IAP" );
+        
+        if ( KErrNotFound != aIapIds.Find( realIap ) )
+            {
+            iaps.Append( realIap );
+            }
+        }
+    else
+        {
+        CCHLOGSTRING( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL: VPN linked to SNAP" );
+        
+        RCmDestination realDestination = CmManagerL().DestinationL( realSnap );
+        CleanupClosePushL( realDestination );
+        
+        for ( TInt i = 0; i < realDestination.ConnectionMethodCount(); i++ )
+            {
+            RCmConnectionMethod realCm = realDestination.ConnectionMethodL( i );
+            CleanupClosePushL( realCm );
+            iapId = realCm.GetIntAttributeL( CMManager::ECmIapId );
+        
+            if ( KErrNotFound != aIapIds.Find( iapId ) )
+                {
+                iaps.Append( iapId );
+                }
+            
+            CleanupStack::PopAndDestroy( &realCm );
+            }
+        
+        CleanupStack::PopAndDestroy( &realDestination );
+        }
+            
+    aIapIds.Reset();
+    for ( TInt j( 0 ); j < iaps.Count(); j++ )
+        {
+        aIapIds.Append( iaps[ j ] );
+        }
+    
+    CleanupStack::PopAndDestroy( &cm );
+    CleanupStack::PopAndDestroy( &iaps ); 
+    
+    CCHLOGSTRING2( "CCCHCommDbWatcher::RemoveOtherThanVpnIapsL; IAPs count after:  %d", aIapIds.Count() );
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchconnmonhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,655 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCCHConnMonHandler implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchconnmonhandler.h"
+#include "cchserverbase.h"
+#include "cchlogger.h"
+#include "cchservicehandler.h"
+#include "cchconnmonhandlernotifier.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+const TInt KPeriodicTimerInterval( 5000000 ); // 5sec.
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::CCCHConnMonHandler
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHConnMonHandler::CCCHConnMonHandler( CCCHServerBase& aServer ) :
+    CActive( CActive::EPriorityStandard ),
+    iState( EUninitialized ),
+    iServer( aServer )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::ConstructL()
+    {
+    User::LeaveIfError( iConnMon.ConnectL() );
+    NotifyL();
+    iConnChangeListenerTimer = CPeriodic::NewL( CActive::EPriorityIdle );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHConnMonHandler* CCCHConnMonHandler::NewL( CCCHServerBase& aServer )
+    {
+    CCCHConnMonHandler* self = CCCHConnMonHandler::NewLC( aServer );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHConnMonHandler* CCCHConnMonHandler::NewLC( CCCHServerBase& aServer )
+    {
+    CCCHConnMonHandler* self = new (ELeave) CCCHConnMonHandler( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// Destructor
+CCCHConnMonHandler::~CCCHConnMonHandler()
+    {
+    CCHLOGSTRING( "CCCHConnMonHandler::~CCCHConnMonHandler" );
+    if ( iConnChangeListenerTimer )
+        {
+        iConnChangeListenerTimer->Cancel();
+        }		
+    delete iConnChangeListenerTimer;
+    StopNotify();
+    Cancel();
+    iPendingRequests.Close();
+    iUnsolvedConnIds.Close();
+    iConnIapIds.Close();
+    iAvailableSNAPs.Close();
+    iAvailableIAPs.Close();
+    iConnMon.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::ScanNetworks
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::ScanNetworks(
+    TBool aWlanScan, MCCHConnMonHandlerNotifier* aObserver )
+    {
+    CCHLOGSTRING( "CCCHConnMonHandler::ScanNetworks: IN" );
+    
+    if ( aWlanScan )
+        {
+        iNetworkScanningObserver = aObserver;
+        GetIaps( EBearerIdAll );
+        }
+            
+    CCHLOGSTRING( "CCCHConnMonHandler::ScanNetworks: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::ScanNetworksCancel
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::ScanNetworksCancel()
+    {
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::IsSNAPAvailable
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHConnMonHandler::IsSNAPAvailable( TUint aSNAPId ) const
+    {    
+    return ( KErrNotFound == iAvailableSNAPs.Find( aSNAPId ) ) 
+        ? EFalse : ETrue; 
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::IsIapAvailable
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHConnMonHandler::IsIapAvailable( TUint aIapId ) const
+    {
+    return ( KErrNotFound == iAvailableIAPs.Find( aIapId ) ) 
+        ? EFalse : ETrue; 
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::SetSNAPsAvailabilityChangeListener
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::SetSNAPsAvailabilityChangeListener(
+    MCCHConnMonHandlerNotifier* aObserver )
+    {
+    CCHLOGSTRING( "CCCHConnMonHandler::SetSNAPsAvailabilityChangeListener" );
+	iConnChangeListenerTimer->Cancel();
+    iSNAPsAvailabilityObserver = aObserver;
+    if ( iSNAPsAvailabilityObserver )
+        {
+        iConnChangeListenerTimer->Start(
+            KPeriodicTimerInterval,
+            KPeriodicTimerInterval,
+            TCallBack( PeriodicTimerCallBack, this ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::GetIaps
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::GetIaps( TConnMonBearerId aBearerId )
+    {
+    if ( !IsActive() )
+        {
+        iConnMon.GetPckgAttribute( aBearerId,
+                                   0,
+                                   KIapAvailability,
+                                   iIapsBuf,
+                                   iStatus );
+        iState = EGetIAPS;
+        SetActive();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::UpdateIapArray
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::UpdateIapArray( TConnMonIapInfo aIaps )
+    {
+    CCHLOGSTRING2( "CCCHConnMonHandler::UpdateIapArray: IN count %d",
+        iAvailableIAPs.Count() );
+    
+    iAvailableIAPs.Reset();
+    TUint count( 0 );
+
+    // Copy TConnMonIapInfo to RArray so we can use RArray::Find method
+    while ( count < aIaps.iCount )
+        {
+        iAvailableIAPs.Append( aIaps.iIap[ count ].iIapId );
+        count++;
+        }
+    CCHLOGSTRING2( "CCCHConnMonHandler::UpdateIapArray: OUT count %d",
+        iAvailableIAPs.Count() );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::GetSNAPs
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::GetSNAPs()
+    {
+    CCHLOGSTRING( "CCCHConnMonHandler::GetSNAPs: IN" );
+    
+    if ( !IsActive() )
+        {
+        iConnMon.GetPckgAttribute( EBearerIdAll, // some parameter
+                                   0, // pass the size of buffer
+                                   KSNAPsAvailability, // specify the request
+                                   iSNAPbuf, // buffer for writing data
+                                   iStatus );
+        iState = EGetSNAPs;
+        SetActive();
+        }
+    
+    CCHLOGSTRING( "CCCHConnMonHandler::GetSNAPs: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::UpdateSnapArray
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::UpdateSnapArray( TConnMonSNAPInfo aSNAPs )
+    {
+    CCHLOGSTRING2( "CCCHConnMonHandler::UpdateSnapArray: IN count %d",
+        iAvailableSNAPs.Count() );
+   
+    iAvailableSNAPs.Reset();
+    TUint count( 0 );
+    // Copy TConnMonSNAPInfo to RArray so we can use RArray::Find method
+    while ( count < aSNAPs.iCount )
+        {
+        iAvailableSNAPs.Append( aSNAPs.iSNAP[ count ].iSNAPId );
+        count++;
+        }        
+    CCHLOGSTRING2( "CCCHConnMonHandler::UpdateSnapArray: OUT count %d",
+        iAvailableSNAPs.Count() );
+    
+    }
+ 
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::NotifyL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::NotifyL()
+    {
+    CCHLOGSTRING( "CCCHConnMonHandler::NotifyL: IN" );
+    
+    iConnMon.NotifyEventL( *this );
+
+    // Thresholds 
+    TInt err = iConnMon.SetUintAttribute( EBearerIdAll,
+                                          0,
+                                          KBearerAvailabilityThreshold,
+                                          1 );
+                                          
+    CCHLOGSTRING2( "CCCHConnMonHandler::NotifyL: OUT", err );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::StopNotify
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::StopNotify()
+    {
+    iConnMon.CancelNotifications();
+    }
+
+// ----------------------------------------------------------------------------
+// CCCHConnMonHandler::PeriodicTimerCallBack
+// The call back function.
+// ----------------------------------------------------------------------------
+//
+TInt CCCHConnMonHandler::PeriodicTimerCallBack( TAny* aAny )
+    {
+    CCHLOGSTRING( "CCCHConnMonHandler::PeriodicTimerCallBack" );
+    
+    CCCHConnMonHandler* self = static_cast<CCCHConnMonHandler*>( aAny );
+    self->iConnChangeListenerTimer->Cancel();
+    
+    if ( self->iSNAPsAvailabilityObserver )
+        {
+        self->iSNAPsAvailabilityObserver->
+            SNAPsAvailabilityChanged( KErrTimedOut );
+        }
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::RunL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::RunL()
+    {
+    CCHLOGSTRING2( "CCCHConnMonHandler::RunL: IN error: %d", iStatus.Int() );
+    
+    if ( KErrNone == iStatus.Int() )
+        {
+        switch ( iState )
+            {
+            case EGetIAPS:
+                {
+                UpdateIapArray( iIapsBuf() );
+                GetSNAPs();
+                }
+                break;
+            
+            case EGetSNAPs:
+                {
+                UpdateSnapArray( iSNAPbuf() );
+                if ( iNetworkScanningObserver )
+                    {
+                    iNetworkScanningObserver->NetworkScanningCompletedL(
+                        iSNAPbuf(), KErrNone );
+                    iNetworkScanningObserver = NULL;
+                    }
+                }
+                break;
+            
+            case EGetIAP:
+                {
+                CCHLOGSTRING2( "CCCHConnMonHandler::RunL: iap: %d", iConnIapId );
+                TCCHConnectionInfo info;
+                info.iIapId  = iConnIapId;
+                info.iConnId = iConnId;
+                                    
+                if ( KErrNotFound == iConnIapIds.Find( info ) )
+                    {
+                    iConnIapIds.Append( info );
+                    }
+                iConnId    = 0;
+                iConnIapId = 0;
+                
+                CCHLOGSTRING2( "CCCHConnMonHandler::RunL: unsolved conn count: %d", iUnsolvedConnIds.Count() );
+                if ( iUnsolvedConnIds.Count() )
+                    {
+                    GetIapId();
+                    }
+                }
+                break;
+                
+            case EGetConnectionCount:
+                {
+                CCHLOGSTRING2( "CCCHConnMonHandler::RunL: conn count: %d", iConnCount );
+                TBool familiar( EFalse );
+                TUint connId( KErrNone );
+                TUint subConnCount( KErrNone );
+                for ( TInt i( 1 ); i <= iConnCount; i++ )
+                    {
+                    if ( !iConnMon.GetConnectionInfo( i, connId, subConnCount ) )
+                        {
+                        familiar = EFalse;
+                        for ( TInt j( 0 ); j < iConnIapIds.Count(); j++ )
+                            {
+                            if ( connId == iConnIapIds[ j ].iConnId )
+                                {
+                                CCHLOGSTRING2( "CCCHConnMonHandler::RunL: iap %d is familiar connection", iConnIapIds[ j ].iIapId );
+                                familiar = ETrue;
+                                break;
+                                }
+                            }
+                        
+                        if ( !familiar && KErrNotFound == iUnsolvedConnIds.Find( connId ) )
+                            {
+                            iUnsolvedConnIds.Append( connId );
+                            }
+                        }
+                    }
+                iConnCount = 0;
+                
+                CCHLOGSTRING2( "CCCHConnMonHandler::RunL: unsolved conn count: %d", iUnsolvedConnIds.Count() );
+                if ( iUnsolvedConnIds.Count() )
+                    {
+                    GetIapId();
+                    }
+                }
+                break;
+                
+            default:
+                break;
+            }
+        
+        
+        if ( iPendingRequests.Count() && !IsActive() )
+            {
+            CCHLOGSTRING2( "CCCHConnMonHandler::RunL: request pending : %d", 
+                iPendingRequests[ 0 ] );
+            switch ( iPendingRequests[ 0 ] )
+                {
+                case EGetIAP:
+                    {
+                    GetIapId();
+                    }
+                    break;
+                        
+                case EGetConnectionCount:
+                    {
+                    GetConnectionCount();
+                    }
+                    break;
+                        
+                default:
+                    break;
+                }
+            
+            iPendingRequests.Remove( 0 );
+            iPendingRequests.Compress();
+            }
+        }
+    else
+        {
+        if ( iNetworkScanningObserver )
+            {
+            iNetworkScanningObserver->NetworkScanningCompletedL(
+                iSNAPbuf(), iStatus.Int() );
+            iNetworkScanningObserver = NULL;
+            }
+        }
+            
+    CCHLOGSTRING( "CCCHConnMonHandler::RunL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::StartMonitoringConnectionChanges
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::StartMonitoringConnectionChanges()
+    {
+    iConnIapIds.Reset();
+    
+    if ( !IsActive() )
+        {
+        GetConnectionCount();
+        }
+    else
+        {
+        iPendingRequests.Append( EGetConnectionCount );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::StopMonitoringConnectionChanges
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::StopMonitoringConnectionChanges( 
+    RArray<TUint>& aIapIds )
+    {
+    aIapIds.Reset();
+    for ( TInt i( 0 ); i < iConnIapIds.Count(); i++ )
+        {
+        if ( KErrNotFound == aIapIds.Find( iConnIapIds[ i ].iIapId ) )
+            {
+            aIapIds.Append( iConnIapIds[ i ].iIapId );
+            }
+        }
+    }
+	
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::GetConnectionCount
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::GetConnectionCount()
+    {
+    iState = EGetConnectionCount;
+    iConnMon.GetConnectionCount( iConnCount, iStatus ); 
+    SetActive(); 
+    }
+     
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::GetIapId
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::GetIapId()
+    {
+    if ( iUnsolvedConnIds.Count() )
+        {
+        iConnId = iUnsolvedConnIds[ 0 ];
+        iUnsolvedConnIds.Remove( 0 );
+        iUnsolvedConnIds.Compress();
+        
+        iState = EGetIAP;
+        iConnMon.GetUintAttribute( iConnId, 0, KIAPId, iConnIapId, iStatus );
+        SetActive();
+        }
+    }
+            
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::RemoveIapId
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::RemoveIapId(
+    TUint aConnId )
+    {
+    for ( TInt i( 0 ); i < iConnIapIds.Count(); i++ )
+        {
+        if ( aConnId == iConnIapIds[ i ].iConnId )
+            {
+            iConnIapIds.Remove( i );
+            iConnIapIds.Compress();
+            break;
+            }
+        }
+    }
+	
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::DoCancel
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::DoCancel()
+    {
+    iConnMon.CancelAsyncRequest( EConnMonGetPckgAttribute );
+    if ( iNetworkScanningObserver )
+        {
+        iNetworkScanningObserver->NetworkScanningCompletedL(
+            iSNAPbuf(), KErrCancel );
+        iNetworkScanningObserver = NULL;
+        }
+    if ( iSNAPsAvailabilityObserver )
+        {
+		iConnChangeListenerTimer->Cancel();
+        iSNAPsAvailabilityObserver->SNAPsAvailabilityChanged( KErrCancel );
+        iSNAPsAvailabilityObserver = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHConnMonHandler::EventL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHConnMonHandler::EventL( const CConnMonEventBase &aConnMonEvent )
+    {
+    CCHLOGSTRING3
+        ( "CCCHConnMonHandler::EventL: IN EventType = %d, ConnectionId = %d", 
+            aConnMonEvent.EventType(), aConnMonEvent.ConnectionId() );
+    
+    switch ( aConnMonEvent.EventType() )
+        {
+        case EConnMonIapAvailabilityChange:
+            {
+            const CConnMonIapAvailabilityChange* eventIap = NULL;
+            eventIap = static_cast< const CConnMonIapAvailabilityChange* >(
+                &aConnMonEvent );
+
+            TConnMonIapInfo iaps = eventIap->IapAvailability();
+            UpdateIapArray( iaps );
+            }
+            break;
+
+        case EConnMonSNAPsAvailabilityChange:
+            {
+            const CConnMonSNAPsAvailabilityChange* eventSNAP = NULL;
+            eventSNAP = static_cast< const CConnMonSNAPsAvailabilityChange* >(
+                 &aConnMonEvent );
+
+            TConnMonSNAPInfo snaps  = eventSNAP->SNAPAvailability();
+            UpdateSnapArray( snaps );
+            
+            if ( iSNAPsAvailabilityObserver )
+                {
+                iConnChangeListenerTimer->Cancel();
+                iSNAPsAvailabilityObserver->SNAPsAvailabilityChanged( KErrNone );
+                }
+            }
+            break;
+			
+        case EConnMonCreateConnection:
+            {
+            const CConnMonCreateConnection* eventCreate = NULL; 
+            eventCreate = static_cast< const CConnMonCreateConnection* >(
+                &aConnMonEvent );
+            iUnsolvedConnIds.Append( eventCreate->ConnectionId() );
+                        
+            if ( !IsActive() )
+                {
+                GetIapId();
+                }
+            else
+                {
+                iPendingRequests.Append( EGetIAP );
+                }
+            }
+            break;
+            
+        case EConnMonDeleteConnection:
+            {
+            const CConnMonDeleteConnection* eventDelete = NULL; 
+            eventDelete = static_cast< const CConnMonDeleteConnection* >(
+                &aConnMonEvent );
+            TUint connId = eventDelete->ConnectionId();
+             
+            RemoveIapId( connId );
+            }
+            break;
+            
+        default:
+            break;
+        }
+    CCHLOGSTRING( "CCCHConnMonHandler::EventL: OUT" );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchetelnetworkstatusnotifier.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,221 @@
+/*
+* 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:  CCchEtelNetworkStatusNotifier implementation
+ *
+*/
+
+
+// INCLUDES
+#include "cchetelnetworkstatusnotifier.h"
+#include "cchclientserver.h"
+#include "cchuihandler.h"
+#include <mmtsy_names.h>
+#include "cchlogger.h"
+
+
+const TUint KCCHEtelRetryDelay  = 1000;
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// CCchEtelNetworkStatusNotifier::NewL() 
+// ----------------------------------------------------------------------------
+CCchEtelNetworkStatusNotifier* CCchEtelNetworkStatusNotifier::NewL( 
+    MCchEtelNetworkStatusObserver& aEtelNetworkStatusObserver )
+    {
+    CCchEtelNetworkStatusNotifier* self = new(ELeave) 
+        CCchEtelNetworkStatusNotifier( aEtelNetworkStatusObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CCchEtelNetworkStatusNotifier::CCchEtelNetworkStatusNotifier() 
+// ----------------------------------------------------------------------------
+CCchEtelNetworkStatusNotifier::CCchEtelNetworkStatusNotifier( 
+    MCchEtelNetworkStatusObserver& aEtelNetworkStatusObserver ) 
+    : CActive( EPriorityStandard ), 
+    iEtelNetworkStatusObserver( aEtelNetworkStatusObserver ),
+    iRegistrationStatus( RMobilePhone::ERegistrationUnknown ),
+    iDelay( KCCHEtelRetryDelay )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ----------------------------------------------------------------------------
+// CCchEtelNetworkStatusNotifier::ConstructL() 
+// ----------------------------------------------------------------------------
+void CCchEtelNetworkStatusNotifier::ConstructL()
+    {    
+    iTimer.CreateLocal();
+    iState = ECCHEtelConnect;
+    Connect();
+    }
+
+// ----------------------------------------------------------------------------
+// CCchEtelNetworkStatusNotifier::~CCchEtelNetworkStatusNotifier() 
+// ----------------------------------------------------------------------------
+
+CCchEtelNetworkStatusNotifier::~CCchEtelNetworkStatusNotifier()
+    {
+    if( IsActive() )
+    	{
+        Cancel();    	
+    	}
+    iPhone.Close();
+    iEtelServer.UnloadPhoneModule( KMmTsyModuleName );
+    iTimer.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CCchEtelNetworkStatusNotifier::Connect
+// Handle notification from pubsub session.
+// -----------------------------------------------------------------------------
+//
+void CCchEtelNetworkStatusNotifier::Connect() 
+    {
+    CCHLOGSTRING( "CCchEtelNetworkStatusNotifier::Connect IN" );
+    TInt error( 0 );
+
+    switch( iState )
+        {
+        case ECCHEtelConnect:
+            error = iEtelServer.Connect();
+            if( error )
+                {
+                break;                    
+                }
+            iState = ECCHEtelLoadModule;
+                
+        case ECCHEtelLoadModule:
+            error = iEtelServer.LoadPhoneModule( KMmTsyModuleName );
+            if( error )
+                {
+                break;                    
+                }
+            iState = ECCHEtelOpenPhone;
+            
+        case ECCHEtelOpenPhone:
+            error = iPhone.Open( iEtelServer, KMmTsyPhoneName );
+            if( error )
+                {
+                break;                    
+                }
+            else
+                {
+                iState = ECCHEtelConnected;                    
+                iPhone.GetNetworkRegistrationStatus( iStatus, iRegistrationStatus );
+                }
+                
+        }
+    if ( error )
+        {
+        iTimer.After( iStatus, iDelay  );
+        iDelay += KCCHEtelRetryDelay;
+        }
+    SetActive();
+    
+    CCHLOGSTRING( "CCchEtelNetworkStatusNotifier::Connect OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCchEtelNetworkStatusNotifier::RunL
+// Handle notification from pubsub session.
+// -----------------------------------------------------------------------------
+//
+void CCchEtelNetworkStatusNotifier::RunL()
+    {
+    CCHLOGSTRING( "CCchEtelNetworkStatusNotifier::RunL IN" );
+    
+    if ( iState == ECCHEtelConnected )
+       {
+       OrderNotification();
+       
+       if ( RMobilePhone::ENotRegisteredNoService == iRegistrationStatus &&
+               iLastRegistrationStatus != iRegistrationStatus )
+           {
+           iEtelNetworkStatusObserver.MobileNetworkNoService();
+           }
+       
+       iLastRegistrationStatus = iRegistrationStatus;      
+       }
+    else 
+       {
+       Connect();
+       }
+
+    CCHLOGSTRING( "CCchEtelNetworkStatusNotifier::RunL OUT" );
+    }
+// -----------------------------------------------------------------------------
+// CCchEtelNetworkStatusNotifier::DoCancel
+// Handle cancel order on this active object.
+// -----------------------------------------------------------------------------
+//
+void CCchEtelNetworkStatusNotifier::DoCancel()
+    {
+    CCHLOGSTRING( "CCchEtelNetworkStatusNotifier::DoCancel IN" );
+    if ( EFalse == iNotified )
+        {
+        iPhone.CancelAsyncRequest( 
+            EMobilePhoneGetNetworkRegistrationStatus );
+        }
+    else
+        {
+        iPhone.CancelAsyncRequest( 
+            EMobilePhoneNotifyNetworkRegistrationStatusChange );
+        }
+    iNotified = EFalse;    
+    
+    CCHLOGSTRING( "CCchEtelNetworkStatusNotifier::DoCancel OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCchEtelNetworkStatusNotifier::OrderNotification
+// Order new notification from CenRep.
+// -----------------------------------------------------------------------------
+//
+void CCchEtelNetworkStatusNotifier::OrderNotification()
+    {
+    CCHLOGSTRING( "CCchEtelNetworkStatusNotifier::OrderNotification IN" );
+    
+    iNotified = ETrue;
+    iPhone.NotifyNetworkRegistrationStatusChange( 
+        iStatus, 
+        iRegistrationStatus );
+    SetActive();
+    
+    CCHLOGSTRING( "CCchEtelNetworkStatusNotifier::OrderNotification OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCchEtelNetworkStatusNotifier::IsNetworkStatusNoService
+// Is network status no service.
+// -----------------------------------------------------------------------------
+//
+TBool CCchEtelNetworkStatusNotifier::IsNetworkStatusNoService() const
+    {
+    CCHLOGSTRING( "CCchEtelNetworkStatusNotifier::IsNetworkStatusNoService" );
+    
+    if ( RMobilePhone::ENotRegisteredNoService == iRegistrationStatus )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchfeaturemanager.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCchFeatureManager implementation.
+ *
+*/
+
+
+// INCLUDES
+
+#include <e32svr.h> // RDebug
+#include <featmgr.h>
+#include "cchfeaturemanager.h"
+#include <centralrepository.h>
+#include "cchprivatecrkeys.h"
+#include "cchlogger.h"
+#include <settingsinternalcrkeys.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ---------------------------------------------------------------------------
+// CCchFeatureManager::CCchFeatureManager
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCchFeatureManager::CCchFeatureManager()
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CCchFeatureManager::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCchFeatureManager::ConstructL()
+    {
+    CCHLOGSTRING( "CCchFeatureManager::ConstructL IN" );
+    
+        // Create Central Repository instance for Offline Mode
+    iOfflineRepository = CRepository::NewL( KCRUidCoreApplicationUIs );
+    
+    TBool iDynamicVoIPSupported( EFalse );
+    FeatureManager::InitializeLibL();
+    
+    iCoverDisplaySupported = FeatureManager::FeatureSupported( 
+        KFeatureIdCoverDisplay );
+    CCHLOGSTRING2( 
+        "CCchFeatureManager::ConstructL: Cover display supported=%d", 
+        iCoverDisplaySupported );
+    
+    iVoIPSupported = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
+    if( iVoIPSupported )
+        {
+        CRepository* rep = CRepository::NewL( KCRUidTelephonySettings );
+        if( rep->Get( KDynamicVoIP, iDynamicVoIPSupported ) == KErrNone )
+            {
+            iVoIPSupported &= iDynamicVoIPSupported;
+            }
+        
+        delete rep;
+        }
+        
+#ifdef _DEBUG
+    iVoIPSupported = ETrue;
+#endif
+    CCHLOGSTRING2( "CCchFeatureManager::ConstructL: VoIP supported=%d", 
+            iVoIPSupported );
+    FeatureManager::UnInitializeLib(); 
+    
+    CCHLOGSTRING( "CCchFeatureManager::ConstructL OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCchFeatureManager::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchFeatureManager* CCchFeatureManager::NewL()
+    {
+    CCchFeatureManager* self = new (ELeave) CCchFeatureManager;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// Destructor
+CCchFeatureManager::~CCchFeatureManager()
+    {
+    delete iOfflineRepository;
+    iOfflineRepository = NULL;
+    }
+    
+// ----------------------------------------------------------------------------
+// CCchFeatureManager::VoIPSupported()
+// ----------------------------------------------------------------------------
+//
+TBool CCchFeatureManager::VoIPSupported() const
+    {
+    return iVoIPSupported;
+    }
+
+// ----------------------------------------------------------------------------
+// CCchFeatureManager::OfflineMode()
+// ----------------------------------------------------------------------------
+//
+TBool CCchFeatureManager::OfflineMode() const
+    {
+    CCHLOGSTRING( "CCchFeatureManager::OfflineMode IN" );
+
+    TInt offline( 0 );
+    iOfflineRepository->Get( KCoreAppUIsNetworkConnectionAllowed, offline );
+    CCHLOGSTRING2( "CCchFeatureManager::OfflineMode Offline: %d", offline );
+    
+    return ECoreAppUIsNetworkConnectionNotAllowed == offline;
+    }
+    
+// ----------------------------------------------------------------------------
+// CCchFeatureManager::CoverDisplaySupported()
+// ----------------------------------------------------------------------------
+//
+TBool CCchFeatureManager::CoverDisplaySupported() const
+    {
+    return iCoverDisplaySupported;
+    }
+    
+
+// End of File
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchnotehandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,392 @@
+/*
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCh note handler.
+*
+*/
+
+// INCLUDE FILES
+#include "cchnotehandler.h"
+#include "cchprivatecrkeys.h"
+#include "cchserverbase.h"
+#include "cchfeaturemanager.h"
+#include <StringLoader.h>
+#include <cch.rsg>
+#include <AknGlobalNote.h>
+#include <AknGlobalMsgQuery.h> 
+#include "cchsecondarydisplayapi.h"
+#include <aknSDData.h>
+#include <barsread.h>
+#include <bautils.h>
+#include "cchlogger.h"
+
+_LIT( KCchResourceDir, "\\resource\\apps\\" );
+_LIT( KCchResourceFileName, "cch.r*" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCchNoteHandler::CCchNoteHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CCchNoteHandler::CCchNoteHandler( CCCHServerBase& aServer )
+      : CActive ( EPriorityHigh ),
+      iServer( aServer ),
+      iCoverDisplaySupported( aServer.FeatureManager().CoverDisplaySupported() )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCchNoteHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCchNoteHandler* CCchNoteHandler::NewL( CCCHServerBase& aServer )
+    {
+    CCchNoteHandler* self = 
+        new (ELeave) CCchNoteHandler( aServer );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CCchNoteHandler::ConstructL()
+// ----------------------------------------------------------------------------
+
+void CCchNoteHandler::ConstructL()
+    {
+    iGlobalMsgQuery = CAknGlobalMsgQuery::NewL();
+    iCchCenRep = CRepository::NewL( KCRUidCch );
+    User::LeaveIfError( iFsSession.Connect() );
+    iResourceFile = ScanFileL( TFileName( KCchResourceFileName ),
+         TFileName( KCchResourceDir ) );
+    User::LeaveIfNull( iResourceFile );
+    CActiveScheduler::Add( this );
+    }    
+
+// ----------------------------------------------------------------------------
+// CCchNoteHandler::~CCchNoteHandler()
+// Destructor
+// ----------------------------------------------------------------------------
+
+CCchNoteHandler::~CCchNoteHandler()
+    {
+    Cancel();
+    iMsgQueryInfoArray.Close();
+    iFsSession.Close();
+    delete iResourceFile;
+    delete iCchCenRep;
+    delete iGlobalMsgQuery;
+    }
+
+// -----------------------------------------------------------------------------
+// CCchNoteHandler::RunL
+// From CActive, handles note/query dismissal.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCchNoteHandler::RunL()
+    {
+    TInt status = iStatus.Int();
+    CCHLOGSTRING2( "CCchNoteHandler::RunL iResourceId: %d", iResourceId );
+
+    // update central repository
+    switch ( iResourceId )
+        {
+        case R_QTN_FIRST_EMERGENCY_WARNING_NOTE:
+            {
+            if ( status == EAknSoftkeyYes || status == EAknSoftkeyOk )
+                {
+                iCchCenRep->Set( 
+                    KCCHVoIPEmergencyWarningShown, 
+                    ECCHVoIPEmergencyWarningAlreadyShown );
+                }
+            if( iDie )
+            	{
+
+            	delete this;
+                return;
+            	}
+            else
+                {
+                // now we are show this emergency note -> we can show
+                // another if needed
+                iServer.SetVoIPEmergencyNoteShown( EFalse );
+                }
+            break;
+            }
+        case R_QTN_VOIP_DO_NOT_SHOW_WARNING:
+            {
+            if ( status == EAknSoftkeyYes || status == EAknSoftkeyOk )
+                {
+                iCchCenRep->Set( 
+                    KCCHVoIPShowEmergencyWarningOnOff,
+                    ECCHVoIPEmergencyWarningOnOffDoNotShowWarning );  
+                
+                }
+            if( iDie )
+            	{
+
+            	delete this;
+                return;
+            	}
+            else
+                {
+                // now we are show this emergency note -> we can show
+                // another if needed
+                iServer.SetVoIPEmergencyNoteShown( EFalse );
+                }
+            break;
+            }
+        case R_QTN_SERVTAB_ALLOW_GPRS_WHEN_ROAMING_QUERY:
+            {
+            if ( status == EAknSoftkeyYes || status == EAknSoftkeyOk )
+                {       
+                // Set gprs roaming cost warning note as shown to cenrep
+                iCchCenRep->Set( 
+                    KCCHGprsRoamingCostWarningShown, 
+                    ECCHGprsRoamingCostWarningAlreadyShown );
+                }
+            }
+            break;
+        default:
+            break;
+        }
+        
+    // delete self
+    if( iResourceId != R_QTN_VOIP_EM_CALL_ERROR_NOTE_NO_CS && iDie )
+        {
+        delete this;
+        return;
+        }
+        
+    // peek one message from query array
+    if( iMsgQueryInfoArray.Count() > 0 )
+        {
+        TGlobalMsgQueryInfo msgQueryInfo = iMsgQueryInfoArray[0];
+        DoLaunchGlobalNoteL( msgQueryInfo.iResourceId,
+                msgQueryInfo.iSoftkeyId,
+                msgQueryInfo.iSecondaryDisplayIndex );
+        
+        iMsgQueryInfoArray.Remove( 0 );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCchNoteHandler::CanBeDestroyed
+// -----------------------------------------------------------------------------
+//
+TBool CCchNoteHandler::CanBeDestroyed()
+	{
+	if( IsActive() )
+		{
+		iDie = ETrue;
+		return EFalse;
+		}
+	else
+		{
+		return ETrue;
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CCchNoteHandler::DoCancel
+// From CActive, cancels current operation.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CCchNoteHandler::DoCancel()
+    {
+    iGlobalMsgQuery->CancelMsgQuery();
+    }
+
+// -----------------------------------------------------------------------------
+// CCchNoteHandler::RunError
+// From CActive, handles exceptions in RunL.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CCchNoteHandler::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CCchNoteHandler::LaunchGlobalNoteL
+// 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+void CCchNoteHandler::LaunchGlobalNoteL( const TInt aResourceId, 
+        const TInt aSoftKeyConfig,
+        const TInt aSecondaryDisplayIndex )
+    {
+    CCHLOGSTRING( "CCchNoteHandler::LaunchGlobalNoteL: IN" );
+    
+    // Check there is global message query is shown at the moment
+    if ( IsActive() )
+        {
+        TBool alreadyAdded( EFalse );       
+        for ( TInt i( 0 ) ; i < iMsgQueryInfoArray.Count() ; i++ )
+            {
+            if ( iMsgQueryInfoArray[ i ].iResourceId == aResourceId )
+                {
+                alreadyAdded = ETrue;
+                }
+            }
+        
+        // Add to array only if note with same resource is not 
+        // already in array
+        if ( !alreadyAdded && ( iResourceId != aResourceId ) )
+            {
+            // add the message query info to array
+            TGlobalMsgQueryInfo msgQueryInfo;
+            msgQueryInfo.iResourceId = aResourceId;
+            msgQueryInfo.iSoftkeyId = aSoftKeyConfig;
+            msgQueryInfo.iSecondaryDisplayIndex = aSecondaryDisplayIndex;
+        
+            iMsgQueryInfoArray.AppendL( msgQueryInfo );
+            }
+        }
+    else
+        {
+        DoLaunchGlobalNoteL( aResourceId, aSoftKeyConfig, aSecondaryDisplayIndex );
+        }
+        
+    if( aResourceId == R_QTN_VOIP_EM_CALL_ERROR_NOTE_NO_CS )
+        {
+        TGlobalMsgQueryInfo msgQueryInfo;
+        msgQueryInfo.iResourceId = R_QTN_VOIP_DO_NOT_SHOW_WARNING;
+        msgQueryInfo.iSoftkeyId = R_AVKON_SOFTKEYS_OK_CANCEL;
+        msgQueryInfo.iSecondaryDisplayIndex = 
+            SecondaryDisplay::ECmdShowDoNotShowVoipEmergencyCallWarningQuery;
+        
+        iMsgQueryInfoArray.AppendL( msgQueryInfo );
+        }
+        
+    CCHLOGSTRING( "CCchNoteHandler::LaunchGlobalNoteL: OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCchNoteHandler::DoLaunchGlobalNoteL
+// 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//    
+void CCchNoteHandler::DoLaunchGlobalNoteL( const TInt aResourceId, 
+        const TInt aSoftKeyConfig,
+        const TInt aSecondaryDisplayIndex )
+    {
+    CCHLOGSTRING( "CCchNoteHandler::LaunchGlobalNoteL: IN" );
+    
+    iResourceId = aResourceId;
+    HBufC* textBuffer = LoadResourceL( aResourceId );
+    CleanupStack::PushL( textBuffer );    
+         
+    // Set secondary display data if necessary
+    if ( iCoverDisplaySupported )
+        {
+        CAknSDData* sd = CAknSDData::NewL(
+            SecondaryDisplay::KCatCch, 
+            aSecondaryDisplayIndex, 
+            KNullDesC8);
+           
+        iGlobalMsgQuery->SetSecondaryDisplayData(sd); 
+        }    
+       
+    iGlobalMsgQuery->ShowMsgQueryL( 
+        iStatus, 
+        textBuffer->Des(), 
+        aSoftKeyConfig, 
+        KNullDesC, 
+        KNullDesC ); 
+
+    CleanupStack::PopAndDestroy( textBuffer );
+    SetActive();
+    
+    CCHLOGSTRING( "CCchNoteHandler::LaunchGlobalNoteL: OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCchNoteHandler::LoadResourceL
+// Loads the localized text resource from resource file
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC* CCchNoteHandler::LoadResourceL( TInt aResourceID )
+    {
+    RResourceFile resourceFile;
+    CleanupClosePushL( resourceFile );    
+    resourceFile.OpenL( iFsSession, *iResourceFile );
+	resourceFile.ConfirmSignatureL( 0 );
+	HBufC8* readBuffer=resourceFile.AllocReadLC( 
+	    aResourceID );
+    const TPtrC16 ptrReadBuffer( 
+        (TText16*) readBuffer->Ptr(),(readBuffer->Length()+1) >> 1 );
+    HBufC* textBuffer=HBufC16::NewL( ptrReadBuffer.Length() );
+    *textBuffer=ptrReadBuffer;
+    CleanupStack::PopAndDestroy( readBuffer );
+    CleanupStack::PopAndDestroy( &resourceFile );
+    return textBuffer;   
+    }
+
+// -----------------------------------------------------------------------------
+// CCchNoteHandler::ScanFileC
+// Finds out the correct path for a file
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC* CCchNoteHandler::ScanFileL( const TDesC& aFileName, 
+                                             const TDesC& aFilePath )
+    {
+    CCHLOGSTRING( "CCchNoteHandler::ScanFileL: IN" );
+    TFindFile search( iFsSession); 
+    CDir* dirlist; 
+    HBufC* fullName = NULL;
+    TFileName filename(aFileName);
+    TInt err = search.FindWildByDir( filename, aFilePath, dirlist ); 
+    if (err == KErrNone)
+        {
+        CCHLOGSTRING( "CCchNoteHandler::ScanFileL: dir found" );
+        if ( dirlist && 0 < dirlist->Count() )
+            {
+            TParse fullentry;
+            fullentry.Set( (*dirlist)[0].iName, &search.File(), NULL ); 
+            TFileName nearestFile( fullentry.FullName() );
+            BaflUtils::NearestLanguageFile( iFsSession, nearestFile );   
+            
+            fullName = HBufC::NewL( nearestFile.Length() );
+            fullName->Des().Copy( nearestFile );  
+            }
+        delete dirlist; 
+        }     
+    CCHLOGSTRING2( "CCchNoteHandler::ScanFileL: OUT value=%s",fullName );
+    return fullName;
+    }
+
+// -----------------------------------------------------------------------------
+// CCchNoteHandler::CchCenRep
+// -----------------------------------------------------------------------------
+//
+CRepository* CCchNoteHandler::CchCenRep()
+    {
+    return iCchCenRep;
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchplugin.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,191 @@
+/*
+* 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:  CCCHPlugin implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchlogger.h"
+#include "cchplugin.h"
+#include "cchservice.h"
+#include "cchservicenotifier.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHPlugin::CCCHPlugin
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHPlugin::CCCHPlugin( TUid aUid ) :
+    iUid( aUid )
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPlugin::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCCHPlugin::ConstructL( TUid aUid )
+    {
+    CCHLOGSTRING( "CCCHPlugin::ConstructL" );
+    CCHLOGSTRING2( "    Uid:        0x%X", aUid );
+
+    iPlugin = CCchService::NewL( aUid, *this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPlugin::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHPlugin* CCCHPlugin::NewL( TUid aUid )
+    {
+    CCCHPlugin* self = new (ELeave) CCCHPlugin( aUid );
+    CleanupStack::PushL( self );
+    self->ConstructL( aUid );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// Destructor
+CCCHPlugin::~CCCHPlugin()
+    {
+    iObservers.Reset();
+    
+    delete iPlugin;
+    iPlugin = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPlugin::CheckUid
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TBool CCCHPlugin::CheckUid( const TUid aUid ) const
+    {
+    return iUid == aUid;
+    }
+        
+// ---------------------------------------------------------------------------
+// CCCHPlugin::Plugin
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+CCchService* CCCHPlugin::Plugin() const
+    {
+    return iPlugin;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPlugin::SetServiceNotifier
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPlugin::SetServiceNotifier( MCCHServiceNotifier* aObserver )
+    {
+    CCHLOGSTRING( "CCCHPlugin::SetServiceNotifier" );
+    
+    TInt index( iObservers.Find( aObserver ) );
+        
+    if ( KErrNotFound == index )
+        {            
+        iObservers.Append( aObserver );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPlugin::RemoveServiceNotifier
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPlugin::RemoveServiceNotifier( MCCHServiceNotifier* aObserver )
+    {
+    CCHLOGSTRING( "CCCHPlugin::RemoveServiceNotifier" );
+    
+    TInt index( iObservers.Find( aObserver ) );
+        
+    if ( KErrNotFound != index )
+        {
+        iObservers.Remove( index );
+        iObservers.Compress();
+        }
+    }
+        
+// ---------------------------------------------------------------------------
+// CCCHPlugin::ServiceStateChanged
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+void CCCHPlugin::ServiceStateChanged( 
+    const TServiceSelection aServiceSelection,
+    TCCHSubserviceState aState, TInt aError  )
+    {
+    CCHLOGSTRING( "CCCHPlugin::ServiceStateChanged" );
+    CCHLOGSTRING2( "    Service Id:        %d", aServiceSelection.iServiceId );
+    CCHLOGSTRING2( "    SubService's Type: %d", aServiceSelection.iType );
+    CCHLOGSTRING2( "    State:             %d", aState );
+    CCHLOGSTRING2( "    Error:             %d", aError );
+    
+    for ( TInt i( 0 ); i < iObservers.Count(); i++ )
+        {
+        if ( iObservers[ i ] )
+            {
+            TRAP_IGNORE(
+                iObservers[ i ]->StateChangedL( 
+                    aServiceSelection.iServiceId, 
+                    aServiceSelection.iType, 
+                    aState,
+                    aError  ) );
+            }
+        }
+    }
+                                          
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchpluginhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,702 @@
+/*
+* 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:  CCCHPluginHandler implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <ecom/ecom.h>
+
+#include "cchlogger.h"
+#include "cchpluginhandler.h"
+#include "cchplugin.h"
+#include "cchservice.h"
+#include "cchservicehandler.h"
+#include "cchserverbase.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::CCCHPluginHandler
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHPluginHandler::CCCHPluginHandler( CCCHServerBase& aServer ) :
+    iServer( aServer )
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHPluginHandler* CCCHPluginHandler::NewL( CCCHServerBase& aServer )
+    {
+    CCCHPluginHandler* self = new (ELeave) CCCHPluginHandler( aServer );
+    return self;
+    }
+
+// Destructor
+CCCHPluginHandler::~CCCHPluginHandler()
+    {
+    // Delete and close Plug-in array
+    iPlugins.ResetAndDestroy();        
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::LoadPluginsL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPluginHandler::LoadPluginsL()
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::LoadPluginsL" );
+    
+    RImplInfoPtrArray pImplInfoArray;
+    CleanupStack::PushL( TCleanupItem( ResetAndDestroy, &pImplInfoArray ) );
+    
+    REComSession::ListImplementationsL( 
+        KCCHConnectivityPluginIFUid, pImplInfoArray );
+            
+    CCHLOGSTRING2( "Available Plug-ins count: %d", pImplInfoArray.Count() );
+    
+    TInt found( KErrNone );
+    
+    for ( TInt i( 0 ); i < pImplInfoArray.Count(); i++ )
+        {
+        found = Find( pImplInfoArray[ i ]->ImplementationUid() );
+        
+        if ( KErrNotFound == found )
+            {
+            CCCHPlugin* pPlugin = CCCHPlugin::NewL(
+                    pImplInfoArray[ i ]->ImplementationUid() );
+            
+            iPlugins.Append( pPlugin );
+                
+            CCHLOGSTRING2( "    Append Plug-in with Uid:    0x%X", 
+                pImplInfoArray[ i ]->ImplementationUid() );
+            }            
+        }
+        
+    CleanupStack::PopAndDestroy( &pImplInfoArray );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::LoadPluginsL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPluginHandler::LoadPluginsL( const TUid& aUid )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::LoadPluginsL" );
+    CCHLOGSTRING2( "    Uid:        0x%X", aUid );
+    
+    TBool found( Find( aUid ) );
+        
+    if ( KErrNotFound == found )
+        {
+        CCCHPlugin* pPlugin = CCCHPlugin::NewL( aUid );
+        
+        iPlugins.Append( pPlugin );
+            
+        CCHLOGSTRING2( "    Append Plug-in with Uid:    0x%X", aUid );
+        }
+   }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::UnloadPlugin
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPluginHandler::UnloadPlugin( const TUid& aUid )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::UnloadPlugin" );
+    CCHLOGSTRING2( "    Uid:        0x%X", aUid );
+    
+    TInt found( Find( aUid ) );
+        
+    if ( KErrNotFound != found )
+        {
+        CCCHPlugin* pPlugin = iPlugins[ found ];
+        iPlugins.Remove( found );
+        delete pPlugin;
+            
+        CCHLOGSTRING( "    Plugin unloaded.");
+        }
+     else
+        {
+        CCHLOGSTRING( "    Plugin not found, cannot unload." );
+        }
+   }
+    
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::EnableServiceL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+void CCCHPluginHandler::EnableServiceL( 
+    const TUint32 aServiceId,
+    const RArray<TUid>& aUids, 
+    const TCCHSubserviceType aType,
+    MCCHServiceNotifier* aNotifier,
+    const TUint32 aIapId,
+    const TBool /*aConnectivityCheck*/ )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::EnableServiceL" );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+    CCHLOGSTRING2( "    Iap Id:     %d", aIapId );
+        
+    TInt found( KErrNone );
+    
+    for ( TInt i( 0 ); i < aUids.Count(); i++ )
+        {
+        CCHLOGSTRING2( "    Uid:        0x%X", aUids[ i ] );
+        
+        TRAP_IGNORE( LoadPluginsL( aUids[ i ] ) );
+        found = Find( aUids[ i ] );
+        if ( KErrNotFound != found )
+            {
+            if ( aNotifier )
+                {
+                iPlugins[ found ]->SetServiceNotifier( aNotifier );    
+                }
+            
+            TCCHSubserviceState state = ECCHUninitialized;
+            const CCCHPlugin* plugin = iPlugins[ found ];
+        	plugin->Plugin()->GetServiceState( 
+        			            TServiceSelection( aServiceId, aType ), 
+        			            state ); 
+        	
+            // check current service state
+        	if( state==ECCHDisconnecting )
+        		{
+        		// return KErrNotReady back to client
+        		User::Leave( KErrNotReady );
+        		}
+        	
+       		!aIapId ? plugin->Plugin()->EnableServiceL( 
+       				            TServiceSelection( aServiceId, aType ) ) :
+        			  plugin->Plugin()->EnableServiceL( 
+        					    TServiceSelection( aServiceId, aType ), 
+        					    aIapId );
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::DisableServiceL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+void CCCHPluginHandler::DisableServiceL( 
+    const TUint32 aServiceId,
+    const RArray<TUid>& aUids,
+    const TCCHSubserviceType aType ) const
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::DisableServiceL" );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+    
+    TInt found( KErrNone );
+    
+    for ( TInt i( 0 ); i < aUids.Count(); i++ )
+        {
+        CCHLOGSTRING2( "    Uid:        0x%X", aUids[ i ] );
+        
+        found = Find( aUids[ i ] );
+        
+        if ( KErrNotFound != found )
+            {
+        	TRAP_IGNORE(iPlugins[ found ]->Plugin()->DisableServiceL( 
+                    TServiceSelection( aServiceId, aType ) ) );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::GetServiceState
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+void CCCHPluginHandler::GetServiceState( 
+    const TUint32 aServiceId, 
+    const TUid aUid,
+    const TCCHSubserviceType aType,
+    TCCHSubserviceState& aState,
+    TInt& aError )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::GetServiceState" );
+    CCHLOGSTRING2( "CCCHPluginHandler::GetServiceState: Service Id: %d", aServiceId );
+    CCHLOGSTRING2( "CCCHPluginHandler::GetServiceState: Uid:        0x%X", aUid );
+    
+    TInt found( Find( aUid ) );
+    
+    if ( KErrNotFound != found )
+        {
+        aError = iPlugins[ found ]->Plugin()->GetServiceState( 
+            TServiceSelection( aServiceId, aType ), aState );
+        }
+        
+    CCHLOGSTRING3( "CCCHPluginHandler::GetServiceState: State, error:      %d, %d", aState, aError );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::ReserveService
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TInt CCCHPluginHandler::ReserveService( 
+    const TUint32 aServiceId,const TUid aUid, const TCCHSubserviceType aType  ) 
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::ReserveService" );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+    CCHLOGSTRING2( "    Uid:        0x%X", aUid );
+    
+    TInt found( Find( aUid ) );
+    
+    if ( KErrNotFound != found )
+        {
+        found = iPlugins[ found ]->Plugin()->ReserveService( 
+            TServiceSelection( aServiceId, aType ) );
+        }
+        
+    return found;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::FreeService
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TInt CCCHPluginHandler::FreeService( 
+    const TUint32 aServiceId,const TUid aUid, const TCCHSubserviceType aType  )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::FreeService" );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+    CCHLOGSTRING2( "    Uid:        0x%X", aUid );
+    
+    TInt found( Find( aUid ) );
+    
+    if ( KErrNotFound != found )
+        {
+        found = iPlugins[ found ]->Plugin()->FreeService( 
+            TServiceSelection( aServiceId, aType ) );
+        }
+        
+    return found;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::IsReserved
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TBool CCCHPluginHandler::IsReserved( 
+    const TUint32 aServiceId,const TUid aUid, 
+    const TCCHSubserviceType aType  ) const
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::ReferenceCount" );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+    CCHLOGSTRING2( "    Uid:        0x%X", aUid );
+    
+    TInt found( Find( aUid ) );
+    TBool ret(EFalse);
+    if ( KErrNotFound != found )
+        {
+        ret = iPlugins[ found ]->Plugin()->IsReserved( 
+            TServiceSelection( aServiceId, aType ) );
+        }
+        
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::GetServiceNetworkInfo
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TInt CCCHPluginHandler::GetServiceNetworkInfo( 
+        const TUint32 aServiceId,
+        const TUid aUid,
+        const TCCHSubserviceType aType,
+        TUint32& aSnapId, 
+        TUint32& aIapId,
+        TBool& aSNAPLocked,
+        TBool& aPasswordSet )
+        {
+        CCHLOGSTRING( "CCCHPluginHandler::GetServiceNetworkInfo" );
+        CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+        CCHLOGSTRING2( "    Uid:        0x%X", aUid );
+        
+        TUint snapId( 0 );
+        TUint iapId( 0 );
+
+        TRAP_IGNORE( LoadPluginsL( aUid ) );
+        TInt found( Find( aUid ) );
+        TServiceConnectionInfo info(aServiceId, aType, snapId, iapId );
+        if ( KErrNotFound != found )
+            {
+            found = iPlugins[ found ]->Plugin()->GetServiceNetworkInfo( 
+                info );
+            }
+            
+        aSnapId = info.iSNAPId;   
+        aIapId = info.iIapId;
+        aSNAPLocked = info.iSNAPLocked;
+        aPasswordSet = info.iPasswordSet;
+        
+        CCHLOGSTRING2( "    SNAP Id:    %d", aSnapId );
+        CCHLOGSTRING2( "    IAP Id:     %d", aIapId );
+        
+        return found;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::SetSnapIdL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPluginHandler::SetSnapIdL( 
+    const TUint32 aServiceId,
+    const RArray<TUid>& aUids,
+    const TCCHSubserviceType aType,
+    const TUint32 aSnapId )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::SetSnapId" );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+    CCHLOGSTRING2( "    SNAP Id:    %d", aSnapId );
+    
+    TInt found( KErrNone );
+    
+    for ( TInt i( 0 ); i < aUids.Count(); i++ )
+        {
+        CCHLOGSTRING2( "    Uid:        0x%X", aUids[ i ] );
+        
+        TRAP_IGNORE( LoadPluginsL( aUids[ i ] ) );
+        found = Find( aUids[ i ] );
+        
+        if ( KErrNotFound != found )
+            {
+            iPlugins[ found ]->Plugin()->SetSnapId( 
+                    TServiceSelection( aServiceId, aType ), aSnapId );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::SetIapIdL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPluginHandler::SetIapIdL( 
+    const TUint32 aServiceId,
+    const RArray<TUid>& aUids,
+    const TCCHSubserviceType aType,
+    const TUint32 aIapId )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::SetIapId" );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+    CCHLOGSTRING2( "    IAP Id:     %d", aIapId );
+    
+    TInt found( KErrNone );
+    
+    for ( TInt i( 0 ); i < aUids.Count(); i++ )
+        {
+        CCHLOGSTRING2( "    Uid:        0x%X", aUids[ i ] );
+        
+        TRAP_IGNORE( LoadPluginsL( aUids[ i ] ) );
+        found = Find( aUids[ i ] );
+        
+        if ( KErrNotFound != found )
+            {
+            iPlugins[ found ]->Plugin()->SetIapId( 
+                    TServiceSelection( aServiceId, aType ), aIapId );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::SetUsernameL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPluginHandler::SetUsernameL( const TUint32 aServiceId,
+        const RArray<TUid>& aUids,
+        const TCCHSubserviceType aType,
+        const TDesC& aUsername )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::SetUsernameL" );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+    CCHLOGSTRING2( "    Username:     %S", &aUsername );
+    
+    TInt found( KErrNone );
+    
+    for ( TInt i( 0 ); i < aUids.Count(); i++ )
+        {
+        CCHLOGSTRING2( "    Uid:        0x%X", aUids[ i ] );
+        
+        LoadPluginsL( aUids[ i ] );
+        found = Find( aUids[ i ] );
+        
+        if ( KErrNotFound != found )
+            {
+            User::LeaveIfError( iPlugins[ found ]->Plugin()->SetConnectionParameter( 
+                    TServiceSelection( aServiceId, aType ),
+                    ECchUsername, aUsername ) );
+            }
+        else
+            {
+            User::Leave( KErrNotFound );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::SetPasswordL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPluginHandler::SetPasswordL( const TUint32 aServiceId,
+        const RArray<TUid>& aUids,
+        const TCCHSubserviceType aType,
+        const TDesC& aPassword )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::SetPasswordL" );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+    CCHLOGSTRING2( "    Password:     %S", &aPassword );
+    
+    TInt found( KErrNone );
+    
+    for ( TInt i( 0 ); i < aUids.Count(); i++ )
+        {
+        CCHLOGSTRING2( "    Uid:        0x%X", aUids[ i ] );
+        
+        LoadPluginsL( aUids[ i ] );
+        found = Find( aUids[ i ] );
+        
+        if ( KErrNotFound != found )
+            {
+            User::LeaveIfError( iPlugins[ found ]->Plugin()->SetConnectionParameter( 
+                    TServiceSelection( aServiceId, aType ),
+                    ECchPassword, aPassword ) );
+            }
+        else
+            {
+            User::Leave( KErrNotFound );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::GetConnectionParameter
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHPluginHandler::GetConnectionParameter(  
+                     const TUid aUid,
+                     const TServiceSelection& aServiceSelection, 
+                     RBuf& aValue )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::GetConnectionParameter" );
+    CCHLOGSTRING2( "    UID: %d", aUid );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceSelection.iServiceId );
+    
+    TRAP_IGNORE( LoadPluginsL( aUid ) );
+    TInt retval( Find( aUid ) );
+    
+    if ( KErrNotFound != retval )
+        {
+        retval = iPlugins[ retval ]->Plugin()->GetConnectionParameter( 
+                       aServiceSelection, aServiceSelection.iParameter,
+                       aValue );
+        }
+   
+    CCHLOGSTRING2( "CCCHPluginHandler::GetConnectionParameter: returning %d", retval );
+    return retval;                
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::GetServiceInfo
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHPluginHandler::GetServiceInfo( 
+    const TUint32 aServiceId,
+    const TUid aUid,
+    const TCCHSubserviceType aType,
+    TDes& aBuffer )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::GetServiceInfo" );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+    CCHLOGSTRING2( "    Uid:        0x%X", aUid );
+    
+    TRAP_IGNORE( LoadPluginsL( aUid ) );
+    TInt found( Find( aUid ) );
+    
+    if ( KErrNotFound != found )
+        {
+        RBuf buf;
+        TRAPD( error, iPlugins[ found ]->Plugin()->
+            GetServiceInfoL( TServiceSelection( aServiceId, aType ), 
+            buf ) ); 
+        aBuffer.Copy( buf );
+        buf.Close();
+        found = error;
+        }
+            
+    CCHLOGSTRING2( "    Info:       %S", &aBuffer );
+    return found;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::IsAvailableL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHPluginHandler::IsAvailableL( 
+    const TUint aServiceId,
+    const TUid aUid,
+    const TCCHSubserviceType aType,
+    RArray<TUint32>& aIapIds ) const
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::IsAvailableL" );
+    CCHLOGSTRING2( "    Service Id: %d", aServiceId );
+    CCHLOGSTRING2( "    Uid:        0x%X", aUid );
+    
+    TInt index( Find( aUid ) );
+    
+    User::LeaveIfError( index );
+    
+    return iPlugins[ index ]->Plugin()->IsAvailableL( 
+        TServiceSelection( aServiceId, aType ), aIapIds );
+    }
+                                             
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::SetServiceNotifier
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPluginHandler::SetServiceNotifier( 
+    MCCHServiceNotifier* aObserver )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::SetServiceNotifier" );
+            
+    for ( TInt i( 0 ); i < iPlugins.Count(); i++ )
+        {
+        iPlugins[ i ]->SetServiceNotifier( aObserver );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::RemoveServiceNotifier
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPluginHandler::RemoveServiceNotifier( 
+    MCCHServiceNotifier* aObserver )
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::RemoveServiceNotifier" );
+            
+    for ( TInt i( 0 ); i < iPlugins.Count(); i++ )
+        {
+        iPlugins[ i ]->RemoveServiceNotifier( aObserver );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::Find
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHPluginHandler::Find( const TUid& aUid ) const
+    {
+    CCHLOGSTRING( "CCCHPluginHandler::Find" );
+    
+    TInt index( KErrNotFound );
+    
+    for ( TInt i( 0 ); i < iPlugins.Count() && KErrNotFound == index; i++ )
+        {
+        if ( iPlugins[ i ]->CheckUid( aUid ) )
+            {
+            index = i;
+            }
+        }
+    
+    CCHLOGSTRING2( "CCCHPluginHandler::Find: index: %d", index ); 
+           
+    return index;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHPluginHandler::ResetAndDestroy
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHPluginHandler::ResetAndDestroy( TAny* aArray )
+    {
+    RImplInfoPtrArray* array = reinterpret_cast<RImplInfoPtrArray*>( aArray );
+    array->ResetAndDestroy();
+    }
+                                         
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchrequeststorage.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,472 @@
+/*
+* 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:  CCCHRequestStorage implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchlogger.h"
+#include "cchserverbase.h"
+#include "cchrequeststorage.h"
+#include "cchconnmonhandler.h"
+#include "cchservicehandler.h"
+#include "cchsubsession.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// IdentityRequestRelation
+// Compare two request storage entries.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool IdentityRequestRelation(
+    const TCCHStorageEntry& aFirst,
+    const TCCHStorageEntry& aSecond )
+    {
+    TBool result( EFalse );
+
+    result = ( aFirst.iRequest == aSecond.iRequest &&
+         aFirst.iSubsession == aSecond.iSubsession );
+
+    return result;
+    }
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::CCCHRequestStorage
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHRequestStorage::CCCHRequestStorage( CCCHServerBase& aServer ) :
+    iServer( aServer )
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHRequestStorage* CCCHRequestStorage::NewL( CCCHServerBase& aServer )
+    {
+    CCCHRequestStorage* self = CCCHRequestStorage::NewLC( aServer );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHRequestStorage* CCCHRequestStorage::NewLC( CCCHServerBase& aServer )
+    {
+    CCCHRequestStorage* self = new (ELeave)CCCHRequestStorage( aServer );
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// Destructor
+CCCHRequestStorage::~CCCHRequestStorage()
+    {
+    iRequests.Close();
+    iSubsessions.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::AddRequestL
+// Add new request into storage.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHRequestStorage::AddRequestL( TCCHCommands aRequest,
+                                      const RMessage2& aMessage,
+                                      const CCCHSubsession* aSubsession )
+    {
+    CCHLOGSTRING( "CCCHRequestStorage::AddRequestL: IN" );
+    CCHLOGSTRING3
+        ("CCCHRequestStorage::AddRequestL: Request = %d, Session = 0x%x",
+            aRequest, aSubsession );
+
+    // Create new request entry
+    TCCHStorageEntry* entry = new (ELeave) TCCHStorageEntry;
+    CleanupStack::PushL( entry );
+
+    // Set entry data
+    entry->iRequest = aRequest;
+    entry->iMessage = new (ELeave) RMessage2( aMessage );
+    CleanupStack::PushL( entry->iMessage );
+    entry->iSubsession = aSubsession;
+    
+    // Check that subsession has not already made the request
+    if ( KErrNotFound ==
+         iRequests.Find( *entry, IdentityRequestRelation ) )
+        {
+        iRequests.AppendL( *entry );
+        
+        switch ( aRequest )
+            {
+            case ECCHEnableService:
+                {
+                TBool connectivityCheck( EFalse );
+                TServiceSelection serviceSelection( aMessage.Int0(), 
+                    static_cast<TCCHSubserviceType>( aMessage.Int1() ) );
+                connectivityCheck = 
+                    aMessage.Int2();
+                
+                TInt err = iServer.ServiceHandler().EnableService( 
+                    serviceSelection, connectivityCheck );
+                    
+                CompleteRequest( ECCHEnableService, aSubsession, err );
+                }
+                break;
+            case ECCHDisableService:
+                {
+                TServiceSelection serviceSelection( aMessage.Int0(), 
+                    static_cast<TCCHSubserviceType>( aMessage.Int1() ) );
+                    
+                TInt err = iServer.ServiceHandler().DisableService( 
+                    serviceSelection );
+                    
+                CompleteRequest( ECCHDisableService, aSubsession, err );
+                }
+                break;
+            case ECCHSetConnectionInfo:
+                {
+                TServiceConnectionInfo serviceConnInfo;
+                
+                TPckgBuf<TServiceConnectionInfo> serviceConnInfoPckg;
+                aMessage.ReadL( 0, serviceConnInfoPckg );
+    
+                serviceConnInfo.iServiceSelection.iServiceId = serviceConnInfoPckg().iServiceSelection.iServiceId;
+                serviceConnInfo.iServiceSelection.iType      = serviceConnInfoPckg().iServiceSelection.iType;
+                serviceConnInfo.iServiceSelection.iParameter = serviceConnInfoPckg().iServiceSelection.iParameter;
+                
+                serviceConnInfo.iSNAPId    = serviceConnInfoPckg().iSNAPId;
+                serviceConnInfo.iIapId     = serviceConnInfoPckg().iIapId;
+                serviceConnInfo.iReserved   = serviceConnInfoPckg().iReserved;
+
+                if( serviceConnInfo.iServiceSelection.iParameter  == ECchUsername )
+                    {
+                    serviceConnInfo.iUsername = serviceConnInfoPckg().iUsername;
+                    serviceConnInfo.iUsername.ZeroTerminate();
+                    }
+                if( serviceConnInfo.iServiceSelection.iParameter  == ECchPassword )
+                    {                
+                    /* : verify password will be zeroed correctly */
+                    serviceConnInfo.iPassword = serviceConnInfoPckg().iPassword;
+                    serviceConnInfo.iPassword.ZeroTerminate();
+                    }
+                
+                TInt err = iServer.ServiceHandler().SetConnectionInfo( 
+                    serviceConnInfo );
+                    
+                CompleteRequest( ECCHSetConnectionInfo, aSubsession, err );
+                }
+                break;
+            case ECCHGetConnectionInfo:
+                {
+                TServiceConnectionInfo serviceConnInfo;
+                
+                TPckgBuf<TServiceConnectionInfo> serviceConnInfoPckg;
+                aMessage.ReadL( 0, serviceConnInfoPckg );
+    
+                serviceConnInfo.iServiceSelection.iServiceId = serviceConnInfoPckg().iServiceSelection.iServiceId;
+                serviceConnInfo.iServiceSelection.iType      = serviceConnInfoPckg().iServiceSelection.iType;
+                serviceConnInfo.iServiceSelection.iParameter = serviceConnInfoPckg().iServiceSelection.iParameter;
+
+                TInt err = iServer.ServiceHandler().GetConnectionInfo(
+                    serviceConnInfo );
+
+                CompleteRequestL( ECCHGetConnectionInfo, aSubsession,
+                    &serviceConnInfo, err );
+                }
+                break;
+
+            case ECCHGetServices:
+                {
+                TInt scanAllowed( KErrNone );
+                
+                // if service id is greater than or equals zero then
+                // this is Quick service discovery request. Network scan is
+                // not performed. 
+                scanAllowed = aMessage.Int0();
+                
+                if ( KErrNotFound == scanAllowed )
+                    {
+                    ScanNetworks();    
+                    
+                    iServer.ServiceHandler().UpdateL( ETrue );
+                    }
+                
+               
+                TRAPD( err, 
+                    iServer.ServiceHandler().GetServicesL( aMessage ) );
+                
+                CompleteRequest( ECCHGetServices, aSubsession, err );
+                }
+                break;
+            default:
+                break;
+            }
+        }
+    else
+        {
+        // Notify request is already active
+        CCHLOGSTRING
+            ( "CCCHRequestStorage::AddRequestL: Request already active!" );
+        iServer.PanicClient( aMessage, KErrAlreadyExists );
+        }
+    CleanupStack::Pop( entry->iMessage );
+    CleanupStack::PopAndDestroy( entry );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::CompleteRequest
+// Complete request and remove it from storage.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHRequestStorage::CompleteRequest( TCCHCommands aRequest,
+                                          const CCCHSubsession* aSubsession,
+                                          TInt aError )
+    {
+    CCHLOGSTRING2
+        ( "CCCHRequestStorage::CompleteRequest: error: %d", aError );
+    
+    TInt error( KErrNone );
+    TCCHStorageEntry entry;
+    entry.iRequest    = aRequest;
+    entry.iSubsession = aSubsession;
+
+    error = iRequests.Find( entry, IdentityRequestRelation );
+    if ( KErrNotFound != error )
+        {
+        iRequests[ error ].iMessage->Complete( aError );
+        DeleteRequest( error );
+
+        // If no error -> return KErrNone
+        error = KErrNone;
+        }
+    CCHLOGSTRING( "CCCHRequestStorage::CompleteRequest: OUT" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::CompleteRequestL
+// Complete request and remove it from storage.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHRequestStorage::CompleteRequestL( TCCHCommands aRequest,
+                                           const CCCHSubsession* aSubsession,
+                                           TAny* aParams,
+                                           TInt aError )
+    {
+    CCHLOGSTRING2
+        ( "CCCHRequestStorage::CompleteRequestL: error: %d", aError );
+    
+    TInt error( KErrNone );
+    TCCHStorageEntry entry;
+    entry.iRequest    = aRequest;
+    entry.iSubsession = aSubsession;
+
+    error = iRequests.Find( entry, IdentityRequestRelation );
+    if ( KErrNotFound != error )
+        {
+        if ( ECCHGetConnectionInfo == entry.iRequest )
+            {
+            TPckgBuf<TServiceConnectionInfo> conInfo;
+            iRequests[ error ].iMessage->ReadL( 0, conInfo );
+            conInfo().iServiceSelection.iServiceId = 
+                static_cast<TServiceConnectionInfo*>( aParams )->iServiceSelection.iServiceId;
+            conInfo().iServiceSelection.iType = 
+                static_cast<TServiceConnectionInfo*>( aParams )->iServiceSelection.iType;
+            conInfo().iSNAPId = 
+                static_cast<TServiceConnectionInfo*>( aParams )->iSNAPId;
+            conInfo().iIapId = 
+                static_cast<TServiceConnectionInfo*>( aParams )->iIapId;
+            conInfo().iSNAPLocked = 
+                static_cast<TServiceConnectionInfo*>( aParams )->iSNAPLocked;
+            conInfo().iPasswordSet = 
+                    static_cast<TServiceConnectionInfo*>( aParams )->iPasswordSet;
+            conInfo().iUsername = static_cast<TServiceConnectionInfo*>( aParams )->iUsername;
+            conInfo().iReserved = 
+                    static_cast<TServiceConnectionInfo*>( aParams )->iReserved;
+                    
+            iRequests[ error ].iMessage->WriteL( 0, conInfo );
+            }
+       
+        iRequests[ error ].iMessage->Complete( aError );
+        DeleteRequest( error );
+
+        // If no error -> return KErrNone
+        error = KErrNone;
+        }
+    CCHLOGSTRING( "CCCHRequestStorage::CompleteRequestL: OUT" );
+    return error;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::RemoveRequestsBySession
+// Remove all requests by session id. (Does not complete request)
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHRequestStorage::RemoveRequestsBySession(
+    const CCCHSubsession* aSubSession )
+    {
+    CCHLOGSTRING( "CCCHRequestStorage::RemoveRequestsBySession: IN" );
+    
+    TInt error( KErrNotFound );
+
+    for ( TInt i( iRequests.Count() - 1 ); i >= 0; i-- )
+        {
+        if ( iRequests[ i ].iSubsession == aSubSession )
+            {
+            DeleteRequest( i );
+            error = KErrNone;
+            }
+        }
+    CCHLOGSTRING( "CCCHRequestStorage::RemoveRequestsBySession: OUT" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::NotifySubserviceStatusChangeL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHRequestStorage::NotifyServiceStatesChange(
+    TServiceStatus aNewStatus )
+    {
+    CCHLOGSTRING( "CCCHRequestStorage::NotifyServiceStatesChange: IN" );
+    //deliver the status event to all subsessions    
+    for ( TInt i = 0; i < iSubsessions.Count(); i++ )
+        {
+        iSubsessions[ i ]->ServiceEventOccured( aNewStatus );
+        }
+
+    CCHLOGSTRING( "CCCHRequestStorage::NotifyServiceStatesChange: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::DeleteRequest
+// Delete message object
+// Delete entry from array
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHRequestStorage::DeleteRequest( TInt aIndex )
+    {
+    CCHLOGSTRING( "CCCHRequestStorage::DeleteRequest: IN" );
+    CCHLOGSTRING2("CCCHRequestStorage::DeleteRequest: Index = %d", aIndex );
+
+    if ( iRequests.Count() > aIndex )
+        {
+         delete iRequests[ aIndex ].iMessage;
+        iRequests[ aIndex ].iMessage = NULL;
+
+        // Remove entry from storage
+        iRequests.Remove( aIndex );
+        }
+   
+    CCHLOGSTRING( "CCCHRequestStorage::DeleteRequest: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::ScanNetworks
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHRequestStorage::ScanNetworks()
+    {
+    // ETrue indicates wlan network scan
+    iServer.ConnMonHandler().ScanNetworks( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::AddSession
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHRequestStorage::AddSession(
+    CCCHSubsession* aSubSession )
+    {
+    CCHLOGSTRING( "CCCHRequestStorage::AddSession: IN" );
+    
+    if( KErrNotFound == iSubsessions.Find( aSubSession ) )
+    	{
+    	iSubsessions.Append( aSubSession );
+    	}
+  
+    CCHLOGSTRING( "CCCHRequestStorage::AddSession: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHRequestStorage::RemoveSession
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHRequestStorage::RemoveSession(
+    const CCCHSubsession* aSubSession )
+    {
+    CCHLOGSTRING( "CCCHRequestStorage::RemoveSession: IN" );
+    
+    TInt error( KErrNotFound );
+
+    for ( TInt i = 0; i < iSubsessions.Count(); i++ )
+        {
+        if ( iSubsessions[ i ] == aSubSession )
+            {
+            iSubsessions.Remove( i );
+            error = KErrNone;
+            break;
+            }
+        }
+    CCHLOGSTRING( "CCCHRequestStorage::RemoveSession: OUT" );
+    return error;
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchserverbase.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,740 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCCHServerBase implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchlogger.h"
+#include "cchserverbase.h"
+#include "cchsession.h"
+#include "cchrequeststorage.h"
+#include "cchconnmonhandler.h"
+#include "cchspshandler.h"
+#include "cchservicehandler.h"
+#include "cchpluginhandler.h"
+#include "cchfeaturemanager.h"
+#include "cchwakeupeventnotifier.h"
+#include "cchstartupcounter.h"
+#include "cchactivescheduler.h"
+#include "cchconnmonhandlernotifier.h"
+
+#include <ecom/ecom.h>
+#include <rconnmon.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+GLDEF_C TInt E32Main();
+#ifdef _DEBUG
+GLDEF_C void MemUsage();
+#endif
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// InitServerL Creates CCHServer.
+// Returns: None.
+// ---------------------------------------------------------------------------
+//
+static void InitServerL()
+    {
+    CCHLOGSTRING("CCCHServerBase::InitServerL");
+    
+    // This is only for startup situation, because starter does not use 
+    // connect metod, which in normal situation reserves the mutex 
+    RMutex serverStartMutex;
+    CleanupClosePushL( serverStartMutex );    
+    TInt createError( serverStartMutex.CreateGlobal( KCCHServerStartMutex ) );
+    if ( KErrNone != createError )
+        {
+        User::LeaveIfError( serverStartMutex.OpenGlobal( KCCHServerStartMutex ) );
+        }
+
+    serverStartMutex.Wait();
+    CCHLOGSTRING( "CCCHServerBase::InitServerL: mutex available" );
+    
+    TFullName name;
+    TFindServer findServer( KCCHServerName );
+    // Check that the server does not exists.
+    if( findServer.Next( name ) == KErrNotFound )
+        {
+        User::LeaveIfError( User::RenameThread( KCCHServerName ) );
+    
+        // create and install the active scheduler we need
+        CCchActiveScheduler* scheduler = new (ELeave) CCchActiveScheduler;
+        CleanupStack::PushL( scheduler );
+        CActiveScheduler::Install( scheduler ); 
+    
+        // create the server (leave it on the cleanup stack)
+        CCCHServerBase* server = NULL;
+        TRAPD( err, server = CCCHServerBase::NewL() );
+    
+        if ( KErrNone != err )
+            {
+            CCHLOGSTRING2
+                ("InitServerL: Server creation failed, error = %d", err );
+                
+            server->PanicServer( ECCHErrCreateServer );
+            }
+        
+        // Scheduler needs server, because server might needs to be restarted 
+        scheduler->SetServer( server );
+        // Initialisation complete, now signal the client
+        RProcess::Rendezvous( KErrNone );
+        
+        // Release and close mutex
+        CCHLOGSTRING( "CCCHServerBase::InitServerL: Release the mutex" );
+        serverStartMutex.Signal();
+        serverStartMutex.Close();
+        
+        // Ready to run
+        CCHLOGSTRING( "CCCHServerBase::InitServerL: Server Running..." );
+        CActiveScheduler::Start();
+    
+        // Cleanup the mutex, scheduler and server
+        delete server;
+        server = NULL;
+    
+        CleanupStack::PopAndDestroy( scheduler );
+        }
+    else
+        {
+        CCHLOGSTRING( "CCCHServerBase::InitServerL: cch server already exists" );
+        RProcess::Rendezvous( KErrAlreadyExists );
+        // Release and close mutex
+        CCHLOGSTRING( "CCCHServerBase::InitServerL: Release the mutex" );
+        serverStartMutex.Signal();
+        serverStartMutex.Close();
+        }
+    CleanupStack::PopAndDestroy( &serverStartMutex );
+    }
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::CCCHServerBase
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHServerBase::CCCHServerBase() :
+    CPolicyServer( EPriorityHigh, KCCHPolicy ),
+    iSessionCounter( 0 )
+    {
+    CCHLOGSTRING( "CCCHServerBase::CCCHServerBase" );
+    iVoIPEmergencyNoteShown = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::ConstructL()
+    {
+    CCHLOGSTRING( "CCCHServerBase::ConstructL" );
+    iWakeUpEventNotifier = CCchWakeUpEventNotifier::NewL( *this );
+    
+    InitServerObjectsL();
+    //Start server
+    StartL( KCCHServerName );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHServerBase* CCCHServerBase::NewL()
+    {
+    CCCHServerBase* self = CCCHServerBase::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHServerBase* CCCHServerBase::NewLC()
+    {
+    CCCHServerBase* self = new (ELeave)CCCHServerBase();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// Destructor
+CCCHServerBase::~CCCHServerBase()
+    { 
+    delete iStartupCounter;
+    delete iWakeUpEventNotifier;
+    
+    ReleaseAllResources();
+    REComSession::FinalClose();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::NewSessionL
+// This is called by RSessionBase (base class for client interface).
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CSession2* CCCHServerBase::NewSessionL( const TVersion& aVersion,
+    const RMessage2& /* aMessage */ ) const
+    {
+    CCHLOGSTRING( "CCCHServerBase::NewSessionL" );
+
+    TVersion version( KCCHServMajorVersionNumber,
+                      KCCHServMinorVersionNumber,
+                      KCCHServBuildVersionNumber );
+
+    if ( !User::QueryVersionSupported( version , aVersion ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    CCCHSession* session = 
+        CCCHSession::NewL( const_cast<CCCHServerBase&>( *this ) );
+    return session;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::ShutdownServerL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::ShutDownServerL()
+    {
+    CCHLOGSTRING( "CCCHServerBase::ShutDownServerL - IN" );
+         
+    if ( !iSessionCounter && IsServerShutdownAllowedL() )
+        {
+        CCHLOGSTRING( "CCCHServerBase::ShutDownServerL - Allowed" );
+        // if session counter is zero -> close server
+        // MSI: Shouldn't we continue in minimal mode?
+        // CActiveScheduler::Current()->Stop();
+        TRAP_IGNORE( StartMinimalServerL() );
+        }
+    CCHLOGSTRING( "CCCHServerBase::ShutDownServerL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::InitServerL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::InitServerObjectsL()
+    {
+    CCHLOGSTRING( "CCCHServerBase::InitServerObjectsL: IN" );
+
+    ServiceHandler().InitServiceHandlerL();
+
+    if ( iServiceHandler->IsStartupFlagSet() )
+        {
+        // is snap ready to proceed startup
+        ConnMonHandler().ScanNetworks( ETrue, this );
+        }
+    else
+        {
+        // Startup flag is not ON, we have to be sure that startup counter 
+        // is truly zero for the next time when startup flag is ON
+        ResetStartupCounterL();
+        StartMinimalServerL();
+        }
+    CCHLOGSTRING( "CCCHServerBase::InitServerObjectsL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::ServiceStartupL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::ServiceStartupL()
+    {
+    CCHLOGSTRING( "CCCHServerBase::ServiceStartupL: IN" );
+    // Start monitoring startup flag registration, this may set startup
+    // flag to OFF if crashes happens more than KCCHMaxStartupCount during
+    // startup flag registration
+    TRAP_IGNORE( CreateStartupCounterL() );
+    // If CCH cannot load the Plug-ins, CCH can still
+    // try to load them later
+    TRAP_IGNORE( iServiceHandler->LoadPluginsL() );
+    RequestStorage().ScanNetworks();
+    // initialization is now done. update states and send notification to
+    // all clients
+    iServerObjectsInit = ETrue;
+    iServiceHandler->UpdateL();
+    CCHLOGSTRING( "CCCHServerBase::ServiceStartupL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::StartMinimalServerL
+// Start server in settings monitoring mode
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::StartMinimalServerL()
+    {
+    CCHLOGSTRING( "CCCHServerBase::StartMinimalServerL IN" );
+
+    iWakeUpEventNotifier->StartL();
+    ReleaseAllResources();
+    CCHLOGSTRING( "CCCHServerBase::StartMinimalServerL OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::ReleaseAllResources
+// Start server in settings monitoring mode
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::ReleaseAllResources()
+    {
+    CCHLOGSTRING( "CCCHServerBase::ReleaseAllResources" );
+
+    delete iServiceHandler;
+    iServiceHandler = NULL;
+    delete iSPSHandler;
+    iSPSHandler = NULL;
+    delete iConnMonHandler;
+    iConnMonHandler = NULL;
+    delete iRequestStorage;
+    iRequestStorage = NULL;
+    delete iPluginHandler;
+    iPluginHandler = NULL;
+    delete iFeatureManager;
+    iFeatureManager = NULL;
+    delete iObjectConIx;
+    iObjectConIx = NULL;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::NotifySessionCreatedL
+// Increase session counter
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::NotifySessionCreatedL()
+    {
+    CCHLOGSTRING( "CCCHServerBase::NotifySessionCreatedL" );
+    
+    iWakeUpEventNotifier->Stop();
+    
+    if ( iSessionCounter == 0 && IsServerShutdownAllowedL() )
+    	{
+        ServiceHandler().InitServiceHandlerL();
+    	}
+    iSessionCounter++;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::NotifySessionClosed
+// Decrease session counter
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::NotifySessionClosed()
+    {
+    CCHLOGSTRING( "CCCHServerBase::NotifySessionClosed" );
+    if ( 0 < iSessionCounter )
+        {
+        iSessionCounter--;
+        }
+    if ( 0 >= iSessionCounter )
+        {
+        iSessionCounter = 0;        
+        TRAP_IGNORE( ShutDownServerL() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::PanicClient
+// Panic client with given error code.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::PanicClient(
+    const RMessage2& aMessage,
+    TInt aPanic )
+    {
+    CCHLOGSTRING2("CCCHServerBase::PanicClient: Panic = %d", aPanic );
+    _LIT( KTxtServer, "CCH Server Client" );
+    aMessage.Panic( KTxtServer, aPanic );
+    CCHLOGSTRING("CCCHServerBase::PanicClient exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// PanicServer implements server panic handler.
+// Panic server with given error code.
+// Returns: None.
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::PanicServer(
+    TInt aPanic )
+    {
+    CCHLOGSTRING2("CCCHServerBase::PanicServer: Panic = %d", aPanic );
+    _LIT( KTxtServerPanic, "CCH Server" );
+    User::Panic( KTxtServerPanic, aPanic );
+    CCHLOGSTRING("CCCHServerBase::PanicServer exit" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::ConstructObject
+// Create requested object and/or return reference to it.
+// ---------------------------------------------------------------------------
+//
+template <class T>T& CCCHServerBase::ConstructObject( 
+    CCCHServerBase* aThis,
+    T*& aObject )
+    {
+    TInt error = KErrNone;
+    if ( !aObject )
+        {
+        TRAP( error, aObject = T::NewL( *aThis ) );
+        }
+    
+    if ( KErrNone != error )
+        {
+        // Failed to create object, have to Panic!
+        PanicServer( ECCHErrCreateServer );
+        }
+    return *aObject;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::ConstructObject
+// Create requested object and/or return reference to it.
+// ---------------------------------------------------------------------------
+//
+template <class T>T& CCCHServerBase::ConstructObject( 
+    T*& aObject )
+    {
+    TInt error = KErrNone;
+    if ( !aObject )
+        {
+        TRAP( error, aObject = T::NewL() );
+        }
+    
+    if ( KErrNone != error )
+        {
+        // Failed to create object, have to Panic!
+        PanicServer( ECCHErrCreateServer );
+        }
+    return *aObject;
+    }
+
+TBool CCCHServerBase::VoIPEmergencyNoteShown()
+	{
+	return iVoIPEmergencyNoteShown;
+	}
+
+void CCCHServerBase::SetVoIPEmergencyNoteShown( TBool aShown )
+	{
+	iVoIPEmergencyNoteShown = aShown;
+	}
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::ObjectContainerIx
+// Return object container index.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CObjectConIx& CCCHServerBase::ObjectContainerIx()
+    {
+    return ConstructObject<CObjectConIx>( iObjectConIx );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::RequestStorage
+// Return instance of request storage.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CCCHRequestStorage& CCCHServerBase::RequestStorage()
+    {
+    return ConstructObject<CCCHRequestStorage>( this, iRequestStorage );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::ConnMonHandler
+// Return instance of ConnMonHandler.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CCCHConnMonHandler& CCCHServerBase::ConnMonHandler()
+    {
+    return ConstructObject<CCCHConnMonHandler>( this, iConnMonHandler );
+    }
+    
+// -----------------------------------------------------------------------------
+// CCCHServerBase::PluginHandler
+// Return instance of plug-in handler.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CCCHPluginHandler& CCCHServerBase::PluginHandler()
+    {
+    return ConstructObject<CCCHPluginHandler>( this, iPluginHandler );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::SPSHandler
+// Return instance of SPSHandler.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CCCHSPSHandler& CCCHServerBase::SPSHandler()
+    {
+    return ConstructObject<CCCHSPSHandler>( this, iSPSHandler );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHServerBase::ServiceHandler
+// Return instance of ServiceHandler.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CCCHServiceHandler& CCCHServerBase::ServiceHandler()
+    {
+    return ConstructObject<CCCHServiceHandler>( this, iServiceHandler );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::FeatureManager
+// Return instance of FeatureManager.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CCchFeatureManager& CCCHServerBase::FeatureManager()
+    {
+    return ConstructObject<CCchFeatureManager>( iFeatureManager );
+    }
+        
+// ---------------------------------------------------------------------------
+// CCCHServerBase::WakeUp
+// Creates all required objects needed by full server mode.
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::WakeUp()
+    {
+    CCHLOGSTRING( "CCCHServerBase::WakeUp IN" );
+    if ( iSessionCounter == 0 && !iServerObjectsInit )
+    	{
+	    TRAPD( err, InitServerObjectsL() );
+	    if ( KErrNone != err )
+	    	{
+	        // Failed to create required objects, have to Panic!
+	        PanicServer( ECCHErrCreateServer );
+	    	}
+    	}
+    CCHLOGSTRING( "CCCHServerBase::WakeUp OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::CreateStartupCounterL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::CreateStartupCounterL()
+    {
+    if ( !iStartupCounter )
+        {
+        iStartupCounter = CCchStartupCounter::NewL( *this );
+        }
+    iStartupCounter->StartupOccuredL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::ResetStartupCounterL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::ResetStartupCounterL()
+    {
+    if ( !iStartupCounter )
+        {
+        iStartupCounter = CCchStartupCounter::NewL( *this );
+        }
+    iStartupCounter->ResetStartupCounter();
+    delete iStartupCounter;
+    iStartupCounter = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::Restart
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::Restart()
+    {
+    CCHLOGSTRING( "CCCHServerBase::Restart IN" );
+    
+    // Send notify to our client
+    TRAP_IGNORE( iServiceHandler->HandleRestartL() );
+    
+    // Do we have to make reregistration
+    if ( iServiceHandler->IsStartupFlagSet() )
+        {
+        delete iServiceHandler;
+        iServiceHandler = NULL;
+        delete iPluginHandler;
+        iPluginHandler = NULL;
+        TRAP_IGNORE( InitServerObjectsL() );
+        }
+    
+    CCHLOGSTRING( "CCCHServerBase::Restart OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServerBase::IsServerShutdownAllowedL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServerBase::IsServerShutdownAllowedL()
+    {
+    CCHLOGSTRING( "CCCHServerBase::IsServerShutdownAllowedL" );
+    
+    TBool shutDownAllowed( ETrue );
+    
+    if ( iSPSHandler && iServiceHandler )  
+        {
+        // Get service IDs
+        RArray<TUint> serviceIds;
+        CleanupClosePushL( serviceIds );
+        
+        iSPSHandler->GetServiceIdsL( serviceIds );
+        
+        TCCHSubserviceState state( ECCHUninitialized );
+  
+        for ( TInt i( 0 ); i < serviceIds.Count(); i++ )
+            {
+            state = iServiceHandler->ServiceState( serviceIds[i] );
+
+            if ( ECCHDisabled != state && ECCHUninitialized != state )
+                {
+                shutDownAllowed = EFalse;
+                }
+            }
+    
+        CleanupStack::PopAndDestroy( &serviceIds ); 
+        }
+
+    CCHLOGSTRING2("CCCHServerBase::IsServerShutdownAllowedL: shutDownAllowed = %d", shutDownAllowed );
+    return shutDownAllowed;
+    }
+
+// ---------------------------------------------------------------------------
+// From MCCHConnMonHandlerNotifier
+// CCCHServerBase::NetworkScanningCompletedL
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::NetworkScanningCompletedL(
+    const TConnMonSNAPInfo& aSNAPs, TInt aError )
+    {
+    CCHLOGSTRING2( "CCCHServerBase::NetworkScanningCompletedL error = %d", aError );
+
+    if ( KErrNone == aError && aSNAPs.iCount  )
+        {
+        ServiceStartupL();
+        }
+    else if ( KErrNone == aError || KErrNotReady == aError )
+        {
+        // No SNAPs available. Start listen to availability change
+        ConnMonHandler().SetSNAPsAvailabilityChangeListener( this );
+        }
+    else
+        {
+        // exceptional error occured
+        ResetStartupCounterL();
+        StartMinimalServerL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MCCHConnMonHandlerNotifier
+// CCCHServerBase::SNAPsAvailabilityChanged
+// ---------------------------------------------------------------------------
+//
+void CCCHServerBase::SNAPsAvailabilityChanged( TInt aError )
+    {
+    CCHLOGSTRING2( "CCCHServerBase::SNAPsAvailabilityChanged error = %d", aError );
+    
+    // Stop event receiving
+    ConnMonHandler().SetSNAPsAvailabilityChangeListener( NULL );
+    
+    if ( KErrNone == aError || KErrTimedOut == aError )
+        {
+        ServiceStartupL();
+        }
+    else
+        {
+        // exceptional error occured
+        ResetStartupCounterL();
+        StartMinimalServerL();
+        }
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+// E32Main implements the executable entry function.
+// Note that because the target type of the CCHServer module
+// is EXEDLL, the entry point has different signature depending
+// on the build platform.
+// Creates a cleanup stack and runs the server.
+// Returns: Zero
+// ---------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    TInt error( KErrNoMemory );
+    __UHEAP_MARK;
+    CCHLOGSTRING( "CCCHServerBase E32Main" );
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+
+    
+    if ( cleanup )
+        {
+        TRAP( error, InitServerL() );
+        delete cleanup;
+        }
+
+    __UHEAP_MARKEND;
+
+    return error;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchservicehandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1880 @@
+/*
+* Copyright (c) 2007-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:  CCCHServiceHandler implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <cchclientserver.h>
+#include <spnotifychange.h>
+
+#include "cchservicehandler.h"
+#include "cchserverbase.h"
+#include "cchspshandler.h"
+#include "cchlogger.h"
+#include "cchpluginhandler.h"
+#include "cchuihandler.h"
+#include "cchconnmonhandler.h"
+#include "cchwlanextension.h"
+#include "cchcommdbwatcher.h"
+#include "cchcommdbwatcherobserver.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+
+const TInt KConnectionRecoveryMaxTries = 5;
+
+const TInt KCCHFirstRecovery    = 15000000;
+const TInt KCCHSecondRecovery   = 15000000;
+const TInt KCCHThirdRecovery    = 30000000;
+const TInt KCCHFourthRecovery   = 60000000;
+const TInt KCCHFifthRecovery    = 60000000;
+
+const TInt KCCHPluginUnloadTimeout = 5000000;
+
+const TInt KCCHHandleNotifyDelay = 1000000;
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None.
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::CCCHServiceHandler
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHServiceHandler::CCCHServiceHandler( CCCHServerBase& aServer ) :
+    iServer( aServer ),
+    iConnectionRecoveryTry( 0 ),
+    iCancelNotify( ETrue ) 
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::ConstructL()
+    {
+    iNotifier = CSPNotifyChange::NewL( *this );
+    iCchUIHandler = CCchUIHandler::NewL( iServer, *this );
+    iConnectionRecoveryTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard );
+    iCommDbWatcher = CCCHCommDbWatcher::NewL( *this );
+    iPluginUnloadTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard );
+    iHandleNotifyDelayTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard );
+    iRecoveryInterval.Append( KCCHFirstRecovery );
+    iRecoveryInterval.Append( KCCHSecondRecovery );
+    iRecoveryInterval.Append( KCCHThirdRecovery );
+    iRecoveryInterval.Append( KCCHFourthRecovery );
+    iRecoveryInterval.Append( KCCHFifthRecovery );
+    iWlanExtension = CCchWlanExtension::NewL( );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHServiceHandler* CCCHServiceHandler::NewL( CCCHServerBase& aServer )
+    {
+    CCCHServiceHandler* self = CCCHServiceHandler::NewLC( aServer );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHServiceHandler* CCCHServiceHandler::NewLC( CCCHServerBase& aServer )
+    {
+    CCCHServiceHandler* self = new (ELeave) CCCHServiceHandler( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// Destructor
+CCCHServiceHandler::~CCCHServiceHandler()
+    {
+    if ( iCchUIHandler )
+        {
+        iCchUIHandler->Destroy();
+        }
+
+    delete iWlanExtension;
+    delete iConnectionRecoveryTimer;
+    delete iPluginUnloadTimer;
+    delete iHandleNotifyDelayTimer;
+    delete iCommDbWatcher;
+
+    if( iNotifier )
+        {
+        iNotifier->Cancel();
+        delete iNotifier;
+        iNotifier = NULL;    
+        }
+
+    iServiceIds.Close();
+    iServer.PluginHandler().RemoveServiceNotifier( this );
+    iServices.ResetAndDestroy();
+    iServicesInRecovery.Close();
+    iRecoveryInterval.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::InitServiceHandlerL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::InitServiceHandlerL()
+    {
+    CCHLOGSTRING2( "CCCHServiceHandler::InitServiceHandlerL [0x%x]: IN",this );
+    
+    RArray<TUint> serviceIds;
+    CleanupClosePushL( serviceIds );
+    iServer.SPSHandler().GetServiceIdsL( serviceIds );
+    for ( TInt i( 0 ); i < serviceIds.Count(); i++ )
+        {        
+        if ( KErrNotFound == FindService( serviceIds[ i ] ) )
+            {
+            TCCHService service;
+            TRAPD( error, iServer.SPSHandler().GetServiceInfoL( 
+                serviceIds[ i ], service ) );
+            if ( KErrNone == error )
+                {
+                AddServiceL( service );    
+                }                    
+            }
+        }
+    CleanupStack::PopAndDestroy( &serviceIds );
+    // Subscribe to service change notifies    
+    EnableNotifyChange();
+    
+    CCHLOGSTRING( "CCCHServiceHandler::InitServiceHandlerL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::AddServiceL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::AddServiceL( TCCHService& aService )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::AddServiceL: IN" );
+    
+    CCCHServiceInfo* cchServiceInfo = CCCHServiceInfo::NewLC( iServer );
+    cchServiceInfo->SetServiceId( aService.iServiceId );
+    cchServiceInfo->SetName( aService.iServiceName );
+    CCHLOGSTRING2( "CCCHServiceHandler::AddServiceL: adding service with %d subservices",aService.iSubservices.Count() );
+    for ( TInt i( 0 ); i < aService.iSubservices.Count(); i++ )
+        {
+        cchServiceInfo->AddSubserviceL( aService.iSubservices[ i ] );
+        }
+        
+    CleanupStack::Pop( cchServiceInfo );
+    iServices.Append( cchServiceInfo );
+    
+    CCHLOGSTRING( "CCCHServiceHandler::AddServiceL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::UpdateL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::UpdateL( TBool aReadSettingTable )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::UpdateL: IN" );
+    
+    // Read settings from service table
+    if ( aReadSettingTable )
+        {
+        RArray<TUint> serviceIds;
+        CleanupClosePushL( serviceIds );
+        
+        TInt index( KErrNotFound );
+        iServer.SPSHandler().GetServiceIdsL( serviceIds );
+        
+        for ( TInt i( 0 ); i < serviceIds.Count(); i++ )
+            {        
+            index = FindService( serviceIds[ i ] );
+            if ( KErrNotFound != index )
+                {
+                iServices[ index ]->UpdateL( ETrue );
+                }
+            else
+                {
+                CCHLOGSTRING2
+                    ( "CCCHSeviceHandler::UpdateL: \
+                        New service found: ServiceId %d", serviceIds[ i ] );
+                TCCHService service;
+                TRAPD( error, iServer.SPSHandler().GetServiceInfoL( 
+                    serviceIds[ i ], service ) );
+                if ( KErrNone == error )
+                    {
+                    AddServiceL( service );
+                    }                
+                }
+            }
+        if ( serviceIds.Count() < iServices.Count() )
+            {
+            // Remove service's which does not exist anymore            
+            for ( TInt i( 0 ); i < iServices.Count(); i++ )
+                {            
+                if ( KErrNotFound == serviceIds.Find( 
+                    iServices[ i ]->GetServiceId( ) ) )
+                    {
+                    CCHLOGSTRING2
+                        ( "CCCHSeviceHandler::UpdateL: \
+                        service removed: ServiceId %d", 
+                        iServices[ i ]->GetServiceId() );
+                    delete iServices[ i ];
+                    iServices.Remove( i );
+                    i--;
+                    StartPluginUnloadTimer( );
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( &serviceIds );
+        }
+    else
+        {
+        for ( TInt i( 0 ); i < iServices.Count(); i++ )
+            {
+            iServices[ i ]->UpdateL();
+            }    
+        }
+    
+    CCHLOGSTRING( "CCCHServiceHandler::UpdateL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::IsStartupFlagSet
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServiceHandler::IsStartupFlagSet() const
+    {
+    TBool ret( EFalse );
+
+    for ( TInt i( 0 ); i < iServices.Count() && !ret; i++ )
+        {
+        ret = iServices[ i ]->StartupFlagSet();
+        }
+        
+    CCHLOGSTRING2( "CCCHServiceHandler::IsStartupFlagSet: %d", ret );
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::IsRecoveryNeeded
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServiceHandler::IsRecoveryNeeded( 
+                               const TCCHSubserviceState aState, 
+                               TInt aError )
+    {
+    TBool recover( EFalse );
+    CCHLOGSTRING( "CCCHServiceHandler::IsRecoveryNeeded: IN" );
+    if( !iServer.FeatureManager().OfflineMode() &&
+        ECCHConnecting == aState && ( 
+        KCCHErrorNetworkLost == aError || 
+        KCCHErrorServiceNotResponding == aError ) &&
+        !iConnectionRecoveryTimer->IsActive() )
+        {
+        recover = ETrue;            
+        }
+    CCHLOGSTRING2( "CCCHServiceHandler::IsRecoveryNeeded: OUT, value=%d", recover );
+    return recover;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::StateChangedL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::StateChangedL( const TUint aServiceId,
+                                        const TCCHSubserviceType aType,
+                                        const TCCHSubserviceState aState,
+                                        const TInt aError )
+    {
+    
+    CCHLOGSTRING( "CCCHServiceHandler::StateChanged: IN" );
+    CCHLOGSTRING2( "CCCHServiceHandler::StateChanged: service id;        %d",aServiceId );
+    CCHLOGSTRING2( "CCCHServiceHandler::StateChanged: service type;      %d",aType );
+    CCHLOGSTRING2( "CCCHServiceHandler::StateChanged: service new state; %d",aState );
+    CCHLOGSTRING2( "CCCHServiceHandler::StateChanged: service error;     %d",aError );
+    TInt index( FindService( aServiceId ) );
+    if ( KErrNotFound != index )
+        {
+        iServices[ index ]->SetErrorL( aType, aError );
+        iServices[ index ]->SetStateL( aType, aState );
+        //toggle voip indicator & emergency note if needed
+        if( ECCHVoIPSub == aType )
+            {
+            iCchUIHandler->UpdateUI( );
+            }
+        
+        if ( ECCHEnabled == aState && !iCchUIHandler->IsCostWarningSeen() )
+            {
+            // Check for possible first usage of GPRS (roaming cost warning)
+            TServiceConnectionInfo serviceConnInfo( aServiceId, aType, 0, 0 );
+            GetConnectionInfo( serviceConnInfo );
+            
+            if ( serviceConnInfo.iIapId )
+                {
+                // Stop monitoring connectivity changes and take new connections
+                RArray<TUint> iaps;
+                CleanupClosePushL( iaps );
+                TBool gprs( EFalse );
+                iServer.ConnMonHandler().StopMonitoringConnectionChanges( iaps );
+                
+                // Are we connected via VPN
+                if ( iCommDbWatcher->IsVpnApL( serviceConnInfo.iIapId ) )
+                    {
+                    // Remove iaps whom are not linked to vpn(snap or iap)
+                    TRAP_IGNORE( iCommDbWatcher->RemoveOtherThanVpnIapsL( 
+                        iaps, serviceConnInfo.iIapId ) );
+                                
+                    for ( TInt i( 0 ); i < iaps.Count(); i++ )
+                        {
+                        CCHLOGSTRING2( "CCCHServiceHandler::StateChanged: new connections: %d",iaps[ i ] );
+                        
+                        // if any new connection is gprs connection show note if not showed already
+                        if( !iCommDbWatcher->IsVpnApL( iaps[ i ] ) && !iCommDbWatcher->IsWlanApL( iaps[ i ] ) )
+                            {
+                            gprs = ETrue;
+                            break;
+                            }
+                        }
+                    }
+                else if( !iCommDbWatcher->IsWlanApL( serviceConnInfo.iIapId ) )
+                    {      
+                    gprs = ETrue;
+                    }
+                CleanupStack::PopAndDestroy( &iaps );
+                
+                if ( gprs )
+                    {
+                    iCchUIHandler->CheckGprsFirstUsageL();
+                    }
+                }
+            }
+        
+        //unload useless plugins    
+        if( ECCHDisabled == aState )
+            {
+            StartPluginUnloadTimer( );
+            }
+        //start fast recovery if not started
+        else if( IsRecoveryNeeded( aState, aError ) )
+            {
+            CCHLOGSTRING( "CCCHServiceHandler::StateChangedL network lost, starting recovery" );
+            iServicesInRecovery.Append( TServiceSelection( aServiceId, aType ) );
+            StartConnectionRecoveryTimer( CCCHServiceHandler::ConnectionRecoveryEvent );                
+            }
+        //stop fast recovery
+        if( ECCHConnecting != aState && 
+                KErrNone == aError &&
+                0 < iServicesInRecovery.Count() )
+            {
+            CCHLOGSTRING( "CCCHServiceHandler::StateChangedL checking if recovery is still needed" );
+            TInt idx = iServicesInRecovery.Find( TServiceSelection( aServiceId, aType ) );
+            if( KErrNotFound != idx )
+                {
+                CCHLOGSTRING( "CCCHServiceHandler::StateChangedL this service has recovered, recovery still on..." );
+                iServicesInRecovery.Remove( idx );
+                }
+            if( 0 == iServicesInRecovery.Count() )
+                {
+                CCHLOGSTRING( "CCCHServiceHandler::StateChangedL all services recovered, stopping recovery" );
+                CancelConnectionRecoveryTimer();
+                }
+            }
+        
+        if ( ECCHConnecting != aState || 
+            ECCHConnecting == aState && KErrNone != aError )
+            {
+            // reset startup counter
+            TBool startupFlag( EFalse );
+            iServer.SPSHandler().LoadAtStartUpL( aServiceId, aType, startupFlag );
+            if ( startupFlag )
+                {
+                iServer.ResetStartupCounterL();
+                }
+            }
+        }
+    else
+        {
+        User::Leave( index );
+        }
+    CCHLOGSTRING( "CCCHServiceHandler::StateChanged: OUT" );
+        
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::StartConnectionRecoveryTimer
+// -----------------------------------------------------------------------------
+//
+void CCCHServiceHandler::StartConnectionRecoveryTimer( TInt (*aFunction)(TAny* aPtr) )
+    {
+    CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::StartConnectionRecoveryTimer; IN", this );
+    CancelConnectionRecoveryTimer();
+    if( !iConnectionRecoveryTimer->IsActive() )
+        {
+        iConnectionRecoveryTry = 0;
+        iConnectionRecoveryTimer->Start( iRecoveryInterval[ iConnectionRecoveryTry ] , 
+                              0, 
+                              TCallBack( aFunction, this ) );
+        CCHLOGSTRING( "CCCHServiceHandler::StartConnectionRecoveryTimer; recovery timer started");
+        
+        }
+    CCHLOGSTRING( "CCCHServiceHandler::StartConnectionRecoveryTimer; OUT");
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::CancelConnectionRecoveryTimer
+// -----------------------------------------------------------------------------
+//
+void CCCHServiceHandler::CancelConnectionRecoveryTimer()
+    {
+    CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::CancelConnectionRecoveryTimer; IN", this );
+
+    if( iConnectionRecoveryTimer->IsActive() )
+        {
+        iConnectionRecoveryTimer->Cancel();
+        }
+    CCHLOGSTRING( "CCCHServiceHandler::CancelConnectionRecoveryTimer; OUT" );        
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::ConnectionRecoveryEvent
+// -----------------------------------------------------------------------------
+//
+TInt CCCHServiceHandler::ConnectionRecoveryEvent( TAny* aSelf )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::ConnectionRecoveryEvent; IN" );
+    CCCHServiceHandler* self = static_cast<CCCHServiceHandler*>( aSelf );
+    self->HandleConnectionRecovery();
+    CCHLOGSTRING( "CCCHServiceHandler::ConnectionRecoveryEvent; OUT" );
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::HandleConnectionRecovery
+// -----------------------------------------------------------------------------
+//
+void CCCHServiceHandler::HandleConnectionRecovery()
+    {
+    CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::HandleConnectionRecovery IN",
+                   this );
+    iConnectionRecoveryTry++;
+    CCHLOGSTRING2( "CCCHServiceHandler::HandleConnectionRecovery; recovery try:%d",iConnectionRecoveryTry );
+    iServer.ConnMonHandler().ScanNetworks( ETrue );    
+    CancelConnectionRecoveryTimer();
+    
+    if( KConnectionRecoveryMaxTries > iConnectionRecoveryTry )
+        {
+        CCHLOGSTRING( "CCCHServiceHandler::HandleConnectionRecovery; recovery continues" );
+        iConnectionRecoveryTimer->Start( iRecoveryInterval[ iConnectionRecoveryTry ], 
+                              0,
+                              TCallBack( CCCHServiceHandler::ConnectionRecoveryEvent, this ) );
+        }
+    else
+        {
+        CCHLOGSTRING( "CCCHServiceHandler::HandleConnectionRecovery; max tries reached, recovery canceled" );
+        }                   
+    CCHLOGSTRING( "CCCHServiceHandler::HandleConnectionRecovery OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::StartPluginUnloadTimer
+// -----------------------------------------------------------------------------
+//
+void CCCHServiceHandler::StartPluginUnloadTimer( )
+    {
+    CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::StartPluginUnloadTimer; IN", this );
+    CancelPluginUnloadTimer();
+    if( !iPluginUnloadTimer->IsActive() )
+        {
+        iPluginUnloadTimer->Start( KCCHPluginUnloadTimeout , 
+                              0, 
+                              TCallBack( CCCHServiceHandler::PluginUnloadEvent, this ) );
+        CCHLOGSTRING( "CCCHServiceHandler::StartPluginUnloadTimer; plugin unload timer started");
+        
+        }
+    CCHLOGSTRING( "CCCHServiceHandler::StartPluginUnloadTimer; OUT");
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::CancelPluginUnloadTimer
+// -----------------------------------------------------------------------------
+//
+void CCCHServiceHandler::CancelPluginUnloadTimer()
+    {
+    CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::CancelPluginUnloadTimer; IN", this );
+
+    if( iPluginUnloadTimer->IsActive() )
+        {
+        iPluginUnloadTimer->Cancel();
+        }
+    CCHLOGSTRING( "CCCHServiceHandler::CancelPluginUnloadTimer; OUT" );        
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::StartHandleNotifyDelayTimer
+// -----------------------------------------------------------------------------
+//
+void CCCHServiceHandler::StartHandleNotifyDelayTimer( )
+    {
+    CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::StartHandleNotifyDelayTimer; IN", this );
+    
+    CancelHandleNotifyDelayTimer();
+    if( !iHandleNotifyDelayTimer->IsActive() )
+        {
+        iHandleNotifyDelayTimer->Start( 
+            KCCHHandleNotifyDelay , 
+            0, 
+            TCallBack( CCCHServiceHandler::HandleNotifyEvent, this ) );
+        
+        CCHLOGSTRING( "CCCHServiceHandler::StartHandleNotifyDelayTimer; timer started");
+        }
+    
+    CCHLOGSTRING( "CCCHServiceHandler::StartHandleNotifyDelayTimer; OUT" );   
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::CancelHandleNotifyDelayTimer
+// -----------------------------------------------------------------------------
+//
+void CCCHServiceHandler::CancelHandleNotifyDelayTimer()
+    {
+    CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::CancelHandleNotifyDelayTimer; IN", this );
+
+    if( iHandleNotifyDelayTimer->IsActive() )
+        {
+        iHandleNotifyDelayTimer->Cancel();
+        }
+    
+    CCHLOGSTRING( "CCCHServiceHandler::CancelHandleNotifyDelayTimer; OUT" );        
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::PluginUnloadEvent
+// -----------------------------------------------------------------------------
+//
+TInt CCCHServiceHandler::PluginUnloadEvent( TAny* aSelf )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::PluginUnloadEvent; IN" );
+    CCCHServiceHandler* self = static_cast<CCCHServiceHandler*>( aSelf );
+    self->HandlePluginUnload();
+    CCHLOGSTRING( "CCCHServiceHandler::PluginUnloadEvent; OUT" );
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::HandleNotifyEvent
+// -----------------------------------------------------------------------------
+//
+TInt CCCHServiceHandler::HandleNotifyEvent( TAny* aSelf )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::HandleNotifyEvent; IN" );
+  
+    CCHLOGSTRING( "CCCHServiceHandler::PluginUnloadEvent; IN" );
+    CCCHServiceHandler* self = static_cast<CCCHServiceHandler*>( aSelf );
+    self->HandleDelayedNotifyEvent();
+    CCHLOGSTRING( "CCCHServiceHandler::HandleNotifyEvent; OUT" );
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::HandlePluginUnload
+// -----------------------------------------------------------------------------
+//
+void CCCHServiceHandler::HandlePluginUnload()
+    {
+    CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::HandlePluginUnload IN",
+                   this );
+    CancelPluginUnloadTimer();
+    TRAP_IGNORE( UnloadDisabledPluginsL( ) );
+    
+    CCHLOGSTRING( "CCCHServiceHandler::HandlePluginUnload OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CCCHServiceHandler::HandleDelayedNotifyEvent
+// -----------------------------------------------------------------------------
+//
+void CCCHServiceHandler::HandleDelayedNotifyEvent()
+    {
+    CCHLOGSTRING2( "CCCHServiceHandler[0x%x]::HandleDelayedNotifyEvent IN",
+                   this );
+    
+    CancelHandleNotifyDelayTimer();
+    
+    TServiceSelection selection;
+    selection.iServiceId = iDelayedHandleNotifyServiceId;
+    TInt index( ServiceExist( selection ) );
+
+    TRAPD( err, 
+        {
+        if ( KErrNotFound != index )
+            {
+            iServices[ index ]->UpdateL( ETrue );
+            }
+        else
+            {
+            TCCHService service;
+            iServer.SPSHandler().GetServiceInfoL( 
+                iDelayedHandleNotifyServiceId, service );
+            AddServiceL( service );
+            } 
+        } );
+
+    //Check if service is already marked as enabled, and enable it
+    if ( KErrNone == err )
+        {
+        index = ServiceExist( selection );
+        if ( KErrNotFound != index )
+            {
+            if( iServices[ index ]->StartupFlagSet() && 
+                ECCHEnabled != iServices[ index ]->GetState() )
+                {
+                iCancelNotify = EFalse;
+                EnableService( selection, EFalse );
+                iCancelNotify = ETrue;
+                }
+            }
+        }
+        
+     // If service has removed, err must be other than none 
+     // and we have to update all services
+    if ( KErrNone != err )
+        {
+        TRAP_IGNORE( UpdateL( ETrue ) );
+        }
+                
+    iDelayedHandleNotifyServiceId = 0;
+    CCHLOGSTRING( "CCCHServiceHandler::HandleDelayedNotifyEvent OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::Exists
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServiceHandler::Exists( TCCHSubserviceType aType, 
+                                  TCCHSubserviceState aState,
+                                  TInt aError ) const
+    {
+    CCHLOGSTRING3( "CCCHServiceHandler::Exists(%d,%d)",aType,aState );
+    TBool bReturn( EFalse );
+    for( TInt i( 0 ); i < iServices.Count(); i++ )
+        {
+        for ( TInt j( 0 ); j < iServices[ i ]->SubserviceCount(); j++ )
+            {
+            TCCHSubserviceState state = ECCHUninitialized;
+            TInt err = iServices[ i ]->GetStatus(iServices[ i ]->GetSubserviceType( j ), state );
+            if( err == KErrNone )
+                {
+                if( aType == iServices[ i ]->GetSubserviceType( j ) && 
+                    aState == state &&
+                    aError == iServices[ i ]->GetError(iServices[ i ]->GetSubserviceType( j ) ) )
+                    {
+                    bReturn = ETrue;
+                    break;
+                    }
+                }
+            }
+        }
+    CCHLOGSTRING2( "CCCHServiceHandler::Exists returns: %d",bReturn );        
+    return bReturn;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::LoadPluginsL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::LoadPluginsL()
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::LoadPluginsL: IN" );
+    
+    // Get plugin uids to array;
+    RArray<TUid> uids;
+    CleanupClosePushL( uids );
+    
+    TUid pluginUid( KNullUid );
+        
+    for( TInt i( 0 ); i < iServices.Count(); i++ )
+        {     
+        for ( TInt j( 0 ); j < iServices[ i ]->SubserviceCount(); j++ )
+            {
+            if ( iServices[ i ]->StartupFlagSet( j ) )
+                {
+                pluginUid = iServices[ i ]->GetUidL( j );
+    
+                if ( KErrNotFound == uids.Find( pluginUid ) && 
+                    KNullUid != pluginUid )
+                    {
+                    uids.Append( pluginUid );
+
+                    TRAP_IGNORE( 
+                        iServer.PluginHandler().LoadPluginsL( pluginUid ) );
+                    
+                    // Set notifier to loaded Plug-ins                        
+                    iServer.PluginHandler().SetServiceNotifier( this );                        
+                    }
+                // Enable subservice
+                TServiceSelection selection;
+                selection.iServiceId = iServices[ i ]->GetServiceId();
+                selection.iType = iServices[ i ]->GetSubserviceType( j );
+                EnableService( selection, EFalse );
+                }           
+            }
+        }        
+    CleanupStack::PopAndDestroy( &uids );    
+    
+    CCHLOGSTRING( "CCCHServiceHandler::LoadPluginsL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::UnloadDisabledPluginsL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::UnloadDisabledPluginsL( )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::UnloadDisabledPluginsL: IN" );
+    
+    // Get plugin uids to array;
+    RArray<TUid> uidsToBeUnloaded;
+    RArray<TUid> uidsNotToBeUnloaded;
+    CleanupClosePushL( uidsToBeUnloaded );
+    CleanupClosePushL( uidsNotToBeUnloaded );
+    
+    
+    // ...let's go through services & sub services
+    for ( TInt ixSer=0; ixSer < iServices.Count(); ixSer++ )
+        {
+        for ( TInt ixSub=0; ixSub < iServices[ ixSer ]->SubserviceCount(); ixSub++ )
+            {
+            TUid pluginUid( KNullUid );
+            TInt error( KErrNone );
+            TRAP( error, pluginUid = iServices[ ixSer ]->GetUidL( ixSub ));
+            // if subservice was found
+            if( KErrNone == error )
+                {
+                
+                TCCHSubserviceState state = ECCHUninitialized;
+                
+                // subservice was found, so don't need to check return value
+                // coverity[check_return] coverity[unchecked_value]
+                iServices[ ixSer ]->GetStatus(
+                     iServices[ ixSer ]->GetSubserviceType( ixSub ), state );
+                     
+                // if non disabled subservice found, add it to non-unload arry                     
+                if( ECCHDisabled != state )
+                    {
+                    uidsNotToBeUnloaded.Append( pluginUid );
+                    }
+                    
+                else
+                    {
+                    if( KErrNotFound == uidsToBeUnloaded.Find( pluginUid ) )
+                        {
+                        // the others go to unload array
+                        uidsToBeUnloaded.Append( pluginUid );        
+                        }
+                    }
+                }
+            }
+        }
+    iServer.PluginHandler().RemoveServiceNotifier( this );
+    for( TInt i=0; i<uidsToBeUnloaded.Count(); i++ )
+        {
+        //unload plugin & set state if not found from non-unloadable array
+        if( KErrNotFound == uidsNotToBeUnloaded.Find( uidsToBeUnloaded[i] ) )
+            {
+            CCHLOGSTRING2(
+                "CCCHServiceHandler::UnloadDisabledPluginsL; unloading plugin UID:0x%x",
+                    uidsToBeUnloaded[i] );
+            iServer.PluginHandler().UnloadPlugin( uidsToBeUnloaded[i] );
+            }
+        }
+    iServer.PluginHandler().SetServiceNotifier( this );
+    CleanupStack::PopAndDestroy( &uidsNotToBeUnloaded );   
+    CleanupStack::PopAndDestroy( &uidsToBeUnloaded );    
+    CCHLOGSTRING( "CCCHServiceHandler::UnloadDisabledPluginsL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::EnableService
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceHandler::EnableService( 
+    const TServiceSelection aServiceSelection, 
+    const TBool aConnectivityCheck )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::EnableService: IN" );
+    TInt error( ServiceExist( aServiceSelection ) );
+    TBool connectionOk( EFalse );
+    if ( KErrNotFound != error )
+        {
+        TInt index = error;
+        TRAP( error, connectionOk = IsServiceConnectivityDefinedL( aServiceSelection ) );
+        if( KErrNone == error )
+            {
+            if( connectionOk )
+                {
+                // Start monitoring connectivity changes
+                iServer.ConnMonHandler().StartMonitoringConnectionChanges();
+                
+                if( iCancelNotify )
+                    {
+                    DisableNotifyChange();
+                    }
+         
+                CCHLOGSTRING3( "CCCHServiceHandler::EnableService: service:%d, type:%d",
+                        aServiceSelection.iServiceId, aServiceSelection.iType );
+    
+                // If client wants to enable VoIP subservice and VoIP are not supported
+                // send KErrNotSupported notify to the client
+                if ( ( ECCHUnknown == aServiceSelection.iType ||
+                       ECCHVoIPSub == aServiceSelection.iType ) &&
+                       iServices[ index ]->SubserviceExist( ECCHVoIPSub ) &&
+                       !iServer.FeatureManager().VoIPSupported() )
+                    {
+                    CCHLOGSTRING( "CCCHServiceHandler::EnableService: No support for VoIP" );
+                    TRAP_IGNORE( iServices[ index ]->SetErrorL( ECCHVoIPSub, KErrNotSupported ) );
+                    TRAP_IGNORE( iServices[ index ]->SetStateL( ECCHVoIPSub, ECCHDisabled ) );
+                    // Enable one by one all subservices except VoIP
+                    if ( ECCHUnknown == aServiceSelection.iType )
+                        {
+                        for ( TInt i( 0 ); i < iServices[ index ]->SubserviceCount(); i++ )
+                            {
+                            if ( ECCHVoIPSub != iServices[ index ]->GetSubserviceType( i ) )
+                                {
+                                TRAP( error, iServices[ index ]->EnableL(
+                                    iServices[ index ]->GetSubserviceType( i ),
+                                        aConnectivityCheck, this ) );
+                                }
+                            }
+                        }
+                    }
+                else
+                    {
+                    TRAP( error, iServices[ index ]->EnableL( 
+                        aServiceSelection.iType, aConnectivityCheck, this ) );
+                    }
+                if( iCancelNotify )
+                    {
+                    EnableNotifyChange();
+                    }
+                if( HasWlanIap( aServiceSelection ) && KErrNone == error )
+                    {
+                    CCHLOGSTRING( "CCCHServiceHandler::EnableService: Launching WLAN scan..." );
+                    TRAP_IGNORE( iWlanExtension->EnableWlanScanL() );
+                    }
+                if ( error )
+                    {
+                    RArray<TUint> iaps;
+                    iServer.ConnMonHandler().StopMonitoringConnectionChanges( iaps );
+                    iaps.Close();
+                    }
+                // There could be new Plug-ins after EnableL, so we must set 
+                // notifier to loaded Plug-ins
+                iServer.PluginHandler().SetServiceNotifier( this );
+                }
+            else
+                {
+                error = KCCHErrorAccessPointNotDefined;
+                }
+            CCHLOGSTRING2
+                    ( "CCCHServiceHandler::EnableService: error: %d", error );
+            }
+        }
+    CCHLOGSTRING( "CCCHServiceHandler::EnableService: OUT" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::DisableService
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceHandler::DisableService( 
+    const TServiceSelection aServiceSelection )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::DisableService: IN" );
+    TInt error( ServiceExist( aServiceSelection ) );
+    
+    if ( KErrNotFound != error )
+        {
+        TInt index( error );
+        if( iCancelNotify )
+            {
+            DisableNotifyChange();
+            }
+
+        TRAP( error, iServices[ index ]->DisableL(
+            aServiceSelection.iType ) );
+        
+        DisableWlanScan();
+        if( iCancelNotify )
+            {
+            EnableNotifyChange();            
+            }
+            CCHLOGSTRING2
+                ( "CCCHServiceHandler::DisableService: error: %d", error );
+        }
+    CCHLOGSTRING2(
+        "CCCHServiceHandler::DisableService: return %d OUT", error );
+    return error;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::DisableWlanScan
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::DisableWlanScan( )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::DisableWlanScan: IN" );
+    
+    TBool disableWlanScan( ETrue );
+    TCCHSubserviceState serviceState( ECCHUninitialized );
+    TCCHSubserviceType serviceType( ECCHUnknown );
+    TInt serviceId( 0 );
+    
+     // ...let's go through services & sub services
+    for ( TInt ixSer = 0; ixSer < iServices.Count(); ixSer++ )
+        {
+        for ( TInt ixSub = 0; ixSub < iServices[ ixSer ]->SubserviceCount(); ixSub++ )
+            {
+            serviceType = iServices[ ixSer ]->GetSubserviceType( ixSub );
+            TInt err = iServices[ ixSer ]->GetStatus( serviceType, serviceState );
+            if( err == KErrNone )
+                {
+                // if found even one enabled/connecting service, do not deactivate scan
+                if( ECCHEnabled == serviceState || ECCHConnecting == serviceState )
+                    {
+                    serviceId =  iServices[ ixSer ]->GetServiceId();
+                    
+                    TServiceConnectionInfo serviceConnInfo( serviceId, serviceType, 0, 0 );
+                    GetConnectionInfo( serviceConnInfo );
+                    // existing snap overrides iap
+                    if( serviceConnInfo.iSNAPId != 0 )
+                        {
+                        TInt wlanIaps( 0 );
+                        TInt allIaps( 0 );
+                        TInt error( KErrNone );
+                        TRAP( error, 
+                            {
+                            wlanIaps = iCommDbWatcher->GetIapCountFromSnap( serviceConnInfo.iSNAPId, ETrue, ETrue );
+                            allIaps = iCommDbWatcher->GetIapCountFromSnap( serviceConnInfo.iSNAPId, EFalse );
+                            } );
+                        
+                        // in case of possibility -> WLAN ALR we need to keep the scan active
+                        // in case of possibility -> do not disable wlan scan if there is only one iap 
+                        // and the iap is wlan
+                        if( KErrNone == error )
+                            {
+                            if( 1 <= allIaps && 0 < wlanIaps )
+                                {
+                                disableWlanScan = EFalse;
+                                break;
+                                }
+                            }
+                        }
+                    else if( serviceConnInfo.iIapId != 0 )
+                        {
+                        TInt error( KErrNone );
+                        TBool isWlanIap( EFalse );
+                        
+                        TRAP( error, isWlanIap = iCommDbWatcher->IsWlanApL( serviceConnInfo.iIapId ) )
+                        CCHLOGSTRING2( "CCCHServiceHandler::DisableWlanScan: error: %d", error );
+                        
+                        if( KErrNone == error)
+                            {
+                            //in case the iap is wlan type, scan is not deactivated
+                            if( isWlanIap )
+                                {
+                                disableWlanScan = EFalse;
+                                break;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        if( !disableWlanScan )
+            {
+            break;
+            }
+        }            
+    if( disableWlanScan )
+        {
+        CCHLOGSTRING( "CCCHServiceHandler::DisableWlanScan disabling wlan scan..." );
+        
+        TRAP_IGNORE( iWlanExtension->DisableWlanScanL() ) ;
+        }
+    CCHLOGSTRING( "CCCHServiceHandler::DisableWlanScan: OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::SetConnectionInfo
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceHandler::SetConnectionInfo( 
+    const TServiceConnectionInfo aServiceConnInfo )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::SetConnectionInfo: IN" );
+    TInt error( KErrNotFound );
+    CCHLOGSTRING2( "CCCHServiceHandler::SetConnectionInfo: serviceId %d",
+        aServiceConnInfo.iServiceSelection.iServiceId );
+    CCHLOGSTRING2( "CCCHServiceHandler::SetConnectionInfo: iType %d",
+        aServiceConnInfo.iServiceSelection.iType );
+    CCHLOGSTRING2( "CCCHServiceHandler::SetConnectionInfo: iSNAPId %d",
+        aServiceConnInfo.iSNAPId );
+    CCHLOGSTRING2( "CCCHServiceHandler::SetConnectionInfo: iIapId %d",
+        aServiceConnInfo.iIapId );
+    CCHLOGSTRING2( "CCCHServiceHandler::SetConnectionInfo: iReserved %d",
+        aServiceConnInfo.iReserved );
+
+    if ( KErrNotFound != 
+        ( error = FindService( aServiceConnInfo.iServiceSelection.iServiceId ) ) )
+        {
+        TInt index( error );
+        TRAP( error, iServices[ index ]->SetConnectionInfoL( 
+            aServiceConnInfo ) );
+        StartPluginUnloadTimer( );
+        CCHLOGSTRING2
+            ( "CCCHServiceHandler::SetConnectionInfo: error: %d", error );
+        }
+    CCHLOGSTRING( "CCCHServiceHandler::SetConnectionInfo: OUT" );
+    return error;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::GetConnectionInfo
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceHandler::GetConnectionInfo( 
+    TServiceConnectionInfo& aServiceConnInfo )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::GetConnectionInfo: IN" );
+    TInt error( KErrNotFound );
+    
+    if ( KErrNotFound != 
+        ( error = FindService( aServiceConnInfo.ServiceId() ) ) )
+        {
+        TInt index( error );
+        TRAP( error, iServices[ index ]->GetConnectionInfoL( 
+                aServiceConnInfo ) );
+        StartPluginUnloadTimer( );
+        CCHLOGSTRING2
+            ( "CCCHServiceHandler::GetConnectionInfo: error: %d", error );
+        }
+    CCHLOGSTRING( "CCCHServiceHandler::GetConnectionInfo: OUT" );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::UsesWlanIapL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServiceHandler::UsesWlanIap( 
+    const TServiceSelection& aServiceSelection )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::UsesWlanIap: IN" );
+    TBool isWlanIap( EFalse );
+    TServiceConnectionInfo serviceConnInfo(
+            aServiceSelection.iServiceId, aServiceSelection.iType, 0, 0 );
+    CCHLOGSTRING3( "CCCHServiceHandler::UsesWlanIap: service:%d, type:%d",
+            aServiceSelection.iServiceId, aServiceSelection.iType );
+    
+    TInt error = GetConnectionInfo( serviceConnInfo );
+    
+    if( KErrNone == error )
+        {
+        
+        CCHLOGSTRING3( "CCCHServiceHandler::UsesWlanIap: snap:%d, snap:%d",
+                serviceConnInfo.iSNAPId, serviceConnInfo.iIapId );
+        if( 0 != serviceConnInfo.iSNAPId )
+            {
+            CCHLOGSTRING( "CCCHServiceHandler::UsesWlanIapL: SNAP in use" );
+            TInt count( 0 );
+            TRAP( error, count = iCommDbWatcher->GetIapCountFromSnap( serviceConnInfo.iSNAPId, ETrue ));
+            if( KErrNone == error && 0 < count )
+                {
+                isWlanIap = ETrue;
+                }
+            }
+        else if( 0 != serviceConnInfo.iIapId )
+            {
+            CCHLOGSTRING( "CCCHServiceHandler::UsesWlanIapL: IAP in use" );
+           
+            TRAP( error, isWlanIap = iCommDbWatcher->IsWlanApL( serviceConnInfo.iIapId ) );
+            CCHLOGSTRING2( "CCCHServiceHandler::UsesWlanIap: error: %d", error );
+            }
+
+
+        }
+    CCHLOGSTRING2( "CCCHServiceHandler::UsesWlanIap: OUT, value=%d", isWlanIap );
+    return isWlanIap;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::IsConnectionDefined
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServiceHandler::IsConnectionDefinedL( 
+    const TServiceSelection& aServiceSelection ) 
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::IsConnectionDefined: IN" );
+    TBool isOk( EFalse );
+    __ASSERT_DEBUG( aServiceSelection.iType != ECCHUnknown, User::Panic( KNullDesC, KErrGeneral ) );
+    TServiceConnectionInfo serviceConnInfo(
+            aServiceSelection.iServiceId, aServiceSelection.iType, 0, 0 );
+    CCHLOGSTRING3( "CCCHServiceHandler::IsConnectionDefined: service:%d, type:%d",
+            aServiceSelection.iServiceId, aServiceSelection.iType );
+    
+    TInt error = GetConnectionInfo( serviceConnInfo );
+    User::LeaveIfError( error );
+    
+    CCHLOGSTRING3( "CCCHServiceHandler::IsConnectionDefined: snap:%d, iap:%d",
+            serviceConnInfo.iSNAPId, serviceConnInfo.iIapId );
+    if( 0 != serviceConnInfo.iSNAPId )
+        {
+        TInt count( 0 );
+        count = iCommDbWatcher->GetIapCountFromSnap( serviceConnInfo.iSNAPId, EFalse, ETrue );
+        CCHLOGSTRING( "CCCHServiceHandler::IsConnectionDefined: SNAP in use" );
+        if( KErrNone == error && 0 < count )
+            {
+            isOk = ETrue;
+            }
+        }
+    else if( 0 != serviceConnInfo.iIapId )
+        {
+        CCHLOGSTRING( "CCCHServiceHandler::IsConnectionDefined: IAP in use" );
+        isOk = ETrue;
+        }
+
+    CCHLOGSTRING2( "CCCHServiceHandler::IsConnectionDefined: OUT, value=%d", isOk );
+    return isOk;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::IsServiceConnectivityDefined
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServiceHandler::IsServiceConnectivityDefinedL( 
+    const TServiceSelection& aServiceSelection ) 
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::IsServiceConnectivityDefined: IN" );
+    
+    TBool isOk( EFalse );
+    TInt error( KErrNone );
+    TInt index = FindService( aServiceSelection.iServiceId );
+    if ( KErrNotFound != index )
+        {
+        if( ECCHUnknown == aServiceSelection.iType )
+            {
+            for( TInt i = 0; i < iServices[ index ]->SubserviceCount(); i++ )
+                {
+                TRAP( error, isOk = IsConnectionDefinedL( 
+                        TServiceSelection( aServiceSelection.iServiceId, 
+                        iServices[ index ]->GetSubserviceType( i ) ) ) ) ;
+                if( isOk )
+                    {
+                    error = KErrNone;
+                    break;
+                    }
+                }
+            }
+        else
+            {
+            TRAP( error, isOk = IsConnectionDefinedL( aServiceSelection ) );
+            }    
+        }
+    CCHLOGSTRING3( 
+        "CCCHServiceHandler::IsServiceConnectivityDefined: OUT, value=%d, error=%d", isOk, error );
+    User::LeaveIfError( error );
+    return isOk;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::HasWlanIap
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServiceHandler::HasWlanIap( 
+    const TServiceSelection& aServiceSelection )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::HasWlanIap: IN" );
+    
+    TBool isWlanIap( EFalse );
+    TInt index = FindService( aServiceSelection.iServiceId );
+    if ( KErrNotFound != index )
+        {
+        if( ECCHUnknown == aServiceSelection.iType )
+            {
+            for( TInt i = 0; i < iServices[ index ]->SubserviceCount(); i++ )
+                {
+                isWlanIap = UsesWlanIap( 
+                        TServiceSelection( aServiceSelection.iServiceId, 
+                        iServices[ index ]->GetSubserviceType( i ) ) ) ;
+                if( isWlanIap )
+                    {
+                    break;
+                    }
+                }
+            }
+        else
+            {
+            isWlanIap = UsesWlanIap( aServiceSelection );
+            }    
+        StartPluginUnloadTimer( );
+        }
+    CCHLOGSTRING2( "CCCHServiceHandler::HasWlanIap: OUT, value=%d", isWlanIap );
+    return isWlanIap;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::ServiceCountL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::ServiceCountL( RMessage2 aMessage ) const
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::ServiceCountL: IN" );
+    
+    TPckgBuf<TUint32> pckgServiceCount;
+    aMessage.ReadL( 0, pckgServiceCount );
+    TCCHSubserviceType type( 
+        static_cast<TCCHSubserviceType>( aMessage.Int1() ) );
+    
+    if ( ECCHUnknown == type )
+        {
+        // Count of services
+        pckgServiceCount() = iServer.SPSHandler().GetServicesCountL();
+        // Service count back to the client
+        aMessage.WriteL( 0, pckgServiceCount );
+        }
+    else
+        {
+        // Count of services which contains subservices
+        pckgServiceCount() = ServiceCount( type );
+        // Service count back to the client
+        aMessage.WriteL( 0, pckgServiceCount );
+        }        
+    
+    CCHLOGSTRING( "CCCHServiceHandler::ServiceCountL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::GetServicesL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::GetServicesL( RMessage2 aMessage )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::GetServicesL: IN" );
+    // outstanding request for service, but SpSettings notify timer still running
+    if( iHandleNotifyDelayTimer->IsActive() )
+        {
+        CCHLOGSTRING( "CCCHServiceHandler::GetServicesL - Forced handling of notify" );
+        iHandleNotifyDelayTimer->Cancel();
+        HandleDelayedNotifyEvent();
+        }
+    TInt count =  iServices.Count();
+    TInt index( KErrNotFound );
+    if ( count )
+        {
+        CCHLOGSTRING2( "CCCHServiceHandler::GetServicesL service count:%d ", count );
+        TUint32 serviceId = aMessage.Int0();
+        TCCHSubserviceType type ( ECCHUnknown );
+        type = static_cast<TCCHSubserviceType>( aMessage.Int1() );
+        
+        if ( KErrNotFound == aMessage.Int0() )
+            {
+            serviceId = KErrNone;
+            }
+        else if ( serviceId != KErrNone )
+            {
+            count = 1;
+            }
+        
+        
+        CArrayFixFlat<TCCHService>* serviceArray = 
+            new( ELeave )CArrayFixFlat<TCCHService>( count );
+        CleanupStack::PushL( serviceArray );
+        
+        TCCHService service;
+        // Get all services
+        if ( KErrNone == serviceId )
+            {
+            CCHLOGSTRING( "CCCHServiceHandler::GetServicesL KErrNone == serviceId" );
+            if ( type == ECCHUnknown )
+                {
+                for ( TInt i( 0 ); i < count; i++ )
+                    {
+                    iServices[ i ]->FillServiceInfo( service );
+                    serviceArray->AppendL( service );
+                    }    
+                }
+            else
+                {
+                for ( TInt i( 0 ); i < count; i++ )
+                    {
+                    if ( iServices[ i ]->SubserviceExist( type ) )
+                        {
+                        iServices[ i ]->FillServiceInfo( service );
+                        serviceArray->AppendL( service );
+                        }                    
+                    }
+                }
+            }
+        // Get specified service
+        else 
+            {
+            if ( type == ECCHUnknown )
+                {
+                index = FindService( serviceId );
+                CCHLOGSTRING2( "CCCHServiceHandler::GetServicesL index:%d", index );
+
+                if ( KErrNotFound != index )
+                    {
+                    iServices[ index ]->FillServiceInfo( service );
+                    serviceArray->AppendL( service );
+                    }
+                }
+            else
+                {
+            CCHLOGSTRING( "CCCHServiceHandler::GetServicesL Else" );
+                TServiceSelection selection( serviceId, type ); 
+                index = ServiceExist( selection );
+                if ( KErrNotFound != index )
+                    {
+                    iServices[ index ]->FillServiceInfo( service );
+                    serviceArray->AppendL( service );
+                    }
+                }
+            }
+        
+        TUint32 length = serviceArray->Count() * sizeof( TCCHService );
+        
+        if ( length )
+            {
+            TPtrC8 servicePtr;
+            servicePtr.Set( 
+                reinterpret_cast<TText8*>( &( *serviceArray )[ 0 ] ), 
+                    length );
+            aMessage.WriteL( 2, servicePtr );                     
+            }
+        else
+            {
+            User::Leave( KErrNotFound );
+            }            
+            
+        CleanupStack::PopAndDestroy( serviceArray );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+    CCHLOGSTRING( "CCCHServiceHandler::GetServicesL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::GetServiceState
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TInt CCCHServiceHandler::GetServiceState( const RMessage2 aMessage )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::GetServiceStateL: IN" );
+        
+    TUint32 serviceId( 0 );
+    TCCHSubserviceType type ( ECCHUnknown );
+    TPckgBuf<TCCHSubserviceState> status;
+    serviceId = aMessage.Int0();
+    type = static_cast<TCCHSubserviceType>( aMessage.Int1() );
+    
+    TInt error( FindService( serviceId ) );
+    TInt errorState = KErrNone;
+    
+    if ( KErrNotFound != error )
+        {
+        TInt index( error );
+        TRAP( error, 
+            {
+            aMessage.ReadL( 2, status );
+            errorState = iServices[ index ]->GetStatus( type, status() );
+            if( errorState == KErrNone )
+                {
+                aMessage.WriteL( 2, status );
+                }
+            } );
+        if( KErrNone == error )
+            {
+            if( errorState == KErrNone )
+                {
+                error = iServices[ index ]->GetError( type );
+                }
+            else
+                {
+                error = errorState;
+                }
+            }
+        StartPluginUnloadTimer( );
+        }
+    
+    CCHLOGSTRING2( 
+        "CCCHServiceHandler::GetServiceStateL: return %d OUT", error );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::GetServiceState
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TCCHSubserviceState CCCHServiceHandler::ServiceState(
+        const TUint aServiceId )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::ServiceState: IN" );
+    
+    TCCHSubserviceState state( ECCHUninitialized );
+    TInt error( FindService( aServiceId ) );
+    
+    if ( KErrNotFound != error )
+        {
+        state = iServices[ error ]->GetState();
+        }
+    
+    CCHLOGSTRING2( 
+        "CCCHServiceHandler::ServiceState: return %d OUT", state );
+    return state;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::GetServiceInfo
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TInt CCCHServiceHandler::GetServiceInfo( const RMessage2 aMessage )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::GetServiceInfo: IN" );
+    TBuf<KCCHMaxProtocolNameLength> buffer;
+
+    TPckgBuf<TServiceConnectionInfo> serviceConnInfoPckg;
+
+    TInt error = KErrNone;
+    TRAP( error, 
+        { 
+        aMessage.ReadL( 0, serviceConnInfoPckg );
+        } );
+        
+    if( error ) 
+        {
+        return error;
+        }
+   
+    TServiceConnectionInfo conninfo;
+     
+    conninfo.iServiceSelection.iServiceId = serviceConnInfoPckg().iServiceSelection.iServiceId;
+    conninfo.iServiceSelection.iType      = serviceConnInfoPckg().iServiceSelection.iType;
+    conninfo.iServiceSelection.iParameter = serviceConnInfoPckg().iServiceSelection.iParameter;
+  
+    error = ServiceExist( conninfo.iServiceSelection );
+    
+    if ( KErrNotFound != error )
+        {
+        TInt index( error );
+
+        if( conninfo.iServiceSelection.iParameter == ECchServiceInfo )
+            {
+            TRAP( error, 
+                {
+                iServices[ index ]->GetServiceInfoL( 
+                    buffer, conninfo.iServiceSelection.iType );
+                aMessage.WriteL( 1, buffer );
+                } );
+            }
+        StartPluginUnloadTimer( );
+        }
+    CCHLOGSTRING2( "CCCHServiceHandler::GetServiceInfo: return %d OUT", error );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::ReserveService
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TInt CCCHServiceHandler::ReserveService( const RMessage2 aMessage ) 
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::ReserveService: IN" );
+    
+    TServiceSelection serviceSelection(aMessage.Int0(), 
+        static_cast<TCCHSubserviceType>( aMessage.Int1() ) );
+    
+    TInt error( ServiceExist( serviceSelection ) );
+    
+    if ( KErrNotFound != error )
+        {
+        TInt index( error );
+        TRAP( error, 
+            {
+            iServices[ index ]->ReserveServiceL( 
+                serviceSelection.iType );
+            } );
+        }
+    CCHLOGSTRING2( "CCCHServiceHandler::ReserveService: return %d OUT", error );
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::FreeService
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TInt CCCHServiceHandler::FreeService( const RMessage2& aMessage )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::FreeService: IN" );
+    
+    TServiceSelection serviceSelection(aMessage.Int0(), 
+        static_cast<TCCHSubserviceType>( aMessage.Int1() ) );
+    
+    TInt error( ServiceExist( serviceSelection ) );
+    
+    if ( KErrNotFound != error )
+        {
+        TInt index( error );
+        TRAP( error, 
+            {
+            iServices[ index ]->FreeServiceL( 
+                serviceSelection.iType );
+            } );
+        }
+    CCHLOGSTRING2( "CCCHServiceHandler::FreeService: return %d OUT", error );        
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::IsReserved
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::IsReserved( RMessage2 aMessage ) const
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::IsReserved: IN" );
+    
+    
+    TServiceSelection serviceSelection(aMessage.Int0(),
+        static_cast<TCCHSubserviceType>( aMessage.Int1() ) );
+    TInt error( KErrNone );
+            
+    TPckgBuf<TBool> pckgIsReserved;
+    TRAP( error, aMessage.ReadL( 2, pckgIsReserved ) );
+    
+    error = ServiceExist( serviceSelection );
+    
+    if ( KErrNotFound != error )
+        {
+        TInt index( error );
+        TRAP( error, 
+            {
+            pckgIsReserved() = iServices[ index ]->IsReservedL( 
+                serviceSelection.iType );
+            } );
+        }
+        
+    
+    if ( KErrNotFound != error )
+        {
+        // Service's reference count back to the client
+        TRAP( error, aMessage.WriteL( 2, pckgIsReserved ) );
+        }
+     
+    
+    CCHLOGSTRING( "CCCHServiceHandler::IsReserved: OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::ServiceExist
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceHandler::ServiceExist( TServiceSelection aSelection ) const
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::ServiceExist: IN" );
+    TBool exist( EFalse );
+    TInt index( FindService( aSelection.iServiceId ) );
+    
+    if ( KErrNotFound != index )
+        {
+        exist = iServices[ index ]->SubserviceExist( aSelection.iType );
+        }    
+    CCHLOGSTRING( "CCCHServiceHandler::ServiceExist: OUT" );
+    return !exist ? KErrNotFound : index;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::FindService
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceHandler::FindService( TUint32 aServiceId ) const
+    {
+    TBool exist( EFalse );
+    TInt index( KErrNotFound );
+    CCHLOGSTRING2( "CCCHServiceHandler::FindService: serviceId %d",
+        aServiceId );
+    for ( TInt i( 0 ); i < iServices.Count() && !exist; i++ )
+        {
+        exist = iServices[ i ]->GetServiceId() == aServiceId;
+        index = i;
+        }
+    return !exist ? KErrNotFound : index;
+    }
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::HandleNotifyChange
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::HandleNotifyChange( TServiceId aServiceId )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::HandleNotifyChange IN" );
+    
+    CancelHandleNotifyDelayTimer();
+    StartHandleNotifyDelayTimer();
+    iDelayedHandleNotifyServiceId = aServiceId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::EnableNotifyChange
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::EnableNotifyChange()
+    {
+    TRACE_ENTRY_POINT;
+    // Subscribe to service change notifies    
+    TRAP_IGNORE( iNotifier->NotifyChangeL( iServiceIds ) );
+    TRACE_EXIT_POINT;
+    }
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::DisableNotifyChange
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::DisableNotifyChange()
+    {
+    TRACE_ENTRY_POINT;
+    iNotifier->Cancel();
+    TRACE_EXIT_POINT;
+    }
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::ServiceCount
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceHandler::ServiceCount( const TCCHSubserviceType aType ) const
+    {
+    CCHLOGSTRING2( "CCCHServiceHandler::ServiceCount: type: %d",aType );
+    
+    TInt count( 0 );
+    
+    for ( TInt i( 0 ); i < iServices.Count(); i++ )
+        {
+        if ( KErrNotFound != iServices[ i ]->FindSubservice( aType ) )
+            {
+            count++;    
+            }
+        }
+    
+    CCHLOGSTRING2( "CCCHServiceHandler::ServiceCount: count: %d", count );
+    
+    return count;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::HandleError
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::HandleError( TInt /*aError*/ )
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::HandleWLANIapAdded
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::HandleWLANIapAdded( TInt aSNAPId )
+    {
+    CCHLOGSTRING( "CCCHServiceHandler::HandleWLANIapAdded: IN" );
+    TBool startScan( EFalse );
+    TCCHSubserviceState serviceState( ECCHUninitialized );
+    TCCHSubserviceType serviceType( ECCHUnknown );
+        
+    // go through all services & subservices
+    for( TInt i = 0; i < iServices.Count(); i++ )
+        {
+        for ( TInt j = 0; j < iServices[ i ]->SubserviceCount(); j++ )
+            {
+            serviceType = iServices[ i ]->GetSubserviceType( j );
+            TInt error = iServices[ i ]->GetStatus( serviceType, serviceState );
+            
+            if( KErrNone == error )
+                {
+                // if we have a connecting or enabled service 
+                if( !iServer.FeatureManager().OfflineMode() &&
+                    ( ECCHConnecting == serviceState || ECCHEnabled == serviceState ) )
+                    {
+                    TUint serviceId = iServices[ i ]->GetServiceId();
+                    TServiceConnectionInfo serviceConnInfo( serviceId, serviceType, 0, 0 );
+                    GetConnectionInfo( serviceConnInfo );
+                    
+                    // with a snap with new wlan iap, we start wlan scan
+                    if( aSNAPId == serviceConnInfo.iSNAPId && 0 != aSNAPId )
+                        {
+                        startScan = ETrue;                    
+                        }
+                    }
+                }
+            }
+        }
+    if( startScan )        
+        {
+        CCHLOGSTRING( "CCCHServiceHandler::HandleWLANIapAdded; starting wlan scan" );
+        TRAP_IGNORE( iWlanExtension->ForceEnableWlanScanL() );
+        iServer.ConnMonHandler().ScanNetworks( ETrue );
+        }
+	CCHLOGSTRING( "CCCHServiceHandler::HandleWLANIapAdded: OUT" );
+	}
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::GetSubserviceTypesL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::GetSubserviceTypesL( 
+    const TUint aServiceId, 
+    RArray<TCCHSubserviceType>& aSubserviceTypes ) const
+    {
+    TInt index( FindService( aServiceId ) );
+    if ( KErrNotFound != index )
+        {
+        aSubserviceTypes.Reset();
+        for ( TInt i( 0 ); i < iServices[ index ]->SubserviceCount(); i++ )
+            {
+            CCHLOGSTRING2( "    Service contains subservice: %d", 
+                iServices[ index ]->GetSubserviceType( i ) );
+            
+            aSubserviceTypes.Append( 
+                    iServices[ index ]->GetSubserviceType( i ) );
+            }
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::SetStartupFlag
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceHandler::SetStartupFlag(
+    TServiceSelection aSelection,
+    TBool aLoadAtStartUp ) const
+    {
+    TInt exist( FindService( aSelection.iServiceId ) );
+    if ( KErrNotFound != exist )
+        {
+        exist = iServices[ exist ]->SetStartupFlag( 
+            aSelection.iType, aLoadAtStartUp ); 
+        }
+    return exist;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceHandler::HandleRestartL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceHandler::HandleRestartL()
+    {
+    // In restart situation all services and subservices goes to 
+    // disabled state, after restart we will make reregistration 
+    CCHLOGSTRING( "CCHServiceHandler::HandleRestartL() IN" );
+    for ( TInt i( 0 ); i < iServices.Count(); i++ )
+        {
+        for ( TInt j( 0 ); j < iServices[ i ]->SubserviceCount(); j++ )
+            {
+            iServices[ i ]->GetSubserviceL( 
+                iServices[ i ]->GetSubserviceType( j ) ).SetError( KErrCancel );
+            iServices[ i ]->GetSubserviceL( 
+                iServices[ i ]->GetSubserviceType( j ) ).SetState( ECCHDisabled );
+            iServices[ i ]->GetSubserviceL( 
+                iServices[ i ]->GetSubserviceType( j ) ).StatusChanged();
+            }
+        }
+    CCHLOGSTRING( "CCHServiceHandler::HandleRestartL() OUT" );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchserviceinfo.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,991 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCCHServiceInfo implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchserviceinfo.h"
+#include "cchsubserviceinfo.h"
+#include "cchserverbase.h"
+#include "cchpluginhandler.h"
+#include "cchrequeststorage.h"
+#include "cchspshandler.h"
+#include "cchservicehandler.h"
+#include "cchlogger.h"
+#include "cchpluginhandler.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// =========================== LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::CCCHServiceInfo
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHServiceInfo::CCCHServiceInfo( CCCHServerBase& aServer ):
+    iServer( aServer ), 
+    iReserved( ETrue )
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHServiceInfo* CCCHServiceInfo::NewL( CCCHServerBase& aServer )
+    {
+    CCCHServiceInfo* self = CCCHServiceInfo::NewLC( aServer );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHServiceInfo* CCCHServiceInfo::NewLC( CCCHServerBase& aServer )
+    {
+    CCCHServiceInfo* self = new (ELeave) CCCHServiceInfo( aServer );
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// Destructor
+CCCHServiceInfo::~CCCHServiceInfo()
+    {
+    iSubservices.ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::GetServiceId
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TUint32 CCCHServiceInfo::GetServiceId() const
+    {
+    return iServiceId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::SetServiceId
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::SetServiceId( TUint32 aServiceId )
+    {
+    iServiceId = aServiceId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::GetName
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+const TDesC CCCHServiceInfo::GetName() const
+    {
+    return iServiceName;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::SetName
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::SetName( const TDesC& aName )
+    {
+    iServiceName.Copy( aName );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::EnableL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::EnableL( 
+    const TCCHSubserviceType aServiceType, 
+    const TBool aConnectivityCheck,
+    MCCHServiceNotifier* aNotifier )
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::EnableL: IN" );
+    CCHLOGSTRING2( "CCCHServiceInfo::EnableL: ServiceId = %d", iServiceId );
+    CCHLOGSTRING2( "CCCHServiceInfo::EnableL: iType %d", aServiceType );
+    CCHLOGSTRING2( "CCCHServiceInfo::EnableL: connectivitycheck %d", 
+        aConnectivityCheck );
+    
+    RArray<TUid> uids;
+    CleanupClosePushL( uids );
+        
+    TUid pluginUid( KNullUid );
+    TBool found( EFalse );
+    TUint iapId( 0 );
+        
+    for ( TInt i( 0 ); i < iSubservices.Count(); i++ )
+        {
+        pluginUid = iSubservices[ i ]->GetPluginUid();
+            
+        found = ( KErrNotFound != uids.Find( pluginUid ) );
+           
+        if ( !found && pluginUid != KNullUid && 
+            ( ECCHUnknown == aServiceType ||
+              aServiceType == iSubservices[ i ]->Type() ) )
+            {
+            uids.Append( pluginUid );
+            }
+        }
+    
+    0 < uids.Count() ? iServer.PluginHandler().EnableServiceL( 
+        iServiceId, uids, aServiceType, aNotifier, iapId, aConnectivityCheck ) : 
+            User::Leave( KErrNotFound );
+    
+    CleanupStack::PopAndDestroy( &uids );
+    
+    // Update service table
+    if ( ECCHUnknown != aServiceType )
+        {        
+        iServer.SPSHandler().SetLoadAtStartUpL( iServiceId,
+            aServiceType, ETrue );
+        }
+    else
+        {
+        for ( TInt i( 0 ); i < iSubservices.Count(); i++ )
+            {
+            iServer.SPSHandler().SetLoadAtStartUpL( iServiceId,
+            iSubservices[ i ]->Type(), ETrue );
+            }
+        }        
+    CCHLOGSTRING( "CCCHServiceInfo::EnableL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::DisableL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::DisableL( const TCCHSubserviceType aServiceType )
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::DisableL: IN" );
+    CCHLOGSTRING2( "CCCHServiceInfo::DisableL: ServiceId = %d", iServiceId );
+    CCHLOGSTRING2( "CCCHServiceInfo::DisableL: iType %d", aServiceType );
+    
+    RArray<TUid> uids;
+    CleanupClosePushL( uids );
+        
+    TUid pluginUid( KNullUid );
+    TBool found( EFalse );
+        
+    for ( TInt i( 0 ); i < iSubservices.Count(); i++ )
+        {
+        pluginUid = iSubservices[ i ]->GetPluginUid();
+            
+        found = ( KErrNotFound != uids.Find( pluginUid ) );
+                       
+        if ( !found && pluginUid != KNullUid && 
+            ( ECCHUnknown == aServiceType ||
+              aServiceType == iSubservices[ i ]->Type() ) )
+            {
+            uids.Append( pluginUid );
+            }
+        }
+    
+    0 < uids.Count() ? iServer.PluginHandler().DisableServiceL( 
+        iServiceId, uids, aServiceType ) : User::Leave( KErrNotFound );
+        
+    CleanupStack::PopAndDestroy( &uids );
+    
+    // Update service table
+    if ( ECCHUnknown != aServiceType )
+        {        
+        iServer.SPSHandler().SetLoadAtStartUpL( iServiceId,
+            aServiceType, EFalse );
+        }
+    else
+        {
+        for ( TInt i( 0 ); i < iSubservices.Count(); i++ )
+            {
+            iServer.SPSHandler().SetLoadAtStartUpL( iServiceId,
+            iSubservices[ i ]->Type(), EFalse );
+            }
+        }
+                
+    CCHLOGSTRING( "CCCHServiceInfo::DisableL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::SetConnectionInfoL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::SetConnectionInfoL( 
+    const TServiceConnectionInfo aServiceConnInfo )
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::SetConnectionInfoL: IN" );
+    
+    RArray<TUid> uids;
+    CleanupClosePushL( uids );
+        
+    TUid pluginUid( KNullUid );
+    TBool found( EFalse );
+        
+    for ( TInt i( 0 ); i < iSubservices.Count(); i++ )
+        {        
+        pluginUid = iSubservices[ i ]->GetPluginUid();
+            
+        found = ( KErrNotFound != uids.Find( pluginUid ) );
+        
+        if ( !found && pluginUid != KNullUid && 
+            ( ECCHUnknown == aServiceConnInfo.iServiceSelection.iType ||
+              aServiceConnInfo.iServiceSelection.iType == 
+              iSubservices[ i ]->Type() ) )
+            {
+            uids.Append( pluginUid );
+            }
+        // Set connection information to subservice
+        if ( ECCHUnknown == aServiceConnInfo.iServiceSelection.iType ||
+              aServiceConnInfo.iServiceSelection.iType == 
+              iSubservices[ i ]->Type() ) 
+            {
+            iSubservices[ i ]->SetIapId( aServiceConnInfo.iIapId );
+            iSubservices[ i ]->SetSNAPId( aServiceConnInfo.iSNAPId );
+            }
+        }
+    
+    if ( 0 == uids.Count() )
+        {
+        User::Leave( KErrNotFound );
+        }
+                
+    if ( !aServiceConnInfo.iIapId && aServiceConnInfo.iSNAPId )
+        {
+        iServer.PluginHandler().SetSnapIdL( 
+            aServiceConnInfo.ServiceId(), uids, 
+                aServiceConnInfo.Type(), 
+                aServiceConnInfo.iSNAPId );
+        }
+    else if ( aServiceConnInfo.iIapId && !aServiceConnInfo.iSNAPId )
+        {
+        iServer.PluginHandler().SetIapIdL( 
+            aServiceConnInfo.ServiceId(), uids, 
+                aServiceConnInfo.Type(), 
+                aServiceConnInfo.iIapId );
+        }
+    else if ( aServiceConnInfo.iIapId && aServiceConnInfo.iSNAPId )
+        {
+        iServer.PluginHandler().SetIapIdL( 
+            aServiceConnInfo.ServiceId(), uids, 
+                aServiceConnInfo.Type(),
+                aServiceConnInfo.iIapId );
+        iServer.PluginHandler().SetSnapIdL( 
+            aServiceConnInfo.ServiceId(), uids, 
+            aServiceConnInfo.Type(),
+                aServiceConnInfo.iSNAPId );
+        }
+   
+    // username must not be empty. And check this field should be set 
+    if ( aServiceConnInfo.iServiceSelection.iParameter == ECchUsername && 
+         aServiceConnInfo.iUsername.Length() )
+        {
+        iServer.PluginHandler().SetUsernameL( 
+            aServiceConnInfo.ServiceId(), uids, 
+                aServiceConnInfo.Type(), 
+                aServiceConnInfo.iUsername );
+        }
+
+    // empty password is ok. And check this field should be set
+    if ( aServiceConnInfo.iServiceSelection.iParameter == ECchPassword )
+        {
+        iServer.PluginHandler().SetPasswordL( 
+            aServiceConnInfo.ServiceId(), uids, 
+                aServiceConnInfo.Type(), 
+                aServiceConnInfo.iPassword );
+        }
+    
+    if ( aServiceConnInfo.iServiceSelection.iParameter == ECchReserved )
+        {
+        iReserved = aServiceConnInfo.iReserved;
+        CCHLOGSTRING2( "CCCHServiceInfo::SetConnectionInfoL: reserved no action=%d", iReserved );
+        }
+
+    CleanupStack::PopAndDestroy( &uids );
+    
+    CCHLOGSTRING( "CCCHServiceInfo::SetConnectionInfoL: OUT" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::GetConnectionInfoL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::GetConnectionInfoL( 
+        TServiceConnectionInfo& aServiceConnInfo ) const
+        {
+        CCHLOGSTRING( "CCCHServiceInfo::GetConnectionInfoL: IN" );
+               
+        TUid pluginUid( KNullUid );
+        TInt index( KErrNone );
+               
+        if ( aServiceConnInfo.iServiceSelection.iType != ECCHUnknown )
+            {
+            index = FindSubservice( aServiceConnInfo.iServiceSelection.iType );
+            }
+
+               
+        if ( KErrNotFound != index && iSubservices.Count() )
+            {
+                   
+            pluginUid = iSubservices[ index ]->GetPluginUid();
+
+            if( aServiceConnInfo.iServiceSelection.iParameter == ECchUsername )
+                {
+                const CCCHPluginHandler& ch = iServer.PluginHandler();
+                const TServiceConnectionInfo& css = aServiceConnInfo;
+
+                RBuf buffer; 
+                buffer.CreateL(KCCHMaxProtocolNameLength);
+                iServer.PluginHandler().GetConnectionParameter( 
+                        pluginUid,
+                        css.iServiceSelection, 
+                        buffer );
+
+                aServiceConnInfo.iUsername = buffer;
+                buffer.Close();
+                }
+            else if( aServiceConnInfo.iServiceSelection.iParameter == 
+                                                        ECchReserved )
+                {
+                CCHLOGSTRING2( "CCCHServiceInfo::GetConnectionInfoL: reserved no action=%d", iReserved );
+                aServiceConnInfo.iReserved = iReserved;
+                }
+            else
+                {
+                User::LeaveIfError( iServer.PluginHandler().GetServiceNetworkInfo( 
+                    aServiceConnInfo.ServiceId(), pluginUid, aServiceConnInfo.Type(), 
+                        aServiceConnInfo.iSNAPId, aServiceConnInfo.iIapId, 
+                        aServiceConnInfo.iSNAPLocked, aServiceConnInfo.iPasswordSet ) );                }
+            }
+        else
+            {
+            User::Leave( KErrNotFound );
+            }
+            
+        CCHLOGSTRING( "CCCHServiceInfo::GetConnectionInfoL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::ReserveServiceL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::ReserveServiceL( 
+    const TCCHSubserviceType aServiceType ) 
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::ReserveServiceL: IN" );
+    
+    TUid pluginUid( KNullUid );
+    TInt index( FindSubservice( aServiceType ) );
+    if ( KErrNotFound != index )
+        {
+        pluginUid = iSubservices[ index ]->GetPluginUid();
+        User::LeaveIfError( iServer.PluginHandler().ReserveService( 
+            iServiceId, pluginUid, aServiceType ));
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+        
+    CCHLOGSTRING( "CCCHServiceInfo::ReserveServiceL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::FreeServiceL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::FreeServiceL( 
+    const TCCHSubserviceType aServiceType )
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::FreeServiceL: IN" );
+    
+    TUid pluginUid( KNullUid );
+    TInt index( FindSubservice( aServiceType ) );
+    if ( KErrNotFound != index )
+        {
+        pluginUid = iSubservices[ index ]->GetPluginUid();
+        User::LeaveIfError( iServer.PluginHandler().FreeService( 
+            iServiceId, pluginUid, aServiceType ));
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+        
+    CCHLOGSTRING( "CCCHServiceInfo::FreeServiceL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::IsReservedL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServiceInfo::IsReservedL( 
+    const TCCHSubserviceType aServiceType ) const
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::IsReservedL: IN" );
+    
+    TBool ret(EFalse);
+    TUid pluginUid( KNullUid );
+    TInt index( FindSubservice( aServiceType ) );
+    if ( KErrNotFound != index )
+        {
+        pluginUid = iSubservices[ index ]->GetPluginUid();
+        User::LeaveIfError( ret = iServer.PluginHandler().IsReserved( 
+            iServiceId, pluginUid, aServiceType ));
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+        
+    CCHLOGSTRING( "CCCHServiceInfo::IsReservedL: OUT" );
+    return ret;
+    }         
+                             
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::IsEnabled
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServiceInfo::IsEnabled() const
+    {
+    return iIsEnabled;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::AddSubservice
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::AddSubserviceL( TCCHSubservice& aSubservice )
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::AddSubserviceL: IN" );
+    
+    CCCHSubserviceInfo* subserviceInfo = NULL;
+    if ( ECCHUnknown != aSubservice.iConnectionInfo.iServiceSelection.iType )
+        {
+        // Create new instance and set service id
+        subserviceInfo = 
+            CCCHSubserviceInfo::NewLC( aSubservice.iConnectionInfo.iServiceSelection.iServiceId, iServer );
+        // Set subserviceID
+        subserviceInfo->SetSubserviceId( aSubservice.iSubserviceId );
+        
+        // Get plugin uid from service table
+        TUid pUid( KNullUid );
+        
+        iServer.SPSHandler().GetConnectivityPluginUidL( 
+                aSubservice.iConnectionInfo.iServiceSelection.iServiceId, aSubservice.iConnectionInfo.iServiceSelection.iType, pUid ); 
+        subserviceInfo->SetPluginUid( pUid ); 
+          
+        subserviceInfo->SetState( aSubservice.iState );
+        subserviceInfo->SetType( aSubservice.iConnectionInfo.iServiceSelection.iType );
+        subserviceInfo->SetIapId( aSubservice.iConnectionInfo.iIapId );
+        subserviceInfo->SetSNAPId( aSubservice.iConnectionInfo.iSNAPId );    
+        TBool startupFlag( EFalse );
+        iServer.SPSHandler().LoadAtStartUpL( aSubservice.iConnectionInfo.iServiceSelection.iServiceId,
+             aSubservice.iConnectionInfo.iServiceSelection.iType, startupFlag );
+        subserviceInfo->SetStartupFlag( startupFlag );        
+        // Append pointer to array
+        iSubservices.Append( subserviceInfo );
+        CleanupStack::Pop( subserviceInfo );
+        }
+   
+    CCHLOGSTRING( "CCCHServiceInfo::AddSubserviceL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::UpdateL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::UpdateL( TBool aReadServiceTable )
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::UpdateL: IN" );
+    
+    iIsEnabled = EFalse;
+    if ( aReadServiceTable )
+        {
+        TUint validSubserviceCount( 0 );
+        TInt index( KErrNotFound );
+        TCCHService service;
+        // Read service information from service table
+        iServer.SPSHandler().GetServiceInfoL( iServiceId , service );
+
+        for ( TInt i( 0 ); i < service.iSubservices.Count(); i++ )
+            {            
+            TCCHSubservice subservice = service.iSubservices[ i ];
+            
+            if ( KErrNotFound != ( index = FindSubservice( 
+                subservice.iConnectionInfo.iServiceSelection.iType ) ) )
+                {
+                TBool startupFlag( EFalse );
+                iServer.SPSHandler().LoadAtStartUpL( subservice.iConnectionInfo.iServiceSelection.iServiceId,
+                    subservice.iConnectionInfo.iServiceSelection.iType, startupFlag );
+                iSubservices[ index ]->SetStartupFlag( startupFlag );
+                iSubservices[ index ]->Update();
+                if ( !iIsEnabled )
+                    {
+                    iIsEnabled = iSubservices[ index ]->IsEnabled();
+                    }
+                
+                validSubserviceCount++;
+                }
+            else if ( ECCHUnknown != subservice.iConnectionInfo.iServiceSelection.iType )
+                {
+                AddSubserviceL( subservice );
+                validSubserviceCount++;
+                }
+            else
+                {
+                // do nothing
+                }
+            }
+        
+        // Check that all subservices really exist in service table
+        if ( validSubserviceCount < iSubservices.Count() )
+            {
+            CCHLOGSTRING( "CCCHServiceInfo::UpdateL: check subservices -> need update" );
+        
+            for ( TInt i( 0 ); i < iSubservices.Count(); i++ )
+                {
+                TBool found( EFalse );
+                TCCHSubserviceType type = iSubservices[ i ]->Type();
+                         
+                for ( TInt j( 0 ) ; j < service.iSubservices.Count() && !found ; j++ )
+                    {
+                    CCHLOGSTRING2( "CCCHServiceInfo::UpdateL: type 1=%d", type );
+                    CCHLOGSTRING2( "CCCHServiceInfo::UpdateL: type 2=%d", 
+                        service.iSubservices[ j ].iConnectionInfo.iServiceSelection.iType );
+                
+                    if ( service.iSubservices[ j ].iConnectionInfo.iServiceSelection.iType == type )
+                        {
+                        CCHLOGSTRING( "CCCHServiceInfo::UpdateL: check subservices -> found" );
+                        found = ETrue;
+                        }
+                    }
+                
+                if ( !found )
+                    {
+                    CCHLOGSTRING( "CCCHServiceInfo::UpdateL: remove subservice" );
+                
+                    delete iSubservices[ i ];
+                    iSubservices.Remove( i );
+                    i--;
+                    }              
+                }
+            }
+        }
+    else
+        {
+        for ( TInt i( 0 ); i < iSubservices.Count(); i++ )
+            {
+            iSubservices[ i ]->Update();
+            if ( !iIsEnabled )
+                {
+                iIsEnabled = iSubservices[ i ]->IsEnabled();    
+                }
+            }
+        }
+            
+    CCHLOGSTRING( "CCCHServiceInfo::UpdateL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::SetStateL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+void CCCHServiceInfo::SetStateL( 
+    const TCCHSubserviceType aType, 
+    const TInt aState )
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::SetStateL IN" );
+    
+    TInt index( FindSubservice( aType ) );
+    if ( KErrNotFound != index )
+        {
+        iSubservices[ index ]->SetState( 
+                static_cast<TCCHSubserviceState>( aState ) );
+        }
+    else
+        {
+        User::Leave( index );
+        }       
+
+    // Before we update our clients handle exception error cases
+    HandleErrorExceptions();
+    UpdateL();    
+    CCHLOGSTRING( "CCCHServiceInfo::SetStateL :OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::SetStateL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+void CCCHServiceInfo::SetStateL( 
+    const TUid& aPluginUid, 
+    const TCCHSubserviceState& aState )
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::SetStateL IN" );
+    
+    
+    for ( TInt i( 0 ); i < iSubservices.Count() && 
+        i < KCCHMaxSubservicesCount; i++ )
+        {
+        if( aPluginUid == GetUidL( i ) )
+            {
+            iSubservices[ i ]->SetState( aState );
+            }
+        }
+        
+    UpdateL();    
+    CCHLOGSTRING( "CCCHServiceInfo::SetStateL :OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::SetErrorL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+void CCCHServiceInfo::SetErrorL( 
+    const TCCHSubserviceType aType, 
+    const TInt aError )
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::SetErrorL IN" );
+    
+    TInt index( FindSubservice( aType ) );
+    if ( KErrNotFound != index )
+        {
+        iSubservices[ index ]->SetError( aError );        
+        }
+    else
+        {
+        User::Leave( index );
+        }           
+    CCHLOGSTRING( "CCCHServiceInfo::SetErrorL :OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::SubserviceCount
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceInfo::SubserviceCount() const
+    {
+    return iSubservices.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::GetUidL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TUid CCCHServiceInfo::GetUidL( TInt aSubserviceIndex ) const
+    {
+    if ( aSubserviceIndex > iSubservices.Count() )
+        {
+        User::Leave( KErrNotFound );
+        }
+    return iSubservices[ aSubserviceIndex ]->GetPluginUid();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::FillServiceInfo
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::FillServiceInfo( TCCHService& service )
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::FillServiceInfo: IN" );
+    service.iServiceId = iServiceId;
+    service.iServiceName.Copy( iServiceName );
+    
+    for ( TInt i( 0 ); i < iSubservices.Count() && 
+        i < KCCHMaxSubservicesCount; i++ )
+        {
+        iSubservices[ i ]->FillSubserviceInfo( service.iSubservices.At( i ) );              
+        }
+        
+    CCHLOGSTRING( "CCCHServiceInfo::FillServiceInfo: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::GetStatus
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceInfo::GetStatus( 
+    TCCHSubserviceType aType, TCCHSubserviceState& aState ) const
+    {    
+    TInt error = KErrNone;
+    TInt index( FindSubservice( aType ) );
+    
+    if( index == KErrNotFound )
+        {
+        error = KErrNotFound;
+        }
+    else
+        {
+        aState = iSubservices[ index ]->GetState();
+        }
+        
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::GetState
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TCCHSubserviceState CCCHServiceInfo::GetState() const
+    {    
+    TCCHSubserviceState ret( ECCHUninitialized );
+
+    for ( TInt i( 0 ); i < iSubservices.Count() && !ret; i++ )
+        {
+        if( iSubservices[ i ]->GetState() > ret )
+            {
+            ret = iSubservices[ i ]->GetState();
+            }
+        }
+        
+    CCHLOGSTRING2( "CCCHServiceHandler::GetState: %d", ret );
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::GetError
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceInfo::GetError( 
+    TCCHSubserviceType aType ) const
+    {    
+    TInt index( FindSubservice( aType ) );
+    return ( KErrNotFound != index ) ? iSubservices[ index ]->GetError() :
+        KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::GetServiceInfoL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHServiceInfo::GetServiceInfoL( 
+    TDes& aBuffer,
+    TCCHSubserviceType aType ) const
+    {
+    TUid pluginUid( KNullUid );
+    TInt index( FindSubservice( aType ) );
+    if ( KErrNotFound != index )
+        {
+        pluginUid = iSubservices[ index ]->GetPluginUid();
+        
+        User::LeaveIfError( iServer.PluginHandler().GetServiceInfo( 
+            iServiceId, pluginUid, aType, aBuffer ) );
+        }
+    else
+    	{
+    	User::Leave( KErrNotFound );
+    	}
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::SubserviceExist
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServiceInfo::SubserviceExist( TCCHSubserviceType aType ) const     
+    {
+    // If subservice is specified then check if it really exist.
+    // Otherwise return ETrue
+    return ( ECCHUnknown != aType ) ?  
+        ( ( KErrNotFound != FindSubservice( aType ) ) ? ETrue : EFalse ) :
+        ETrue;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::FindSubservice
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceInfo::FindSubservice( TCCHSubserviceType aType ) const
+    {
+    TInt index( KErrNotFound );
+    TBool exist( EFalse );
+    for ( TInt i( 0 ); i < iSubservices.Count() && 
+            i < KCCHMaxSubservicesCount && !exist; i++ )
+        {
+        exist = iSubservices[ i ]->Type() == aType;
+        index = i;
+        }
+    return !exist ? KErrNotFound : index;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::StartupFlagSet
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHServiceInfo::StartupFlagSet() const
+    {
+    TBool ret( EFalse );
+    for ( TInt i( 0 ); i < iSubservices.Count() && !ret; i++ )
+        {
+        ret = iSubservices[ i ]->GetStartUpFlag(); 
+        }
+    CCHLOGSTRING2( "CCCHServiceInfo::StartupFlagSet: %d", ret );        
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::StartupFlagSet
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TBool CCCHServiceInfo::StartupFlagSet( TInt aSubserviceIndex ) const
+    {
+    return aSubserviceIndex > iSubservices.Count() ? EFalse :
+        iSubservices[ aSubserviceIndex ]->GetStartUpFlag();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::SetStartupFlag
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHServiceInfo::SetStartupFlag(
+    TCCHSubserviceType aType,
+    TBool aLoadAtStartUp ) const
+    {
+    TInt exist( KErrNotFound );
+    for ( TInt i( 0 ); i < iSubservices.Count() && 
+            i < KCCHMaxSubservicesCount; i++ )
+        {
+        if ( iSubservices[ i ]->Type() == aType )
+            {
+            iSubservices[ i ]->SetStartupFlag( aLoadAtStartUp );
+            exist = KErrNone;
+            break;
+            }
+        }
+    return exist;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::GetSubserviceType
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TCCHSubserviceType CCCHServiceInfo::GetSubserviceType( 
+    TInt aSubserviceIndex ) const
+    {
+    return aSubserviceIndex > iSubservices.Count() ? ECCHUnknown :
+        iSubservices[ aSubserviceIndex ]->Type();
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::GetSubserviceL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+CCCHSubserviceInfo& CCCHServiceInfo::GetSubserviceL( 
+    TCCHSubserviceType aType ) const
+    {
+    TInt index( FindSubservice( aType ) );
+    if ( KErrNotFound == index )
+        {
+        User::Leave( index );
+        }
+        
+    return *iSubservices[ index ];
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHServiceInfo::HandleErrorExceptions
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+void CCCHServiceInfo::HandleErrorExceptions()
+    {
+    CCHLOGSTRING( "CCCHServiceInfo::HandleErrorExceptions IN" );
+    
+    for ( TInt i( 0 ); i < iSubservices.Count(); i++ )
+        {
+        switch ( iSubservices[ i ]->GetError() )
+            {
+            
+            // KErrCancel caused by CSIPProfileRegistry::ErrorOccurred(-3)
+            // User has canceled connecting dialog and we have to remove
+            // service from the load at startup list.
+            // At last make sure that unnecessary wlan scan is OFF
+            case KErrCancel:
+                {
+                TRAP_IGNORE( iServer.SPSHandler().SetLoadAtStartUpL( 
+                    iServiceId, iSubservices[ i ]->Type(), EFalse ) );
+                iServer.ServiceHandler().DisableWlanScan();
+                }
+                break;
+                
+            default:
+                break;
+            }
+        
+        }
+     
+    CCHLOGSTRING( "CCCHServiceInfo::HandleErrorExceptions :OUT" );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchsession.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,209 @@
+/*
+* 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:  CCCHSession implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchlogger.h"
+#include "cchsession.h"
+#include "cchserverbase.h"
+#include "cchsubsession.h"
+#include "cchclientserverinternal.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHSession::CCCHSession
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHSession::CCCHSession( CCCHServerBase& aServer ) :
+    CSession2(),
+    iCCHServer( aServer )
+    {
+    TRAP_IGNORE( iCCHServer.NotifySessionCreatedL() );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSession::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCCHSession::ConstructL()
+    {
+    iSubsessions = iCCHServer.ObjectContainerIx().CreateL();
+    iObjectIx = CObjectIx::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSession::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHSession* CCCHSession::NewL( CCCHServerBase& aServer )
+    {
+    CCCHSession* self = CCCHSession::NewLC( aServer );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSession::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHSession* CCCHSession::NewLC( CCCHServerBase& aServer )
+    {
+    CCCHSession* self = new (ELeave) CCCHSession( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// Destructor
+CCCHSession::~CCCHSession()
+    {   
+    delete iObjectIx;
+    iObjectIx = NULL;   
+
+    iCCHServer.ObjectContainerIx().Remove( iSubsessions );
+    iCCHServer.NotifySessionClosed(); 
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSession::ServiceL
+// Handles request received from client.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSession::ServiceL( const RMessage2& aMessage )
+    {
+    CCHLOGSTRING( "CCCHSession::ServiceL: IN" );
+    TInt command = aMessage.Function();
+    switch ( command )
+        {
+        case ECCHOpenSubSession:
+            {
+            CCCHSubsession* subsession = CCCHSubsession::NewLC( iCCHServer );
+            iSubsessions->AddL( subsession );
+            const TInt handle( iObjectIx->AddL( subsession ) );
+            CleanupStack::Pop( subsession );
+            TPckg<TInt> handlePckg( handle );
+            TInt err = aMessage.Write( 3, handlePckg ); 
+         
+            if ( KErrNone != err )
+                {
+                // Panic client
+                iObjectIx->Remove( handle );
+                iCCHServer.PanicClient( aMessage, ECCHErrSubSessionOpen );   
+                }
+            else   
+                {
+                aMessage.Complete( KErrNone );
+                }
+            }
+            break;
+        case ECCHCloseSubSession:
+            {
+            const TInt handle( aMessage.Int3() );
+            if ( iObjectIx->At( handle ) )
+                {
+                iObjectIx->Remove( handle );
+                aMessage.Complete( KErrNone );
+                }
+            else
+                {
+                // Panic client. Handle was not valid
+                iCCHServer.PanicClient( aMessage, ECCHErrSubSessionClose );
+                }
+            }
+            break;
+        /**
+         * CCH subsession functions
+         */
+        case ECCHSubscribeToEvents:
+        case ECCHSubscribeToEventsCancel:
+        case ECCHGetServices:
+        case ECCHGetServicesCancel:
+        case ECCHGetServiceState:
+        case ECCHEnableService:
+        case ECCHEnableServiceCancel:
+        case ECCHDisableService:
+        case ECCHDisableServiceCancel:
+        case ECCHGetServiceInfo:
+        case ECCHGetPreferredService:
+        case ECCHSetConnectionInfo:
+        case ECCHSetConnectionInfoCancel:
+        case ECCHGetConnectionInfo:
+        case ECCHGetConnectionInfoCancel:
+        case ECCHReserveService:
+        case ECCHFreeService:
+        case ECCHIsReserved:
+        case ECCHServiceCount:
+        case ECCHServerRegister:
+        case ECCHServerRegisterCancel:
+            {
+            CCCHSubsession* subsession = static_cast<CCCHSubsession*>(
+                iObjectIx->At( aMessage.Int3() ) );
+            if ( subsession )
+                {
+                subsession->ServiceL( aMessage );
+                }
+            else
+                {
+                // Panic client.
+                iCCHServer.PanicClient( aMessage, ECCHBadDescriptor );
+                }
+            }
+            break;
+        default:
+            {
+            iCCHServer.PanicClient( aMessage, ECCHBadRequest );
+            }
+
+        }
+    CCHLOGSTRING( "CCCHSession::ServiceL: OUT" );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchspshandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,508 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CCCHSPSHandler implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <spsettings.h>
+#include <spentry.h>
+#include <spproperty.h>
+
+#include "cchspshandler.h"
+#include "cchlogger.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::CCCHSPSHandler
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHSPSHandler::CCCHSPSHandler( CCCHServerBase& aServer ):
+    iServer( aServer )
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCCHSPSHandler::ConstructL()
+    {
+    iSettings = CSPSettings::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHSPSHandler* CCCHSPSHandler::NewL( CCCHServerBase& aServer )
+    {
+    CCCHSPSHandler* self = CCCHSPSHandler::NewLC( aServer );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHSPSHandler* CCCHSPSHandler::NewLC( CCCHServerBase& aServer )
+    {
+    CCCHSPSHandler* self = new (ELeave) CCCHSPSHandler( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// Destructor
+CCCHSPSHandler::~CCCHSPSHandler()
+    {
+    delete iSettings;
+    iSettings = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::GetServicesCountL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CCCHSPSHandler::GetServicesCountL() const
+    {
+    CCHLOGSTRING2( "CCCHSPSHandler::GetServicesCountL : %d", 
+        iSettings->SettingsCountL() );
+            
+    return iSettings->SettingsCountL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::GetServiceIdsL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSPSHandler::GetServiceIdsL( RArray<TUint>& aServiceIds ) const
+    {
+    CCHLOGSTRING( "CCCHSPSHandler::GetServiceIdsL: IN" );
+    
+    TRAP_IGNORE( iSettings->FindServiceIdsL( aServiceIds ) );
+    
+    CCHLOGSTRING2
+        ( "CCCHSPSHandler::GetServiceIdsL: OUT: %d", aServiceIds.Count() );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::GetServiceInfoL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSPSHandler::GetServiceInfoL( const TUint32 aServiceId, 
+    TCCHService& aService ) const
+    {
+    CCHLOGSTRING( "CCCHSPSHandler::GetServiceInfoL: IN" );
+    
+    aService.iSubservices.Reset();
+    
+    // Get entry
+    TInt err( KErrNone );
+    CSPEntry* entry = CSPEntry::NewLC();
+    err = iSettings->FindEntryL( aServiceId, *entry );
+    
+    if ( KErrNone == err )
+        {
+        // Read service id and service name
+        aService.iServiceId = aServiceId;
+        RBuf buf;
+        CleanupClosePushL( buf );
+        buf.CreateL( entry->GetServiceName(), KCCHMaxServiceNameLength );
+        aService.iServiceName.Copy( buf );
+        CleanupStack::PopAndDestroy( &buf );
+        
+        // Check which subservices are supported
+        RPropertyNameArray propertyNameArray;
+        CleanupClosePushL( propertyNameArray );
+        propertyNameArray.AppendL( EPropertyVoIPSubServicePluginId );
+        propertyNameArray.AppendL( EPropertyPresenceSubServicePluginId );
+        propertyNameArray.AppendL( EPropertyIMSubServicePluginId );
+        propertyNameArray.AppendL( EPropertyVMBXSubServicePluginId );
+        
+        for ( TInt i( 0 ) ; i < propertyNameArray.Count() ; i++ )
+            {
+            CSPProperty* property = CSPProperty::NewLC();
+        
+            err = iSettings->FindPropertyL( 
+                aServiceId,
+                propertyNameArray[ i ],
+                *property );
+            
+            if ( !err && ValidSubserviceL( aServiceId, propertyNameArray[ i ] ) )
+                {
+                TCCHSubserviceType type = ECCHUnknown;        
+                switch ( propertyNameArray[ i ] )
+                    {
+                    case EPropertyVoIPSubServicePluginId:
+                        {
+                        type = ECCHVoIPSub;
+                        }
+                        break;
+                    case EPropertyPresenceSubServicePluginId:
+                        {
+                        type = ECCHPresenceSub;
+                        }
+                        break;
+                    case EPropertyIMSubServicePluginId:
+                        {
+                        type = ECCHIMSub;
+                        }
+                        break;
+                    case EPropertyVMBXSubServicePluginId:
+                        {
+                        type = ECCHVMBxSub;
+                        }
+                        break;
+                    default:
+                        {
+                        type = ECCHUnknown;
+                        break;
+                        }
+                    }
+            
+                CCHLOGSTRING2( "CCCHSPSHandler::GetServiceInfoL: subservice type=%d", type );
+                
+                aService.iSubservices[ i ].iConnectionInfo.iServiceSelection.iType = type;
+                aService.iSubservices[ i ].iConnectionInfo.iServiceSelection.iServiceId = aServiceId;
+                
+                // These are just initialized here. Correct values are got from connectivity plugin
+                aService.iSubservices[ i ].iState = ECCHUninitialized;
+                aService.iSubservices[ i ].iSubserviceId = KErrNone;
+                aService.iSubservices[ i ].iConnectionInfo.iSNAPId = KErrNone;
+                aService.iSubservices[ i ].iConnectionInfo.iIapId = KErrNone;
+                aService.iSubservices[ i ].iConnectionInfo.iSNAPLocked = EFalse;
+                }
+        
+            CleanupStack::PopAndDestroy( property );
+            }
+        
+        CleanupStack::PopAndDestroy( &propertyNameArray );
+        }
+    else
+        {
+        CCHLOGSTRING2( "CCCHSPSHandler::GetServiceInfoL: error getting entry err=%d", err );
+        User::Leave( err );
+        }
+            
+    CleanupStack::PopAndDestroy( entry );
+    
+    CCHLOGSTRING( "CCCHSPSHandler::GetServiceInfoL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::GetConnectivityPluginUidL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSPSHandler::GetConnectivityPluginUidL( TUint32 aServiceId,
+    TCCHSubserviceType aType, 
+    TUid& aUid ) const
+    {
+    CCHLOGSTRING( "CCCHSPSHandler::GetConnectivityPluginUidL: IN" );
+    CCHLOGSTRING2( "CCCHSPSHandler::GetConnectivityPluginUidL: aServiceId %d",
+        aServiceId );
+    CCHLOGSTRING2( "CCCHSPSHandler::GetConnectivityPluginUidL: aType %d",
+        aType );
+        
+    TInt pUid( 0 );
+    TInt error( KErrNone );
+    TServicePropertyName propertyType( EPropertyUnknown ); 
+    
+    switch( aType )
+        {        
+        case ECCHVoIPSub:
+            {
+            propertyType = EPropertyVoIPSubServicePluginId;
+            }
+            break;
+        case ECCHPresenceSub:
+            {
+            propertyType = EPropertyPresenceSubServicePluginId;
+            }
+            break;
+        case ECCHIMSub:
+            {
+            propertyType = EPropertyIMSubServicePluginId;
+            }
+            break;
+        case ECCHVMBxSub:
+            {
+            propertyType = EPropertyVMBXSubServicePluginId;
+            }
+            break;
+        default:
+            error = KErrNotFound;
+            break;
+        }
+   
+    if ( KErrNone == error )
+        {
+        CSPProperty* property = CSPProperty::NewLC();
+        error = iSettings->FindPropertyL( aServiceId, 
+            propertyType, *property );
+            
+        if ( KErrNone == error )
+            {
+            property->GetValue( pUid );
+            // Convert TUint32 to TUid
+            aUid = TUid::Uid( pUid );
+            }
+        else
+            {
+            CCHLOGSTRING2( "CCH: iSettings->FindPropertyL err: %d" , error );
+            User::Leave( error );
+            }
+        CleanupStack::PopAndDestroy( property );
+        }
+        
+    CCHLOGSTRING2( 
+        "CCCHSPSHandler::GetConnectivityPluginUidL: aUid 0x%X", aUid );   
+    }
+        
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::LoadAtStartUpL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSPSHandler::LoadAtStartUpL( TUint32 aServiceId,
+    TCCHSubserviceType aType,
+    TBool& aEnabled ) const
+    {
+    CCHLOGSTRING2( "CCCHSPSHandler::LoadAtStartUpL: aType %d", aType );   
+    
+    
+    TSPItemType propertyType( EItemTypeNotDefined );
+    TServicePropertyName propertyName( EPropertyUnknown );
+    RPropertyArray subproperties;
+    CleanupClosePushL( subproperties );
+    
+    ChangeToPropertyStyleL( aType, propertyType, propertyName );
+           
+    // Find correct subservice
+    TInt err( iSettings->FindSubServicePropertiesL( 
+        aServiceId, propertyType, subproperties ) );
+    CCHLOGSTRING2( "CCH: iSettings->FindSubServicePropertiesL err: %d" , err );
+    for ( TInt i( 0 ); i < subproperties.Count(); i++ )
+        {
+        // Read subservice's On/Off information 
+        if ( propertyName == subproperties[ i ]->GetName() )
+            {
+            TOnOff onOff( EOONotSet );                
+            subproperties[ i ]->GetValue( onOff );
+            aEnabled = onOff == EOn;
+            i = subproperties.Count();               
+            }
+        }    
+    subproperties.ResetAndDestroy( );
+    CleanupStack::PopAndDestroy( &subproperties );
+    
+    CCHLOGSTRING2( "CCCHSPSHandler::LoadAtStartUpL: aEnabled %d", aEnabled );  
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::SetLoadAtStartUpL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSPSHandler::SetLoadAtStartUpL( const TUint32 aServiceId,
+    const TCCHSubserviceType aType,
+    const TBool aOnOff ) const
+    {
+    CCHLOGSTRING2( "CCCHSPSHandler::SetLoadAtStartUpL: aType %d", aType );      
+    CCHLOGSTRING2( "CCCHSPSHandler::SetLoadAtStartUpL: aOnOff %d", aOnOff );   
+    TSPItemType propertyType( EItemTypeNotDefined );
+    TServicePropertyName propertyName( EPropertyUnknown );
+    RPropertyArray subproperties;
+    CleanupClosePushL( subproperties );
+    
+    TOnOff onOff( EOONotSet );
+    onOff = aOnOff ? EOn : EOff;
+    
+    // Get property name
+    ChangeToPropertyStyleL( aType, propertyType, propertyName );
+   
+    CSPProperty* propLoadAtStartUp = CSPProperty::NewLC();
+    
+    propLoadAtStartUp->SetName( propertyName );
+    propLoadAtStartUp->SetValue( onOff );
+    
+    subproperties.Append( propLoadAtStartUp );
+    CleanupStack::Pop( propLoadAtStartUp );
+    TInt err( iSettings->AddOrUpdatePropertiesL( aServiceId, subproperties ) );
+    CCHLOGSTRING2( "CCH: iSettings->AddOrUpdatePropertiesL err: %d" , err );
+    subproperties.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &subproperties );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::ChangeToPropertyStyleL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSPSHandler::ChangeToPropertyStyleL( 
+    TCCHSubserviceType aType,
+    TSPItemType& aPropertyType,
+    TServicePropertyName& aPropertyName ) const
+    {
+    switch( aType )
+        {
+        case ECCHVoIPSub:
+            {
+            aPropertyType = EItemTypeVoIPSubProperty;
+            aPropertyName = ESubPropertyVoIPEnabled;
+            }
+            break;
+        case ECCHPresenceSub:
+            {
+            aPropertyType = EItemTypePresenceSubProperty;
+            aPropertyName = ESubPropertyPresenceEnabled;
+            }
+            break;
+        case ECCHIMSub:
+            {            
+            aPropertyType = EItemTypeIMSubProperty;
+            aPropertyName = ESubPropertyIMEnabled;
+            }
+            break;
+        case ECCHVMBxSub:
+            {
+            aPropertyType = EItemTypeVMBXSubProperty;
+            aPropertyName = ESubPropertyVMBXEnabled;
+            }
+            break;
+        default:
+            {
+            User::Leave( KErrNotFound );
+            }            
+            break;
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSPSHandler::ValidSubserviceL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHSPSHandler::ValidSubserviceL( 
+    const TUint32 aServiceId,
+    TServicePropertyName aPropertyName ) const
+    {
+    CCHLOGSTRING2
+        ( "CCCHSPSHandler::ValidSubservice aServiceId: %d" , aServiceId );
+        
+    TBool valid( EFalse );
+    TInt propertyId( KErrNone );
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    
+    switch( aPropertyName )
+        {
+        case EPropertyVoIPSubServicePluginId:
+            {
+            CCHLOGSTRING( "Subservice: EPropertyVoIPSubServicePluginId" );
+            
+            // Until further notice VoIP property is always valid
+            valid = ETrue;
+            break;
+            }
+        case EPropertyPresenceSubServicePluginId:
+            {
+            CCHLOGSTRING( "Subservice: EPropertyPresenceSubServicePluginId" );
+            
+            valid = KErrNone != iSettings->FindPropertyL( aServiceId, 
+                ESubPropertyPresenceSettingsId, *property ) ? EFalse :
+                    KErrNone == property->GetValue( propertyId );
+                                
+            CCHLOGSTRING2( "CCH:     property id: %d" , propertyId );
+            break;
+            }
+        case EPropertyIMSubServicePluginId:
+            {
+            CCHLOGSTRING( "Subservice: EPropertyIMSubServicePluginId" );
+            
+            valid = KErrNone != iSettings->FindPropertyL( aServiceId, 
+                ESubPropertyIMSettingsId, *property ) ? EFalse :
+                    KErrNone == property->GetValue( propertyId );
+            
+            CCHLOGSTRING2( "CCH:     property id: %d" , propertyId );
+            break;
+            }
+        case EPropertyVMBXSubServicePluginId:
+            {
+            CCHLOGSTRING( "Subservice: EPropertyVMBXSubServicePluginId" );
+            
+            valid = KErrNone != iSettings->FindPropertyL( aServiceId, 
+                ESubPropertyVMBXSettingsId, *property ) ? EFalse :
+                    KErrNone == property->GetValue( propertyId );
+            
+            CCHLOGSTRING2( "CCH:     property id: %d" , propertyId );
+            break;
+            }
+        default:
+            {
+            // Let other properties go through
+            valid = EFalse;
+            break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( property );
+    
+    CCHLOGSTRING2
+        ( "CCCHSPSHandler::ValidSubservice valid: %d" , valid );
+                    
+    return valid;        
+    }
+        
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchstartupcounter.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  CCchStartupCounter implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchlogger.h"
+#include "cchstartupcounter.h"
+#include "cchserverbase.h"
+#include "cchspshandler.h"
+#include "cchservicehandler.h"
+#include "cchprivatecrkeys.h"
+#include <centralrepository.h>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// Some critical process has crashed three times during startup registration
+// to avoid bootlock situation set startup flag to OFF after max count
+const TInt KCCHMaxStartupCount = 3;
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCchStartupCounter::CCchStartupCounter
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCchStartupCounter::CCchStartupCounter( CCCHServerBase& aServer ) 
+    : iServer( aServer )
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CCchStartupCounter::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCchStartupCounter::ConstructL()
+    {
+    iStartupRepository = CRepository::NewL( KCRUidCch );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchStartupCounter::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchStartupCounter* CCchStartupCounter::NewL( CCCHServerBase& aServer )
+    {
+    CCchStartupCounter* self = new (ELeave) CCchStartupCounter( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// Destructor
+CCchStartupCounter::~CCchStartupCounter()
+    {
+    delete iStartupRepository;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCchStartupCounter::StartupOccuredL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCchStartupCounter::StartupOccuredL()
+    {
+    CCHLOGSTRING( "CCchStartupCounter::StartupOccuredL IN" );
+    
+    TInt startupCounter( KErrNone );
+    User::LeaveIfError( iStartupRepository->Get( 
+        KCCHStartupCounter, startupCounter ) );
+            
+    startupCounter++;
+    CCHLOGSTRING2( 
+        "CCchStartupCounter -> startup counter: %d", startupCounter );
+            
+    if ( startupCounter >= KCCHMaxStartupCount )
+        {
+        CCHLOGSTRING( "CCchStartupCounter -> set startup flag to OFF" );
+        // Some critical process has crashed three times during startup registration..
+        startupCounter = 0;
+        // ..to avoid bootlock situation set startup flag to OFF
+        HandleStartupExceptionsL(); 
+        }
+            
+    User::LeaveIfError( iStartupRepository->Set( 
+        KCCHStartupCounter, startupCounter ) );
+                        
+    CCHLOGSTRING( "CCchStartupCounter::StartupOccuredL OUT" );
+    }
+      
+// ---------------------------------------------------------------------------
+// CCchStartupCounter::HandleStartupExceptionsL
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCchStartupCounter::HandleStartupExceptionsL()
+    {
+    CCHLOGSTRING( "CCchStartupCounter::HandleStartupExceptionsL IN" );
+    
+    RArray<TUint> serviceIds;
+    CleanupClosePushL( serviceIds );
+    RArray<TCCHSubserviceType> subserviceTypes;
+    CleanupClosePushL( subserviceTypes );
+                
+    iServer.SPSHandler().GetServiceIdsL( serviceIds );
+    for ( TInt i( 0 ); i < serviceIds.Count(); i++ )
+        {
+        iServer.ServiceHandler().GetSubserviceTypesL( 
+            serviceIds[ i ], subserviceTypes );
+            
+        for ( TInt j( 0 ); j < subserviceTypes.Count(); j++ )
+            {
+            iServer.ServiceHandler().SetStartupFlag( TServiceSelection( 
+                serviceIds[ i ], subserviceTypes[ j ] ), EFalse );
+            iServer.SPSHandler().SetLoadAtStartUpL(
+                serviceIds[ i ], subserviceTypes[ j ], EFalse );
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &subserviceTypes );
+    CleanupStack::PopAndDestroy( &serviceIds ); 
+            
+    CCHLOGSTRING( "CCchStartupCounter::HandleStartupExceptionsL OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchStartupCounter::ResetStartupCounter
+// 
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCchStartupCounter::ResetStartupCounter()
+    {
+    CCHLOGSTRING( "CCchStartupCounter::ResetStartupCounter IN" );
+    
+    iStartupRepository->Set( 
+        KCCHStartupCounter, KErrNone );
+    
+    CCHLOGSTRING( "CCchStartupCounter::ResetStartupCounter OUT" );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchsubserviceinfo.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  CCCHSubserviceInfo implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchsubserviceinfo.h"
+#include "cchserverbase.h"
+#include "cchrequeststorage.h"
+#include "cchpluginhandler.h"
+#include "cchlogger.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::CCCHSubserviceInfo
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHSubserviceInfo::CCCHSubserviceInfo( 
+    TUint aServiceId, 
+    CCCHServerBase& aServer ):
+    iServiceId( aServiceId ),
+    iServer( aServer ),    
+    iEnableAtStartUp( EFalse )
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHSubserviceInfo* CCCHSubserviceInfo::NewL( 
+    TUint aServiceId, 
+    CCCHServerBase& aServer )
+    {
+    CCCHSubserviceInfo* self = CCCHSubserviceInfo::NewLC( aServiceId, aServer );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHSubserviceInfo* CCCHSubserviceInfo::NewLC( 
+    TUint aServiceId, 
+    CCCHServerBase& aServer )
+    {
+    CCCHSubserviceInfo* self = 
+        new (ELeave) CCCHSubserviceInfo( aServiceId, aServer );
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// Destructor
+CCCHSubserviceInfo::~CCCHSubserviceInfo()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::SetSubserviceId
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSubserviceInfo::SetSubserviceId( const TUint aSubserviceId )
+    {
+    iSubserviceId = aSubserviceId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::SetPluginUid
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSubserviceInfo::SetPluginUid( const TUid aPluginUid )
+    {
+    CCHLOGSTRING2( "CCCHSubserviceInfo::SetPluginUid aPluginUid = 0x%X", 
+        aPluginUid );
+    iPluginUid = aPluginUid;    
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::SetPluginUid
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TUid CCCHSubserviceInfo::GetPluginUid() const
+    {
+    return iPluginUid;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::SetType
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSubserviceInfo::SetType( const TCCHSubserviceType aType )
+    {
+    iType = aType;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::GetType
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TCCHSubserviceType CCCHSubserviceInfo::Type()
+    { 
+	return iType;
+	}
+    
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::SetState
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSubserviceInfo::SetState( const TCCHSubserviceState aState )
+    {
+    CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: iPreviousState = %d", 
+        iState );
+    CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: new state = %d", 
+        aState );
+    CCHLOGSTRING2( "CCCHSubserviceInfo::SetState: new state = %d", 
+        Type() );
+    iPreviousState = iState;
+    iState = aState;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::SetError
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSubserviceInfo::SetError( const TInt aError )
+    {
+    iError = aError;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::SetIapId
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSubserviceInfo::SetIapId( const TUint32 aIapId )
+    {
+    iIapId = aIapId;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::SetSNAPId
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSubserviceInfo::SetSNAPId( const TUint32 aSNAPid )
+    {
+    iSNAPId = aSNAPid;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::Update
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSubserviceInfo::Update()
+    {
+    CCHLOGSTRING( "CCCHSubserviceInfo::Update: IN" );
+
+    // Read state from plugin
+    GetServiceNetworkInfo();
+    
+    StatusChanged();
+        
+    CCHLOGSTRING( "CCCHSubserviceInfo::Update: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::IsEnabled
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TBool CCCHSubserviceInfo::IsEnabled() const
+    {
+    return ( iState != ECCHUninitialized && iState != ECCHDisabled );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::StatusChangedL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+void CCCHSubserviceInfo::StatusChanged()
+    {
+    CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: IN" );
+    CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iServiceId %d", 
+        iServiceId );
+    CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iType %d", 
+        iType );
+    CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iState %d", 
+        iState );
+    CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iPreviousState %d", 
+        iPreviousState );
+    CCHLOGSTRING2( "CCCHSubserviceInfo::StatusChangedL: iError %d", 
+        iError );
+    
+    if( iPreviousState == ECCHUninitialized && iState == ECCHDisabled )
+        {
+        CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: Status not notified" );
+        }
+    else 
+        {
+        if ( iPreviousState == ECCHDisconnecting && iState == ECCHDisabled )
+            {
+            iPreviousState = ECCHUninitialized;
+            }
+        CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: Notify new status" );
+        TServiceStatus serviceStatus;
+        serviceStatus.iConnectionInfo.iServiceSelection.iServiceId = iServiceId;
+        serviceStatus.iConnectionInfo.iServiceSelection.iType      = iType;
+        serviceStatus.iConnectionInfo.iIapId                       = iIapId;
+        serviceStatus.iConnectionInfo.iSNAPId                      = iSNAPId; 
+        serviceStatus.iConnectionInfo.iSNAPLocked                  = iSNAPLocked; 
+        serviceStatus.iState                                       = iState;
+        serviceStatus.iError                                       = iError;
+        
+        // Send notify to clients
+        iServer.RequestStorage().NotifyServiceStatesChange( serviceStatus );
+        }
+    CCHLOGSTRING( "CCCHSubserviceInfo::StatusChangedL: OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::GetServiceNetworkInfo
+// ---------------------------------------------------------------------------
+//   
+void CCCHSubserviceInfo::GetServiceNetworkInfo( )
+    {
+    iServer.PluginHandler().GetServiceNetworkInfo( iServiceId, iPluginUid,
+            iType, iSNAPId, iIapId, iSNAPLocked, iPasswordSet );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::FillSubserviceInfo
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+void CCCHSubserviceInfo::FillSubserviceInfo( TCCHSubservice& aSubservice )
+    {
+    CCHLOGSTRING( "CCCHSubserviceInfo::FillSubserviceInfo: IN" );
+    GetServiceNetworkInfo();
+
+    aSubservice.iConnectionInfo.iServiceSelection.iServiceId    = iServiceId;
+    aSubservice.iConnectionInfo.iServiceSelection.iType         = iType;
+    aSubservice.iConnectionInfo.iIapId                          = iIapId;
+    aSubservice.iConnectionInfo.iSNAPId                         = iSNAPId;
+    aSubservice.iConnectionInfo.iSNAPLocked                     = iSNAPLocked;
+    aSubservice.iSubserviceId                                   = iSubserviceId;
+    aSubservice.iState                                          = iState;
+    aSubservice.iError                                          = iError;
+    CCHLOGSTRING( "CCCHSubserviceInfo::FillSubserviceInfo: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::GetState
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TCCHSubserviceState CCCHSubserviceInfo::GetState()
+    {
+    CCHLOGSTRING( "CCCHSubserviceInfo::GetState: IN" );
+    iServer.PluginHandler().GetServiceState( iServiceId, iPluginUid, 
+            iType, iState, iError );
+    return iState;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::GetError
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//    
+TInt CCCHSubserviceInfo::GetError()
+    {
+    CCHLOGSTRING( "CCCHSubserviceInfo::GetError: IN" );
+    iServer.PluginHandler().GetServiceState( iServiceId, iPluginUid, 
+            iType, iState, iError );
+    return iError;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::SetStartupFlag
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+// 
+void CCCHSubserviceInfo::SetStartupFlag( TBool aLoadAtStartUp )
+    {
+    iEnableAtStartUp = aLoadAtStartUp;
+    }
+    
+// ---------------------------------------------------------------------------
+// CCCHSubserviceInfo::GetStartUpFlag
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//     
+TBool CCCHSubserviceInfo::GetStartUpFlag() const
+    {
+    return iEnableAtStartUp;
+    }
+    
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchsubsession.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,398 @@
+/*
+* 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:  CCCHSubsession implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <cchclientserver.h>
+
+#include "cchlogger.h"
+#include "cchsubsession.h"
+#include "cchserverbase.h"
+#include "cchrequeststorage.h"
+#include "cchpluginhandler.h"
+#include "cchservicehandler.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHSubsession::CCCHSubsession
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCCHSubsession::CCCHSubsession( CCCHServerBase& aServer ) :
+    iServer( aServer ),
+    iMessage( NULL ),
+    iQueueEvents( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubsession::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHSubsession* CCCHSubsession::NewL( CCCHServerBase& aServer )
+    {
+    CCCHSubsession* self = CCCHSubsession::NewLC( aServer );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubsession::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCCHSubsession* CCCHSubsession::NewLC( CCCHServerBase& aServer )
+    {
+    CCCHSubsession* self = new (ELeave)CCCHSubsession( aServer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// Destructor
+CCCHSubsession::~CCCHSubsession()
+    {
+    iServer.RequestStorage().RemoveRequestsBySession( this );
+    iServer.RequestStorage().RemoveSession( this );
+    iEventQueue.Close();
+ 
+    delete iRegisterMessage;
+    delete iMessage;            
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCCHSubsession::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CCCHSubsession::ConstructL(  )
+    {
+    CCHLOGSTRING( "CCCHSubsession::ConstructL: IN" );
+    
+    iServer.RequestStorage().AddSession( this );
+    
+    CCHLOGSTRING( "CCCHSubsession::ConstructL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubsession::ServiceEventOccured
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSubsession::ServiceEventOccured(
+    TServiceStatus aNewStatus )
+    {
+    CCHLOGSTRING( "CCCHSubsession::ServiceEventOccured: IN" );
+    //if are we queuing
+    if( iQueueEvents )
+        {
+        //check if we can accept this event
+        if ( 0 == iSubscribedService.iServiceId ||        // all services
+        		iSubscribedService.iServiceId == aNewStatus.ServiceId() )  // specified service
+            {
+            if ( iSubscribedService.iType == ECCHUnknown ||   
+            		iSubscribedService.iType == aNewStatus.Type() )        // subservice specified
+                {
+                iEventQueue.Append( aNewStatus );
+                CompleteMessage( );
+                }
+            }
+        }
+    
+    CCHLOGSTRING( "CCCHSubsession::ServiceEventOccured: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCCHSubsession::CompleteMessage
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSubsession::CompleteMessage( )
+    {
+    CCHLOGSTRING( "CCCHSubsession::CompleteMessage: IN" );
+    //if there is pending SubscribeToEvents and we have something in queue
+    if( iMessage && 0 < iEventQueue.Count() )
+        {
+        TInt error( KErrNone );
+        TPckgBuf<TServiceStatus> serviceStatus;
+        
+        // while we append to queue, we consume from the start (fifo)
+        serviceStatus() = iEventQueue[ 0 ];   
+        CCHLOGSTRING2( "CCCHSubsession::CompleteMessage: type  : %d", serviceStatus().Type() );
+        CCHLOGSTRING2( "CCCHSubsession::CompleteMessage: state : %d", serviceStatus().iState );
+        // Write status to IPC message
+        TRAP( error, iMessage->WriteL( 2, serviceStatus ) );    
+        
+        //complete & delete message 
+        iMessage->Complete( error );
+        delete iMessage;
+        iMessage = NULL;
+        
+        // Remove consumed event from queue
+        iEventQueue.Remove( 0 );
+        }
+    CCHLOGSTRING( "CCCHSubsession::CompleteMessage: OUT" );
+    } 
+       
+// ---------------------------------------------------------------------------
+// CCCHSubsession::ServiceL
+// Handles request received from client.
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCCHSubsession::ServiceL( const RMessage2& aMessage )
+    {
+    CCHLOGSTRING( "CCCHSubsession::ServiceL: IN" );
+    TInt command = aMessage.Function();
+    switch ( command )
+        {
+        case ECCHServerRegister:
+            {
+            if( !iRegisterMessage )
+                {
+                iRegisterMessage = new (ELeave) RMessage2( aMessage );
+                }
+            
+            break;
+            }
+            
+        case ECCHServerRegisterCancel:
+            {
+            if( iRegisterMessage )
+                {
+                iRegisterMessage->Complete( KErrCancel );
+                delete iRegisterMessage;
+                iRegisterMessage = NULL;
+                }
+            aMessage.Complete( KErrNone );
+            break;
+            }
+        case ECCHSubscribeToEvents:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHSubscribeToEvents" );
+            iMessage = new (ELeave) RMessage2( aMessage );
+            //set the service (or set of services) we are interested in
+            iSubscribedService.iServiceId = iMessage->Int0();
+            iSubscribedService.iType = static_cast<TCCHSubserviceType>(
+                                                    iMessage->Int1() );
+            //start queuing
+            iQueueEvents = ETrue;
+            //try to complete message
+            CompleteMessage( );
+            }
+            break;
+        case ECCHSubscribeToEventsCancel:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHSubscribeToEventsCancel" );
+            //if ECCHSubscribeToEvents request is pending, complete & delete it
+            if( iMessage )
+                {
+                iMessage->Complete( KErrCancel );    
+                delete iMessage;
+                iMessage = NULL;
+                }
+            // Complete cancel request
+            aMessage.Complete( KErrNone );
+            //stop & reset the queue
+            iQueueEvents = EFalse;
+            iEventQueue.Reset();
+            }
+            break;
+        case ECCHGetServices:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHGetServices" );
+            iServer.RequestStorage().AddRequestL( ECCHGetServices,
+                aMessage, this );
+            }
+            break;
+        case ECCHGetServicesCancel:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHGetServicesCancel" );
+            iServer.RequestStorage().CompleteRequest( ECCHGetServices,
+                this, KErrCancel );
+            aMessage.Complete( KErrNone );
+            }
+            break;
+        case ECCHGetServiceState:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHGetServiceState" );
+            TInt err( KErrNone );
+            err = iServer.ServiceHandler().GetServiceState( aMessage );
+            aMessage.Complete( err );
+            }
+            break;
+        case ECCHEnableService:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHEnableService" );
+            iServer.RequestStorage().AddRequestL( ECCHEnableService,
+                aMessage, this );
+            }
+            break;
+        case ECCHEnableServiceCancel:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHEnableServiceCancel" );
+            iServer.RequestStorage().CompleteRequest( ECCHEnableService,
+                this, KErrCancel );
+            aMessage.Complete( KErrNone );
+            }
+            break;
+        case ECCHDisableService:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHDisableService" );
+            iServer.RequestStorage().AddRequestL( ECCHDisableService,
+                aMessage, this );
+            }
+            break;
+        case ECCHDisableServiceCancel:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHDisableServiceCancel" );
+            iServer.RequestStorage().CompleteRequest( ECCHDisableService,
+                this, KErrCancel );
+            aMessage.Complete( KErrNone );
+            }
+            break;
+        case ECCHGetServiceInfo:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHGetServiceInfo" );
+            TInt err( KErrNone );
+            err = iServer.ServiceHandler().GetServiceInfo( aMessage );
+            aMessage.Complete( err );
+            }
+            break;
+        case ECCHGetPreferredService:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHGetPreferredService" );
+            aMessage.Complete( KErrNotSupported );
+            }
+            break;
+        case ECCHSetConnectionInfo:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHSetConnectionInfo" );
+            iServer.RequestStorage().AddRequestL( ECCHSetConnectionInfo,
+                aMessage, this );
+            }
+            break;
+        case ECCHSetConnectionInfoCancel:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHSetConnectionInfoCancel" );
+            iServer.RequestStorage().CompleteRequest( ECCHSetConnectionInfo,
+                this, KErrCancel );
+            aMessage.Complete( KErrNone );
+            }
+            break;
+        case ECCHGetConnectionInfo:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHGetConnectionInfo" );
+            iServer.RequestStorage().AddRequestL( ECCHGetConnectionInfo,
+                aMessage, this );
+            }
+            break;
+        case ECCHGetConnectionInfoCancel:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHGetConnectionInfoCancel" );
+            iServer.RequestStorage().CompleteRequest( ECCHGetConnectionInfo,
+                this, KErrCancel );
+            aMessage.Complete( KErrNone );
+            }
+            break;
+        case ECCHServiceCount:
+            {
+            iServer.ServiceHandler().ServiceCountL( aMessage );
+            aMessage.Complete( KErrNone );
+            }
+            break;
+        case ECCHReserveService:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHReserveService" );
+            TInt err( KErrNone );
+            err = iServer.ServiceHandler().ReserveService( aMessage );
+            aMessage.Complete( err );
+            }
+            break;
+        case ECCHFreeService:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHFreeService" );
+            TInt err( KErrNone );
+            err = iServer.ServiceHandler().FreeService( aMessage );
+            aMessage.Complete( err );
+            }
+            break;
+        case ECCHIsReserved:
+            {
+            CCHLOGSTRING
+                ( "CCCHSubsession::ServiceL :ECCHIsReserved" );
+            iServer.ServiceHandler().IsReserved( aMessage );
+            aMessage.Complete( KErrNone );
+            }
+            break;
+        default:
+            {
+            CCHLOGSTRING( "CCCHSubsession::ServiceL :ECCHBadRequest" );
+            iServer.PanicClient( aMessage, ECCHBadRequest );
+            }
+        }
+    CCHLOGSTRING( "CCCHSubsession::ServiceL: OUT" );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchuihandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,383 @@
+/*
+* 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:  CCchUIHandler implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchlogger.h"
+#include "cchserverbase.h"
+#include "cchservicehandler.h"
+#include "cchclientserverinternal.h"
+#include <centralrepository.h>
+#include "cchetelnetworkstatusnotifier.h"
+#include "cchfeaturemanager.h"
+#include "cchnotehandler.h"
+#include "cchprivatecrkeys.h"
+#include <cch.rsg>
+#include "cchuihandler.h"
+#include "cchsecondarydisplayapi.h"
+#include <CoreApplicationUIsSDKCRKeys.h>
+
+// From AVKON
+#include <AknSmallIndicator.h>
+#include <avkon.hrh>
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+const TInt KDelayTimeOneSec(1000000);
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCchUIHandler::CCchUIHandler
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCchUIHandler::CCchUIHandler( 
+    CCCHServerBase& aServer, 
+    CCCHServiceHandler& aCCchServiceHandler ) :
+    CActive( CActive::EPriorityStandard ),
+    iServer( aServer ),
+    iCCchServiceHandler( aCCchServiceHandler )
+    {
+    CCHLOGSTRING( "CCchUIHandler::CCchUIHandler" );
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUIHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCchUIHandler::ConstructL()
+    {
+    CCHLOGSTRING( "CCchUIHandler::ConstructL" );
+    User::LeaveIfError( iTimer.CreateLocal() );
+    
+    iCchEtelNetworkStatusNotifier = CCchEtelNetworkStatusNotifier::NewL( *this );
+    iNoteHandler = CCchNoteHandler::NewL( iServer );
+    iOfflineRepository = CRepository::NewL( KCRUidCoreApplicationUIs );
+    iCchRepository = iNoteHandler->CchCenRep();
+
+    MonitorOfflineStatusL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUIHandler::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchUIHandler* CCchUIHandler::NewL( 
+    CCCHServerBase& aServer, 
+    CCCHServiceHandler& aCCchServiceHandler )
+    {
+    CCHLOGSTRING( "CCchUIHandler::NewL" );
+    CCchUIHandler* self = 
+        CCchUIHandler::NewLC( aServer, aCCchServiceHandler );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUIHandler::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchUIHandler* CCchUIHandler::NewLC( 
+    CCCHServerBase& aServer, 
+    CCCHServiceHandler& aCCchServiceHandler )
+    {
+    CCHLOGSTRING( "CCchUIHandler::NewLC" );
+    CCchUIHandler* self = 
+        new (ELeave) CCchUIHandler( aServer, aCCchServiceHandler );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUIHandler::NewLC
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CCchUIHandler::~CCchUIHandler()
+    {   
+    CCHLOGSTRING( "CCchUIHandler::~CCchUIHandler" );
+    Cancel();
+    iTimer.Close();
+    
+    delete iCchEtelNetworkStatusNotifier;
+    delete iOfflineRepository;
+    
+    if ( iNoteHandler && iNoteHandler->CanBeDestroyed() )
+    	{
+    	delete iNoteHandler;
+    	}  
+    }
+// ---------------------------------------------------------------------------
+// CCchUIHandler::SetIndicatorStateL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCchUIHandler::SetIndicatorStateL( TInt aIndicator, 
+                                        TInt aState ) const
+    {
+    CCHLOGSTRING( "CCchUIHandler::SetIndicatorStateL" );
+    CAknSmallIndicator* theIndicator = 
+        CAknSmallIndicator::NewLC( TUid::Uid( aIndicator ) );
+    theIndicator->SetIndicatorStateL( aState );
+    CleanupStack::PopAndDestroy( theIndicator );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUIHandler::MobileNetworkNoService
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCchUIHandler::MobileNetworkNoService(  )
+    {
+    CCHLOGSTRING( "CCchUIHandler::MobileNetworkNoService" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUIHandler::HandleVoipStateChanged
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCchUIHandler::HandleVoipStateChanged( TBool aStatus )
+    {
+    CCHLOGSTRING( "CCchUIHandler::HandleVoipStateChanged" );
+    TRAP_IGNORE( HandleVoipStateChangedL(aStatus) );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUIHandler::HandleVoipStateChangedL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+void CCchUIHandler::HandleVoipStateChangedL( TBool aStatus )
+    {
+    CCHLOGSTRING( "CCchUIHandler::HandleVoipStateChangedL" );
+    TInt err;
+    if ( aStatus && !iVoIPSmallIndicatorShown )   // Change VoIP indicator visibility
+        {
+        SetIndicatorStateL( EAknIndicatorVoIP, 
+                EAknIndicatorStateOn ) ;
+        iVoIPSmallIndicatorShown = ETrue;
+        TInt emergencyWarningShown( 0 );
+        err = iCchRepository->Get( 
+             KCCHVoIPEmergencyWarningShown, emergencyWarningShown );
+        if( err == KErrNone )
+            {
+            if( !emergencyWarningShown )
+                {
+                ShowEmergencyWarningNoteL( ETrue );
+                }
+            }
+        }
+    else if ( !aStatus && iVoIPSmallIndicatorShown )
+        {
+        iVoIPSmallIndicatorShown = EFalse;
+        iServer.SetVoIPEmergencyNoteShown( EFalse );
+        TRAP( err, SetIndicatorStateL( EAknIndicatorVoIP, 
+                EAknIndicatorStateOff ) );
+        }
+    } 
+// ---------------------------------------------------------------------------
+// CCchUIHandler::UpdateUI
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//      
+void CCchUIHandler::UpdateUI( )
+    {
+    CCHLOGSTRING( "CCchUIHandler::UpdateUI" );
+    if( iCCchServiceHandler.Exists( ECCHVoIPSub, ECCHEnabled, KErrNone ) )
+        {
+        HandleVoipStateChanged( ETrue );
+        }
+    else
+        {
+        HandleVoipStateChanged( EFalse );
+        }
+
+    }
+// ---------------------------------------------------------------------------
+// CCchUIHandler::CheckGprsFirstUsageL
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//      
+void CCchUIHandler::CheckGprsFirstUsageL( )
+    { 
+    CCHLOGSTRING( "CCchUIHandler::CheckGprsFirstUsageL - IN" );
+    // Show gprs roaming cost warning note if not already shown
+    if( !IsCostWarningSeen() )
+        {
+        iNoteHandler->LaunchGlobalNoteL( 
+            R_QTN_SERVTAB_ALLOW_GPRS_WHEN_ROAMING_QUERY, 
+            R_AVKON_SOFTKEYS_OK_EMPTY,
+            SecondaryDisplay::ECmdNoNote );     
+        }
+    
+    CCHLOGSTRING( "CCchUIHandler::CheckGprsFirstUsageL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUIHandler::IsCostWarningSeen
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//      
+TBool CCchUIHandler::IsCostWarningSeen() const
+    {
+    TBool response( EFalse );
+    TInt costWarning( KErrNone );
+    iCchRepository->Get( KCCHGprsRoamingCostWarningShown, costWarning );
+
+    response = 1 == costWarning;
+    CCHLOGSTRING2( "CCchUIHandler::IsCostWarningSeen : %d", response );
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchUIHandler::NetworkConnectionsAllowed
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//      
+TBool CCchUIHandler::NetworkConnectionsAllowed() const
+    { 
+    return iNetworkConnectionAllowed;
+    }
+
+// ----------------------------------------------------------------------------
+// CCchUIHandler::ShowEmergencyWarningNoteL()
+// (other items were commented in a header).
+// ----------------------------------------------------------------------------
+    
+void CCchUIHandler::ShowEmergencyWarningNoteL( TBool aVoIPEnabledFirstTime )
+    {
+    CCHLOGSTRING( "CCchUIHandler::ShowEmergencyWarningNoteL" );
+    if ( iServer.FeatureManager().VoIPSupported() )
+        {
+        if ( aVoIPEnabledFirstTime )
+            {
+            iNoteHandler->LaunchGlobalNoteL( 
+                R_QTN_FIRST_EMERGENCY_WARNING_NOTE, 
+                R_AVKON_SOFTKEYS_OK_EMPTY,
+                SecondaryDisplay::ECmdShowVoipEmergencyCallReadinessQuery );
+            iServer.SetVoIPEmergencyNoteShown( ETrue );
+            }
+
+        }
+    } 
+
+// ----------------------------------------------------------------------------
+// CCchUIHandler::MonitorOfflineStatusL()
+// ----------------------------------------------------------------------------
+void CCchUIHandler::MonitorOfflineStatusL()
+    {
+    CCHLOGSTRING("CCchUIHandler::MonitorOfflineStatusL() IN"); 
+     
+    iOfflineRepository->Get( 
+        KCoreAppUIsNetworkConnectionAllowed, 
+        iNetworkConnectionAllowed );
+          
+    iOfflineRepository->NotifyRequest( 
+            KCoreAppUIsNetworkConnectionAllowed, iStatus);
+    
+    SetActive();
+    CCHLOGSTRING("CCchUIHandler::MonitorOfflineStatusL() OUT"); 
+    }
+
+// ----------------------------------------------------------------------------
+// CCchUIHandler::Cancel()
+// ----------------------------------------------------------------------------
+void CCchUIHandler::DoCancel()
+    {
+    CCHLOGSTRING("CCchUIHandler::DoCancel()");
+    iTimer.Cancel();
+    iOfflineRepository->NotifyCancel(
+            KCoreAppUIsNetworkConnectionAllowed );
+    }
+
+// ----------------------------------------------------------------------------
+// CCchUIHandler::RunL()
+// ----------------------------------------------------------------------------
+void CCchUIHandler::RunL()
+    {
+    CCHLOGSTRING("CCchUIHandler::RunL() IN"); 
+    
+    if ( iDie )
+        {
+        delete this;
+        }
+    else
+        {
+        MonitorOfflineStatusL();
+        }
+
+    CCHLOGSTRING("CCchUIHandler::RunL() OUT"); 
+    }
+
+// ----------------------------------------------------------------------------
+// CCchUIHandler::RunError()
+// ----------------------------------------------------------------------------
+TInt CCchUIHandler::RunError( TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// CCchUIHandler::Destroy()
+// ----------------------------------------------------------------------------
+void CCchUIHandler::Destroy()
+    {
+    CCHLOGSTRING("CCchUIHandler::Destroy() IN"); 
+    iDie = ETrue;
+    
+    // Soon we are down so remove VoIP icon
+    TRAP_IGNORE( SetIndicatorStateL( 
+        EAknIndicatorVoIP, EAknIndicatorStateOff ) );
+    Cancel();
+    iTimer.After ( iStatus, KDelayTimeOneSec );
+    SetActive();
+    
+    CCHLOGSTRING("CCchUIHandler::Destroy() OUT");
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchwakeupeventnotifier.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,324 @@
+/*
+* 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:  CCCHWakeUpEventNotifier implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <spnotifychange.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+
+#include "cchwakeupeventnotifier.h"
+#include "cchwakeupeventobserver.h"
+#include "cchlogger.h"
+#include "cchetelnetworkstatusnotifier.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES
+// None
+
+// CONSTANTS
+const TInt KOfflineTimeout = 500000;
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+//None
+
+// FORWARD DECLARATIONS
+// None
+
+// ============================= LOCAL FUNCTIONS =============================
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCCHWakeUpEventNotifier::CCCHWakeUpEventNotifier
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CCchWakeUpEventNotifier::CCchWakeUpEventNotifier( 
+    MCchWakeUpEventObserver& aWakeUpEventObserver ) :
+    CActive( CActive::EPriorityStandard ),
+    iWakeUpEventObserver( aWakeUpEventObserver )
+    {
+    CCHLOGSTRING( "CCchWakeUpEventNotifier::CCchWakeUpEventNotifier" );
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CCchWakeUpEventNotifier::ConstructL()
+    {
+    CCHLOGSTRING( "CCchWakeUpEventNotifier::ConstructL" );
+    
+    iSPSNotifier = CSPNotifyChange::NewL( *this );
+    iCchEtelNetworkNotifier = CCchEtelNetworkStatusNotifier::NewL( *this );
+    iOfflineRepository = CRepository::NewL( KCRUidCoreApplicationUIs );
+    iOfflineTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard );
+    
+    StartL();
+    }
+
+// ---------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchWakeUpEventNotifier* CCchWakeUpEventNotifier::NewL(
+    MCchWakeUpEventObserver& aWakeUpEventObserver )
+    {
+    CCchWakeUpEventNotifier* self = CCchWakeUpEventNotifier::NewLC(
+            aWakeUpEventObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCchWakeUpEventNotifier* CCchWakeUpEventNotifier::NewLC(
+    MCchWakeUpEventObserver& aWakeUpEventObserver )
+    {
+    CCchWakeUpEventNotifier* self = new (ELeave)CCchWakeUpEventNotifier(
+            aWakeUpEventObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// Destructor
+CCchWakeUpEventNotifier::~CCchWakeUpEventNotifier()
+    {
+    Cancel();
+    delete iOfflineTimer;
+    delete iSPSNotifier;
+    delete iCchEtelNetworkNotifier;
+    delete iOfflineRepository;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::MobileNetworkNoService
+// Handles mobile network events.
+// ---------------------------------------------------------------------------
+//
+void CCchWakeUpEventNotifier::MobileNetworkNoService()
+    {
+    CCHLOGSTRING( "CCchWakeUpEventNotifier::MobileNetworkNoService IN" );
+    
+    if ( iObservationOngoing )
+        {
+        iWakeUpEventObserver.WakeUp();
+        }
+    
+    CCHLOGSTRING( "CCchWakeUpEventNotifier::MobileNetworkNoService OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::HandleNotifyChange
+// Handles change events generated by spsettings.
+// ---------------------------------------------------------------------------
+//
+void CCchWakeUpEventNotifier::HandleNotifyChange( TServiceId /* aServiceId */ )
+    {
+    CCHLOGSTRING( "CCchWakeUpEventNotifier::HandleNotifyChange IN" );
+    
+    if ( iObservationOngoing )
+        {
+        iWakeUpEventObserver.WakeUp();
+        }
+
+    CCHLOGSTRING( "CCchWakeUpEventNotifier::HandleNotifyChange OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::HandleError
+// Handles errors generated by spsettings.
+// ---------------------------------------------------------------------------
+//
+void CCchWakeUpEventNotifier::HandleError( TInt /*aError*/ )
+    {
+    CCHLOGSTRING( "CCchWakeUpEventNotifier::HandleError IN OUT" );
+    }
+
+// ----------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::Cancel()
+//
+// ----------------------------------------------------------------------------
+//
+void CCchWakeUpEventNotifier::DoCancel()
+    {
+    CCHLOGSTRING("CCchWakeUpEventNotifier::DoCancel()"); 
+    iOfflineRepository->NotifyCancel( KCoreAppUIsNetworkConnectionAllowed );
+    iSPSNotifier->NotifyChangeCancel();
+    CancelOfflineTimer();
+    }
+
+// ----------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::RunL()
+//
+// ----------------------------------------------------------------------------
+//
+void CCchWakeUpEventNotifier::RunL()
+    {
+    CCHLOGSTRING("CCchWakeUpEventNotifier::RunL() IN");
+    
+    iOfflineRepository->Get( 
+            KCoreAppUIsNetworkConnectionAllowed, iNetworkConnectionAllowed );
+    if ( ECoreAppUIsNetworkConnectionNotAllowed == iNetworkConnectionAllowed )
+        {
+        // Start 0.5s timer, after timeout if cellular network is still down 
+        // send wakeup event to our client. Why timer -> we can avoid situtation 
+        // where cellular network is down for very short period.
+        if ( !iOfflineTimer->IsActive() )
+            {
+            CCHLOGSTRING("CCchWakeUpEventNotifier::RunL -> Start timer");
+            StartOfflineTimer( CCchWakeUpEventNotifier::OfflineTimeout );
+            }
+        }
+    
+    StartL();
+    
+    CCHLOGSTRING("CCchWakeUpEventNotifier::RunL() OUT"); 
+    }
+
+// ----------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::RunError()
+//
+// ----------------------------------------------------------------------------
+//
+TInt CCchWakeUpEventNotifier::RunError( TInt /*aError*/ )
+    {
+    CCHLOGSTRING("CCchWakeUpEventNotifier::RunError IN OUT"); 
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::StartL()
+//
+// ----------------------------------------------------------------------------
+//
+void CCchWakeUpEventNotifier::StartL()
+    {
+    CCHLOGSTRING("CCchWakeUpEventNotifier::StartL IN");
+
+    iObservationOngoing = ETrue;
+    if ( !IsActive() )
+        {  
+        RIdArray serviceIds;
+        iSPSNotifier->NotifyChangeL( serviceIds );
+        
+        iOfflineRepository->NotifyRequest( 
+                KCoreAppUIsNetworkConnectionAllowed, iStatus );
+        SetActive();
+        }
+    
+    CCHLOGSTRING("CCchWakeUpEventNotifier::StartL OUT");
+    }
+
+// ----------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::StopL()
+//
+// ----------------------------------------------------------------------------
+//
+void CCchWakeUpEventNotifier::Stop()
+    {
+    CCHLOGSTRING("CCchWakeUpEventNotifier::Stop IN");
+    iObservationOngoing = EFalse;
+    Cancel();
+    CCHLOGSTRING("CCchWakeUpEventNotifier::Stop OUT");
+    }
+
+// -----------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::StartOfflineTimer
+//
+// -----------------------------------------------------------------------------
+//
+void CCchWakeUpEventNotifier::StartOfflineTimer( TInt (*aFunction)(TAny* aPtr) )
+    {
+    if( !iOfflineTimer->IsActive() )
+        {
+        iOfflineTimer->Start( 
+            KOfflineTimeout , 0, TCallBack( aFunction, this ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::CancelOfflineTimer
+//
+// -----------------------------------------------------------------------------
+//
+void CCchWakeUpEventNotifier::CancelOfflineTimer()
+    {
+    if( iOfflineTimer->IsActive() )
+        {
+        iOfflineTimer->Cancel();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::OfflineTimeout
+//
+// -----------------------------------------------------------------------------
+//
+TInt CCchWakeUpEventNotifier::OfflineTimeout( TAny* aSelf )
+    {
+    CCchWakeUpEventNotifier* self = 
+        static_cast<CCchWakeUpEventNotifier*>( aSelf );
+    self->HandleOfflineTimeout();
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCchWakeUpEventNotifier::HandleOfflineTimeout
+//
+// -----------------------------------------------------------------------------
+//
+void CCchWakeUpEventNotifier::HandleOfflineTimeout()
+    {
+    CCHLOGSTRING( "CCchWakeUpEventNotifier::HandleOfflineTimeout IN" );
+    
+    CancelOfflineTimer();
+    iOfflineRepository->Get( 
+        KCoreAppUIsNetworkConnectionAllowed, iNetworkConnectionAllowed );
+
+    if ( ECoreAppUIsNetworkConnectionNotAllowed == iNetworkConnectionAllowed )
+        {
+        // Mode is still offline, send notify to our client
+        iWakeUpEventObserver.WakeUp();
+        }
+        
+    CCHLOGSTRING( "CCchWakeUpEventNotifier::HandleOfflineTimeout OUT" );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/cchserver/src/cchwlanextension.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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: 
+*        class implementation for CCchWlanExtension
+*
+*/
+
+
+// INCLUDE FILES
+#include "cchwlanextension.h"
+#include "cchprivatecrkeys.h"
+#include "cchlogger.h"
+
+#include <centralrepository.h>
+#include <wlanmgmtclient.h>
+#include <StringLoader.h>
+#include <WlanCdbCols.h>
+
+// CONSTANTS
+
+const TUint32 KWlanScanRateDeactive = 0;    //scan not active
+const TUint32 KWlanScanRateActive   = 300;  //value used when cch activates 1st scan
+
+const TInt KRetryTimeout( 100000 ); // 0,1s delay for comms db begintransaction retry (microseconds)
+const TInt KRetryCount( 6 );      // Maximum number of retries
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CCchWlanExtension::NewL()
+// Symbian OS two-phased constructor
+// ---------------------------------------------------------------------------
+CCchWlanExtension* CCchWlanExtension::NewL( )
+    {
+    CCchWlanExtension* self = new( ELeave ) CCchWlanExtension( );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchWlanExtension::ConstructL()
+// Symbian OS two-phased constructor
+// ---------------------------------------------------------------------------
+void CCchWlanExtension::ConstructL()
+    {
+    CCHLOGSTRING2( "CCchWlanExtension::ConstructL[0x%x]: IN", this );
+    // Create connection to the Access Points setting data.
+    iAPCommsDatabase = CCommsDatabase::NewL( EDatabaseTypeIAP );
+    
+    // Create connection to the WLAN setting data.
+    iWLANCommsDatabase = CCommsDatabase::NewL();
+    
+    iCchRepository = CRepository::NewL( KCRUidCch );
+    CCHLOGSTRING( "CCchWlanExtension::ConstructL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchWlanExtension::CCchWlanExtension()
+// Constructor.
+// ---------------------------------------------------------------------------
+CCchWlanExtension::CCchWlanExtension( ) :
+	iLastSavedScanInterval( 0 )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CGSUiVoIPExtension::~CCchWlanExtension()
+// Destructor.
+// ---------------------------------------------------------------------------
+CCchWlanExtension::~CCchWlanExtension()
+    {
+    delete iWLANCommsDatabase;
+    delete iAPCommsDatabase;
+    delete iCchRepository;
+    }
+
+// ---------------------------------------------------------------------------
+// CCchWlanExtension::ForceEnableWlanScanL
+// ---------------------------------------------------------------------------
+void CCchWlanExtension::ForceEnableWlanScanL()
+    {
+    CCHLOGSTRING( "CCchWlanExtension::ForceEnableWlanScanL: IN" );    
+    TInt scanRate = CheckAvailabilityStatusL();
+    if( KWlanScanRateDeactive != scanRate )
+        {
+        CCHLOGSTRING( "CCchWlanExtension::Forced to disable/enable wlan scan" ); 
+        SetAvailabilitySwitchL( KWlanScanRateDeactive );    
+        SetAvailabilitySwitchL( iLastSavedScanInterval );  
+        }
+    else
+        {
+        CCHLOGSTRING( "CCchWlanExtension::Normal wlan scan enable" ); 
+        EnableWlanScanL();
+        }
+    
+    CCHLOGSTRING( "CCchWlanExtension::ForceEnableWlanScanL: OUT" );    
+    }
+
+// ---------------------------------------------------------------------------
+// CCchWlanExtension::EnableWlanScanL
+// ---------------------------------------------------------------------------
+void CCchWlanExtension::EnableWlanScanL()
+    {
+    CCHLOGSTRING( "CCchWlanExtension::EnableWlanScanL: IN" );
+    TInt err( KErrNone );
+    TInt wlanActivation( 0 );
+    err = iCchRepository->Get( 
+             KCCHWasWlanScanActivatedBeforeServiceEnabling, 
+             wlanActivation );
+    User::LeaveIfError( err );
+    TInt scanRate = CheckAvailabilityStatusL();
+    // Activate the WLAN scan setting if needed.
+    if( KErrNone == err )
+        {
+        if( ECCHWlanScanNotDefined == wlanActivation )
+            {
+            if( KWlanScanRateDeactive < scanRate )    
+                {
+                iCchRepository->Set( KCCHWasWlanScanActivatedBeforeServiceEnabling, 
+                                     ECCHWlanScanWasEnabled );    
+                CCHLOGSTRING( "CCchWlanExtension::EnableWlanScanL; scan was enabled by user" );
+                }
+            else
+                {
+                iCchRepository->Set( KCCHWasWlanScanActivatedBeforeServiceEnabling, 
+                                     ECCHWlanScanWasNotEnabled );    
+                
+                CCHLOGSTRING( "CCchWlanExtension::EnableWlanScanL; scan was enabled by CCH" );
+                }
+            }
+        }
+    if( KWlanScanRateDeactive == scanRate )    
+        {
+        SetAvailabilitySwitchL( iLastSavedScanInterval );            
+        }
+
+    CCHLOGSTRING( "CCchWlanExtension::EnableWlanScanL: OUT" );
+    }
+// ---------------------------------------------------------------------------
+// CCchWlanExtension::DisableWlanScanL
+// ---------------------------------------------------------------------------
+void CCchWlanExtension::DisableWlanScanL()    
+    {
+    CCHLOGSTRING( "CCchWlanExtension::DisableWlanScanL: IN" );
+    // Deactivate the WLAN scan setting if needed.    
+    TInt err( KErrNone );
+    TInt wlanActivation( 0 );
+    err = iCchRepository->Get( 
+             KCCHWasWlanScanActivatedBeforeServiceEnabling, 
+             wlanActivation );
+    User::LeaveIfError( err );
+    TInt scanRate = CheckAvailabilityStatusL();             
+    CCHLOGSTRING2( "CCchWlanExtension::DisableWlanScanL: ERROR:%d", err );
+    if( KErrNone == err )
+        {
+        CCHLOGSTRING2( "CCchWlanExtension::DisableWlanScanL: activation:%d", wlanActivation );
+        if ( KWlanScanRateDeactive < scanRate )
+            {
+            CCHLOGSTRING( "CCchWlanExtension::DisableWlanScanL: scan is active" );
+            if( ECCHWlanScanNotDefined != wlanActivation )
+                {
+                if( ECCHWlanScanWasNotEnabled == wlanActivation )
+                    {
+                    CCHLOGSTRING( "CCchWlanExtension::DisableWlanScanL: disabling wlan scan" );
+                    SetAvailabilitySwitchL( KWlanScanRateDeactive );                        
+                    }
+                err = iCchRepository->Set( KCCHWasWlanScanActivatedBeforeServiceEnabling, 
+                                     ECCHWlanScanNotDefined );    
+                User::LeaveIfError( err );
+                }
+            }            
+        }
+    CCHLOGSTRING( "CCchWlanExtension::DisableWlanScanL: OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchWlanExtension::CheckAvailabilityStatusL
+// Checks WLAN availability setting status.
+// ---------------------------------------------------------------------------
+//
+TUint32 CCchWlanExtension::CheckAvailabilityStatusL()
+	{
+	CCHLOGSTRING( "CCchWlanExtension::CheckAvailabilityStatusL: IN" );
+    TUint32 scanRate( KErrNone );
+    // Open WLAN setting table and get availability data.
+    CCommsDbTableView* view = 
+        iWLANCommsDatabase->OpenViewMatchingUintLC
+            (
+            TPtrC( WLAN_DEVICE_SETTINGS ),
+            TPtrC( WLAN_DEVICE_SETTINGS_TYPE ),
+            KWlanUserSettings
+            );
+    
+    User::LeaveIfError( view->GotoFirstRecord() );
+    view->ReadUintL( TPtrC( WLAN_BG_SCAN_INTERVAL ), scanRate );
+    //ignore leave if there is no such column WLAN_SAVED_BG_SCAN_INTERVAL
+    TRAP_IGNORE( view->ReadUintL( TPtrC( WLAN_SAVED_BG_SCAN_INTERVAL ), 
+    							  iLastSavedScanInterval ) );
+    
+    if( 0 == iLastSavedScanInterval )
+    	{
+    	iLastSavedScanInterval = KWlanScanRateActive;
+    	}
+    CCHLOGSTRING3( 
+    	"CCchWlanExtension::CheckAvailabilityStatusL: interval: %d, saved: %d", 
+    	scanRate, iLastSavedScanInterval );
+    CleanupStack::PopAndDestroy( view );
+    CCHLOGSTRING( "CCchWlanExtension::CheckAvailabilityStatusL: OUT" );
+    // Return scan rate value.
+    return scanRate;
+	}
+
+// -----------------------------------------------------------------------------
+// CCchWlanExtension::SetAvailabilitySwitchL
+// Sets WLAN availability switch based on scan rate given.
+// -----------------------------------------------------------------------------
+void CCchWlanExtension::SetAvailabilitySwitchL( TUint32 aScanRate )
+    {
+    CCHLOGSTRING( "CCchWlanExtension::SetAvailabilitySwitchL: IN" );
+    // Open WLAN setting table and record.
+    CCommsDbTableView* view = iWLANCommsDatabase->OpenViewMatchingUintLC
+        (
+        TPtrC( WLAN_DEVICE_SETTINGS ),
+        TPtrC( WLAN_DEVICE_SETTINGS_TYPE ),
+        KWlanUserSettings
+        );
+        
+    User::LeaveIfError( view->GotoFirstRecord() );
+    User::LeaveIfError( view->UpdateRecord() );
+
+    // Set new WLAN availability setting value to comms database.
+    view->WriteUintL( TPtrC( WLAN_BG_SCAN_INTERVAL ), aScanRate );
+    
+    TInt round( 0 );
+    TInt err( KErrNone );
+       do
+           {
+           // Complete transaction procedure.
+           err = view->PutRecordChanges();
+
+           if ( KErrNone != err )
+               {
+               User::After( round * KRetryTimeout );
+               round++;
+               }
+           }
+       while ( KErrNone != err && round < KRetryCount);
+          
+     if ( KErrNone != err  )
+        {
+        CCHLOGSTRING( "CCchWlanExtension::SetAvailabilitySwitchL: PutRecordChanges was unsuccessful" );
+        User::Leave( err );
+        }
+    
+    CleanupStack::PopAndDestroy( view );
+    
+    // Notifying WLAN Engine about changes in settings.
+    CWlanMgmtClient* wlanMgmtClient = CWlanMgmtClient::NewL();
+    wlanMgmtClient->NotifyChangedSettings();
+    delete wlanMgmtClient;
+    CCHLOGSTRING( "CCchWlanExtension::SetAvailabilitySwitchL: OUT" );
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Build information file for project Converged Connection
+                 Handler (CCH)
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+../rom/cch.iby CORE_APP_LAYER_IBY_EXPORT_PATH( cch.iby )
+
+../rom/cchresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH( cchresources.iby )
+
+#include "../cchserver/group/bld.inf"
+#include "../cchclient/group/bld.inf"
+#include "../cchclientapi/group/bld.inf"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/inc/cchclientserverinternal.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,96 @@
+/*
+* 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:  CCH Client / Server common internal header
+*
+*/
+
+
+#ifndef CCHCLIENTSERVERINTERNAL_H
+#define CCHCLIENTSERVERINTERNAL_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+_LIT( KCCHServerExe, "CCHServer.exe" );
+_LIT( KCCHServerName, "!CCHServer" );
+_LIT( KCCHServerStartMutex, "CCHServerStartMutex" );
+
+const TUid  KCCHServerUid  = { 0x10275456 };
+
+/** 
+ * Version number 
+ */
+const TUint KCCHServMajorVersionNumber = 0;
+const TUint KCCHServMinorVersionNumber = 0;
+const TUint KCCHServBuildVersionNumber = 1;
+
+/**
+ * Number of message slots in the server.
+ * Needed message slots can be defined as follows:
+ * total slots = n+2, where n is number of independent
+ * asynchronous services offered by the server.
+ */
+const TUint KCCHMessageSlots = 9;
+
+// DATA TYPES
+
+/**
+ * Commands from client to server
+ */
+enum TCCHCommands
+    {
+    ECCHOpenSubSession = 0,
+    ECCHCloseSubSession,
+    ECCHSubscribeToEvents,
+    ECCHSubscribeToEventsCancel,
+    ECCHGetServices,
+    ECCHGetServicesCancel,
+    ECCHGetServiceState,
+    ECCHEnableService,
+    ECCHEnableServiceCancel,
+    ECCHDisableService,
+    ECCHDisableServiceCancel,
+    ECCHGetServiceInfo,
+    ECCHGetPreferredService,
+    ECCHSetConnectionInfo,
+    ECCHSetConnectionInfoCancel,
+    ECCHGetConnectionInfo,
+    ECCHGetConnectionInfoCancel,
+    ECCHReserveService,
+    ECCHFreeService,
+    ECCHIsReserved,
+    ECCHServiceCount,
+    ECCHServerRegister,
+    ECCHServerRegisterCancel
+    };
+
+/**
+ * Server panic codes
+ */
+enum TCCHServerPanic
+    {
+    ECCHErrCreateServer = 100,
+    ECCHErrStartServer = 101,
+    
+    ECCHErrSubSessionOpen = 102,
+    ECCHErrSubSessionClose = 103,
+    
+    ECCHBadRequest = 104,
+    ECCHBadDescriptor = 105,
+    };
+
+#endif // CCHCLIENTSERVERINTERNAL_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/inc/cchlogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,176 @@
+/*
+* 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 macros for logging
+*
+*/
+
+
+
+#ifndef __CCHLOGGER_H__
+#define __CCHLOGGER_H__
+
+// INCLUDES
+#include <e32def.h>
+#include <e32svr.h>
+#include <e32base.h>
+#include <e32std.h>
+
+// CONSTS
+const TInt KMaxLogLineLength = 512;
+_LIT8( KModuleName8, "CCH" );
+
+//----------------------------------------------------------------------------
+//  USER LOGGING SETTINGS
+//----------------------------------------------------------------------------
+
+#ifndef _DEBUG
+
+/***************************
+ * Logging method variants:
+ *   0 = No logging
+ *   1 = Flogger
+ *   2 = RDebug
+ ***************************/ 
+
+#define CCH_LOGGING_METHOD      0   // UREL BUILD
+
+#else
+
+#ifdef __WINS__
+#define CCH_LOGGING_METHOD      2   // UDEB BUILD, WINS
+#else
+#define CCH_LOGGING_METHOD      2   // UDEB BUILD, HW
+#endif // __WINS__
+
+#ifdef TRACE_ENTRY_EXIT_POINT // MACRO IN MMP FILE
+    #define TRACE_ENTRY_POINT TRACE_FUNC_ENTRY_DEBUG_PRINT
+    #define TRACE_EXIT_POINT TRACE_FUNC_EXIT_DEBUG_PRINT    
+#endif
+
+#endif // _DEBUG
+
+// [module_name]_ENTRY_POINT;[thread_id];[function_name];[filename]:[line_number];
+_LIT8( KFuncEntryFormat8, "%S_ENTRY;%d;%S;%S:%d;");
+// [module_name]_EXIT_POINT;[thread_id];[function_name];[filename]:[line_number];
+_LIT8( KFuncExitFormat8,  "%S_EXIT_;%d;%S;%S:%d;");
+//-----------------------------------------------------------------------------
+//  LOGGING SETTINGS (DO NOT EDIT)
+//-----------------------------------------------------------------------------
+
+#if CCH_LOGGING_METHOD == 1      // Flogger
+
+#include <flogger.h>
+_LIT(KCCHLogFolder,"CCH");
+_LIT(KCCHLogFile,"CCHLOG.TXT");
+
+#elif CCH_LOGGING_METHOD == 2    // RDebug
+//Check if entry exit trace should be activated 
+
+
+
+
+#endif
+
+
+NONSHARABLE_CLASS( TOverflowTruncate8 ) : public TDes8Overflow
+    {
+
+public:
+    void Overflow( TDes8& /*aDes*/ ) {}
+    };
+
+//Trace macro 8bit
+inline void TraceDebugPrint( TRefByValue<const TDesC8> aFmt, ...)
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+        
+    TOverflowTruncate8 overflow;
+    TBuf8<KMaxLogLineLength> buf8;
+    buf8.AppendFormatList( aFmt, list, &overflow );
+    TBuf16<KMaxLogLineLength> buf16( buf8.Length() );
+    buf16.Copy( buf8 );
+    TRefByValue<const TDesC> tmpFmt( _L("%S") );
+    RDebug::Print( tmpFmt, &buf16 );
+    }
+
+//-----------------------------------------------------------------------------
+//  LOGGING MACROs (DO NOT EDIT)
+//
+//  USE THESE MACROS IN YOUR CODE !
+//-----------------------------------------------------------------------------
+
+#if CCH_LOGGING_METHOD == 1      // Flogger
+
+#define CCHLOGSTRING(AA)           { RFileLogger::Write(KCCHLogFolder(),KCCHLogFile(),EFileLoggingModeAppend, _L(AA) ); }
+#define CCHLOGSTRING2(AA,BB)       { RFileLogger::WriteFormat(KCCHLogFolder(),KCCHLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB); }
+#define CCHLOGSTRING3(AA,BB,CC)    { RFileLogger::WriteFormat(KCCHLogFolder(),KCCHLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB,CC); }
+#define CCHLOGSTRING4(AA,BB,CC,DD) { RFileLogger::WriteFormat(KCCHLogFolder(),KCCHLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB,CC,DD); }
+
+#elif CCH_LOGGING_METHOD == 2    // RDebug
+
+#define CCHLOGSTRING(AA)           { RDebug::Print(_L(AA)); }
+#define CCHLOGSTRING2(AA,BB)       { RDebug::Print(_L(AA),BB); }
+#define CCHLOGSTRING3(AA,BB,CC)    { RDebug::Print(_L(AA),BB,CC); }
+#define CCHLOGSTRING4(AA,BB,CC,DD) { RDebug::Print(_L(AA),BB,CC,DD); }
+
+
+
+#else   // CCH_LOGGING_METHOD == 0 or invalid -> Disable loggings
+
+#define CCHLOGSTRING(AA)           // Example: CCHLOGSTRING("Test");
+#define CCHLOGSTRING2(AA,BB)       // Example: CCHLOGSTRING("Test %d", aValue);
+#define CCHLOGSTRING3(AA,BB,CC)    // Example: CCHLOGSTRING("Test %d %d", aValue1, aValue2);
+#define CCHLOGSTRING4(AA,BB,CC,DD) // Example: CCHLOGSTRING("Test %d %d %d", aValue1, aValue2, aValue3);
+
+#define TRACE_ENTRY_POINT
+#define TRACE_EXIT_POINT
+    
+#endif  // CCH_LOGGING_METHOD
+
+#ifdef TRACE_ENTRY_EXIT_POINT // MACRO IN MMP FILE
+    #ifdef __ARMCC__
+        #define TRACE_FUNC_ENTRY_DEBUG_PRINT                                                                \
+        {                                                                                                   \
+            const TUint threadId( RThread().Id() );                                                         \
+            TPtrC8 ptr8File( (TUint8*)__MODULE__ );                                                         \
+            TPtrC8 ptr8PF( (TUint8*)__PRETTY_FUNCTION__ );                                                  \
+            TraceDebugPrint( KFuncEntryFormat8, &KModuleName8, threadId, &ptr8PF, &ptr8File, __LINE__ );    \
+        }
+        #define TRACE_FUNC_EXIT_DEBUG_PRINT                                                                 \
+        {                                                                                                   \
+            const TUint threadId( RThread().Id() );                                                         \
+            TPtrC8 ptr8File( (TUint8*)__MODULE__ );                                                         \
+            TPtrC8 ptr8PF( (TUint8*)__PRETTY_FUNCTION__ );                                                  \
+            TraceDebugPrint( KFuncExitFormat8, &KModuleName8, threadId, &ptr8PF, &ptr8File, __LINE__ );     \
+        }
+    #else // __WINS__
+        #define TRACE_FUNC_ENTRY_DEBUG_PRINT                                                                \
+        {                                                                                                   \
+            const TUint threadId( RThread().Id() );                                                         \
+            TPtrC8 ptr8File( (TUint8*)__FILE__ );                                                           \
+            TPtrC8 ptr8PF( (TUint8*)__PRETTY_FUNCTION__ );                                                  \
+            TraceDebugPrint( KFuncEntryFormat8, &KModuleName8, threadId, &ptr8PF, &ptr8File, __LINE__ );    \
+        }
+        #define TRACE_FUNC_EXIT_DEBUG_PRINT                                                                 \
+        {                                                                                                   \
+            const TUint threadId( RThread().Id() );                                                         \
+            TPtrC8 ptr8File( (TUint8*)__FILE__ );                                                           \
+            TPtrC8 ptr8PF( (TUint8*)__PRETTY_FUNCTION__ );                                                  \
+            TraceDebugPrint( KFuncExitFormat8, &KModuleName8, threadId, &ptr8PF, &ptr8File, __LINE__ );     \
+        }           
+    #endif
+#endif
+
+#endif  // CCHLOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/rom/cch.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* 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:  Converged Connection Handler ROM definition file.
+*
+*/
+
+
+#ifndef CCH_IBY
+#define CCH_IBY
+
+
+//Server EXE
+file=ABI_DIR/BUILD_DIR/CCHServer.exe    PROGRAMS_DIR/CCHServer.exe
+
+//Client DLL
+file=ABI_DIR/BUILD_DIR/CCHClient.dll   SHARED_LIB_DIR/CCHClient.dll
+
+file=ABI_DIR/BUILD_DIR/cch.dll				 SHARED_LIB_DIR/cch.dll
+
+// CCH UI components
+ECOM_PLUGIN(cchuinotifwrapper.dll,	1020E567.RSC)
+file=ABI_DIR/BUILD_DIR/cchuinotif.dll      SHARED_LIB_DIR/cchuinotif.dll
+
+#endif // CCH_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/convergedconnectionhandler/rom/cchresources.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* 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:  Converged Connection Handler ROM definition file.
+*
+*/
+
+
+#ifndef CCHRESOURCES_IBY
+#define CCHRESOURCES_IBY
+
+data=/epoc32/data/Z/Resource/apps/cch.RSC         resource/apps/cch.RSC
+
+// CCH UI localized resources
+data=/epoc32/data/Z/Resource/apps/cchuinotif.rsc         resource/apps/cchuinotif.rsc
+
+#endif // CCHRESOURCES_IBY
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,36 @@
+/*
+* 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:  
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+#include "../richcallsettingsengine/group/bld.inf"
+#include "../voipplugins/group/bld.inf"
+#include "../commsconfig/group/bld.inf"
+#include "../convergedconnectionhandler/group/bld.inf"
+#include "../sipvoipprovider/group/bld.inf"
+#include "../callcontinuity/group/bld.inf"
+#include "../iptel_plat/group/bld.inf"
+
+PRJ_TESTMMPFILES
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_client_api/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,36 @@
+/*
+* 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:  File that exports the files belonging to 
+:                cchclient api
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/cchclient.h                MW_LAYER_PLATFORM_EXPORT_PATH( cchclient.h )
+../inc/cchclientserver.h          MW_LAYER_PLATFORM_EXPORT_PATH( cchclientserver.h )
+../inc/cchclientserver.inl        MW_LAYER_PLATFORM_EXPORT_PATH( cchclientserver.inl )
+../inc/cchserver.h                MW_LAYER_PLATFORM_EXPORT_PATH( cchserver.h )
+../inc/ccherror.h                 MW_LAYER_PLATFORM_EXPORT_PATH( ccherror.h )
+../inc/cch.h                      MW_LAYER_PLATFORM_EXPORT_PATH( cch.h )
+../inc/cchtypes.h                 MW_LAYER_PLATFORM_EXPORT_PATH( cchtypes.h )
+../inc/cchui.h     	          MW_LAYER_PLATFORM_EXPORT_PATH( cchui.h )
+../inc/cchuiobserver.h            MW_LAYER_PLATFORM_EXPORT_PATH( cchuiobserver.h )
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_client_api/inc/cch.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,380 @@
+/*
+* 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:  The new cch client api class
+*
+*/
+
+
+
+#ifndef C_CCH_H
+#define C_CCH_H
+
+#include <e32base.h>
+#include <ccherror.h>
+#include <cchtypes.h>
+#include <cchui.h>
+
+class CCchImpl;
+
+
+/**
+ *  Class indicating the service status
+ *
+ *  @lib cch
+ */
+class TCchServiceStatus
+    {
+
+public:
+    
+    /**
+     * Constructor.
+     */
+     IMPORT_C TCchServiceStatus( );
+    
+    /**
+     * Returns the service state
+     *
+     * @return State of the service
+     */
+     IMPORT_C TCCHSubserviceState State() const;
+    
+    /**
+     * Returns last known service error
+     *
+     * @return Error of the service
+     */
+     IMPORT_C TInt Error() const;
+    
+    /**
+     * Sets the service state
+     *
+     * @param aState State for the service
+     */
+     IMPORT_C void SetState( TCCHSubserviceState aState );
+
+    /**
+     * Sets the service error
+     *
+     * @param aError Error for the service
+     */
+     IMPORT_C void SetError( TInt aError );
+    	
+private: // data
+
+    /**
+     * The state of the service
+     */
+	TCCHSubserviceState iState;
+    /**
+     * The error of the service
+     */
+    TInt iError;
+    };
+    
+/**
+ *  Observer class for getting service status change messages
+ *
+ *  @lib cch
+ */
+class MCchServiceStatusObserver 
+    {
+
+public:
+    /**
+     * Signaled when service status or error changes
+     *
+     * @param aServiceId Id of the service
+     * @param aType Service type
+     * @param aServiceStatus Service status
+     */
+    virtual void ServiceStatusChanged( TInt aServiceId, 
+    								   TCCHSubserviceType aType, 
+                                       const TCchServiceStatus& aServiceStatus ) = 0;
+
+    };
+
+/**
+ *  Class for cch service management
+ *
+ *  CCchService is used for launching various kinds of service functions
+ *  @code
+ *   ?good_class_usage_example(s)
+ *  @endcode
+ *
+ *  @lib ?library
+ */
+class CCchService : public CBase
+    {
+
+public:
+
+    /**
+     * Launches service enable. See MCchServiceObserver for status changes.
+     *
+     * @param aType Type of service
+     * @return Symbian error
+     */
+    virtual TInt Enable( TCCHSubserviceType aType ) = 0;
+    
+    /**
+     * Launches service disable. See MCchServiceObserver for status changes.
+     *
+     * @param aType Type of service
+     * @return Symbian error
+     */
+    virtual TInt Disable( TCCHSubserviceType aType ) = 0;
+    
+    /**
+     * Returns the current service state
+     *
+     * @param aType Type of service
+     * @param aStatus Status of the service, return value
+     * @return Symbian error code
+     */
+    virtual TInt GetStatus( TCCHSubserviceType aType, 
+    						TCchServiceStatus& aStatus ) const = 0;
+    
+    /**
+     * Returns the connection parameters
+     *
+     * @param aType Type of service
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    virtual TInt GetConnectionParameter( TCCHSubserviceType aType,
+    					TCchConnectionParameter aParameter, TInt& aValue ) const = 0;
+    
+    /**
+     * Returns the connection parameters
+     *
+     * @param aType Type of service
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    virtual TInt GetConnectionParameter( TCCHSubserviceType aType, 
+    					TCchConnectionParameter aParameter, RBuf& aValue ) const = 0;
+    
+    /**
+     * Sets the connection parameters
+     *
+     * @param aType The type of service
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    virtual TInt SetConnectionParameter( TCCHSubserviceType aType, 
+    					TCchConnectionParameter aParameter, TInt aValue ) = 0;
+    
+    /**
+     * Sets the connection parameters
+     *
+     * @param aType The type of service
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    virtual TInt SetConnectionParameter( TCCHSubserviceType aType, 
+    					TCchConnectionParameter aParameter, const TDesC& aValue ) = 0;
+    
+    /**
+     * Reserves the service for exclusive usage
+     *
+     * @param aType Type of service
+     * @return Symbian error code
+     */
+    virtual TInt Reserve( TCCHSubserviceType aType ) = 0;
+    
+    /**
+     * Frees the service of exclusive usage
+     *
+     * @param aType Type of service
+     * @return Symbian error code
+     */
+    virtual TInt Free( TCCHSubserviceType aType ) = 0;
+    
+    /**
+     * Is the service reserved
+     *
+     * @param aType Type of service
+     * @param aReserved True if the service is reserved
+     * @return Symbian error code
+     */
+    virtual TInt IsReserved( TCCHSubserviceType aType, TBool& aReserved ) const = 0;
+    
+    /**
+     * Returns the service id
+     *
+     * @return The id of the service
+     */
+    virtual TInt ServiceId() const = 0;
+    
+    /**
+     * @deprecated Do not use this anymore, change to AddObserver!
+     *
+     * Adds observer for listening service events
+     *
+     * @param aObserver Event observing class
+     */
+    virtual void SetObserver( MCchServiceStatusObserver& aObserver ) = 0;
+    
+    /**
+     * @deprecated Do not use this anymore, change to 
+     * RemoveObserver method with paramater
+     * 
+     * Removes the observer of service events
+     */
+    virtual void RemoveObserver( ) = 0;
+
+    /**
+     * Adds observer for listening service events
+     *
+     * @param aObserver Event observing class
+     * @return KErrAlreadyExist Observer already added
+     *         KErrNone Observer was added
+     */
+    virtual TInt AddObserver( MCchServiceStatusObserver& aObserver ) = 0;
+    
+    /**
+     * Removes the observer of service events
+     *
+     * @param aObserver Event observing class
+     * @return KErrNotFound Observer was not found
+     *         KErrNone Observer was removed
+     */
+    virtual TInt RemoveObserver( MCchServiceStatusObserver& aObserver ) = 0;
+    
+    /**
+     * Checks if the type is supported
+     *
+     * @param aType Type of service
+     * @param aSupported True if the service type is supported
+     * @return Symbian error code
+     */
+    virtual TInt IsSupported( TCCHSubserviceType aType, TBool& aSupported ) const = 0;
+
+protected:
+
+    virtual ~CCchService() { };
+    };
+    
+/**
+ *  Class for basic cch functionality, getting services
+ *
+ *  @code
+ *   ?good_class_usage_example(s)
+ *  @endcode
+ *
+ *  @lib cch
+ */
+class CCch : public CBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CCch* NewL();
+    
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CCch* NewLC();
+    
+    /**
+     * Destructor.
+     */
+    ~CCch();
+
+    /**
+     * Returns one service
+     *
+     * @param aId Service id
+     * @return Service or NULL if not found. Ownership is not transferred.
+     */
+    IMPORT_C CCchService* GetService( TInt aId );
+    
+    /**
+     * Returns service ids of all configured services
+     *
+     * @param  aIds Array of TInt to be filled with ids
+     * @return Symbian error code
+     */
+    IMPORT_C TInt GetServiceIds( RArray<TInt>& aIds ) const;
+    
+    /**
+     * Returns services fulfilling the search criteria
+     *
+     * @param aType Service type
+     * @param aServices Array of CCchService to be filled 
+     * @return Symbian error code
+     */
+    IMPORT_C TInt GetServices( TCCHSubserviceType aType, 
+                               RPointerArray<CCchService>& aServices );
+        
+    /**
+     * Returns ETrue if connectivity dialogs are allowed in service enabling.
+     *
+     * @return ETrue if connectivity dialogs are allowed in service enabling
+     */
+    IMPORT_C TBool ConnectivityDialogsAllowed() const;
+       
+    /**
+     * For allowing/disallowing connectivity dialogs showing in 
+     * service enabling.
+     * 
+     * @param aConnectivityDialogsAllowed Boolean to set connectivity dialogs
+     *        allowed/disallowed
+     */ 
+    IMPORT_C void SetConnectivityDialogsAllowed( 
+        TBool aConnectivityDialogsAllowed );
+    
+    /**
+     * For getting cchui api.
+     * 
+     * @return reference to cchui api.
+     */
+    IMPORT_C MCchUi& CchUiApi() const;
+    
+protected:
+
+    /**
+     * The constructor
+     */
+    CCch();
+    
+private:
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private: // data
+
+    /**
+     * Cch client implementation
+     * Own.  
+     */
+	CCchImpl* iImplementation;
+
+#ifdef CCHUI_EUNIT
+    friend class UT_CchUi;
+#endif
+    };
+
+#endif // C_CCH_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_client_api/inc/cchclient.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,308 @@
+/*
+* 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:  RCCHClient declaration
+*
+*/
+
+
+#ifndef R_CCHCLIENT_H
+#define R_CCHCLIENT_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+#include "cchserver.h"
+#include "cchclientserver.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+    
+/**
+ *  RCCHClient declaration.
+ *  A CCH sub-session object. This sub-session provides the functionality
+ *  for CCH.
+ *  @lib cchclient.lib
+ *  @since S60 3.2
+ */
+class RCCHClient : public RSubSessionBase
+    {
+
+public: // Constructors and destructor
+    
+    /**
+     * C++ default constructor
+     */
+    IMPORT_C RCCHClient();
+    
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~RCCHClient();
+
+public: // New functions
+
+    /**
+     * Opens a new sub-session to CCH within an existing session.
+     * @since S60 3.2
+     * @param aRCCHServer Open CCH session
+     * @return General Symbian error code
+     */
+    IMPORT_C TInt Open( const RCCHServer& aRCCHServer );
+    
+    /**
+     * Close sub-session to CCH server
+     * @since S60 3.2
+     */
+    IMPORT_C void Close();
+    
+    /**
+     * Register to server
+     * If CCH server crashes, Symbian will complete this message with KErrServerTerminated,
+     * CCH client is possible to create new handle to CCH server
+     * @since S60 5.0
+     * @param aReqStatus KErrNone if successful, otherwise another of the 
+     * system-wide error codes
+     */
+    IMPORT_C void RegisterToServer( TRequestStatus& aReqStatus ) const;
+
+    /**
+     * Cancel register server request
+     * @since S60 5.0
+     */
+    IMPORT_C void RegisterToServerCancel( ) const;
+    
+    /**
+     * Subscribe to specific service events, if any service's subservices 
+     * status has changed, CCH sends notify to the client. 
+     * @since S60 3.2
+     * @param aServiceSelection Which service's or type of subservices
+     * client wants to be notified, if aServiceSelection iServiceId is zero and
+     * iType is ECCHUnknown then all subservice events are selected
+     * @param aServiceStatus On completion contains selected service's status
+     * @param aReqStatus KErrNone if successful, otherwise another of the 
+     * system-wide error codes
+     */
+    IMPORT_C void SubscribeToEvents( const TServiceSelection& aServiceSelection,
+                                     TPckgBuf<TServiceStatus>& aServiceStatus,
+                                     TRequestStatus& aReqStatus ) const;
+                                     
+    /**
+     * Cancel all subscribe event request.
+     * @since S60 3.2
+     */
+    IMPORT_C void SubscribeToEventsCancel() const;
+      
+    /**
+     * Get services. Client queries for all services and sub-services, 
+     * network scan is performed.
+     * @since S60 3.2
+     * @param aServices On completion contains all services and subservices
+     * @param aReqStatus KErrNone if successful, otherwise another of the 
+     * system-wide error codes
+     */
+    IMPORT_C void GetServicesL( CArrayFixFlat<TCCHService>& aServices,
+                                TRequestStatus& aReqStatus );
+    
+    /**
+     * Get services. Client queries for certain services or type of 
+     * subservices, network scan is not performed.
+     * @since S60 3.2
+     * @param aServiceSelection Which service's or type of subservices
+     * client wants to get, if aServiceSelection iServiceId is zero and 
+     * iType is ECCHUnknown then all services are selected
+     * @param aServices On completion contains all selected service and 
+     * subservices
+     * @param aReqStatus KErrNone if successful, otherwise another of the 
+     * system-wide error codes.
+     */
+    IMPORT_C void GetServicesL( const TServiceSelection& aServiceSelection,
+                                CArrayFixFlat<TCCHService>& aServices,
+                                TRequestStatus& aReqStatus );
+                               
+    /**
+     * Cancel get services request.
+     * @since S60 3.2
+     */
+     IMPORT_C void GetServicesCancel() const;
+                                
+    /**
+     * Client asks for the state of service or subservice of a certain 
+     * service. To perform operation quickly, network scan is not performed.
+     * @since S60 3.2
+     * @param aServiceSelection Which service's state client wants to get.
+     * aServiceSelection's iServiceId and iType are compulsory
+     * @param aState On completion contains selected service's state. 
+     * @return General symbian error code
+     */
+    IMPORT_C TInt GetServiceState( const TServiceSelection& aServiceSelection,
+                                   TCCHSubserviceState& aState ) const;
+          
+    /**
+     * Enable services. All sub-services under the service are enabled.
+     * @since S60 3.2
+     * @param aServiceSelection Which service's or type of subservices
+     * client wants to enable, aServiceSelection's iServiceId and iType 
+     * are compulsory
+     * @param aReqStatus KErrNone if successful, otherwise another of the 
+     * system-wide error codes.
+     * @param aConnectivityCheck If value is True Connectivity Plug-in will
+     * make test call to check is the connection truly working.
+     */
+    IMPORT_C void EnableService( const TServiceSelection& aServiceSelection,
+                                 TRequestStatus& aReqStatus,
+                                 TBool aConnectivityCheck = EFalse ) const;
+                                 
+    /**
+     * Cancel enable services request.
+     * @since S60 3.2
+     */
+    IMPORT_C void EnableServiceCancel() const;                                 
+                                 
+    /**
+     * Client disables service. All sub-services under the service are 
+     * disabled.
+     * @since S60 3.2
+     * @param aServiceSelection Which service's or type of subservices
+     * client wants to disable, aServiceSelection's iServiceId and iType 
+     * are compulsory
+     * @param aReqStatus KErrNone if successful, otherwise another of the 
+     * system-wide error codes.
+     */
+    IMPORT_C void DisableService( const TServiceSelection& aServiceSelection,
+                                  TRequestStatus& aReqStatus ) const;
+                                  
+    /**
+     * Cancel disable service request.
+     * @since S60 3.2
+     */
+    IMPORT_C void DisableServiceCancel() const;                                  
+    
+    /**
+     * Get service specifics information about service and protocol
+     * @since S60 3.2
+     * @param aServiceSelection Which service's or type of subservices
+     * client wants get service information, aServiceSelection's iServiceId 
+     * and iType are compulsory
+     * @param aBuffer On completion contains selected service's protocol
+     * information, aBuffer's max length is in KCCHMaxProtocolNameLength
+     * which is defined in CCHClientServer.h-file
+     * @return General symbian error code.  
+     */
+    IMPORT_C TInt GetServiceInfo( const TServiceSelection& aServiceSelection,
+                                  TDes& aBuffer ) const;
+    
+    /**
+     * Client set's connection information of sub-service of a certain 
+     * service.
+     * @since S60 3.2
+     * @param aServiceConnInfo Service where client wants to set connection
+     * information. Note that iSNAPLocked is read only.
+     * @param aReqStatus KErrNone if successful, otherwise another of the 
+     * system-wide error codes.
+     */
+    IMPORT_C void SetConnectionInfo( 
+        const TPckgBuf<TServiceConnectionInfo>& aServiceConnInfo,
+        TRequestStatus& aReqStatus );
+                                     
+    /**
+     * Cancel set connection information request.
+     * @since S60 3.2
+     */
+    IMPORT_C void SetConnectionInfoCancel() const;                                     
+                                     
+    /**
+     * Client ask connection information of subservice of a certain service.
+     * @since S60 3.2
+     * @param aServiceSelection Service which client wants to get connection 
+     * information, aServiceSelection's iServiceId and iType are compulsory
+     * @param aServiceConnInfo On completion contains selected service's 
+     * connection information
+     * @param aReqStatus KErrNone if successful, otherwise another of the 
+     * system-wide error codes.
+     */
+    IMPORT_C void GetConnectionInfo( 
+        const TServiceSelection& aServiceSelection,
+        TPckgBuf<TServiceConnectionInfo>& aServiceConnInfo,
+        TRequestStatus& aReqStatus ) const;
+                                     
+    /**
+     * Cancel get connection information request.
+     * @since S60 3.2
+     */
+    IMPORT_C void GetConnectionInfoCancel() const;
+    
+    /**
+     * Client asks for exclusive reservation of the service e.g. to block 
+     * ALR during a VoIP call
+     * @since S60 3.2
+     * @param aServiceSelection Which service client wants to reserve.
+     * aServiceSelection's iServiceId and iType are compulsory
+     * @param aReqStatus KErrNone if successful, otherwise another of the 
+     * system-wide error codes.
+     */
+    IMPORT_C TInt ReserveService( const TServiceSelection& aServiceSelection );
+    
+    /**
+     * Client asks to free the exclusive service reservation.
+     * @since S60 3.2
+     * @param aServiceSelection Which service client wants to free.
+     * aServiceSelection's iServiceId and iType are compulsory
+     * @param aReqStatus KErrNone if successful, otherwise another of the 
+     * system-wide error codes.
+     */
+    IMPORT_C TInt FreeService( const TServiceSelection& aServiceSelection );
+    
+    /**
+     * Returns service's reservation status.
+     * @since S60 3.2
+     * @param aServiceSelection Which service's reference count client wants 
+     * to get.
+     * aServiceSelection's iServiceId and iType are compulsory
+     * @return Reservation status
+     */
+    IMPORT_C TBool IsReserved( const TServiceSelection& aServiceSelection ) 
+                    const;
+    
+private:
+
+    // Prohibit copy constructor if not deriving from CBase.
+    RCCHClient( const RCCHClient& );
+
+    // Prohibit assigment operator if not deriving from CBase.
+    RCCHClient& operator=( const RCCHClient& );                                        
+    
+private:
+
+    TPtr8* iService;   
+    
+    };
+
+#endif // R_CCHCLIENT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_client_api/inc/cchclientserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,210 @@
+/*
+* 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:  CCH Client / Server common interface header
+*
+*/
+
+
+
+#ifndef T_CCHCLIENTSERVER_H
+#define T_CCHCLIENTSERVER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <ccherror.h>
+#include <cchtypes.h>
+// CONSTANTS
+const TUint KCCHMaxServiceNameLength  = 64; 
+const TUint KCCHMaxSubservicesCount   = 4;
+const TUint KCCHMaxProtocolNameLength = 512; 
+const TUint KCCHMaxUsernameLength = 128;
+const TUint KCCHMaxPasswordLength = 64;
+  
+  
+// CLASS DECLARATION
+class TServiceSelection
+    {
+public:
+    inline TServiceSelection();
+    inline TServiceSelection( TUint aServiceId, 
+                      TCCHSubserviceType aType,
+                      TCchConnectionParameter aParameter = ECchInitial );
+public:
+    /**
+     * Service Id
+     */
+    TUint                   iServiceId;
+    /**
+     * Subservice's type
+     */
+    TCCHSubserviceType      iType;
+    /**
+     * Identifies operation target for get/set.
+     */
+    TCchConnectionParameter iParameter;
+    };
+    
+class TServiceConnectionInfo
+    {
+public:
+    inline TServiceConnectionInfo();
+    inline TServiceConnectionInfo( TUint aServiceId, 
+                                   TCCHSubserviceType aType, 
+                                   TUint32 aIapId, 
+                                   TUint32 aSNAPId );
+
+    inline TServiceConnectionInfo( TUint aServiceId, 
+                                   TCCHSubserviceType aType, 
+                                   TUint32 aIapId, 
+                                   TUint32 aSNAPId,
+                                   TDesC& aUsername,
+                                   TDesC& aPassword );
+    inline TUint ServiceId() const;
+    inline TCCHSubserviceType Type() const;
+    inline void SetServiceId( TUint aServiceId );
+    inline void SetType( TCCHSubserviceType aType );
+    inline void SetParameter( TCchConnectionParameter aParameter );
+    
+public:    
+    /**
+     * Service Id
+     */
+    TServiceSelection       iServiceSelection;
+    /**
+     * Service's SNAP Id
+     */
+    TUint32                 iSNAPId;
+    /**
+     * Services IAP Id
+     */
+    TUint32                 iIapId;
+     /**
+     * Is SNAP editable, read only
+     */
+    TBool                   iSNAPLocked;
+    /**
+    * Is password set.
+    */
+    TBool                   iPasswordSet;
+
+    /**
+     * Username
+     */
+    TBuf<KCCHMaxUsernameLength> iUsername;
+
+    /**
+     * Password
+     */
+    TBuf<KCCHMaxPasswordLength> iPassword;
+    
+    /**
+    * Reserved, obsolote. When adding next new parameter (TInt)
+    * rename Reserved to that, implementation is ready then.
+    */
+    TBool                   iReserved;
+    
+    };
+
+class TServiceStatus
+    {
+public:
+    inline TServiceStatus();
+    inline TUint ServiceId() const;
+    inline TCCHSubserviceType Type() const;
+    inline TUint32 IapId() const;
+    inline TUint32 SNAPId() const;
+    inline TBool SNAPLocked() const;
+    inline TBool PasswordSet() const;
+    inline void SetServiceId( TUint aServiceId );
+    inline void SetType( TCCHSubserviceType aType );
+    inline void SetIapId( TUint32 aIapId );
+    inline void SetSNAPId( TUint32 aSNAPId );
+    inline void SetSNAPLocked( TBool aSNAPLocked );
+public:
+    /**
+     * Service Id
+     */
+    TServiceConnectionInfo  iConnectionInfo;
+    /**
+     * Current state of subservice
+     */
+    TCCHSubserviceState     iState;
+    /**
+     * Current error code of subservice
+     */
+    TInt                    iError;
+    };
+
+class TCCHSubservice
+    {
+public:
+    inline TCCHSubservice();
+    inline TUint ServiceId() const;
+    inline TCCHSubserviceType Type() const;
+    inline TUint32 IapId() const;
+    inline TUint32 SNAPId() const;
+    inline TBool SNAPLocked() const;
+    inline void SetServiceId( TUint aServiceId );
+    inline void SetType( TCCHSubserviceType aType );
+    inline void SetIapId( TUint32 aIapId );
+    inline void SetSNAPId( TUint32 aSNAPId );
+    inline void SetSNAPLocked( TBool aSNAPLocked );
+public:
+    /**
+     * Service Id
+     */
+    TServiceConnectionInfo          iConnectionInfo;
+    /**
+     * Subservice's Id
+     */
+    TUint                           iSubserviceId;
+    /**
+     * Current state of subservice
+     */
+    TCCHSubserviceState             iState;
+    /**
+     * Subservice's name
+     */
+    TBuf<KCCHMaxServiceNameLength>  iSubserviceName;
+    /**
+     * Current error code of subservice
+     */
+    TInt                            iError;
+    };
+
+class TCCHService
+    {
+public:
+    inline TCCHService();
+
+public:
+    /**
+     * Service Id
+     */
+    TUint                                   iServiceId;
+    /**
+     * Service's name
+     */
+    TBuf<KCCHMaxServiceNameLength>          iServiceName;
+    /**
+     * Service's subservices
+     */
+    TFixedArray<TCCHSubservice, KCCHMaxSubservicesCount>    iSubservices;
+    };
+
+#include "cchclientserver.inl"
+
+#endif // T_CCHCLIENTSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_client_api/inc/cchclientserver.inl	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,254 @@
+/*
+* 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:  Inline functions for ClientServer
+*
+*/
+
+
+// --------------------------------------------------------------------------
+// TCCHService::TCCHService
+// --------------------------------------------------------------------------
+//
+inline TCCHService::TCCHService()
+    {
+    iServiceId      = 0;
+    }
+
+// --------------------------------------------------------------------------
+// TCCHSubservice::TCCHSubservice
+// --------------------------------------------------------------------------
+//
+inline TCCHSubservice::TCCHSubservice()
+    {
+    iConnectionInfo.iServiceSelection.iServiceId = 0;
+    iConnectionInfo.iServiceSelection.iType      = ECCHUnknown;
+    iConnectionInfo.iIapId                       = 0;
+    iConnectionInfo.iSNAPId                      = 0;
+    iConnectionInfo.iSNAPLocked                  = EFalse;
+    iConnectionInfo.iPasswordSet                  = EFalse;
+    iConnectionInfo.iUsername.Zero();
+    iConnectionInfo.iPassword.Zero();
+    iSubserviceId                                = 0;
+    iState                                       = ECCHUninitialized;
+    iError                                       = KErrNone;
+    }
+
+inline TUint TCCHSubservice::ServiceId() const
+    {
+    return iConnectionInfo.iServiceSelection.iServiceId;    
+    }
+    
+inline TCCHSubserviceType TCCHSubservice::Type() const
+    {
+    return iConnectionInfo.iServiceSelection.iType;     
+    }
+
+inline void TCCHSubservice::SetServiceId( TUint aServiceId )
+    {
+    iConnectionInfo.iServiceSelection.iServiceId = aServiceId;    
+    }
+    
+inline void TCCHSubservice::SetType( TCCHSubserviceType aType )
+    {
+    iConnectionInfo.iServiceSelection.iType      = aType; 
+    }
+
+inline TUint32 TCCHSubservice::IapId() const
+    {
+    return iConnectionInfo.iIapId;    
+    }
+    
+inline TUint32 TCCHSubservice::SNAPId() const
+    {
+    return iConnectionInfo.iSNAPId;     
+    }
+    
+inline TBool TCCHSubservice::SNAPLocked() const
+    {
+    return iConnectionInfo.iSNAPLocked;     
+    }
+
+inline void TCCHSubservice::SetIapId( TUint32 aIapId )
+    {
+    iConnectionInfo.iIapId = aIapId;    
+    }
+    
+inline void TCCHSubservice::SetSNAPId( TUint32 aSNAPId)
+    {
+    iConnectionInfo.iSNAPId = aSNAPId;     
+    }
+    
+inline void TCCHSubservice::SetSNAPLocked( TBool aSNAPLocked )
+    {
+    iConnectionInfo.iSNAPLocked = aSNAPLocked;     
+    }
+
+// --------------------------------------------------------------------------
+// TServiceStatus::TServiceStatus
+// --------------------------------------------------------------------------
+//
+inline TServiceStatus::TServiceStatus()
+    {
+    iConnectionInfo.iServiceSelection.iServiceId = 0;
+    iConnectionInfo.iServiceSelection.iType      = ECCHUnknown;
+    iConnectionInfo.iIapId                       = 0;
+    iConnectionInfo.iSNAPId                      = 0;
+    iConnectionInfo.iSNAPLocked                  = EFalse;
+    iConnectionInfo.iUsername.Zero();
+    iConnectionInfo.iPassword.Zero();
+    iState                                       = ECCHUninitialized;
+    iError                                       = KErrNone;
+    }
+
+inline TUint TServiceStatus::ServiceId() const
+    {
+    return iConnectionInfo.iServiceSelection.iServiceId;    
+    }
+    
+inline TCCHSubserviceType TServiceStatus::Type() const
+    {
+    return iConnectionInfo.iServiceSelection.iType;     
+    }
+
+inline void TServiceStatus::SetServiceId( TUint aServiceId )
+    {
+    iConnectionInfo.iServiceSelection.iServiceId = aServiceId;    
+    }
+    
+inline void TServiceStatus::SetType( TCCHSubserviceType aType )
+    {
+    iConnectionInfo.iServiceSelection.iType      = aType; 
+    }
+
+inline TUint32 TServiceStatus::IapId() const
+    {
+    return iConnectionInfo.iIapId;    
+    }
+    
+inline TUint32 TServiceStatus::SNAPId() const
+    {
+    return iConnectionInfo.iSNAPId;     
+    }
+    
+inline TBool TServiceStatus::SNAPLocked() const
+    {
+    return iConnectionInfo.iSNAPLocked;     
+    }
+inline TBool TServiceStatus::PasswordSet() const
+    {
+    return iConnectionInfo.iPasswordSet;     
+    }
+
+inline void TServiceStatus::SetIapId( TUint32 aIapId )
+    {
+    iConnectionInfo.iIapId = aIapId;    
+    }
+    
+inline void TServiceStatus::SetSNAPId( TUint32 aSNAPId)
+    {
+    iConnectionInfo.iSNAPId = aSNAPId;     
+    }
+    
+inline void TServiceStatus::SetSNAPLocked( TBool aSNAPLocked )
+    {
+    iConnectionInfo.iSNAPLocked = aSNAPLocked;     
+    }
+        
+// --------------------------------------------------------------------------
+// TServiceSelection::TServiceSelection
+// --------------------------------------------------------------------------
+//
+inline TServiceSelection::TServiceSelection()
+    {
+    iServiceId      = 0;
+    iType           = ECCHUnknown;
+    iParameter      = ECchInitial;
+    }
+
+inline TServiceSelection::TServiceSelection( TUint aServiceId, 
+                                             TCCHSubserviceType aType,
+                                             TCchConnectionParameter aParameter )
+    {
+    iServiceId      = aServiceId;
+    iType           = aType;
+    iParameter      = aParameter;
+    }
+
+// --------------------------------------------------------------------------
+// TServiceConnectionInfo::TServiceConnectionInfo
+// --------------------------------------------------------------------------
+//
+inline TServiceConnectionInfo::TServiceConnectionInfo()
+    {
+    iServiceSelection.iServiceId = 0;
+    iServiceSelection.iType      = ECCHUnknown;
+    iSNAPId                      = 0;
+    iIapId                       = 0;
+    iSNAPLocked                  = EFalse;
+    iUsername.Zero();
+    iPassword.Zero();
+    }
+
+inline TServiceConnectionInfo::TServiceConnectionInfo( TUint aServiceId, 
+                                                       TCCHSubserviceType aType,
+                                                       TUint32 aIapId, 
+                                                       TUint32 aSNAPId )
+    {
+    iServiceSelection.iServiceId = aServiceId;
+    iServiceSelection.iType      = aType;
+    iSNAPId                      = aSNAPId;
+    iIapId                       = aIapId;
+    iSNAPLocked                  = EFalse;
+    iPasswordSet                 = EFalse;
+    }
+
+inline TServiceConnectionInfo::TServiceConnectionInfo( TUint aServiceId, 
+                                                       TCCHSubserviceType aType,
+                                                       TUint32 aIapId, 
+                                                       TUint32 aSNAPId,
+                                                       TDesC& aUsername,
+                                                       TDesC& aPassword )
+    {
+    iServiceSelection.iServiceId = aServiceId;
+    iServiceSelection.iType      = aType;
+    iSNAPId                      = aSNAPId;
+    iIapId                       = aIapId;
+    iSNAPLocked                  = EFalse;
+    iUsername.Append( aUsername );
+    iPassword.Append( aPassword );
+    }
+inline TUint TServiceConnectionInfo::ServiceId() const
+    {
+    return iServiceSelection.iServiceId;    
+    }
+    
+inline TCCHSubserviceType TServiceConnectionInfo::Type() const
+    {
+    return iServiceSelection.iType;     
+    }
+
+inline void TServiceConnectionInfo::SetServiceId( TUint aServiceId )
+    {
+    iServiceSelection.iServiceId = aServiceId;    
+    }
+    
+inline void TServiceConnectionInfo::SetType( TCCHSubserviceType aType )
+    {
+    iServiceSelection.iType      = aType; 
+    }
+    
+inline void TServiceConnectionInfo::SetParameter( TCchConnectionParameter aParameter )
+    {
+    iServiceSelection.iParameter = aParameter;    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_client_api/inc/ccherror.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  CCH error declaration
+*
+*/
+
+
+#ifndef K_CCHERROR_H
+#define K_CCHERROR_H
+
+const TInt KCCHErrorInvalidIap             ( -32750 );
+const TInt KCCHErrorNetworkLost            ( -32751 );
+const TInt KCCHErrorLoginFailed            ( -32752 );
+const TInt KCCHErrorAuthenticationFailed   ( -32753 );
+const TInt KCCHErrorServiceNotResponding   ( -32754 );
+const TInt KCCHErrorBandwidthInsufficient  ( -32755 );
+const TInt KCCHErrorInvalidSettings        ( -32756 );
+const TInt KCCHErrorAccessPointNotDefined  ( -32757 );
+
+#endif // K_CCHERROR_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_client_api/inc/cchserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,123 @@
+/*
+* 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:  RCCHServer declaration
+*
+*/
+
+
+#ifndef R_CCHSERVER_H
+#define R_CCHSERVER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+/** @file CCHServer.h
+ * API to access Converged Connection Handler server functionalities.
+ * 
+ * Client uses RCCHServer and RCCHClient classes to create client-server 
+ * connection to Converged Connection Handler server. After successful 
+ * connection client can access server functionalities trought RCCHClient. 
+ * 
+ * 
+ * Example usage of API:  
+ * @code
+ * // Creating connection and subsession to server
+ * #include <cchclient.h>
+ * #include <cchserver.h>
+ * 
+ * RCCHServer  iServer;
+ * RCCHClient  iClient;
+ * 
+ * iServer = new (ELeave) RCCHServer();
+ * iClient = new (ELeave) RCCHClient();
+ * 
+ * // Start CCHServer and open session
+ * User::LeaveIfError( iServer->Connect() );
+ * // Open subsession
+ * User::LeaveIfError( iClient->Open( *iServer ) );
+ * ...
+ * @endcode
+ */
+  
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+    
+/**
+ *  RCCHServer declaration
+ *  This class hides inter-thread communication between client
+ *  and server. Hides also asynchronous notification services.
+ *  @lib cchclient.lib
+ *  @since S60 3.2
+ */
+class RCCHServer : public RSessionBase
+    {
+
+public: // Constructors and destructor
+    
+    /**
+     * C++ default constructor
+     */
+    IMPORT_C RCCHServer();
+
+public: // New functions
+
+    /**
+     * Connect to CCH server
+     * @since S60 3.2
+     * @return General Symbian error code
+     */
+    IMPORT_C TInt Connect();
+    
+    /**
+     * Disconnect from CCH server
+     * @since S60 3.2
+     */
+    IMPORT_C void Disconnect();
+    
+    /**
+     * Get version information
+     * @since S60 3.2
+     * @return Version information
+     */
+    TVersion Version() const;
+
+protected:  // New functions
+        
+    /**
+     * Start the server during Connect() if the server is not loaded.
+     * @since S60 3.2
+     * @return General Symbian error code.
+     */
+    TInt StartServer() const;
+
+    };
+
+#endif // R_CCHSERVER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_client_api/inc/cchtypes.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* 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:  Cch basic types
+*
+*/
+
+
+
+#ifndef CCHTYPES_H
+#define CCHTYPES_H
+
+/**
+ * Subservice types
+ */
+enum TCCHSubserviceType
+    {
+    ECCHUnknown = 0,
+    ECCHVoIPSub,
+    ECCHPresenceSub,
+    ECCHIMSub,
+    ECCHVMBxSub
+    };
+
+/**
+ * State of subservice
+ */
+enum TCCHSubserviceState
+    {
+    ECCHUninitialized = 0,
+    ECCHDisabled,
+    ECCHConnecting,
+    ECCHEnabled,
+    ECCHDisconnecting
+    };
+
+/**
+ * State of subservice
+ */
+enum TCchConnectionParameter
+    {
+    ECchInitial = 0,    // Type TInt, initial value
+    ECchIapId,          // Type TInt, read/write 
+    ECchSnapId,         // Type TInt, read/write
+    ECchServiceInfo,    // Type Describtor, read only
+    ECchSnapLocked,     // Type TInt, read only
+    ECchUsername,       // Type Describtor, read/write, 
+                        // TCCHSubserviceType ECCHUnknown has to be used for ECchUsername
+    ECchPassword,       // Type Describtor, write only
+                        // TCCHSubserviceType ECCHUnknown has to be used for ECchUsername
+    ECchPasswordSet,    // Type TInt, read. True if password has been set, else false.
+    ECchReserved         // Type TInt, read/write. Reserved (obsolote) When adding next new parameter  
+                         // rename Reserved to that, implementation is ready then.   
+    };    
+
+#endif // CCHTYPES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_client_api/inc/cchui.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,173 @@
+/*
+* 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:  This file contains the header file of the MCchUi class.
+*
+*/
+
+
+#ifndef M_CCHUI_H
+#define M_CCHUI_H
+
+#include <cch.h>
+#include <cchuiobserver.h>
+
+/**
+ *  Virtual interface of cchui.
+ *
+ *  @code
+ *   // One way to use CCHUI API is to configure which notes it shows
+ *   // and after that do normal enable through CCH
+ *   iCch = CCch::NewL();
+ *   
+ *   // Allow connectivity notes to be shown when enabling service
+ *   iCch->SetConnectivityDialogsAllowed( ETrue );
+ * 
+ *   // Get handle to cchui api
+ *   iCchUi = &iCch->CchUiApi(); // iCchUi is pointer to MCchUi
+ * 
+ *   // Set observer to listen cchui events.
+ *   iCchUi->AddObserverL( *this );  // parameter is MCchUiObserver
+ *   
+ *   // Configure CCHUI API to show all notes/dialogs except connecting note.
+ *   // Also configure that only VoIP and IM subservices are allowed (notes are
+ *   // shown only for those).
+ *   RArray<MCchUiObserver::TCchUiDialogType> allowedNotes;
+ *   RArray<MCchUiObserver::TCchUiDialogType> allowedSubServices;
+ *   CleanupClosePushL( allowedNotes );
+ *   CleanupClosePushL( allowedSubServices );
+ * 
+ *   allowedNotes.AppendL( MCchUiObserver::ECchUiDialogTypeAuthenticationFailed );
+ *   allowedNotes.AppendL( MCchUiObserver::ECchUiDialogTypeNoConnectionDefined );
+ *   allowedNotes.AppendL( MCchUiObserver::ECchUiDialogTypeNoConnectionAvailable );
+ *   allowedNotes.AppendL( MCchUiObserver::ECchUiDialogTypeChangeConnection );
+ *   allowedNotes.AppendL( MCchUiObserver::ECchUiDialogTypeDefectiveSettings );     
+ *   
+ *   allowedSubServices.AppendL( ECCHVoIPSub );
+ *   allowedSubServices.AppendL( ECCHIMSub );
+ * 
+ *   iCchUi->ConfigureVisualizationL( 
+ *       allowedNotes, allowedSubServices );
+ *   
+ *   CleanupStack::PopAndDestroy( &allowedNotes );
+ *   
+ *   CCchService* service = iCch->GetService( serviceId );
+ *   service->Enable( ECCHUnknown );
+ * 
+ * 
+ * 
+ * 
+ *   // Another way to use CCHUI API is to just show specific notes.
+ *   iCch = CCch::NewL();
+ *   
+ *   // Get handle to cchui api
+ *   iCchUi = &iCch->CchUiApi(); // iCchUi is pointer to MCchUi
+ * 
+ *   // Set observer to listen cchui events.
+ *   iCchUi->AddObserverL( *this );  // parameter is MCchUiObserver
+ * 
+ *   // Show connecting dialog.
+ *   iCchUi->ShowDialogL( 
+ *       serviceId, 
+ *       MCchUiObserver::ECchUiDialogTypeConnecting );
+ * 
+ *   // disable note by cancelling
+ *   iCchUi->CancelNotes();
+ * 
+ *   // Remove observer
+ *   iCchUi->RemoveObserver();  
+ * 
+ *  @endcode
+ * 
+ *  @lib cch.lib
+ *  @since S60 5.0
+ */
+class MCchUi
+    {
+    public:
+        /**
+        * destructor
+        */
+        virtual ~MCchUi( ) {};
+        
+    public:
+        
+        /**
+         * Adds observer for listening cchui events.
+         *
+         * @since S60 5.0
+         * @param aObserver Event observing class
+         */
+        virtual void AddObserverL( MCchUiObserver& aObserver ) = 0;
+        
+        /**
+         * Removes the observer of cchui events.
+         * 
+         * @since S60 5.0
+         * @param aObserver Event observing class
+         */
+        virtual void RemoveObserver( MCchUiObserver& aObserver ) = 0;
+        
+        /**
+         * Shows global note/dialog. See observer definition for available notes. 
+         *
+         * @since S60 5.0
+         * @param aServiceId service id of the service that the dialog is 
+         *        shown for. Service id is used to fetch service specific data.
+         * @param aDialog defines which dialog is shown.
+         * @leave KErrAlreadyExists Failed to show dialog because another 
+         * note already shown.
+         */
+        virtual void ShowDialogL( 
+            TUint32 aServiceId, 
+            MCchUiObserver::TCchUiDialogType aDialog ) = 0;
+           
+        /**
+         * Allows client to configure visualization of connectivity events. This
+         * only effects the automatically shown connectivity notes. Client can
+         * still use seperate methods in this API to show specific notes by
+         * itself. 
+         * 
+         * By default all notes are allowed.
+         *
+         * @since S60 5.0
+         * @param aAllowedNotes array of allowed notes
+         */
+        virtual void ConfigureVisualizationL( 
+            RArray<MCchUiObserver::TCchUiDialogType>& aAllowedNotes,
+            RArray<TCCHSubserviceType>& aAllowedSubServices ) = 0;    
+           
+        /**
+         * Cancels all notes shown by CCH UI. 
+         * If there is nothing to dismiss, call to this method does nothing.
+         *
+         * @since S60 5.0
+         */
+        virtual void CancelNotes() = 0;         
+           
+        /**
+         * Reserved for future use.
+         *
+         * @since S60 5.0
+         */    
+        virtual void Reserved1() = 0;         
+
+        /**
+         * Reserved for future use.
+         *
+         * @since S60 5.0
+         */    
+        virtual void Reserved2() = 0;
+    };
+
+#endif // M_CCHUI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_client_api/inc/cchuiobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,117 @@
+/*
+* 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:  Observer definition for CCH UI clients
+*
+*/
+
+
+#ifndef M_CCHUIOBSERVER_H
+#define M_CCHUIOBSERVER_H
+
+/**
+ *  CCH UI Observer declaration class.
+ *
+ *  This class defines observer implementation for the CCH UI
+ *  clients. Every client must derive this class in order to
+ *  be able to use services provided by CCH UI and to be able
+ *  to receive observer callbacks.
+ *  @code
+ *  inherit in header:
+ *  class CMyClass : public CBase, public MCchUiObserver
+ *  @endcode
+ *
+ *  @lib cch.lib
+ *  @since S60 5.0
+ */
+class MCchUiObserver
+    {
+public:
+
+    /**  Defines dialog types available through this API */
+    enum TCchUiDialogType
+    	{
+    	ECchUiDialogTypeNotSet,
+    	// For connecting note showing
+    	ECchUiDialogTypeConnecting,
+    	// For disconnecting note showing
+        ECchUiDialogTypeDisconnecting,
+        // For showing info note about invalid username/password.
+        // Will also automatically show username/password query after
+        // showing info note.
+        ECchUiDialogTypeUsernamePasswordFailed,
+        // For showing username/password query.
+    	ECchUiDialogTypeAuthenticationFailed,
+    	// For showing no connections defined query. When user inputs
+    	// username/password and accepts query, CCHUI will save them
+    	// and also will re-enable service.
+    	ECchUiDialogTypeNoConnectionDefined,    
+    	// For showing no connections available query. When user selects
+    	// new access point, CCHUI adds it to service´s SNAP and re-enables
+    	// service automatically.
+    	ECchUiDialogTypeNoConnectionAvailable,   
+    	// For showing confirmation query to change connection.
+    	// Will show automatically also change connection query if
+    	// confirmation query accepted by user.
+    	ECchUiDialogTypeConfirmChangeConnection,
+    	// For showing change connection query. When user selects
+    	// new access point, CCHUI add it to service´s SNAP and re-enables
+    	// service. CCHUI will also delete old access point from service´s
+    	// SNAP if access point is not used by other service(s).
+    	ECchUiDialogTypeChangeConnection,
+    	// For showing defective settings info note.
+    	ECchUiDialogTypeDefectiveSettings,
+    	// For showing error in connection info note.
+    	// Will show automatically also confirm change connection query
+    	// and confirmation query is accepted by user, change connection
+    	// query is showed also.
+    	ECchUiDialogTypeErrorInConnection
+    	};
+    	
+    /**  Defines operation results ie. indicates what have been done. 
+         Client can implement handling based on these on callback. */
+    enum TCchUiOperationResult
+    	{
+    	// Operation result not set
+    	ECchUiClientOperationResultNotSet,
+    	// User has cancelled query.
+    	ECchUiClientOperationResultUserCancelled,
+    	// Failure that prevents enabling service has happened.
+    	ECchUiClientOperationResultGeneralFailure,
+    	// CCHUI has added new access point to service´s SNAP.
+    	ECchUiClientOperationResultAccessPointAdded,
+    	// CCHUI has added new access point to service´s SNAP. 
+    	// CCHUI has also removed previously used access point from
+    	// service´s SNAP if it was not used by other service(s).
+    	ECchUiClientOperationResultConnectionChanged,
+    	// CCHUI has saved new username/password for service
+    	ECchUiClientOperationResultCredentialsChanged
+    	};
+        
+    /**
+     * Gets called when cchui has finished showing connectivity dialogs
+     * and possible connectivity related operations based on user
+     * actions in those dialogs. 
+     *
+     * @since S60 5.0
+     * @param aServiceId Service id.
+     * @param aServiceState Service state after cchui operations.
+     * @param aOperationResult Contains last cchui operation.
+     * @return None
+     */
+    virtual void ConnectivityDialogsCompletedL(
+        TInt aServiceId, 
+        TCchUiOperationResult aOperationResult ) = 0;
+    };
+
+#endif // M_CCHUIOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_server_api/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* 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:  File that exports the files belonging to 
+:                cchserver api
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/cchservice.h             MW_LAYER_PLATFORM_EXPORT_PATH( cchservice.h )
+../inc/cchservice.inl           MW_LAYER_PLATFORM_EXPORT_PATH( cchservice.inl )
+../inc/cchserviceobserver.h     MW_LAYER_PLATFORM_EXPORT_PATH( cchserviceobserver.h )
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_server_api/inc/cchservice.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  
+*
+*/
+
+
+#ifndef C_CCHSERVICE_H
+#define C_CCHSERVICE_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <ecom/ecom.h>
+#include <cchclientserver.h>
+
+#include "cchserviceobserver.h"
+
+
+// CONSTANTS
+/** Interface UID of this ECOM interface*/
+const TUid KCCHConnectivityPluginIFUid = { 0x10275457 };
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+    
+/**
+ *  CCchService declaration.
+ *  CCH service connectivity plug-in API.
+ *  @since S60 3.2
+ */
+class CCchService : public CBase
+    {
+    
+public:
+
+    static CCchService* NewL( TUid aImplementationUid,
+                              MCchServiceObserver& aCCHObserver );
+
+    
+    virtual inline ~CCchService();
+    
+    /**
+     * Client enables service. CCHService implementation
+     * should use MCCHServiceObserver for service state notifications.
+     * @since S60 3.2
+     * @param aServiceSelection Selected service, ID and type
+     */
+    virtual void EnableServiceL( const TServiceSelection& aServiceSelection ) = 0;
+                                 
+    /**
+     * Client enables service. CCHService implementation
+     * should use MCCHServiceObserver for service state notifications.
+     * @since S60 3.2
+     * @param aServiceSelection Selected service, ID and type
+     * @param aIapId
+     */
+    virtual void EnableServiceL( const TServiceSelection& aServiceSelection, 
+                                 TUint aIapId ) = 0;
+   
+    /**
+     * Client disables service. 
+     * @since S60 3.2
+     * @param aServiceSelection Selected service, ID and type
+     */
+    virtual void DisableServiceL( const TServiceSelection& aServiceSelection  ) = 0;
+    
+    /**
+     * Client checks is the service available by the IAP id array.
+     * CCHService implementation should return ETrue if service is
+     * registrable by the (some) IAP, array contains. 
+     * @since S60 3.2
+     * @param aServiceSelection Selected service, ID and type
+     * @param aIapIdArray Id array of the currently available iaps.
+     * @return ETrue if service is available.
+     */
+    virtual TBool IsAvailableL( const TServiceSelection& aServiceSelection,
+                                const RArray<TUint32>& aIapIdArray ) const = 0;
+    
+    /**
+     * Get service state information.
+     * @since S60 3.2
+     * @param aServiceSelection Selected service, ID and type
+     * @param aState Current service state.
+     * @return General symbian error code.
+     */
+    virtual TInt GetServiceState( const TServiceSelection& aServiceSelection, 
+                                  TCCHSubserviceState& aState ) const = 0;
+    
+    /**
+     * Get service network information.
+     * @since S60 3.2
+     * @param aConnectionInfo Selected service, ID and type, used 
+     *               SNAP id (should be set as null if not in use),
+     *               used IAP id (should be set as null if not in use),
+     *               SNAP locked indicator
+     * @return General symbian error code.
+     */
+    virtual TInt GetServiceNetworkInfo( TServiceConnectionInfo& aConnectionInfo ) const = 0;
+                                        
+    /**
+     * Set SNAP id for service.
+     * @since S60 3.2
+     * @param aServiceSelection Selected service, ID and type
+     * @param aSnapId 
+     * @return General symbian error code.
+     */
+    virtual TInt SetSnapId( const TServiceSelection& aServiceSelection,
+                            TUint aSnapId ) = 0;
+                            
+    /**
+     * Set IAP id for service.
+     * @since S60 3.2
+     * @param aServiceSelection Selected service, ID and type
+     * @param aIapId 
+     * @return General symbian error code.
+     */
+    virtual TInt SetIapId( const TServiceSelection& aServiceSelection,
+                           TUint aIapId ) = 0;                               
+    
+    /**
+     * Get service specifics information about service and protocol
+     * @since S60 3.2
+     * @param aServiceSelection Selected service, ID and type
+     */
+    virtual void GetServiceInfoL( const TServiceSelection& aServiceSelection,
+                                  RBuf& aBuffer ) const = 0;
+                                  
+    /**
+     * Reserves the service for exclusive use
+     * @since S60 3.2
+     * @param aServiceSelection Selected service, ID and type
+     * @return General symbian error code.
+     */
+    virtual TInt ReserveService( const TServiceSelection& aServiceSelection ) = 0;
+
+    /**
+     * Frees the exclusive service reservation
+     * @since S60 3.2
+     * @param aServiceSelection Selected service, ID and type
+     * @return General symbian error code.
+     */
+    virtual TInt FreeService( const TServiceSelection& aServiceSelection ) = 0;
+    
+    /**
+     * Is the service reserved
+     * @since S60 3.2
+     * @param aServiceSelection Selected service, ID and type
+     * @return TBool 
+     */
+    virtual TBool IsReserved( const TServiceSelection& aServiceSelection ) const = 0;
+
+    /**
+     * Returns the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    virtual TInt GetConnectionParameter( 
+                         const TServiceSelection& aServiceSelection,
+                         TCchConnectionParameter aParameter,
+                         TInt& aValue ) const = 0;
+    
+    /**
+     * Returns the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    virtual TInt GetConnectionParameter(  
+                         const TServiceSelection& aServiceSelection, 
+                         TCchConnectionParameter aParameter,
+                         RBuf& aValue ) const = 0;
+    
+    /**
+     * Sets the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    virtual TInt SetConnectionParameter(  
+                         const TServiceSelection& aServiceSelection, 
+                         TCchConnectionParameter aParameter,
+                         TInt aValue ) = 0;
+    
+    /**
+     * Sets the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    virtual TInt SetConnectionParameter(  
+                         const TServiceSelection& aServiceSelection, 
+                         TCchConnectionParameter aParameter,
+                         const TDesC& aValue ) = 0;
+
+public: // Data
+
+    /// Unique key for implementations of this interface.
+    TUid iInstanceKey;
+
+protected: // Constructors 
+
+    inline CCchService();
+    
+    };
+
+#include "cchservice.inl"
+
+#endif // C_CCHSERVICE_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_server_api/inc/cchservice.inl	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,58 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef CCHSERVICE_INL
+#define CCHSERVICE_INL
+
+//INCLUDES
+#include "cchserviceobserver.h"
+
+// ---------------------------------------------------------------------------
+// CCchService::CCchService 
+// ---------------------------------------------------------------------------
+//
+inline CCchService::CCchService()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCchService::NewL 
+// ---------------------------------------------------------------------------
+//
+inline CCchService* CCchService::NewL( TUid aImplementationUid,
+                                       MCchServiceObserver& aCchObserver )
+    {
+    return reinterpret_cast< CCchService* >( 
+                REComSession::CreateImplementationL( 
+                    aImplementationUid, 
+                    _FOFF( CCchService, iInstanceKey ),
+                    ( TAny* )( &aCchObserver ) ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CCchService::CCchService 
+// ---------------------------------------------------------------------------
+//
+inline CCchService::~CCchService()
+    {
+    REComSession::DestroyedImplementation( iInstanceKey );
+    }
+
+#endif // CCHSERVICE_INL
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/cch_server_api/inc/cchserviceobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,74 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef M_CCHSERVICEOBSERVER_H
+#define M_CCHSERVICEOBSERVER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <cchclientserver.h>
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// CLASS DECLARATION
+    
+/**
+ *  CCHServiceObserver declaration.
+ *  @since S60 3.2
+ */
+class MCchServiceObserver
+    {
+
+public: // New functions
+
+    /**
+     * CCchService implementation have to use this callback
+     * method when service state changed. Otherwise CCH doesn't
+     * forward notifications to the clients.
+     * @since S60 3.2
+     * @param aServiceId
+     * @param aSubService Sub service type. 
+     * @param aState a new state of the service.
+     * @param aError KErrNone if no error occured, otherwise see CCHError.h.
+     */
+     virtual void ServiceStateChanged(
+                    const TServiceSelection aServiceSelection,
+                    TCCHSubserviceState aState, 
+                    TInt aError ) = 0;
+
+private:
+    
+    };
+
+#endif // M_CCHSERVICEOBSERVER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/csc_settingsui_api/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/cscsettingsui.h     APP_LAYER_PLATFORM_EXPORT_PATH( cscsettingsui.h )
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/csc_settingsui_api/inc/cscsettingsui.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,98 @@
+/*
+* 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:  Declarition of CSCSettingsUi API.
+*
+*/
+
+
+#ifndef C_CSCSETTINGSUI_H
+#define C_CSCSETTINGSUI_H
+
+#include <e32def.h>
+#include <e32base.h>
+
+class CEikonEnv;
+class CCSCSettingsUiImpl;
+class MCoeView;
+
+/**
+ *  CSCSettingsUi class
+ *  Implements CSCSettingsUi API methods.
+ *
+ *  @lib CSCSettingsUi.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CCSCSettingsUi ) : public CBase
+    {
+    public:
+        
+        /**
+         * Two-phased constructor.
+         */
+        IMPORT_C static CCSCSettingsUi* NewL( CEikonEnv& aEikEnv );
+ 
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CCSCSettingsUi();
+       
+   
+        /**
+         * Initializes Converged Service Configurator Settings UI. 
+         *  
+         * @param   aReturnViewId   Identifier of the view where to return with 
+         *                          "back" key.
+         * @param   aServiceId      Service settings identifier.
+         * @param   aDefaultAppView The view to set as the default for client
+         *                          application. If NULL, settings ui view
+         *                          is set as the default view for the 
+         *                          application.
+         * @since   S60 v5.1
+         */
+        IMPORT_C void InitializeL( 
+            const TUid& aReturnViewId, 
+            TUint aServiceId,
+            const MCoeView* aDefaultAppView );
+        
+        /**
+         * Launches Converged Service Configurator Settings UI with parameters
+         * given at initialization. 
+         * 
+         * @since   S60 v3.2
+         * @pre     Initialization is done at least once.
+         */
+        IMPORT_C void LaunchSettingsUiL() const;
+        
+    private:
+
+        CCSCSettingsUi();
+
+        void ConstructL( CEikonEnv& aEikEnv );
+            
+    private: // Data
+    
+        /**
+         * Implementation of the CSC Settings UI.
+         * Own.
+         */
+        CCSCSettingsUiImpl* iImpl;
+
+#ifdef _DEBUG
+    friend class UT_cscsettingsui;
+#endif        
+    };
+
+#endif  // C_CSCSETTINGSUI_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 all the Domain API specific bld.inf files, which 
+*                export files.
+*
+*/
+
+
+#include "../richcallsettingsengine_api/group/bld.inf"
+#include "../cch_client_api/group/bld.inf"
+#include "../cch_server_api/group/bld.inf"
+#include "../csc_settingsui_api/group/bld.inf"
+#include "../vccpropertyhandler_api/group/bld.inf"
+#include "../vcc_api/group/bld.inf"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/richcallsettingsengine_api/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 
+:                Rich Call Settings Engine / RCSE API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+
+PRJ_PLATFORMS
+default armv5
+
+PRJ_EXPORTS
+
+../inc/crcseprofileregistry.h       APP_LAYER_PLATFORM_EXPORT_PATH( crcseprofileregistry.h )
+../inc/rcsedefaultdbnames.h         APP_LAYER_PLATFORM_EXPORT_PATH( rcsedefaultdbnames.h )
+../inc/crcsesccpentry.h             APP_LAYER_PLATFORM_EXPORT_PATH( crcsesccpentry.h )
+../inc/mrcsebackupobserver.h        APP_LAYER_PLATFORM_EXPORT_PATH( mrcsebackupobserver.h )
+../inc/crcseprofileentry.h          APP_LAYER_PLATFORM_EXPORT_PATH( crcseprofileentry.h )
+../inc/rcseregistrybase.h          APP_LAYER_PLATFORM_EXPORT_PATH( rcseregistrybase.h )
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/richcallsettingsengine_api/inc/crcseprofileentry.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,327 @@
+/*
+* 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:  Single profile entry, which is stored to RCSE
+*
+*/
+
+
+
+#ifndef CRCSEPROFILEENTRY_H
+#define CRCSEPROFILEENTRY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+
+// CONSTANTS
+const TInt32 KNotSet = -1;
+
+// OMA Provisioning Content 1.1 defines the minimum lengths of
+// these constants. These constants are doubled.
+const TInt KMaxProviderNameLength = 64;
+const TInt KMaxSettingsNameLength = 32;
+const TInt KMaxSettingsLength32   = 32;
+const TInt KMaxSettingsUrlLength  = 256;
+
+// struct TSettings defines SIP, SCCP and SIP profile specific VOIP settings ids.
+struct TSettingIds
+        {
+        TInt iProfileType;
+        TInt iProfileId;
+        TInt iProfileSpecificSettingId;    
+        };
+
+// CLASS DECLARATION
+
+/**
+*  Profile entry, which is stored to RCSE.
+*
+*  @lib RCSE.lib
+*  @since S60 3.0
+*/
+class CRCSEProfileEntry : public CBase
+    {
+    public: // Enums
+
+    enum TOnOff
+        {
+        EOONotSet = KNotSet,
+        EOff = 0,
+        EOn = 1
+        };
+
+    // Profile types of Ids
+    enum TProtocolType
+        {
+        EProtocolNone    = -1,
+        EProtocolSIP     = 0,
+        EProtocolSCCP    = 1,
+        EProtocolLast,
+        };
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSEProfileEntry* NewL();
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSEProfileEntry* NewLC();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CRCSEProfileEntry();
+        
+    public: // New functions
+                
+        /**
+        * Resets entry to default values.
+        * @since S60 3.0
+        */
+        void ResetDefaultValues();
+        
+    private:
+    
+        /**
+        * C++ default constructor.
+        * Initialises values to ENotSet.
+        */
+        CRCSEProfileEntry();
+        
+	    /**
+    	* By default Symbian 2nd phase constructor is private.
+    	*/
+    	void ConstructL();
+
+    public:     // Data
+
+        // Identifier of profile. This values is set by CRCSEProfile, when
+        // profile entry is got from CRCSEProfile.
+        TUint32 iId;
+
+        // Provider of the profile.
+        TBuf<KMaxProviderNameLength> iProviderName;
+        
+        // Name of the settings.
+        TBuf<KMaxSettingsNameLength> iSettingsName;
+
+        // Preferred codec ids in priority order.
+        RArray<TUint32> iPreferredCodecs;
+
+        // Start media port.
+        TUint32 iStartMediaPort;
+
+        // End media port.
+        TUint32 iEndMediaPort;
+
+        // Siqnaling Quolity Of Service
+        TInt32 iSiqnalingQOS;
+
+        // Media Quality Of Service.
+        TInt32 iMediaQOS;
+
+        // Whether Inband DTMF is in use.
+        TOnOff iInbandDTMF;
+
+        // Whether outband DTMF in in use
+        TOnOff iOutbandDTMF;
+
+        // Hold ring back timer value
+        TInt32 iHoldRingBack;
+
+        // Auto complete
+        TOnOff iAutoComplete;
+
+        // Call forwarding no answer
+        TOnOff iCFNoAnswer;
+        
+        // Call forwarding when busy
+        TOnOff iCFBusy;
+        
+        // Call forwarding unconditional
+        TOnOff iCFUnconditional;
+        
+        // Redundancy
+        TOnOff iRedundancy;
+        
+        // SIP, SCCp and SIP profile specific VOIP settings ids.
+        RArray<TSettingIds> iIds;
+
+        // Secure call preference
+        TUint32 iSecureCallPreference;
+        
+        // VoIP profile lock
+        TUint32 iVoIPProfileLock;
+        
+        // Adhoc allowed
+        TUint32 iAdhocAllowed;
+        
+        // SIP Server type
+        TBuf<KMaxSettingsLength32> iSIPServerType;
+        
+        // Session Board Controller type
+        TBuf<KMaxSettingsLength32> iSBCType;
+        
+        // STUN Server type
+        TBuf<KMaxSettingsLength32> iSTUNServerType;
+        
+        // WLAN AP type
+        TBuf<KMaxSettingsLength32> iWLANAPType;
+        
+        // PSTN Gateway type
+        TBuf<KMaxSettingsLength32> iPSTNGatewayType;
+        
+        // Security Gateway type
+        TBuf<KMaxSettingsLength32> iSecurityGatewayType;
+
+        // RTCP, Real-Time Control Protocol reporting
+        TUint32 iRTCP;
+        
+        // SIP VoIP User Agent header: terminal type display
+        TUint32 iSIPVoIPUAHTerminalType;
+        
+        // SIP VoIP User Agent header WLAN MAC address display 
+        TUint32 iSIPVoIPUAHeaderWLANMAC;
+        
+        // SIP VoIP User Agent header string
+        TBuf<KMaxSettingsLength32> iSIPVoIPUAHeaderString;
+
+        //Profile locked to IAP
+        TOnOff iProfileLockedToIAP;
+        
+        //VoIP plugin UID
+        TInt32 iVoIPPluginUID;
+
+        // Allow VoIP over WCDMA
+        TOnOff iAllowVoIPoverWCDMA;
+
+        // Allow VoIP over Bluetooth
+        TOnOff iAllowVoIPoverBT;
+
+        // Meaningfull count of VoIP digits for call identification
+        TInt32 iMeanCountOfVoIPDigits;
+
+        // Ignore address domain part for VoIP calls
+        TInt32 iIgnoreAddrDomainPart;
+
+        // Handover dialect
+        TInt32 iHandoverDialect;
+
+        // PS Telephony handover preference
+        TInt32 iPSTelephonyHOPreference;
+
+        //Handover threshold value lower level 
+        TInt32 iHOThresholdValueLL;
+
+        // Handover threshold value higher level
+        TInt32 iHOThresholdValueHL;
+
+        // Number of measurements (above value)
+        TInt32 iNumberOfMeasurementsAbove;
+
+        // Number of measurements (below value)
+        TInt32 iNumberOfMeasurementsBelow;
+
+        // Smart scanning interval parameter high
+        TInt32 iSmartScannInterParaHigh;
+
+        // Smart scanning interval parameter medium
+        TInt32 iSmartScannInterParaMedium;
+
+        // Smart scanning interval parameter low
+        TInt32 iSmartScannInterParaLow;
+
+        // Smart scanning interval parameter: static
+        TInt32 iSmartScannInterParaStatic;
+
+        // Smart scanning duration in high mode
+        TInt32 iSmartScannDurationHighMode;
+
+        // Smart scanning duration in medium mode
+        TInt32 iSmartScannDurationMediumMode;
+
+        // Smart scanning duration in low mode
+        TInt32 iSmartScannDurationLowMode;
+
+        // Handoff number (CS->PS)
+        TInt32 iHandoffNumber;
+
+        // Handback number (PS -> CS)
+        TInt32 iHandbackNumber;
+
+        // Hysterisis timer
+        TInt32 iHysterisisTimer;
+
+        // Hand off/back process timer.
+        TInt32 iHandOffProcessTimer;
+
+        // Disconnect process timer
+        TInt32 iDisconnectProcessTimer;
+
+        // Handoff reroute prefix.
+        TBuf<KMaxSettingsLength32> iHandoffPrefix;
+
+        // Handback reroute prefix.
+        TBuf<KMaxSettingsLength32> iHandbackPrefix;
+
+        // Handover tones on/off
+        TInt32 iHandoverTones;
+
+        // Support for SMS over WLAN
+        TInt32 iSupportSMSoverWLAN;
+
+        // Service provider ID
+        TUint32 iServiceProviderId;
+
+        // URI's user=phone parameter
+        TOnOff iUserPhoneUriParameter;
+
+        // Connectivity test call address in registering
+        TBuf<KMaxSettingsLength32> iSIPConnTestAddress;
+
+        // NAT/FW Domain specific settings storage ID (CenRep key)
+        TUint32 iNATSettingsStorageId;
+
+        // The minimum allowed value for the session timer
+        TInt32 iSIPMinSE;
+
+        // The session interval for a SIP session
+        TInt32 iSIPSessionExpires;
+
+        // Used NAT protocol
+        // STUN = 0x00000000, TURN = 0x00000001, ICE = 0x00000002
+        TInt32 iNATProtocol;
+
+        // Variable which indicates if Service table entry needs to be created
+        // during a new VoIP profile creation. New service entry will be created
+        // if value is EOONotSet or EOn. Otherwise existing service is used if
+        // iServiceProviderId is set and valid and it's not used by any other
+        // voip profile.
+        TOnOff iNewServiceTableEntry;
+
+        // Destination network id
+        TUint32 iSNAPId;
+
+         // Account creation URL. Used when service contains no login information
+         // and the user wants to create a new account on the provider web page.
+         TBuf<KMaxSettingsUrlLength> iAccountCreationUrl;
+    };
+
+#endif      // CRCSEPROFILEENTRY_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/richcallsettingsengine_api/inc/crcseprofileregistry.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,367 @@
+/*
+* 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:  Offers API for storing, getting and updating profiles.
+*
+*/
+
+
+
+#ifndef CRCSEPROFILEREGISTRY_H
+#define CRCSEPROFILEREGISTRY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <rcseregistrybase.h>
+#include <crcseprofileentry.h>
+#include <sipprofileregistryobserver.h>
+
+
+
+// FORWARD DECLARATION
+class CSIPManagedProfileRegistry;
+class CSIPProfile;
+
+
+// CLASS DECLARATION
+
+/**
+*  Offers getting, setting and updating of profiles.
+*
+*  @lib RCSE.lib
+*  @since S60 3.0
+*/
+class CRCSEProfileRegistry: public CRCSERegistryBase,
+                            public MSIPProfileRegistryObserver
+    {    
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    IMPORT_C static CRCSEProfileRegistry* NewL();
+
+    /**
+    * Two-phased constructor.
+    */
+    IMPORT_C static CRCSEProfileRegistry* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    IMPORT_C virtual ~CRCSEProfileRegistry();
+
+public: // New functions
+
+    /**
+    * Search a profile, which provider name setting is same as 
+    * aProviderName. Leaves with KErrNotFound if such profile
+    * is not found. Default values are reseted to aFoundEntry
+    * before the search.
+    *
+    * @since S60 v3.0
+    * @param aProviderName Search criteria for profiles.
+    * @param aFoundEntry A found profile entry, which provider name is 
+    * same than aProviderName.
+    */
+    IMPORT_C void FindL( const TDesC& aProviderName, 
+        CRCSEProfileEntry& aFoundEntry );
+
+    /**
+    * Search a profile, which profile id is same as aProfileId. 
+    * Leaves with KErrNotFound if such profile is not found.
+    * Default values are reseted to aFoundEntry before the search.
+    *
+    * @since S60 v3.0.
+    * @param aProfileId Search criteria for profiles.
+    * @param aFoundEntry A found profile entry, which provider name is 
+    * same than aProviderName.
+    */
+    IMPORT_C void FindL( TUint32 aProfileId, 
+        CRCSEProfileEntry& aFoundEntry );
+
+    /**
+    * Gets all profile identifiers which are stored to RCSE. If there are
+    * no profiles stored, aAllIds will contain zero entries.
+    *
+    * @since S60 v3.0
+    * @param aAllIds Array, where the profile identifiers are stored.
+    */
+    IMPORT_C void GetAllIdsL( RArray<TUint32>& aAllIds );
+
+    /**
+    * Adds new profile entry.
+    *
+    * @since S60 v3.0
+    * @param aNewEntry New entry.
+    * @return Profile identifier of the added profile.
+    */
+    IMPORT_C TUint32 AddL( const CRCSEProfileEntry& aNewEntry );
+
+    /**
+    * Deletes a profile, which profile id is same than aProfileId. 
+    *
+    * @since S60 v3.0
+    * @param aProfileId Profile identifier
+    */
+    IMPORT_C void DeleteL( TUint32 aProfileId );
+    /**
+    * Updates profile, which profile identifier is same than aProfileId.
+    * Only settings that are set in aUpdateData are updated in profile.
+    * Leaves with KErrNotFound if profile is not found.
+    *
+    * @since S60 v3.0
+    * @param aId Profile identifier.
+    * @param aUpdateData Updated data, which are updated to profile.
+    */
+    IMPORT_C void UpdateL( TUint32 aId, 
+        const CRCSEProfileEntry& aUpdateData );
+
+    /**
+    * Resets default values for profile. Default profile is a profile, 
+    * which can be used when no other profile is available.
+    *
+    * @since S60 v3.0
+    * @param aDefaultProfile Default profile settings are set to this.
+    */
+    IMPORT_C void GetDefaultProfile( 
+        CRCSEProfileEntry& aDefaultProfile ) const;
+
+    /**
+    * Search a profiles, where service provider id is same as aServiceId.
+    * Content of aFoundEntries array is deleted before the search.
+    * On return, aFoundEntries is empty if requested entries are not found.
+    *
+    * @since S60 v3.2.
+    * @param aServiceId Search criteria for profiles.
+    * @param aFoundEntries Container for found profiles
+    */
+    IMPORT_C void FindByServiceIdL( TUint32 aServiceId, 
+        RPointerArray<CRCSEProfileEntry>& aFoundEntries );
+
+    /**
+    * Search a profiles that have requested aSipProfileId.
+    * Content of aFoundEntries array is deleted before the search.
+    * On return, aFoundEntries is empty if requested entries are not found.
+    *
+    * @since S60 v3.2.
+    * @param aSipProfileId Search criteria for profiles.
+    * @param aFoundEntries Container for found profiles
+    */
+    IMPORT_C void FindBySIPProfileIdL( TUint32 aSipProfileId, 
+        RPointerArray<CRCSEProfileEntry>& aFoundEntries );
+
+    /**
+    * Adds bunch of profile entries to store in one transaction.
+    * Creates new service provider setting entry to service table
+    * if iServiceProviderId has not been set in given profile entry.
+    *
+    * @since S60 v3.2
+    * @param aEntries 
+    */
+    void AddL( RPointerArray<CRCSEProfileEntry>& aEntries );
+
+
+    /** 
+    * From MSIPProfileRegistryObserver
+    * SIP profile information event.
+    *
+    * @since S60 v3.1
+    * @param aSIPProfileId id for profile
+    * @param aEvent type of information event
+    */
+    void ProfileRegistryEventOccurred( TUint32 aSIPProfileId,
+                                       TEvent aEvent );
+
+    /**
+    * From MSIPProfileRegistryObserver
+    * An asynchronous error has occurred related to SIP profile.
+    *
+    * @since S60 v3.1
+    * @param aSIPProfileId the id of failed profile
+    * @param aError a error code
+    * @return none
+    */
+    void ProfileRegistryErrorOccurred( TUint32 aSIPProfileId, 
+                                       TInt aError );
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CRCSEProfileRegistry();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    /**
+    * Do actual search of requested entry.
+    * Leaves with KErrNotFound if such profile is not found.
+    * Default values are reseted to aFoundEntry before the search.
+    *
+    * @since S60 v3.0.
+    * @param aProfileId Search criteria for profiles.
+    * @param aFoundEntry A found profile entry
+    * @leave KErrNotFound if profile doesn't exist.
+    */
+    void FindEntryL( TUint32 aProfileId, CRCSEProfileEntry& aFoundEntry );
+
+    /**
+    * Adds or updates settings entry to storage depending of the aId
+    * parameter. Entry is stored as new entry if aId parameter have
+    * been set to KNoEntryId, otherwise existing entry is updated.
+    *
+    * @since S60 v3.2
+    * @param aId ID of entry if exists. 
+    * @param aEntry Entry to be added to storage.
+    * @param aUpdate Determines add or update operation.
+    *                New entry is added when value is set to EFalse (default).
+    * @return ID of entry.
+    */
+    void AddOrUpdateEntryL( TUint32& aId, const CRCSEProfileEntry& aEntry );
+
+    /**
+    * Convert xxx
+    * .
+    *
+    * @since S60 v3.2.
+    * @param aEntry
+    * @param aProperties
+    */
+    void ConvertPropertiesToEntryL( CRCSEProfileEntry& aEntry,
+                                    RIpAppPropArray& aProperties );
+
+
+    /**
+    * Convert xxx
+    * .
+    *
+    * @since S60 v3.2.
+    * @param aEntry
+    * @param aProperties
+    */
+    void ConvertEntryToPropertiesL( const CRCSEProfileEntry& aEntry,
+                                    RIpAppPropArray& properties );
+
+    /**
+    * Extract protocol ids from descriptor. 
+    *
+    * @since S60 v3.2
+    * @param aDes Contains TSettingIds structs.
+    * @param aArray Contains extracted TSettingIds struct when return.
+    */
+    void ExtractProtocoIdsL( const TDesC& aDes, RArray<TSettingIds>& aArray );
+
+    /**
+    * Validates that linked SIP profiles are up to date.
+    * Removes invalid links and updates entry to data base
+    *
+    * @since S60 v3.1
+    * @param aEntry Profile entry fetched from data base
+    * @return 
+    */
+    void UpdateSIPProfileLinksL( CRCSEProfileEntry& aEntry );
+
+    /**
+    * Creates and stores service provider settings entry with
+    * default values, when new profile is created.
+    * Service ID of stored service settings is set to profile.
+    *
+    * @since S60 v3.2.
+    * @param aNewEntry New entry.
+    */
+    void CreateDefaultServiceSettingsL( CRCSEProfileEntry& aNewEntry );
+
+    /**
+    * Deletes service settings and audio codec settings referenced
+    * from profile.
+    *
+    * @since S60 v3.2.
+    * @param aProfileId Id of deleted VoIP profile
+    */
+    void DeleteReferenceSettingsL( TUint32 aProfileId );
+
+    /**
+    * Checks if Service table exist with rerenced entry name.
+    * @since S60 3.2.
+    * @param aProviderName.
+    */        
+    TBool NameExistsInServiceTableL( const TDesC& aProviderName ) const;
+    
+    /**
+    * Checks if service id is used for profile.
+    * @since S60 3.2.
+    * @param aEntry.
+    */        
+    void LeaveIfServiceIdInUseL( const CRCSEProfileEntry& aEntry );
+
+    /**
+    * Updates service settings related to aEntry if needed
+    * @since S60 3.2.
+    * @param aEntry.
+    */        
+    void UpdateServiceSettingsL( const CRCSEProfileEntry& aEntry );
+
+    /**
+    * Updates service id related to given entry id.
+    * @since S60 3.2.
+    * @param aId.
+    * @param aServiceId New service id.
+    */        
+    void UpdateServiceIdL(  TUint32 aId, TUint32 aServiceId );
+
+    /**
+    * Implementation for cleanup item.
+    * Resets and destroys array of the entries. 
+    * @param anArray RPointerArray pointer.
+    */
+    static void ResetAndDestroyEntries( TAny* anArray );
+
+    /**
+    * Copies values from a const entry to a modifiable one.
+    * @since S60 3.2.
+    * @param aSourceEntry Entry whose values are to be copied.
+    * @param aDestinationEntry Entry to whom values are copied.
+    */
+    void CopyEntryValues( const CRCSEProfileEntry& aSourceEntry, 
+        CRCSEProfileEntry& aDestinationEntry );
+private:     // Data
+
+    /**
+    * SIP registry ( from SIP Profile Client )
+    * Own.
+    */
+    CSIPManagedProfileRegistry* iSIPRegistry;
+
+    /**
+    * SIP profiles ( from SIP Profile Client )
+    * Own.
+    */
+    RPointerArray<CSIPProfile> iSIPProfiles;
+
+
+private:
+
+    // For testing
+    #ifdef TEST_EUNIT
+        friend class UT_CRCSEProfileRegistry;
+    #endif                                  
+    };
+
+#endif      // CRCSEPROFILEREGISTRY_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/richcallsettingsengine_api/inc/crcsesccpentry.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,162 @@
+/*
+* 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:  Single SCCP entry, which is stored to RCSE
+*
+*/
+
+
+
+#ifndef CRCSEPSCCPENTRY_H
+#define CRCSEPSCCPENTRY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+
+#include <crcseprofileentry.h>
+
+// CONSTANTS
+
+// OMA Provisioning Content 1.1 defines the minimum lengths of
+// these constants. These constants are doubled.
+
+const TInt KMaxSCCPStackNameLength = 16;
+
+const TInt KMaxTFTPServerAddressLength = 64;
+
+const TInt KMaxCallManagerAddressLength = 64;
+
+const TInt KMaxSCCPNumberLength = 64;
+
+const TInt KMaxSCCPCertificatesNameLength = 128;
+
+const TInt KMaxMusicServerAddressLength = 128;
+
+const TInt KMaxCFUncondAddLength = 64;
+
+const TInt KMaxArray = 5;
+
+const TInt KMaxSCCPProfileNameLength = 64;
+
+const TInt KMaxSCCPVoiceMailboxLength = 128;
+
+const TInt KMaxSCCPIntCallPrefixLength = 20;
+
+// CLASS DECLARATION
+
+/**
+*  SCCP setting entry, which is stored to RCSE.
+*
+*  @lib RCSE.lib
+*  @since S60 3.0
+*/
+class CRCSESCCPEntry : public CBase
+    {
+    public: // Enums
+
+    enum TOnOff
+        {
+        EOONotSet = KNotSet,
+        EOff = 0,
+        EOn = 1
+        };
+    
+    enum TManualAutomatic
+        {
+        EManual = 0,
+        EAutomatic = 1    
+        };
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSESCCPEntry* NewL();
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSESCCPEntry* NewLC();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CRCSESCCPEntry();
+        
+    public: // New methods
+                    
+        /**
+        * Resets entry to default values.
+        * @since S60 3.0
+        */
+        void ResetDefaultValues();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        * Initialises values to ENotSet.
+        */
+        CRCSESCCPEntry();
+        
+    public:     // Data        
+    
+        // Identifier of profile. This values is set by CRCSESCCPSetting, when
+        // profile entry is got from CRCSESCCPSetting.
+        TUint32 iSCCPSettingId;
+
+        // SCCP Profile name
+        TBuf<KMaxSCCPProfileNameLength> iProfileName;
+    
+        // Voip login.
+        TManualAutomatic iVOIPLogin;
+        
+        // ID of the access used access point.
+        TInt32    iAccessPoint;
+
+        // Array of call manager addresses(0-5).        
+        TBuf<100> iCallManager[KMaxArray];
+                
+        // SCCP stack version.
+        TBuf<KMaxSCCPStackNameLength> iStackVersion; 
+        
+        // Usage of TFTP server and DHCP services.
+        TOnOff iDHCPTFTPEnabled;
+        
+        // TFTP server address.
+        TBuf<KMaxTFTPServerAddressLength> iTFTPServerAddress;
+        
+        // SCCP profile phone number.
+        TBuf<KMaxSCCPNumberLength> iPhoneNumber;
+        
+        // List of SCCP certificates.
+        TBuf<KMaxSCCPCertificatesNameLength> iSCCPCertificates;
+        
+        // Music server address.
+        TBuf<KMaxMusicServerAddressLength> iMusicServerAdd;
+        
+        // CFUncond address.
+        TBuf<KMaxCFUncondAddLength> iCFUncondAdd;
+
+        // SCCP Voice Mailbox address
+        TBuf<KMaxSCCPVoiceMailboxLength> iVoiceMailBoxURI;
+
+        // SCCP International call  prefix
+        TBuf<KMaxSCCPIntCallPrefixLength> iSCCPIntCallPrefix;
+    };
+
+#endif      // CRCSESCCPENTRY_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/richcallsettingsengine_api/inc/mrcsebackupobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Call back interface for backup events
+*
+*/
+
+
+
+#ifndef MRCSEBACKUPOBSERVER_H
+#define MRCSEBACKUPOBSERVER_H
+
+
+/**
+ *  Call back interface for backup events
+ *
+ *  @lib rcse.lib
+ *  @since S60 3.0
+ */
+
+class MRCSEBackupObserver
+    {
+public:
+
+    /**
+     * Handle backup events
+     *
+     * @since S60 3.0
+     */
+    virtual void HandleBackupOperationEventL() = 0;
+
+    };
+
+#endif // MRCSEBACKUPOBSERVER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/richcallsettingsengine_api/inc/rcsedefaultdbnames.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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:  Database name constants
+*
+*/
+
+
+
+#ifndef RCSEDEFAULTDBNAMES
+#define RCSEDEFAULTDBNAMES
+
+// CONSTANTS
+
+// Profile database name, format is [drive letter]:[database name]
+_LIT( KDbName, "c:RCSE_VoIPProfiles" );
+
+// Audio Codec database name, format is [drive letter]:[database name].
+_LIT( KDbCodecName, "c:RCSE_AudioCodec" );
+
+// SCCP setting database name, format is [drive letter]:[database name]
+_LIT( KDbSCCPName, "c:RCSE_SCCPSetting" );
+
+// SIP setting database name, format is [drive letter]:[database name]
+_LIT( KDbSIPName, "c:RCSE_SIPSetting" );
+
+
+// Temporary database name, format is [drive letter]:[database name]
+_LIT( KDbTempName, "c:RCSE_Temp" );
+
+
+#endif      // RCSEDEFAULTDBNAMES   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/richcallsettingsengine_api/inc/rcseregistrybase.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,232 @@
+/*
+* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RCSE registry classes
+*
+*/
+
+
+#ifndef CRCSEREGISTRYBASE_H
+#define CRCSEREGISTRYBASE_H
+
+//#include <centralrepository.h>
+#include <e32base.h>
+#include <d32dbms.h>
+#include <mrcsebackupobserver.h>
+
+#include <cenrepdatabaseutil.h>
+const TInt KMaxNameLength = 100;
+
+
+class CRCSEBackupObserver;
+
+/**
+ *  Base class for RCSE registry classes
+ *
+ *  Encapsules settings repository connections and handles backup events.
+ *
+ *  @lib rcse.lib
+ *  @since S60 v3.0
+ */
+class CRCSERegistryBase : public CBase, public MRCSEBackupObserver
+    {
+protected:
+
+    /**  Registry type */
+    enum TRCSERegistryType
+        {
+        EUnknown,
+        EVoIPProfile,
+        ESIPSetting,        // Not supported
+        EAudioCodecSetting,
+        ESCCPProfile        // Not supported
+        };
+
+    /**  Item types in settings table */
+    enum TItemType
+        {
+        EItemUnknown    = 0,            // Unknown item
+        EItemDeleted    = 1,            // Row (item) deleted
+        EItemVoIPEntry  = 2,            // VoIP profile entry
+        EItemCodecEntry = 3,            // Audio codec entry
+        EItemAttribute  = 4,            // Attribute of entry
+        };
+
+
+public:
+
+    virtual ~CRCSERegistryBase();
+
+    /**
+     * From MRCSEBackupObserver.
+     * Handle backup observer event.
+     *
+     * @since S60 v3.0
+     */
+    void HandleBackupOperationEventL();
+
+protected:
+
+    CRCSERegistryBase( TRCSERegistryType aType );
+
+    void BaseConstructL();
+
+    /**
+    * Prepares operation. Checks that there is not backup/restore
+    * opearation ongoing and begins transaction.
+    *    
+    * @since S60 v3.2
+    * @leave KErrNotReady if there is backuoperation ongoing.
+    * @leave KErrLocked if there is write operation already ongoing.
+    */
+    void BeginL();
+
+    /**
+    * Ends user operations. Commits transaction.
+    *
+    * @since S60 v3.2
+    * @param aType Type of performed operation
+    */
+    void EndL();
+
+    /**
+    * Helper method that converts TInt32 type to descriptor.
+    *
+    * @since S60 v3.2
+    * @param aFrom TInt32 value to be converted.
+    * @param aTo Descriptor containing the converted value.
+    * @return Reference to descriptor containing the converted value.
+    */
+    TDesC& ToDes( TInt32 aFrom, TDes& aTo );
+
+    /**
+    * Helper method that converts TUint32 type to descriptor.
+    *
+    * @since S60 v3.2
+    * @param aFrom TUint32 value to be converted.
+    * @param aTo Descriptor containing the converted value.
+    * @return Reference to descriptor containing the converted value.
+    */
+    TDesC& ToDes( TUint32 aFrom, TDes& aTo );
+
+    /**
+    * Helper method that converts descriptor type to TInt32.
+    *
+    * @since S60 v3.2
+    * @param aFrom Descriptor to be converted.
+    * @return Converted TInt32 value.
+    */
+    TInt32 ToTInt32L( const TDesC& aFrom );
+
+    /**
+    * Helper method that converts descriptor type to TUint32.
+    *
+    * @since S60 v3.2
+    * @param aFrom Descriptor to be converted.
+    * @return Converted TUint32 value.
+    */
+    TUint32 ToTUint32L( const TDesC& aFrom );
+
+    /**
+    * Imports rcse settings from restored database file 
+    *
+    * @since S60 v3.2
+    */
+    void ImportSettingsL();
+
+    /**
+    * Create CenRep db property to given property array.
+    *
+    * @since S60 v3.2
+    * @param aPropertyName Name of created property.
+    * @param aPropertyValue Value of created property.
+    * @param aPropertyArray Container of properties.
+    */
+    void CreatePropertyL( TUint aPropertyName,
+                          const TDesC& aPropertyValue,
+                          RIpAppPropArray& aPropertyArray );
+
+    /**
+    * Find value of property from given property array.
+    *
+    * @since S60 v3.2
+    * @param aPropertyName Name of requested property.
+    * @param aPropertyValue Value of requested property.
+    * @param aPropertyArray Container of properties.
+    */
+    void GetPropertyValueL( TUint aPropertyName,
+                            TDes& aPropertyValue,
+                            RIpAppPropArray& aPropertyArray );
+
+    /**
+    * Create CenRep db property to given property array.
+    *
+    * @since S60 v3.2
+    * @param aPropertyName Searh criteria.
+    * @param aPropertyValue Searh criteria.
+    * @param aIdArray Contains all found entry IDs.
+    */
+    void FindIdsByValueL( TUint aPropertyName,
+                          const TDesC& aPropertyValue,
+                          RArray<TUint32>& aIdArray );
+
+    /**
+    * Search all entry IDs from CenRep database.
+    *
+    * @since S60 v3.2
+    * @param aIdArray Contains all found entry IDs.
+    */
+    void FindAllIdsL( RArray<TUint32>& aIdArray );
+
+    /**
+     * Custom cleanup for cenrep db property array.
+     *
+     * @since S60 v3.2
+     * @param aPointer Array pointer
+     */
+    static void CleanupDbPropArray( TAny* aPointer );
+
+
+protected: // data
+
+    /**
+     * Registry type of this object
+     */
+    TRCSERegistryType iType;
+
+    /**
+     * Backup observer
+     * Own.
+     */
+    CRCSEBackupObserver* iBackupObserver;
+
+    /**
+     * Backup flag
+     */
+    TBool iBackupActive;
+
+    /**
+     * Interface to RCSE's settings storage
+     * Own.
+     */
+    CCenRepDatabaseUtil* iCenRepDb;
+
+
+    // For testing
+    #ifdef TEST_EUNIT
+        friend class UT_CRCSERegistryBase;
+    #endif                                  
+
+    };
+
+#endif // CRCSEREGISTRYBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/vcc_api/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 
+*                Callcontinuity API
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+default armv5
+
+PRJ_EXPORTS
+../inc/vccsubscribekeys.h                           APP_LAYER_PLATFORM_EXPORT_PATH( vccsubscribekeys.h )
+../inc/cvccperformer.h                              APP_LAYER_PLATFORM_EXPORT_PATH( cvccperformer.h )
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/vcc_api/inc/cvccperformer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,542 @@
+/*
+* 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:   CCP reference plug-in implementation.
+*
+*/
+
+#ifndef CVCCPERFORMER_H
+#define CVCCPERFORMER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <e32cmn.h> // HBufC
+#include <mccpcallobserver.h> //CCP API
+#include <mccpcscall.h>//CCP API
+#include <cccpcallparameters.h>
+#include <cccecallparameters.h>
+
+#include "cconvergedcallprovider.h"
+#include "tvccstate.h"
+
+class CVccEngPsPropertyListener;
+class CVccEngPsProperty;
+class CVccHoTrigger;
+class CVccTransferProvider;
+
+/**
+* The class acts as a proxy forward the CCE. 
+* It forwards the call to the actual MCCP interface implementation 
+* and initiates new call if instructed to do the handover.
+* 
+*  @lib vccperformer.dll
+*  @since S60 3.2
+* 
+*/
+class CVccPerformer : public CBase,
+                   	  public MCCPCSCall,
+                   	  public MCCPCallObserver
+                   
+    {
+public:
+
+ 	/*
+ 	* The c'tor
+ 	* @param aProviders Array or call providers
+ 	* @param aState State of the call to be created
+ 	* @param aVccHoTrigger Reference to handover trigger object
+ 	* @since S60 3.2
+ 	*/
+    static CVccPerformer* NewL(RPointerArray<CConvergedCallProvider>& aProviders, 
+    						   TVccState& aState, CVccHoTrigger& aVccHoTrigger,
+    						   TBool aCsOriginated );
+    
+    /*
+    * dtor
+    */
+    ~CVccPerformer();
+    
+    /**
+     * Starts Handover procedure
+     * @since S60 3.2
+     * @param aValue Type and direction of the possible HO
+     * @return void
+     */
+    void SwitchL( const TInt aValue );
+
+    /**
+    * Gets the observer for the call events
+    * @since Series60 3.2
+    * @return Call event observer 
+    */
+    MCCPCallObserver* CallObserver();
+    
+    
+    /**
+    * Makes run-time decision what technology to use for the call
+    * @since Series60 3.2
+    * @param aParameters Call parameters
+    * @param aRecipient Recipient
+    * @param aObserver Reference to call observer
+    * @return Reference to created call object or leaves with Symbian error code
+    */
+    MCCPCall* CreatePrimaryCallL(const CCCPCallParameters& aParameters,
+                          const TDesC& aRecipient,
+                          const MCCPCallObserver& aObserver );
+                          
+    /**
+    * handles incoming call
+    * @since Series60 3.2
+    * @param aCall Reference to call object
+    * @return reference to this object
+    */
+    
+    MCCPCall* IncomingCall( MCCPCall* aCall );
+    
+    /**
+    * handles 3rd party mo call
+    * @since Series60 3.2
+    * @param aCall Reference to call object
+    * @return reference to this object
+    */
+    MCCPCall* MoCall( MCCPCall* aCall );
+    
+    /**
+    * Gets the actual implementation of the active call
+    * @since Series60 3.2
+    * @return reference to call object
+    */
+    MCCPCall* PrimaryCall();
+    
+    /**
+    * returns cs provider
+    * @since Series60 3.2
+    * @return reference to CS call provider
+    */
+    CConvergedCallProvider& CsProvider();
+    
+    /**
+    * returns ps provider
+    * @since Series60 3.2
+    * @return reference to PS call provider
+    */
+    CConvergedCallProvider& PsProvider();
+                              
+    /**
+    * Changing the call object
+    * @since Series60 3.2
+    * @param aCall Reference to a new call object
+    */                                            
+    void SetCall( MCCPCall* aCall );                
+
+    /**
+    * Changing the call object
+    * @since Series60 3.2
+    * @param aCall Reference to a new call object
+    * leaves with system error code
+    */                                            
+    void SetCallL( MCCPCall* aCall );                
+
+                          
+    /**
+    * Releases call
+    * @since Series60 3.2
+    * @param aCall Call to be removed
+    * @return Symbian error code
+    */
+    TInt ReleaseCall( MCCPCall& aCall );
+    
+    /**
+    * Informat that the domain has been changed.
+    * @since Series60 3.2
+    */
+    void HandoverReady();           
+
+    /**
+    * Creates an implementation for making handover
+    * @since Series60 3.2
+    * @param aParameters Call parameters
+    * @param aRecipient Recipient
+    * @param aObserver Reference to call observer
+    */
+    void CreateSecondaryCallL(const CCCPCallParameters& aParameters,
+                               const TDesC& aRecipient,
+                               const MCCPCallObserver& aObserver);
+    /**
+    * Returns created local implementation
+    * @since Series60 3.2
+    * @return local implementation for hand-over, NULL if not created.
+    */                         
+    MCCPCall* SecondaryCall();
+    
+    /**
+    * Updates the current state with the next state
+    * @since Series60 3.2
+    * @param aState reference to a new call state
+    */
+    void SetState( TVccState& aState );
+    
+    /**
+    * Returns current state name
+    * @since Series60 3.2
+    * @return current state, see state headers for the state names
+    */
+    TUint StateName() const;
+    
+    /**
+    * Gets the notifier
+    * @since Series60 3.2
+    * @return the notifier to be used for the reporting hand-over process
+    */
+    CVccEngPsProperty& Notifier();
+    
+    /**
+     * Activates the trigger if call is connected, stops otherwise
+     * @since Series60 3.2
+     * @param aActivation activate or deactivate trigger
+     */
+    void ActivateTrigger( TBool aActivation );
+    
+    /**
+     * PS key is updated via this method, so that UI item is removed from 
+     * in call Options menu when needed
+     * @since Series60 3.2
+     * @param aAllow to show or hide HO option in menu
+     */
+    void AllowHo( TBool aAllow );
+
+    /**
+     * PS key is updated via this method, so that UI item is removed from 
+     * in call Options menu when needed
+     * @since Series60 3.2
+     * @param aAllow to show or hide HO option in menu
+     * @leave with system wide error if fails 
+     */
+    void AllowHoL( TBool aAllow );
+    
+    /**
+     * Checks own state after conference and starts trigger if state is connected.
+     * @since Series60 3.2
+     */
+    void ConferenceEnded();    
+
+    /**
+     * Release secondary call leg, if needed, before calling destructor.
+     * @since Series60 3.2
+     */
+    void ReleaseSecondaryCallLeg();
+    
+    /**
+     * Save original RemoteParty and RemotePartyName, so that call bubble
+     * stays intact also after handover
+     */
+    void SetRemoteParties();
+    
+    /**
+     * Finds provider index number from array
+     * @param aVoipIndex true if voip index should be searched, false if
+     *                   cs index
+     * @return index number from which the provider can be found, KErrNotFound
+     *         if provider not found from array
+     */
+    TInt VoipProviderIndex( TBool aVoipIndexWanted );
+    
+      
+// from base class MCCPCall    
+    /**
+    * @see MCCPCall::Answer()
+    */
+    TInt Answer();
+      
+    /**
+    * @see MCCPCall::Reject()
+    */
+    TInt Reject();
+
+    /**
+    * @see MCCPCall::Queue()
+    */
+    TInt Queue();
+
+    /**
+    * @see MCCPCall::Dial()
+    */
+    TInt Dial();
+
+    /**
+    * @see MCCPCall::Ringing()
+    */
+    TInt Ringing();
+      
+    /**
+    * @see MCCPCall::HangUp()
+    */
+    TInt HangUp();
+      
+    /**
+    * @see MCCPCall::Cancel()
+    */
+    TInt Cancel();
+      
+    /**
+    * @see MCCPCall::Hold()
+    */
+    TInt Hold();
+      
+    /**
+    * @see MCCPCall::Resume()
+    */
+    TInt Resume();
+      
+    /**
+    * @see MCCPCall::Swap()
+    */
+    TInt Swap();
+      
+    /**
+    * @see MCCPCall::RemoteParty()
+    */
+    const TDesC& RemoteParty() const;
+
+    /**
+    * @see MCCPCall::RemotePartyName()
+    */
+    const TDesC& RemotePartyName();
+
+    /**
+    * @see MCCPCall::DialledParty()
+    */
+    const TDesC& DialledParty() const;
+      
+    /**
+    * @see MCCPCall::IsCallForwarded()
+    */
+    TBool IsCallForwarded() const;
+     
+    /**
+    * @see MCCPCall::IsMobileOriginated()
+    */
+    TBool IsMobileOriginated() const;
+      
+    /**
+    * @see MCCPCall::State()
+    */
+    MCCPCallObserver::TCCPCallState State() const;
+      
+    /**
+    * @see MCCPCall::Uid()
+    */
+    TUid Uid() const;
+      
+    /**
+    * @see MCCPCall::Caps()
+    */
+    MCCPCallObserver::TCCPCallControlCaps Caps() const;     
+    
+    /**
+    * @see MCCPCall::SecureSpecified()
+    */
+    TBool SecureSpecified() const;
+    
+    /**
+    * @see MCCPCall::IsSecured()
+    */
+    TBool IsSecured() const;
+      
+    /**
+	* @see MCCPCall::SetParameters()
+	*/
+    void SetParameters( const CCCPCallParameters& aNewParams );
+
+    /**
+	* @see MCCPCall::Parameters()
+	*/
+    const CCCPCallParameters& Parameters() const;
+      
+    /**
+	* @see MCCPCall::Tone()
+    */
+    TCCPTone Tone() const;
+      
+	/**
+	* @see MCCPCall::ForwardProviderL()
+	*/
+	MCCPForwardProvider* ForwardProviderL( const MCCPForwardObserver& aObserver );
+
+	/**
+    * @see MCCPCall::TransferProviderL()
+    */
+	MCCPTransferProvider* TransferProviderL( const MCCPTransferObserver& aObserver );
+      
+    /**
+    * @see MCCPCall::AddObserverL()
+    */
+    void AddObserverL( const MCCPCallObserver& aObserver );
+
+    /**
+    * @see MCCPCall::RemoveObserver()
+    */
+    TInt RemoveObserver( const MCCPCallObserver& aObserver );
+    
+//from base class MCCPCSCall
+    
+    /**
+    * @see MCCPCSCall::Dial()
+    */
+	TInt Dial( const TDesC8& aCallParams );
+
+    /**
+    * @see MCCPCSCall::NoFDNCheck()
+    */
+	void NoFDNCheck();
+
+    /**
+    * @see MCCPCSCall::GetMobileCallInfo()
+    */
+	TInt GetMobileCallInfo( TDes8& aCallInfo ) const;
+
+    /**
+    * @see MCCPCSCall::SwitchAlternatingCall()
+    */
+	TInt SwitchAlternatingCall();
+
+    /**
+    * @see MCCPCSCall::GetMobileDataCallCaps()
+    */
+	TInt GetMobileDataCallCaps( TDes8& aCaps ) const;
+	
+    /**
+    * @see MCCPCSCall::LogDialedNumber()
+    */
+    TBool LogDialedNumber() const;
+    
+    
+//from base class MCCPCallObserver
+    
+    /**
+    * @see MCCPCallObserver::ErrorOccurred()
+    */
+	void ErrorOccurred( const TCCPError aError, MCCPCall* aCall );
+
+    /**
+    * @see MCCPCallObserver::CallStateChanged()
+    */
+	void CallStateChanged( const MCCPCallObserver::TCCPCallState aState, 
+	                       MCCPCall* aCall );
+
+    /**
+    * @see MCCPCallObserver::CallStateChangedWithInband()
+    */
+	void CallStateChangedWithInband( const MCCPCallObserver::TCCPCallState aState,
+	                                 MCCPCall* aCall );
+
+    /**
+    * @see MCCPCallObserver::CallEventOccurred()
+    */
+	void CallEventOccurred( const MCCPCallObserver::TCCPCallEvent aEvent, 
+	                        MCCPCall* aCall  );
+
+    /**
+    * @see MCCPCallObserver::CallCapsChanged()
+    */
+	void CallCapsChanged( const TUint32 aCapsFlags, MCCPCall* aCall );
+	
+private:
+
+    /**
+    * constructor.
+    */
+    CVccPerformer(RPointerArray<CConvergedCallProvider>& aProviders,
+    			  TVccState& aState, CVccHoTrigger& aVccHoTrigger,
+    			  TBool aCsOriginated);
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+    
+       /**
+    * Removes SIP-uri from remoteparty number if call is VoIP call
+    */
+    void ParseRemoteParty();
+
+private: // data
+    
+    /**
+     * Call provider array
+     * Not own
+     */
+	RPointerArray<CConvergedCallProvider>& iProviders;
+
+    
+    /**
+     * actual call implementation, can be changed run-time
+     * Own
+     */
+	MCCPCall* iPrimaryCall; 
+	
+    /**
+     * actual call implementation, created to perfome a handover
+     * Own
+     */
+	MCCPCall* iSecondaryCall; 
+	
+    /**
+     * remembering the call observer because it needs to change
+     * Not own
+     */
+	MCCPCallObserver* iCallObs;
+	
+    /**
+     * for informing the states
+     * Own
+     */
+	CVccEngPsProperty* iVccPsp;
+	
+    /**
+     * current state in case of the hand-over
+     * Own
+     */
+	TVccState* iCurrentState;
+	
+    /**
+     * trigger for initiating automatic HOs
+     * Not own
+     */
+	CVccHoTrigger& iVccHoTrigger;
+	
+	/**
+	 * Originating domain of the call
+	 * */
+	TBool iCsOriginated;
+
+	/**
+	 * Transfer provider for handling call transfer 
+	 * Own
+	 */
+	CVccTransferProvider* iTransferProvider;
+
+	/**
+	 *For storing the remote party information 
+	 */
+
+	TBuf<100> iOrigRemotePartyName;
+	TBuf<100> iOrigRemoteParty;
+	
+	TBool iRemotePartiesSet;
+	friend class T_CVccPerformer;
+    };
+
+#endif      // CVCCPERFORMER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/vcc_api/inc/vccsubscribekeys.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   Vcc application IDs for Publish&Subscribe API.
+*
+*/
+
+
+
+#ifndef VCCSUBSCRIBEKEYS_H_
+#define VCCSUBSCRIBEKEYS_H_
+
+/**
+ * Main PS property category Vcc.
+ * @note uid is not valid!!!
+ */
+const TUid KPSVccPropertyCategory = { 0x10207FD9 };
+
+/**
+ * PS property key KVccPropKeyHoRequest for category Vcc.
+ * Indicates the state of handover as TVccUiRequest.
+ * UI makes HO request by updating this key's value. VCC server component
+ * observers it.
+ */
+ const TUint32 KVccPropKeyHoRequest = 0x00000001;
+
+/**
+* PS property key KVccPropKeyHoStatus for category Vcc.
+* Indicates the state of handover on the HO server as TVccHoStatus.
+* Only VCC server components update this value. Other components may observer it.
+*/
+const TUint32 KVccPropKeyHoStatus = 0x00000002;
+
+/**
+* PS property key KVccPropHoError for category Vcc.
+* Indicates the Ho error code.
+*/
+const TUint32 KVccPropKeyHoError = 0x00000003;
+
+/**
+ * The key values used with property KVccPropKeyHoRequest.
+ */
+enum TVccHoRequest
+     {
+     EVccNoRequestOngoing = 3000, // Empty state, ok
+
+     EVccManualStartCsToPsHoRequest, // User has requested to start CS->PS HO
+     EVccManualCancelCsToPsHoRequest, // User has requested to cancel CS->PS HO
+
+     EVccManualStartPsToCsHoRequest, // User has requested to start PS->CS HO
+     EVccManualCancelPsToCsHoRequest, // User has requested to cancel PS->CS HO
+
+     EVccAutomaticStartCsToPsHoRequest, // User has requested to start CS->PS HO
+     EVccAutomaticCancelCsToPsHoRequest, // User has requested to cancel CS->PS HO
+     EVccAutomaticStartCsToPsHoRequestIfSingleCall, // User has requested to 
+                                                    // start CS->PS HO, but ho is 
+                                                    // forbidden if there are 
+                                                    // held or waiting calls.
+
+     EVccAutomaticStartPsToCsHoRequest, // User has requested to start PS->CS HO
+     EVccAutomaticCancelPsToCsHoRequest, // User has requested to cancel PS->CS HO
+     EVccAutomaticStartPsToCsHoRequestIfSingleCall, // User has requested to 
+                                                         // start PS->CS HO, but ho is 
+                                                         // forbidden if there are 
+                                                         // held or waiting calls.
+
+     EVccUndefinedRequest   //nok, key value could not be fetched
+
+     };
+
+/**
+* The key values used with property KVccPropKeyHoStatus.
+*/
+enum TVccHoStatus
+    {
+    EVccHoStateIdle = 4000,     // Everything ok
+    EVccCsToPsHoStarted,        // CS->PS HO started
+    EVccCsToPsHoInprogress,     // CS->PS HO in progress.
+    EVccCsToPsHoSuccessful,     // CS->PS HO ended successfully.
+    EVccCsToPsHoFailure,        // HO server encountered failure.
+
+    EVccPsToCsHoStarted,        // PS->CS HO started
+    EVccPsToCsHoInprogress,     // PS->CS  HO in progress.
+    EVccPsToCsHoSuccessful,     // PS->CS  HO ended successfully.
+    EVccPsToCsHoFailure,        // HO server encountered failure.
+    EVccHoStateUnknown,         // nok, key value could not be fetched
+    EVccHoUnavailable,          // HO cannot be done (no other network etc.)
+    EVccCsToPsNotAllowed,       // No ho to wlan
+    EVccPsToCsNotAllowed,       // No ho to GSM
+    EVccHoStateIdleIfSingleCall, // No ho if multicall situation, if singe call both directions ok
+    EVccHoAllowedToCsIfSingleCall, // Ho allowed to CS if not in multicall situation
+    EVccHoAllowedToPsIfSingleCall  // Ho allowed to PS if not in multicall situation
+
+    };
+
+#endif /*VCCSUBSCRIBEKEYS_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/vccpropertyhandler_api/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 
+*                Callcontinuity API
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+default armv5
+
+PRJ_EXPORTS
+../inc/vccuipsproperty.h APP_LAYER_PLATFORM_EXPORT_PATH( vccuipsproperty.h )
+../inc/vccuipspropertylistener.h APP_LAYER_PLATFORM_EXPORT_PATH( vccuipspropertylistener.h )
+../inc/mvccpspropertylistenerobserver.h APP_LAYER_PLATFORM_EXPORT_PATH( mvccpspropertylistenerobserver.h )
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/vccpropertyhandler_api/inc/mvccpspropertylistenerobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* 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 VCC HO property watcher 
+*
+*/
+
+
+
+#ifndef M_VCCPSPROPERTYLISTENEROBSERVER_H
+#define M_VCCPSPROPERTYLISTENEROBSERVER_H
+
+/**
+ *  Observer class for CVccUiPsPropertyListener
+ *
+ *  The class that implements this observer interfaces gets notified about 
+ *  the VCC P&S property value changes.
+ *
+ *  @lib vccuipropertyhandler.lib
+ *  @since S60 v3.2
+ */
+class MVccPsPropertyListenerObserver 
+    {
+
+public:
+
+	/**
+	 * Observer interface. Called when a P&S property value 
+	 * has been updated.
+	 * 
+	 * @param akeyId VCC key uid
+	 * @param aValue Current value of the VCC property.
+	 */	
+ 	virtual void VccPropertyChangedL( 
+            const TUint aKeyId,
+            const TInt aValue ) = 0;
+    
+    };
+
+
+
+#endif /*M_VCCPSPROPERTYLISTENEROBSERVER_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/vccpropertyhandler_api/inc/vccuipsproperty.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:   Vcc P&S property manager
+*
+*/
+
+
+
+
+#ifndef C_VCCPSPROPERTY_H
+#define C_VCCPSPROPERTY_H
+
+#include <e32base.h>
+#include <e32std.h>
+#include <e32property.h>
+
+#include <vccsubscribekeys.h>
+
+/**
+ *  CVccUiPsProperty manages the VCC P&S keys on the UI side:
+ *
+ *  This class defines the VCC property keys used by the UI.
+ *  It provides access to read/write values. Keys can be deleted.
+ *
+ *  Key KVccPropKeyHoRequest:
+ *      EVccNoRequestOngoing                idle state
+ *      EVccManualStartCsToPsHoRequest      manual HO PS->CS
+ *      EVccManualCancelCsToPsHoRequest     manual HO CS->PS
+ *      EVccUndefinedRequest                P&S key not available
+ *
+ *  @code
+ *      CVccUiPsProperty* iVccPsp = CVccUiPsProperty::NewL();
+ *      ...
+ *      iVccPsp.NotifySubscriberL(EVccManualStartCsToPsHoRequest);
+ *      ...
+ *      iVccPsp.NotifySubscriberL(EVccManualCancelCsToPsHoRequest);
+ *      ...
+ *      delete iVccPsp;
+ *  @endcode
+ *
+ *
+ *  @lib vccuipropertyhandler.lib
+ *  @since S60 v3.2
+ */
+class CVccUiPsProperty : public CBase
+{
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * Defines UI side VCC property keys if they are not available.
+     */
+    IMPORT_C static CVccUiPsProperty* NewL();
+
+    /**
+     * Destructor.
+     * Note! Deletes Vcc UI side property keys
+     */
+    IMPORT_C virtual ~CVccUiPsProperty();
+
+    /**
+     * Update VCC property key KVccPropKeyHoRequest with the given value.
+     *
+     *  @since S60 v3.2
+     * @param aValue The new value
+     */
+    IMPORT_C void NotifySubscriberL( TVccHoRequest aValue );
+
+    /**
+     * Gets the current value of the Vcc property key KVccPropKeyHoRequest.
+     *
+    *  @since S60 v3.2
+     * @param aValue The value of the key
+     * @return KErrNone / KErrPermissionDenied/ KErrNotFound/KErrArgument
+     */
+    IMPORT_C TInt GetCurrentRequest( TVccHoRequest& aValue );
+
+    /**
+     * Deletes keys used by UI
+     */
+    IMPORT_C TInt DeleteKeys();
+
+private:
+    /**
+     * C++ Constructor
+     */
+    CVccUiPsProperty();
+
+    /**
+     * Symbian 2nd phase Constructor
+     */
+    void ConstructL();
+
+    /**
+     * Defines keys used by UI
+     */
+    void DefineKeysL();
+
+    /**
+     * creates handles to property keys used by UI
+     */
+    void CreateHandlesL();
+
+private: //data
+
+    /**
+     * Handle to property which is updated by the UI
+     * Own
+     */
+    RProperty iHoRequestKey;
+};
+
+#endif /*C_VCCPSPROPERTY_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/iptel_plat/vccpropertyhandler_api/inc/vccuipspropertylistener.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,160 @@
+/*
+* 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:   Active object that tracks changes on a PS property.
+*
+*/
+
+
+
+#ifndef C_VCCPSPROPERTYLISTENER_H
+#define C_VCCPSPROPERTYLISTENER_H
+
+#include <e32base.h>
+#include <e32property.h>
+
+#include "mvccpspropertylistenerobserver.h"
+
+/*
+ *  CVccUiPsPropertyListener notes its observers when the value of the VCC
+ *  property changes.
+ *
+ *  This class can get notifications about the VCC properties.
+ *
+ *  @code
+ *  void CExampleClass::ConstructL()
+ *  {
+ *   CVccUiPsPropertyListener* iHoStatusListener =
+ *              CVccUiPsPropertyListener::NewL( KVccPropKeyHoStatus );
+ *   iHoStatusListener.AddObserver( this );
+ *   iHoStatusListener.Start();
+ *  }
+ *
+ *  void CExampleClass::VccPropertyChangedL( const TUint aKeyId,
+            const TInt aValue )
+ *  {
+ *      if( aKeyId )
+ *          {
+ *          switch( aValue )
+ *              {
+ *              case EVccCsToPsHoStarted:
+ *                  // show UI notification
+ *                  break;
+ *              default:
+ *                  break;
+ *              }
+ *          }
+ *  }
+ *
+ *  @endcode
+ *
+ *  @lib vccuipropertyhandler.lib
+ *  @since S60 v3.2
+ */
+class CVccUiPsPropertyListener : public CActive
+    {
+public:
+
+    /**
+     * Symbian two-phased constructor.
+     *
+     * @param aKeyId Id of a key of the property.
+     */
+    IMPORT_C static CVccUiPsPropertyListener* NewL( const TUint aKeyId );
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CVccUiPsPropertyListener();
+
+    /**
+     * Add an observer
+     * @param aObserver Reference to observer object 
+     */
+    IMPORT_C void AddObserverL( MVccPsPropertyListenerObserver& aObserver );
+
+    /**
+     * Remove an observer.
+     * @param aObserver Reference to observer object
+     */
+    IMPORT_C void RemoveObserver( MVccPsPropertyListenerObserver& aObserver );
+
+    /**
+     * Get the current value of the property.
+     * @return Property value
+     */
+    IMPORT_C TInt CurrentValue();
+
+    /**
+     * Start the listener. The listener subscribes to the given property.
+     */
+    IMPORT_C void Start();
+
+private:
+    
+    /**
+     * Constructor.
+     *
+     * @param aKeyId Id of a key of the property.
+     */
+    CVccUiPsPropertyListener( const TUint aKeyId );
+
+    /**
+     * Symbian 2nd phase constructor
+     */
+    void ConstructL();
+    
+    /**
+     * Notifies the observers about the Ho state change.
+     */
+    void NotifyObserversL();
+
+// from base class CActive.
+
+    /**
+     * @see CActive::RunL()
+     */
+    void RunL();
+
+    /**
+     * @see CActive::DoCancel()
+     */
+    void DoCancel();
+
+private: //data
+
+    /**
+     * The uid of the property category to be watched.
+     */
+    TUid iCategoryId;
+
+    /**
+     * The property key uid to be watched.
+     */
+    TUint iKeyId;
+
+    /**
+     * the property category.
+     */
+    RProperty iProperty;
+
+    /**
+     * Obsevers for callback from this.
+     * Observers are not owned.
+     */
+    RPointerArray<MVccPsPropertyListenerObserver> iObservers;
+
+    };
+
+#endif // C_VCCPSPROPERTYLISTENER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "sf/app/iptelephony" >
+]>
+
+<SystemDefinition name="iptelephony" schema="1.4.0">
+  <systemModel>
+    <layer name="app_layer">
+      <module name="iptelephony">
+        <unit name="iptelephony" unitID="te.iptelephony" bldFile="&layer_real_source_path;/group" mrp="" />
+      </module>
+    </layer>
+  </systemModel>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,21 @@
+/*
+* 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 richcallsettingsengine
+*
+*/
+
+
+
+#include "../rcse2/group/bld.inf"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/bwins/rcseu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,34 @@
+EXPORTS
+	??1CRCSEAudioCodecEntry@@UAE@XZ @ 1 NONAME ; CRCSEAudioCodecEntry::~CRCSEAudioCodecEntry(void)
+	??1CRCSEAudioCodecRegistry@@UAE@XZ @ 2 NONAME ; CRCSEAudioCodecRegistry::~CRCSEAudioCodecRegistry(void)
+	??1CRCSEChangeNotifier@@UAE@XZ @ 3 NONAME ; CRCSEChangeNotifier::~CRCSEChangeNotifier(void)
+	??1CRCSEProfileEntry@@UAE@XZ @ 4 NONAME ; CRCSEProfileEntry::~CRCSEProfileEntry(void)
+	??1CRCSEProfileRegistry@@UAE@XZ @ 5 NONAME ; CRCSEProfileRegistry::~CRCSEProfileRegistry(void)
+	?AddL@CRCSEAudioCodecRegistry@@QAEKABVCRCSEAudioCodecEntry@@@Z @ 6 NONAME ; unsigned long CRCSEAudioCodecRegistry::AddL(class CRCSEAudioCodecEntry const &)
+	?AddL@CRCSEProfileRegistry@@QAEKABVCRCSEProfileEntry@@@Z @ 7 NONAME ; unsigned long CRCSEProfileRegistry::AddL(class CRCSEProfileEntry const &)
+	?CancelNotify@CRCSEChangeNotifier@@QAEXXZ @ 8 NONAME ; void CRCSEChangeNotifier::CancelNotify(void)
+	?DeleteL@CRCSEAudioCodecRegistry@@QAEXK@Z @ 9 NONAME ; void CRCSEAudioCodecRegistry::DeleteL(unsigned long)
+	?DeleteL@CRCSEProfileRegistry@@QAEXK@Z @ 10 NONAME ; void CRCSEProfileRegistry::DeleteL(unsigned long)
+	?FindBySIPProfileIdL@CRCSEProfileRegistry@@QAEXKAAV?$RPointerArray@VCRCSEProfileEntry@@@@@Z @ 11 NONAME ; void CRCSEProfileRegistry::FindBySIPProfileIdL(unsigned long, class RPointerArray<class CRCSEProfileEntry> &)
+	?FindByServiceIdL@CRCSEProfileRegistry@@QAEXKAAV?$RPointerArray@VCRCSEProfileEntry@@@@@Z @ 12 NONAME ; void CRCSEProfileRegistry::FindByServiceIdL(unsigned long, class RPointerArray<class CRCSEProfileEntry> &)
+	?FindL@CRCSEAudioCodecRegistry@@QAEXKAAVCRCSEAudioCodecEntry@@@Z @ 13 NONAME ; void CRCSEAudioCodecRegistry::FindL(unsigned long, class CRCSEAudioCodecEntry &)
+	?FindL@CRCSEProfileRegistry@@QAEXABVTDesC16@@AAVCRCSEProfileEntry@@@Z @ 14 NONAME ; void CRCSEProfileRegistry::FindL(class TDesC16 const &, class CRCSEProfileEntry &)
+	?FindL@CRCSEProfileRegistry@@QAEXKAAVCRCSEProfileEntry@@@Z @ 15 NONAME ; void CRCSEProfileRegistry::FindL(unsigned long, class CRCSEProfileEntry &)
+	?GetAllCodecIdsL@CRCSEAudioCodecRegistry@@QAEXAAV?$RArray@K@@@Z @ 16 NONAME ; void CRCSEAudioCodecRegistry::GetAllCodecIdsL(class RArray<unsigned long> &)
+	?GetAllIdsL@CRCSEProfileRegistry@@QAEXAAV?$RArray@K@@@Z @ 17 NONAME ; void CRCSEProfileRegistry::GetAllIdsL(class RArray<unsigned long> &)
+	?GetDefaultCodec@CRCSEAudioCodecRegistry@@QBEXAAVCRCSEAudioCodecEntry@@@Z @ 18 NONAME ; void CRCSEAudioCodecRegistry::GetDefaultCodec(class CRCSEAudioCodecEntry &) const
+	?GetDefaultProfile@CRCSEProfileRegistry@@QBEXAAVCRCSEProfileEntry@@@Z @ 19 NONAME ; void CRCSEProfileRegistry::GetDefaultProfile(class CRCSEProfileEntry &) const
+	?NewL@CRCSEAudioCodecEntry@@SAPAV1@XZ @ 20 NONAME ; class CRCSEAudioCodecEntry * CRCSEAudioCodecEntry::NewL(void)
+	?NewL@CRCSEAudioCodecRegistry@@SAPAV1@XZ @ 21 NONAME ; class CRCSEAudioCodecRegistry * CRCSEAudioCodecRegistry::NewL(void)
+	?NewL@CRCSEChangeNotifier@@SAPAV1@ABVTDesC16@@@Z @ 22 NONAME ; class CRCSEChangeNotifier * CRCSEChangeNotifier::NewL(class TDesC16 const &)
+	?NewL@CRCSEProfileEntry@@SAPAV1@XZ @ 23 NONAME ; class CRCSEProfileEntry * CRCSEProfileEntry::NewL(void)
+	?NewL@CRCSEProfileRegistry@@SAPAV1@XZ @ 24 NONAME ; class CRCSEProfileRegistry * CRCSEProfileRegistry::NewL(void)
+	?NewLC@CRCSEAudioCodecEntry@@SAPAV1@XZ @ 25 NONAME ; class CRCSEAudioCodecEntry * CRCSEAudioCodecEntry::NewLC(void)
+	?NewLC@CRCSEAudioCodecRegistry@@SAPAV1@XZ @ 26 NONAME ; class CRCSEAudioCodecRegistry * CRCSEAudioCodecRegistry::NewLC(void)
+	?NewLC@CRCSEProfileEntry@@SAPAV1@XZ @ 27 NONAME ; class CRCSEProfileEntry * CRCSEProfileEntry::NewLC(void)
+	?NewLC@CRCSEProfileRegistry@@SAPAV1@XZ @ 28 NONAME ; class CRCSEProfileRegistry * CRCSEProfileRegistry::NewLC(void)
+	?NotifyChange@CRCSEChangeNotifier@@QAEXAAVTRequestStatus@@@Z @ 29 NONAME ; void CRCSEChangeNotifier::NotifyChange(class TRequestStatus &)
+	?SetDefaultCodecValueSet@CRCSEAudioCodecEntry@@QAEXVTPtrC16@@@Z @ 30 NONAME ; void CRCSEAudioCodecEntry::SetDefaultCodecValueSet(class TPtrC16)
+	?UpdateL@CRCSEAudioCodecRegistry@@QAEXKABVCRCSEAudioCodecEntry@@@Z @ 31 NONAME ; void CRCSEAudioCodecRegistry::UpdateL(unsigned long, class CRCSEAudioCodecEntry const &)
+	?UpdateL@CRCSEProfileRegistry@@QAEXKABVCRCSEProfileEntry@@@Z @ 32 NONAME ; void CRCSEProfileRegistry::UpdateL(unsigned long, class CRCSEProfileEntry const &)
+
Binary file richcallsettingsengine/rcse2/cenrep/200100FD.txt has changed
Binary file richcallsettingsengine/rcse2/cenrep/2001B26B.txt has changed
Binary file richcallsettingsengine/rcse2/cenrep/keys_rcse.xls has changed
Binary file richcallsettingsengine/rcse2/conf/rcse.confml has changed
Binary file richcallsettingsengine/rcse2/conf/rcse_200100fd.crml has changed
Binary file richcallsettingsengine/rcse2/conf/rcse_2001b26b.crml has changed
Binary file richcallsettingsengine/rcse2/data/10202869.SPD has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/data/backup_registration.xml	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,7 @@
+<?xml version="1.0" standalone="yes"?>
+
+<backup_registration>
+    <dbms_backup policy="10202869" /> 
+    <proxy_data_manager sid = "0x10202BE9" />
+    <restore requires_reboot = "yes"/>
+</backup_registration>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/data/dbms_backup_registration.xml	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,4 @@
+<?xml version="1.0" standalone="yes" ?> 
+ <backup_registration>
+  <dbms_backup policy="10202869" /> 
+ </backup_registration>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/data/voip_profile_db_security_policy.txt	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+;/*
+;* ==============================================================================
+;*  Name        : voip_profile_db_security_policy.txt
+;*  Part of     : RCSE / RCSE
+;*  Description : Database policy file for VoIP profile database.
+;*  Version     : %version: ou1s60rt#4 %
+;*
+;*  Copyright © 2002-2004 Nokia. All rights reserved.
+;*  This material, including documentation and any related 
+;*  computer programs, is protected by copyright controlled by 
+;*  Nokia. All rights are reserved. Copying, including 
+;*  reproducing, storing, adapting or translating, any 
+;*  or all of this material requires the prior written consent of 
+;*  Nokia. This material also contains confidential 
+;*  information which may not be disclosed to others without the 
+;*  prior written consent of Nokia.
+;* ==============================================================================
+;*/
+
+;//
+;// Start of policy file
+;//
+[database]
+
+;//
+;// Required capabilities when reading database.
+;//
+read
+capability = ReadDeviceData
+
+;//
+;// Required capabilities when writing to database.
+;//
+write
+capability = WriteDeviceData
+
+;//
+;// Required capabilities when altering database structure.
+;//
+schema
+capability = WriteDeviceData
+
+[BACKUP]
+SID = 10202869
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/eabi/rcseu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,58 @@
+EXPORTS
+	_ZN17CRCSEProfileEntry4NewLEv @ 1 NONAME
+	_ZN17CRCSEProfileEntry5NewLCEv @ 2 NONAME
+	_ZN17CRCSEProfileEntryD0Ev @ 3 NONAME
+	_ZN17CRCSEProfileEntryD1Ev @ 4 NONAME
+	_ZN17CRCSEProfileEntryD2Ev @ 5 NONAME
+	_ZN19CRCSEChangeNotifier12CancelNotifyEv @ 6 NONAME
+	_ZN19CRCSEChangeNotifier12NotifyChangeER14TRequestStatus @ 7 NONAME
+	_ZN19CRCSEChangeNotifier4NewLERK7TDesC16 @ 8 NONAME
+	_ZN19CRCSEChangeNotifierD0Ev @ 9 NONAME
+	_ZN19CRCSEChangeNotifierD1Ev @ 10 NONAME
+	_ZN19CRCSEChangeNotifierD2Ev @ 11 NONAME
+	_ZN20CRCSEAudioCodecEntry23SetDefaultCodecValueSetE7TPtrC16 @ 12 NONAME
+	_ZN20CRCSEAudioCodecEntry4NewLEv @ 13 NONAME
+	_ZN20CRCSEAudioCodecEntry5NewLCEv @ 14 NONAME
+	_ZN20CRCSEAudioCodecEntryD0Ev @ 15 NONAME
+	_ZN20CRCSEAudioCodecEntryD1Ev @ 16 NONAME
+	_ZN20CRCSEAudioCodecEntryD2Ev @ 17 NONAME
+	_ZN20CRCSEProfileRegistry10GetAllIdsLER6RArrayImE @ 18 NONAME
+	_ZN20CRCSEProfileRegistry16FindByServiceIdLEmR13RPointerArrayI17CRCSEProfileEntryE @ 19 NONAME
+	_ZN20CRCSEProfileRegistry19FindBySIPProfileIdLEmR13RPointerArrayI17CRCSEProfileEntryE @ 20 NONAME
+	_ZN20CRCSEProfileRegistry4AddLERK17CRCSEProfileEntry @ 21 NONAME
+	_ZN20CRCSEProfileRegistry4NewLEv @ 22 NONAME
+	_ZN20CRCSEProfileRegistry5FindLERK7TDesC16R17CRCSEProfileEntry @ 23 NONAME
+	_ZN20CRCSEProfileRegistry5FindLEmR17CRCSEProfileEntry @ 24 NONAME
+	_ZN20CRCSEProfileRegistry5NewLCEv @ 25 NONAME
+	_ZN20CRCSEProfileRegistry7DeleteLEm @ 26 NONAME
+	_ZN20CRCSEProfileRegistry7UpdateLEmRK17CRCSEProfileEntry @ 27 NONAME
+	_ZN20CRCSEProfileRegistryD0Ev @ 28 NONAME
+	_ZN20CRCSEProfileRegistryD1Ev @ 29 NONAME
+	_ZN20CRCSEProfileRegistryD2Ev @ 30 NONAME
+	_ZN23CRCSEAudioCodecRegistry15GetAllCodecIdsLER6RArrayImE @ 31 NONAME
+	_ZN23CRCSEAudioCodecRegistry4AddLERK20CRCSEAudioCodecEntry @ 32 NONAME
+	_ZN23CRCSEAudioCodecRegistry4NewLEv @ 33 NONAME
+	_ZN23CRCSEAudioCodecRegistry5FindLEmR20CRCSEAudioCodecEntry @ 34 NONAME
+	_ZN23CRCSEAudioCodecRegistry5NewLCEv @ 35 NONAME
+	_ZN23CRCSEAudioCodecRegistry7DeleteLEm @ 36 NONAME
+	_ZN23CRCSEAudioCodecRegistry7UpdateLEmRK20CRCSEAudioCodecEntry @ 37 NONAME
+	_ZN23CRCSEAudioCodecRegistryD0Ev @ 38 NONAME
+	_ZN23CRCSEAudioCodecRegistryD1Ev @ 39 NONAME
+	_ZN23CRCSEAudioCodecRegistryD2Ev @ 40 NONAME
+	_ZNK20CRCSEProfileRegistry17GetDefaultProfileER17CRCSEProfileEntry @ 41 NONAME
+	_ZNK23CRCSEAudioCodecRegistry15GetDefaultCodecER20CRCSEAudioCodecEntry @ 42 NONAME
+	_ZTI15CRCSEDbImporter @ 43 NONAME ; #<TI>#
+	_ZTI17CRCSEProfileEntry @ 44 NONAME ; #<TI>#
+	_ZTI17CRCSERegistryBase @ 45 NONAME ; #<TI>#
+	_ZTI19CRCSEChangeNotifier @ 46 NONAME ; #<TI>#
+	_ZTI20CRCSEAudioCodecEntry @ 47 NONAME ; #<TI>#
+	_ZTI20CRCSEProfileRegistry @ 48 NONAME ; #<TI>#
+	_ZTI23CRCSEAudioCodecRegistry @ 49 NONAME ; #<TI>#
+	_ZTV15CRCSEDbImporter @ 50 NONAME ; #<VT>#
+	_ZTV17CRCSEProfileEntry @ 51 NONAME ; #<VT>#
+	_ZTV17CRCSERegistryBase @ 52 NONAME ; #<VT>#
+	_ZTV19CRCSEChangeNotifier @ 53 NONAME ; #<VT>#
+	_ZTV20CRCSEAudioCodecEntry @ 54 NONAME ; #<VT>#
+	_ZTV20CRCSEProfileRegistry @ 55 NONAME ; #<VT>#
+	_ZTV23CRCSEAudioCodecRegistry @ 56 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+
+PRJ_PLATFORMS
+default armv5
+
+PRJ_EXPORTS
+// Public headers
+../inc/crcseaudiocodecentry.h             |../../../inc/crcseaudiocodecentry.h
+../inc/crcseaudiocodecregistry.h          |../../../inc/crcseaudiocodecregistry.h
+
+// Database security policy file for emulator.
+../data/10202869.SPD                /epoc32/release/winscw/udeb/z/private/100012a5/policy/10202869.spd
+../data/10202869.SPD                /epoc32/release/winscw/urel/z/private/100012a5/policy/10202869.spd
+../data/10202869.SPD                /epoc32/data/z/private/100012a5/policy/10202869.spd
+
+// Backup registration file for databases.
+//../data/backup_registration.xml     z:/private/10202869/backup_registration.xml
+../data/backup_registration.xml     /epoc32/data/z/private/10202869/backup_registration.xml
+../data/backup_registration.xml     /epoc32/release/winscw/udeb/z/private/10202869/backup_registration.xml
+../data/backup_registration.xml     /epoc32/release/winscw/urel/z/private/10202869/backup_registration.xml
+
+// CenRep ini-file
+../cenrep/200100FD.txt                /epoc32/release/winscw/udeb/z/private/10202be9/200100fd.txt
+../cenrep/200100FD.txt                /epoc32/data/z/private/10202be9/200100fd.txt
+../cenrep/200100FD.txt		      /epoc32/winscw/c/private/10202be9/200100fd.txt
+
+../conf/rcse.confml             APP_LAYER_CONFML(rcse.confml)
+../conf/rcse_200100fd.crml      APP_LAYER_CRML(rcse_200100fd.crml)
+
+../rom/rcse2.iby CORE_APP_LAYER_IBY_EXPORT_PATH( rcse2.iby )
+
+// CenRep ini-file for codecs
+../cenrep/2001B26B.txt                /epoc32/release/winscw/udeb/z/private/10202be9/2001b26b.txt
+../cenrep/2001B26B.txt                /epoc32/data/z/private/10202be9/2001b26b.txt
+../cenrep/2001B26B.txt		      /epoc32/winscw/c/private/10202be9/2001b26b.txt
+
+../conf/rcse_2001b26b.crml      APP_LAYER_CRML(rcse_2001b26b.crml)
+
+
+PRJ_MMPFILES
+rcse.mmp
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/group/make_db_security_policy_file.bat	Wed Sep 01 12:29:57 2010 +0100
@@ -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:
+rem
+
+REM Copy the policy file from ..\data -folder to \epoc32\Winscw\c -folder.
+echo off
+xcopy ..\data\voip_profile_db_security_policy.txt \epoc32\winscw\c /Y
+
+echo Running the policy file converter.
+\epoc32\release\winscw\udeb\edbspconv /f=c:\voip_profile_db_security_policy.txt /b=c:\10202869.spd
+
+echo copying the security policy file to s60\rcse\data
+xcopy \epoc32\winscw\c\10202869.spd \s60\rcse\data\ /Y
+
+echo Removing copied files
+del \epoc32\winscw\c\voip_profile_db_security_policy.txt
+del \epoc32\winscw\c\10202869.spd 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/group/rcse.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,57 @@
+/*
+* 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:  mmp-file
+*
+*/
+
+#include <platform_paths.hrh>
+
+TARGET          rcse.dll
+TARGETTYPE      DLL
+UID             0x1000008D 0x10202869
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+
+SOURCEPATH      ../src
+SOURCE          crcseprofileentry.cpp
+SOURCE          crcseprofileregistry.cpp
+SOURCE          crcseaudiocodecentry.cpp
+SOURCE          crcseaudiocodecregistry.cpp
+SOURCE          crcsechangenotifier.cpp
+SOURCE          rcsepanic.cpp
+SOURCE          rcsebackupobserver.cpp
+SOURCE          rcseregistrybase.cpp
+SOURCE          rcsedbimporter.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../inc/stubs
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../../inc
+
+LIBRARY         euser.lib // Needed for classes that are derived from CBase class. 
+LIBRARY         edbms.lib // Needed for creating DBMS session.
+LIBRARY         efsrv.lib // For accessing/editing files.
+LIBRARY         bafl.lib  // Provides simple-to-use file system utilities used by SQL factories.
+LIBRARY         sipprofilecli.lib       // For SIP settings
+LIBRARY         flogger.lib     // for logging
+LIBRARY         serviceprovidersettings.lib // Service provider settings
+
+LIBRARY         featmgr.lib // Feature Manager 
+LIBRARY         cenrepdatabase.lib
+LIBRARY         centralrepository.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/crcseaudiocodecentry.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,184 @@
+/*
+* 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:  Single audio codec entry, which is stored to RCSE
+*
+*/
+
+
+
+#ifndef CRCSEAUDIOCODECENTRY_H
+#define CRCSEAUDIOCODECENTRY_H
+
+//  INCLUDES
+#include <e32base.h>
+
+#include <crcseprofileentry.h>
+
+// CONSTANTS
+const TInt KMaxMediaTypeNameLenght = 64;
+const TInt KMaxCodecNameLength = 32;
+
+// Literals that are used to SetDefaultCodecValueSet for different
+// codecs (aCodecType).
+_LIT( KAudioCodecAMR,      "AMR"         );
+_LIT( KAudioCodeciLBC,     "iLBC"        );
+_LIT( KAudioCodecVMRWB,    "VMR-WB"      );
+_LIT( KAudioCodecPCMA,     "PCMA"        );
+_LIT( KAudioCodecPCMU,     "PCMU"        );
+_LIT( KAudioCodecG726_40,  "G726-40"     );
+_LIT( KAudioCodecG726_32,  "G726-32"     );
+_LIT( KAudioCodecG726_24,  "G726-24"     );
+_LIT( KAudioCodecG726_16,  "G726-16"     );
+_LIT( KAudioCodecCN,       "CN"          );
+_LIT( KAudioCodecG729,     "G729"        );
+_LIT( KAudioCodecAMRWB,    "AMR-WB"      );
+_LIT( KAudioCodecGSMEFR,   "GSM-EFR"     );
+_LIT( KAudioCodecGSMFR,    "GSM-FR"      );
+_LIT( KAudioCodecEVRC,     "EVRC"        );
+_LIT( KAudioCodecEVRC0,    "EVRC0"       );
+_LIT( KAudioCodecSMV,      "SMV"         );
+_LIT( KAudioCodecSMV0,     "SMV0"        );
+
+
+// CLASS DECLARATION
+
+/**
+*  Audio Codec entry, which is stored to RCSE.
+*
+*  @lib RCSE.lib
+*  @since Series 60 3.0
+*/
+class CRCSEAudioCodecEntry : public CBase
+    {
+    public: // Enums
+    
+    enum TOnOff
+        {
+        EOONotSet = KNotSet,
+        EOff = 0,
+        EOn = 1
+        };
+
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSEAudioCodecEntry* NewL();
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSEAudioCodecEntry* NewLC();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CRCSEAudioCodecEntry();
+        
+    public: // New methods
+      
+        /**
+        * Resets entry to default values.
+        * @since Series 60 3.0
+        */
+        void ResetDefaultCodecValues();
+        
+        /**
+        * Sets defeault values for different codecs.
+        * @param aCodecType defines codec specific parameter default values.
+        * @since Series 60 3.0
+        */      
+        IMPORT_C void SetDefaultCodecValueSet( TPtrC aCodecType );
+        
+    private:
+    
+        /**
+        * C++ default constructor.
+        * Initialises values to ENotSet.
+        */
+        CRCSEAudioCodecEntry();
+
+	    /**
+    	* By default Symbian 2nd phase constructor is private.
+    	*/
+    	void ConstructL();
+        
+    public: // Data
+    
+        // Identifier of audio codec.
+        TUint32 iCodecId;
+        
+        // Identifier of used for define Media type name.
+        TBuf<KMaxMediaTypeNameLenght> iMediaTypeName;
+            
+        // Identifier of used for define media subtype name. This values is set by CRCSEAudioCodec, when
+        // audio codec entry is got from CRCSEAudioCodec.
+        TBuf<KMaxCodecNameLength> iMediaSubTypeName;
+        
+        // Jitter buffer size.        
+        TInt32 iJitterBufferSize;
+        
+        // Octet-align.
+        TOnOff iOctetAlign;
+        
+        // Mode-set.
+        RArray<TUint32> iModeSet;
+                
+        // Mode-change-period.
+        TInt32 iModeChangePeriod;
+        
+        // Mode-change-neighbor.
+        TOnOff iModeChangeNeighbor;
+                
+        // Ptime.
+        TInt32 iPtime;
+        
+        // Maxptime.
+        TInt32 iMaxptime;
+        
+        // Crc.
+        TOnOff iCrc;
+        
+        // Robust-sorting.
+        TOnOff iRobustSorting;
+        
+        // Interleaving.
+        TInt32 iInterLeaving;
+        
+        // Channels.
+        RArray<TUint32> iChannels;
+        
+        // Voice Activation Deactivation (VAD).
+        TOnOff iVAD;
+        
+        // Discontinous transmission (DTX).
+        TOnOff iDTX;
+        
+        // Sampling rate.
+        TInt32 iSamplingRate;
+        
+        // Annex b.
+        TOnOff iAnnexb;
+
+        // Mode change capability.
+        TInt32 iModeChangeCapability;
+
+        // Max-red.
+        TInt32 iMaxRed;
+    };
+
+#endif      // CRCSEAUDIOCODECENTRY_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/crcseaudiocodecregistry.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,214 @@
+/*
+* 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:  Offers API for storing, getting and updating Audio Codec entry.
+*
+*/
+
+
+
+#ifndef CRCSEAUDIOCODECREGISTRY_H
+#define CRCSEAUDIOCODECREGISTRY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <rcseregistrybase.h>
+
+// FORWARD DECLARATIONS
+class CRCSEAudioCodecEntry;
+
+// CLASS DECLARATION
+
+/**
+*  Offers getting, setting and updating of Audio codec entries.
+*
+*  @lib RCSE.lib
+*  @since S60 v3.0
+*/
+class CRCSEAudioCodecRegistry: public CRCSERegistryBase
+    {
+public:  // Constructors and destructor
+
+    /**
+    * Two-phased constructor.
+    */
+    IMPORT_C static CRCSEAudioCodecRegistry* NewLC();
+    
+    /**
+    * Two-phased constructor.
+    */
+    IMPORT_C static CRCSEAudioCodecRegistry* NewL();        
+    
+    /**
+    * Destructor.
+    */       
+    IMPORT_C virtual ~CRCSEAudioCodecRegistry();
+    
+public: // New functions
+
+    /**
+    * Adds new audio codec entry.
+    *
+    * @since S60 v3.0
+    * @param aCodecEntry New entry.
+    * @return Codec identifier of the added audio codec entry.
+    */
+
+    IMPORT_C TUint32 AddL(const CRCSEAudioCodecEntry& aCodecEntry );
+               
+    /**
+    * Gets all codec identifiers which are stored to RCSE. If there are
+    * no codecs stored, aAllIds will contain zero entries.
+    *
+    * @since S60 v3.0
+    * @param aAllIds Array, where the codec identifiers are stored.
+    */
+    IMPORT_C void GetAllCodecIdsL( RArray<TUint32>& aAllIds );
+    
+    /**
+    * Search a Audio Codec entry, which id is same as aCodecId. 
+    * Leaves with KErrNotFound if such profile is not found.
+    * Default values are reseted to aFoundEntry before the search.
+    * the new values are set to it.
+    *
+    * @since S60 v3.0
+    * @param aCodecId Search criteria for Audio Codec.
+    * @param aFoundEntry A found audio codec entry.
+    */
+    IMPORT_C void FindL( TUint32 aCodecId, 
+        CRCSEAudioCodecEntry& aFoundEntry );
+        
+    /**
+    * Deletes a codec, which codec id is same than aCodecId. 
+    *
+    * @since S60 v3.0
+    * @param aCodecId Audio Codec identifier
+    */
+    IMPORT_C void DeleteL( TUint32 aCodecId );
+    
+    /**
+    * Updates codec, which codec identifier is same than aCodecId.
+    * Only settings that are set in aUpdateData are updated in codec.
+    * Leaves with KErrNotFound if codec is not found.
+    *
+    * @since S60 v3.0
+    * @param aCodecId codec identifier.
+    * @param aUpdateData Updated data, which are updated to codec.
+    */
+    IMPORT_C void UpdateL( TUint32 aCodecId, 
+        const CRCSEAudioCodecEntry& aUpdateData );
+
+    /**
+    * Gets default codec. Default codec is a codec, which
+    * can be used when no other codec is available. AFoundEntrys 
+    * buffers and arrays are freed, before the new values are set to it.
+    *
+    * @since S60 v3.0
+    * @param aDefaultCodec Default codec settings are set to this.
+    */
+    IMPORT_C void GetDefaultCodec( 
+        CRCSEAudioCodecEntry& aDefaultCodec ) const;
+
+
+    /**
+    * Adds bunch of audio codec entries to store in one transaction.
+    *
+    * @since S60 v3.2
+    * @param aEntries 
+    */
+    void AddL( RPointerArray<CRCSEAudioCodecEntry>& aEntries );
+
+    /**
+    * Delete bunch of audio codec entries from store in one transaction.
+    *
+    * @since S60 v3.2
+    * @param aIds Codec IDs
+    */
+    void DeleteL( const RArray<TUint32>& aIds );
+
+protected:  // New functions
+
+    /**
+    * C++ default constructor.
+    */
+    CRCSEAudioCodecRegistry();
+
+private:
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    /**
+    * Do actual search of requested entry.
+    * Leaves with KErrNotFound if such profile is not found.
+    * Default values are reseted to aFoundEntry before the search.
+    *
+    * @since S60 v3.0.
+    * @param aProfileId Search criteria for profiles.
+    * @param aFoundEntry A found profile entry
+    * @leave KErrNotFound if audio codec doesn't exist.
+    */
+    void FindEntryL( TUint32 aProfileId, CRCSEAudioCodecEntry& aFoundEntry );
+
+    /**
+    * Adds or updates settings entry to storage depending of the aId
+    * parameter. Entry is stored as new entry if aId parameter have
+    * been set to KNoEntryId, otherwise existing entry is updated.
+    *
+    * @since S60 v3.2
+    * @param aId ID of entry if exists. 
+    * @param aEntry Entry to be added to storage.
+    * @param aUpdate Determines add or update operation.
+    *                New entry is added when value is set to EFalse (default).
+    * @return ID of entry.
+    */
+    void AddOrUpdateEntryL( TUint32& aId,
+                            const CRCSEAudioCodecEntry& aEntry );
+
+
+    /**
+    * Convert xxx
+    * .
+    *
+    * @since S60 v3.2.
+    * @param aEntry
+    * @param aProperties
+    */
+    void ConvertPropertiesToEntryL( CRCSEAudioCodecEntry& aEntry,
+                                    RIpAppPropArray& aProperties );
+
+
+    /**
+    * Convert xxx
+    * .
+    *
+    * @since S60 v3.2.
+    * @param aEntry
+    * @param aProperties
+    */
+    void ConvertEntryToPropertiesL( const CRCSEAudioCodecEntry& aEntry,
+                                    RIpAppPropArray& properties );
+
+
+    // For testing
+    #ifdef TEST_EUNIT
+        friend class UT_CRCSEAudioCodecRegistry;
+    #endif                                  
+
+    };
+
+#endif      // CRCSEAUDIOCODECREGISTRY_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/crcsechangenotifier.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,153 @@
+/*
+* 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:  Provides notification service for changes in settings.
+*
+*/
+
+
+
+#ifndef CRCSECHANGENOTIFIER_H
+#define CRCSECHANGENOTIFIER_H
+
+//  INCLUDES
+#include <centralrepository.h>
+#include <e32base.h>
+#include <rcsedefaultdbnames.h>
+#include <mrcsebackupobserver.h>
+
+// FORWARD DECLARATIONS
+class CRCSEBackupObserver;
+
+// CLASS DECLARATION
+
+/**
+*  Provides notification service for any changes in storage.
+*
+*  @lib RCSE.lib
+*  @since S60 v3.0
+*/
+class CRCSEChangeNotifier : public CBase, public MRCSEBackupObserver
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    *
+    * @param aName defines used notifier. aNames are defined 
+    *        in RCSEDefaultDBNames.h.
+    */
+    IMPORT_C static CRCSEChangeNotifier* NewL( const TDesC& aName );
+    
+    /**
+    * Destructor.
+    */
+    IMPORT_C virtual ~CRCSEChangeNotifier();
+
+public: // From base classes
+
+    /**
+    * Handle backup observer event
+    *
+    * @since S60 v3.0
+    */
+    void HandleBackupOperationEventL();
+
+public: // New functions
+    
+    /**
+    * Makes an asyncronous request for notification of changes in
+    * VoIP profiles. The change can be anything from adding, deleting or
+    * updating a profile. The request status > KErrNone in case of commit.
+    *
+    * @since S60 v3.0
+    * @param aStatus The request status object, 
+    */
+    IMPORT_C void NotifyChange( TRequestStatus& aStatus );
+
+    /**
+    * Cancels outstanding notify request.
+    *
+    * @since S60 v3.0
+    */
+    IMPORT_C void CancelNotify();
+    
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CRCSEChangeNotifier();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    *
+    * @param aName used database identifier.
+    */
+    void ConstructL( const TDesC& aName );
+
+    /**
+    * Setup notifier to requested data source
+    *
+    * @since S60 v3.1
+    */
+    void SetNotifierL( TRequestStatus& aStatus );
+
+
+private:    // Data
+
+    /**
+     * Central Repository object.
+     * Own.
+     */
+    CRepository* iRepository;
+
+    /**
+     * Request status if notify request is made during backup
+     * Own.
+     */
+    TBuf<100> iName;
+
+    /**
+     * Request status if notify request is made during backup
+     * No Own.
+     */
+    TRequestStatus* iReqStatus;
+
+    /**
+     * Backup / Restore observer
+     * Own.
+     */
+	CRCSEBackupObserver* iBackupObserver;
+
+    /**
+     * Defines range of keys where notifications are requested.
+     */
+    TUint32 iRange;
+
+    /**
+     * Indicates whether notifications requested or not.
+     */
+    TBool iNotifyRequested;
+
+    // For testing
+    #ifdef TEST_EUNIT
+        friend class UT_CRCSEChangeNotifier;
+    #endif                                  
+
+
+    };
+
+#endif      // CRCSECHANGENOTIFIER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/rcsebackupobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 observer class for backup events
+*
+*/
+
+
+
+#ifndef CRCSEBACKUPOBSERVER_H
+#define CRCSEBACKUPOBSERVER_H
+
+#include <e32base.h>
+#include <e32property.h>
+
+class MRCSEBackupObserver;
+
+/**
+ *  Implements observer class for backup events.
+ *
+ *  @lib rcse.lib
+ *  @since S60 3.0
+ */
+NONSHARABLE_CLASS( CRCSEBackupObserver ) : public CActive
+{
+public:
+    static CRCSEBackupObserver* NewL( MRCSEBackupObserver& aObserver );
+
+    ~CRCSEBackupObserver();
+
+    /**
+     * Return backup / restore status
+     *
+     * @since S60 3.0
+     * @return ETrue if backup or restore is ongoing, else EFalse
+     */
+    TBool IsBackupOperationRunning();
+
+protected:
+
+    /**
+     * From CActive.
+     * Cancel.
+     *
+     * @since S60 3.0
+     */
+    void DoCancel();
+
+    /**
+     * From CActive.
+     * Handle backup event notification.
+     *
+     * @since S60 3.0
+     */
+    void RunL();
+
+private:
+
+    CRCSEBackupObserver( MRCSEBackupObserver& aObserver );
+    void ConstructL();
+
+private:
+
+    /**
+     * Publish & Subscribe connection
+     */
+    RProperty       iBackupStatus;
+
+    /**
+     * Observer object
+     */
+    MRCSEBackupObserver& iObserver;
+
+private:
+    // For testing
+    #ifdef TEST_EUNIT
+        friend class UT_CRCSEBackupObserver;
+    #endif                                  
+
+
+
+};
+
+#endif // CRCSEBACKUPOBSERVER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/rcseconstants.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,193 @@
+/*
+* 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:  Constants
+*
+*/
+
+
+
+#ifndef RCSECONSTANTS
+#define RCSECONSTANTS
+
+
+//============================================================================
+// CONSTANTS
+
+const TInt KDesLength256 = 256;    //KMaxProviderNameLength;
+const TInt KDesLength128 = 128;
+const TInt KDesLength64  = 64;
+const TInt KDesLength15  = 15;
+
+// Timeout in microseconds for waiting a semaphore
+const TInt KRCSETimeOut = 5000000;  
+
+// Identifies entry row in settings table
+_LIT( KVoIPEntry, "VoIPEntry" );
+_LIT( KCodecEntry, "CodecEntry" );
+
+// Space character
+_LIT( KSpace, " " );
+
+// Profile specific settings names.
+_LIT( KProtocolIds,                 "PRID"        );
+_LIT( KSiqnalingQOS,                "SQOS"        );
+_LIT( KSettingsName,                "SN"          );
+_LIT( KAutoComplete,                "AC"          );
+_LIT( KEndMediaPort,                "EMP"         );
+_LIT( KHoldRingBack,                "HRB"         );
+_LIT( KInbandDtmf,                  "IDTMF"       );
+_LIT( KMediaQOS,                    "MQOS"        );
+_LIT( KOutbandDtmf,                 "ODTMF"       );
+_LIT( KPreferredCodecs,             "PC"          );
+_LIT( KProfileId,                   "PI"          );
+_LIT( KProviderName,                "PN"          );
+_LIT( KRedundancy,                  "R"           );
+_LIT( KStartMediaPort,              "SMP"         );
+_LIT( KCFNoAnswer,                  "CFNA"        );
+_LIT( KCFBusy,                      "CFB"         );
+_LIT( KCFUnconditional,             "CFU"         );
+_LIT( KSecureCallPreference,        "SCP"         );
+_LIT( KVoIPProfileLock,             "VPL"         );
+_LIT( KAdhocAllowed,                "AHA"         );
+_LIT( KSIPServerType,               "SST"         );
+_LIT( KSBCType,                     "SBCT"        );
+_LIT( KSTUNServerType,              "STUNST"      );
+_LIT( KWLANAPType,                  "WLANAPT"     );
+_LIT( KPSTNGatewayType,             "PSTNGT"      );
+_LIT( KSecurityGatewayType,         "SGT"         );
+_LIT( KRTCP,                        "RTCP"        );
+_LIT( KSIPVoIPUAHTerminalType,      "UATT"        );
+_LIT( KSIPVoIPUAHeaderWLANMAC,      "UAWMAC"      );
+_LIT( KSIPVoIPUAHeaderString,       "UAHS"        );
+_LIT( KProfileLockedToIAP,          "PLTI"        );
+_LIT( KVoIPPluginUID,               "VUID"        );
+_LIT( KAllowVoIPoverWCDMA,          "AWCDMA"      );
+_LIT( KAllowVoIPoverBT,             "ABT"         );
+_LIT( KMeanCountOfVoIPDigits,       "MCVP"        );
+_LIT( KIgnoreAddrDomainPart,        "IADR"        );
+
+_LIT( KHandoverDialect,             "HD"    );
+_LIT( KPSTelephonyHOPreference,     "PSHOP" );
+_LIT( KHOThresholdValueLL,          "HOLL"  );
+_LIT( KHOThresholdValueHL,          "HOHL"  );
+_LIT( KNumberOfMeasurementsAbove,   "NMA"   );
+_LIT( KNumberOfMeasurementsBelow,   "NMB"   );
+_LIT( KSmartScannInterParaHigh,     "SSPH"  );
+_LIT( KSmartScannInterParaMedium,   "SSPM"  );
+_LIT( KSmartScannInterParaLow,      "SSPL"  );
+_LIT( KSmartScannInterParaStatic,   "SSPS"  );
+
+_LIT( KSmartScannDurationHighMode,      "SSHG"  );
+_LIT( KSmartScannDurationMediumMode,    "SSMM"  );
+_LIT( KSmartScannDurationLowMode,       "SSLM"  );
+_LIT( KHandoffNumber,                   "HON"   );
+_LIT( KHandbackNumber,                  "HBN"   );
+_LIT( KHysterisisTimer,                 "HT"    );
+_LIT( KHandOffProcessTimer,             "HOPT"  );
+_LIT( KDisconnectProcessTimer,          "DPT"   );
+_LIT( KHandoffPrefix,                   "HOP"   );
+_LIT( KHandbackPrefix,                  "HBP"   );
+_LIT( KHandoverTones,                   "HTO"   );
+_LIT( KSupportSMSoverWLAN,              "SSW"   );
+
+_LIT( KServiceProviderId,                "SPID"  );
+_LIT( KUserPhoneUriParam,                "UPP"   );
+_LIT( KSIPConnTestAddress,               "CTEST" );
+_LIT( KNATSettingsStorageId,             "NSID"  );
+_LIT( KSIPMinSE,                         "MINSE" );
+_LIT( KSIPSessionExpires,                "SESEX" );
+_LIT( KNATProtocol,                      "NAT"   );
+_LIT( KNewServiceTable,                  "NEWST" );
+_LIT( KSNAPId,                           "SNAP"  );
+
+// SCCP settings names.
+_LIT( KSCCPSettingId,               "SSI"         );
+_LIT( KSCCPProfileName,             "SNAME"       );
+_LIT( KVOIPLogin,                   "VPL"         );
+_LIT( KAccessPoint,                 "AP"          );
+_LIT( KCallManagerAdd0,             "CMA0"        );
+_LIT( KCallManagerAdd1,             "CMA1"        );
+_LIT( KCallManagerAdd2,             "CMA2"        );
+_LIT( KCallManagerAdd3,             "CMA3"        );
+_LIT( KCallManagerAdd4,             "CMA4"        );
+_LIT( KStackVersion,                "SPS"         );
+_LIT( KDHCPTFTPEnabled,             "DCTT"        );
+_LIT( KTFTPServerAddress,           "TTSA"        );
+_LIT( KPhoneNumber,                 "SPN"         );
+_LIT( KSCCPCertificates,            "SSF"         );
+_LIT( KMusicServerAdd,              "MS"          );
+_LIT( KCFUncondAdd,                 "CFUA"        );
+_LIT( KSCCPVmbx,                    "SVMBX"       );
+_LIT( KSCCPIntCallPrefix,           "SICP"        );
+
+// SIP Profile settings names.
+_LIT( KVOIPSIPProfileSpecificId,    "VSPSI"       );
+_LIT( KSIPProfileId2,               "SPI"         );
+_LIT( KConferencingFactoryURI,      "CFURI"       );
+_LIT( KMusicServerURI,              "MSURI"       );
+_LIT( KIPVoiceMailBoxURI,           "IVMB"        );
+_LIT( KCFNoAnsURI,                  "CFNAU"       );
+_LIT( KCFBusyURI,                   "CFBURI"      );
+_LIT( KCFUncondURI,                 "CFUURI"      );
+
+// Audio Codec settings names.
+_LIT( KAudioCodecId,                "ACI"         );
+_LIT( KMediaTypeName,               "MTN"         );
+_LIT( KMediaSubTypeName,            "MSTN"        );
+_LIT( KJitterBufferSize,            "JBS"         );
+_LIT( KOctetAlign,                  "OA"          );
+_LIT( KModeSet,                     "ME"          );
+_LIT( KModeChangePeriod,            "MCP"         );
+_LIT( KModeChangeNeighbor,          "MCN"         );
+_LIT( KPtime,                       "PT"          );
+_LIT( KMaxptime,                    "MPT"         );
+_LIT( KCrc,                         "CRC"         );
+_LIT( KRobustSorting,               "RS"          );
+_LIT( KInterLeaving,                "IL"          );
+_LIT( KChannels,                    "CH"          );
+_LIT( KVAD,                         "VAD"         );
+_LIT( KDTX,                         "DTX"         );
+_LIT( KSamplingRate,                "SR"          );
+_LIT( KAnnexb,                      "AB"          );
+_LIT( KModeChangeCapability,        "MCC"         );
+_LIT( KMaxRed,                      "MR"          );
+
+
+
+// Constants for supporting restore from db
+
+// CONSTANTS
+// Security uid, which identifies the security policy file used for this
+// database.
+_LIT( KDatabaseUID, "SECURE[10202869]" );
+
+// Profile table name in db.
+_LIT( KProfileTableName, "profile" );
+
+// Audio Codec table name in Audio db.
+_LIT( KAudioCodecTableName, "audiocodec" );
+
+// SCCP table name in SCCP db.
+_LIT( KSCCPSettingTableName, "sccpsetting" );
+
+// SIP Profile table name in SIP db.
+_LIT( KSIPTableName, "sipprofiles" );
+
+//  SQL statement formats
+_LIT( KSQLSelectAllStatement, "SELECT * FROM %S" );
+
+
+#endif      // RCSECONSTANTS   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/rcsedbimporter.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,256 @@
+/*
+* 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:  RCSE Settings Import from DBMS
+*
+*/
+
+
+
+#ifndef C_RCSEDBIMPORTER_H
+#define C_RCSEDBIMPORTER_H
+
+
+#include <e32base.h>
+#include <d32dbms.h>
+
+#include "crcseprofileentry.h"
+#include "crcseaudiocodecentry.h"
+
+
+/**  Struct for mapping old and new ids of entries */
+class TRCSEIdPair
+    {
+public:
+    TUint32 iOldId;
+    TUint32 iNewId;
+    };
+
+/**
+ *  Utility class that imports rcse settings from database and
+ *  stores them to central repository.
+ *
+ *  Enables the restoring of voip settings from previous SW versions.
+ *
+ *  @code
+ *   if ( CRCSEDbImporter::ImportExists() && 
+          !CRCSEDbImporter::IsImportRunning() )
+        {
+        CRCSEDbImporter* importer = CRCSEDbImporter::NewLC();
+        importer->ImportAndStoreL();
+        CleanupStack::PopAndDestroy( importer );
+        }
+
+ *  @endcode
+ *
+ *  @lib rcse.lib
+ *  @since S60 v3.2
+ */
+class CRCSEDbImporter : public CBase
+    {
+
+public:
+
+    static CRCSEDbImporter* NewL();
+
+    static CRCSEDbImporter* NewLC();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CRCSEDbImporter();
+
+    /**
+     * Check if there is imported (restored) rcse database file.
+     *
+     * @since S60 v3.2
+     * @return ETrue if imported db file found
+     */
+    static TBool ImportExists();
+
+    /**
+     * Check if there is import operation already started.
+     *
+     * @since S60 v3.2
+     * @return ETrue if import is already ongoing
+     */
+    static TBool IsImportRunning();
+
+    /**
+     * Imports rcse entries from database and stores them to repository.
+     *
+     * @since S60 v3.2
+     */
+    void ImportAndStoreL();
+
+private:
+
+    CRCSEDbImporter();
+
+    void ConstructL();
+
+    /**
+     * Sets lock that prevents other instances to start import operation.
+     *
+     * @since S60 v3.2
+     */
+    void SetImportLock();
+    
+    /**
+     * Release import lock.
+     *
+     * @since S60 v3.2
+     */
+    void ReleaseImportLock();
+
+    /**
+     * Imports RCSE profile entries from database to the iProfiles array.
+     *
+     * @since S60 v3.2
+     */
+    void ImportVoIPProfilesL();
+
+    /**
+     * Imports RCSE audio codec entries from database to the iCodecs array.
+     *
+     * @since S60 v3.2
+     */
+    void ImportAudioCodecsL();
+
+    /**
+     * Deletes all imported db files
+     *
+     * @since S60 v3.2
+     */
+    void DeleteImports();
+
+    /**
+     * Maps data from database query to profile entry.
+     *
+     * @since S60 v3.2
+     * @param aColumnIndex Column that is mappped.
+     * @param aView Query results.
+     * @param aEntry Data from requested column is mapped and
+     *               stored to this entry.
+     */
+    void MapColumnToEntryL( TInt aColumnIndex, 
+                            const RDbView& aView, 
+                            CRCSEProfileEntry& aEntry );
+
+    /**
+     * Maps data from database query to audio codec entry.
+     *
+     * @since S60 v3.2
+     * @param aColumnIndex Column that is mappped.
+     * @param aView Query results.
+     * @param aEntry Data from requested column is mapped and
+     *               stored to this entry.
+     */
+    void MapColumnToEntryL( TInt aColumnIndex, 
+                            const RDbView& aView, 
+                            CRCSEAudioCodecEntry& aEntry );
+
+
+    /**
+     * Reads TSettingIds structs from given descriptor to array.
+     *
+     * @since S60 v3.2
+     * @param aNumbers Descriptor containing TSettingIds structs.
+     * @param aArray Container for TSettingIds structs.
+     */
+    void GetProfileIdsFromDescriptorL( const TDesC& aNumbers,
+                                       RArray<TSettingIds>& aArray );
+
+
+
+    /**
+     * Reads IDs from given descriptor to array.
+     *
+     * @since S60 v3.2
+     * @param aNumbers Descriptor containing list of IDs.
+     * @param aArray Container for IDs.
+     */
+    template<class T>
+    void GetNumbersFromDescriptorL( const TDesC& aNumbers,
+                                    RArray<T>& aArray );
+
+
+    /**
+     * Updates new preferred audio codec IDs to imported VoIP 
+     * profile entries.
+     *
+     * @since S60 v3.2
+     */
+    void UpdatePreferredCodecs();
+
+    /**
+     * Stores imported voip profiles.
+     *
+     * @since S60 v3.2
+     */
+    void StoreVoIPProfilesL();
+
+    /**
+     * Stores imported audio codecs.
+     *
+     * @since S60 v3.2
+     */
+    void StoreAudioCodecsL();
+
+
+
+private: // data
+
+    /**
+     * Database object.
+     * Own.
+     */
+    RDbNamedDatabase iDb;
+
+    /**
+     * Database session.
+     * Own.
+     */
+    RDbs iDbSession;
+
+    /**
+     * Container for imported VoIP profiles.
+     * Own.
+     */
+    RPointerArray<CRCSEProfileEntry> iProfiles;
+
+    /**
+     * Container for imported Audio Codecs.
+     * Own.
+     */
+    RPointerArray<CRCSEAudioCodecEntry> iCodecs;
+
+    /**
+     * An array for pairs of old and new codec IDs
+     * Own.
+     */
+    RArray<TRCSEIdPair> iCodecIds;
+
+private:
+    // For testing
+    #ifdef TEST_EUNIT
+        friend class UT_CRCSEDbImporter;
+    #endif                                  
+
+
+
+    };
+
+
+
+#endif // C_RCSEDBIMPORTER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/rcsedefaults.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,178 @@
+/*
+* 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:  Default RCSE settings.
+*
+*/
+
+
+#ifndef RCSEDEFAULTS_H
+#define RCSEDEFAULTS_H
+
+
+//  INCLUDES
+#include <crcseprofileentry.h>
+#include <crcseaudiocodecentry.h>
+#include <crcsesccpentry.h>
+
+
+// CONSTANTS
+
+_LIT( KRCSEDefaultMediaSubtypeName, "" );
+_LIT( KRCSEDefaultMediaTypeName, "Audio" );
+_LIT( KRCSEDefaultSCCPStack, "" );
+_LIT( KRCSEDefaultTFTPAddress, "" );
+_LIT( KRCSEDefaultSCCPNumber, "" );
+_LIT( KRCSEDefaultSCCPCertificates, "" );
+_LIT( KRCSEDefaultMusicServerAdd, "" );
+_LIT( KRCSEDefaultCFUncondAdd, "" );
+_LIT( KRCSEDefaultConferenceFactoryURI, "" );
+_LIT( KRCSEDefaultMusicServerURI, "" );
+_LIT( KRCSEDefaultVoiceMailBoxURI, "" );
+_LIT( KRCSEDefaultCFNoAnsURI, "" );
+_LIT( KRCSEDefaultCFBusyURI, "" );
+_LIT( KRCSEDefaultCFUncondURI, "" );
+_LIT( KRCSEDefaultSCCPProfileName, "" );
+_LIT( KRCSEDefaultSCCPVoiceMailboxName, "" );
+_LIT( KRCSEDefaultSCCPIntCallPrefix, "" );
+
+_LIT( KRCSEDefaultTest, "" );
+
+_LIT( KRCSEDefaultProviderName, "Provider" );
+_LIT( KRCSEDefaultSettingsName, "VoIP settings" );
+_LIT( KRCSEDefaultMusicServerAddress, "" );
+_LIT( KRCSEDefaultVoiceMailbox, "" );
+
+_LIT( KRCSEDefaultSIPServerType,         "" );
+_LIT( KRCSEDefaultSBCType,               "" );
+_LIT( KRCSEDefaultSTUNServerType,        "" );
+_LIT( KRCSEDefaultWLANAPType,            "" );
+_LIT( KRCSEDefaultPSTNGatewayType,       "" );
+_LIT( KRCSEDefaultSecurityGatewayType,   "" );
+_LIT( KRCSEDefaultSIPVoIPUAHeaderString, "" );
+const TUint32           KRCSEDefaultSecureCallPreference   = 0;
+const TUint32           KRCSEDefaultVoIPProfileLock        = 0;
+const TUint32           KRCSEDefaultAdhocAllowed           = 1;
+const TUint32           KRCSEDefaultRTCP                   = 0;
+const TUint32           KRCSEDefaultSIPVoIPUAHTerminalType = 1;
+const TUint32           KRCSEDefaultSIPVoIPUAHeaderWLANMAC = 0;
+const TInt32            KRCSEDefaultVoIPPluginUID          = 0;
+const TInt32            KRCSEDefaultMeanCountOfVoIPDigits  = 0;
+const TInt32            KRCSEDefaultIgnoreAddrDomainPart   = 0;
+const CRCSEProfileEntry::TOnOff KRCSEDefaultProfileLockedToIAP  = CRCSEProfileEntry::EOff;
+const CRCSEProfileEntry::TOnOff KRCSEDefaultAllowVoIPoverWCDMA  = CRCSEProfileEntry::EOff;
+const CRCSEProfileEntry::TOnOff KRCSEDefaultAllowVoIPoverBT     = CRCSEProfileEntry::EOff;
+
+const TInt32            KRCSEDefHandoverDialect            = 0;
+const TInt32            KRCSEDefPSTelephonyHOPreference    = 0;
+const TInt32            KRCSEDefHOThresholdValueLL         = 0;
+const TInt32            KRCSEDefHOThresholdValueHL         = 0;
+const TInt32            KRCSEDefNumberOfMeasurementsAbove  = 0;
+const TInt32            KRCSEDefNumberOfMeasurementsBelow  = 0;
+const TInt32            KRCSEDefSmartScannInterParaHigh    = 6000;
+const TInt32            KRCSEDefSmartScannInterParaMedium  = 30000;
+const TInt32            KRCSEDefSmartScannInterParaLow     = 110000;
+const TInt32            KRCSEDefSmartScannInterParaStatic  = 0;
+
+const TInt32            KRCSEDefSmartScannDurationHighMode     = 60;
+const TInt32            KRCSEDefSmartScannDurationMediumMode   = 900;
+const TInt32            KRCSEDefSmartScannDurationLowMode      = 0;
+const TInt32            KRCSEDefHandoffNumber                  = 0;
+const TInt32            KRCSEDefHandbackNumber                 = 10000;
+const TInt32            KRCSEDefHysterisisTimer                = 10000;
+const TInt32            KRCSEDefHandOffProcessTimer            = 10000;
+const TInt32            KRCSEDefDisconnectProcessTimer         = 5000;
+_LIT( KRCSEHandoffPrefix,                     "" );
+_LIT( KRCSEHandbackPrefix,                    "" );
+const TInt32            KRCSEDefHandoverTones                  = 0;
+const TInt32            KRCSEDefSupportSMSoverWLAN  = 0;
+
+_LIT( KRCSEDefXCAPRootURI,                     "" );
+_LIT( KRCSEDefXCAPAddressAutheticationProxy,   "" );
+_LIT( KRCSEDefXCAPUserName,                    "" );
+_LIT( KRCSEDefXCAPPassword,                    "" );
+const TInt32            KRCSEDefUseSIPNamePassword                 = 0;
+const TInt32            KRCSEDefAuthenticationMethod               = 0;
+const TInt32            KRCSEDefTimeoutValueTerminalVoIPPresence   = 3600;
+
+const TUint32           KRCSEDefServiceProviderId                  = 0;
+const CRCSEProfileEntry::TOnOff KRCSEDefUserPhoneUriParam  = CRCSEProfileEntry::EOff;
+_LIT(                   KRCSEDefSIPConnTestAddress,                "" );
+const TUint32           KRCSEDefNATSettingsStorageId               = 0;
+const TInt32            KRCSEDefSIPMinSE                           = 90;
+const TInt32            KRCSEDefSIPSessionExpires                  = 1800;
+const TInt32            KRCSEDefNATProtocol                        = KNotSet;
+const CRCSEProfileEntry::TOnOff KRCSENewServiceTableEntry          = CRCSEProfileEntry::EOn;
+const TUint32           KRCSEDefSNAPId                             = 0;
+
+// iPreferredCodecs is an array and default value is set in ResetDefaultValues()
+
+const TUint32                       KRCSEDefaultStartMediaPort         = 49152;
+const TUint32                       KRCSEDefaultEndMediaPort           = 65534;
+const TInt32                        KRCSEDefaultSiqnalingQOS           = 40;
+const TInt32                        KRCSEDefaultMediaQOS               = 46;
+const CRCSEProfileEntry::TOnOff     KRCSEDefaultInbandDTMF             = CRCSEProfileEntry::EOn;
+const CRCSEProfileEntry::TOnOff     KRCSEDefaultOutbandDTMF            = CRCSEProfileEntry::EOn;
+const TInt32                        KRCSEDefaultHoldRingBack           = 3;
+const CRCSEProfileEntry::TOnOff     KRCSEDefaultAutoComplete           = CRCSEProfileEntry::EOff;
+const CRCSEProfileEntry::TOnOff     KRCSEDefaultVoiceActivation        = CRCSEProfileEntry::EOn;
+const CRCSEProfileEntry::TOnOff     KRCSEDefaultRedundancy             = CRCSEProfileEntry::EOff;
+const CRCSEProfileEntry::TOnOff     KRCSEDefaultVoipPreferred          = CRCSEProfileEntry::EOff;
+
+const CRCSEProfileEntry::TOnOff     KRCSEDefaultCFNoAnswer             = CRCSEProfileEntry::EOff;
+const CRCSEProfileEntry::TOnOff     KRCSEDefaultCFBusy                 = CRCSEProfileEntry::EOff;
+const CRCSEProfileEntry::TOnOff     KRCSEDefaultCFUnconditional        = CRCSEProfileEntry::EOff;
+
+// CRCSEAudioCodecEntry default values.
+const TInt32                            KRCSEDefaultJitterBufferSize   = 200;
+const TInt32                            KRCSEDefaultMaxptime           = 200;
+const CRCSEAudioCodecEntry::TOnOff      KRCSEDefaultOctetAlign         = CRCSEAudioCodecEntry::EOONotSet;
+const CRCSEAudioCodecEntry::TOnOff      KRCSEDefaultModeChangeNeighbor = CRCSEAudioCodecEntry::EOONotSet;
+const CRCSEAudioCodecEntry::TOnOff      KRCSEDefaultCRC                = CRCSEAudioCodecEntry::EOONotSet;
+const CRCSEAudioCodecEntry::TOnOff      KRCSEDefaultRobustSorting      = CRCSEAudioCodecEntry::EOONotSet;
+const CRCSEAudioCodecEntry::TOnOff      KRCSEDefaultVAD                = CRCSEAudioCodecEntry::EOONotSet;
+const CRCSEAudioCodecEntry::TOnOff      KRCSEDefaultDTX                = CRCSEAudioCodecEntry::EOONotSet;
+const CRCSEAudioCodecEntry::TOnOff      KRCSEDefaultAnnexb             = CRCSEAudioCodecEntry::EOff;
+const TInt32                            KRCSEDefaultModeChangeCapability = KNotSet;
+const TInt32                            KRCSEDefaultMaxRed               = KNotSet;
+
+// CRCSESCCPEntry default values.
+const CRCSESCCPEntry::TManualAutomatic   KRCSEDefaultVOIPLogin         = CRCSESCCPEntry::EAutomatic;
+const CRCSESCCPEntry::TOnOff             KRCSEDefaultDHCPTFTP          = CRCSESCCPEntry::EOn;
+
+
+
+// Default service provider settings for VoIP profile
+const TInt32 KPhoneAppCLIPlugId                    = 0x10282EB2;
+const TInt32 KPhoneAppCallLogPlugId                = 0x10282EB4;
+const TInt32 KPhoneAppCallStateIndPlugId           = 0x10282EB8;
+const TInt32 KPhoneAppCallMenuHandlerPlugId        = 0x10282EB6;
+const TInt32 KCCECallProviderPlugId                = 0x10282589;
+const TInt32 KCCHVoIPSubServicePlugId              = 0x1027545A;
+const TInt32 KCCHVMBXSubServicePlugId              = 0x1027545A;
+const TInt32 KPresenceServiceConnPlugId            = 0x10282EF2;
+const TInt32 KContactViewPlugId                    = 0x20012423;
+
+const TInt32 KLogCntLinkMaxLength                  = 256;
+const TInt32 KPresencePresentityIDFieldType        = 52;
+
+_LIT( KContactStoreId, "cntdb://c:contacts.cdb" );
+_LIT( KVoIPBrandId, "10282EC0" );
+
+const TUint KDefaultVoIPService = 2;
+
+const TUint KVoIPSettingsID = 1;
+
+#endif      // RCSEDEFAULTS_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/rcselogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 macros for logging
+*
+*/
+
+
+
+#ifndef RCSELOGGER_H
+#define RCSELOGGER_H
+
+//  INCLUDES
+#include <e32def.h>
+
+
+//-----------------------------------------------------------------------------
+//  USER LOGGING SETTINGS
+//-----------------------------------------------------------------------------
+
+#ifndef _DEBUG
+
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = Flogger
+*   2 = RDebug
+***************************/ 
+
+#define RCSE_LOGGING_METHOD  0   // UREL BUILD
+
+#else
+
+#ifdef __WINS__
+#define RCSE_LOGGING_METHOD  2   // UDEB BUILD, WINS
+#else
+#define RCSE_LOGGING_METHOD  2   // UDEB BUILD, HW
+#endif // __WINS__
+
+#endif // _DEBUG
+
+
+//-----------------------------------------------------------------------------
+//  LOGGING SETTINGS (DO NOT EDIT)
+//-----------------------------------------------------------------------------
+
+#if RCSE_LOGGING_METHOD == 1      // Flogger
+
+#include <flogger.h>
+_LIT(KRCSELogFolder,"RCSE");
+_LIT(KRCSELogFile,"RCSELOG.TXT");
+
+#elif RCSE_LOGGING_METHOD == 2    // RDebug
+
+#include <e32svr.h>
+
+#endif
+
+
+//-----------------------------------------------------------------------------
+//  LOGGING MACROs (DO NOT EDIT)
+//
+//  USE THESE MACROS IN YOUR CODE
+//-----------------------------------------------------------------------------
+
+#if RCSE_LOGGING_METHOD == 1      // Flogger
+
+#define RCSELOGSTRING(AA)           { RFileLogger::Write(KRCSELogFolder(),KRCSELogFile(),EFileLoggingModeAppend, _L(AA) ); }
+#define RCSELOGSTRING2(AA,BB)       { RFileLogger::WriteFormat(KRCSELogFolder(),KRCSELogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB); }
+#define RCSELOGSTRING3(AA,BB,CC)    { RFileLogger::WriteFormat(KRCSELogFolder(),KRCSELogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB,CC); }
+#define RCSELOGSTRING4(AA,BB,CC,DD) { RFileLogger::WriteFormat(KRCSELogFolder(),KRCSELogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB,CC,DD); }
+#define RCSELOGTHREAD()             { RFileLogger::Write(KRCSELogFolder(),KRCSELogFile(),EFileLoggingModeAppend, RThread().FullName() ); }
+
+#elif RCSE_LOGGING_METHOD == 2    // RDebug
+
+#define RCSELOGSTRING(AA)           { RDebug::Print(_L(AA)); }
+#define RCSELOGSTRING2(AA,BB)       { RDebug::Print(_L(AA),BB); }
+#define RCSELOGSTRING3(AA,BB,CC)    { RDebug::Print(_L(AA),BB,CC); }
+#define RCSELOGSTRING4(AA,BB,CC,DD) { RDebug::Print(_L(AA),BB,CC,DD); }
+#define RCSELOGTHREAD()             { RDebug::Print( RThread().FullName() ); }
+
+#else   // RCSE_LOGGING_METHOD == 0 or invalid -> Disable loggings
+
+#define RCSELOGSTRING(AA)           // Example: RCSELOGSTRING("Test");
+#define RCSELOGSTRING2(AA,BB)       // Example: RCSELOGSTRING("Test %d", aValue);
+#define RCSELOGSTRING3(AA,BB,CC)    // Example: RCSELOGSTRING("Test %d %d", aValue1, aValue2);
+#define RCSELOGSTRING4(AA,BB,CC,DD) // Example: RCSELOGSTRING("Test %d %d %d", aValue1, aValue2, aValue3);
+#define RCSELOGTHREAD()
+
+#endif  // RCSE_LOGGING_METHOD
+
+#endif  // RCSELOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/rcsepanic.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* 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:  Panic method
+*
+*/
+
+
+
+#ifndef RCSEPANIC_H
+#define RCSEPANIC_H
+
+//  INCLUDES
+#include <e32std.h>
+
+// DATA TYPES
+enum TRCSEPanic
+    {
+    ERCSEUnknownCodec,
+    ERCSEArraysDifferentSize,
+    ERCSEZeroArray,
+    ERCSEUnknownColumn,
+    ERCSEUnknownRegistry,
+    ERCSEKeyError,
+    ERCSETransactionStart
+    };
+
+// FUNCTION PROTOTYPES
+void RCSEPanic( TRCSEPanic aPanicCode );
+
+#endif      // RCSEPANIC_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/rcseprivatecrkeys.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,205 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef __RCSEPRIVATECRKEYS__
+#define __RCSEPRIVATECRKEYS__
+
+/** Central Repository UID of RCSE */
+const TUid KCRUidRCSE = { 0x200100FD };
+
+/** Central Repository UID of RCSE audio codecs */
+const TUid KCRUidRCSECodec = { 0x2001B26B };
+
+
+// Structure of VoIP profile table in repository. 
+// Audio codec entries are stored equally.
+// 
+//----------------------------------------------------------------------------
+//| KColProfileId | KColProviderName | KColSettingsName | ... | ... | KColxx |
+//|     (int)     |     (des)        |     (des)        |     | ... | (des)  |
+//----------------------------------------------------------------------------
+//|       1       |   "Provider 1"   |  "Name x"        | ... | ... | "aaa"  |
+//|       7       |   "Provider 2"   |  "Name y"        | ... | ... | "bbb"  |
+//|       15      |   "Provider 3"   |  "Name z"        | ... | ... | "ccc"  |
+//|       0       |      ""          |     ""           | ... | ... |        |
+//|       0       |      ""          |     ""           | ... | ... |        |
+//|       ...     |      ...         |     ...          | ... | ... |        |
+//|       ...     |      ...         |     ...          | ... | ... |        |
+//----------------------------------------------------------------------------
+
+
+
+//************************ Single keys (actual keys) ************************
+
+/** ID counter. Contains the next available ID for entry */
+const TUint32 KRCSEIdCounter                = 0x00000000;
+
+/** Notifier key for VoIP profiles */
+//const TUint32 KRCSEVoIPProfileNotifier      = 0x00000010; // Not needed
+
+/** Notifier key for Audio Codecs */
+//const TUint32 KRCSEAudioCodecNotifier       = 0x00000011; // Not needed
+
+//******************************** Key ranges *******************************
+
+/** Range for general keys  */
+const TUint32 KRCSESpecialKeys              = 0x00000000;   // --> 0x00000FFF
+
+
+// Range for VoIP profile table (4096 rows)
+const TUint32 KRCSEProfileTable             = 0x00001000;   // --> 0x0012FFFF
+
+
+// Ranges for  Audio Codec table (4096 rows)
+const TUint32 KRCSECodecTable               = 0x00001000;   // --> 0x0004FFFF
+
+// Columns for VoIP profiles. Each column has 4096 rows
+// Add new profile columns to the end of profile column list!
+const TUint32 KColProfileId                     = KRCSEProfileTable;  // Int range!
+const TUint32 KColProviderName                  = 0x00002000;
+const TUint32 KColSettingsName                  = 0x00003000;
+const TUint32 KColPreferredCodecs               = 0x00004000;
+const TUint32 KColStartMediaPort                = 0x00005000;
+const TUint32 KColEndMediaPort                  = 0x00006000;
+const TUint32 KColSiqnalingQOS                  = 0x00007000;
+const TUint32 KColMediaQOS                      = 0x00008000;
+const TUint32 KColInbandDtmf                    = 0x00009000;
+const TUint32 KColOutbandDtmf                   = 0x0000A000;   // 10
+
+const TUint32 KColHoldRingBack                  = 0x0000B000;
+const TUint32 KColAutoComplete                  = 0x0000C000;
+const TUint32 KColCFNoAnswer                    = 0x0000D000;
+const TUint32 KColCFBusy                        = 0x0000E000;
+const TUint32 KColCFUnconditional               = 0x0000F000;
+const TUint32 KColRedundancy                    = 0x00010000;
+const TUint32 KColProtocolIds                   = 0x00011000;
+const TUint32 KColSecureCallPreference          = 0x00012000;
+const TUint32 KColVoIPProfileLock               = 0x00013000;
+const TUint32 KColAdhocAllowed                  = 0x00014000;   // 20
+
+const TUint32 KColSIPServerType                 = 0x00015000;
+const TUint32 KColSBCType                       = 0x00016000;
+const TUint32 KColSTUNServerType                = 0x00017000;
+const TUint32 KColWLANAPType                    = 0x00018000;
+const TUint32 KColPSTNGatewayType               = 0x00019000;
+const TUint32 KColSecurityGatewayType           = 0x0001A000;
+const TUint32 KColRTCP                          = 0x0001B000;
+const TUint32 KColSIPVoIPUAHTerminalType        = 0x0001C000;
+const TUint32 KColSIPVoIPUAHeaderWLANMAC        = 0x0001D000;
+const TUint32 KColSIPVoIPUAHeaderString         = 0x0001E000;   // 30
+
+const TUint32 KColProfileLockedToIAP            = 0x0001F000;
+const TUint32 KColVoIPPluginUID                 = 0x00020000;
+const TUint32 KColAllowVoIPoverWCDMA            = 0x00021000;
+const TUint32 KColAllowVoIPoverBT               = 0x00022000;
+const TUint32 KColMeanCountOfVoIPDigits         = 0x00023000;
+const TUint32 KColIgnoreAddrDomainPart          = 0x00024000;
+const TUint32 KColHandoverDialect               = 0x00025000;
+const TUint32 KColPSTelephonyHOPreference       = 0x00026000;
+const TUint32 KColHOThresholdValueLL            = 0x00027000;
+const TUint32 KColHOThresholdValueHL            = 0x00028000;   // 40
+
+const TUint32 KColNumberOfMeasurementsAbove     = 0x00029000;
+const TUint32 KColNumberOfMeasurementsBelow     = 0x0002A000;
+const TUint32 KColSmartScannInterParaHigh       = 0x0002B000;
+const TUint32 KColSmartScannInterParaMedium     = 0x0002C000;
+const TUint32 KColSmartScannInterParaLow        = 0x0002D000;
+const TUint32 KColSmartScannInterParaStatic     = 0x0002E000;
+const TUint32 KColSmartScannDurationHighMode    = 0x0002F000;
+const TUint32 KColSmartScannDurationMediumMode  = 0x00030000;
+const TUint32 KColSmartScannDurationLowMode     = 0x00031000;
+const TUint32 KColHandoffNumber                 = 0x00032000;   // 50
+
+const TUint32 KColHandbackNumber                = 0x00033000;
+const TUint32 KColHysterisisTimer               = 0x00034000;
+const TUint32 KColHandOffProcessTimer           = 0x00035000;
+const TUint32 KColDisconnectProcessTimer        = 0x00036000;
+const TUint32 KColHandoffPrefix                 = 0x00037000;
+const TUint32 KColHandbackPrefix                = 0x00038000;
+const TUint32 KColHandoverTones                 = 0x00039000;
+const TUint32 KColSupportSMSoverWLAN            = 0x0003A000;
+const TUint32 KColServiceProviderId             = 0x0003B000;
+const TUint32 KColUserPhoneUriParam             = 0x0003C000;   // 60
+
+const TUint32 KColSIPConnTestAddress            = 0x0003D000;
+const TUint32 KColNATSettingsStorageId          = 0x0003E000;
+const TUint32 KColSIPMinSE                      = 0x0003F000;
+const TUint32 KColSIPSessionExpires             = 0x00040000;
+const TUint32 KColNATProtocol                   = 0x00041000;
+const TUint32 KColNewServiceTable               = 0x00042000;
+const TUint32 KColSNAPId                        = 0x00043000;
+const TUint32 KColCreationUrl                   = 0x00044000; // = KRCSELastColumnVoIP
+
+
+// Columns for Audio Codecs. Each column has 4096 rows
+// Add new codec columns to end of the audio codec list!
+const TUint32 KColAudioCodecId                  = KRCSECodecTable;  // Int range!
+const TUint32 KColMediaTypeName                 = 0x00002000;
+const TUint32 KColMediaSubTypeName              = 0x00003000;
+const TUint32 KColJitterBufferSize              = 0x00004000;
+const TUint32 KColOctetAlign                    = 0x00005000;
+const TUint32 KColModeSet                       = 0x00006000;
+const TUint32 KColModeChangePeriod              = 0x00007000;
+const TUint32 KColModeChangeNeighbor            = 0x00008000;
+const TUint32 KColPtime                         = 0x00009000;
+const TUint32 KColMaxptime                      = 0x0000A000;   // 10
+
+const TUint32 KColCrc                           = 0x0000B000;
+const TUint32 KColRobustSorting                 = 0x0000C000;
+const TUint32 KColInterLeaving                  = 0x0000D000;
+const TUint32 KColChannels                      = 0x0000E000;
+const TUint32 KColVAD                           = 0x0000F000;
+const TUint32 KColDTX                           = 0x00010000;
+const TUint32 KColSamplingRate                  = 0x00011000;
+const TUint32 KColAnnexb                        = 0x00012000;
+const TUint32 KColModeChangeCapability          = 0x00013000;
+const TUint32 KColMaxRed                        = 0x00014000; // KRCSELastColumnCodec
+
+
+//********************************* Key masks *******************************
+
+/** Increment for rows in table */
+const TUint32 KRCSERowIncrement                 = 0x00000001;
+
+const TUint32 KRCSEColIncrement                 = 0x00001000;
+
+/** Query mask for all rows in setting tables */
+const TUint32 KRCSEColumnMask                   = 0xFFFFF000;
+
+
+//************************ Other key related constants **********************
+
+/** Last column in current setting table */
+const TInt KRCSELastColumnVoIP = KColCreationUrl;
+const TInt KRCSELastColumnCodec = KColMaxRed;
+
+/** Amount of columns in current setting tables */
+const TInt KRCSEColumnCountVoIP  = 68;  // Cols until KRCSELastColumnVoIP
+const TInt KRCSEColumnCountCodec = 20;  // Cols until KRCSELastColumnCodec
+
+/** Amount of rows in setting tables */
+const TInt KRCSERowCountVoIP  = 4096; // = 0x00001000
+const TInt KRCSERowCountCodec = 4096; // = 0x00001000
+
+
+/** ID not set */
+const TInt KNoEntryId = 0;
+
+
+#endif      // __RCSEPRIVATECRKEYS__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/stubs/crcsecreatetable.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,91 @@
+/*
+* 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:  Provides table creation for databases.
+*
+*/
+
+
+
+#ifndef CRCSECREATETABLE_H
+#define CRCSECREATETABLE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <d32dbms.h>
+
+// CLASS DECLARATION
+
+/**
+*  Provides table creation for databases.
+*
+*  @lib RCSE.lib
+*  @since S60 3.0
+*/
+class CRCSECreateTable: public CBase
+    {     
+public: // New functions
+        
+    /**
+    * Creates Audio Codec table to Audio Codec database.
+    * @since S60 3.0
+    */
+    static void CreateAudioCodecTableL();
+    
+    /**
+    * Creates SIP setting table to SIP database.
+    * @since S60 3.0
+    */
+    static void CreateSIPSettingTableL();
+    
+    /**
+    * Creates Profile table to Profile database.
+    * @since S60 3.0
+    */
+    static void CreateProfileTableL();
+    
+    /**
+    * Creates SCCP table to SCCP setting database.
+    * @since S60 3.0
+    */
+    static void CreateSCCPSettingTableL();
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CRCSECreateTable();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CRCSECreateTable();
+    
+    /**
+    * Adds column to table.
+    * @since S60 3.0.
+    * @param aTable Table, where the column is created.
+    * @param aColumnName Name of the column
+    * @param aColumnType Type of the column
+    * @param aMaxLenghtOfColumn Columns maximum length.
+    */
+    static void AddColumnToTableL( CDbColSet& aTable, const TDesC& aColumnName,
+        TDbColType aColumnType, 
+        TInt aMaxLengthOfColumn = KDbDefaultTextColLength );
+
+    };
+
+#endif      // CRCSECREATETABLE_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/stubs/crcsesccpsettingregistry.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,157 @@
+/*
+* 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:  Offers API for storing, getting and updating SCCP setting entry.
+*
+*/
+
+
+
+#ifndef CRCSESCCPSETTINGREGISTRY_H
+#define CRCSESCCPSETTINGREGISTRY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <rcseregistrybase.h>
+
+// FORWARD DECLARATIONS
+class CRCSESCCPEntry;
+
+// CLASS DECLARATION
+
+/**
+*  Offers getting, setting and updating of SCCP setting.
+*
+*  @lib RCSE.lib
+*  @since S60 3.0
+*/
+class CRCSESCCPSettingRegistry: public CRCSERegistryBase
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSESCCPSettingRegistry* NewL();
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSESCCPSettingRegistry* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CRCSESCCPSettingRegistry();
+
+    public: // New functions
+
+        /**
+        * Search a SCCP Setting, which id is same as aSCCPSettingId. 
+        * Leaves with KErrNotFound if such setting is not found.
+        * Default values are reseted to aFoundEntry before the search.
+        * @since S60 3.0
+        * @param aSCCPSettingId Search criteria for SCCP setting.
+        * @param aFoundEntry A found SCCP setting entry.
+        */
+        IMPORT_C void FindL( TUint32 aSCCPSettingId, 
+            CRCSESCCPEntry& aFoundEntry );
+
+        /**
+        * Gets all profile identifiers which are stored to RCSE. If there are
+        * no profiles stored, aAllIds will contain zero entries.
+        * @since S60 3.0
+        * @param aAllIds Array, where the SCCP identifiers are stored.
+        */
+        IMPORT_C void GetAllIdsL( RArray<TUint32>& aAllIds );
+
+        /**
+        * Adds new profile entry.
+        * @since S60 3.0
+        * @param aNewEntry New entry.
+        * @return SCCP identifier of the added SCCP setting.
+        */
+        IMPORT_C TUint32 AddL( const CRCSESCCPEntry& aNewEntry);
+        
+        /**
+        * Deletes a profile, which profile id is same than aProfileId. 
+        * @since S60 3.0
+        * @param aId SCCP identifier
+        */
+        IMPORT_C void DeleteL( TUint32 aId );
+
+        /**
+        * Updates profile, which profile identifier is same than aProfileId.
+        * Only settings that are set in aUpdateData are updated in profile.
+        * Leaves with KErrNotFound if profile is not found.
+        * @since S60 3.0
+        * @param aId Profile identifier.
+        * @param aUpdateData Updated data, which are updated to SCCP setting entry.
+        */
+        IMPORT_C void UpdateL( TUint32 aId, 
+            const CRCSESCCPEntry& aUpdateData );
+
+        /**
+        * Resets default values for SCCP profile. Default profile is a profile,
+        * which can be used when no other profile is available.
+        * @since S60 3.0
+        * @param aDefaultProfile Default SCCP settings are set to this.
+        */
+        IMPORT_C void GetDefaultProfile( 
+            CRCSESCCPEntry& aDefaultProfile ) const;
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CRCSESCCPSettingRegistry();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * Maps data from database to aEntry. 
+        * @since S60 3.0
+        * @param aColumnIndex Index to a column in database row.
+        * @param aView View to database to access values in column.
+        * @param aEntry Profile entry settings are set to here.
+        */
+        void MapColumnToEntry( TInt aColumnIndex, const RDbView& aView, 
+            CRCSESCCPEntry& aEntry );
+
+        /**
+        * Initializes database view.
+        * @since S60 3.0
+        * @param aView View to be initialized-
+        * @param aSqlStatement SQL statement which initializes the database.
+        */
+        void InitializeDbViewL( RDbView& aView, 
+            const TDesC& aSqlStatement );
+
+        /**
+        * Initializes the database with aSqlQuery and sets data
+        * from database to aEntry.
+        * @since S60 3.0
+        * @param aEntry Profile entry, which single setting is set.
+        * @param aSqlQuery SQL query used to get the data from database.
+        */
+        void SetDataFromDbToEntryL( CRCSESCCPEntry& aEntry,
+            const TDesC& aSqlQuery );
+    };
+
+#endif      // CRCSESCCPSETTINGREGISTRY_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/stubs/crcsesipsettingentry.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,117 @@
+/*
+* 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:  Single SIP setting entry, which is stored to RCSE
+*
+*/
+
+
+
+#ifndef CRCSESIPSETTINGENTRY_H
+#define CRCSESIPSETTINGENTRY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+
+
+// CONSTANTS
+const TInt KMaxConferencingFactoryURILength = 200;
+
+const TInt KMaxMusicServerURILenght = 200;
+
+const TInt KMaxIPVoiceMailBoxURILenght = 200;
+
+const TInt KMaxCFBusyURILenght = 200;
+
+const TInt KMaxCFNoAnsURILenght = 200;
+
+const TInt KMaxCFUncondURILenght = 200;
+
+// OMA Provisioning Content 1.1 defines the minimum lengths of
+// these constants. These constants are doubled.
+
+// CLASS DECLARATION
+
+/**
+*  SIP Setting entry, which is stored to RCSE.
+*
+*  @lib RCSE.lib
+*  @since S60 3.0
+*/
+class CRCSESIPSettingEntry : public CBase
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSESIPSettingEntry* NewL();
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSESIPSettingEntry* NewLC();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CRCSESIPSettingEntry();
+        
+    public: // New functions
+                    
+        /**
+        * Resets entry to default values.
+        * @since S60 3.0
+        */
+        void ResetDefaultValues();
+
+    private:
+                
+        /**
+        * C++ default constructor.
+        * Initialises values to ENotSet.
+        */
+        CRCSESIPSettingEntry();
+
+    public: // Data
+
+        // Identifier of profile. This values is set by CRCSESSIPSetting, when
+        // profile entry is got from CRCSESSIPSetting.
+        TInt iVOIPSIPProfileSpecificId;
+        
+        // SIP Profile ID.
+        TInt iSIPProfileId;
+
+        // Conferencing factory URI.
+        TBuf<KMaxConferencingFactoryURILength> iConferenceFactoryURI;
+        
+        // Music server URI.
+        TBuf<KMaxMusicServerURILenght> iMusicServerURI;
+        
+        // IP VoiceMailBox URI.
+        TBuf<KMaxIPVoiceMailBoxURILenght> iVoiceMailBoxURI;
+        
+        // Call forwarding no answer SIP or TEL URI.
+        TBuf<KMaxCFNoAnsURILenght> iCFNoAnsURI;
+        
+        // Call forwarding when busy SIP or TEL URI.
+        TBuf<KMaxCFBusyURILenght> iCFBusyURI;
+        
+        // Call forwarding unconditional SIP or TEL URI.
+        TBuf<KMaxCFUncondURILenght> iCFUncondURI;
+    };
+
+#endif      // CRCSESIPSETTINGENTRY_H  
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/inc/stubs/crcsesipsettingregistry.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,157 @@
+/*
+* 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:  Offers API for storing, getting and updating SIP settings.
+*
+*/
+
+
+
+#ifndef CRCSESIPPSETTINGREGISTRYREGISTRY_H
+#define CRCSESIPPSETTINGREGISTRYREGISTRY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <rcseregistrybase.h>
+
+// FORWARD DECLARATIONS
+class CRCSESIPSettingEntry;
+
+// CLASS DECLARATION
+
+/**
+*  Offers getting, setting and updating of sip settings.
+*
+*  @lib RCSE.lib
+*  @since S60 3.0
+*/
+class CRCSESIPSettingRegistry: public CRCSERegistryBase
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSESIPSettingRegistry* NewL();
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CRCSESIPSettingRegistry* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CRCSESIPSettingRegistry();
+
+    public: // New functions
+ 
+        /**
+        * Search a SIP setting, which profile id is same as aSIPProfileId. 
+        * Leaves with KErrNotFound if such profile is not found.
+        * Default values are reseted to aFoundEntry before the search.
+        * @since S60 3.0.
+        * @param aSIPProfileId Search criteria for SIP setting.
+        * @param aFoundEntry A found SIP setting entry.
+        */
+        IMPORT_C void FindL( TUint32 aSIPProfileId, 
+            CRCSESIPSettingEntry& aFoundEntry );
+
+        /**
+        * Gets all SIP setting identifiers which are stored to RCSE.
+        * If there are no profiles stored, aAllIds will contain zero entries.
+        * @since S60 3.0
+        * @param aAllIds Array, where the SIP setting identifiers are stored.
+        */
+        IMPORT_C void GetAllIdsL( RArray<TUint32>& aAllIds );
+
+        /**
+        * Adds new profile entry.
+        * @since S60 3.0
+        * @param aNewEntry New entry.
+        * @return SIP setting identifier of the added setting.
+        */
+        IMPORT_C TUint32 AddL( const CRCSESIPSettingEntry& aNewEntry );
+
+        /**
+        * Deletes a profile, which profile id is same than aProfileId. 
+        * @since S60 3.0
+        * @param aId SIP setting identifier
+        */
+        IMPORT_C void DeleteL( TUint32 aId );
+
+        /**
+        * Updates SIP setting, which identifier is same than aId.
+        * Only settings that are set in aUpdateData are updated in profile.
+        * Leaves with KErrNotFound if setting is not found.
+        * @since S60 3.0
+        * @param aId setting identifier.
+        * @param aUpdateData Updated data, which are updated to SIP Setting.
+        */
+        IMPORT_C void UpdateL( TUint32 aId, 
+            const CRCSESIPSettingEntry& aUpdateData );
+
+        /**
+        * Resets default values for SIP profile. Default profile is a profile,
+        * which can be used when no other profile is available.
+        * @since S60 3.0
+        * @param aDefaultProfile Default profile settings are set to this.
+        */
+        IMPORT_C void GetDefaultProfile( 
+            CRCSESIPSettingEntry& aDefaultProfile ) const;
+            
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CRCSESIPSettingRegistry();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * Maps data from database to aEntry. 
+        * @since S60 3.0
+        * @param aColumnIndex Index to a column in database row.
+        * @param aView View to database to access values in column.
+        * @param aEntry SIP entry settings are set to here.
+        */
+        void MapColumnToEntry( TInt aColumnIndex, const RDbView& aView, 
+            CRCSESIPSettingEntry& aEntry );
+
+        /**
+        * Initializes database view.
+        * @since S60 3.0
+        * @param aView View to be initialized-
+        * @param aSqlStatement SQL statement which initializes the database.
+        */
+        void InitializeDbViewL( RDbView& aView, 
+            const TDesC& aSqlStatement );
+
+        /**
+        * Initializes the database with aSqlQuery and sets data
+        * from database to aEntry.
+        * @since S60 3.0
+        * @param aEntry SIP setting entry, which single setting is set.
+        * @param aSqlQuery SQL query used to get the data from database.
+        */
+        void SetDataFromDbToEntryL( CRCSESIPSettingEntry& aEntry,
+            const TDesC& aSqlQuery );
+    };
+
+#endif      // CRCSESIPPSETTINGREGISTRYREGISTRY_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/rom/rcse2.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002-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:  Rich Call Settings Engine ROM definition file.
+*
+*/
+
+
+#ifndef RCSE_IBY
+#define RCSE_IBY
+
+
+file=ABI_DIR/BUILD_DIR/RCSE.dll SHARED_LIB_DIR/RCSE.dll
+data=ZPRIVATE/100012a5/policy/10202869.SPD PRIVATE/100012a5/policy/10202869.SPD
+data=ZPRIVATE/10202869/backup_registration.xml private/10202869/backup_registration.xml
+
+
+#endif // RCSE_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/crcseaudiocodecentry.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,431 @@
+/*
+* 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:  Audio codec entry, which is stored to db
+*
+*/
+
+
+
+// INCLUDE FILES
+#include	<featmgr.h>
+
+#include    "crcseaudiocodecentry.h"
+#include    "rcseconstants.h"
+#include    "rcsepanic.h"
+#include    "rcsedefaults.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecEntry::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSEAudioCodecEntry* CRCSEAudioCodecEntry::NewL()
+    {
+    CRCSEAudioCodecEntry* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecEntry::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSEAudioCodecEntry* CRCSEAudioCodecEntry::NewLC()
+    {
+    CRCSEAudioCodecEntry* self = new (ELeave) CRCSEAudioCodecEntry();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    self->ResetDefaultCodecValues();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecEntry::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CRCSEAudioCodecEntry::ConstructL()
+    {
+    // Check VoIP support from feature manager
+    FeatureManager::InitializeLibL();
+    TBool support = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
+    FeatureManager::UnInitializeLib();
+    if (!support)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    }
+ 
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecEntry::CRCSEAudioCodecEntry
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRCSEAudioCodecEntry::CRCSEAudioCodecEntry()
+    {
+    }
+    
+// Destructor
+EXPORT_C CRCSEAudioCodecEntry::~CRCSEAudioCodecEntry()
+    {
+    iChannels.Reset();
+    iChannels.Close(); 
+    
+    iModeSet.Reset();
+    iModeSet.Close();      
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecEntry::SetDefaultCodecValueSet
+// Sets default parameter values separately for each codec.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEAudioCodecEntry::SetDefaultCodecValueSet( TPtrC aCodecType )
+    {
+    
+    if ( aCodecType == KAudioCodecAMR )
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodecAMR;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOff;
+        iModeSet.Reset();
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOn;
+        iPtime                    = 20;
+        iMaxptime                 = KRCSEDefaultMaxptime;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = KNotSet;
+        iChannels.Append(1);
+        iVAD                      = EOff;
+        iDTX                      = EOff;
+        iSamplingRate             = KNotSet;
+        iAnnexb                   = EOONotSet;
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else if ( aCodecType == KAudioCodeciLBC )
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodeciLBC;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOONotSet;
+        iModeSet.Reset();
+        iModeSet.Append(30);
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOONotSet;
+        iPtime                    = 30;
+        iMaxptime                 = 180;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = KNotSet;
+        iChannels.Reset();
+        iVAD                      = EOff;
+        iDTX                      = EOff;
+        iSamplingRate             = KNotSet;
+        iAnnexb                   = EOONotSet;    
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else if (aCodecType == KAudioCodecVMRWB)
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodecVMRWB;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOff;
+        iModeSet.Reset();
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOONotSet;
+        iPtime                    = KNotSet;
+        iMaxptime                 = KRCSEDefaultMaxptime;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = KNotSet;
+        iChannels.Reset();
+        iVAD                      = EOONotSet;
+        iDTX                      = EOff;
+        iSamplingRate             = KNotSet;
+        iAnnexb                   = EOONotSet;        
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else if (aCodecType == KAudioCodecPCMA)
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodecPCMA;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOn;
+        iModeSet.Reset();
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOONotSet;
+        iPtime                    = 20;
+        iMaxptime                 = KRCSEDefaultMaxptime;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = KNotSet;
+        iChannels.Reset();
+        iVAD                      = EOff;
+        iDTX                      = EOff;
+        iSamplingRate             = KNotSet;
+        iAnnexb                   = EOONotSet;    
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else if (aCodecType == KAudioCodecPCMU)
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodecPCMU;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOn;
+        iModeSet.Reset();
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOONotSet;
+        iPtime                    = 20;
+        iMaxptime                 = KRCSEDefaultMaxptime;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = KNotSet;
+        iChannels.Reset();
+        iVAD                      = EOff;
+        iDTX                      = EOff;
+        iSamplingRate             = KNotSet;
+        iAnnexb                   = EOONotSet;
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else if (aCodecType == KAudioCodecCN)
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodecCN;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOONotSet;
+        iModeSet.Reset();
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOONotSet;
+        iPtime                    = KNotSet;
+        iMaxptime                 = KNotSet;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = KNotSet;
+        iChannels.Reset();
+        iVAD                      = EOff;
+        iDTX                      = EOONotSet;
+        iSamplingRate             = 8000;
+        iAnnexb                   = EOONotSet;
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else if (aCodecType == KAudioCodecG729)
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodecG729;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOONotSet;
+        iModeSet.Reset();
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOONotSet;
+        iPtime                    = KNotSet;
+        iMaxptime                 = KRCSEDefaultMaxptime;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = KNotSet;
+        iChannels.Reset();
+        iVAD                      = EOff;
+        iDTX                      = EOff;
+        iSamplingRate             = KNotSet;
+        iAnnexb                   = EOONotSet;
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else if (aCodecType == KAudioCodecAMRWB)
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodecAMRWB;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOff;
+        iModeSet.Reset();
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOn;
+        iPtime                    = 20;
+        iMaxptime                 = KRCSEDefaultMaxptime;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = KNotSet;
+        iChannels.Append(1);
+        iVAD                      = EOff;
+        iDTX                      = EOff;
+        iSamplingRate             = KNotSet;
+        iAnnexb                   = EOONotSet;
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else if (aCodecType == KAudioCodecEVRC)
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodecEVRC;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOONotSet;
+        iModeSet.Reset();
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOONotSet;
+        iPtime                    = KNotSet;
+        iMaxptime                 = KRCSEDefaultMaxptime;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = 5;
+        iChannels.Reset();
+        iVAD                      = EOff;
+        iDTX                      = EOONotSet;
+        iSamplingRate             = KNotSet;
+        iAnnexb                   = EOONotSet;
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else if (aCodecType == KAudioCodecEVRC0)
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodecEVRC0;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOONotSet;
+        iModeSet.Reset();
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOONotSet;
+        iPtime                    = KNotSet;
+        iMaxptime                 = KNotSet;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = KNotSet;
+        iChannels.Reset();
+        iVAD                      = EOff;
+        iDTX                      = EOONotSet;
+        iSamplingRate             = KNotSet;
+        iAnnexb                   = EOONotSet;
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else if (aCodecType == KAudioCodecSMV)
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodecSMV;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOONotSet;
+        iModeSet.Reset();
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOONotSet;
+        iPtime                    = KNotSet;
+        iMaxptime                 = KRCSEDefaultMaxptime;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = 5;
+        iChannels.Reset();
+        iVAD                      = EOff;
+        iDTX                      = EOONotSet;
+        iSamplingRate             = KNotSet;
+        iAnnexb                   = EOONotSet;
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else if (aCodecType == KAudioCodecSMV0)
+        {
+        iCodecId                  = 0;
+        iMediaTypeName            = KRCSEDefaultMediaTypeName;
+        iMediaSubTypeName         = KAudioCodecSMV0;
+        iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
+        iOctetAlign               = EOONotSet;
+        iModeSet.Reset();
+        iModeChangePeriod         = KNotSet;
+        iModeChangeNeighbor       = EOONotSet;
+        iPtime                    = KNotSet;
+        iMaxptime                 = KNotSet;
+        iCrc                      = EOONotSet;
+        iRobustSorting            = EOONotSet;
+        iInterLeaving             = KNotSet;
+        iChannels.Reset();
+        iVAD                      = EOff;
+        iDTX                      = EOONotSet;
+        iSamplingRate             = 8000;
+        iAnnexb                   = EOONotSet;
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }
+    else
+        {
+        iOctetAlign               = KRCSEDefaultOctetAlign;
+        iModeSet.Reset();
+        iModeChangePeriod         = 0;
+        iModeChangeNeighbor       = KRCSEDefaultModeChangeNeighbor;
+        iPtime                    = 0;
+        iMaxptime                 = 0;
+        iCrc                      = KRCSEDefaultCRC;
+        iRobustSorting            = KRCSEDefaultRobustSorting;
+        iInterLeaving             = 0;
+        iChannels.Reset();
+        iVAD                      = KRCSEDefaultVAD;
+        iDTX                      = KRCSEDefaultDTX;
+        iSamplingRate             = KNotSet;
+        iAnnexb                   = EOONotSet;    
+        iModeChangeCapability     = KNotSet;
+        iMaxRed                   = KNotSet;
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecEntry::ResetDefaultCodecValues
+// Resets codec entry to default settings.
+// -----------------------------------------------------------------------------
+//
+void CRCSEAudioCodecEntry::ResetDefaultCodecValues()
+    {
+    iModeSet.Reset();
+    iChannels.Reset();
+    // These parameters default values are same regardless used codec.
+    iCodecId                 = 0;
+    iMediaTypeName           = KRCSEDefaultMediaTypeName;
+    iMediaSubTypeName        = KRCSEDefaultMediaSubtypeName;
+    iJitterBufferSize        = KRCSEDefaultJitterBufferSize;
+    
+    // These parameters default values change with used codec, here there are set to KNotSet.
+    iOctetAlign              = KRCSEDefaultOctetAlign;
+    iModeChangePeriod        = 0;
+    iModeChangeNeighbor      = KRCSEDefaultModeChangeNeighbor;
+    iPtime                   = 0;
+    iMaxptime                = 0;
+    iCrc                     = KRCSEDefaultCRC;
+    iRobustSorting           = KRCSEDefaultRobustSorting;
+    iInterLeaving            = 0;
+    iVAD                     = KRCSEDefaultVAD;
+    iDTX                     = KRCSEDefaultDTX;
+    iSamplingRate            = 0;
+    iAnnexb                  = KRCSEDefaultAnnexb;
+    iModeChangeCapability    = KRCSEDefaultModeChangeCapability;
+    iMaxRed                  = KRCSEDefaultMaxRed;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/crcseaudiocodecregistry.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,566 @@
+/*
+* 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:  Stores and loads CRCSEAudioCodecRegistry to/from data storage.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <featmgr.h>
+
+#include "crcseaudiocodecregistry.h"
+#include "crcseaudiocodecentry.h"
+#include "rcsepanic.h"
+#include "rcseconstants.h"
+#include "rcseprivatecrkeys.h"
+#include "rcselogger.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSEAudioCodecRegistry* CRCSEAudioCodecRegistry::NewLC()
+    {
+    CRCSEAudioCodecRegistry* self = new( ELeave ) CRCSEAudioCodecRegistry();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSEAudioCodecRegistry* CRCSEAudioCodecRegistry::NewL()
+    {
+    CRCSEAudioCodecRegistry* self = CRCSEAudioCodecRegistry::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CRCSEAudioCodecRegistry::ConstructL()
+    {
+    // Check VoIP support from feature manager
+    FeatureManager::InitializeLibL();
+    TBool support = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
+    FeatureManager::UnInitializeLib();
+    if (!support)
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    BaseConstructL();
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::CRCSEAudioCodecRegistry
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRCSEAudioCodecRegistry::CRCSEAudioCodecRegistry()
+    : CRCSERegistryBase( EAudioCodecSetting )
+    {
+    }
+
+// Destructor
+EXPORT_C CRCSEAudioCodecRegistry::~CRCSEAudioCodecRegistry()
+    {
+    RCSELOGSTRING( 
+        "CRCSEAudioCodecRegistry::~CRCSEAudioCodecRegistry() - IN/OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::AddL
+// Start addition of audio codec entry.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CRCSEAudioCodecRegistry::AddL( 
+    const CRCSEAudioCodecEntry& aNewEntry )
+    {
+    RCSELOGSTRING( "CRCSEAudioCodecRegistry::AddL() - IN" );
+
+    BeginL();
+
+    TUint32 id( KNoEntryId );
+
+    // Add entry to storage
+    AddOrUpdateEntryL( id, aNewEntry );
+
+    __ASSERT_ALWAYS( KNoEntryId < id , User::Leave( KErrCorrupt ) );
+
+    EndL();
+
+    RCSELOGSTRING( "CRCSEAudioCodecRegistry::AddL() - OUT" );
+    return id;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::FindL
+// Start search of audio codec entry by ID.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEAudioCodecRegistry::FindL( 
+    TUint32 aCodecId, 
+    CRCSEAudioCodecEntry& aFoundEntry )
+    {
+    RCSELOGSTRING2( "CRCSEAudioCodecRegistry::FindL(%d) - IN", aCodecId );
+
+    BeginL();
+
+    FindEntryL( aCodecId, aFoundEntry );
+
+    EndL();
+
+    RCSELOGSTRING2( "CRCSEAudioCodecRegistry::FindL(%d) - OUT", aCodecId );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::DeleteL
+// Deletes a codec entry which codec id is aCodecId.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEAudioCodecRegistry::DeleteL( TUint32 aCodecId )
+    {
+    RCSELOGSTRING2( "CRCSEAudioCodecRegistry::DeleteL() - IN", aCodecId );
+
+    BeginL();
+
+    iCenRepDb->DeleteEntryL( aCodecId );
+
+    EndL();
+
+    RCSELOGSTRING2( "CRCSEAudioCodecRegistry::DeleteL() - OUT", aCodecId );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::UpdateL
+// Updates codec entry, which codec identifier is aCodecId.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEAudioCodecRegistry::UpdateL(
+    TUint32 aCodecId,
+    const CRCSEAudioCodecEntry& aUpdateData )
+    {
+    RCSELOGSTRING2( "CRCSEAudioCodecRegistry::UpdateL() - IN", aCodecId );
+
+    __ASSERT_ALWAYS( KNoEntryId < aCodecId, User::Leave( KErrArgument ) );
+
+    BeginL();
+
+    AddOrUpdateEntryL( aCodecId, aUpdateData );
+
+    EndL();
+
+    RCSELOGSTRING2( "CRCSEAudioCodecRegistry::UpdateL() - OUT", aCodecId );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::GetDefaultCodec
+// Resets a default profile values.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEAudioCodecRegistry::GetDefaultCodec( 
+    CRCSEAudioCodecEntry& aDefaultCodec ) const
+    {
+    aDefaultCodec.ResetDefaultCodecValues();
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::GetAllIdsL
+// Gets all codec identifiers.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEAudioCodecRegistry::GetAllCodecIdsL( RArray<TUint32>& aAllIds )
+    {
+    RCSELOGSTRING( "CRCSEAudioCodecRegistry::GetAllCodecIdsL() - IN" );
+
+    BeginL();
+
+    FindAllIdsL( aAllIds );
+
+    EndL();
+
+    RCSELOGSTRING( "CRCSEAudioCodecRegistry::GetAllCodecIdsL() - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::AddL
+// Add bunch of entries to store
+// ---------------------------------------------------------------------------
+//
+void CRCSEAudioCodecRegistry::AddL( 
+    RPointerArray<CRCSEAudioCodecEntry>& aEntries )
+    {
+    RCSELOGSTRING2( 
+        "CRCSEAudioCodecRegistry::AddL(%d entries) - IN", aEntries.Count() );
+
+    BeginL();
+
+    TInt count( aEntries.Count() );
+
+    for ( TInt i( 0 ); i < count; ++i )
+        {
+        TUint32 id( KNoEntryId );
+        AddOrUpdateEntryL( id, *aEntries[ i ] );
+        aEntries[ i ]->iCodecId = id;
+        }
+
+    EndL();
+
+    RCSELOGSTRING( "CRCSEAudioCodecRegistry::AddL(entries) - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::DeleteL
+// Delete bunch of entries from store in one trasaction.
+// ---------------------------------------------------------------------------
+//
+void CRCSEAudioCodecRegistry::DeleteL( const RArray<TUint32>& aIds )
+    {
+    TInt count( aIds.Count() );
+
+    RCSELOGSTRING2( 
+        "CRCSEAudioCodecRegistry::DeleteL(%d entries) - IN", count );
+
+    BeginL();
+
+    for( TInt i = 0; i < count; i++ )
+        {
+        TRAPD( e, iCenRepDb->DeleteEntryL( aIds[ i ] ) );
+        __ASSERT_ALWAYS( 
+            KErrNone == e || KErrNotFound == e, User::Leave( e ) );
+        }
+
+    EndL();
+
+    RCSELOGSTRING( "CRCSEAudioCodecRegistry::DeleteL(entries) - OUT" );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::FindEntryL
+// Do actual search of audio codec entry
+// -----------------------------------------------------------------------------
+//
+void CRCSEAudioCodecRegistry::FindEntryL( 
+    TUint32 aCodecId, 
+    CRCSEAudioCodecEntry& aFoundEntry )
+    {
+    RCSELOGSTRING2( "CRCSEAudioCodecRegistry::FindEntryL(%d) - IN", aCodecId );
+
+    RIpAppPropArray properties;
+	TCleanupItem cleanup( CRCSERegistryBase::CleanupDbPropArray, &properties );
+	CleanupStack::PushL( cleanup );
+
+    User::LeaveIfError( iCenRepDb->FindEntryL( aCodecId, properties ) );
+    ConvertPropertiesToEntryL( aFoundEntry, properties );
+    aFoundEntry.iCodecId = aCodecId;
+
+    CleanupStack::PopAndDestroy( &properties );
+
+    RCSELOGSTRING2( "CRCSEAudioCodecRegistry::FindEntryL(%d) - OUT", aCodecId );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::AddOrUpdateEntryL
+// Adds new entry or updates values of existing enry
+// -----------------------------------------------------------------------------
+//
+void CRCSEAudioCodecRegistry::AddOrUpdateEntryL( 
+    TUint32& aId, 
+    const CRCSEAudioCodecEntry& aEntry )
+    {
+    RCSELOGSTRING( "CRCSEAudioCodecRegistry::AddOrUpdateEntryL() - IN" );
+
+    TInt id( aId );
+
+    RIpAppPropArray properties;
+
+	TCleanupItem cleanup( CRCSERegistryBase::CleanupDbPropArray, &properties );
+	CleanupStack::PushL( cleanup );
+
+    ConvertEntryToPropertiesL( aEntry, properties );
+    
+    if ( KNoEntryId == id ) // Add new one
+        {
+        RCSELOGSTRING( "-- Add --" );
+        iCenRepDb->AddEntryL( id, properties );
+        }
+    else                    // Update existing entry
+        {
+        RCSELOGSTRING( "-- Update --" );
+        User::LeaveIfError( iCenRepDb->UpdateEntryL( id, properties ) );
+        }
+
+    aId = id;
+
+    CleanupStack::PopAndDestroy( &properties );
+    
+    RCSELOGSTRING( "CRCSEAudioCodecRegistry::AddOrUpdateEntryL() - OUT" );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CRCSEAudioCodecRegistry::GetEntryL
+// Get values for audio codec entry from repository
+// -----------------------------------------------------------------------------
+//
+void CRCSEAudioCodecRegistry::ConvertPropertiesToEntryL( 
+    CRCSEAudioCodecEntry& aEntry,
+    RIpAppPropArray& aProperties  )
+    {
+    RCSELOGSTRING( 
+        "CRCSEAudioCodecRegistry::ConvertPropertiesToEntryL() - IN" );
+
+    aEntry.ResetDefaultCodecValues();
+
+    TBuf<KDesLength256> value;
+
+    //TInt32 id( KNoEntryId );
+    //GetL( aRow, KColAudioCodecId, id );
+    //aEntry.iCodecId = id;
+
+    GetPropertyValueL( KColMediaTypeName, value, aProperties );
+    aEntry.iMediaTypeName.Copy( value );
+    
+    GetPropertyValueL( KColMediaSubTypeName, value, aProperties );
+    aEntry.iMediaSubTypeName.Copy( value );
+
+    GetPropertyValueL( KColJitterBufferSize, value, aProperties );
+    aEntry.iJitterBufferSize = ToTInt32L( value );
+
+    GetPropertyValueL( KColOctetAlign, value, aProperties );
+    aEntry.iOctetAlign = static_cast<CRCSEAudioCodecEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColModeSet, value, aProperties );
+
+    TLex lex( value );
+    while( !lex.Eos() )
+        {
+        // Extract the number as unsigned int 32, which can be 
+        // converted to value wanted (template)
+        TUint32 num;
+        lex.Val( num, EDecimal );
+        aEntry.iModeSet.AppendL( static_cast<TUint32>( num ) );
+        // Skip characters to space char.
+        lex.SkipCharacters();
+        if ( !lex.Eos() ) // Check that End of string is not next char.
+            {
+            // Go over the space character.
+            lex.Inc( 1 );
+            }
+        }
+
+    GetPropertyValueL( KColModeChangePeriod, value, aProperties );
+    aEntry.iModeChangePeriod = ToTInt32L( value );
+
+    GetPropertyValueL( KColModeChangeNeighbor, value, aProperties );
+    aEntry.iModeChangeNeighbor = static_cast<CRCSEAudioCodecEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColPtime, value, aProperties );
+    aEntry.iPtime = ToTInt32L( value );
+
+    GetPropertyValueL( KColMaxptime, value, aProperties );
+    aEntry.iMaxptime = ToTInt32L( value );
+
+    GetPropertyValueL( KColCrc, value, aProperties );
+    aEntry.iCrc = static_cast<CRCSEAudioCodecEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColRobustSorting, value, aProperties );
+    aEntry.iRobustSorting = static_cast<CRCSEAudioCodecEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColInterLeaving, value, aProperties );
+    aEntry.iInterLeaving = ToTInt32L( value );
+
+    GetPropertyValueL( KColChannels, value, aProperties );
+
+    TLex lex2( value );
+    while( !lex2.Eos() )
+        {
+        // Extract the number as unsigned int 32, which can be 
+        // converted to value wanted (template)
+        TUint32 num;
+        lex2.Val( num, EDecimal );
+        aEntry.iChannels.AppendL( static_cast<TUint32>( num ) );
+        // Skip characters to space char.
+        lex2.SkipCharacters();
+        if ( !lex2.Eos() ) // Check that End of string is not next char.
+            {
+            // Go over the space character.
+            lex2.Inc( 1 );
+            }
+        }
+
+    GetPropertyValueL( KColVAD, value, aProperties );
+    aEntry.iVAD = static_cast<CRCSEAudioCodecEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColDTX, value, aProperties );
+    aEntry.iDTX = static_cast<CRCSEAudioCodecEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColSamplingRate, value, aProperties );
+    aEntry.iSamplingRate = ToTInt32L( value );
+
+    GetPropertyValueL( KColAnnexb, value, aProperties );
+    aEntry.iAnnexb = static_cast<CRCSEAudioCodecEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColModeChangeCapability, value, aProperties );
+    aEntry.iModeChangeCapability = ToTInt32L( value );
+
+    GetPropertyValueL( KColMaxRed, value, aProperties );
+    aEntry.iMaxRed = ToTInt32L( value );
+
+    RCSELOGSTRING( "CRCSEAudioCodecRegistry::GetEntryValuesL() - OUT" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::AddEntryL
+// Do actual addition or update of entry
+// -----------------------------------------------------------------------------
+//
+void CRCSEAudioCodecRegistry::ConvertEntryToPropertiesL( 
+    const CRCSEAudioCodecEntry& aEntry,
+    RIpAppPropArray& aProperties )
+    {
+    RCSELOGSTRING(
+         "CRCSEAudioCodecRegistry::ConvertEntryToPropertiesL() - IN" );
+
+    // Descriptor for value conversion
+    TBuf<KDesLength128> des;
+
+    CreatePropertyL( KColMediaTypeName,
+                     aEntry.iMediaTypeName,
+                     aProperties );
+
+    CreatePropertyL( KColMediaSubTypeName,
+                     aEntry.iMediaSubTypeName,
+                     aProperties );
+
+    CreatePropertyL( KColJitterBufferSize,
+                     ToDes( aEntry.iJitterBufferSize, des ),
+                     aProperties );
+
+    TInt32 octetAlign( aEntry.iOctetAlign ); // TOnOff
+    CreatePropertyL( KColOctetAlign,
+                     ToDes( octetAlign, des ),
+                     aProperties );
+
+    TInt msCount = aEntry.iModeSet.Count(); // Array type
+    des.Zero();
+    for ( TInt i( 0 ); i < msCount; i++ )
+        {
+        des.AppendNum( static_cast<TUint32>( aEntry.iModeSet[i] ) );
+        if ( i < msCount - 1 )
+            {
+            des.Append( KSpace );
+            }
+        }
+
+    CreatePropertyL( KColModeSet,
+                     des,
+                     aProperties );
+
+    CreatePropertyL( KColModeChangePeriod, 
+                     ToDes( aEntry.iModeChangePeriod, des ),
+                     aProperties );
+
+    TInt32 modeChangeNeighbor( aEntry.iModeChangeNeighbor ); // TOnoff
+    CreatePropertyL( KColModeChangeNeighbor,
+                     ToDes( modeChangeNeighbor, des ),
+                     aProperties );
+
+    CreatePropertyL( KColPtime,
+                     ToDes( aEntry.iPtime, des ),
+                     aProperties );
+
+    CreatePropertyL( KColMaxptime,
+                     ToDes( aEntry.iMaxptime, des ),
+                     aProperties );
+
+    TInt32 crc( aEntry.iCrc ); // TOnOff
+    CreatePropertyL( KColCrc,
+                     ToDes( crc, des ),
+                     aProperties );
+
+    TInt32 robustSorting( aEntry.iRobustSorting ); // TOnOff
+    CreatePropertyL( KColRobustSorting,
+                     ToDes( robustSorting, des ),
+                     aProperties );
+
+    CreatePropertyL( KColInterLeaving,
+                     ToDes( aEntry.iInterLeaving, des ),
+                     aProperties );
+
+    TInt cCount = aEntry.iChannels.Count(); // Array type
+    des.Zero();
+    for ( TInt j( 0 ); j < cCount; j++ )
+        {
+        des.AppendNum( static_cast<TUint32>( aEntry.iChannels[j] ) );
+        if ( j < cCount - 1 )
+            {
+            des.Append( KSpace );
+            }
+        }
+
+    CreatePropertyL( KColChannels,
+                     des,
+                     aProperties );
+
+    TInt32 vad( aEntry.iVAD ); // TOnOff
+    CreatePropertyL( KColVAD,
+                     ToDes( vad, des ),
+                     aProperties );
+
+    TInt32 dtx( aEntry.iDTX );
+    CreatePropertyL( KColDTX,
+                     ToDes( dtx, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSamplingRate,
+                     ToDes( aEntry.iSamplingRate, des ),
+                     aProperties );
+
+    TInt32 annexB( aEntry.iAnnexb ); // TOnOff
+    CreatePropertyL( KColAnnexb,
+                     ToDes( annexB, des ),
+                     aProperties );
+
+    CreatePropertyL( KColModeChangeCapability,
+                     ToDes( aEntry.iModeChangeCapability, des ),
+                     aProperties );
+
+    CreatePropertyL( KColMaxRed,
+                     ToDes( aEntry.iMaxRed, des ),
+                     aProperties );
+
+    RCSELOGSTRING(
+         "CRCSEAudioCodecRegistry::ConvertEntryToPropertiesL() - OUT" );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/crcsechangenotifier.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,205 @@
+/*
+* 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:  Provides notification service of changes in VoIP profiles.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <centralrepository.h>
+#include <featmgr.h>
+
+#include "crcsechangenotifier.h"
+#include "rcseconstants.h"
+#include "rcsebackupobserver.h"
+#include "rcselogger.h"
+#include "rcsepanic.h"
+#include "rcseprivatecrkeys.h"
+
+
+const TUint32 KUnknownNotifier = KMaxTUint;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CRCSEChangeNotifier::CRCSEChangeNotifier
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRCSEChangeNotifier::CRCSEChangeNotifier()
+    {
+    iRange = KUnknownNotifier;
+    iNotifyRequested = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEChangeNotifier::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CRCSEChangeNotifier::ConstructL( const TDesC& aName )
+    {
+    RCSELOGSTRING( "CRCSEChangeNotifier::ConstructL() - IN" );
+    RCSELOGTHREAD();
+
+    // Check VoIP support from feature manager
+    FeatureManager::InitializeLibL();
+    TBool support = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
+    FeatureManager::UnInitializeLib();
+    if (!support)
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    iRepository = CRepository::NewL( KCRUidRCSE );
+
+    iName.Copy( aName );
+    iBackupObserver = CRCSEBackupObserver::NewL( *this );
+
+    RCSELOGSTRING( "CRCSEChangeNotifier::ConstructL() - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEChangeNotifier::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSEChangeNotifier* CRCSEChangeNotifier::NewL( const TDesC& aName )
+    {
+    CRCSEChangeNotifier* self = new( ELeave ) CRCSEChangeNotifier();
+    CleanupStack::PushL( self );
+    self->ConstructL( aName );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CRCSEChangeNotifier::~CRCSEChangeNotifier
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSEChangeNotifier::~CRCSEChangeNotifier()
+    {
+    RCSELOGSTRING( "CRCSEChangeNotifier::~CRCSEChangeNotifier() - IN" );
+    RCSELOGTHREAD();
+
+    if ( iBackupObserver )
+        {
+        iBackupObserver->Cancel();
+        delete iBackupObserver;
+        iBackupObserver = NULL;
+        }
+
+    delete iRepository;
+
+    RCSELOGSTRING( "CRCSEChangeNotifier::~CRCSEChangeNotifier() - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEChangeNotifier::HandleBackupOperationEventL
+// Handle backup events. 
+// -----------------------------------------------------------------------------
+//
+void CRCSEChangeNotifier::HandleBackupOperationEventL()
+	{
+	RCSELOGSTRING( "CRCSEChangeNotifier::HandleBackupOperationEventL() - IN" );
+    RCSELOGTHREAD();
+
+	if ( iBackupObserver->IsBackupOperationRunning() )
+        {
+        CancelNotify();
+        }
+    else if ( iReqStatus )
+        {
+        NotifyChange( *iReqStatus );
+        iReqStatus = NULL;
+        }
+
+    RCSELOGSTRING( "CRCSEChangeNotifier::HandleBackupOperationEventL() - OUT" );
+	}
+
+// -----------------------------------------------------------------------------
+// CRCSEChangeNotifier::NotifyChange
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEChangeNotifier::NotifyChange( TRequestStatus& aStatus )
+    {
+    RCSELOGSTRING( "CRCSEChangeNotifier::NotifyChange() - IN" );
+    RCSELOGTHREAD();
+
+    // If backup is active, store request handle for later use.
+    if ( iBackupObserver->IsBackupOperationRunning() )
+        {
+        RCSELOGSTRING( "CRCSEChangeNotifier::NotifyChange() - BUR active" );
+        iReqStatus = &aStatus;
+        aStatus = KRequestPending;
+        }
+    else
+        {
+        TRAP_IGNORE( SetNotifierL( aStatus ) );
+        }
+
+    RCSELOGSTRING( "CRCSEChangeNotifier::NotifyChange() - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEChangeNotifier::CancelNotify
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEChangeNotifier::CancelNotify()
+    {
+    RCSELOGSTRING( "CRCSEChangeNotifier::CancelNotify() - IN" );
+    RCSELOGTHREAD();
+
+    iRepository->NotifyCancel( iRange, KRCSEColumnMask );
+    iReqStatus = NULL;
+    iNotifyRequested = EFalse;
+
+    RCSELOGSTRING( "CRCSEChangeNotifier::CancelNotify() - OUT" );
+    }
+// -----------------------------------------------------------------------------
+// CRCSEChangeNotifier::SetNotifierL
+// Set up notifier to requested data source
+// -----------------------------------------------------------------------------
+//
+void CRCSEChangeNotifier::SetNotifierL( TRequestStatus& aStatus )
+    {
+    RCSELOGSTRING2( "CRCSEChangeNotifier::SetNotifierL( %S ) - IN", &iName );
+
+    if ( KDbName() == iName ) // VoIP profile IDs
+        {
+        iRange = KColProfileId;
+        }
+    else if ( KDbCodecName() == iName ) // Audio Codec IDs
+        {
+        iRange = KColAudioCodecId;
+        }
+    else // Unknown
+        {
+        User::Leave( KErrArgument );
+        }
+
+    User::LeaveIfError(
+        iRepository->NotifyRequest( iRange, KRCSEColumnMask, aStatus ) );
+
+    iNotifyRequested = ETrue;
+
+    RCSELOGSTRING( "CRCSEChangeNotifier::SetNotifierL() - OUT" );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/crcseprofileentry.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,174 @@
+/*
+* 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:  Profile entry, which is stored to cenrep
+*
+*/
+
+
+
+// INCLUDE FILES
+#include	<featmgr.h>
+
+#include    "crcseprofileentry.h"
+#include    "rcsedefaults.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CRCSEProfile::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSEProfileEntry* CRCSEProfileEntry::NewL()
+    {
+    CRCSEProfileEntry* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfile::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSEProfileEntry* CRCSEProfileEntry::NewLC()
+    {
+    CRCSEProfileEntry* self = new (ELeave) CRCSEProfileEntry();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    self->ResetDefaultValues();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileEntry::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileEntry::ConstructL()
+    {
+    // Check VoIP support from feature manager
+    FeatureManager::InitializeLibL();
+    TBool support = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
+    FeatureManager::UnInitializeLib();
+    if (!support)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileEntry::CRCSEProfileEntry
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRCSEProfileEntry::CRCSEProfileEntry()
+    {
+    }
+    
+// Destructor
+EXPORT_C CRCSEProfileEntry::~CRCSEProfileEntry()
+    {
+    iIds.Reset();
+    iIds.Close();
+    iPreferredCodecs.Reset();
+    iPreferredCodecs.Close();
+    }
+    
+// -----------------------------------------------------------------------------
+// CRCSEProfileEntry::ResetDefaultValues
+// Resets profile entry to default settings.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileEntry::ResetDefaultValues()
+    {
+    iIds.Reset();
+    
+    iId                 = 0;
+    iProviderName       = KRCSEDefaultProviderName;
+    iSettingsName       = KRCSEDefaultSettingsName;
+    
+    // Codecs
+    iPreferredCodecs.Reset();
+    
+    iStartMediaPort     = KRCSEDefaultStartMediaPort;
+    iEndMediaPort       = KRCSEDefaultEndMediaPort;
+    iSiqnalingQOS       = KRCSEDefaultSiqnalingQOS;
+    iMediaQOS           = KRCSEDefaultMediaQOS;
+    iInbandDTMF         = KRCSEDefaultInbandDTMF;
+    iOutbandDTMF        = KRCSEDefaultOutbandDTMF;
+    iHoldRingBack       = KRCSEDefaultHoldRingBack;
+    iAutoComplete       = KRCSEDefaultAutoComplete;
+    iCFNoAnswer         = KRCSEDefaultCFNoAnswer;
+    iCFBusy             = KRCSEDefaultCFBusy;
+    iCFUnconditional    = KRCSEDefaultCFUnconditional;
+    iRedundancy         = KRCSEDefaultRedundancy;   
+    iSecureCallPreference   = KRCSEDefaultSecureCallPreference;
+    iVoIPProfileLock        = KRCSEDefaultVoIPProfileLock;
+    iAdhocAllowed           = KRCSEDefaultAdhocAllowed;
+    iSIPServerType          = KRCSEDefaultSIPServerType;
+    iSBCType                = KRCSEDefaultSBCType;
+    iSTUNServerType         = KRCSEDefaultSTUNServerType;
+    iWLANAPType             = KRCSEDefaultWLANAPType;
+    iPSTNGatewayType        = KRCSEDefaultPSTNGatewayType;
+    iSecurityGatewayType    = KRCSEDefaultSecurityGatewayType;
+    iRTCP                   = KRCSEDefaultRTCP;
+    iSIPVoIPUAHTerminalType = KRCSEDefaultSIPVoIPUAHTerminalType;
+    iSIPVoIPUAHeaderWLANMAC = KRCSEDefaultSIPVoIPUAHeaderWLANMAC;
+    iSIPVoIPUAHeaderString  = KRCSEDefaultSIPVoIPUAHeaderString;
+    iProfileLockedToIAP     = KRCSEDefaultProfileLockedToIAP;
+    iVoIPPluginUID          = KRCSEDefaultVoIPPluginUID;
+    iAllowVoIPoverWCDMA     = KRCSEDefaultAllowVoIPoverWCDMA;
+    iAllowVoIPoverBT        = KRCSEDefaultAllowVoIPoverBT;
+    iMeanCountOfVoIPDigits  = KRCSEDefaultMeanCountOfVoIPDigits;
+    iIgnoreAddrDomainPart   = KRCSEDefaultIgnoreAddrDomainPart;
+
+    iHandoverDialect            = KRCSEDefHandoverDialect;
+    iPSTelephonyHOPreference    = KRCSEDefPSTelephonyHOPreference;
+    iHOThresholdValueLL         = KRCSEDefHOThresholdValueLL;
+    iHOThresholdValueHL         = KRCSEDefHOThresholdValueHL;
+    iNumberOfMeasurementsAbove  = KRCSEDefNumberOfMeasurementsAbove;
+    iNumberOfMeasurementsBelow  = KRCSEDefNumberOfMeasurementsBelow;
+    iSmartScannInterParaHigh    = KRCSEDefSmartScannInterParaHigh;
+    iSmartScannInterParaMedium  = KRCSEDefSmartScannInterParaMedium;
+    iSmartScannInterParaLow     = KRCSEDefSmartScannInterParaLow;
+    iSmartScannInterParaStatic  = KRCSEDefSmartScannInterParaStatic;
+
+    iSmartScannDurationHighMode     = KRCSEDefSmartScannDurationHighMode;
+    iSmartScannDurationMediumMode   = KRCSEDefSmartScannDurationMediumMode;
+    iSmartScannDurationLowMode      = KRCSEDefSmartScannDurationLowMode;
+    iHandoffNumber                  = KRCSEDefHandoffNumber;
+    iHandbackNumber                 = KRCSEDefHandbackNumber;
+    iHysterisisTimer                = KRCSEDefHysterisisTimer;
+    iHandOffProcessTimer            = KRCSEDefHandOffProcessTimer;
+    iDisconnectProcessTimer         = KRCSEDefDisconnectProcessTimer;
+    iHandoffPrefix                  = KRCSEHandoffPrefix;
+    iHandbackPrefix                 = KRCSEHandbackPrefix;
+    iHandoverTones                  = KRCSEDefHandoverTones;
+    iSupportSMSoverWLAN             = KRCSEDefSupportSMSoverWLAN;
+
+    iServiceProviderId              = KRCSEDefServiceProviderId;
+    iUserPhoneUriParameter          = KRCSEDefUserPhoneUriParam;
+    iSIPConnTestAddress             = KRCSEDefSIPConnTestAddress;
+    iNATSettingsStorageId           = KRCSEDefNATSettingsStorageId;
+    iSIPMinSE                       = KRCSEDefSIPMinSE;
+    iSIPSessionExpires              = KRCSEDefSIPSessionExpires;
+    iNATProtocol                    = KRCSEDefNATProtocol;
+    iNewServiceTableEntry           = KRCSENewServiceTableEntry;
+    iSNAPId                         = KRCSEDefSNAPId;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/crcseprofileregistry.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1764 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Stores and loads CRCSEProfileEntry to/from data storage.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <sipmanagedprofileregistry.h>
+#include <sipprofile.h>
+
+#include <spsettings.h>
+#include <spentry.h>
+#include <spproperty.h>
+#include <spdefinitions.h>
+#include <featmgr.h>
+
+#include <cenrepdatabaseutil.h>
+#include <cenrepdatabaseproperty.h>
+
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+#include "crcseprofileregistry.h"
+#include "crcseprofileentry.h"
+#include "crcseaudiocodecregistry.h"
+#include "rcsepanic.h"
+#include "rcseconstants.h"
+#include "rcsedefaults.h"
+#include "rcseprivatecrkeys.h"
+#include "rcselogger.h"
+
+
+const TInt KArrayInitSize = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::CRCSEProfileRegistry
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRCSEProfileRegistry::CRCSEProfileRegistry()
+    : CRCSERegistryBase( EVoIPProfile ),
+      iSIPRegistry( NULL )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::ConstructL()
+    {
+    // Check VoIP support from feature manager
+    FeatureManager::InitializeLibL();
+    TBool support = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
+    FeatureManager::UnInitializeLib();
+    if ( !support )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    BaseConstructL();
+    iSIPRegistry = CSIPManagedProfileRegistry::NewL( *this );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSEProfileRegistry* CRCSEProfileRegistry::NewL()
+    {
+    CRCSEProfileRegistry* self = CRCSEProfileRegistry::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSEProfileRegistry* CRCSEProfileRegistry::NewLC()
+    {
+    CRCSEProfileRegistry* self = new( ELeave ) CRCSEProfileRegistry;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSEProfileRegistry::~CRCSEProfileRegistry()
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::~CRCSEProfileRegistry() - IN" );
+
+    delete iSIPRegistry;
+    iSIPProfiles.ResetAndDestroy();
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::~CRCSEProfileRegistry() - OUT" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::FindL
+// Start search of profile entry by provider name.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEProfileRegistry::FindL( 
+    const TDesC& aProviderName,
+    CRCSEProfileEntry& aFoundEntry )
+    {
+    RCSELOGSTRING2( "CRCSEProfileRegistry::FindL(%S) - IN", &aProviderName );
+
+    BeginL();
+
+    RArray<TUint32> entryIds;
+    CleanupClosePushL( entryIds );
+
+    // Search IDs of entries that have this service ID
+    FindIdsByValueL( KColProviderName,
+                     aProviderName, 
+                     entryIds );
+
+    // Search whole entry if ID was found
+    if ( 0 < entryIds.Count() )
+        {
+        FindEntryL( entryIds[ 0 ], aFoundEntry );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // Check that SIP Ids are valid
+    UpdateSIPProfileLinksL( aFoundEntry );
+    
+    CleanupStack::PopAndDestroy( &entryIds );
+
+    EndL();
+
+    RCSELOGSTRING2( "CRCSEProfileRegistry::FindL(%S) - OUT", &aProviderName );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::FindL
+// Start search of profile entry by ID.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEProfileRegistry::FindL( 
+    TUint32 aProfileId, 
+    CRCSEProfileEntry& aFoundEntry )
+    {
+    RCSELOGSTRING2( "CRCSEProfileRegistry::FindL(id=%d) - IN", aProfileId );
+
+    BeginL();
+
+    FindEntryL( aProfileId, aFoundEntry );
+
+    // Check that SIP Ids are valid
+    UpdateSIPProfileLinksL( aFoundEntry );
+
+    EndL();
+
+    RCSELOGSTRING2( "CRCSEProfileRegistry::FindL(id=%d) - OUT", aProfileId );
+    }
+    
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::AddL
+// Start addition of profile entry.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CRCSEProfileRegistry::AddL( 
+    const CRCSEProfileEntry& aNewEntry )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::AddL() - IN" );
+
+    BeginL();
+
+    TUint32 id( KNoEntryId );
+
+    // Add entry to storage
+    AddOrUpdateEntryL( id, aNewEntry );
+
+    __ASSERT_ALWAYS( KNoEntryId < id, User::Leave( KErrCorrupt ) );
+
+    // Create service settings or use existing
+    CRCSEProfileEntry& modifyEntry 
+        = const_cast<CRCSEProfileEntry&>( aNewEntry );
+
+    // New service settings entry...
+    if( ( CRCSEProfileEntry::EOONotSet == modifyEntry.iNewServiceTableEntry ||
+          CRCSEProfileEntry::EOn == modifyEntry.iNewServiceTableEntry ) )
+        {
+        CreateDefaultServiceSettingsL( modifyEntry );
+        if ( modifyEntry.iServiceProviderId != KRCSEDefServiceProviderId )
+            {
+            UpdateServiceIdL( id, modifyEntry.iServiceProviderId );
+            }
+        }
+
+    // Use existing service settings entry if
+    // - given service id is valid
+    // - service id is not used by another profile
+    // - provider name is valid
+    else if( CRCSEProfileEntry::EOff == modifyEntry.iNewServiceTableEntry &&
+             KSPNoId < modifyEntry.iServiceProviderId )
+        {
+        // Check that provide name is valid
+        TBool providerExist( 
+            NameExistsInServiceTableL( modifyEntry.iProviderName ) );
+
+        if( !providerExist )
+            {
+            User::Leave( KErrNotFound );
+            }
+
+        // Check that service id is not used by another profile
+        LeaveIfServiceIdInUseL( modifyEntry );
+        }
+
+    // Fail all other cases
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    EndL();
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::AddL() - OUT" );
+
+    return id;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::DeleteL
+// Deletes a profile entry which profile id is aProfileId.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEProfileRegistry::DeleteL( 
+    TUint32 aProfileId )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::DeleteL() - IN" );
+
+    // Delete referenced settings first
+    DeleteReferenceSettingsL( aProfileId );
+
+    // Start transaction here since referenced settings are
+    // deleted in own separate transaction
+    BeginL();
+
+    // Delete actual profile
+    iCenRepDb->DeleteEntryL( aProfileId );
+
+    EndL();
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::DeleteL() - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::UpdateL
+// Updates profile entry, which profile identifier is aId.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEProfileRegistry::UpdateL(
+    TUint32 aId, const CRCSEProfileEntry& aUpdateData )
+    {
+    RCSELOGSTRING2( "CRCSEProfileRegistry::UpdateL(%d) - IN", aId );
+
+    __ASSERT_ALWAYS( KNoEntryId < aId, User::Leave( KErrArgument ) );
+
+    BeginL();
+
+    AddOrUpdateEntryL( aId, aUpdateData );
+
+    // Update also service settings if needed
+    if ( aUpdateData.iIds.Count() && 
+        aUpdateData.iIds[0].iProfileType == CRCSEProfileEntry::EProtocolSIP )
+        {
+        if ( aUpdateData.iServiceProviderId == KRCSEDefServiceProviderId )
+            {
+            CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();
+            CopyEntryValues( aUpdateData, *entry );
+            CreateDefaultServiceSettingsL( *entry );
+            UpdateServiceSettingsL( *entry );
+            AddOrUpdateEntryL( aId, *entry );
+            CleanupStack::PopAndDestroy( entry );
+            }
+        else
+            {
+            UpdateServiceSettingsL( aUpdateData );
+            }
+        }
+
+    EndL();
+
+    RCSELOGSTRING2( "CRCSEProfileRegistry::UpdateL(%d) - OUT", aId );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::GetDefaultProfile
+// Resets a default profile values.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEProfileRegistry::GetDefaultProfile( 
+    CRCSEProfileEntry& aDefaultProfile ) const
+    {
+    aDefaultProfile.ResetDefaultValues();
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::GetAllIdsL
+// Gets all profile identifiers.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEProfileRegistry::GetAllIdsL( RArray<TUint32>& aAllIds )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::GetAllIdsL() - IN" );
+
+    BeginL();
+
+    FindAllIdsL( aAllIds );
+    
+    EndL();
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::GetAllIdsL() - OUT" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::FindByServiceIdL
+// Gets all profiles matching to service ID.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEProfileRegistry::FindByServiceIdL( TUint32 aServiceId, 
+    RPointerArray<CRCSEProfileEntry>& aFoundEntries )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::FindByServiceIdL() - IN" );
+
+    CleanupResetAndDestroyPushL( aFoundEntries );
+    
+    BeginL();
+
+    TBuf<KDesLength128> des;
+
+    RArray<TUint32> entryIds;
+    CleanupClosePushL( entryIds );
+
+    // Search IDs of entries that have this service ID
+    FindIdsByValueL( KColServiceProviderId,
+                     ToDes( aServiceId, des ), 
+                     entryIds );
+
+    const TInt count( entryIds.Count() );
+    RCSELOGSTRING2( " - Entries found: %d", count );
+
+    // Search entries using found IDs
+    for ( TInt i( 0 ); i < count; i++ )
+        {
+        CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();
+        TRAPD( e, FindEntryL( entryIds[ i ], *entry ) );
+
+        if ( KErrNone == e )
+            {
+            aFoundEntries.AppendL( entry );
+            CleanupStack::Pop( entry );
+            }
+        else
+            {
+            CleanupStack::PopAndDestroy( entry );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &entryIds );
+
+    // Update SIP profile links
+    const TInt entryCount( aFoundEntries.Count() );
+    for ( TInt k( 0 ); k < entryCount; ++k )
+        {
+        UpdateSIPProfileLinksL( *aFoundEntries[k] );
+        }
+
+    EndL();
+    
+    CleanupStack::Pop( &aFoundEntries );
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::FindByServiceIdL() - OUT" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::FindBySIPSprofileIdL
+// Gets all profiles based on SIP profile ID.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSEProfileRegistry::FindBySIPProfileIdL( TUint32 aSipProfileId, 
+    RPointerArray<CRCSEProfileEntry>& aFoundEntries )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::FindBySIPProfileIdL() - IN" );
+    
+    CleanupResetAndDestroyPushL( aFoundEntries );
+
+    BeginL();
+
+    // Find all profile IDs
+    RArray<TUint32> voipIds;
+    CleanupClosePushL( voipIds );
+    FindAllIdsL( voipIds );
+
+    // Check protocol ids (iIds) from each found profile ID.
+    // Leave only those profile IDs where match found.
+    CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
+    TInt count( voipIds.Count() );
+
+    RArray<TSettingIds> prIds;
+    CleanupClosePushL( prIds );
+
+    for ( TInt i( 0 ); i < count; i++ )
+        {
+        iCenRepDb->FindPropertyL( voipIds[ i ], KColProtocolIds, *property );
+        
+        const TDesC& value = property->GetDesValue();
+
+        ExtractProtocoIdsL( value, prIds );
+
+        TBool found( EFalse );
+        TInt prIdCount( prIds.Count() );
+        for ( TInt j( 0 ); j < prIdCount && !found; j++ )
+            {
+            if ( prIds[ j ].iProfileType == CRCSEProfileEntry::EProtocolSIP && 
+                 prIds[ j ].iProfileId == aSipProfileId )
+                {
+                found = ETrue;
+                }
+            }
+
+        // Search profile if match found
+        if ( found )
+            {
+            CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();
+            TRAPD( e, FindEntryL( voipIds[ i ], *entry ) );
+
+            if ( KErrNone == e )
+                {
+                aFoundEntries.AppendL( entry );
+                CleanupStack::Pop( entry );
+                }
+            else
+                {
+                CleanupStack::PopAndDestroy( entry );
+                }
+            }
+        }
+
+
+    CleanupStack::PopAndDestroy( &prIds );
+    CleanupStack::PopAndDestroy( property );
+
+
+    // Update SIP profile links
+    TInt entryCount( aFoundEntries.Count() );
+    for ( TInt k( 0 ); k < entryCount; ++k )
+        {
+        UpdateSIPProfileLinksL( *aFoundEntries[k] );
+        }
+
+    CleanupStack::PopAndDestroy( &voipIds );
+    EndL();
+    
+    CleanupStack::Pop( &aFoundEntries );
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::FindBySIPProfileIdL() - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CRCSEProfileRegistry::AddL
+// Add bunch of entries to store
+// ---------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::AddL( 
+    RPointerArray<CRCSEProfileEntry>& aEntries )
+    {
+    RCSELOGSTRING2( 
+        "CRCSEProfileRegistry::AddL( %d entries) - IN", aEntries.Count() );
+
+    BeginL();
+
+    TInt count( aEntries.Count() );
+
+    for ( TInt i( 0 ); i < count; ++i )
+        {
+        // Create service settings if service ID is not available for entry
+        if (  KRCSEDefServiceProviderId == aEntries[ i ]->iServiceProviderId )
+            {
+            CreateDefaultServiceSettingsL( *aEntries[ i ] );
+            }
+
+        TUint32 id( KNoEntryId );
+        AddOrUpdateEntryL( id, *aEntries[ i ] );
+        aEntries[ i ]->iId = id;
+        }
+        
+
+    EndL();
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::AddL(entries) - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::FindEntryL
+// Do actual search of profile entry
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::FindEntryL( 
+    TUint32 aProfileId, 
+    CRCSEProfileEntry& aFoundEntry )
+    {
+    RCSELOGSTRING2( "CRCSEProfileRegistry::FindEntryL(id=%d) - IN", aProfileId );
+
+    RIpAppPropArray properties;
+	TCleanupItem cleanup( CRCSERegistryBase::CleanupDbPropArray, &properties );
+	CleanupStack::PushL( cleanup );
+
+    User::LeaveIfError( iCenRepDb->FindEntryL( aProfileId, properties ) );
+    ConvertPropertiesToEntryL( aFoundEntry, properties );
+    aFoundEntry.iId = aProfileId;
+    
+    CleanupStack::PopAndDestroy( &properties );
+
+    RCSELOGSTRING2( "CRCSEProfileRegistry::FindEntryL(id=%d) - OUT", aProfileId );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::AddOrUpdateEntryL
+// Adds new entry or updates values of existing enry
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::AddOrUpdateEntryL( 
+    TUint32& aId, 
+    const CRCSEProfileEntry& aEntry )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::AddOrUpdateEntryL() - IN" );
+
+    TInt id( aId );
+
+    RIpAppPropArray properties;
+	TCleanupItem cleanup( CRCSERegistryBase::CleanupDbPropArray, &properties );
+	CleanupStack::PushL( cleanup );
+
+    ConvertEntryToPropertiesL( aEntry, properties );
+
+    if ( KNoEntryId == id ) // Add new one
+        {
+        RCSELOGSTRING( "-- Add --" );
+        iCenRepDb->AddEntryL( id, properties );
+        }
+    else                    // Update existing entry
+        {
+        RCSELOGSTRING( "-- Update --" );
+        User::LeaveIfError( iCenRepDb->UpdateEntryL( id, properties ) );
+        }
+
+    aId = id;
+
+    CleanupStack::PopAndDestroy( &properties );
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::AddOrUpdateEntryL() - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::ConvertPropertiesToEntryL( 
+    CRCSEProfileEntry& aEntry,
+    RIpAppPropArray& aProperties )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::ConvertPropertiesToEntryL() - IN" );
+
+    aEntry.ResetDefaultValues();
+
+    TBuf<KDesLength256> value;
+
+    GetPropertyValueL( KColProviderName, aEntry.iProviderName, aProperties );
+
+    GetPropertyValueL( KColSettingsName, aEntry.iSettingsName, aProperties );
+
+    GetPropertyValueL( KColPreferredCodecs, value, aProperties );
+
+    TLex lex2( value );
+    while( !lex2.Eos() )
+        {
+        // Extract the number as unsigned int 32, which can be 
+        // converted to value wanted (template)
+        TUint32 num;
+        lex2.Val( num, EDecimal );
+        aEntry.iPreferredCodecs.AppendL( static_cast<TUint32>( num ) );
+        // Skip characters to space char.
+        lex2.SkipCharacters();
+        if ( !lex2.Eos() ) // Check that End of string is not next char.
+            {
+            // Go over the space character.
+            lex2.Inc( 1 );
+            }
+        }
+
+    GetPropertyValueL( KColStartMediaPort, value, aProperties );
+    aEntry.iStartMediaPort = ToTInt32L( value );
+
+    GetPropertyValueL( KColEndMediaPort, value, aProperties );
+    aEntry.iEndMediaPort = ToTInt32L( value );
+
+    GetPropertyValueL( KColSiqnalingQOS, value, aProperties );
+    aEntry.iSiqnalingQOS = ToTInt32L( value );
+
+    GetPropertyValueL( KColMediaQOS, value, aProperties );
+    aEntry.iMediaQOS = ToTInt32L( value );
+
+    GetPropertyValueL( KColInbandDtmf, value, aProperties );
+    aEntry.iInbandDTMF = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColOutbandDtmf, value, aProperties );
+    aEntry.iOutbandDTMF = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColHoldRingBack, value, aProperties );
+    aEntry.iHoldRingBack = ToTInt32L( value );
+
+    GetPropertyValueL( KColAutoComplete, value, aProperties );
+    aEntry.iAutoComplete = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColCFNoAnswer, value, aProperties );
+    aEntry.iCFNoAnswer = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColCFBusy, value, aProperties );
+    aEntry.iCFBusy = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColCFUnconditional, value, aProperties );
+    aEntry.iCFUnconditional = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColRedundancy, value, aProperties );
+    aEntry.iRedundancy = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColProtocolIds, value, aProperties );
+    ExtractProtocoIdsL( value, aEntry.iIds );
+
+    GetPropertyValueL( KColSecureCallPreference, value, aProperties );
+    aEntry.iSecureCallPreference = ToTUint32L( value );
+
+    GetPropertyValueL( KColVoIPProfileLock, value, aProperties );
+    aEntry.iVoIPProfileLock = ToTUint32L( value );
+
+    GetPropertyValueL( KColAdhocAllowed, value, aProperties );
+    aEntry.iAdhocAllowed = ToTUint32L( value );
+
+    GetPropertyValueL( KColSIPServerType, value, aProperties );
+    aEntry.iSIPServerType.Copy( value );
+
+    GetPropertyValueL( KColSBCType, value, aProperties );
+    aEntry.iSBCType.Copy( value );;
+
+    GetPropertyValueL( KColSTUNServerType, value, aProperties );
+    aEntry.iSTUNServerType.Copy( value );
+
+    GetPropertyValueL( KColWLANAPType, value, aProperties );
+    aEntry.iWLANAPType.Copy( value );
+
+    GetPropertyValueL( KColPSTNGatewayType, value, aProperties );
+    aEntry.iPSTNGatewayType.Copy( value );
+
+    GetPropertyValueL( KColSecurityGatewayType, value, aProperties );
+    aEntry.iSecurityGatewayType.Copy( value );
+
+    GetPropertyValueL( KColRTCP, value, aProperties );
+    aEntry.iRTCP = ToTUint32L( value );
+
+    GetPropertyValueL( KColSIPVoIPUAHTerminalType, value, aProperties );
+    aEntry.iSIPVoIPUAHTerminalType = ToTUint32L( value );
+
+    GetPropertyValueL( KColSIPVoIPUAHeaderWLANMAC, value, aProperties );
+    aEntry.iSIPVoIPUAHeaderWLANMAC = ToTUint32L( value );
+
+    GetPropertyValueL( KColSIPVoIPUAHeaderString, value, aProperties );
+    aEntry.iSIPVoIPUAHeaderString.Copy( value );
+
+    GetPropertyValueL( KColProfileLockedToIAP, value, aProperties );
+    aEntry.iProfileLockedToIAP = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColVoIPPluginUID, value, aProperties );
+    aEntry.iVoIPPluginUID = ToTInt32L( value );
+
+    GetPropertyValueL( KColAllowVoIPoverWCDMA, value, aProperties );
+    aEntry.iAllowVoIPoverWCDMA = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColAllowVoIPoverBT, value, aProperties );
+    aEntry.iAllowVoIPoverBT = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColMeanCountOfVoIPDigits, value, aProperties );
+    aEntry.iMeanCountOfVoIPDigits = ToTInt32L( value );
+
+    GetPropertyValueL( KColIgnoreAddrDomainPart, value, aProperties );
+    aEntry.iIgnoreAddrDomainPart = ToTInt32L( value );
+
+    GetPropertyValueL( KColHandoverDialect, value, aProperties );
+    aEntry.iHandoverDialect = ToTInt32L( value );
+
+    GetPropertyValueL( KColPSTelephonyHOPreference, value, aProperties );
+    aEntry.iPSTelephonyHOPreference = ToTInt32L( value );
+
+    GetPropertyValueL( KColHOThresholdValueLL, value, aProperties );
+    aEntry.iHOThresholdValueLL = ToTInt32L( value );
+
+    GetPropertyValueL( KColHOThresholdValueHL, value, aProperties );
+    aEntry.iHOThresholdValueHL = ToTInt32L( value );
+
+    GetPropertyValueL( KColNumberOfMeasurementsAbove, value, aProperties );
+    aEntry.iNumberOfMeasurementsAbove = ToTInt32L( value );
+
+    GetPropertyValueL( KColNumberOfMeasurementsBelow, value, aProperties );
+    aEntry.iNumberOfMeasurementsBelow = ToTInt32L( value );
+
+    GetPropertyValueL( KColSmartScannInterParaHigh, value, aProperties );
+    aEntry.iSmartScannInterParaHigh = ToTInt32L( value );
+
+    GetPropertyValueL( KColSmartScannInterParaMedium, value, aProperties );
+    aEntry.iSmartScannInterParaMedium = ToTInt32L( value );
+
+    GetPropertyValueL( KColSmartScannInterParaLow, value, aProperties );
+    aEntry.iSmartScannInterParaLow = ToTInt32L( value );
+
+    GetPropertyValueL( KColSmartScannInterParaStatic, value, aProperties );
+    aEntry.iSmartScannInterParaStatic = ToTInt32L( value );
+
+    GetPropertyValueL( KColSmartScannDurationHighMode, value, aProperties );
+    aEntry.iSmartScannDurationHighMode = ToTInt32L( value );
+
+    GetPropertyValueL( KColSmartScannDurationMediumMode, value, aProperties );
+    aEntry.iSmartScannDurationMediumMode = ToTInt32L( value );
+
+    GetPropertyValueL( KColSmartScannDurationLowMode, value, aProperties );
+    aEntry.iSmartScannDurationLowMode = ToTInt32L( value );
+
+    GetPropertyValueL( KColHandoffNumber, value, aProperties );
+    aEntry.iHandoffNumber = ToTInt32L( value );
+
+    GetPropertyValueL( KColHandbackNumber, value, aProperties );
+    aEntry.iHandbackNumber = ToTInt32L( value );
+
+    GetPropertyValueL( KColHysterisisTimer, value, aProperties );
+    aEntry.iHysterisisTimer = ToTInt32L( value );
+
+    GetPropertyValueL( KColHandOffProcessTimer, value, aProperties );
+    aEntry.iHandOffProcessTimer = ToTInt32L( value );
+
+    GetPropertyValueL( KColDisconnectProcessTimer, value, aProperties );
+    aEntry.iDisconnectProcessTimer = ToTInt32L( value );
+
+    GetPropertyValueL( KColHandoffPrefix, value, aProperties );
+    aEntry.iHandoffPrefix.Copy( value );
+
+    GetPropertyValueL( KColHandbackPrefix, value, aProperties );
+    aEntry.iHandbackPrefix.Copy( value );
+
+    GetPropertyValueL( KColHandoverTones, value, aProperties );
+    aEntry.iHandoverTones = ToTInt32L( value );
+
+    GetPropertyValueL( KColSupportSMSoverWLAN, value, aProperties );
+    aEntry.iSupportSMSoverWLAN = ToTInt32L( value );
+
+    GetPropertyValueL( KColServiceProviderId, value, aProperties );
+    aEntry.iServiceProviderId = ToTUint32L( value );
+
+    GetPropertyValueL( KColUserPhoneUriParam, value, aProperties );
+    aEntry.iUserPhoneUriParameter = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColSIPConnTestAddress, value, aProperties );
+    aEntry.iSIPConnTestAddress.Copy( value );
+
+    GetPropertyValueL( KColNATSettingsStorageId, value, aProperties );
+    aEntry.iNATSettingsStorageId = ToTUint32L( value );
+
+    GetPropertyValueL( KColSIPMinSE, value, aProperties );
+    aEntry.iSIPMinSE = ToTInt32L( value );
+
+    GetPropertyValueL( KColSIPSessionExpires, value, aProperties );
+    aEntry.iSIPSessionExpires = ToTInt32L( value );
+
+    GetPropertyValueL( KColNATProtocol, value, aProperties );
+    aEntry.iNATProtocol = ToTInt32L( value );
+
+    GetPropertyValueL( KColNewServiceTable, value, aProperties );
+    aEntry.iNewServiceTableEntry = static_cast<CRCSEProfileEntry::TOnOff>( ToTInt32L( value ) );
+
+    GetPropertyValueL( KColSNAPId, value, aProperties );
+    aEntry.iSNAPId = ToTUint32L( value );
+    
+    GetPropertyValueL( KColCreationUrl, value, aProperties );
+    aEntry.iAccountCreationUrl.Copy( value );
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::ConvertPropertiesToEntryL() - OUT" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::ConvertEntryToPropertiesL( 
+    const CRCSEProfileEntry& aEntry,
+    RIpAppPropArray& aProperties )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::ConvertEntryToPropertiesL() - IN" );
+
+    // Descriptor for value conversion
+    TBuf<KDesLength128> des;
+
+    CreatePropertyL( KColProviderName,
+                     aEntry.iProviderName,
+                     aProperties );
+
+    CreatePropertyL( KColSettingsName, 
+                     aEntry.iSettingsName,
+                     aProperties );
+
+    TInt count = aEntry.iPreferredCodecs.Count();
+    des.Zero();
+    for ( TInt j( 0 ); j < count; j++ )
+        {
+        des.AppendNum( static_cast<TUint32>( aEntry.iPreferredCodecs[j] ) );
+        if ( j < count - 1 )
+            {
+            des.Append( KSpace );
+            }
+        }
+
+    CreatePropertyL( KColPreferredCodecs, 
+                     des,
+                     aProperties );
+
+    CreatePropertyL( KColStartMediaPort, 
+                     ToDes( aEntry.iStartMediaPort, des ),
+                     aProperties );
+
+    CreatePropertyL( KColEndMediaPort, 
+                     ToDes( aEntry.iEndMediaPort, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSiqnalingQOS, 
+                     ToDes( aEntry.iSiqnalingQOS, des ),
+                     aProperties );
+
+    CreatePropertyL(  KColMediaQOS, 
+                     ToDes( aEntry.iMediaQOS, des ),
+                     aProperties );
+
+    TInt32 inbandDTMF( aEntry.iInbandDTMF ); // TOnOff
+    CreatePropertyL( KColInbandDtmf, 
+                     ToDes( inbandDTMF, des ),
+                     aProperties );
+
+    TInt32 outbandDTMF( aEntry.iOutbandDTMF ); // TOnOff
+    CreatePropertyL( KColOutbandDtmf, 
+                     ToDes( outbandDTMF, des ),
+                     aProperties );
+
+    TInt32 holdRingBack( aEntry.iHoldRingBack ); // TOnOff
+    CreatePropertyL( KColHoldRingBack, 
+                     ToDes( holdRingBack, des ),
+                     aProperties );
+
+    TInt32 autoComplete = aEntry.iAutoComplete; // TOnOff
+    CreatePropertyL( KColAutoComplete, 
+                     ToDes( autoComplete, des ),
+                     aProperties );
+
+    TInt32 cfNoAnswer( aEntry.iCFNoAnswer ); // TOnOff
+    CreatePropertyL( KColCFNoAnswer, 
+                     ToDes( cfNoAnswer,  des ),
+                     aProperties );
+
+    TInt32 cfBusy( aEntry.iCFBusy ); // TOnOff
+    CreatePropertyL( KColCFBusy, 
+                     ToDes( cfBusy, des ),
+                     aProperties );
+
+    TInt32 cfUnconditional( aEntry.iCFUnconditional ); // TOnOff
+    CreatePropertyL( KColCFUnconditional, 
+                     ToDes( cfUnconditional, des ),
+                     aProperties );
+
+    TInt32 redundancy( aEntry.iRedundancy ); // TOnOff
+    CreatePropertyL( KColRedundancy, 
+                     ToDes( redundancy, des ),
+                     aProperties );
+
+    des.Zero();
+    TBuf<KDesLength15> intDes; // for SIP profile ID
+    count = aEntry.iIds.Count();
+
+    if ( count )
+        {
+        for( TInt i = 0; i < count; i++ )
+            {
+            intDes.Zero();
+
+            TInt profileType = aEntry.iIds[i].iProfileType;
+            intDes.Num( profileType );
+            des.Append( intDes );
+            des.Append( KSpace );
+
+            TInt profileId = aEntry.iIds[i].iProfileId;
+            intDes.Num( profileId );
+            des.Append( intDes );
+            des.Append( KSpace );
+
+            TInt profileSpecificId = aEntry.iIds[i].iProfileSpecificSettingId;
+            intDes.Num( profileSpecificId );
+            des.Append( intDes );
+            des.Append( KSpace );
+            }
+        }
+
+    CreatePropertyL( KColProtocolIds, 
+                     des,
+                     aProperties );
+
+    CreatePropertyL( KColSecureCallPreference, 
+                     ToDes( aEntry.iSecureCallPreference, des ),
+                     aProperties );
+
+    CreatePropertyL( KColVoIPProfileLock, 
+                     ToDes( aEntry.iVoIPProfileLock, des ),
+                     aProperties );
+
+    CreatePropertyL( KColAdhocAllowed, 
+                     ToDes( aEntry.iAdhocAllowed, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSIPServerType, 
+                     aEntry.iSIPServerType,
+                     aProperties );
+
+    CreatePropertyL( KColSBCType, 
+                     aEntry.iSBCType,
+                     aProperties );
+
+    CreatePropertyL( KColSTUNServerType, 
+                     aEntry.iSTUNServerType,
+                     aProperties );
+
+    CreatePropertyL( KColWLANAPType, 
+                     aEntry.iWLANAPType,
+                     aProperties );
+
+    CreatePropertyL( KColPSTNGatewayType, 
+                     aEntry.iPSTNGatewayType,
+                     aProperties );
+
+    CreatePropertyL( KColSecurityGatewayType, 
+                     aEntry.iSecurityGatewayType,
+                     aProperties );
+  
+    CreatePropertyL( KColRTCP, 
+                     ToDes( aEntry.iRTCP, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSIPVoIPUAHTerminalType, 
+                     ToDes( aEntry.iSIPVoIPUAHTerminalType, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSIPVoIPUAHeaderWLANMAC, 
+                     ToDes( aEntry.iSIPVoIPUAHeaderWLANMAC, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSIPVoIPUAHeaderString, 
+                     aEntry.iSIPVoIPUAHeaderString,
+                     aProperties );
+
+    TInt32 profileLockedToIAP( aEntry.iProfileLockedToIAP ); // TOnOff
+    CreatePropertyL( KColProfileLockedToIAP, 
+                     ToDes( profileLockedToIAP, des ),
+                     aProperties );
+
+    CreatePropertyL( KColVoIPPluginUID, 
+                     ToDes( aEntry.iVoIPPluginUID, des ),
+                     aProperties );
+
+    TInt32 allowVoIPoverWCDMA( aEntry.iAllowVoIPoverWCDMA ); // TOnOff
+    CreatePropertyL( KColAllowVoIPoverWCDMA, 
+                     ToDes( allowVoIPoverWCDMA, des ),
+                     aProperties );
+
+    TInt32 allowVoIPoverBT( aEntry.iAllowVoIPoverBT ); // TOnOff
+    CreatePropertyL( KColAllowVoIPoverBT, 
+                     ToDes( allowVoIPoverBT, des ),
+                     aProperties );
+
+    CreatePropertyL( KColMeanCountOfVoIPDigits,
+                     ToDes( aEntry.iMeanCountOfVoIPDigits, des ),
+                     aProperties );
+
+    CreatePropertyL( KColIgnoreAddrDomainPart, 
+                     ToDes( aEntry.iIgnoreAddrDomainPart, des ),
+                     aProperties );
+
+    CreatePropertyL( KColHandoverDialect, 
+                     ToDes( aEntry.iHandoverDialect, des ),
+                     aProperties );
+
+    CreatePropertyL( KColPSTelephonyHOPreference, 
+                     ToDes( aEntry.iPSTelephonyHOPreference, des ),
+                     aProperties );
+
+    CreatePropertyL( KColHOThresholdValueLL, 
+                     ToDes( aEntry.iHOThresholdValueLL, des ),
+                     aProperties );
+
+    CreatePropertyL( KColHOThresholdValueHL, 
+                     ToDes( aEntry.iHOThresholdValueHL, des ),
+                     aProperties );
+
+    CreatePropertyL( KColNumberOfMeasurementsAbove, 
+                     ToDes( aEntry.iNumberOfMeasurementsAbove, des ),
+                     aProperties );
+
+    CreatePropertyL( KColNumberOfMeasurementsBelow, 
+                     ToDes( aEntry.iNumberOfMeasurementsBelow, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSmartScannInterParaHigh, 
+                     ToDes( aEntry.iSmartScannInterParaHigh, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSmartScannInterParaMedium, 
+                     ToDes(  aEntry.iSmartScannInterParaMedium, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSmartScannInterParaLow, 
+                     ToDes( aEntry.iSmartScannInterParaLow, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSmartScannInterParaStatic, 
+                     ToDes( aEntry.iSmartScannInterParaStatic, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSmartScannDurationHighMode, 
+                     ToDes( aEntry.iSmartScannDurationHighMode, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSmartScannDurationMediumMode, 
+                     ToDes( aEntry.iSmartScannDurationMediumMode, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSmartScannDurationLowMode, 
+                     ToDes( aEntry.iSmartScannDurationLowMode, des ),
+                     aProperties );
+
+    CreatePropertyL( KColHandoffNumber, 
+                     ToDes( aEntry.iHandoffNumber, des ),
+                     aProperties );
+
+    CreatePropertyL( KColHandbackNumber, 
+                     ToDes( aEntry.iHandbackNumber, des ),
+                     aProperties );
+
+    CreatePropertyL( KColHysterisisTimer, 
+                     ToDes( aEntry.iHysterisisTimer, des ),
+                     aProperties );
+
+    CreatePropertyL( KColHandOffProcessTimer, 
+                     ToDes( aEntry.iHandOffProcessTimer, des ),
+                     aProperties );
+
+    CreatePropertyL( KColDisconnectProcessTimer, 
+                     ToDes( aEntry.iDisconnectProcessTimer, des ),
+                     aProperties );
+
+    CreatePropertyL( KColHandoffPrefix, 
+                     aEntry.iHandoffPrefix,
+                     aProperties );
+
+    CreatePropertyL( KColHandbackPrefix, 
+                     aEntry.iHandbackPrefix,
+                     aProperties );
+
+    CreatePropertyL( KColHandoverTones, 
+                     ToDes( aEntry.iHandoverTones, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSupportSMSoverWLAN, 
+                     ToDes( aEntry.iSupportSMSoverWLAN, des ),
+                     aProperties );
+
+    CreatePropertyL( KColServiceProviderId, 
+                     ToDes( aEntry.iServiceProviderId, des ),
+                     aProperties );
+
+    TInt32 userPhoneUriParameter( aEntry.iUserPhoneUriParameter ); // TOnOff
+    CreatePropertyL( KColUserPhoneUriParam, 
+                     ToDes( userPhoneUriParameter, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSIPConnTestAddress, 
+                     aEntry.iSIPConnTestAddress,
+                     aProperties );
+
+    CreatePropertyL( KColNATSettingsStorageId, 
+                     ToDes( aEntry.iNATSettingsStorageId, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSIPMinSE, 
+                     ToDes( aEntry.iSIPMinSE, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSIPSessionExpires, 
+                     ToDes( aEntry.iSIPSessionExpires, des ),
+                     aProperties );
+
+    CreatePropertyL( KColNATProtocol, 
+                     ToDes( aEntry.iNATProtocol, des ),
+                     aProperties );
+
+    TInt32 newServiceTable( aEntry.iNewServiceTableEntry ); // TOnOff
+    CreatePropertyL( KColNewServiceTable, 
+                     ToDes( newServiceTable, des ),
+                     aProperties );
+
+    CreatePropertyL( KColSNAPId, 
+                     ToDes( aEntry.iSNAPId, des ),
+                     aProperties );
+
+    CreatePropertyL( KColCreationUrl, 
+                     aEntry.iAccountCreationUrl,
+                     aProperties );
+    
+    RCSELOGSTRING( "CRCSEProfileRegistry::ConvertEntryToPropertiesL() - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::ExtractProtocoIdsL( 
+    const TDesC& aDes, RArray<TSettingIds>& aArray )
+    {
+    CleanupClosePushL( aArray );
+    
+    TLex lex( aDes );
+    
+    TSettingIds value;
+    
+    // Reset original array
+    aArray.Reset();
+    
+    while( !lex.Eos() )
+        {
+        lex.Val( value.iProfileType );
+        // Skip characters to space char.
+        lex.SkipCharacters();
+        lex.Inc( 1 );
+        lex.Val( value.iProfileId );
+        lex.SkipCharacters();
+        lex.Inc( 1 );
+        lex.Val( value.iProfileSpecificSettingId );
+        
+        aArray.AppendL( value );
+        if ( !lex.Eos() ) // Check that End of string is not next char.
+            {
+            // Go over the space character.
+            lex.Inc( 1 );
+            }
+        }
+    
+    CleanupStack::Pop( &aArray );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::UpdateSIPProfileLinksL
+// Validates profile's SIP profile IDs and updates if necessary
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::UpdateSIPProfileLinksL( CRCSEProfileEntry& aEntry )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::UpdateSIPProfileLinksL - IN" );
+    const TInt count( aEntry.iIds.Count() );
+    TSettingIds value;
+    RCSELOGSTRING2( "Protocol link count=%d", count );
+
+    if ( 0 < count )
+        {
+        iSIPProfiles.ResetAndDestroy();
+
+        TInt err(0);
+        // Check the existence of linked SIP profiles
+        for ( TInt i( count-1 ); 0 <= i ; i-- )
+            {
+            value = aEntry.iIds[i];
+
+            if ( CRCSEProfileEntry::EProtocolSIP == value.iProfileType )
+                {
+                CSIPProfile* profile = NULL;
+                TRAP( err, profile = iSIPRegistry->ProfileL( value.iProfileId ) );
+                if ( KErrNotFound == err )
+                    {
+                    aEntry.iIds.Remove( i );
+                    delete profile;
+                    profile = NULL;
+                    RCSELOGSTRING2( "SIP link removed, id=%d", value.iProfileId );
+                    }
+                else if ( KErrNone == err )
+                    {
+                    err = iSIPProfiles.Append( profile );
+                    }
+                else
+                    {
+                    delete profile;
+                    profile = NULL;
+                    }
+                }
+            }
+
+        // Check that all profiles have same AOR.
+        // If some AOR differs leave only the first link
+        TInt profCount( iSIPProfiles.Count() );
+        RCSELOGSTRING2( "SIP link count=%d", profCount );
+        TBool ok( ETrue );
+        if ( 1 < profCount )
+            {
+            const TDesC8* aor1;
+            HBufC8* empty = KNullDesC8().AllocLC();
+            err = iSIPProfiles[0]->GetParameter( KSIPUserAor, aor1 );
+
+            if ( KErrNotFound == err )
+                {
+                aor1 = empty;
+                }
+
+            for ( TInt j( 1 ); j < profCount; j++ )
+                {
+                const TDesC8* aor2;
+                err = iSIPProfiles[j]->GetParameter( KSIPUserAor, aor2 );
+
+                if ( KErrNotFound == err )
+                    {
+                    if ( aor1->Compare( KNullDesC8() ) != 0 )
+                        {
+                        ok = EFalse;
+                        }
+                    }
+                else
+                    { 
+                    if ( aor1->Compare( *aor2 ) != 0 )
+                        {
+                        ok = EFalse;
+                        }
+                    }
+                }
+            CleanupStack::PopAndDestroy( empty );
+
+            if ( !ok )
+                {
+                RCSELOGSTRING( "AOR changed" );
+                TInt newCount = aEntry.iIds.Count();
+                TBool first( ETrue );
+                for ( TInt k( 0 ); k < newCount; k++ )
+                    {
+                    value = aEntry.iIds[k];
+                    if ( CRCSEProfileEntry::EProtocolSIP == value.iProfileType )
+                        {
+                        if ( first )
+                            {
+                            first = EFalse;
+                            RCSELOGSTRING2( "Leave SIP link, index=%d", k );
+                            }
+                        else
+                            {
+                            aEntry.iIds.Remove( k );
+                            newCount--;
+                            k--;
+                            RCSELOGSTRING2( "Remove SIP link, index=%d", k );
+                            }
+                        }
+                    }
+                }
+            }
+
+        iSIPProfiles.ResetAndDestroy();
+
+        // Update entry if count of ids have changed
+        if ( count != aEntry.iIds.Count() )
+            {
+            RCSELOGSTRING3( "Link ID count: initial=%d, final=%d",
+                             count, aEntry.iIds.Count() );
+
+            AddOrUpdateEntryL( aEntry.iId, aEntry );
+
+            RCSELOGSTRING( "Entry updated" );
+            }
+        }
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::UpdateSIPProfileLinksL - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// Local helper method for searching default values of properties from service
+// table and adding them to given service entry.
+// -----------------------------------------------------------------------------
+//
+void FindAndAddDefaultPropertyL( 
+    CSPSettings& aTable, 
+    CSPEntry& aEntry, 
+    CSPProperty& aProperty, 
+    TServicePropertyName aName  )
+    {
+    TInt err = aTable.FindPropertyL( KDefaultVoIPService, aName, aProperty );
+
+    if ( KErrNone == err )
+        {
+        err = aEntry.AddPropertyL( aProperty );
+        if ( KErrNone != err )
+            {
+            RCSELOGSTRING2(
+                "CRCSEProfileRegistry::FindAndAddDefaultPropertyL - add property err: %d",
+                err );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::CreateDefaultServiceSettingsL
+// Creates a voip-sip service entry with default content and return
+// service ID for new profile
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::CreateDefaultServiceSettingsL( 
+    CRCSEProfileEntry& aNewEntry )
+    {
+    RCSELOGSTRING( 
+        "CRCSEProfileRegistry::CreateDefaultServiceSettingsL - IN" );
+
+    // Do not create service if there is no SIP linkage.
+    if ( !aNewEntry.iIds.Count() )
+        {
+        return;
+        }
+    else if ( aNewEntry.iIds[0].iProfileType != 
+        CRCSEProfileEntry::EProtocolSIP )
+        {
+        return;
+        }
+    
+    TInt err( KErrNone );
+
+    // Service table API
+    CSPSettings* table = CSPSettings::NewLC();
+
+    // New service entry for this provider name
+    CSPEntry* entry = CSPEntry::NewLC();
+    entry->SetServiceName( aNewEntry.iProviderName );
+
+    CSPProperty* property = CSPProperty::NewLC();
+
+    // Service Setup plug-in UID ( if VoIP plugin UID set )
+    if ( KRCSEDefaultVoIPPluginUID != aNewEntry.iVoIPPluginUID )
+        {
+        property->SetName( EPropertyServiceSetupPluginId );
+        property->SetValue( aNewEntry.iVoIPPluginUID );
+        err = entry->AddPropertyL( *property );
+        if ( KErrAlreadyExists == err )
+            {
+            User::LeaveIfError(
+                    entry->UpdateProperty( EPropertyServiceSetupPluginId,
+                                           aNewEntry.iVoIPPluginUID ) );
+            }
+        else
+            {
+            User::LeaveIfError( err );
+            }
+        }
+
+    // This property is needed by clients to check if VoIP service is used
+    property->SetName( ESubPropertyVoIPSettingsId );
+    property->SetValue( KVoIPSettingsID );
+    err = entry->AddPropertyL( *property );
+    if ( KErrAlreadyExists == err )
+        {
+        User::LeaveIfError( entry->UpdateProperty( ESubPropertyVoIPSettingsId,
+                                                   KVoIPSettingsID ) );
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        }
+    
+    // Service Attribute Mask
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyServiceAttributeMask );
+
+    // Phone Application CLI plug-in UID
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyCLIPluginId );
+
+    // Phone Application Call Logging plug-in UID.
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyCallLoggingPluginId );
+
+    // Phone Application Call State Indicator plug-in UID.
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyCallStateIndicatorPluginId );
+
+    // Phone Application Call Menu Handler plug-in UID.
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyCallMenuHandlerPluginId );
+
+    // Converged Call Engine Call Provider plug-in UID.
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyCallProviderPluginId );
+
+    // Virtual Phonebook Contact Store ID.
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyContactStoreId );
+
+    // Contact View plug-in UID
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyContactViewPluginId );
+
+    // Converged Connection Handler (CCH) VoIP Subservice plug-in UID
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyVoIPSubServicePluginId );
+
+    // Converged Connection Handler (CCH) VMBX Subservice plug-in UID
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyVMBXSubServicePluginId );
+
+    // Brand ID for VoIP
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyBrandId );
+
+    // Presence Service Connectivity plugin UID
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyPCSPluginId );
+
+    // Maximum Lenght of Log Contact Link
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, EPropertyLogCntLinkMaxLength );
+
+    // Field Type of Presence Presentity ID
+    FindAndAddDefaultPropertyL( 
+        *table, *entry, *property, ESubPropertyPresencePresentityIDFieldType );
+
+    // Add entry to store and set service ID
+    User::LeaveIfError( table->AddEntryL( *entry ) );
+    aNewEntry.iServiceProviderId 
+        = static_cast<TUint32>( entry->GetServiceId() );
+
+    CleanupStack::PopAndDestroy( property );
+    CleanupStack::PopAndDestroy( entry );
+    CleanupStack::PopAndDestroy( table );
+
+    RCSELOGSTRING( 
+        "CRCSEProfileRegistry::CreateDefaultServiceSettingsL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CRCSEProfileRegistry::DeleteReferenceSettingsL
+// ---------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::DeleteReferenceSettingsL( TUint32 aProfileId )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::DeleteReferenceSettingsL - IN" );
+
+    CRCSEProfileEntry* profileInfo = CRCSEProfileEntry::NewLC();
+
+    TRAPD( e, FindL( aProfileId, *profileInfo ) );
+
+    __ASSERT_ALWAYS( KErrNone == e || KErrNotFound == e, User::Leave( e ) );
+
+    // Delete related audio codecs
+    CRCSEAudioCodecRegistry* codecReg = CRCSEAudioCodecRegistry::NewLC();
+    codecReg->DeleteL( profileInfo->iPreferredCodecs );
+    CleanupStack::PopAndDestroy( codecReg );
+
+    // Delete related service settings
+    if( CRCSEProfileEntry::EOONotSet == profileInfo->iNewServiceTableEntry ||
+        CRCSEProfileEntry::EOn == profileInfo->iNewServiceTableEntry )
+        {
+        RCSELOGSTRING( "Delete related service settings" );
+        CSPSettings* serviceSettings = CSPSettings::NewLC();
+        serviceSettings->DeleteEntryL( profileInfo->iServiceProviderId );
+        CleanupStack::PopAndDestroy( serviceSettings );
+        }
+
+    CleanupStack::PopAndDestroy( profileInfo );
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::DeleteReferenceSettingsL - OUT" );
+    }
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::NameExistsInServiceTableL
+// -----------------------------------------------------------------------------
+//
+TBool CRCSEProfileRegistry::NameExistsInServiceTableL(
+    const TDesC& aProviderName ) const
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::NameExistsInServiceTableL- IN" );
+    TBool result( EFalse );
+    
+    RIdArray serviceIds;
+    CleanupClosePushL( serviceIds );
+    CDesCArray* serviceNames = 
+        new ( ELeave ) CDesCArrayFlat( KArrayInitSize );
+    CleanupStack::PushL( serviceNames );
+    CSPSettings* serviceSettings = CSPSettings::NewLC();
+    TInt err(KErrNone);
+    err = serviceSettings->FindServiceIdsL( serviceIds );
+    if ( KErrNotFound == err )
+        {
+        CleanupStack::PopAndDestroy( serviceSettings );
+        CleanupStack::PopAndDestroy( serviceNames );
+        CleanupStack::PopAndDestroy( &serviceIds );
+        return EFalse; 
+        }
+    User::LeaveIfError( err );
+    User::LeaveIfError( 
+        serviceSettings->FindServiceNamesL( serviceIds, *serviceNames ) );
+    CleanupStack::PopAndDestroy( serviceSettings );
+    TBool serviceFound( EFalse );
+    for ( TInt i( 0 ) ; i < serviceNames->MdcaCount() && !serviceFound ; i++ )
+        {
+        if ( !aProviderName.Compare( serviceNames->MdcaPoint( i) ) )
+            {
+            result = ETrue;
+            serviceFound = ETrue;
+            }
+        }
+    CleanupStack::PopAndDestroy( serviceNames );	
+    CleanupStack::PopAndDestroy( &serviceIds );
+    
+    RCSELOGSTRING( "CRCSEProfileRegistry::NameExistsInServiceTableL- OUT" );
+    return result;
+    }
+    
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::LeaveIfServiceIdInUseL
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::LeaveIfServiceIdInUseL(
+    const CRCSEProfileEntry& aEntry ) 
+    {    
+    RCSELOGSTRING( "CRCSEProfileRegistry::LeaveIfServiceIdInUseL - IN" );
+
+    // Find all profile IDs
+    RArray<TUint32> voipIds;
+    CleanupClosePushL( voipIds );
+    FindAllIdsL( voipIds );
+
+
+    // Check service id from each profile
+    CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
+    TBuf<KDesLength256> value;
+    TInt count( voipIds.Count() );
+
+    for ( TInt i( 0 ); i < count; i++ )
+        {
+        iCenRepDb->FindPropertyL( voipIds[ i ], KColProtocolIds, *property );
+
+        __ASSERT_ALWAYS( 
+            aEntry.iServiceProviderId != ToTUint32L( property->GetDesValue() ),
+                User::Leave( KErrAlreadyExists ) );
+        }
+
+    CleanupStack::PopAndDestroy( property );
+    CleanupStack::PopAndDestroy( &voipIds );
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::LeaveIfServiceIdInUseL - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::UpdateServiceSettingsL
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::UpdateServiceSettingsL(
+    const CRCSEProfileEntry& aEntry ) 
+    {    
+    RCSELOGSTRING( "CRCSEProfileRegistry::UpdateServiceSettingsL - IN" );
+
+    // Do not update service if there is no SIP linkage.
+    if ( !aEntry.iIds.Count() )
+        {
+        return;
+        }
+    else if ( aEntry.iIds[0].iProfileType != 
+        CRCSEProfileEntry::EProtocolSIP )
+        {
+        return;
+        }
+
+    CSPSettings* serviceSettings = CSPSettings::NewLC();
+    CSPEntry* serviceEntry = CSPEntry::NewLC();
+
+    User::LeaveIfError( 
+        serviceSettings->FindEntryL( 
+            aEntry.iServiceProviderId, *serviceEntry ) );
+
+    // Update service settings if service name has been changed
+    if ( aEntry.iProviderName != serviceEntry->GetServiceName() )
+        {
+        serviceEntry->SetServiceName( aEntry.iProviderName );
+        User::LeaveIfError( serviceSettings->UpdateEntryL( *serviceEntry ) );
+        }
+
+    CleanupStack::PopAndDestroy( serviceEntry );
+    CleanupStack::PopAndDestroy( serviceSettings );
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::UpdateServiceSettingsL - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::UpdateServiceIdL
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::UpdateServiceIdL( TUint32 aId, TUint32 aServiceId )
+    {    
+    RCSELOGSTRING( "CRCSEProfileRegistry::UpdateServiceIdL - IN" );
+
+    TBuf<KDesLength128> des;
+
+    RIpAppPropArray properties;
+
+    CreatePropertyL( KColServiceProviderId,
+                     ToDes( aServiceId, des ),
+                     properties );
+
+    iCenRepDb->AddOrUpdatePropertiesL( aId, properties );
+
+    properties.ResetAndDestroy();
+
+    RCSELOGSTRING( "CRCSEProfileRegistry::UpdateServiceIdL - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MSIPProfileRegistryObserver
+// CRCSEProfileRegistry::ProfileRegistryEventOccurred
+// SIP profile event
+// ---------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::ProfileRegistryEventOccurred( 
+    TUint32 /*aSIPProfileId*/,
+    TEvent /*aEvent*/ )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::ProfileRegistryEventOccurred" );
+    // Have to be implemented because MSIPProfileRegistryObserver
+    // is passed to CSIPManagedProfileRegistry.
+    }
+
+// ---------------------------------------------------------------------------
+// From MSIPProfileRegistryObserver
+// CRCSEProfileRegistry::ProfileRegistryErrorOccured
+// An asynchronous error has occurred related to SIP profile
+// ---------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::ProfileRegistryErrorOccurred( 
+    TUint32  /*aProfileId*/,
+    TInt /*aError*/ )
+    {
+    RCSELOGSTRING( "CRCSEProfileRegistry::ProfileRegistryErrorOccurred" );
+    // Have to be implemented because MSIPProfileRegistryObserver
+    // is passed to CSIPManagedProfileRegistry.
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::ResetAndDestroyEntries
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::ResetAndDestroyEntries( TAny* anArray )
+	{
+	RCSELOGSTRING( "CRCSEProfileRegistry::ResetAndDestroyEntries - IN" );
+	
+    RPointerArray<CRCSEProfileEntry>* array = 
+        reinterpret_cast<RPointerArray<CRCSEProfileEntry>*>( anArray );
+    if (array)
+        {
+        array->ResetAndDestroy();
+        array->Close();
+        }
+    RCSELOGSTRING( "CRCSEProfileRegistry::ResetAndDestroyEntries - OUT" );
+	}
+
+// -----------------------------------------------------------------------------
+// CRCSEProfileRegistry::CopyEntryValues
+// -----------------------------------------------------------------------------
+//
+void CRCSEProfileRegistry::CopyEntryValues( 
+    const CRCSEProfileEntry& aSourceEntry, 
+    CRCSEProfileEntry& aDestinationEntry )
+    {
+    aDestinationEntry.ResetDefaultValues();
+    aDestinationEntry.iIds.Reset();
+    for ( TInt i = 0; i < aSourceEntry.iIds.Count(); i++ )
+        {
+        aDestinationEntry.iIds.Append( aSourceEntry.iIds[i] );
+        }
+    aDestinationEntry.iId = aSourceEntry.iId;
+    aDestinationEntry.iProviderName = aSourceEntry.iProviderName;
+    aDestinationEntry.iSettingsName = aSourceEntry.iSettingsName;
+    aDestinationEntry.iPreferredCodecs.Reset();
+    for ( TInt i = 0; i < aSourceEntry.iPreferredCodecs.Count(); i++ )
+        {
+        aDestinationEntry.iPreferredCodecs.Append( 
+            aSourceEntry.iPreferredCodecs[i] );
+        }
+    aDestinationEntry.iStartMediaPort = aSourceEntry.iStartMediaPort;
+    aDestinationEntry.iEndMediaPort = aSourceEntry.iEndMediaPort;
+    aDestinationEntry.iMediaQOS = aSourceEntry.iMediaQOS;
+    aDestinationEntry.iInbandDTMF = aSourceEntry.iInbandDTMF;
+    aDestinationEntry.iOutbandDTMF = aSourceEntry.iOutbandDTMF;
+    aDestinationEntry.iSecureCallPreference = 
+        aSourceEntry.iSecureCallPreference;
+    aDestinationEntry.iRTCP = aSourceEntry.iRTCP;
+    aDestinationEntry.iSIPVoIPUAHTerminalType = 
+        aSourceEntry.iSIPVoIPUAHTerminalType;
+    aDestinationEntry.iSIPVoIPUAHeaderWLANMAC = 
+        aSourceEntry.iSIPVoIPUAHeaderWLANMAC;
+    aDestinationEntry.iSIPVoIPUAHeaderString = 
+        aSourceEntry.iSIPVoIPUAHeaderString;
+    aDestinationEntry.iProfileLockedToIAP = aSourceEntry.iProfileLockedToIAP;
+    aDestinationEntry.iVoIPPluginUID = aSourceEntry.iVoIPPluginUID;
+    aDestinationEntry.iAllowVoIPoverWCDMA = aSourceEntry.iAllowVoIPoverWCDMA;
+    aDestinationEntry.iMeanCountOfVoIPDigits = 
+        aSourceEntry.iMeanCountOfVoIPDigits;
+    aDestinationEntry.iIgnoreAddrDomainPart = 
+        aSourceEntry.iIgnoreAddrDomainPart;
+    aDestinationEntry.iServiceProviderId = aSourceEntry.iServiceProviderId;
+    aDestinationEntry.iUserPhoneUriParameter = 
+        aSourceEntry.iUserPhoneUriParameter;
+    aDestinationEntry.iSIPConnTestAddress = aSourceEntry.iSIPConnTestAddress;
+    aDestinationEntry.iNATSettingsStorageId = 
+        aSourceEntry.iNATSettingsStorageId;
+    aDestinationEntry.iSIPMinSE = aSourceEntry.iSIPMinSE;
+    aDestinationEntry.iSIPSessionExpires = aSourceEntry.iSIPSessionExpires;
+    aDestinationEntry.iNATProtocol = aSourceEntry.iNATProtocol;
+    aDestinationEntry.iNewServiceTableEntry = 
+        aSourceEntry.iNewServiceTableEntry;
+    aDestinationEntry.iSNAPId = aSourceEntry.iSNAPId;
+    aDestinationEntry.iAccountCreationUrl = aSourceEntry.iAccountCreationUrl;
+    }
+
+//  End of File  
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/rcsebackupobserver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 observer class for backup events
+*
+*/
+
+
+#include <connect/sbdefs.h>
+
+#include "rcsebackupobserver.h"
+#include "mrcsebackupobserver.h"
+#include "rcselogger.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CRCSEBackupObserver::CRCSEBackupObserver( MRCSEBackupObserver& aObserver )
+    : CActive( CActive::EPriorityStandard ),
+      iObserver( aObserver )
+    {
+    CActiveScheduler::Add(this);
+    }
+
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CRCSEBackupObserver::ConstructL()
+    {
+    RCSELOGSTRING( "CRCSEBackupObserver::ConstructL() - IN" );
+    User::LeaveIfError( iBackupStatus.Attach( KUidSystemCategory, 
+                                              conn::KUidBackupRestoreKey ) );
+    //iStatus = KRequestPending;
+    iBackupStatus.Subscribe( iStatus );
+    SetActive();
+    RCSELOGSTRING( "CRCSEBackupObserver::ConstructL() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CRCSEBackupObserver* CRCSEBackupObserver::NewL( MRCSEBackupObserver& aObserver )
+    {
+    CRCSEBackupObserver* self = new (ELeave) CRCSEBackupObserver( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CRCSEBackupObserver::~CRCSEBackupObserver()
+    {
+    RCSELOGSTRING( "CRCSEBackupObserver::~CRCSEBackupObserver() - IN" );
+    Cancel();
+    iBackupStatus.Close();
+    RCSELOGSTRING( "CRCSEBackupObserver::~CRCSEBackupObserver() - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// Cancel backup/restore event subscription
+// ---------------------------------------------------------------------------
+//
+void CRCSEBackupObserver::DoCancel()
+    {
+    iBackupStatus.Cancel();
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// Handle backup/restore event
+// ---------------------------------------------------------------------------
+//
+void CRCSEBackupObserver::RunL()
+    {
+    RCSELOGSTRING( "CRCSEBackupObserver::RunL() - IN" );
+    User::LeaveIfError( iStatus.Int() );
+    iBackupStatus.Subscribe( iStatus );
+    SetActive();
+
+    iObserver.HandleBackupOperationEventL();
+    RCSELOGSTRING( "CRCSEBackupObserver::RunL() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Return backup / restore status
+// ---------------------------------------------------------------------------
+//
+TBool CRCSEBackupObserver::IsBackupOperationRunning()
+    {
+    TInt backupRestoreStatus;
+    TInt err = RProperty::Get( KUidSystemCategory, 
+                               conn::KUidBackupRestoreKey,
+                               backupRestoreStatus );
+
+    if ( KErrNone != err )
+        {
+        RCSELOGSTRING( 
+            "CRCSEBackupObserver::IsBackupOperationRunning() - FALSE" );
+        return EFalse;
+        }
+
+    if( backupRestoreStatus == conn::EBURUnset || 
+        backupRestoreStatus & conn::EBURNormal ||
+        (backupRestoreStatus & conn::KBackupIncTypeMask) == conn::ENoBackup)
+        {
+        RCSELOGSTRING( 
+            "CRCSEBackupObserver::IsBackupOperationRunning() - FALSE" );
+        return EFalse;
+        }
+    else
+        {
+        RCSELOGSTRING( "CRCSEBackupObserver::IsBackupOperationRunning() - TRUE" );
+        return ETrue;
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/rcsedbimporter.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,998 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  RCSE Settings Import from DBMS
+*
+*/
+
+
+#include "rcsedbimporter.h"
+#include "rcseconstants.h"
+#include "crcseprofileregistry.h"
+#include "crcseaudiocodecregistry.h"
+#include "rcsedefaultdbnames.h"
+#include "rcselogger.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+CRCSEDbImporter::CRCSEDbImporter()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CRCSEDbImporter::ConstructL()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::ConstructL() - IN" );
+    User::LeaveIfError( iDbSession.Connect() );
+    RCSELOGSTRING( "CRCSEDbImporter::ConstructL() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CRCSEDbImporter* CRCSEDbImporter::NewL()
+    {
+    CRCSEDbImporter* self = CRCSEDbImporter::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CRCSEDbImporter* CRCSEDbImporter::NewLC()
+    {
+    CRCSEDbImporter* self = new( ELeave ) CRCSEDbImporter;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CRCSEDbImporter::~CRCSEDbImporter()
+    {
+    ReleaseImportLock();
+
+    iDb.Close();
+    iDbSession.Close();
+    iProfiles.ResetAndDestroy();
+    iCodecs.ResetAndDestroy();
+    iCodecIds.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Check if imported (restored) database file exists.
+// ---------------------------------------------------------------------------
+//
+TBool CRCSEDbImporter::ImportExists()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::ImportExists() - IN" );
+
+    TBool profileImport( EFalse );
+    TBool codecImport( EFalse );
+
+    RDbs dbSession;
+    RDbNamedDatabase db;
+
+    TInt err( dbSession.Connect() );
+
+    if ( KErrNone != err )
+        {
+        return EFalse;
+        }
+    else
+        {
+        // Check voip profiles
+        err = db.Open( dbSession, KDbName, KDatabaseUID );
+        db.Close();
+
+        if ( KErrNone == err )
+            {
+            profileImport = ETrue;
+            }
+
+        // Check audio codecs
+        err = db.Open( dbSession, KDbCodecName, KDatabaseUID );
+        db.Close();
+
+        if ( KErrNone == err )
+            {
+            codecImport = ETrue;
+            }
+        }
+
+    dbSession.Close();
+
+    RCSELOGSTRING2( "CRCSEDbImporter::ImportExists(%d) - OUT", 
+        profileImport && codecImport );
+
+    // Return ETrue only when both of imports exist
+    return profileImport && codecImport;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Check if import is already running.
+// ---------------------------------------------------------------------------
+//
+TBool CRCSEDbImporter::IsImportRunning()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::IsImportRunning() - IN" );
+
+    TBool ret( EFalse );
+
+    RDbs dbSession;
+    RDbNamedDatabase db;
+
+    TInt err( dbSession.Connect() );
+
+    if ( KErrNone != err )
+        {
+        ret = EFalse;
+        }
+    else
+        {
+        // Check if temporary table exists
+        err = db.Open( dbSession, KDbTempName, KDatabaseUID );
+        db.Close();
+
+        if ( KErrNone == err )
+            {
+            ret = ETrue;
+            }
+        }
+
+    dbSession.Close();
+
+    RCSELOGSTRING2( "CRCSEDbImporter::IsImportRunning(%d) - OUT", ret );
+    
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Imports RCSE entries from db file and stores them to repository.
+// ---------------------------------------------------------------------------
+//
+void CRCSEDbImporter::ImportAndStoreL()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::ImportL() - IN" );
+
+    SetImportLock();
+
+    // Import settings data
+    ImportVoIPProfilesL();
+    ImportAudioCodecsL();
+
+    // Store audio codecs
+    StoreAudioCodecsL();
+
+    // Update and store VoIP profiles
+    UpdatePreferredCodecs();
+    StoreVoIPProfilesL();
+
+    DeleteImports();
+    ReleaseImportLock();
+
+    RCSELOGSTRING( "CRCSEDbImporter::ImportL() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Set locking data base file to prevent disturb during the import operation.
+// ---------------------------------------------------------------------------
+//
+void CRCSEDbImporter::SetImportLock()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::SetImportLock() - IN" );
+
+    // Create temporary db that indicates ongoing operation
+    iDb.Create( iDbSession, KDbTempName, KDatabaseUID );
+    iDb.Close();
+
+    RCSELOGSTRING( "CRCSEDbImporter::SetImportLock() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Release locking data base file.
+// ---------------------------------------------------------------------------
+//
+void CRCSEDbImporter::ReleaseImportLock()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::ReleaseImportLock() - IN" );
+
+    // Delete temporary locking db
+    TInt err( iDb.Open( iDbSession, KDbTempName, KDatabaseUID ) );
+
+    if ( KErrNone == err )
+        {
+        iDb.Destroy();
+        iDb.Close();
+        RCSELOGSTRING( "Temporary db deleted" );
+        }
+    else
+        {
+        RCSELOGSTRING2( "Temporary db not deleted, err=%d", err );
+        }
+
+    RCSELOGSTRING( "CRCSEDbImporter::ReleaseImportLock() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Import VoIP profiles from database to array.
+// ---------------------------------------------------------------------------
+//
+void CRCSEDbImporter::ImportVoIPProfilesL()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::ImportVoIPProfilesL() - IN" );
+    User::LeaveIfError( iDb.Open( iDbSession, KDbName, KDatabaseUID ) );
+
+    // Create sql statement
+    HBufC* statement = HBufC::NewLC(
+        KSQLSelectAllStatement().Length() + 
+        KProfileTableName().Length() );
+
+    statement->Des().Format( 
+        KSQLSelectAllStatement, &KProfileTableName );
+
+    // Launch query
+    RDbView view;
+    User::LeaveIfError( view.Prepare( iDb, *statement ) );
+    CleanupClosePushL( view );
+    User::LeaveIfError( view.EvaluateAll() );
+    view.FirstL();
+
+    // Browse all result rows trough
+    while ( view.AtRow() )
+        {
+        view.GetL(); // Get the data row
+        const TInt cols( view.ColCount() + 1 );
+
+        CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();
+
+        // Map the data from current row to profile entry.
+        for( TInt i = 1; i < cols; i++ )
+            {
+            MapColumnToEntryL( i, view, *entry );
+            }
+
+        iProfiles.AppendL( entry );
+        CleanupStack::Pop( entry );
+        view.NextL();
+        }
+
+    CleanupStack::PopAndDestroy( &view );
+    CleanupStack::PopAndDestroy( statement );
+
+    iDb.Close();
+    RCSELOGSTRING( "CRCSEDbImporter::ImportVoIPProfilesL() - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Import audio codecs from database to array.
+// ---------------------------------------------------------------------------
+//
+void CRCSEDbImporter::ImportAudioCodecsL()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::ImportAudioCodecsL() - IN" );
+
+    User::LeaveIfError( iDb.Open( iDbSession, KDbCodecName, KDatabaseUID ) );
+
+    // Create sql statement
+    HBufC* statement = HBufC::NewLC(
+        KSQLSelectAllStatement().Length() + 
+        KAudioCodecTableName().Length() );
+
+    statement->Des().Format( 
+        KSQLSelectAllStatement, &KAudioCodecTableName );
+
+    // Launch query
+    RDbView view;
+    User::LeaveIfError( view.Prepare( iDb, *statement ) );
+    CleanupClosePushL( view );
+    User::LeaveIfError( view.EvaluateAll() );
+    view.FirstL();
+
+    // Browse all result rows trough
+    while ( view.AtRow() )
+        {
+        view.GetL(); // Get the data row
+        const TInt cols( view.ColCount() + 1 );
+
+        CRCSEAudioCodecEntry* entry = CRCSEAudioCodecEntry::NewLC();
+
+        // Map the data from current row to audio codec entry.
+        for( TInt i = 1; i < cols; i++ )
+            {
+            MapColumnToEntryL( i, view, *entry );
+            }
+
+        // Append entry and its ID
+        iCodecs.AppendL( entry );
+
+        TRCSEIdPair idPair;
+        idPair.iOldId =  entry->iCodecId;
+        iCodecIds.Append( idPair );
+
+        CleanupStack::Pop( entry );
+        view.NextL();
+        }
+
+    CleanupStack::PopAndDestroy( &view );
+    CleanupStack::PopAndDestroy( statement );
+
+    iDb.Close();
+
+    RCSELOGSTRING( "CRCSEDbImporter::ImportAudioCodecsL() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Delete imported (restored) rcse database files.
+// ---------------------------------------------------------------------------
+//
+void CRCSEDbImporter::DeleteImports()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::DeleteImports() - IN" );
+
+    TInt err( 0 );
+
+    // Delete VoIP profile import
+    err = iDb.Open( iDbSession, KDbName, KDatabaseUID );
+
+    if ( KErrNone == err )
+        {
+        iDb.Destroy();
+        iDb.Close();
+        RCSELOGSTRING( "Profile import deleted" );
+        }
+    else
+        {
+        RCSELOGSTRING2( "Profile import not deleted, err=%d", err );
+        }
+
+    // Delete audio codec import
+    err = iDb.Open( iDbSession, KDbCodecName, KDatabaseUID );
+
+    if ( KErrNone == err )
+        {
+        iDb.Destroy();
+        iDb.Close();
+        RCSELOGSTRING( "Codec import deleted" );
+        }
+    else
+        {
+        RCSELOGSTRING2( "Codec import not deleted, err=%d", err );
+        }
+
+    RCSELOGSTRING( "CRCSEDbImporter::DeleteImports() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Map query result from a given column to profile entry.
+// -----------------------------------------------------------------------------
+//
+void CRCSEDbImporter::MapColumnToEntryL( 
+    TInt aColumnIndex, 
+    const RDbView& aView, 
+    CRCSEProfileEntry& aEntry )
+    {
+    // Get the column definition
+    const TDbCol col( aView.ColDef( aColumnIndex ) );
+
+    // Maps the values using the names of columns
+    if ( col.iName == KProfileId )
+        {
+        aEntry.iId = aView.ColUint32( aColumnIndex );
+        }   
+    else if ( col.iName == KProtocolIds )
+        {        
+        const TDesC& ids = aView.ColDes( aColumnIndex );
+        // Extracts the numbers from ids to iIds.
+        GetProfileIdsFromDescriptorL( ids, aEntry.iIds );  
+        }
+    else if ( col.iName == KProviderName )
+        {
+        aEntry.iProviderName.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KSettingsName )
+        {
+        aEntry.iSettingsName.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KAutoComplete )
+        {
+        aEntry.iAutoComplete = static_cast<CRCSEProfileEntry::TOnOff>(
+            aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KEndMediaPort )
+        {
+        aEntry.iEndMediaPort = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KHoldRingBack )
+        {
+        aEntry.iHoldRingBack = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KInbandDtmf)
+        {
+        aEntry.iInbandDTMF = static_cast<CRCSEProfileEntry::TOnOff>( 
+            aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KMediaQOS )
+        {
+        aEntry.iMediaQOS = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KOutbandDtmf )
+        {
+        aEntry.iOutbandDTMF = static_cast<CRCSEProfileEntry::TOnOff>
+            ( aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KPreferredCodecs )
+        {
+        const TDesC& codecs = aView.ColDes( aColumnIndex );
+        // Extracts the numbers from codecs to iPreferredCodecs.
+        GetNumbersFromDescriptorL( codecs, aEntry.iPreferredCodecs );
+        }
+    else if ( col.iName == KSiqnalingQOS )
+        {
+        aEntry.iSiqnalingQOS = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KStartMediaPort )
+        {
+        aEntry.iStartMediaPort = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KCFNoAnswer )
+        {
+        aEntry.iCFNoAnswer = static_cast<CRCSEProfileEntry::TOnOff>
+                ( aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KCFBusy )
+        {
+        aEntry.iCFBusy = static_cast<CRCSEProfileEntry::TOnOff>
+                ( aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KCFUnconditional )
+        {
+        aEntry.iCFUnconditional = static_cast<CRCSEProfileEntry::TOnOff>(
+            aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KRedundancy )
+        {
+        aEntry.iRedundancy = static_cast<CRCSEProfileEntry::TOnOff>(
+            aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KSecureCallPreference )
+        {
+        aEntry.iSecureCallPreference = aView.ColUint32( aColumnIndex );
+        }
+    else if ( col.iName == KVoIPProfileLock )
+        {
+        aEntry.iVoIPProfileLock = aView.ColUint32( aColumnIndex );
+        }
+    else if ( col.iName == KAdhocAllowed )
+        {
+        aEntry.iAdhocAllowed = aView.ColUint32( aColumnIndex );
+        }
+    else if ( col.iName == KSIPServerType )
+        {
+        aEntry.iSIPServerType.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KSBCType )
+        {
+        aEntry.iSBCType.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KSTUNServerType )
+        {
+        aEntry.iSTUNServerType.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KWLANAPType )
+        {
+        aEntry.iWLANAPType.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KPSTNGatewayType )
+        {
+        aEntry.iPSTNGatewayType.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KSecurityGatewayType )
+        {
+        aEntry.iSecurityGatewayType.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KRTCP )
+        {
+        aEntry.iRTCP = aView.ColUint32( aColumnIndex );
+        }
+    else if ( col.iName == KSIPVoIPUAHTerminalType )
+        {
+        aEntry.iSIPVoIPUAHTerminalType = aView.ColUint32( aColumnIndex );
+        }
+    else if ( col.iName == KSIPVoIPUAHeaderWLANMAC )
+        {
+        aEntry.iSIPVoIPUAHeaderWLANMAC = aView.ColUint32( aColumnIndex );
+        }
+    else if ( col.iName == KSIPVoIPUAHeaderString )
+        {
+        aEntry.iSIPVoIPUAHeaderString.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KProfileLockedToIAP )
+        {
+        aEntry.iProfileLockedToIAP = static_cast<CRCSEProfileEntry::TOnOff>(
+            aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KVoIPPluginUID )
+        {
+        aEntry.iVoIPPluginUID = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KAllowVoIPoverWCDMA )
+        {
+        aEntry.iAllowVoIPoverWCDMA = static_cast<CRCSEProfileEntry::TOnOff>(
+            aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KAllowVoIPoverBT )
+        {
+        aEntry.iAllowVoIPoverBT = static_cast<CRCSEProfileEntry::TOnOff>(
+            aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KMeanCountOfVoIPDigits )
+        {
+        aEntry.iMeanCountOfVoIPDigits = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KIgnoreAddrDomainPart )
+        {
+        aEntry.iIgnoreAddrDomainPart = aView.ColInt32( aColumnIndex );
+        }
+
+    else if ( col.iName == KHandoverDialect )
+        {
+        aEntry.iHandoverDialect = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KPSTelephonyHOPreference )
+        {
+        aEntry.iPSTelephonyHOPreference = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KHOThresholdValueLL )
+        {
+        aEntry.iHOThresholdValueLL = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KHOThresholdValueHL )
+        {
+        aEntry.iHOThresholdValueHL = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KNumberOfMeasurementsAbove )
+        {
+        aEntry.iNumberOfMeasurementsAbove = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KNumberOfMeasurementsBelow )
+        {
+        aEntry.iNumberOfMeasurementsBelow = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KSmartScannInterParaHigh )
+        {
+        aEntry.iSmartScannInterParaHigh = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KSmartScannInterParaMedium )
+        {
+        aEntry.iSmartScannInterParaMedium = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KSmartScannInterParaLow )
+        {
+        aEntry.iSmartScannInterParaLow = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KSmartScannInterParaStatic )
+        {
+        aEntry.iSmartScannInterParaStatic = aView.ColInt32( aColumnIndex );
+        }
+
+    else if ( col.iName == KSmartScannDurationHighMode )
+        {
+        aEntry.iSmartScannDurationHighMode = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KSmartScannDurationMediumMode )
+        {
+        aEntry.iSmartScannDurationMediumMode = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KSmartScannDurationLowMode )
+        {
+        aEntry.iSmartScannDurationLowMode = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KHandoffNumber )
+        {
+        aEntry.iHandoffNumber = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KHandbackNumber )
+        {
+        aEntry.iHandbackNumber = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KHysterisisTimer )
+        {
+        aEntry.iHysterisisTimer = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KHandOffProcessTimer )
+        {
+        aEntry.iHandOffProcessTimer = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KDisconnectProcessTimer )
+        {
+        aEntry.iDisconnectProcessTimer = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KHandoffPrefix )
+        {
+        aEntry.iHandoffPrefix.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KHandbackPrefix )
+        {
+        aEntry.iHandbackPrefix.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KHandoverTones )
+        {
+        aEntry.iHandoverTones = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KSupportSMSoverWLAN )
+        {
+        aEntry.iSupportSMSoverWLAN = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KServiceProviderId )
+        {
+        aEntry.iServiceProviderId = aView.ColUint32( aColumnIndex );
+        }
+    else if ( col.iName == KUserPhoneUriParam )
+        {
+        aEntry.iUserPhoneUriParameter = static_cast<CRCSEProfileEntry::TOnOff>( 
+            aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KSIPConnTestAddress )
+        {
+        aEntry.iSIPConnTestAddress.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KNATSettingsStorageId )
+        {
+        aEntry.iNATSettingsStorageId = aView.ColUint32( aColumnIndex );
+        }
+    else if ( col.iName == KSIPMinSE )
+        {
+        aEntry.iSIPMinSE = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KSIPSessionExpires )
+        {
+        aEntry.iSIPSessionExpires = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KNATProtocol )
+        {
+        aEntry.iNATProtocol = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KNewServiceTable )
+        {
+        aEntry.iNewServiceTableEntry = static_cast<CRCSEProfileEntry::TOnOff>(
+            aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KSNAPId )
+        {
+        aEntry.iSNAPId = aView.ColUint32( aColumnIndex );
+        }
+    else
+        {
+        // Skip unknown column.
+        RCSELOGSTRING2( 
+            "CRCSEProfileRegistry::MapColumnToEntryL() - unknown %d",
+                 aColumnIndex );
+        }
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// Map query result from a given column to audio codec entry.
+// -----------------------------------------------------------------------------
+//
+void CRCSEDbImporter::MapColumnToEntryL( 
+    TInt aColumnIndex, 
+    const RDbView& aView, 
+    CRCSEAudioCodecEntry& aCodecEntry )
+    {    
+    // Get the column definition
+    const TDbCol col( aView.ColDef( aColumnIndex ) );
+
+    // Maps the values using the names of columns
+    if ( col.iName == KAudioCodecId )
+        {
+        aCodecEntry.iCodecId = aView.ColUint32( aColumnIndex );
+        }
+    else if ( col.iName == KMediaTypeName )
+        {
+        aCodecEntry.iMediaTypeName.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KMediaSubTypeName )
+        {
+        aCodecEntry.iMediaSubTypeName.Copy( aView.ColDes( aColumnIndex ) );
+        }
+    else if ( col.iName == KJitterBufferSize )
+        {
+        aCodecEntry.iJitterBufferSize = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KOctetAlign )
+        {
+        aCodecEntry.iOctetAlign = static_cast<CRCSEAudioCodecEntry::TOnOff>( 
+        aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KModeSet )
+        {
+        const TDesC& modeset = aView.ColDes( aColumnIndex );
+        GetNumbersFromDescriptorL( modeset, aCodecEntry.iModeSet );
+        }        
+    else if ( col.iName == KModeChangePeriod )
+        {
+        aCodecEntry.iModeChangePeriod = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KModeChangeNeighbor )
+        {
+        aCodecEntry.iModeChangeNeighbor = static_cast<CRCSEAudioCodecEntry::TOnOff>( 
+        aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KPtime )
+        {
+        aCodecEntry.iPtime = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KMaxptime )
+        {
+        aCodecEntry.iMaxptime = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KCrc )
+        {
+        aCodecEntry.iCrc = static_cast<CRCSEAudioCodecEntry::TOnOff>( 
+        aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KRobustSorting )
+        {
+        aCodecEntry.iRobustSorting = static_cast<CRCSEAudioCodecEntry::TOnOff>( 
+        aView.ColInt32( aColumnIndex ) );
+        }    
+    else if ( col.iName == KInterLeaving )
+        {
+        aCodecEntry.iInterLeaving = aView.ColInt32( aColumnIndex );
+        }    
+    else if ( col.iName == KChannels )
+        {
+        const TDesC& channels = aView.ColDes( aColumnIndex );
+        GetNumbersFromDescriptorL( channels, aCodecEntry.iChannels );
+        }                    
+    else if ( col.iName == KVAD )
+        {
+        aCodecEntry.iVAD = static_cast<CRCSEAudioCodecEntry::TOnOff>( 
+        aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KDTX )
+        {
+        aCodecEntry.iDTX = static_cast<CRCSEAudioCodecEntry::TOnOff>( 
+        aView.ColInt32( aColumnIndex ) );
+        }
+    else if ( col.iName == KSamplingRate )
+        {
+        aCodecEntry.iSamplingRate = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KAnnexb )
+        {
+        aCodecEntry.iAnnexb = static_cast<CRCSEAudioCodecEntry::TOnOff>(
+            aView.ColInt32( aColumnIndex) );
+        }
+    else if ( col.iName == KModeChangeCapability )
+        {
+        aCodecEntry.iModeChangeCapability = aView.ColInt32( aColumnIndex );
+        }
+    else if ( col.iName == KMaxRed )
+        {
+        aCodecEntry.iMaxRed = aView.ColInt32( aColumnIndex );
+        }
+    else
+        {
+        // Skip unknown column.
+        RCSELOGSTRING2( 
+            "CRCSEAudioCodecRegistry::MapColumnToEntryL() - unknown %d",
+                 aColumnIndex );
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// Read TSettingIds structs from given descriptor to array.
+// -----------------------------------------------------------------------------
+//
+void CRCSEDbImporter::GetProfileIdsFromDescriptorL(
+    const TDesC& aNumbers,
+    RArray<TSettingIds>& aArray )
+    {
+    CleanupClosePushL( aArray );
+    
+    TLex lex( aNumbers );
+    
+    TSettingIds value;
+    
+    // Reset original array
+    aArray.Reset();
+    
+    while( !lex.Eos() )
+        {
+        lex.Val( value.iProfileType );
+        // Skip characters to space char.
+        lex.SkipCharacters();
+        lex.Inc( 1 );
+        lex.Val( value.iProfileId );
+        lex.SkipCharacters();
+        lex.Inc( 1 );
+        lex.Val( value.iProfileSpecificSettingId );
+        
+        aArray.AppendL( value );
+        if ( !lex.Eos() ) // Check that End of string is not next char.
+            {
+            // Go over the space character.
+            lex.Inc( 1 );
+            }
+        } 
+    
+    CleanupStack::Pop( &aArray );
+    }
+
+
+// -----------------------------------------------------------------------------
+// Read IDs from given descriptor to array.
+// -----------------------------------------------------------------------------
+//
+template<class T>
+void CRCSEDbImporter::GetNumbersFromDescriptorL(
+    const TDesC& aNumbers,
+    RArray<T>& aArray )
+    {
+    CleanupClosePushL( aArray );
+    TLex lex( aNumbers );
+
+    // Reset original array
+    aArray.Reset();
+    
+    while( !lex.Eos() )
+        {
+        // Extract the number as unsigned int 32, which can be 
+        // converted to value wanted (template)
+        TUint32 value;
+        lex.Val( value, EDecimal );
+        aArray.AppendL( static_cast<T>( value ) );
+        // Skip characters to space char.
+        lex.SkipCharacters();
+        if ( !lex.Eos() ) // Check that End of string is not next char.
+            {
+            // Go over the space character.
+            lex.Inc( 1 );
+            }
+        }
+    
+    CleanupStack::Pop( &aArray );
+    }
+
+
+// -----------------------------------------------------------------------------
+// Update new preferred audio codec IDs to imported VoIP profiles.
+// -----------------------------------------------------------------------------
+//
+void CRCSEDbImporter::UpdatePreferredCodecs()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::UpdatePreferredCodecs() - IN" );
+
+    // Update preferred codec IDs for each profile
+    const TInt count( iProfiles.Count() );
+    for( TInt i( 0 ); i < count; ++i )
+        {
+        // Browse preferred codecs array
+        const TInt codecCount( iProfiles[i]->iPreferredCodecs.Count() );
+        for ( TInt j( 0 ); j < codecCount; ++j )
+            {
+            // Search new codec ID from array
+            TUint32 oldId = iProfiles[i]->iPreferredCodecs[j];
+            TBool found( EFalse );
+
+            const TInt idCount( iCodecIds.Count() );
+            for ( TInt k( 0 ); k < idCount && !found; ++k )
+                {
+                found = ( oldId == iCodecIds[k].iOldId );
+
+                // Set new ID if it was found
+                if ( found )
+                    {
+                    iProfiles[i]->iPreferredCodecs[j] = iCodecIds[k].iNewId;
+                    RCSELOGSTRING4( 
+                        "Match %d. Codec index %d updated for %d. profile",
+                            k, j, i + 1 );
+                    }
+                else
+                    {
+                    RCSELOGSTRING2( "Skip %d", k );
+                    }
+                }
+            }
+        }
+
+    RCSELOGSTRING( "CRCSEDbImporter::UpdatePreferredCodecs() - OUT" );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// Store imported voip profiles.
+// -----------------------------------------------------------------------------
+//
+void CRCSEDbImporter::StoreVoIPProfilesL()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::StoreVoIPProfilesL() - IN" );
+
+    CRCSEProfileRegistry* reg = CRCSEProfileRegistry::NewLC();
+    reg->AddL( iProfiles );
+    CleanupStack::PopAndDestroy( reg );
+
+    RCSELOGSTRING( "CRCSEDbImporter::StoreVoIPProfilesL() - OUT" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// Store imported audio codecs.
+// -----------------------------------------------------------------------------
+//
+void CRCSEDbImporter::StoreAudioCodecsL()
+    {
+    RCSELOGSTRING( "CRCSEDbImporter::StoreAudioCodecsL() - IN" );
+
+    CRCSEAudioCodecRegistry* reg = CRCSEAudioCodecRegistry::NewLC();
+    reg->AddL( iCodecs );
+    CleanupStack::PopAndDestroy( reg );
+
+    // Update codec ID pairs
+    const TInt codecCount( iCodecs.Count() );
+    const TInt codecIdCount( iCodecIds.Count() );
+
+    __ASSERT_ALWAYS( codecCount == codecIdCount, User::Leave( KErrCorrupt ) );
+
+    for ( TInt i( 0 ); i < codecCount; ++i )
+        {
+        iCodecIds[ i ].iNewId = iCodecs[i]->iCodecId;
+        }
+
+    RCSELOGSTRING( "CRCSEDbImporter::StoreAudioCodecsL() - OUT" );
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/rcsepanic.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* 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:  Panic method
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "rcsepanic.h"
+
+// LOCAL CONSTANTS AND MACROS
+_LIT( KRCSEPanic, "RCSE" );
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RCSEPanic, Panics the current thread
+// -----------------------------------------------------------------------------
+//
+void RCSEPanic( 
+    TRCSEPanic aPanic )
+    {
+    User::Panic( KRCSEPanic, aPanic );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/rcseregistrybase.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,382 @@
+/*
+* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Base for RCSE registry classes
+*
+*/
+
+
+//#include <cenrepdatabaseutil.h>
+//#include <cenrepdatabaseproperty.h>
+
+
+#include "rcseregistrybase.h"
+#include "rcsebackupobserver.h"
+#include "rcsedefaultdbnames.h"
+#include "rcseconstants.h"
+#include "rcsepanic.h"
+#include "rcseprivatecrkeys.h"
+#include "rcselogger.h"
+#include "rcsedbimporter.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CRCSERegistryBase::CRCSERegistryBase( TRCSERegistryType aType )
+    : iType( aType )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// BaseConstructL
+// ---------------------------------------------------------------------------
+//
+void CRCSERegistryBase::BaseConstructL()
+    {
+    RCSELOGSTRING2( "CRCSERegistryBase::BaseConstructL(type=%d) - IN", iType );
+    RCSELOGTHREAD();
+
+    // Set proper table and mask
+    switch ( iType )
+        {
+        case EVoIPProfile:
+            {
+            iCenRepDb = CCenRepDatabaseUtil::NewL( KCRUidRCSE,
+                                                   KRCSEProfileTable,
+                                                   KRCSEColIncrement,
+                                                   KRCSEColumnMask,
+                                                   KRCSEIdCounter,
+                                                   KRCSEColumnCountVoIP );
+            break;
+            }
+        case EAudioCodecSetting:
+            {
+            iCenRepDb = CCenRepDatabaseUtil::NewL( KCRUidRCSECodec,
+                                                   KRCSECodecTable,
+                                                   KRCSEColIncrement,
+                                                   KRCSEColumnMask,
+                                                   KRCSEIdCounter,
+                                                   KRCSEColumnCountCodec );
+
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            }
+        };
+
+    iBackupObserver = CRCSEBackupObserver::NewL( *this );
+
+    TInt err( 0 );
+
+    // Check if Backup operation is running.
+    if ( iBackupObserver->IsBackupOperationRunning() )
+        {
+        RCSELOGSTRING( "Backup active!" );
+        iBackupActive = ETrue;
+        }
+
+    if ( !iBackupActive &&
+         CRCSEDbImporter::ImportExists() &&
+         !CRCSEDbImporter::IsImportRunning() )
+        {
+        TRAP( err, ImportSettingsL() );
+        }
+
+    RCSELOGSTRING( "CRCSERegistryBase::BaseConstructL() - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CRCSERegistryBase::~CRCSERegistryBase()
+    {
+    RCSELOGSTRING2( 
+        "CRCSERegistryBase::~CRCSERegistryBase(type=%d) - IN", iType );
+    RCSELOGTHREAD();
+
+    if ( iBackupObserver )
+        {
+        iBackupObserver->Cancel();
+        delete iBackupObserver;
+        iBackupObserver = NULL;
+        }
+
+
+    delete iCenRepDb;
+
+    RCSELOGSTRING( "CRCSERegistryBase::~CRCSERegistryBase() - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MRCSEBackupObserver.
+// Handle backup events.
+// ---------------------------------------------------------------------------
+//
+void CRCSERegistryBase::HandleBackupOperationEventL()
+	{
+	RCSELOGSTRING( "CRCSERegistryBase::HandleBackupOperationEventL() - IN" );
+    RCSELOGTHREAD();
+
+	if ( iBackupObserver->IsBackupOperationRunning() )
+        {
+        RCSELOGSTRING( "Backup active!" );
+        iBackupActive = ETrue;
+        }
+    else
+        {
+        RCSELOGSTRING( "Backup not active!" );
+        iBackupActive = EFalse;
+		}
+
+    RCSELOGSTRING( "CRCSERegistryBase::HandleBackupOperationEventL() - OUT" );
+	}
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::BeginL
+// Prepares read/write operation.
+// -----------------------------------------------------------------------------
+//
+void CRCSERegistryBase::BeginL()
+    {
+    RCSELOGSTRING( "CRCSERegistryBase::BeginL() - IN" );
+    RCSELOGTHREAD();
+
+    if ( iBackupActive )
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    else 
+        {
+        RCSELOGSTRING( "Begin transaction" );
+
+        // Begin transaction. Method leaves 2 items in cleanup stack
+        // and they will be removed in CommitTransaction
+        iCenRepDb->BeginTransactionL(); 
+        }
+
+    RCSELOGSTRING( "CRCSERegistryBase::BeginL() - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::EndL
+// Finalize performed operation
+// -----------------------------------------------------------------------------
+//
+void CRCSERegistryBase::EndL()
+    {
+    RCSELOGSTRING( "CRCSERegistryBase::EndL() - IN" );
+    RCSELOGTHREAD();
+
+    User::LeaveIfError( iCenRepDb->CommitTransaction() );
+
+    RCSELOGSTRING( "CRCSERegistryBase::EndL() - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::ToDes
+// Converts TInt32 to descriptor.
+// -----------------------------------------------------------------------------
+//
+TDesC& CRCSERegistryBase::ToDes( TInt32 aFrom, TDes& aTo )
+    {
+    aTo.Zero();
+    aTo.AppendNum( aFrom );
+    return aTo;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::ToDes
+// Converts TUint32 to descriptor.
+// -----------------------------------------------------------------------------
+//
+TDesC& CRCSERegistryBase::ToDes( TUint32 aFrom, TDes& aTo )
+    {
+    aTo.Zero();
+    aTo.AppendNum( aFrom );
+    return aTo;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::ToDes
+// Converts descriptor to TInt32.
+// -----------------------------------------------------------------------------
+//
+TInt32 CRCSERegistryBase::ToTInt32L( const TDesC& aFrom )
+    {
+    TInt32 value;
+    TLex16 convert( aFrom );
+    User::LeaveIfError( convert.Val( value ) );
+    return value;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::ToDes
+// Converts descriptor to TUint32.
+// -----------------------------------------------------------------------------
+//
+TUint32 CRCSERegistryBase::ToTUint32L( const TDesC& aFrom)
+    {
+    TUint32 value;
+    TLex16 convert( aFrom );
+    User::LeaveIfError( convert.Val( value, EDecimal ) );
+    return value;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::ImportSettingsL
+// Import settings from db files and store to cenrep.
+// -----------------------------------------------------------------------------
+//
+void CRCSERegistryBase::ImportSettingsL()
+    {
+    RCSELOGSTRING( "CRCSERegistryBase::ImportSettingsL() - IN" );
+    RCSELOGTHREAD();
+
+    CRCSEDbImporter* importer = CRCSEDbImporter::NewLC();
+    importer->ImportAndStoreL();
+    CleanupStack::PopAndDestroy( importer );
+
+    RCSELOGSTRING( "CRCSERegistryBase::ImportSettingsL() - OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::CreatePropertyL
+// Create a new property and appends it to given property array
+// -----------------------------------------------------------------------------
+//
+void CRCSERegistryBase::CreatePropertyL( 
+    TUint aPropertyName, 
+    const TDesC& aPropertyValue, 
+    RIpAppPropArray& aPropertyArray )
+    {
+    CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
+    property->SetName( aPropertyName );
+    User::LeaveIfError( property->SetValue( aPropertyValue ) );
+    aPropertyArray.AppendL( property );
+    CleanupStack::Pop( property );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::GetPropertyValueL
+// Gets value of requested property from array
+// -----------------------------------------------------------------------------
+//
+void CRCSERegistryBase::GetPropertyValueL( 
+    TUint aPropertyName, 
+    TDes& aPropertyValue, 
+    RIpAppPropArray& aPropertyArray )
+    {
+    aPropertyValue.Zero();
+
+    const TInt count( aPropertyArray.Count() );
+    for ( TInt i( 0 ); i < count; i++ )
+        {
+        if ( aPropertyArray[i]->GetName() == aPropertyName )
+            {
+            aPropertyValue = aPropertyArray[i]->GetDesValue();
+            //delete aPropertyArray[i];
+            //aPropertyArray.Remove( i );
+            i = count; // Stop the loop
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::FindIdsByValueL
+// Search entries that have this property and requested value.
+// -----------------------------------------------------------------------------
+//
+void CRCSERegistryBase::FindIdsByValueL( 
+    TUint aPropertyName, 
+    const TDesC& aPropertyValue, 
+    RArray<TUint32>& aIdArray )
+    {    
+    RArray<TInt> allEntries;
+    CleanupClosePushL( allEntries );
+
+    iCenRepDb->FindEntryIdsL( allEntries );
+    
+    CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC();
+    
+    const TInt allCount( allEntries.Count() );
+    
+    for ( TInt i( 0 ); i < allCount; i++ )
+        {        
+        TInt err = iCenRepDb->FindPropertyL( allEntries[i], aPropertyName,
+                *property );
+        
+        if ( KErrNoMemory == err )
+            {
+            User::Leave( err );
+            }
+        
+        if ( KErrNone == err )
+            {            
+            // If properties match, add id to the id array.
+            if ( !property->GetDesValue().Compare( aPropertyValue ) )
+                {                
+                aIdArray.AppendL( allEntries[i] );
+                }
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( property );
+    CleanupStack::PopAndDestroy( &allEntries );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::FindAllIdsL
+// Search all ids of entries from cenrep db.
+// -----------------------------------------------------------------------------
+//
+void CRCSERegistryBase::FindAllIdsL( RArray<TUint32>& aIdArray )
+    {
+    CleanupClosePushL( aIdArray );
+    aIdArray.Reset();
+
+    RArray<TInt> ids;
+    CleanupClosePushL( ids );
+
+    iCenRepDb->FindEntryIdsL( ids );
+
+    // TInt to TUint
+    const TInt count( ids.Count() );
+    for ( TInt i( 0 ); i < count; i++ )
+        {
+        aIdArray.AppendL( ids[ i ] );
+        }
+
+    CleanupStack::PopAndDestroy( &ids );
+    CleanupStack::Pop( &aIdArray );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSERegistryBase::CleanupDbPropArray
+// Custom cleanup for cenrep db property array.
+// -----------------------------------------------------------------------------
+//
+void CRCSERegistryBase::CleanupDbPropArray( TAny* aPointer )
+	{
+	RIpAppPropArray* array = static_cast<RIpAppPropArray*>( aPointer );
+	array->ResetAndDestroy();
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/stubs/s_crcsecreatetable.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,98 @@
+/*
+* 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:  Provides table creation for databases.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "crcsecreatetable.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CRCSECreateTable::CRCSECreateTable
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRCSECreateTable::CRCSECreateTable()
+    {
+    }
+    
+// Destructor
+CRCSECreateTable::~CRCSECreateTable()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CRCSECreateTable::CreateProfileTableL
+// Creates a table to database, where the profiles are stored.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRCSECreateTable::CreateProfileTableL()
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSECreateTable::CreateAudioCodecTableL
+// Creates a table to database, where the Audio Codecs are stored.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRCSECreateTable::CreateAudioCodecTableL()
+    {
+    User::Leave( KErrNotSupported );
+    }
+    
+// -----------------------------------------------------------------------------
+// CRCSECreateTable::CreateSIPProfileTableL
+// Creates a table to database, where the SIP profiles are stored.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRCSECreateTable::CreateSIPSettingTableL()
+    {
+    User::Leave( KErrNotSupported );
+    }
+    
+// -----------------------------------------------------------------------------
+// CRCSECreateTable::CreateSCCPSettingTableL
+// Creates a table to database, where the SCCP settings are stored.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRCSECreateTable::CreateSCCPSettingTableL()
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSECreateTable::AddColumnToTableL
+// Adds column to table
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRCSECreateTable::AddColumnToTableL(
+    CDbColSet& /*aTable*/,
+    const TDesC& /*aColumnName*/,
+    TDbColType /*aColumnType*/,
+    TInt /*aMaxLengthOfColumn*/ )
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/stubs/s_crcsesccpentry.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* 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:  SCCP Setting entry, which is stored to db
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "crcsesccpentry.h"
+#include "rcsedefaults.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPEntry::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSESCCPEntry* CRCSESCCPEntry::NewL()
+    {
+    CRCSESCCPEntry* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPEntry::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSESCCPEntry* CRCSESCCPEntry::NewLC()
+    {
+    CRCSESCCPEntry* self = new (ELeave) CRCSESCCPEntry();
+    CleanupStack::PushL( self );
+    self->ResetDefaultValues();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPEntry::CRCSESCCPEntry
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRCSESCCPEntry::CRCSESCCPEntry()
+    {
+    }
+    
+// Destructor
+EXPORT_C CRCSESCCPEntry::~CRCSESCCPEntry()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPEntry::ResetDefaultValues
+// Resets profile entry to default settings.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRCSESCCPEntry::ResetDefaultValues()
+    {
+    iSCCPSettingId        = 0;
+    iProfileName          = KRCSEDefaultSCCPProfileName;
+    iVOIPLogin            = KRCSEDefaultVOIPLogin;
+    iAccessPoint          = KNotSet;      
+    
+    // Reset iCallManager.
+    for ( TInt i = 0; i < KMaxArray; i++ )
+        {
+        iCallManager[ i ] = KNullDesC;
+        }
+
+    iStackVersion         = KRCSEDefaultSCCPStack;
+    iDHCPTFTPEnabled      = KRCSEDefaultDHCPTFTP;
+    iTFTPServerAddress    = KRCSEDefaultTFTPAddress;
+    iPhoneNumber          = KRCSEDefaultSCCPNumber;
+    iSCCPCertificates     = KRCSEDefaultSCCPCertificates;
+    iMusicServerAdd       = KRCSEDefaultMusicServerAdd;
+    iCFUncondAdd          = KRCSEDefaultCFUncondAdd;
+    iVoiceMailBoxURI      = KRCSEDefaultSCCPVoiceMailboxName;
+    iSCCPIntCallPrefix    = KRCSEDefaultSCCPIntCallPrefix;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/stubs/s_crcsesccpsettingregistry.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,166 @@
+/*
+* 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:  Stores and loads CRCSESCCPEntry to/from database.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "crcsesccpsettingregistry.h"
+#include "crcsesccpentry.h"
+#include "rcseregistrybase.h"
+#include "rcsepanic.h"
+#include "rcseconstants.h"
+#include "rcselogger.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPSettingRegistry::CRCSESCCPSettingRegistry
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRCSESCCPSettingRegistry::CRCSESCCPSettingRegistry()
+    : CRCSERegistryBase( ESCCPProfile )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPSettingRegistry::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CRCSESCCPSettingRegistry::ConstructL()
+    {
+    RCSELOGSTRING( "CRCSESCCPSettingRegistry::ConstructL() - STUB impl" );
+    BaseConstructL();
+    }
+    
+// -----------------------------------------------------------------------------
+// CRCSESCCPSettingRegistry::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSESCCPSettingRegistry* CRCSESCCPSettingRegistry::NewL()
+    {
+    CRCSESCCPSettingRegistry* self = CRCSESCCPSettingRegistry::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPSettingRegistry::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSESCCPSettingRegistry* CRCSESCCPSettingRegistry::NewLC()
+    {
+    CRCSESCCPSettingRegistry* self = new( ELeave ) CRCSESCCPSettingRegistry;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSESCCPSettingRegistry::~CRCSESCCPSettingRegistry()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CRCSESCCPSettingRegistry::FindL
+// Creates sql query and sets the data to aFoundQuery.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSESCCPSettingRegistry::FindL( 
+    TUint32 /*aSCCPSettingId*/, 
+    CRCSESCCPEntry& /*aFoundEntry*/ )
+    {
+    RCSELOGSTRING( "CRCSESCCPSettingRegistry::FindL() - KErrNotSupported" );
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPSettingRegistry::AddL
+// Inserts aProfile to database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CRCSESCCPSettingRegistry::AddL( 
+    const CRCSESCCPEntry& /*aNewEntry*/ )
+    {
+    RCSELOGSTRING( "CRCSESCCPSettingRegistry::AddL() - KErrNotSupported" );
+    User::Leave( KErrNotSupported );
+    return 0;//sccpid;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPSettingRegistry::DeleteL
+// Deletes a profile entry which profile id is aId.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSESCCPSettingRegistry::DeleteL( TUint32 /*aId*/ )
+    {
+    RCSELOGSTRING( "CRCSESCCPSettingRegistry::DeleteL() - KErrNotSupported" );
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPSettingRegistry::UpdateL
+// Updates profile entry, which profile identifier is aId.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSESCCPSettingRegistry::UpdateL(
+    TUint32 /*aId*/,
+    const CRCSESCCPEntry& /*aUpdateData*/ )
+    {
+    RCSELOGSTRING( "CRCSESCCPSettingRegistry::UpdateL() - KErrNotSupported" );
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPSettingRegistry::GetDefaultProfile
+// Sets a default profile.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSESCCPSettingRegistry::GetDefaultProfile(
+    CRCSESCCPEntry& aDefaultProfile ) const
+    {
+    aDefaultProfile.ResetDefaultValues();
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESCCPSettingRegistry::GetAllIdsL
+// Gets all profile identifiers from data base.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSESCCPSettingRegistry::GetAllIdsL( 
+    RArray<TUint32>& /*aAllIds*/ )
+    {
+    RCSELOGSTRING( "CRCSESCCPSettingRegistry::GetAllIdsL() - No impl !" );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/stubs/s_crcsesipsettingentry.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,89 @@
+/*
+* 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:  SIP setting entry, which is stored to db
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "crcsesipsettingentry.h"
+#include    "rcsedefaults.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingEntry::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSESIPSettingEntry* CRCSESIPSettingEntry::NewL()
+    {
+    CRCSESIPSettingEntry* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingEntry::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSESIPSettingEntry* CRCSESIPSettingEntry::NewLC()
+    {
+    CRCSESIPSettingEntry* self = new (ELeave) CRCSESIPSettingEntry();
+    CleanupStack::PushL( self );
+    self->ResetDefaultValues();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingEntry::CRCSESIPSettingEntry
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRCSESIPSettingEntry::CRCSESIPSettingEntry()
+    {
+    }
+    
+// Destructor
+EXPORT_C CRCSESIPSettingEntry::~CRCSESIPSettingEntry()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingEntry::ResetDefaultValues
+// Resets SIP setting entry to default settings.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CRCSESIPSettingEntry::ResetDefaultValues()
+    {
+    //SIP & VOIP specific ids 
+    iVOIPSIPProfileSpecificId = 0;
+        
+    // SIP Profile ID.
+    iSIPProfileId = 0;
+    
+    iConferenceFactoryURI    = KRCSEDefaultConferenceFactoryURI;
+    iMusicServerURI          = KRCSEDefaultMusicServerURI;
+    iVoiceMailBoxURI         = KRCSEDefaultVoiceMailBoxURI;
+    iCFNoAnsURI              = KRCSEDefaultCFNoAnsURI;
+    iCFBusyURI               = KRCSEDefaultCFBusyURI;
+    iCFUncondURI             = KRCSEDefaultCFUncondURI;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/richcallsettingsengine/rcse2/src/stubs/s_crcsesipsettingregistry.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,166 @@
+/*
+* 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:  Stores and loads CRCSESIPSettingEntry to/from database.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "crcsesipsettingregistry.h"
+#include "crcsesipsettingentry.h"
+#include "rcsepanic.h"
+#include "rcseconstants.h"
+#include "rcselogger.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingRegistry::CRCSESIPSettingRegistry
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CRCSESIPSettingRegistry::CRCSESIPSettingRegistry()
+    : CRCSERegistryBase( ESIPSetting )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingRegistry::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CRCSESIPSettingRegistry::ConstructL()
+    {
+    RCSELOGSTRING( "CRCSESIPSettingRegistry::ConstructL() - STUB impl" );
+    BaseConstructL();
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingRegistry::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSESIPSettingRegistry* CRCSESIPSettingRegistry::NewL()
+    {
+    CRCSESIPSettingRegistry* self = CRCSESIPSettingRegistry::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingRegistry::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSESIPSettingRegistry* CRCSESIPSettingRegistry::NewLC()
+    {
+    CRCSESIPSettingRegistry* self = new( ELeave ) CRCSESIPSettingRegistry;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CRCSESIPSettingRegistry::~CRCSESIPSettingRegistry()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingRegistry::FindL
+// Creates sql query and sets the data to aFoundQuery.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSESIPSettingRegistry::FindL( 
+    TUint32 /*aSIPProfileId*/, 
+    CRCSESIPSettingEntry& /*aFoundEntry*/ )
+    {
+    RCSELOGSTRING( "CRCSESIPSettingRegistry::FindL() - KErrNotSupported" );
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingRegistry::AddL
+// Inserts aNewEntry to database.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CRCSESIPSettingRegistry::AddL( 
+    const CRCSESIPSettingEntry& /*aNewEntry*/ )
+    {
+    RCSELOGSTRING( "CRCSESIPSettingRegistry::AddL() - KErrNotSupported" );
+    User::Leave( KErrNotSupported );
+    return 0; //sipid;
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingRegistry::DeleteL
+// Deletes a SIP entry which SIP id is aId.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSESIPSettingRegistry::DeleteL( TUint32 /*aId*/ )
+    {
+    RCSELOGSTRING( "CRCSESIPSettingRegistry::Delete() - KErrNotSupported" );
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingRegistry::UpdateL
+// Updates SIP profile entry, which SIP identifier is aId.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSESIPSettingRegistry::UpdateL(
+    TUint32 /*aId*/,
+    const CRCSESIPSettingEntry& /*aUpdateData*/ )
+    {
+    RCSELOGSTRING( "CRCSESIPSettingRegistry::UpdateL() - KErrNotSupported" );
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingRegistry::GetDefaultProfile
+// Sets a default profile.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSESIPSettingRegistry::GetDefaultProfile( 
+    CRCSESIPSettingEntry& aDefaultProfile ) const
+    {
+    aDefaultProfile.ResetDefaultValues();
+    }
+
+// -----------------------------------------------------------------------------
+// CRCSESIPSettingRegistry::GetAllIdsL
+// Gets all SIP setting identifiers from data base.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CRCSESIPSettingRegistry::GetAllIdsL( 
+    RArray<TUint32>& /*aAllIds*/ )
+    {
+    RCSELOGSTRING( "CRCSESIPSettingRegistry::GetAllIdsL() - No impl !" );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/data/10282587.RSS	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* 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:  Resource definitions for project SVP
+*
+*/
+
+#include "ecom/registryinfo.rh"
+
+// -----------------------------------------------------------------------------
+//   
+// SVP ecom resource file.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// svpcontroller.dll UID
+	dll_uid = 0x10282587;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// CCP interface UID
+			interface_uid = 0x10282588;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					// SVP Plug-in implementation UID
+					implementation_uid = 0x10282589;
+					version_no = 1;
+					display_name = "SVP Plug-in";
+					default_data = "";
+					// Note : opaque_data MUST have @ least a single byte of data
+					// in this instance it is an empty string.
+					opaque_data = " ";
+					}
+				// Place additional interface implementations here
+				};
+			}
+		// Place additional interfaces here
+		};
+	}
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* 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 project SIP VoIP Provider
+*
+*/
+
+#include <platform_paths.hrh>
+
+// specifies the platforms this component needs to be built 
+PRJ_PLATFORMS
+DEFAULT
+
+
+// Specify the source file followed by its destination here
+PRJ_EXPORTS
+../rom/svp.iby CORE_APP_LAYER_IBY_EXPORT_PATH( svp.iby )
+
+// Specify the .mmp files required for building the important component
+// releasables.
+PRJ_MMPFILES
+svpcontroller.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/group/svpcontroller.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,140 @@
+/*
+* 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 SVP
+*
+*/
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+TARGET                  svp.dll
+TARGETTYPE              PLUGIN
+
+// 271066503	0x10282587	 SIP VoIP Provider 	ecom dll uid 
+// 271066504	0x10282588	 SIP VoIP Provider	ecom interface uid
+// 271066505	0x10282589	 SIP VoIP Provider	ecom implementation uid
+
+// ECOM Dll recognition UID followed by the unique UID for this dll
+UID                     0x10009D8D 0x10282587
+
+CAPABILITY              CAP_ECOM_PLUGIN 
+VENDORID                VID_DEFAULT
+
+// svp controller
+SOURCEPATH              ../src
+SOURCE                  svpcontroller.cpp
+SOURCE                  svpsessionbase.cpp
+SOURCE                  svpmosession.cpp
+SOURCE                  svpmtsession.cpp
+SOURCE                  svpemergencysession.cpp
+SOURCE                  svputility.cpp
+SOURCE                  svpproxy.cpp
+SOURCE                  svpuriparser.cpp
+SOURCE                  svptimer.cpp
+SOURCE                  svppropertywatch.cpp
+SOURCE                  svpvolumeobserver.cpp
+SOURCE                  svpforwardprovider.cpp
+SOURCE                  svppositioningprovider.cpp
+SOURCE                  svpemergencyiapprovider.cpp
+SOURCE                  svpemergencyconnection.cpp
+SOURCE                  svpsslogcall.cpp
+SOURCE                  svpsupplementaryservices.cpp
+SOURCE                  svpdtmfeventgenerator.cpp
+SOURCE                  svpaudioutility.cpp
+SOURCE                  svprtpobserver.cpp
+SOURCE                  svprtpobserverrequest.cpp
+SOURCE                  svpsettings.cpp
+
+// svp hold
+SOURCEPATH              ../svphold/src
+SOURCE                  svpholdattributehandler.cpp
+SOURCE                  svpholdmediahandler.cpp
+SOURCE                  svpholdcontroller.cpp
+SOURCE                  svpholdcontext.cpp
+SOURCE                  svpholdstatebase.cpp                  
+SOURCE                  svpholdconnectedstate.cpp             
+SOURCE                  svpholddhstate.cpp
+SOURCE                  svpholdinstate.cpp
+SOURCE                  svpholdoutstate.cpp
+SOURCE                  svpholdoutestablishingstate.cpp
+SOURCE                  svpholdinestablishingstate.cpp
+
+// svp transfer
+SOURCEPATH              ../svptransfer/src
+SOURCE                  svptransfercontroller.cpp
+SOURCE                  svptransferstatecontext.cpp
+SOURCE                  svptransferstatebase.cpp
+SOURCE                  svptransferidlestate.cpp
+SOURCE                  svptransferpendingstate.cpp
+SOURCE                  svptransferacceptedstate.cpp
+SOURCE                  svptransferterminatingstate.cpp
+SOURCE                  svptransferterminatedstate.cpp
+
+// user include paths
+USERINCLUDE             ../inc
+USERINCLUDE             ../svphold/inc
+USERINCLUDE             ../svptransfer/inc
+USERINCLUDE             ../../inc
+
+// system include paths
+SYSTEMINCLUDE           /epoc32/include/ecom
+SYSTEMINCLUDE           ../../inc    // IPTelephony internal headers
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH              ../data
+START RESOURCE          10282587.RSS
+TARGET                  svp.rsc
+END
+
+
+LIBRARY                 bafl.lib 
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 mceclient.lib  
+LIBRARY                 rcse.lib
+LIBRARY                 centralrepository.lib    // for call waiting value
+LIBRARY                 sipclient.lib            // for keepalive value
+LIBRARY                 sipprofilecli.lib        // for keepalive value
+LIBRARY                 sipcodec.lib             // for sipstring
+LIBRARY                 inetprotutil.lib         // for escape utils 
+LIBRARY                 cenrepnotifhandler.lib   // for volume watcher
+LIBRARY                 sdpcodec.lib             // for connection field
+LIBRARY                 lbs.lib                  // for positioning provider
+LIBRARY                 connmon.lib              // for connection monitor
+LIBRARY                 commdb.lib               // for TCommDbConnPref
+LIBRARY                 insock.lib               // for TInetAddr class
+LIBRARY                 esock.lib                // for RSocket class
+LIBRARY                 estor.lib                // for RBufWriteStream class
+LIBRARY                 sysutil.lib             // for SW version
+LIBRARY                 platformenv.lib         // for phonemodel
+
+                        // Symbian OS general
+LIBRARY                 cone.lib 
+LIBRARY                 efsrv.lib
+LIBRARY telephonyaudiorouting.lib 		// for tracking audio routing
+// for Log call service
+LIBRARY			apgrfx.lib
+LIBRARY			apparc.lib 
+LIBRARY			logcli.lib
+LIBRARY			logseng.lib
+LIBRARY			logwrap.lib
+LIBRARY			pbkeng.lib 
+LIBRARY			charconv.lib 
+LIBRARY			pbkview.lib 
+LIBRARY			voipeventlog.lib	// for VoIP event logger
+LIBRARY                 ipapputils.lib          // CIpAppPhoneUtils, CIPAppUtilsAddressResolver
+LIBRARY                 callprovider.lib
+LIBRARY                 serviceprovidersettings.lib
+LIBRARY			featdiscovery.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpaudioutility.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,233 @@
+/*
+* 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:  Static audio utility functions for SVP.
+*
+*/
+
+
+#ifndef SVPAUDIOUTILITY_H
+#define SVPAUDIOUTILITY_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CMceAudioStream;
+class CSVPSessionBase;
+class CSVPEmergencySession;
+
+/**
+ * SVPAudioUtility class contains static audio related utility functions.
+ * 
+ * @lib svp.dll
+ * @since S60 v3.2
+ */
+class SVPAudioUtility
+    {
+public: // new methods
+
+    /**
+     * Determines if the given audiostream is downlink (in) stream.
+     * @since S60 v3.2
+     * @param aStream Audiostream whose direction to determine.
+     * @return TBool ETrue if given stream is downlinkstream, EFalse otherwise.
+     */
+    static TBool IsDownlinkStream( CMceAudioStream& aStream );
+    
+    /**
+     * Sets MMF priorities to streams
+     * @since S60 3.2
+     * @param aAudioInStream Representation of MCE audio stream
+     * @param aAudioOutStream Representation of MCE audio stream
+     * @return TBool ETrue if outband DTMF (tel-event) is used in
+     *               audiostreams.
+     *               EFalse if Inband DTMF is used in audiostreams.
+     */
+    static TBool SetPriorityCodecValuesL( CMceAudioStream& aAudioInStream,
+                                          CMceAudioStream& aAudioOutStream );
+                                          
+    /**
+     * Sets audio priority values to streams. Note that this does not
+     * return information about DTMF status. If both streams are not type
+     * KMceAudioStream, this function leaves with KErrArgument.
+     * @since S60 v3.2
+     * @aMediaStream Representation of MCE media stream
+     * @aBoundStream Representation of MCE media stream, bound to aMediaStream
+     * @return void
+     */
+    static void SetAudioStreamPrioritiesL( CMceMediaStream& aMediaStream,
+                                           CMceMediaStream& aBoundStream );
+    
+    /**
+     * Enables speaker sink from aSink array if found.
+     * @since S60 v3.2
+     * @param aSink Array of media sinks.
+     * @return void
+     */
+    static void EnableSpeakerSinkL(
+        const RPointerArray< CMceMediaSink >& aSink );
+    
+    /**
+     * Disables speaker sink from aSink array if found.
+     * @since S60 v3.2
+     * @param aSink Array of media sinks.
+     * @return void
+     */
+    static void DisableSpeakerSinkL( 
+        const RPointerArray< CMceMediaSink >& aSink );
+    
+    /**
+     * Enables aMicSource if it's type is KMceMicSource.
+     * @since S60 v3.2
+     * @param aMicSource Media source
+     * @return void
+     */
+    static void EnableMicSourceL( CMceMediaSource& aMicSource );
+    
+    /**
+     * Disables aMicSource if it's type is KMceMicSource.
+     * @since S60 v3.2
+     * @param aMicSource
+     * @return void
+     */
+    static void DisableMicSourceL( CMceMediaSource& aMicSource );
+    
+    /**
+     * Enables speaker sinks from aStreams array if found and types of media
+     * streams are KMceAudio.
+     * @since S60 v3.2
+     * @param aStreams Array of media streams.
+     * @return void
+     */
+    static void EnableSpeakerSinksL(
+        const RPointerArray< CMceMediaStream >& aStreams );
+        
+    /**
+     * Disables mic from given media stream or from it's bound stream if
+     * mic source is found from either of the streams.
+     * @since S60 v3.2
+     * @param aStream Media stream
+     * @return void
+     */
+    static void DisableMicSourceL( CMceMediaStream& aStream );
+    
+    /**
+     * Finds a codec of name aCodecname from aAudiostream. Returns NULL if not
+     * found
+     * @since S60 v3.2
+     * @param aAudiostream Audiostream from where to search the codec.
+     * @param aCodecname Name of the codec to search
+     * @return CMceAudioCodec Pointer to the found codec or NULL if not found.
+     */
+    static CMceAudioCodec* FindCodec(
+        CMceAudioStream& aAudiostream, const TDesC8& aCodecname );
+    
+    /**
+     * Removes a codec of name aCodecname from aAudiostream if found.
+     * @since S60 v3.2
+     * @param aAudiostream Audiostream from where to remove the codec.
+     * @param aCodecname Name of the codec to remove
+     * @return void
+     */
+    static void RemoveCodecL( CMceAudioStream& aAudiostream,
+        const TDesC8& aCodecname );
+    
+    /**
+     * Checks the media streams if MMF priority update is needed. Function
+     * assumes that all media streams are of type KMceAudio and will leave
+     * with KErrArgument if it encounters other types of media streams.
+     * @since S60 v3.2
+     * @param aStreams Streams to check if the priority update is needed.
+     * @return TBool ETrue if priority update is needed, EFalse otherwise.
+     */
+    static TBool MmfPriorityUpdateNeededL(
+        const RPointerArray<CMceMediaStream>& aStreams );
+    
+    /**
+     * Checks whether given SVP session is capable to DTMF action
+     * (send, stop, etc.). This means that session
+     * a) does not have HoldController.
+     * b) has HoldController, but is in 'connected' state.
+     * @since S60 v3.2
+     * @param aSession SVP session to check.
+     * @return ETrue If DTMF action can be performed.
+     */
+    static TBool DtmfActionCapableSession(
+        const CSVPSessionBase& aSession );
+
+    /**
+     * Checks whether given SVP emergency session is capable to DTMF action
+     * (send, stop, etc.). This means that session
+     * a) does not have HoldController.
+     * b) has HoldController, but is in 'connected' state.
+     * @since S60 v3.2
+     * @param aSession SVP emergency session to be check.
+     * @return ETrue If DTMF action can be performed.
+     */
+    static TBool DtmfActionCapableSession(
+        const CSVPEmergencySession& aSession );
+            
+    /**
+     * Checks whether given MCE stream is capable to DTMF action
+     * (send, stop, etc.). This means that stream:
+     * a) Is a MCE audio stream.
+     * b) It has a source.
+     * c) It's source is enabled.
+     * MCE server will handle the rest of the checks and actual DTMF
+     * action will return a error code.
+     * @since S60 v3.2
+     * @param aStream MCE stream to check.
+     * @return ETrue If DTMF action can be performed.
+     */
+    static TBool DtmfActionCapableStream( const CMceMediaStream& aStream );
+        
+private: // new methods
+
+    /**
+     * C++ default constructor.
+     */
+    SVPAudioUtility();
+    
+    /**
+     * Method for setting DTMF priority for DTMF codec in aAudioStream if
+     * found from it.
+     * @since S60 v3.2
+     * @param aAudioStream Representation of Mce audio stream.
+     * @return TBool ETrue if aAudioStream contained DTMF codec.
+     */
+    static TBool SetDtmfPriorityL( CMceAudioStream& aAudioStream );
+    
+    /**
+     * Method for setting audio priority and preference for audio codecs.
+     * @since S60 v3.2
+     * @param aAudioStream Representation of Mce audio stream.
+     * @param aAudioPref Audio preference value to be used for the codecs.
+     * @return void
+     */
+    static void SetAudioCodecPrioritiesL( CMceAudioStream& aAudioStream,
+        TUint aAudioPref );
+        
+    /**
+     * Checks a uplink audiostream whether it needs an MMF priority/preference
+     * update.
+     * @since S60 v3.2
+     * @param aUplinkStream Uplink stream to check if it needs priority or
+     *                      preference update.
+     * @return TBool ETrue if priority update is needed, EFalse otherwise.
+     */
+    static TBool MmfPriorityUpdateNeededL( CMceAudioStream& aUplinkStream );
+    
+    };
+
+#endif // SVPAUDIOUTILITY_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpcleanupresetanddestroy.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,63 @@
+/*
+* 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 of CleanupResetAndDestroyPushL
+*
+*/
+
+
+
+
+#ifndef SVPCLEANUPRESETANDDESTROY_H
+#define SVPCLEANUPRESETANDDESTROY_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CLASS DEFINITION
+/**
+ * Template class for cleaning up arrays that have a ResetAndDestroy() function.
+ * To be used with the CleanupStack.
+ */
+template <class T>
+class CleanupResetAndDestroy
+	{
+	public:	// New functions
+
+		inline static void PushL( T& aRef );
+
+	private: // New functions
+
+		static void ResetAndDestroy( TAny *aPtr );
+
+	};
+
+// INLINE FUNCTIONS
+template <class T>
+inline void CleanupResetAndDestroy< T >::PushL( T& aRef )
+	{
+	CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) );
+	}
+
+template <class T>
+void CleanupResetAndDestroy<T>::ResetAndDestroy( TAny *aPtr )
+	{
+	( static_cast< T* >( aPtr ) )->ResetAndDestroy();
+	( static_cast< T* >( aPtr ) )->Close();
+	}
+
+template <class T>
+inline void CleanupResetAndDestroyPushL( T& aRef )
+	{ CleanupResetAndDestroy< T >::PushL( aRef ); }
+
+#endif // SVPCLEANUPRESETANDDESTROY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpconsts.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,272 @@
+/*
+* 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:  Constants for SVP.
+*
+*/
+
+
+#ifndef SVPCONSTS_H
+#define SVPCONSTS_H
+
+#include <e32base.h>
+
+// SVP panic codes; panic code range -32600 -> -32649
+const TInt KSVPanicSessionNotFound = -32601;
+const TInt KSVPPanicBadArgument = -32602;
+
+// SVP implementation Uid
+const TUid KSVPImplementationUid = {0x10282589}; 
+
+// SVP Uid
+const TUid KSVPUid = { 0 };
+
+// secure preference consts
+const TUint32 KSVPStatusNonSecure = 0;
+const TUint32 KSVPStatusSecurePreferred = 1;
+const TUint32 KSVPStatusSecureMandatory = 2;
+
+// codec SDP names
+_LIT8( KTELEVENT, "telephone-event" ); 
+
+_LIT8( KAMR,"AMR" );
+_LIT8( KPCMA, "PCMA" );
+_LIT8( KPCMU, "PCMU" );
+_LIT8( KG729, "G729" );
+_LIT8( KG711, "G711" );
+_LIT8( KILBC, "iLBC" );
+_LIT8( KCN, "CN" );
+_LIT8( KRED, "red");
+_LIT8( KAMRWB,"AMR-WB");
+
+const TInt KSVPDefKeepAlivePl = 120;
+const TInt KSVPDefKeepAlivePlMax = 127;
+const TInt KSVPCNPayloadType = 13;
+
+// timer constants
+const TInt KSVPTerminationTimerExpired = 1;
+const TInt KSVPInviteTimerExpired = 2;
+const TInt KSVPExpiresTimeExpired = 3;
+const TInt KSVPRemoteEndDiedExpired = 4;
+const TInt KSVPHangUpTimerExpired = 5;
+const TInt KSVPEmergencyExpired = 6;
+const TInt KSVPHoldTimerExpired = 7;
+const TInt KSVPResumeTimerExpired = 8;
+const TInt KSVPReInviteTimerExpired = 9;
+const TInt KSVPReferTimerExpired = 10;
+const TInt KSVPICMPErrorTimerExpired = 11;
+const TInt KSVPSinkResumeICMPErrorTimerExpired = 12;
+const TInt KSVPSourceResumeICMPErrorTimerExpired = 13;
+const TInt KSVPTerminatingTime = 4000;
+const TInt KSVPMoHangupTerminatingTime = 500;
+const TInt KSVPInviteTimer = 120000;
+const TInt KSVPHoldExpirationTime = 10000;
+const TInt KSVPResumeExpirationTime = 10000;
+const TInt KSVPReferExpirationTime = 10000;
+const TInt KSVPMilliSecondCoefficient = 1000;
+const TUint KSvpStandbyTimerInMillisecs = 2000; // timer constant needed when creating rtp source
+const TUint KSvpJitterBufferLength = 10;
+const TUint KSvpJitterBufferThreshold = 3;
+const TUint32 KSVPDefaultExpiresTime = 120;
+const TUint32 KSVPDefaultSessionExpires = 1800;
+const TInt KSVPICMPErrorTime = 5000;
+const TUint KSVPSinkResumeICMPErrorTime = 1000;    // Time after resume and icmp error
+const TUint KSVPSourceResumeICMPErrorTime = 1000;  // Time after resume and icmp error
+
+// Recipient DTMF parsing
+_LIT( KSVPDtmfAllValidChars, "0123456789pw*+#" );
+_LIT( KSVPDtmfTelNumRange, "+0123456789" );
+_LIT( KSVPDtmfDelimiterRange, "pw+" );
+
+// constants for URI handling and SIP headers
+_LIT8( KSVPSipPrefix, "sip:" );
+_LIT( KSVPSipPrefix2, "sip:" );
+const TInt KSVPSipPrefixLength = 4;
+_LIT8( KSVPSipsPrefix, "sips:" );
+_LIT( KSVPSipsPrefix2, "sips:" );
+const TInt KSVPSipsPrefixLength = 5;
+_LIT8( KSVPAt, "@" );
+_LIT( KSVPAt2, "@" );
+const TInt KSVPAtLength = 1;
+_LIT8( KSVPSemiCln, ";" );
+_LIT8( KSVPCln, ":" );
+_LIT( KSVPCln2, ":" );
+_LIT8( KSVPHphn, "-" );
+_LIT8( KSVPComma, "," );
+_LIT( KSVPQuotationMark, "\"" );
+_LIT8 (KSVPUserEqualsPhone, ";user=phone" );
+const TInt KSVPUserEqualsPhoneLenght = 11; 
+const TInt KSVPLRLength = 3;
+_LIT8( KSVPLooseRouting, ";lr" );
+const TInt KSVPSingleBracketLength = 1; // only one bracket
+const TInt KSVPDoubleBracketLength = 2; // always opening and closing bracket
+_LIT8( KSVPLeftBracketMark, "<");
+_LIT( KSVPLeftBracketMark2, "<" );
+_LIT8( KSVPRightBracketMark, ">");
+_LIT( KSVPRightBracketMark2, ">" );
+_LIT8( KSVPAuthidentity, "?X-Sipx-Authidentity=");
+_LIT8( KSVPAuthidentity2, "?X-sipX-Authidentity=");
+_LIT8( KSVPAuthidentity3, "&X-sipX-Authidentity=");
+
+// uri length
+const TUint KSVPMaxUriLength = 100;
+// codec name length, max
+const TUint KSVPMaxCodecNameLength = 8;
+const TUint8 KSVPLineFeed2 = '\n';
+const TUint8 KSVPHyphen        = '-';
+_LIT( KSVPSpace2, " " );
+_LIT8( KSVPLineFeed,           "\n" );
+
+_LIT8( KSVPOpeningBracket, "(" );
+_LIT8( KSVPClosingBracket, ")" );
+_LIT( KSVPCSeqPrefix, "CSeq:" );
+const TInt KSVPCSeqPrefixLength = 5; 
+
+// user=phone 
+_LIT8(KSVPPlus, "+");
+_LIT8( KUserEqualsPhone, "user=phone" ); // user = phone
+const TInt KUserEqualsPhoneParamLength = 11; // user = phone
+const TInt KSemicolonLength = 1; // user = phone
+const TInt KSVPMinUserInfoLength = 2; // user = phone
+
+_LIT8( KTelPrefix, "tel:" );
+const TInt KTelPrefixLength = 4;
+
+_LIT( KSVPSemiColon, ";" );
+_LIT( KSVPLogFieldDelimiter, "\t" );
+const TUint8 KSVPLeftBracket = '<';
+const TUint KSVPUserEqualsPhoneLength = 11;
+_LIT( KSVPName,"SVP" );
+
+
+_LIT8( KSVPTLS, "tls" );
+
+const TUint KSVPMaxUAFreeTextLength   = 32;
+const TUint KSVPTempStringlength      = 200;
+const TUint KSVPAcceptLangStringLength= 19; // example: Accept-language: en
+const TUint KSVPExpiresHeaderLength   = 12; // example: Expires: 120
+const TUint KSVPQuesReplacesTxtLength = 10;
+const TUint KSVPReferredByLength      = 12;
+const TUint KSVPToTagLength           = 12;
+const TUint KSVPFromTagLength         = 14;
+const TUint KSVPTagLength             = 5;
+
+_LIT8( KSVPAcceptLanguage,      "Accept-Language:" );
+_LIT8( KSVPExpiresHeader,       "Expires:" );
+_LIT8( KSVPSessionExpires,      "Session-Expires:" );
+_LIT8( KSVPRefresher,           ";refresher" );
+_LIT8( KSVPMinSessionExpires,   "Min-SE:" );
+const TInt KSVPMinExpiresLenght = 8;
+_LIT8( KSVPExpires,             "120");
+_LIT8( KSVPUserAgent,           "User-Agent:" );
+_LIT8( KSVPSpaceMark,           " " );
+_LIT8( KSVPReferredBy,          "Referred-By:" );
+_LIT8( KSVPCallId_replaces,     "Call-ID: " );
+_LIT8( KSVP_tag,                ";tag=" );
+_LIT8( KSVPTo_tag,              "%3Bto-tag%3D" );
+_LIT8( KSVPFrom_tag,            "%3Bfrom-tag%3D" );
+_LIT8( KSVPFromPrompt, 			"From: ");
+_LIT8( KSVPPIdentity,           "P-Preferred-Identity: ");
+
+const TUint KSVPFromPromptStringlength = 6;
+
+_LIT8( KSVPReplacesColonTxt,    "Replaces:" );
+_LIT8( KSVPQuesReplacesTxt,     "?Replaces=" );
+
+_LIT8(KSVPMyAnonymousAddress,    "\"Anonymous\" <sip:anonymous@anonymous.invalid>");
+_LIT8(KSVPMyAnonymousSecAddress, "\"Anonymous\" <sips:anonymous@anonymous.invalid>");
+_LIT(KSVPAnonymous,              "Anonymous");
+_LIT8(KSVPAnonymousAddressWithoutName,    "<sip:anonymous@anonymous.invalid>");
+_LIT8(KSVPAnonymousSecAddressWithoutName, "<sips:anonymous@anonymous.invalid>");
+_LIT8(KSVPAnonymousName8,                 "Anonymous");
+_LIT(KSVPPrivateNumber, "Private");
+
+_LIT8( KSVPEmpty,        "");
+_LIT8( KSVPPrivacy,      "Privacy:" );
+_LIT8( KSVPId,           "Id" );
+_LIT8( KSVPNone,         "None" );
+_LIT8( KSVPSupported,    "Supported:" );
+_LIT8( KSVPRequire,      "Require:" );
+_LIT8( KSVPPrecondition, "precondition" );
+_LIT8( KSVP100rel,       "100rel" );
+const TInt KSVPClirOff = 0;
+const TInt KSVPClirOn = 1;
+const TInt KSVPClirDefault = 2;
+const TUint KSVPPrivacyLength   = 13;  // example: Privacy: None
+
+const TUint8 KSVPQuestionMark  = '?';
+const TUint8 KSVPColonMark     = ':';
+const TUint8 KSVPSemiColonMark = ';'; 
+
+const TUint KSVPMaxLangCodeLength = 4; 
+
+//Logging
+const TInt KSvpMaxDebugBufferSize = 256;
+
+// ipapputils
+const TUint KSVPWlanMacAddressLength = 50;
+_LIT8 ( KSVPWlanMacAddressFrmt, "-" );
+
+const TInt KSVPContactArrayGranularity = 5;
+
+_LIT8( KSVPMessageSipfrag, "message/sipfrag;version=2.0");
+_LIT8( KSVPSubsStateTerminated,   "Subscription-State: terminated;reason=noresource");
+
+_LIT( KSVPS60,"S60" );
+_LIT( KSVPCopyright, "?" );
+_LIT(KSVPSalesModelFileName, "\\resource\\versions\\model.txt");
+
+// Emergency constants
+const TInt KSVPEmergencyTimeout = 17000;
+// Location information constants
+const CActive::TPriority KSVPEmergencyPositioningPriority = 
+    CActive::EPriorityStandard;
+const TInt KSVPEmergencyDhcpDefaultPsyModuleId = 0x10283114;
+_LIT( KSVPEmergencyApplicationName, "svp.dll" ); // Requestor identifier
+const TUint32 KSVPEmergencyPositioningTimeout = 5000000; // In microseconds
+// Location related header constants
+_LIT8( KSVPEmergencyPriorityEmergency, "Priority: emergency" );
+_LIT8( KSVPEmergencyGeolocation, "Geolocation: " );
+_LIT8( KSVPEmergencyTagInsertedBy, ";inserted-by=" );
+_LIT8( KSVPEmergencyTagRecipientEndpoint, ";recipient=endpoint" );
+_LIT8( KSVPEmergencyAcceptApplicationSdp, "Accept: application/sdp" );
+_LIT8( KSVPEmergencyApplicationPidfXml, "application/pidf+xml" );
+_LIT8( KSVPEmergencyContentIdName, "Content-ID: " );
+_LIT8( KSVPCidPrefix, "cid:" );
+
+
+const TInt KSVPAnonymousBarringOff = 0;
+const TInt KSVPAnonymousBarringOn  = 1;
+const TInt KSVPDoNotDisturbOff     = 0;
+const TInt KSVPDoNotDisturbOn      = 1;
+
+const TInt KSVPErrDnDRejection           = -10;
+const TInt KSVPErrAnonymousCallRejection = -11;
+const TInt KSVPErrCodecMismatch          = -12;
+const TInt KSVPErrWrongMinSE             = -13;
+
+const TInt KSVPMceArrayIndexOriginator = 0;
+
+const TInt KSVPDefaultUDPRefreshInterval = 28; // 28 seconds is default
+
+// DATA TYPES
+enum TSupplementaryServicesEvent
+    {
+    ESVPSSDefault,
+    ESVPSSAnonymousBarring,
+    ESVPSSDoNotDisturb
+    };
+    
+const TUint KSVPWlanTrafficStreamParamUserPriority = 6;
+
+#endif // SVPCONSTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpcontroller.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1016 @@
+/*
+* 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:  Handles all common logic for SVP and handles sessions.
+*
+*/
+
+#ifndef SVPCONTROLLER_H
+#define SVPCONTROLLER_H
+
+#include <mcemanager.h>
+#include <mcesessionobserver.h>
+#include <mcedtmfobserver.h>
+#include <mceinsessionobserver.h>
+#include <mceinreferobserver.h>
+#include <mceeventobserver.h>
+#include <mcestreamobserver.h>
+#include <mcereferobserver.h>
+#include <mcetransactiondatacontainer.h>
+
+#include <cconvergedcallprovider.h>
+#include <mccpobserver.h> 
+#include <mccpssobserver.h>
+#include <mccpdtmfprovider.h>
+
+#include <wlanmgmtclient.h>
+
+#include "svpsessionobserver.h"
+#include "svpemergencysession.h"
+#include "svpconsts.h"
+#include "svputdefs.h"
+
+#include "svpsupplementaryservices.h"
+#include "cipappphoneutils.h"               // KSVPMaxTerminalTypeLength
+
+// FORWARD DECLARATIONS
+class CSVPRtpObserver;
+class CWlanMgmtClient;
+
+/**
+ *  SVP controller
+ *
+ *  Handles all common logic for SVP and handles sessions.
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2 
+ */
+class CSVPController : public CConvergedCallProvider,
+                       public MSVPSessionObserver, 
+                       public MMceSessionObserver,
+                       public MMceEventObserver,
+                       public MMceReferObserver,
+                       public MMceInSessionObserver,
+                       public MMceInReferObserver,
+                       public MMceStreamObserver,
+                       public MMceDtmfObserver,
+                       public MCCPDTMFProvider, 
+                       public MSIPObserver,
+                       public MSIPProfileRegistryObserver
+    {
+
+public: // new functions
+
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPController* NewL();
+  
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPController();
+   
+public: // functions from base classes
+
+    /**
+    * From SVPSessionObserver. Removes session from session array
+    * @since S60 3.2
+    * @param aSession Session to be removed from session array
+    */
+    void RemoveFromArray( CSVPSessionBase &aSession );
+    
+    /**
+    * From SVPSessionObserver. Handles session cleanup
+    * when Mt session creation fails in early stages
+    * @since S60 3.2
+    * @param aSession Session to be removed
+    */
+    void TerminateSession( CMceInSession &aSession );
+
+    /**
+    * From MMceSessionObserver. The state of the session has changed.
+    * @since Series 60 3.2
+    * @param aSession, the session that has changed.
+    * @param aContainer, if present, holds details of
+    *        transaction causing state change.
+    */
+    void SessionStateChanged(
+    			CMceSession& aSession,
+    			TMceTransactionDataContainer* aContainer );
+
+    /**
+    * From MMceSessionObserver.The state of the connection used by the session has changed.
+    * @since Series 60 3.2
+    * @param aSession, the session that has changed.
+    * @param aActive, ETrue if connection active, EFalse if connection inactive.
+    */
+    void SessionConnectionStateChanged(
+                CMceSession& aSession,
+                TBool aActive );
+    
+    /**
+    * From MMceSessionObserver.An error has occurred concerning a specific session.
+    * Note, that each error causes the session state to be ETerminated.
+    * @since Series 60 3.2
+    * @param aSession, The session raising the error.
+    * @param aError, Error code
+    */
+	void Failed( CMceSession& aSession, TInt aError );
+
+	/**
+    * From MMceSessionObserver.An session update has been failed concerning a specific session.
+    * Note, that each error causes the session state to be ETerminated.
+    * @since Series 60 3.2
+    * @param aSession, The session raising the error.
+    * @param aContainer, if present, holds details of
+    *        transaction causing update.
+    */
+	void UpdateFailed(
+    			CMceSession& aSession,
+    			TMceTransactionDataContainer* aContainer );
+    			
+     /**
+    * From MMceEventObserver. The state of the event has changed.
+    * @since Series 60 3.2
+    * @param aEvent, the event that has changed.
+    * @param aContainer, if present, holds details of
+    *        transaction causing state change.
+    */
+    void EventStateChanged(
+    			CMceEvent& aEvent,
+				TMceTransactionDataContainer* aContainer );
+
+	/**
+	* From MMceEventObserver. The state of the event has changed.
+	* @since Series 60 3.2
+	* @param aEvent, event received notification.
+    * @param aContainer, if present, holds details of
+    *        transaction causing state change.
+	*/
+	void NotifyReceived(
+				CMceEvent& aEvent,
+				TMceTransactionDataContainer* aContainer );
+				
+				
+    /**
+    * From MMceEventObserver. The state of the event used by the refer has changed.
+    * @since Series 60 3.2
+    * @param aEvent, the event that has changed.
+    * @param aActive, ETrue if connection active, EFalse if connection inactive.
+    */
+    void EventConnectionStateChanged(
+                CMceEvent& aEvent,
+                TBool aActive );
+    
+	/**
+	* From MMceEventObserver. An error has occurred concerning a specific SIP event.
+	* Note, that each error causes the event state to be ETerminated.
+	* @param aEvent, The event raising the error.
+	* @param aError, Error code
+	*/
+    void Failed(CMceEvent& aEvent, TInt aError );
+	
+	/**
+    * From MMceInSessionObserver. Incoming session invitation. 
+    * The CMceInSession is given to the
+	* application as a callback.
+    * @since Series 60 3.2
+    * @param aSession, pointer to the incoming session. Ownership is
+	*	     transferred.
+    * @param aContainer, if present, holds details of
+    *        transaction causing state change.
+    */
+	void IncomingSession(
+                CMceInSession* aSession,
+				TMceTransactionDataContainer* aContainer );
+				
+				
+    /**
+    * From MMceInSessionObserver.Incoming session update. 
+    * The new updated CMceInSession is given to the
+	* application as a callback.
+    * @since Series 60 3.2
+    * @param aOrigSession, the original session to be updated. 
+    *        This instance cannot be used anymore, 
+    *        all actions done using aUpdatedSession instance.
+    * @param aUpdatedSession, pointer to the new updated session. Ownership is
+	*	     transferred.
+    * @param aContainer, if present, holds details of
+    *        update transaction.
+    */
+	void IncomingUpdate(
+				CMceSession& aOrigSession, 
+				CMceInSession* aUpdatedSession,
+				TMceTransactionDataContainer* aContainer );
+				
+	/**
+    * From MMceInReferObserver. New incoming refer received.
+	* @since Series 60 3.2
+	* @param aRefer, the new inbound refer. Ownership is
+	*		 transferred.
+    * @param aReferTo SIP specific Refer-to header 
+    * @param aContainer, if present, holds details of
+    *        transaction causing state change.
+    */
+    void IncomingRefer(
+				CMceInRefer* aRefer,
+				const TDesC8& aReferTo,
+				TMceTransactionDataContainer* aContainer );
+				
+	/**
+    * From MMceStreamObserver. The state of the stream has changed.
+    * @since Series 60 3.2
+    * @param aStream, the stream that has changed.
+    */
+    void StreamStateChanged( 
+                   CMceMediaStream& aStream);
+
+    /**
+    * From MMceStreamObserver. The state of the sink has changed.
+    * @since Series 60 3.2
+    * @param aStream, the stream that uses the sink.
+    * @param aSink, the sink that has changed.
+    */
+    void StreamStateChanged(
+                    CMceMediaStream& aStream,
+                    CMceMediaSink& aSink );
+
+    /**
+    * From MMceStreamObserver. The state of the source has changed.
+    * @since Series 60 3.2
+    * @param aStream, the stream that uses the source.
+    * @param aSource, the source that has changed.
+    */
+    void StreamStateChanged(
+                    CMceMediaStream& aStream,
+                    CMceMediaSource& aSource );
+    
+    
+    /**
+    * From MMceReferObserver. state of the refer has changed.
+    * @param aRefer, the refer that has changed.
+    * @param aContainer, if present, holds details of
+    *        transaction causing state change.
+    */
+    void ReferStateChanged(
+    			CMceRefer& aRefer,
+				TMceTransactionDataContainer* aContainer );
+		
+    /**
+    * From MMceReferObserver. The state of the connection used by the refer has changed.
+    * @param aRefer, the refer that has changed.
+    * @param aActive, ETrue if connection active, EFalse if connection inactive.
+    */
+    void ReferConnectionStateChanged(
+                CMceRefer& aRefer,
+                TBool aActive );
+            
+	/**
+	* From MMceReferObserver. An error has occurred concerning a specific SIP refer.
+	* Note, that each error causes the event state to be ETerminated.
+	* @param aRefer, The refer raising the error.
+	* @param aError, Error code
+	*/
+	void Failed( CMceRefer& aRefer, TInt aError );
+
+
+// from MConvergedCallProvider 
+	/**
+	* Initializes plug-in. All required parameters must be passed
+	* with this function in order to use services.
+	* Simplifies pluging construct removing need to pass parameters to ECom interface
+	* @since Series60 3.2
+	* @param aMonitor CCP observer
+	* @param aSsObserver SS observer
+	*/
+	void InitializeL( const TUint32 aServiceId,
+					  const MCCPObserver& aObserver, 
+					  const MCCPSsObserver& aSsObserver );
+    
+   	/**
+    * Initializes plug-in. All required parameters must be passed
+    * with this function in order to use services.
+    * Simplifies pluging construct removing need to pass parameters to ECom interface
+    * @since Series60 3.2
+    * @param aMonitor CCP observer
+    * @param aSsObserver SS observer
+    */
+    void InitializeL( const MCCPObserver& aMonitor,
+                      const MCCPSsObserver& aSsObserver );
+
+    /**
+    * Creates a new session and checks secure status from profile. Leaves with
+    * ECCPErrorNetworkBusy if not enough WLAN bandwith.
+    * @since Series60 3.2
+    * @param aParameters Call parameters, SVP uses Service ID parameter
+    * @param aRecipient Recipients address/number
+    * @param aObserver Observer
+    * @return MCCPCall
+    */
+    MCCPCall* NewCallL( const CCCPCallParameters& aParameters,
+					    const TDesC& aRecipient,
+					    const MCCPCallObserver& aObserver );
+                                
+    /**
+    * Returns Uid of plug-in which is on use.
+    * @since Series60 3.2
+    * @return Uid of plug-in
+    */                        
+    const TUid& Uid() const;
+                           
+    /**
+    * Creates a new Emergency call and add user-agent header.
+    * @since Series60 3.2
+    * @param aServiceId Service ID, obsolete!
+    * @param aAddress Emergency number
+    * @param aObserver Observer
+    * @return MCCPEmergencyCall
+    */
+    MCCPEmergencyCall* NewEmergencyCallL( const TUint32 aServiceId,
+                                          const TDesC&  aAddress,
+                                          const MCCPCallObserver& aObserver );
+                                          
+    /**
+    * Creates a new conference session.
+    * @since Series60 3.2
+    * @param aObserver Observer
+    * @return MCCPConferenceCall
+    */
+    MCCPConferenceCall* NewConferenceL( const TUint32 aServiceId,
+                              const MCCPConferenceCallObserver& aObserver );
+                             
+    /**
+    * Releases call
+    * @since Series60 3.2
+    * @param aCall Call to be removed
+    * @return Symbian error code
+    */
+    TInt ReleaseCall( MCCPCall& aCall );
+
+    /**
+    * Releases emergency call
+    * @since Series60 3.2
+    * @param aCall Call to be removed
+    * @return Symbian error code
+    */
+    TInt ReleaseEmergencyCall( MCCPEmergencyCall& aCall );
+
+    /**
+    * Releases conference call
+    * @since Series60 3.2
+    * @param aCall Call to be removed
+    * @return Symbian error code
+    */
+    TInt ReleaseConferenceCall( MCCPConferenceCall& aCall );
+
+    /**
+    * Notifies Plug-In about transfer status.
+    * @since Series 60 3.2
+    * @param aAccept Boolean value is transfer accepted or not.
+    * @return None
+    */                      
+    void AcceptTransfer( TBool aAccept );
+
+
+    /**
+    * Notification from UI to Multiple choices query
+    * multiple choices response
+    * @since Series 60 3.2
+    * @param aIndex index of address where the call is to be forwarded
+    * @return KErrNone if succesfull
+    */  
+    TInt ForwardCallToAddressL( const TInt aIndex );
+    
+    /**
+    * Get Plug-In capabilities
+    * @since Series 60 3.2
+    * @return TUint32 On return contains the capability flags of plug-In
+    */
+    TUint32 Caps() const;
+    
+	/**
+	* Get DTMF provider
+	* @since Series 60 3.2
+	* @param aObserver CCP Dtmf observer for informing events
+	* @return Pointer to MCCPDTMFProvider if succesfull, NULL if not available
+	*/
+	MCCPDTMFProvider* DTMFProviderL( const MCCPDTMFObserver& aObserver );
+
+	/**
+	* Get extension provider
+	* @since Series 60 3.2
+    * @param aObserver observer for extension(custom) events
+	* @return Pointer to MCCPExtensionProvider if succesfull, NULL if not available
+	*/
+	MCCPExtensionProvider* ExtensionProviderL( const MCCPExtensionObserver& aObserver );
+    
+    /**
+    * Add an observer for DTMF related events.
+    * Plug-in dependent feature if duplicates or more than one observers 
+    * are allowed or not. Currently CCE will set only one observer.
+    * @since S60 v3.2
+    * @param aObserver Observer
+    * @leave system error if observer adding fails
+    */
+    void AddObserverL( const MCCPDTMFObserver& aObserver );
+
+    /**
+    * Remove an observer.
+    * @since S60 v3.2
+    * @param aObserver Observer
+    * @return KErrNone if removed succesfully. KErrNotFound if observer was not found.
+    * Any other system error depending on the error.
+    */
+    TInt RemoveObserver( const MCCPDTMFObserver& aObserver );
+
+    
+// from MCCPDTMFProvider
+
+    /**
+	* Cancels asynchronous DTMF string sending.
+	* @return KErrNone if successful, otherwise system wide error code
+	* @since Series 60 3.2
+	*/
+	TInt CancelDtmfStringSending();
+
+	/**
+	* Starts the transmission of a single DTMF tone across a
+	* connected and active call.
+	* @since S60 3.2
+	* @param aTone Tone to be played.
+	* @return KErrNone if successful, otherwise another system wide error code
+	*/
+	TInt StartDtmfTone( const TChar aTone );
+
+	/**
+	* Stops playing current DTMF tone.
+	* @since S60 3.2
+    * @param none
+	* @return KErrNone if successfull, otherwise another system wide error code
+	*/
+	TInt StopDtmfTone();
+
+	/**
+	* Plays DTMF string.
+	* @since S60 3.2
+	* @param aString String to be played.
+	* @return KErrNone if successful, otherwise another system wide error code
+	* KErrArgument if the specified string contains illegal DTMF characters
+	*/
+	TInt SendDtmfToneString( const TDesC& aString );
+
+	/**
+	* Continue or cancel sending DTMF string which was stopped with 'w'-character
+	* in string.
+	* @since S60 3.2
+	* @param aContinue ETrue if sending of the DTMF string should continue,
+	* EFalse if the rest of the DTMF string is to be discarded.
+	* @return KErrNone if succesfull, otherwise another system wide error code
+	*/
+	TInt ContinueDtmfStringSending( const TBool aContinue );   
+	
+	
+// from Mce DTMF observer
+public: 
+
+    /**
+    * Incoming DTMF tone received.
+    * @param aSession Session that tone was received.
+    * @param aStream Stream that tone was received.
+    * @param aTone Received tone.
+    */
+    void DtmfToneReceived( CMceSession& aSession,
+                           CMceAudioStream& aStream,
+                           const TChar& aTone );
+                                                               
+    /**
+    * DTMF event received.
+    * @param aSession Session that event was received.
+    * @param aStream Stream that event was received.
+    * @param aSource Source that event was received.
+    * @param aEvent Received event.
+    */
+    void DtmfEventReceived( CMceSession& aSession,
+                            CMceAudioStream& aStream,
+                            CMceMediaSource& aSource,
+                            TMceDtmfEvent aEvent );
+                                  		
+    /**
+    * DTMF error occured. If error occurs, DTMFs becomes
+    * unavailable for that source.
+    * @param aSession Session that event was received.
+    * @param aStream Stream that event was received.
+    * @param aStream Stream that event was received.
+    * @param aError Error code.
+    */
+    void DtmfErrorOccured( CMceSession& aSession,
+                           CMceAudioStream& aStream,
+                           CMceMediaSource& aSource,
+                           TInt aError );
+
+
+public: // methods from MSIPObserver
+
+    /**
+    * From MSIPObserver A SIP request has been received from the network. 
+    * @since  Series 60 3.0
+    * @param  aIapId The IapId from which the SIP request was received.  
+    * @param  aTransaction Contains local address, remote address of a sip
+    *         message, as well as optional SIP message method, headers and 
+    *         body. The ownership is transferred.  
+    */
+     void IncomingRequest( TUint32 aIapId, 
+                           CSIPServerTransaction* aTransaction );
+
+    /**
+    * From MSIPObserver The received SIP request time-outed and it has been
+    * destroyed.  
+    * @since  Series 60 3.0
+    * @param  aSIPServerTransaction The time-outed transaction. Ownership is
+    *         not transferred. 
+    */
+     void TimedOut( CSIPServerTransaction& aSIPServerTransaction );
+
+     
+public: // methods from MSIPProfileRegistryObserver
+
+    /**
+    * From MSIPProfileRegistryObserver An asynchronous error has occurred
+    * related to SIP profile Event is send to those observers, who have the
+    * corresponding profile instantiated. 
+    * @since  Series 60 3.0
+    * @param  aSIPProfileId SIP Profile ID. 
+    * @param  aError Error code. 
+    */ 
+     void ProfileRegistryErrorOccurred( TUint32 aSIPProfileId,
+                                        TInt aError );
+    
+    /**
+    * From MSIPProfileRegistryObserver An event related to SIP Profile has
+    * occurred.
+    * @since  Series 60 3.0
+    * @param  aProfileId SIP Profile ID. 
+    * @param  aEvent An occurred event.
+    */ 
+    void ProfileRegistryEventOccurred( TUint32 aProfileId,
+                                        TEvent aEvent );
+
+
+private: // new methods
+    
+    /**
+     * Checks min session expires offered
+     * Responds with 422 if smaller than provisioned
+     * @Since Series 60 3.2
+     * @param aSession Incoming session
+     * @param aHeaders Incoming session SIP headers
+     * @param aMinSE Minimum session expires provisioned to phone
+     */
+    void CheckMinSessionExpiresL( CMceInSession& aSession, 
+                                  CDesC8Array& aHeaders,
+                                  TInt aMinSE );
+
+    /**
+     * Handles cases where re-INVITE is received without SDP
+     * @Since Series 60 3.2
+     * @param aSessionIndex Session that is under update
+     * @param aUpdatedSession Updated session received from Mce
+     */
+    void IncomingUpdateNoSdpHandlerL( TInt aSessionIndex, 
+                                      CMceInSession* aUpdatedSession );
+
+
+    /**
+     * Handles cases where re-INVITE is received with SDP
+     * @Since Series 60 3.2
+     * @param aSessionIndex Session that is under update
+     * @param aOrigSession Session to be updated
+     * @param aUpdatedSession Updated session received from Mce
+     */
+    void IncomingNormalUpdate( TInt aSessionIndex,
+                               CMceSession& aOrigSession,
+                               CMceInSession* aUpdatedSession );
+
+    /**
+    * Fetches expires time from incoming INVITE
+    * @Since Series 60 3.2
+    * @param aExpiresTime time in expires header
+    */   
+    void FetchExpiresTime( TUint32& aExpiresTime, CDesC8Array& aHeaders ) const;
+    
+    /**
+    * Checks if state change call back reported error in session creation
+    * Used only for secure session 
+    * @since S60 3.2
+    * @param aStatusCode Status code contains the response or system wide error code
+    * @return TBool ETrue if faield, EFalse otherwise
+    */
+    TBool CheckIfSecureFailed( TInt aStatusCode ) const;
+
+    /**
+    * Method is called when normal Mo session needs to created
+    * after secure session creation has failed 
+    * @since S60 3.2
+    * @param aSessionIndex Session which is to be created again non-securely
+    */
+    void CreateNonSecureSessionL( TInt aSessionIndex ); 
+
+    /**
+    * Creates new SVP out session
+    * @since Series 60 3.2
+    * @param aRecipient, Recipient address
+    * @param aVoIPProfile, VoIP profile entry
+    * @param aParameters, Call parameters
+    * @param aObserver, Observer
+    * @return MCCPCall 
+    */
+    MCCPCall* CreateNewSessionL( 
+        TDesC8& aRecipient, 
+        CRCSEProfileEntry& aVoipProfile, 
+        const CCCPCallParameters& aParameters,
+        const MCCPCallObserver& aObserver );
+    
+    /**
+    * Method for matching sessions.
+    * @since Series 60 3.2
+    * @param aSession Session object
+    * @return Index of session. Function calls panic if session is not found.
+    */
+    TInt FindSVPSession( const CMceSession& aSession ) const;
+    
+    /**
+    * Handles incoming sessions 
+    * @since Series 60 3.2
+    * @param aSession Session object
+    * @param aContainer In this case contains data concerning incoming session 
+    * @return 
+    */
+    void IncomingSessionHandlerL( CMceInSession* aSession,
+			                      TMceTransactionDataContainer* aContainer);
+			                   
+    /**
+    * Handles incoming session updates in case when it is not hold case,
+    * e.g. in codec renegotiation case
+    * @param aOrigSession, the original session to be updated. 
+    *        This instance cannot be used anymore, 
+    *        all actions done using aUpdatedSession instance.
+    * @param aUpdatedSession, the new updated session.
+	* @return
+    */
+    void UpdateSessionL( CMceSession& aOrigSession,
+                         CMceInSession& aUpdatedSession );
+
+   	/**
+    * Audio codecs are set in existing stream.
+    * If there isn't existing stream, new stream will be created.
+    * @since Series 60 3.2
+    * @param aVoIPProfile VoIP profile entry
+    * @param aMtSession MtSession object.
+    * @return 
+    */
+    void CheckStreamsL( CRCSEProfileEntry& aVoipProfile, 
+                        CMceSession& aMtSession,
+                        TInt aKeepAliveValue,
+                        TBool aSessionUpdateOngoing = EFalse );
+
+    /**
+    * Extract call id from user headers.
+    * @since S60 3.2
+    * @param aUserHeaders   User headers.
+    * @param aCallId        On completion, contains call id.
+    * @return ETrue if text Replaces: found, else EFalse
+    * @leave KErrArgument if header doesn't include colonmarks.
+    */
+    TBool GetCallIdFromUserHeadersL( const CDesC8Array& aUserHeaders,
+                                   TDes8& aCallId );
+
+    /**
+    * Check is incoming session transfer target case or normal incoming call.
+    * @since S60 3.2
+    * @param aHeaders Headers of incoming session. 
+    */
+    void IsTransferTargetCaseL( CDesC8Array* aHeaders );
+    
+    /**
+     * Check Supported and Require headers if Provisional Response
+     * ACKnowledgement (PRACK) method is supported for Preconditions.
+     * @since S60 3.2
+     * @param aHeaders Headers of incoming session
+     * @return ETrue if Precondition is required and PRACK is supported, else EFalse
+     */
+    TBool IsPreconditionRequired( CDesC8Array& aHeaders );
+
+    /**
+    * Check and store data (FromHeader, ToHeader, CallId) from the headers
+    * to the SessionBase, if CallId not already existing.
+    * @since Series 60 3.2
+    * @param aSVPSession
+    * @param aContainer Contains data concerning changed session  
+    */
+    void CheckHeadersData( CSVPSessionBase* aSVPSession,
+                           TMceTransactionDataContainer* aContainer );
+
+    /**
+    * Check and store contact data from the headers to the MoSession
+    * @since Series 60 3.2
+    * @param aSVPSession
+    * @param aContainer Contains data concerning changed session  
+    */
+    TInt CheckContactData( CSVPSessionBase* aSVPSession, 
+                                TMceTransactionDataContainer* aContainer );
+
+    /**
+    * Handles incoming refers 
+    * @since Series 60 3.2
+    * @param aRefer coming refer
+    * @param aReferTo Refer-to header.
+    * @param aContainer In this case contains data concerning incoming session 
+    * @return void
+    */
+    void IncomingReferHandlerL( CMceInRefer* aRefer,
+                                    const TDesC8& aReferTo,
+                                    TMceTransactionDataContainer* aContainer);
+
+    /**
+    * Creates new SVP out session in transfer case
+    * @since Series 60 3.2
+    * @param aSessionIndex, SVP session index, receiver of refer.
+    * @param aAttended, ETrue if attended EFalse if unattended
+    */
+    void CreateNewTransferSessionL( 
+        TInt aSessionIndex,
+        TBool aAttended );
+
+    /**
+    * Handles 3xx call forward events
+    * @since Series 60 3.2
+    * @param aStatusCode Call forward response code
+    * @param aSessionIndex SVP session index
+    * @param aContainer Contains data concerning changed session  
+    */
+    void HandleCallForward( TInt aStatusCode,
+                            TInt aSessionIndex, 
+                            TMceTransactionDataContainer* aContainer );
+    
+    /**
+     * Finalizes the session creation. Adds DTMF observer to created session
+     * and adds the session into the session array.
+     * @since S60 v3.2
+     * @param aSession Session whose construction to finalize.
+     * @return void
+     */
+    void FinalizeSessionCreationL( CSVPSessionBase* aSession );
+    
+    /**
+     * Executes 'ErrorOccurred' callback(Cb) to CCP Monitor if not NULL.
+     * @since S60 v3.2
+     * @param aError the error code
+     * @return System wide error code.
+     */
+    TInt ExecCbErrorOccurred( MCCPObserver::TCCPError aError );
+    
+    /**
+     * Executes 'IncomingCall' callback(Cb) to CCP Monitor if not NULL.
+     * @since S60 v3.2
+     * @param aCall Pointer to the newly created incoming call.
+     * @return System wide error code.
+     */
+    TInt ExecCbIncomingCall( MCCPCall* aCall );
+    
+    /**
+     * Executes 'IncomingCall' callback(Cb) to CCP Monitor if not NULL.
+     * @since S60 v3.2
+     * @param aCall Pointer to the newly created incoming call.
+     * @param aTempCall Reference to the held call.
+     * @return System wide error code.
+     */
+    TInt ExecCbIncomingCall( MCCPCall* aCall, MCCPCall& aTempCall );
+    
+    /**
+     * Executes 'CallCreated' callback(Cb) to CCP Monitor if not NULL.
+     * @since S60 v3.2
+     * @param aNewTransferCall The call that has been created with the new transfer target.
+     * @param aOriginator Pointer to originator of the transfer request.
+     * @param aAttended Transfer requested was attented (ETrue) or un-attented(EFalse)
+     * @return System wide error code.
+     */
+    TInt ExecCbCallCreated( MCCPCall* aNewTransferCall, MCCPCall* aOriginator, TBool aAttended );
+
+    /**
+    * Evaluates and removes the Dual-tone multi-frequency (DTMF) part from recipient's number.
+    * Leaves with KErrArgument if invalid argument given.
+    * @since S60 3.2
+    * @param aRecipient The address/number to be evaluated, a non-modifiable descriptor.
+    * @return Pointer to the modified recipient address/number heap descriptor. 
+    */
+    HBufC* ParseRecipientDtmfSuffixL( const TDesC& aRecipient ) const;
+
+    /**
+    * Checks that the given recipient address/number contains only valid DTMF characters.
+    * Called from ParseRecipientDtmfSuffixL method.
+    * Leaves with KErrArgument if invalid argument given.
+    * @since S60 3.2
+    * @param aRecipient The address/number to be checked, a non-modifiable descriptor.
+    * @return ETrue when aRecipient contains only valid dtmf chars, EFalse if not.
+    */
+    TBool IsValidDtmfRecipientL( const TDesC& aRecipient ) const;
+
+    /**
+    * Checks what call event will be sent after attended transfer cases.
+    * @since S60 3.2
+    * @param aNewSVPSession The new established session.
+    * @param aOldSVPSession The old transfered session.
+    */
+    void CSVPController::CheckCallEventToBeSent( CSVPSessionBase* aNewSVPSession, 
+                                                 CSVPSessionBase* aOldSVPSession ) const;
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPController();
+    
+    /**
+    * second-phase constructor
+    */
+    void ConstructL();
+    
+private: // data
+    
+    /**
+     * pointer to Mce manager
+     */
+    CMceManager* iMceManager;
+    
+    /*
+     * instance of SVP utility class.
+     * own.
+     */
+    CSVPUtility* iSVPUtility;
+    
+    /**
+     * transaction container, holds detailed data about transaction
+     * TMceTransactionDataContainer* iTransactionDataContainer;
+     */
+    TMceTransactionDataContainer iContainer;
+    
+    /**
+     * array of created SVP sessions
+     */
+    RPointerArray< CSVPSessionBase > iSessionArray;
+    
+    /**
+     * pointer to created SVP emergency session
+     */
+    CSVPEmergencySession* iEmergencySession;
+    
+    /**
+     * CCP observer
+     */
+    MCCPObserver* iCCPMonitor;
+    
+    /**
+     * CCP Supplementary Services observer
+     */
+    MCCPSsObserver* iCCPSsObserver;
+    
+    /**
+     * CCP session observer
+     */ 
+    MCCPCallObserver* iCCPSessionObserver;
+    
+    /**
+     * CCP DTMF observer
+     */
+    const MCCPDTMFObserver* iCCPDtmfObserver;
+    
+    /**
+     * Terminal type
+     */
+    TBuf< KSVPMaxTerminalTypeLength > iTerminalType;
+
+    /**
+     * WLAN MAC address
+     */
+    TBuf< KSVPWlanMacAddressLength > iWlanMacAddress;
+    
+    /**
+     * Hold call index in attended transfer target case.
+     */
+    TInt32 iHoldCallIndex;
+    
+    /**
+     * Original call index in transfer case.
+     */
+    TInt32 iIncomingReferCallIndex;
+    
+    /**
+     * Untried profile IDs for emergency call
+     */
+    RArray<TUint32> iEmergencyProfileIds;
+    
+    /**
+     * Untried IAP IDs for emergency call
+     */
+    RArray<TUint> iEmergencyIapIds;
+
+    /**
+     * Flag to indicate that Dtmf string sending is started
+     * This is needed, because Mce provides only two Dtmf events
+     */
+    TBool iDtmfStringSending;
+    
+    /**
+     * Flag to indicate first character of the Dtmf string is send
+     * This is needed, because Mce provides only two Dtmf events
+     */
+    TBool iFirstDtmfSent;
+    
+    /**
+     * Supplementary services.
+     * Own.
+     */
+    CSVPSupplementaryServices* iSuppServices;
+    
+    /**
+     * Flag for prevent wrong handling after SessionStateChanged -callback
+     * in MT Re-Invite case that is not hold/resume. ETrue when e.g. codec
+     * renegotiation ongoing, EFalse otherways
+     */
+    TBool iSessionUpdateOngoing;
+
+    /**
+     * Flag that indicates that handling of hold re-INVITE 
+     * without is SDP is ongoing
+     */
+    TBool iEmptyReInvite;
+    
+    /**
+     * This flag is set after Failed() callback is received to
+     * prevent handling of subsequent state change callbacks
+     * because session termination started when Failed() was received 
+     */
+    TBool iFailed;
+    
+    /**
+     * RTP observer
+     * Own
+     */
+    CSVPRtpObserver* iRtpObserver;
+    
+    /**
+     * Contains single DTMF tone sent. Used with outband 
+     */ 
+    TChar iDtmfTone;
+    
+    /**
+     * Contains DTMF string sent. Used with outband DTMF 
+     */
+    HBufC* iDtmfString;
+    
+    /** 
+     * Keeps count of the current tone sent. Used with outband DTMF 
+     */
+    TLex iDtmfStringLex;
+    
+    /**
+     * This flag is set ETrue if preconditions are required in SIP headers 
+     */
+    TBool iPreconditions;
+
+    /**
+     * WLAN management client used for creating virtual WLAN traffic streams. 
+     * Own.
+     */
+    CWlanMgmtClient* iWlanMgmt;
+
+    /**
+     * ID of the created WLAN virtual traffic stream during an MO call.
+     */
+    TUint iTrafficStreamId;
+
+    /**
+     * This flag is used for stream creation/deletion logic during an MO call.
+     */
+    TBool iTrafficStreamCreated;
+   
+private:
+    
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif // CSVPTRANSFERCONTROLLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpdtmfeventgenerator.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,129 @@
+/*
+* 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:  Generates DTMF events in Inband DTMF   
+*
+*/
+
+
+
+#ifndef SVPDTMFEVENTGENERATOR_H
+#define SVPDTMFEVENTGENERATOR_H
+
+#include <e32base.h>
+#include "svputdefs.h"
+
+class MSVPDTMFEventObserver;
+
+/**
+ *  SVP DTMF event generator
+ *  Generates DTMF events when sending Inband string sequence
+ *
+ *  @lib 
+ *  @since S60 3.2
+ */
+class CSVPDTMFEventGenerator : public CActive 
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSVPDTMFEventGenerator* CSVPDTMFEventGenerator::NewL( MSVPDTMFEventObserver& aObserver );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CSVPDTMFEventGenerator();
+
+public: // new methods
+
+    /**
+     * Starts sending DTMF events
+     * @Since S60 3.2
+     * @return void
+     */   
+    void StartDtmfEvents( TInt aStringLength, TBool aPause = EFalse );
+    
+    /**
+     * Stops the timer.
+     * @since Series 60 3.2
+     * @return 
+     */
+    void StopEvents();
+ 
+protected: // methods from base classes
+
+    /**
+     * @see CActive
+     */
+    void RunL();
+    
+    /**
+     * @see CActive
+     */
+    void DoCancel();
+    
+    /**
+     * @see CActive
+     */
+    TInt RunError( TInt aError );
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CSVPDTMFEventGenerator( MSVPDTMFEventObserver& aObserver );
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private: // data
+    
+    /**
+     * Reference to the DTMF observer.
+     */
+    MSVPDTMFEventObserver& iObserver;
+    
+    /** 
+     * Holds the length of the string to be sent
+     */ 
+    TInt iStringLength;
+   
+    /**
+     * Reference to RTimer 
+     */
+    RTimer iTimer;
+     
+    /**
+     * Flag which determines if start event is sent
+     * Needed for event sending logic when sending DMTF string
+     */  
+    TBool iStartSent;
+    
+    /**
+     * Pause flag determines, whether pause should be activated
+     */
+    TBool iPause;
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif // SVPDTMFEVENTGENERATOR_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpdtmfeventobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* 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:  Event observer for CSVPDTMFEventGenerator
+*
+*/
+
+
+#ifndef MSVPDTMFEVENTOBSERVER_H
+#define MSVPDTMFEVENTOBSERVER_H
+
+/**
+ * Enumeration for describing different SVP DTMF events
+ */
+enum TSVPDtmfEvent
+    {
+    ESvpDtmfSendStarted,
+    ESvpDtmfSendStopped,
+    ESvpDtmfSendCompleted
+    };
+
+/**
+ *  Event observer for CSVPDTMFEventGenerator
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class MSVPDTMFEventObserver
+    {
+    
+public:
+    
+    /**
+     * Called when a DTMF event needs to be sent CCE
+     * @since S60 v3.2
+     * @retun void
+     */
+    virtual void InbandDtmfEventOccurred( TSVPDtmfEvent aEvent ) = 0;
+				
+    };
+
+#endif // SVPDTMFEVENTOBSERVER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpemergencyconnection.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,168 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 connection for emergency call when necessary
+*
+*/
+
+
+#ifndef C_SVPEMERGENCYCONNECTION_H
+#define C_SVPEMERGENCYCONNECTION_H
+
+
+#include <es_sock.h>                // For RSocketServ, RConnection
+#include <commdbconnpref.h>         // For TCommDbConnPref
+#include <comms-infras/es_config.h> // For TSipServerAddrBuf
+
+#include "svpemergencyconnectionobserver.h"
+#include "svputdefs.h"
+
+/**
+ *  Connection for emergency call.
+ *  Asynchronous services: IAP and SNAP connect, retrieval of used IAP ID of 
+ *  SNAP connection, and retrieval of SIP proxy address.
+ *
+ *  @lib svp.dll
+ *  @since S60 v3.2
+ */
+class CSVPEmergencyConnection : public CActive
+    {
+
+public:
+
+    /** Request type */
+    enum TSVPRequestType
+        {
+        ESVPNone, 
+        ESVPSnapConnect, 
+        ESVPConnect, 
+        ESVPSipProxyAddress,
+        ESVPSipDomainAddress
+        };
+
+    /**
+     * Two-phased constructor.
+     * @param aPriority Active object priority
+     * @param aObserver Observer
+     */
+    static CSVPEmergencyConnection* NewL( 
+        TPriority aPriority, MSVPEmergencyConnectionObserver& aObserver );
+    
+    static CSVPEmergencyConnection* NewLC( 
+        TPriority aPriority, MSVPEmergencyConnectionObserver& aObserver );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CSVPEmergencyConnection();
+
+    /**
+     * Connects with SNAP ID
+     *
+     * @since S60 v3.2
+     * @param aSnapId SNAP ID
+     */
+    void ConnectWithSnapIdL( TUint32 aSnapId );
+
+    /**
+     * Returns the IAP ID used by the SNAP connection
+     *
+     * @since S60 v3.2
+     * @param aIapId IAP ID 
+     * @return Error code
+     */
+    TInt IapId( TUint32& aIapId );
+
+    /**
+     * Connects with IAP ID
+     *
+     * @since S60 v3.2
+     * @param aIapId IAP ID 
+     */
+    void ConnectL( TUint32 aIapId );
+
+    /**
+     * Requests for SIP proxy address
+     *
+     * @since S60 v3.2
+     * @param aIapId IAP ID
+     */
+    void RequestSipProxyAddressL( TUint32 aIapId );
+
+private:
+
+    CSVPEmergencyConnection( 
+        TPriority aPriority, MSVPEmergencyConnectionObserver& aObserver );
+
+    void ConstructL();
+    
+// from base class CActive
+
+    void DoCancel();
+    
+    void RunL();
+    
+    TInt RunError( TInt aError );
+    
+    void RequestSipServerDomainL();
+    
+private: // data
+
+    /**
+     * Observer
+     */
+    MSVPEmergencyConnectionObserver& iObserver;
+
+    /**
+     * Request type
+     */
+    TSVPRequestType iRequestType;
+
+    /**
+     * Snap connection preference
+     */    
+    TCommSnapPref iSnapConnPref;
+
+    /**
+     * Connection preference overrider
+     */
+    TCommDbConnPref iConnPref;
+    
+    /**
+     * SIP server address buffer
+     */
+    TSipServerAddrBuf iSipServerAddrBuf;
+    
+    /**
+     * SIP server domain name buffer
+     */
+    TSipServerDomainBuf iSipServerDomainBuf;
+
+    /**
+     * Connection
+     */
+    RConnection iConnection;
+
+    /**
+     * Socket server
+     */
+    RSocketServ iSocketServer;
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+
+    };
+
+#endif // C_SVPEMERGENCYCONNECTION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpemergencyconnectionobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Observes emergency connection
+*
+*/
+
+
+#ifndef M_SVPEMERGENCYCONNECTIONOBSERVER_H
+#define M_SVPEMERGENCYCONNECTIONOBSERVER_H
+
+
+/**
+ *  Observes emergency connection.
+ *  Observes: SNAP connected, IAP connected, SIP proxy address ready, and 
+ *  error occurred.
+ *
+ *  @lib svp.dll
+ *  @since S60 v3.2
+ */
+class MSVPEmergencyConnectionObserver
+    {
+
+public:
+
+    /**
+     * Notifies observer that SNAP connection is established
+     *
+     * @since S60 3.2
+     */
+    virtual void SnapConnected() = 0;
+
+    /**
+     * Notifies observer that IAP connection is established
+     *
+     * @since S60 3.2
+     */
+    virtual void Connected() = 0;
+
+    /**
+     * Notifies observer that SIP proxy address is ready
+     *
+     * @since S60 3.2
+     * @param aAddress SIP proxy address
+     */
+    virtual void SipProxyAddressReady( const TDesC16& aAddress ) = 0;
+
+    /**
+     * Notifies observer that error has occurred
+     *
+     * @since S60 3.2
+     * @param aError Symbian error code
+     */
+    virtual void ConnectionError( TInt aError ) = 0;
+
+    };
+
+#endif // M_SVPEMERGENCYCONNECTIONOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpemergencyiapprovider.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Provides IAP IDs for emergency
+*
+*/
+
+
+#ifndef C_SVPEMERGENCYIAPPROVIDER_H
+#define C_SVPEMERGENCYIAPPROVIDER_H
+
+#include <rconnmon.h> // For RConnectionMonitor
+#include "svputdefs.h"
+
+/**
+ *  Provides IAP IDs by using RConnectionMonitor
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPEmergencyIapProvider : public CActive
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aPriority Active object priority
+     */
+    static CSVPEmergencyIapProvider* NewL( TPriority aPriority );
+    
+    static CSVPEmergencyIapProvider* NewLC( TPriority aPriority );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CSVPEmergencyIapProvider();
+
+    /**
+     * Requests for IAP IDs
+     *
+     * @since S60 3.2
+     * @param aIapIds Array of IAP IDs to be filled
+     * @return Error code
+     */
+    TInt RequestIapIds( RArray<TUint>& aIapIds );
+
+private:
+
+    CSVPEmergencyIapProvider( TPriority aPriority );
+
+    void ConstructL();
+    
+// from base class CActive
+
+    void DoCancel();
+    
+    void RunL();
+    
+private: // data
+
+    /**
+     * Contains IAP info when request complete
+     */
+    TConnMonIapInfoBuf iIapInfoBuf;
+
+    /**
+     * Contains error code of request
+     */
+    TInt iError;
+    
+    /**
+     * Connection monitor
+     */        
+    RConnectionMonitor iConnectionMonitor;
+
+    /**
+     * Wait object.
+     * Own.
+     */
+    CActiveSchedulerWait* iWait;
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif // C_SVPEMERGENCYIAPPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpemergencysession.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,730 @@
+/*
+* 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:  Class representing the emergency session
+*
+*/
+
+
+
+#ifndef SVPEMERGENCYSESSION_H
+#define SVPEMERGENCYSESSION_H
+
+#include <sipprofileregistryobserver.h>
+#include <sipobserver.h>
+
+#include <mccpemergencycall.h>
+#include <mccpcallobserver.h>
+#include <ccpdefs.h>    // error definitions
+#include <mceoutsession.h>
+
+#include "svplogger.h"
+#include "svptimer.h"
+#include "svptimerobserver.h"
+#include "svppositioningproviderobserver.h"
+#include "svpemergencyconnectionobserver.h"
+#include "svpholdobserver.h"
+#include "svpdtmfeventobserver.h"
+#include "svputdefs.h"
+
+class MCCPCallObserver;
+class CSVPUtility;
+class CSIP;
+class CSIPProfileRegistry;
+class CRCSEProfileEntry;
+class CSVPPositioningProvider;
+class CSVPEmergencyConnection;
+class TMceTransactionDataContainer;
+class CSVPHoldController;
+class MCCPDTMFObserver;
+class CSVPDTMFEventGenerator;
+
+
+/**
+ *  Class that handles emergency sessions
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPEmergencySession : public CBase,
+                             public MCCPEmergencyCall, 
+                             public MSIPObserver,
+                             public MSIPProfileRegistryObserver, 
+                             public MSVPTimerObserver, 
+                             public MSVPPositioningProviderObserver, 
+                             public MSVPEmergencyConnectionObserver, 
+                             public MSVPHoldObserver, 
+                             public MSVPDTMFEventObserver
+    {
+
+public:
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPEmergencySession* NewL( CMceManager& aMceManager, 
+                                       TUint32 aVoipProfileId, 
+                                       const TDesC& aAddress,
+                                       const MCCPCallObserver& aObserver,
+                                       CSVPUtility& aSVPUtility, 
+                                       TBool aIsLastProfile, 
+                                       TBool aIsDummy = EFalse );
+
+    /**
+    * Two-phased constructor for creating IAP session.
+    */
+    static CSVPEmergencySession* NewL( CMceManager& aMceManager, 
+                                       const TDesC& aAddress,
+                                       const MCCPCallObserver& aObserver,
+                                       CSVPUtility& aSVPUtility, 
+                                       TUint32 aIapId, 
+                                       TBool aIsLastProfile, 
+                                       TBool aIsDummy = EFalse );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPEmergencySession();
+
+    /**
+	* Returns CCP call state
+	* @since S60 3.2
+	* @return CCP call state
+	*/
+    MCCPCallObserver::TCCPCallState State() const;
+    
+    /**
+	* Traps SessionStateChangedL
+    * @since S60 3.2
+	* @param aStatusCode Status code to be handled
+	*/
+    void SessionStateChanged( TInt aStatusCode );
+    
+    /**
+	* Session connection state changed
+	* @since S60 3.2
+	* @param aSession SIP session
+	* @param aActive  SIP connection state, ETrue if up, EFalse otherwise
+	*/
+    void SessionConnectionStateChanged( 
+        CMceSession& aSession, TBool aActive );
+
+    /**
+	* Handles stream state changes
+    * @since S60 3.2
+	* @param aStream Stream that has changed
+	*/
+    void StreamStateChanged( CMceMediaStream& aStream );
+
+    /**
+    * Handles remote action after session is established, i.e. hold
+    * @since Series60 3.2
+    * @param aUpdatedSession
+    * @param aContainer MCE transaction container
+    */
+    void IncomingRequestL( CMceInSession* aUpdatedSession, 
+                           TMceTransactionDataContainer aContainer );
+
+    /**
+    * Returns ETrue, if hold controller exists
+    * @since Series60 3.2
+    * @return ETrue if hold controller exists
+    */
+    TBool HasHoldController() const;
+
+    /**
+    * Returns reference to hold controller
+    * @since Series60 3.2
+    * @return ETrue Refenrence to hold controller
+    */    
+    CSVPHoldController& CSVPEmergencySession::HoldController() const;
+
+    /**
+    * Handles hold session state changes
+    * @since Series60 3.2
+    * @param aSession MCE session
+    */    
+    void HoldSessionStateChangedL( CMceSession& aSession );
+
+    /**
+    * Gets CCP DTMF observer 
+    * @since Series 60 3.2
+    * @return MCCPDTMFObserver CCP DTMF observer
+    */
+    const MCCPDTMFObserver& DtmfObserver();
+
+    /**
+    * Sets CCP DTMF observer to session
+    * @since Series 60 3.2
+    * @param aObserver Observer
+    */
+    void SetDtmfObserver( const MCCPDTMFObserver& aObserver );
+
+	/**
+	* Starts the transmission of a single DTMF tone across a
+	* connected and active call.
+	* @since S60 3.2
+	* @param aTone Tone to be played.
+	* @return Error code
+	*/
+	TInt StartDtmfTone( const TChar aTone );
+
+	/**
+	* Stops playing current DTMF tone.
+	* @since S60 3.2
+	* @return Error code
+	*/
+	TInt StopDtmfTone();
+
+	/**
+	* Plays DTMF string.
+	* @since S60 3.2
+	* @param aString String to be played.
+	* @return Error code
+	*/
+	TInt SendDtmfToneString( const TDesC& aString );  
+
+    /**
+	* Cancels asynchronous DTMF string sending.
+	* @since Series 60 3.2
+	* @return Error code
+	*/
+	TInt CancelDtmfStringSending();
+
+
+// from base class MCCPEmergencyCall
+
+ 	/**
+	* Creates an emergency call
+	* @since S60 3.2
+	* @param aRecipient, not used
+    * @return KErrNone or system wide error code
+	*/
+	TInt Dial( const TDesC& aRecipient );
+
+	/**
+	* Cancels ongoing dial request
+	* @since S60 3.2
+	* @return KErrNone or system wide error code
+	*/
+	TInt Cancel();
+
+	/**
+	* Ends an ongoing call
+	* @since S60 3.2
+	* @return KErrNone or system wide error code
+	*/
+	TInt HangUp();
+
+	/**
+	* Answers to an incoming call.
+	* @since S60 3.2
+	* @return KErrNone or system wide error code
+	*/
+	TInt Answer();
+	
+
+// from base class MSVPTimerObserver
+    
+    /**
+    * Notifies, that the previously set timer has now expired.
+    * Implemented by the class using the timer.
+    * @since Series 60 3.2
+    * @param aTimerId The ID of the timer. Observer can identify 
+    *        timers from each other with this ID.
+    */
+    void TimedOut( TInt aTimerId );
+
+
+// from base class MSIPObserver
+
+    /**
+    * From MSIPObserver A SIP request has been received from the network. 
+    * @since  Series 60 3.0
+    * @param  aIapId The IapId from which the SIP request was received.  
+    * @param  aTransaction Contains local address, remote address of a sip
+    *         message, as well as optional SIP message method, headers and 
+    *         body. The ownership is transferred.  
+    */
+     void IncomingRequest( TUint32 aIapId, 
+                           CSIPServerTransaction* aTransaction );
+
+    /**
+    * From MSIPObserver The received SIP request time-outed and it has been
+    * destroyed.  
+    * @since  Series 60 3.0
+    * @param  aSIPServerTransaction The time-outed transaction. Ownership is
+    *         not transferred. 
+    */
+     void TimedOut( CSIPServerTransaction& aSIPServerTransaction );
+
+     
+// from base class MSIPProfileRegistryObserver
+
+    /**
+    * From MSIPProfileRegistryObserver An asynchronous error has occurred
+    * related to SIP profile Event is send to those observers, who have the
+    * corresponding profile instantiated. 
+    * @since  Series 60 3.0
+    * @param  aSIPProfileId SIP Profile ID. 
+    * @param  aError Error code. 
+    */ 
+     void ProfileRegistryErrorOccurred( TUint32 aSIPProfileId,
+                                        TInt aError );
+    
+    /**
+    * From MSIPProfileRegistryObserver An event related to SIP Profile has
+    * occurred.
+    * @since  Series 60 3.0
+    * @param  aProfileId SIP Profile ID. 
+    * @param  aEvent An occurred event.
+    */ 
+    void ProfileRegistryEventOccurred( TUint32 aProfileId,
+                                       TEvent aEvent ); 
+
+
+// from base class MSVPPositioningProviderObserver
+    
+    /**
+     * Handles successful positioning requests
+     *
+     * @since S60 3.2
+     * @param aPosition Acquired position information
+     */
+    void PositioningRequestComplete( const TDesC8& aPosition );
+    
+    /**
+     * Handles failed positioning requests
+     *
+     * @since S60 3.2
+     * @param aError Symbian error code
+     */
+    void PositioningErrorOccurred( TInt aError );
+
+
+// from base class MSVPEmergencyConnectionObserver
+
+    /**
+     * SNAP connection is established
+     *
+     * @since S60 3.2
+     */
+    void SnapConnected();
+    
+    /**
+     * IAP connection is established
+     *
+     * @since S60 3.2
+     */    
+    void Connected();
+
+    /**
+     * SIP proxy address is ready
+     *
+     * @since S60 3.2
+     * @param aAddress SIP proxy address
+     */    
+    void SipProxyAddressReady( const TDesC16& aAddress );
+
+    /**
+     * Connection error has occurred
+     *
+     * @since S60 3.2
+     * @param aError Symbian error code
+     */    
+    void ConnectionError( TInt aError );
+
+
+// from base class MSVPHoldObserver
+
+    /**
+    * Notifies, that session has been holded.
+    * @since Series 60 3.2
+    */
+    void SessionLocallyHeld();
+
+    /**
+    * Notifies, that session has been resumed.
+    * @since Series 60 3.2
+    */
+    void SessionLocallyResumed();
+    
+    /**
+    * Notifies, that session has been remotely held.
+    * @since Series 60 3.2
+    */
+    void SessionRemoteHeld();
+
+    /**
+    * Notifies, that session has been remotely resumed.
+    * @since Series 60 3.2
+    */
+    void SessionRemoteResumed();
+    
+    /**
+    * Notifies, that hold request failed.
+    * @since Series 60 3.2
+    */
+    void HoldRequestFailed();
+
+    /**
+    * Notifies, that resume request failed.
+    * @since Series 60 3.2
+    */
+    void ResumeRequestFailed();
+
+
+// from base class MSVPDTMFEventObserver
+
+    /**
+    * Sends DTMF events to CCE
+    * @since S60 v3.2
+    * @param aEvent DTMF event
+    */
+    void InbandDtmfEventOccurred( TSVPDtmfEvent aEvent );
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPEmergencySession( CSVPUtility& aSVPUtility, 
+                          CMceManager& aMceManager, 
+                          TBool aIsLastProfile, 
+                          TBool aIsDummy );
+
+    /**
+    * second-phase constructor
+    */
+    void ConstructL( TUint32 aVoipProfileId, 
+                     const TDesC& aAddress,
+                     const MCCPCallObserver& aObserver, 
+                     TBool aIsDummy );
+
+    /**
+    * Second-phase constructor for IAP session
+    */
+    void ConstructWithIapIdL( TUint32 aIapId, 
+                              const TDesC& aAddress,
+                              const MCCPCallObserver& aObserver, 
+                              TBool aIsDummy );
+
+    /**
+	* Continues IAP EC construction
+    * @since S60 3.2
+	* @param aSipProxyAddress SIP proxy address
+	*/
+    void ContinueConstructWithIapIdL( const TDesC16& aSipProxyAddress );
+
+ 	/**
+	* Deletes failed MCE session and creates a new one without LI. Used when 
+	* 415 Unsupported Media Type received.
+	* @since S60 3.2
+	*/    
+    void CreateNonLISessionL();
+
+ 	/**
+ 	* Creates unregistered MCE session
+	* @since S60 3.2
+	*/    
+    void CreateUnregistedSessionL();
+
+    /**
+	* Handles emergency session state change
+    * @since S60 3.2
+	* @param aStatusCode Status code to be handled
+	*/
+    void SessionStateChangedL( TInt aMceStatusCode );
+
+ 	/**
+	* Determines if dialing can be proceeded
+	* @since S60 3.2
+	*/
+    void ProceedDial();    
+
+ 	/**
+	* Establishes an emergency call
+	* @since S60 3.2
+	*/
+    void DialL();
+
+    /**
+    * Constructs audiostreams for emergency session
+    * @since Series 60 3.2
+    */   
+    void ConstructAudioStreamsL();
+
+    /**
+    * Sets keep-alive value
+    * @since Series 60 3.2
+    */   
+    void SetKeepAlive();
+
+    /**
+    * Updates keepalive parameters for MCE session
+    * @since Series 60 3.2 
+    */
+    void UpdateKeepAliveL();
+    
+    /**
+     * Method for checking audio priorities in audio streams. Method checks
+     * that correct audio priorities are used in inband/outband DTMF cases and
+     * sets them accordingly to uplink side codecs.
+     * @since S60 3.2
+     * @param aAudioStreams Media streams of MCE session
+     */
+    void CheckMmfPrioritiesForDtmfL( 
+        const RPointerArray<CMceMediaStream>& aAudioStreams ) const;
+
+    /**
+    * Starts SVP timer
+    * @since Series 60 3.2
+    * @param aMilliSeconds Timeout
+    * @param aTimerId Timer ID
+    */
+    void StartTimerL( TInt aMilliSeconds, TInt aTimerId );
+
+    /**
+    * Stop timer
+    * @since Series 60 3.2
+    * @param aTimerId Timer ID
+    */
+    void StopTimer( TInt aTimerId );
+    
+    /**
+    * Stops started timers
+    * @since Series 60 3.2
+    */
+    void StopTimers();
+
+    /**
+    * Notify client about an error. ECCPEmergencyFailed if it is the last try 
+    * of this plugin, normal CCP error otherwise.
+    * @since Series 60 3.2
+    * @param aError CCP error
+    */
+    void ErrorOccurred( TCCPError aError );
+
+    /**
+     * Initializes position provider and requests for position information. 
+     * Traps leaves of RequestPositionL because emergency call must not fail 
+     * due to this feature.
+     *
+     * @since S60 3.2
+     * @param aIapId IAP ID
+     */
+    void RequestPosition( TUint32 aIapId );
+
+    /**
+     * Initializes position provider and requests for position information.
+     *
+     * @since S60 3.2
+     * @param aIapId IAP ID
+     */
+    void RequestPositionL( TUint32 aIapId );
+
+    /**
+     * Requests for SIP proxy address
+     *
+     * @since S60 3.2
+     */
+    void RequestSipProxyAddressL();
+
+    /**
+     * Parses content ID from URI: removes "sip(s):" prefix, if one exists.
+     * @since S60 3.2
+     * @param aUri URI to be parsed
+     * @return Parsed content ID
+     */
+    HBufC8* ParseContentIdL( const TDesC8& aUri );
+
+    /**
+     * Parses cid: adds "cid:" prefix and brackets.
+     * @since S60 3.2
+     * @param aContentId Content ID to be parsed
+     * @return Parsed cid
+     */
+    HBufC8* ParseCidL( const TDesC8& aContentId );
+
+    
+private: // data
+
+    /**
+    * reference to SVP utility class
+    */ 
+    CSVPUtility& iSVPUtility;
+    
+    /**
+    * Reference to MCE manager
+    */     
+    CMceManager& iMceManager;
+
+    /**
+    * Contains current session state
+    */
+    MCCPCallObserver::TCCPCallState iSessionState;
+
+    /**
+    * VoIP profile ID, KErrNotFound if creating an IAP session
+    */
+    TInt iVoipProfileId;
+
+    /**
+    * Id of SIP profile
+    */
+    TUint32 iSipProfileId;
+
+    /**
+    * IAP ID
+    */
+    TUint32 iIapId;
+
+    /**
+    * Session Expires value
+    */
+    TUint32 iSessionExpires;
+
+    /**
+    * Keep-alive value
+    */
+    TInt iKeepAlive;
+    
+    /**
+    * Indicates that this the last profile to be tried with this plugin. If it 
+    * fails, ECCPEmergencyFailed must be sent instead of normal error codes.
+    */
+    TBool iIsLastProfile;
+
+    /**
+    * Indicates that this session is dummy. ErrorOccurred is called on the 
+    * next CCP API operation.
+    */
+    TBool iIsDummy;
+
+    /**
+    * Indicates that Dial() has been called
+    */
+    TBool iIsDialed;
+
+    /**
+    * Indicates that LI request is ready
+    */
+    TBool iIsLIRequestReady;
+
+    /**
+    * Session timers, need an array since there migh be more than one.
+    */
+    RPointerArray< CSVPTimer > iTimers;
+
+    /**
+    * Pointer to CCP call observer
+    * Not own.
+    */
+    MCCPCallObserver* iEmergencyObserver;
+    
+    /**
+    * Pointer to created emergency session
+    * Own.
+    */
+    CMceSession* iEmergencySession;
+
+    /**
+    * Pointer to failed emergency session after received 415
+    * Own.
+    */    
+    CMceSession* iFailedEmergencySession;
+
+    /** 
+    * User AOR. Member data because it is needed for creating location 
+    * related SIP headers.
+    */ 
+    HBufC8* iUserAor;
+
+    /** 
+    * Recipient address.
+    * Own.
+    */ 
+    HBufC8* iAddress;
+
+    /** 
+    * Recipient URI. Member data because it is needed for creating location 
+    * related SIP headers.
+    * Own.
+    */ 
+    HBufC8* iRecipientUri;
+
+    /** 
+    * Positioning provider
+    * Own.
+    */ 
+    CSVPPositioningProvider* iPositioningProvider;
+        
+    /** 
+    * Position information
+    * Own.
+    */ 
+    HBufC8* iPositionInformation;
+
+    /** 
+    * Emergency connection.
+    * Own.
+    */ 
+    CSVPEmergencyConnection* iEmergencyConnection;
+
+    /** 
+    * Hold Controller.
+    * Own.
+    */ 
+    CSVPHoldController* iHoldController;
+
+    /** 
+    * Reference to DTMF observer.
+    * Not own.
+    */ 
+    MCCPDTMFObserver* iDtmfObserver;
+
+    /*
+    * DTMF event generator, used in inband dtmf case.
+    * Own.
+    */
+    CSVPDTMFEventGenerator* iDTMFEventGenerator;
+
+    /**
+     * Tone information. Updated everytime session state changes.
+     */
+    TCCPTone iTone;
+    
+    /** 
+     * Contains DTMF tone sent. Used with inband DTMF. 
+     */  
+    TChar iDtmfTone;
+       
+    /** 
+     * Contains DTMF string sent. Used with inband DTMF. 
+     */
+    HBufC* iDtmfString;
+       
+    /* 
+    * Keeps count of the current tone sent. Used with inband DTMF
+    */
+    TLex iDtmfLex;  
+    
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif // SVPEMERGENCYSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpforwardprovider.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,130 @@
+/*
+* 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:  Forward functionality provider
+*
+*/
+
+
+
+
+#ifndef C_SVPFORWARDPROVIDER_H
+#define C_SVPFORWARDPROVIDER_H
+
+
+#include <mccpforwardprovider.h>
+#include "svputdefs.h"
+
+class CSVPMoSession;
+
+/**
+ *  Forward functionality provider
+ *
+ *  ?more_complete_description
+ *
+ *  @lib svp.lib
+ *  @since S60 v3.2
+ */
+class CSVPForwardProvider : public CBase,
+                            public MCCPForwardProvider
+    {
+
+public:
+
+    static CSVPForwardProvider* NewL( CSVPMoSession& aSession );
+
+    virtual ~CSVPForwardProvider();
+
+
+// from base class MCCPForwardProvider
+
+    /**
+    * From MCCPForwardProvider.
+	* Returns pointer to array containing addresses to forward the call to.
+	* Index zero contains the first address. If there are no addresses available
+	* returns an empty array.
+	* @since Series 60 3.2
+	* @param none
+	* @return Reference to array containing addresses
+    * @leave KErrNotReady call is not in forwarding state
+    * @leave KErrNotAllowed if call is not mobile originated
+    * @leave system error code 
+    * @pre Call state is MCCPCallObserver::ECCPStateForwarding and call type is MO
+    * @pre Call MCCPForwardObserver::ECCPMultipleChoices event is received
+	*/
+	const CDesC8Array& GetForwardAddressChoicesL();
+
+	/**
+	* From MCCPForwardProvider.
+	* Forward call to address at given index.
+	* @since Series 60 3.2
+	* @param aIndex Index of address where the call is to be forwarded. Address is 
+	* found in the array received from GetForwardAddressChoicesL. Index starts from zero.
+	* @return none
+	* @leave KErrArgument Index is not in array
+    * @leave KErrNotReady Call is not in forwarding state
+    * @leave KErrNotAllowed If call is not mobile originated
+    * @pre Call state is MCCPCallObserver::ECCPStateForwarding and call type is MO
+    * @pre Call MCCPForwardObserver::ECCPMultipleChoices event is received
+	*/
+	void ForwardToAddressL( const TInt aIndex );
+	
+    /**
+    * From MCCPForwardProvider.
+    * Add an observer for forward related events.
+    * Currently CCE will set only one observer.
+    * @since S60 v3.2
+    * @param aObserver Observer
+    * @return none
+    * @leave system error if observer adding fails
+    */
+    void AddObserverL( const MCCPForwardObserver& aObserver );
+
+    /**
+    * From MCCPForwardProvider.
+    * Remove an observer.
+    * @since S60 v3.2
+    * @param none
+    * @param aObserver Observer
+    * @return KErrNone if removed succesfully. 
+    * @return KErrNotFound if observer was not found.
+    */
+    TInt RemoveObserver( const MCCPForwardObserver& aObserver );
+
+
+
+private:
+
+    CSVPForwardProvider();
+
+    void ConstructL( CSVPMoSession& aSession );
+
+private: // data
+
+
+    /**
+     * MO Session
+     * Not own.
+     */
+    CSVPMoSession* iMoSession;
+
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+
+#endif // C_SVPFORWARDPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svplanguagetagconsts.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,242 @@
+/*
+* 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:  Language tag constants for SVP.
+*
+*/
+
+
+
+#ifndef SVPLANGUAGETAGCONSTS_H
+#define SVPLANGUAGETAGCONSTS_H
+
+// Language tags, needed for mapping Symbian language codes
+// to language tags (ISO 639-1)
+_LIT8( KSVPLanguageTagEn, "en" ); // english 
+_LIT8( KSVPLanguageTagFr, "fr" ); // french
+_LIT8( KSVPLanguageTagDe, "de" ); // german
+_LIT8( KSVPLanguageTagEs, "es" ); // spanish
+_LIT8( KSVPLanguageTagIt, "it" ); // italian
+_LIT8( KSVPLanguageTagSv, "sv" ); // swedish
+_LIT8( KSVPLanguageTagDa, "da" ); // danish
+_LIT8( KSVPLanguageTagNo, "no" ); // norwegian
+_LIT8( KSVPLanguageTagFi, "fi" ); // finnish
+_LIT8( KSVPLanguageTagAmerican, "en" ); // american english
+_LIT8( KSVPLanguageTagSwissFrench, "fr" ); // swiss french
+_LIT8( KSVPLanguageTagSwissGerman, "de" ); // swiss german
+_LIT8( KSVPLanguageTagPt, "pt" ); // portugese
+_LIT8( KSVPLanguageTagTr, "tr" ); // turkish
+_LIT8( KSVPLanguageTagIs, "is" ); // icelandic
+_LIT8( KSVPLanguageTagRu, "ru" ); // russian
+_LIT8( KSVPLanguageTagHu, "hu" ); // hungarian
+_LIT8( KSVPLanguageTagNl, "nl" ); // dutch
+_LIT8( KSVPLanguageTagBelgianFlemish, "nl" ); // belgian flemish
+_LIT8( KSVPLanguageTagAustralian, "en" ); // australian english
+_LIT8( KSVPLanguageTagESVPLangBelgianFrench, "fr" ); // belgian french
+_LIT8( KSVPLanguageTagESVPLangAustrianGerman, "de" ); // austrian german
+_LIT8( KSVPLanguageTagESVPLangNewZealandEnglish, "en" ); // new zealand english
+_LIT8( KSVPLanguageTagESVPLangInternationalFrench, "fr" ); // international french
+_LIT8( KSVPLanguageTagCs, "cs" ); // czech
+_LIT8( KSVPLanguageTagSk, "sk" ); // slovak
+_LIT8( KSVPLanguageTagPl, "pl" ); // polish
+_LIT8( KSVPLanguageTagSl, "sl" ); // slovenian
+_LIT8( KSVPLanguageTagTaiwaneseChinese, "zh" ); // taiwanese chinese
+_LIT8( KSVPLanguageTagHongKongChinese, "zh" ); // hong kong chinese
+_LIT8( KSVPLanguageTagChinese, "zh" ); //  republic of china's chinese
+_LIT8( KSVPLanguageTagJa, "ja" ); // japanese
+_LIT8( KSVPLanguageTagTh, "th" ); // thai
+_LIT8( KSVPLanguageTagAf, "af" ); // afrikaans
+_LIT8( KSVPLanguageTagSq, "sq" ); // albanian
+_LIT8( KSVPLanguageTagAm, "am" ); // amharic
+_LIT8( KSVPLanguageTagAr, "ar" ); // arabic
+_LIT8( KSVPLanguageTagHy, "hy" ); // armenian
+_LIT8( KSVPLanguageTagTl, "tl" ); // tagalog
+_LIT8( KSVPLanguageTagBe, "be" ); // belarussian
+_LIT8( KSVPLanguageTagBn, "bn" ); // bengali
+_LIT8( KSVPLanguageTagBg, "bg" ); // bulgarian
+_LIT8( KSVPLanguageTagMy, "my" ); // burmese
+_LIT8( KSVPLanguageTagCa, "ca" ); // catalan
+_LIT8( KSVPLanguageTagHr, "hr" ); // croatian
+_LIT8( KSVPLanguageTagCanadianEnglish, "en" ); // canadian english
+_LIT8( KSVPLanguageTagInternationalEnglish, "en" ); // international english
+_LIT8( KSVPLanguageTagSouthAfricanEnglish, "en" ); // south african english
+_LIT8( KSVPLanguageTagEt, "et" ); // estonian
+_LIT8( KSVPLanguageTagFa, "fa" ); // farsi
+_LIT8( KSVPLanguageTagCanadianFrench, "fr" ); // canadian french
+_LIT8( KSVPLanguageTagGd, "gd" ); // gaelic
+_LIT8( KSVPLanguageTagKa, "ka" ); // georgian
+_LIT8( KSVPLanguageTagEl, "el" ); // greek
+_LIT8( KSVPLanguageTagCyprusGreek, "el" ); // cyprus greek
+_LIT8( KSVPLanguageTagGu, "gu" ); // gujarati
+_LIT8( KSVPLanguageTagHe, "he" ); // hebrew
+_LIT8( KSVPLanguageTagHi, "hi" ); // hindi
+_LIT8( KSVPLanguageTagId, "id" ); // indonesian
+_LIT8( KSVPLanguageTagGa, "ga" ); // irish
+_LIT8( KSVPLanguageTagSwissItalian, "it" ); // swiss italian
+_LIT8( KSVPLanguageTagKn, "kn" ); // kannada
+_LIT8( KSVPLanguageTagKk, "kk" ); // kazakh
+_LIT8( KSVPLanguageTagKm, "km" ); // khmer  
+_LIT8( KSVPLanguageTagKo, "ko" ); // korean
+_LIT8( KSVPLanguageTagLo, "lo" ); // lao
+_LIT8( KSVPLanguageTagLv, "lv" ); // latvian
+_LIT8( KSVPLanguageTagLt, "lt" ); // lithuanian
+_LIT8( KSVPLanguageTagMk, "mk" ); // macedonian
+_LIT8( KSVPLanguageTagMs, "ms" ); // malay
+_LIT8( KSVPLanguageTagMl, "ml" ); // malayam
+_LIT8( KSVPLanguageTagMr, "mr" ); // marathi
+_LIT8( KSVPLanguageTagMo, "mo" ); // moldovian
+_LIT8( KSVPLanguageTagMn, "mn" ); // mongolian
+_LIT8( KSVPLanguageTagNorwegianNynorsk, "no" ); // norwegian nynorsk
+_LIT8( KSVPLanguageTagBrazilianPortugese, "pt" ); // brazilian portugese
+_LIT8( KSVPLanguageTagPa, "pa" ); // punjabi
+_LIT8( KSVPLanguageTagRo, "ro" ); // romanian
+_LIT8( KSVPLanguageTagSr, "sr" ); // serbian
+_LIT8( KSVPLanguageTagSi, "si" ); // sinhalese
+_LIT8( KSVPLanguageTagSo, "so" ); // somali
+_LIT8( KSVPLanguageTagInternationalSpanish, "es" ); // international spanish
+_LIT8( KSVPLanguageTagAmericanSpanish, "es" ); // american spanish
+_LIT8( KSVPLanguageTagSw, "sw" ); // swahili
+_LIT8( KSVPLanguageTagFinlandSwedish, "fi" ); // finland swedish
+_LIT8( KSVPLanguageTagReserved, " " ); // Reserved for future use
+_LIT8( KSVPLanguageTagTa, "ta" ); // tamil
+_LIT8( KSVPLanguageTagTe, "te" ); // telugu
+_LIT8( KSVPLanguageTagBo, "bo" ); // tibetan
+_LIT8( KSVPLanguageTagTi, "ti" ); // tigrinya
+_LIT8( KSVPLanguageTagCyprusTurkish, "tr" ); // cyprus turkish
+_LIT8( KSVPLanguageTagTurkaem, " " ); // turkaem 
+_LIT8( KSVPLanguageTagUk, "uk" ); // ukrainian
+_LIT8( KSVPLanguageTagUr, "ur" ); // urdu
+_LIT8( KSVPLanguageTagReserved2, " " ); // reserved for future use 2
+_LIT8( KSVPLanguageTagVi, "vi" ); // vietnamese
+_LIT8( KSVPLanguageTagCy, "cy" ); // welsh
+_LIT8( KSVPLanguageTagZu, "zu" ); // zulu
+_LIT8( KSVPLanguageTagSoth, "LS"); // lesotho
+_LIT8( KSVPLanguageTagMalay, "ms"); // malay
+
+// enumeration for Symbian supported languages
+enum TLanguageTags
+    {
+    ESVPLangTest, // not used
+    ESVPLangEnglish, 
+    ESVPLangFrench, 
+    ESVPLangGerman, 
+    ESVPLangSpanish,
+    ESVPLangItalian, 
+    ESVPLangSwedish, 
+    ESVPLangDanish, 
+    ESVPLangNorwegian, 
+    ESVPLangFinnish, 
+    ESVPLangAmerican, 
+    ESVPLangSwissFrench, 
+    ESVPLangSwissGerman,
+    ESVPLangPortuguese, 
+    ESVPLangTurkish, 
+    ESVPLangIcelandic, 
+    ESVPLangRussian,
+    ESVPLangHungarian,
+    ESVPLangDutch,
+    ESVPLangBelgianFlemish,
+    ESVPLangAustralian,
+    ESVPLangBelgianFrench,
+    ESVPLangAustrian,
+    ESVPLangNewZealand,
+    ESVPLangInternationalFrench,
+    ESVPLangCzech,
+    ESVPLangSlovak,
+    ESVPLangPolish,
+    ESVPLangSlovenian,
+    ESVPLangTaiwanChinese,
+    ESVPLangHongKongChinese,
+    ESVPLangPrcChinese,
+    ESVPLangJapanese,
+    ESVPLangThai,
+    ESVPLangAfrikaans,
+    ESVPLangAlbanian,
+    ESVPLangAmharic,
+    ESVPLangArabic,
+    ESVPLangArmenian,
+    ESVPLangTagalog,
+    ESVPLangBelarussian,
+    ESVPLangBengali,
+    ESVPLangBulgarian,
+    ESVPLangBurmese,
+    ESVPLangCatalan,
+    ESVPLangCroatian,
+    ESVPLangCanadianEnglish,
+    ESVPLangInternationalEnglish,
+    ESVPLangSouthAfricanEnglish,
+    ESVPLangEstonian,
+    ESVPLangFarsi,
+    ESVPLangCanadianFrench,
+    ESVPLangScotsGaelic,
+    ESVPLangGeorgian,
+    ESVPLangGreek,
+    ESVPLangCyprusGreek,
+    ESVPLangGujarati,
+    ESVPLangHebrew,
+    ESVPLangHindi,
+    ESVPLangIndonesian,
+    ESVPLangIrish,
+    ESVPLangSwissItalian,
+    ESVPLangKannada,
+    ESVPLangKazakh,
+    ESVPLangKhmer,
+    ESVPLangKorean,
+    ESVPLangLao,
+    ESVPLangLatvian,
+    ESVPLangLithuanian,
+    ESVPLangMacedonian,
+    ESVPLangMalay,
+    ESVPLangMalayalam,
+    ESVPLangMarathi,
+    ESVPLangMoldavian,
+    ESVPLangMongolian,
+    ESVPLangNorwegianNynorsk,
+    ESVPLangBrazilianPortuguese,
+    ESVPLangPunjabi,
+    ESVPLangRomanian,
+    ESVPLangSerbian,
+    ESVPLangSinhalese,
+    ESVPLangSomali,
+    ESVPLangInternationalSpanish,
+    ESVPLangLatinAmericanSpanish,
+    ESVPLangSwahili,
+    ESVPLangFinlandSwedish,
+    ESVPLangReserved1,
+    ESVPLangTamil,
+    ESVPLangTelugu,
+    ESVPLangTibetan,
+    ESVPLangTigrinya,
+    ESVPLangCyprusTurkish,
+    ESVPLangTurkmen,
+    ESVPLangUkrainian,
+    ESVPLangUrdu,
+    ESVPLangReserved2,
+    ESVPLangVietnamese,
+    ESVPLangWelsh,
+    ESVPLangZulu,
+    ESVPLangOther,
+	ESVPLangManufacturerEnglish,
+	ESVPLangSouthSotho,
+	ESVPLangEnglish_Apac = 129,
+	ESVPLangEnglish_Taiwan = 157,
+	ESVPLangEnglish_HongKong = 158,
+	ESVPLangEnglish_Prc = 159,
+	ESVPLangEnglish_Japan = 160,
+	ESVPLangEnglish_Thailand = 161,
+	ESVPLangMalay_Apac = 326,
+    ESVPLangMaximum = 0xFFFE,
+    ESVPLangNone = 0xFFFF
+    };
+    
+#endif // SVPLANGUAGETAGCONSTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svplogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,157 @@
+/*
+* 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:  Provides macros for logging and debugging.
+*
+*/
+
+#ifndef SVPLOGGER_H
+#define SVPLOGGER_H
+
+#ifdef _DEBUG  // enable debug macros
+
+#ifndef COMPONENT
+#define COMPONENT
+_LIT( KComponent, "SVP" );
+#endif // COMPONENT
+
+#include <e32svr.h>
+#include <e32cmn.h>
+#include "svpconsts.h"
+
+/*****************************************************
+* Format string for adding component to prints.
+* 
+* Parameters passed within macros from code are
+* formatted with string that came as a parameter
+*****************************************************/
+_LIT( KSVPPrintFormatString, "%S: %S" );
+
+/*
+ *  Prints for text without params
+ */
+static inline void PrintL( const TDesC& aStr )
+    {
+    HBufC* line = HBufC::NewLC( KSvpMaxDebugBufferSize );
+    TPtr ptr( line->Des() );
+    ptr.Format( KSVPPrintFormatString(), &KComponent(), &aStr );   
+    RDebug::Print( line->Des() );
+    CleanupStack::PopAndDestroy( line );
+    }
+static inline void Print( const TDesC& aStr )
+    {
+    TRAP_IGNORE( PrintL( aStr ) )
+    }
+
+/* 
+ * Prints for text with TInt as a param
+ */
+static inline void PrintL( const TDesC& aStr, const TInt& aTInt )
+    {
+    HBufC* line1 = HBufC::NewLC( KSvpMaxDebugBufferSize );
+    TPtr ptr1( line1->Des() );
+    ptr1.Format( aStr, aTInt );
+    
+    HBufC* line2 = HBufC::NewLC( KSvpMaxDebugBufferSize );
+    TPtr ptr2( line2->Des() );
+    ptr2.Format( KSVPPrintFormatString(), &KComponent(), line1 );   
+    RDebug::Print( line2->Des() );
+    CleanupStack::PopAndDestroy( 2 );
+    }
+static inline void Print( const TDesC& aStr, const TInt& aTInt )
+    {
+    TRAP_IGNORE( PrintL( aStr, aTInt ) )
+    }
+
+/*
+ * Prints for text with any pointer as a param
+ */
+static inline void PrintL( const TDesC& aStr, const TAny* aPtr )
+    {
+    HBufC* line1 = HBufC::NewLC( KSvpMaxDebugBufferSize );
+    TPtr ptr1( line1->Des() );
+    ptr1.Format( aStr, aPtr );
+    
+    HBufC* line2 = HBufC::NewLC( KSvpMaxDebugBufferSize );
+    TPtr ptr2( line2->Des() );
+    ptr2.Format( KSVPPrintFormatString(), &KComponent(), line1 ); 
+    RDebug::Print( line2->Des() );
+    CleanupStack::PopAndDestroy( 2 );
+    }
+static inline void Print( const TDesC& aStr, const TAny* aPtr )
+    {
+    TRAP_IGNORE( PrintL( aStr, aPtr ) )
+    }
+
+/* 
+ * Prints for text with two TInt as a param
+ */
+static inline void PrintL( const TDesC& aStr,
+                           const TInt& aTInt1,
+                           const TInt& aTInt2 )
+    {
+    HBufC* line1 = HBufC::NewLC( KSvpMaxDebugBufferSize );
+    TPtr ptr1( line1->Des() );
+    ptr1.Format( aStr, aTInt1, aTInt2 );
+        
+    HBufC* line2 = HBufC::NewLC( KSvpMaxDebugBufferSize );
+    TPtr ptr2( line2->Des() );
+    ptr2.Format( KSVPPrintFormatString(), &KComponent(), line1 );   
+    RDebug::Print( line2->Des() );
+    CleanupStack::PopAndDestroy( 2 );
+    }
+static inline void Print( const TDesC& aStr,
+                          const TInt& aTInt1,
+                          const TInt& aTInt2 )
+    {
+    TRAP_IGNORE( PrintL( aStr, aTInt1, aTInt2 ) )
+    }
+
+/*
+ * Prints for text with TInt and a string as a parameter
+ */
+static inline void PrintL( const TDesC& aStr1,
+                           const TInt& aTInt,
+                           const TDesC* aStr2 )
+    {
+    HBufC* line1 = HBufC::NewLC( KSvpMaxDebugBufferSize );
+    TPtr ptr1( line1->Des() );
+    ptr1.Format( aStr1, aTInt, aStr2 );
+        
+    HBufC* line2 = HBufC::NewLC( KSvpMaxDebugBufferSize );
+    TPtr ptr2( line2->Des() );
+    ptr2.Format( KSVPPrintFormatString(), &KComponent(), line1 );   
+    RDebug::Print( line2->Des() );
+    CleanupStack::PopAndDestroy( 2 );
+    }
+static inline void Print( const TDesC& aStr1,
+                          const TInt& aTInt,
+                          const TDesC* aStr2 )
+    {
+    TRAP_IGNORE( PrintL( aStr1, aTInt, aStr2 ) )
+    }
+
+
+#define SVPDEBUG1( a ) { _LIT( KStr, a ); Print( KStr() ); }
+#define SVPDEBUG2( a, b ){ _LIT( KStr, a ); Print( KStr(), b ); }
+#define SVPDEBUG3( a, b, c ){ _LIT( KStr, a ); Print( KStr(), b, c ); }
+
+#else // _DEBUG
+
+#define SVPDEBUG1( a )
+#define SVPDEBUG2( a, b )
+#define SVPDEBUG3( a, b, c )
+
+#endif // _DEBUG
+
+#endif // SVPLOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpmosession.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,385 @@
+/*
+* 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:  Class representing the SVP MO session
+*
+*/
+
+
+
+#ifndef SVPMOSESSION_H
+#define SVPMOSESSION_H
+
+#include <sipprofileregistryobserver.h>
+#include <sipconnectionobserver.h>
+#include <sipobserver.h>
+
+#include <sip.h>
+#include <sipprofile.h>
+#include <sipprofileregistry.h>
+
+#include <mcemanager.h>
+
+#include "svpsessionbase.h"
+#include "svpconsts.h"
+#include "svputdefs.h"
+
+
+class CRCSEProfileEntry;
+class CSVPForwardProvider;
+class CDesC8Array;
+
+/**
+ *  Representation of SVP Mo session
+ *
+ *  Inlcudes all the methods needed to establish SVP MO session. 
+ *
+ *  @lib svpcontroller.lib   
+ *  @since S60 3.2
+ */
+class CSVPMoSession : public CSVPSessionBase, 
+                      public MSIPObserver,
+                      public MSIPProfileRegistryObserver
+    {  
+     
+public:
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPMoSession* NewL( 
+        CMceManager& aMceManager,
+        const TDesC8& aRecipient,
+        CRCSEProfileEntry& aVoipProfile, 
+        const CCCPCallParameters& aParameters,
+        TMceTransactionDataContainer& aContainer,                                
+		MSVPSessionObserver& aObserver,
+		CSVPUtility& aSVPUtility,
+		CSVPRtpObserver& aRtpObserver,
+		TUint32& aSecurityStatus, 
+		CDesC8Array* aUserHeaders = 0 );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPMoSession();
+    
+    
+public: // methdos from MCCPCall   
+
+    /**
+    * From MCCPMoSession. Starts dialing to recipient
+    * @since Series 60 3.2
+    * @return 
+    */
+    TInt Dial();
+
+    /**
+    * From MCCPMoSession. Cancels (dial) request
+    * @since Series 60 3.2
+    * @return
+    */
+    TInt Cancel();
+    
+    /**
+    * From MCCPCall Ends an ongoing call.
+    * @since Series 60 3.2
+    * @return
+    */
+    TInt HangUp();
+    
+    /**
+    * From MCCPMoSession. Destructs session
+    * @since Series 60 3.2
+    * @return
+    */
+    TInt Release();
+    
+    /**
+	* From MCCPCall Get Forward provider
+	* @since Series 60 3.2
+	* @return Pointer to MCCPForwardProvider if succesfull, NULL if not available
+	*/
+	MCCPForwardProvider* ForwardProviderL( const MCCPForwardObserver& aObserver );
+    
+    /**
+    * Puts the specified session on hold.
+    * @since Series60 3.2
+    * @return 
+    */
+    TInt Hold();
+
+    /**
+    * Resumes held session.
+    * @since Series60 3.2
+    * @return 
+    */
+    TInt Resume();
+
+    /**
+    * Handles remote action after session is established.
+    * @since Series60 3.2
+    * @param None
+    * @return
+    */
+    TInt IncomingRequest( CMceInSession* aUpdatedSession );
+    
+    /**
+    * Returns boolean value, is the session mobile originated.
+    * @since Series60 3.2
+    * @param None
+    * @return TBool ETrue if mobile originated, otherwise EFalse
+    */
+    TBool IsMobileOriginated() const;
+    
+
+                  
+public: // methods from MSIPObserver
+
+    /**
+    * From MSIPObserver A SIP request has been received from the network. 
+    * @since  Series 60 3.0
+    * @param  aIapId The IapId from which the SIP request was received.  
+    * @param  aTransaction Contains local address, remote address of a sip
+    *         message, as well as optional SIP message method, headers and 
+    *         body. The ownership is transferred.  
+    * @return None
+    */
+     void IncomingRequest( TUint32 aIapId, 
+                           CSIPServerTransaction* aTransaction );
+
+    /**
+    * From MSIPObserver The received SIP request time-outed and it has been
+    * destroyed.  
+    * @since  Series 60 3.0
+    * @param  aSIPServerTransaction The time-outed transaction. Ownership is
+    *         not transferred. 
+    * @return None
+    */
+     void TimedOut( CSIPServerTransaction& aSIPServerTransaction );
+
+public: // methods from MSIPProfileRegistryObserver
+
+    /**
+    * From MSIPProfileRegistryObserver An asynchronous error has occurred
+    * related to SIP profile Event is send to those observers, who have the
+    * corresponding profile instantiated. 
+    * @since  Series 60 3.0
+    * @param  aSIPProfileId SIP Profile ID. 
+    * @param  aError Error code. 
+    * @return None
+    */ 
+     void ProfileRegistryErrorOccurred( TUint32 aSIPProfileId,
+                                        TInt aError );
+    
+    /**
+    * From MSIPProfileRegistryObserver An event related to SIP Profile has
+    * occurred.
+    * @since  Series 60 3.0
+    * @param  aProfileId SIP Profile ID. 
+    * @param  aEvent An occurred event.
+    * @return None
+    */ 
+    void ProfileRegistryEventOccurred( TUint32 aProfileId,
+                                        TEvent aEvent ); 
+                                        
+public: // new public methods
+    
+    /**
+    * Method for creating normal Mo session if secure sessio
+    * creation has failed
+    * @since  Series 60 3.2
+    * @param  aMceManager Mce Manager. 
+    */
+    void CreateNonSecureSessionL( CMceManager& aMceManager );  
+        
+    /**
+	* Returns pointer to array containing addresses to forward the call to.
+	* Index zero contains the first address. If there are no addresses available
+	* returns an empty array.
+	* @since Series 60 3.2
+	* @param none
+	* @return Reference to array containing addresses
+    * @leave KErrNotReady call is not in forwarding state
+    * @leave KErrNotAllowed if call is not mobile originated
+    * @leave system error code 
+    * @pre Call state is MCCPCallObserver::ECCPStateForwarding and call type is MO
+    * @pre Call MCCPForwardObserver::ECCPMultipleChoices event is received
+	*/
+	const CDesC8Array& GetForwardAddressChoicesL();
+
+	/**
+	* Forward call to address at given index.
+	* @since Series 60 3.2
+	* @param aIndex Index of address where the call is to be forwarded. Address is 
+	* found in the array received from GetForwardAddressChoicesL. Index starts from zero.
+	* @return none
+	* @leave KErrArgument Index is not in array
+    * @leave KErrNotReady Call is not in forwarding state
+    * @leave KErrNotAllowed If call is not mobile originated
+    * @pre Call state is MCCPCallObserver::ECCPStateForwarding and call type is MO
+    * @pre Call MCCPForwardObserver::ECCPMultipleChoices event is received
+	*/
+	void ForwardToAddressL( const TInt aIndex );
+	
+    /**
+    * Add an observer for forward related events.
+    * Currently CCE will set only one observer.
+    * @since S60 v3.2
+    * @param aObserver Observer
+    * @return none
+    * @leave system error if observer adding fails
+    */
+    void AddForwardObserverL( const MCCPForwardObserver& aObserver );
+
+    /**
+    * Remove an observer.
+    * @since S60 v3.2
+    * @param none
+    * @param aObserver Observer
+    * @return KErrNone if removed succesfully. 
+    * @return KErrNotFound if observer was not found.
+    */
+    TInt RemoveForwardObserver( const MCCPForwardObserver& aObserver );
+
+    /**
+    * Notify forwardobserver about forward event.
+    * @since S60 3.2
+    * @param aEventCode eventcode
+    * @return none
+    */
+    void NotifyForwardEvent( TInt aEventCode );
+
+ 	/**
+	* Add forward address for this session
+	* @since S60 3.2
+	* @param aFwdAddress 
+	* @return Count of addresses, otherwise system wide error code
+    * @leave system error if address adding fails
+	*/
+    TInt AddForwardAddressL( const TDesC8& aFwdAddress );
+
+ 	/**
+	* Reset address list
+	* @since S60 3.2
+	* @return None
+	*/
+    void ResetForwardAddressChoices();
+
+private: // new private methods
+
+    /**
+    * Method for completing sip uri
+    * @since Series 60 3.2
+    * @param aRecipient Recipient received from application
+    * @param aRecipient SIP profile which is making the call
+    * @param aSecurityStatus security preference 
+    * @param aUserEqualsPhoneRequired defines user=phone parameter
+    * @return HBufC8* constructed uri
+    */
+    HBufC8* CompleteUriL( const TDesC8& aRecipient, 
+                          const CSIPProfile& aSipProfile,
+                          const TUint32& aSecurityStatus,
+                          TBool aUserEqualsPhoneRequired );
+
+    /**
+    * Dial method that leave
+    * @since Series 60 3.2
+    */
+    void DialL();
+
+    
+protected:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPMoSession( TUint32 aSessionExpires, 
+                   TMceTransactionDataContainer& aContainer,
+                   MSVPSessionObserver& aObserver,
+                   CSVPUtility& aSVPUtility,
+                   CSVPRtpObserver& aRtpObserver );
+                                      
+    /**
+     * Worker function for session state change, called from
+     * SessionStateChanged().
+     * @since S60 v3.2
+     * @param aOrigStatus Original status code
+     * @param aError Mapped TCCPError
+     * @param aModStatus Modified status code
+     * @return void
+     */
+    virtual void SessionStateChangedL( TInt aOrigCode, TCCPError aError,
+        TInt aModStatus );
+
+
+private:
+
+    /**
+    * second-phase constructor
+    */
+    void ConstructL( CMceManager& aMceManager, 
+                     CRCSEProfileEntry& aVoipProfile, 
+                     const CCCPCallParameters& aParameters,
+                     const TDesC8& aRecipient,
+                     TUint32& aSecurityStatus,
+                     CDesC8Array* aUserHeaders );
+                     
+private: // data
+
+    /**
+    * Session Expires value
+    */
+    TUint32 iSessionExpires;
+          
+    /**
+    * User header array
+    */
+    CDesC8Array* iUserHeaders;
+    
+    /**
+    * Forward observer
+    * Not own.
+    */
+    MCCPForwardObserver* iForwardObserver;
+    
+    /**
+    * Forward provider
+    * Own.
+    */
+    CSVPForwardProvider* iForwardProvider;
+    
+    /**
+    * Recipient address, needed for secure preferred -secure call setting
+    */
+    TBuf8< KSVPMaxUriLength > iSecondCallRecipient;
+    
+    /**
+    * List for forward addresses
+    */
+    CDesC8Array* iForwardAddressList;
+    
+    /**
+    * Pointer to Mce manager
+    * Not own
+    */
+    CMceManager* iMceManager;
+    
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif // SVPMOSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpmtsession.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,184 @@
+/*
+* 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:  Representation of SVP MT session
+*
+*/
+
+
+#ifndef SVPMTSESSION_H
+#define SVPMTSESSION_H
+
+#include <mccpcall.h>
+#include "svpsessionbase.h"
+#include "svputdefs.h"
+
+/**
+ *  Class which acts as SVP MT session.
+ *  Contains all the SVP MT session specific methods.
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPMtSession : public CSVPSessionBase              
+    {
+
+public:
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPMtSession* NewL( CMceInSession* aMtSession,
+                                TMceTransactionDataContainer& aContainer,
+                                TUint32 aServiceId,
+                                TUint32 aVoIPProfileId,
+                                MSVPSessionObserver& aObserver,
+                                CSVPUtility& aSVPUtility,
+                                CSVPRtpObserver& aRtpObserver,
+                                TInt aKeepAliveValue,
+                                TBool aPreconditions );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPMtSession();
+    
+
+public: // from base classes: MCCPCall
+
+    /**
+    * Answers to an incoming session.
+    * @since Series60 3.2
+    * @return KErrNone if successful or system wide error code
+    */
+    TInt Answer();
+        
+    /**
+    * Rejects an incoming call.
+    * @since Series 60 3.2
+    * @return KErrNone if successful or system wide error code
+    */
+    TInt Reject();
+
+    /**
+    * Reguests to queue the call. 
+    * @since S60 3.2
+    * @return KErrNone if successful or system wide error code
+    */
+    TInt Queue();
+
+    /**
+    * Send 180 Ringing
+    * @since S60 3.2
+    * @return KErrNone if successful or system wide error code
+    */
+    TInt Ringing();
+
+    /**
+    * From MCCPMtSession. Return boolean value, is incoming session forwarded or not.
+    * @since Series60 3.2
+    * @return ETrue if session is forwarded, else EFalse
+    */
+    TBool IsCallForwarded() const;
+     
+    /**
+    * Returns boolean value, is the session mobile originated.
+    * @since Series60 3.2
+    * @return TBool ETrue if session is mobile originated, otherwise EFalse
+    */
+    TBool IsMobileOriginated() const;
+    
+    /** 
+    * Calls sessions destructor
+    * @since Series60 3.2
+    * @return KErrNone if successful or system wide error code
+    */
+    TInt Release();
+
+    /**
+    * Puts the specified session on hold.
+    * @since Series60 3.2
+    * @return KErrNone if successful or system wide error code
+    */
+    TInt Hold();
+
+    /**
+    * Resumes the session.
+    * @since Series60 3.2
+    * @return KErrNone if successful or system wide error code
+    */
+    TInt Resume();
+     
+    /**
+    * Handles remote action after session is established.
+    * @since Series60 3.2
+    * @param None
+    * @return
+    */
+    TInt IncomingRequest( CMceInSession* aUpdatedSession );
+    
+private: // new methods
+
+    /**
+    * Handles sink/source enabling for Mt streams
+    * @since Series 60 3.2
+    * @param aStreams array of streams in Mt session
+    */
+    void HandleMtStreamsL( const RPointerArray< CMceMediaStream >& aStreams );
+    
+    /**
+     * Worker functio to answer an incoming session.
+     * @since Series60 3.2
+     * @return void
+     */
+    void DoAnswerL();
+    
+// From CSVPSessionBase
+
+    /**
+     * Sets RTP keep-alive timer value and payload
+     * @since Series 60 3.2
+     * @param aSession MCE session
+     * @param aSessionUpdateOngoing Flag determines whether session udpate is needed
+     * @return void
+     */
+    void SetRtpKeepAliveL( CMceSession* aSession, 
+                           TBool aSessionUpdateOngoing );
+    
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPMtSession( CMceInSession* aMtSession,
+                   TMceTransactionDataContainer& aContainer,
+                   TUint32 aVoIPProfileId,
+                   MSVPSessionObserver& aObserver,
+                   CSVPUtility& aSVPUtility,
+                   CSVPRtpObserver& aRtpObserver,
+                   TInt aKeepAliveValue,
+                   TBool aPreconditions );
+    
+    /**
+     * Symbian 2nd phase construction
+     */
+    void ConstructL( TUint32 aServiceId );
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif // SVPMTSESSION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svppositioningprovider.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Provides position information
+*
+*/
+
+
+#ifndef C_SVPPOSITIONINGPROVIDER_H
+#define C_SVPPOSITIONINGPROVIDER_H
+
+#include <lbs.h>
+#include "svputdefs.h"
+
+class MSVPPositioningProviderObserver;
+
+/**
+ *  Provides position information
+ *  Provides position information through Symbian Location FW. Actual 
+ *  information comes via a DHCP query which is implemented in a separate 
+ *  positioning module.
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPPositioningProvider : public CActive
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aPriority Active object priority
+     * @param aObserver Observer
+     */
+    static CSVPPositioningProvider* NewL( 
+        TPriority aPriority, MSVPPositioningProviderObserver& aObserver );
+    
+    static CSVPPositioningProvider* NewLC( 
+        TPriority aPriority, MSVPPositioningProviderObserver& aObserver );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPPositioningProvider();
+
+    /**
+     * Opens positioning module
+     *
+     * @since S60 3.2
+     * @param aModuleId Module to be opened
+     */
+    void OpenModuleL( TInt aModuleId );
+
+    /**
+     * Closes positioning module
+     *
+     * @since S60 3.2
+     */
+    void CloseModule();
+
+    /**
+     * Requests position information asynchronically
+     *
+     * @since S60 3.2
+     * @param aIapId IAP ID
+     * @param aApplicationName Identifies requestor
+     * @param aTimeout Timeout for position request in microseconds
+     */
+    void MakePositioningRequestL( 
+        TUint32 aIapId, 
+        const TDesC& aApplicationName, 
+        TUint32 aTimeout );
+
+private:
+
+    CSVPPositioningProvider( 
+        TPriority aPriority, MSVPPositioningProviderObserver& aObserver );
+
+    void ConstructL();
+    
+// from base class CActive
+
+    void DoCancel();
+    
+    void RunL();
+    
+private: // data
+
+    /**
+     * Observer
+     */
+    MSVPPositioningProviderObserver& iObserver;
+
+    /**
+     * Position server
+     */
+    RPositionServer iPositionServer;
+
+    /**
+     * Positioner
+     */
+    RPositioner iPositioner;
+
+    /**
+     * Generic position information
+     * Own.  
+     */
+    HPositionGenericInfo* iPositionGenericInfo;
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif // C_SVPPOSITIONINGPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svppositioningproviderobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,56 @@
+/*
+* 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:  Observes positioning provider
+*
+*/
+
+
+#ifndef M_SVPPOSITIONINGPROVIDEROBSERVER_H
+#define M_SVPPOSITIONINGPROVIDEROBSERVER_H
+
+
+/**
+ *  Observes positioning provider
+ *
+ *  Observes positioning provider whether position information has been 
+ *  acquired or an error has occurred
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class MSVPPositioningProviderObserver
+    {
+
+public:
+
+    /**
+     * Notifies observer that positioning request has completed successfully
+     *
+     * @since S60 3.2
+     * @param aPosition Acquired position information
+     */
+    virtual void PositioningRequestComplete( const TDesC8& aPosition ) = 0;
+
+    /**
+     * Notifies observer that positioning request has failed
+     *
+     * @since S60 3.2
+     * @param aError Symbian error code
+     */
+    virtual void PositioningErrorOccurred( TInt aError ) = 0;
+
+    };
+
+
+#endif // M_SVPPOSITIONINGPROVIDEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svppropertywatch.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Active object for watching P&S changes
+*
+*/
+
+
+
+#ifndef CSVPPROPERTYWATCH_H
+#define CSVPPROPERTYWATCH_H
+
+#include <e32base.h>
+#include <e32property.h>
+
+#include "svppropertywatchobserver.h"
+#include "svputdefs.h"
+
+ /**
+ *  Attaches itself to the specified P&S property and notifies clients when 
+ *  property was changed.
+ *
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPPropertyWatch : public CActive
+    {
+
+public:
+       
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPPropertyWatch* NewL( MSVPPropertyWatchObserver& aClient,
+                                    const TUid& aCategory,
+                                    TInt aKey );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPPropertyWatch();
+
+protected:  // Functions from base classes 
+        
+    /**
+    * From CActive. Handles an active object's request completion event.
+    */
+    void RunL();
+
+    /**
+    * From CActive. Implements cancellation of an outstanding request.
+    */
+    void DoCancel();
+    
+    /**
+    * From CActive. Handles a leave occurring in the request completion
+    * event handler RunL().
+    */
+    TInt RunError( TInt aError );
+        
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPPropertyWatch( MSVPPropertyWatchObserver& aClient, TInt aKey );
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL( const TUid& aCategory );
+ 
+     
+private:  // Data
+        
+    /**
+    * The client interested being notified about property changes
+    */
+    MSVPPropertyWatchObserver& iClient;
+
+    /**
+    * The key defining property where watcher attaches to
+    */
+    TInt iKey;
+
+    /**
+    * The property to attach to
+    */
+    RProperty iProperty;
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif //  C_SVPPROPERTYWATCH_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svppropertywatchobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Observers changes in proverty values
+*
+*/
+
+
+#ifndef M_SVPPROPERTYWATCHOBSERVER_H
+#define M_SVPPROPERTYWATCHOBSERVER_H
+
+/**
+ *  Observer interface for clients being interested in getting notifications
+ *  when Publish&Subscribe property under watching changes.
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class MSVPPropertyWatchObserver
+    {
+
+public:
+
+    /**
+     * MSVPPropertyWatch calls this when some property under watching was
+     * changed. 
+     *
+     * @since S60 3.2
+     * @param aKey Property which was changed
+     * @param aValue New value of the property
+     */
+     virtual void ValueChangedL( TInt aKey, TInt aValue ) = 0;
+    
+    /**
+     * MccPropertyWatch calls this when property was deleted.
+     *
+     * @since S60 3.2
+     * @param aKey Property which was deleted
+     */
+     virtual void PropertyDeleted( TInt aKey ) = 0;
+
+    };
+
+#endif // M_SVPPROPERTYWATCHOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svprtpobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  RTP observer for SVP
+*
+*/
+
+
+#ifndef SVPRTPOBSERVER_H
+#define SVPRTPOBSERVER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mcesession.h>
+#include <mcertpobserver.h>
+
+// FORWARD DECLARATIONS
+class CSVPSessionBase;
+class CSVPRtpObserverRequest;
+
+// CLASS DECLARATION
+
+/**
+ * CSVPRtpObserver
+ * 
+ */
+class CSVPRtpObserver : public CBase, public MMceRtpObserver
+    {
+public:     // Constructors and destructor
+
+    /**
+     * Destructor.
+     */
+    ~CSVPRtpObserver();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSVPRtpObserver* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSVPRtpObserver* NewLC();
+
+public:     // From MMceRtpObserver
+    
+    void SRReceived( CMceSession& aSession,
+					CMceMediaStream& aStream );
+    
+    void RRReceived( CMceSession& aSession,
+					CMceMediaStream& aStream );
+    
+    void InactivityTimeout( CMceMediaStream& aStream,
+					CMceRtpSource& aSource );
+    
+    void SsrcAdded( CMceMediaStream& aStream,
+					CMceRtpSource& aSource,
+					TUint aSsrc );
+    
+    void SsrcRemoved( CMceMediaStream& aStream,
+					 CMceRtpSource& aSource,
+					 TUint aSsrc );
+    
+public:     // New functions
+    
+    /**
+     * Adds a SVP session for observing RTCP (or RTCP timeouts).
+     * @since S60 v3.2
+     * @param aSession SVP session.
+     */
+    void AddSessionForObservingL( CSVPSessionBase* aSession );
+    
+    /**
+     * Removes a SVP session from RTCP observer.
+     * @since S60 v3.2
+     * @param aSession SVP session.
+     * @return TInt KErrNotFound if given session is not found,
+     *              KErrNone otherwise.
+     */
+    TInt RemoveSessionFromObserving( CSVPSessionBase* aSession );
+    
+    /**
+     * Resets(stops) session specific RTCP observing timers.
+     * @since S60 3.2
+     * @param aSession SVP session.
+     * @return TInt KErrNotFound if given session is not found,
+     *              KErrNone otherwise.
+     */
+    TInt ResetSessionInObserving( CSVPSessionBase* aSession );
+
+
+private:    // New functions
+    
+    /**
+     * Finds a observer request by SVP session.
+     * @since S60 v3.2
+     * @param aSession SVP session
+     * @return CSVPRtpObserverRequest or NULL if associated request not found
+     */
+    CSVPRtpObserverRequest* FindBySvpSession(
+        const CSVPSessionBase* aSession );
+    
+    /**
+     * Finds a observer request by MCE session.
+     * @since S60 v3.2
+     * @param aSession SVP session
+     * @return CSVPRtpObserverRequest or NULL if associated request not found
+     */
+    CSVPRtpObserverRequest* FindByMceSession( const CMceSession* aSession );
+    
+private:    // Consturctors
+
+    /**
+     * Constructor for performing 1st stage construction
+     */
+    CSVPRtpObserver();
+
+    /**
+     * EPOC default constructor for performing 2nd stage construction
+     */
+    void ConstructL();
+
+private:    // Data
+    
+    /**
+     * Request array.
+     * Own
+     */
+    RPointerArray<CSVPRtpObserverRequest> iRequestArray;
+    
+    };
+
+#endif // SVPRTPOBSERVER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svprtpobserverrequest.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  RTP observer for SVP
+*
+*/
+
+
+#ifndef SVPRTPOBSERVERREQUEST_H
+#define SVPRTPOBSERVERREQUEST_H
+
+// INCLUDES
+#include <e32base.h>
+#include "svptimerobserver.h"
+
+// FORWARD DECLARATIONS
+class CSVPSessionBase;
+class CMceSession;
+class CMceMediaStream;
+class CSVPTimer;
+
+// CLASS DECLARATION
+
+/**
+ * CSVPRtpObserverRequest
+ * 
+ */
+class CSVPRtpObserverRequest : public CBase, public MSVPTimerObserver
+    {
+public:     // Data types
+    
+    // Enumeration to determine RTCP activitytype
+    enum TReceivedRtcpPacket
+        {
+        ERtcpRrPacket = 0,
+        ERtcpSrPacket = 1
+        };
+    
+public:     // Constructors and destructor
+
+    /**
+     * Destructor.
+     */
+    ~CSVPRtpObserverRequest();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSVPRtpObserverRequest* NewL( CSVPSessionBase& aSession );
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSVPRtpObserverRequest* NewLC(  CSVPSessionBase& aSession  );
+    
+public:     // New functions
+    
+    /**
+     * Returns the SVP session associated to this request.
+     * @since S60 v3.2
+     * @return CSVPSessionBase
+     */
+    const CSVPSessionBase* SvpSession() const;
+    
+    /**
+     * Returns the MCE session associated to this request.
+     * @since S60 v3.2
+     * @return CMceSession
+     */
+    const CMceSession* MceSession() const;
+    
+    /**
+     * Called when RTCP RR or SR packet has been received.
+     * @since S60 v3.2
+     * @aPacket RTCP packet type
+     * @aSession MCE session
+     * @aStream MCE media stream.
+     */
+    void RtcpPacketReceived( TReceivedRtcpPacket aPacket,
+        CMceSession& aSession, CMceMediaStream& aStream );
+    
+    /**
+     * Called when associated session's state has changed.
+     * @since S60 3.2
+     */
+    void Reset();
+
+
+public:     // Functions from base classes
+    
+    // From MSVPTimerObserver
+    void TimedOut( TInt aTimerId );
+    
+private:     // New functions
+    
+    /**
+     * Determines the RTCP timeout value based on the media stream and
+     * it's associated codecs. Returns default value (35 seconds) if
+     * error is encountered.
+     * @since S60 v3.2
+     * @param aStream Stream from where to search the timeout value
+     * @return TInt RTCP timeout value in milliseconds
+     */
+    TInt DetermineTimeoutValue( CMceMediaStream& aStream ) const;
+
+    /**
+     * Returns ETrue if the associated session is currently in Hold state 
+     * @since S60 v3.2.3
+     * @return TBool value
+     */
+    TBool IsSessionInHoldState();
+    
+private:    // Consturctors
+
+    /**
+     * Constructor for performing 1st stage construction
+     */
+    CSVPRtpObserverRequest( CSVPSessionBase& aSession );
+
+    /**
+     * EPOC default constructor for performing 2nd stage construction
+     */
+    void ConstructL();
+
+private:    // Data
+    
+    /**
+     * SVP session associated to this observing request
+     * Not own
+     */
+    CSVPSessionBase& iSession;
+    
+    /**
+     * Timer for determining RTCP timeout.
+     * Own
+     */
+    CSVPTimer* iTimer;
+    
+    /**
+     * Flag to indicate that 'disconnect' state has been informed.
+     */
+    TBool iDisconnectSent;
+
+public:     // For testing purposes
+    friend class UT_CSVPRtpObserverRequest;
+    };
+
+#endif // SVPRTPOBSERVERREQUEST_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpsessionbase.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1244 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Session base class for SVP MO and MT sessions. Contains methods 
+*                common for SVP MO and MT sessions.
+*
+*/
+
+
+#ifndef SVPSESSIONBASE_H
+#define SVPSESSIONBASE_H
+
+#include <e32base.h>
+#include <mccpcall.h>
+#include <mccpssobserver.h>
+#include <mccpdtmfobserver.h> 
+
+#include "svpsessionobserver.h"
+#include "svpholdobserver.h"
+#include "svptransferobserver.h"
+#include "svptimer.h"
+#include "svptimerobserver.h"
+#include "svppropertywatchobserver.h"
+#include "svpvolumeupdateobserver.h"
+#include "svpdtmfeventobserver.h"
+#include "svputdefs.h"
+
+// FORWARD DECLARATIONS
+class TMceTransactionDataContainer;
+class CSVPUtility;
+class CSVPRtpObserver;
+class CSVPHoldController;
+class MCCPCallObserver;
+class MCCPSsObserver;
+class CSVPTransferController;
+class CMceInRefer;
+class CSVPVolumeObserver;
+class CSVPPropertyWatch;
+class CSVPDTMFEventGenerator;
+class CMceSession;
+class CMceMediaStream;
+class CMceMediaSink;
+class CMceMediaSource;
+class CMceEvent;
+class CMceRefer;
+class CDesC8Array;
+
+/**
+ *  SVP Session base
+ *
+ *  Base class for SVP MT and MO sessions.
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPSessionBase : public CBase,
+                        public MCCPCall,
+                        public MSVPTransferObserver,
+                        public MSVPHoldObserver,
+                        public MSVPTimerObserver,
+                        public MSVPPropertyWatchObserver,
+                        public MSVPVolumeUpdateObserver,
+                        public MSVPDTMFEventObserver
+                       
+    {
+
+public:
+    
+    /**
+    * C++ default constructor.
+    */
+    CSVPSessionBase( TMceTransactionDataContainer& aContainer,
+                     MSVPSessionObserver& aObserver, 
+                     CSVPUtility& aSVPUtility,
+                     CSVPRtpObserver& aRtpObserver );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPSessionBase();
+    
+public: // new functions    
+    
+    /**
+     * Saves updated Mce session in cases where re-INVITE without
+     * SDP is received
+     * @Since S60 3.2
+     * @param aUpdatedSession Session that is under update
+     */
+    void SetUpdatedSession( CMceInSession* aUpdatedSession );
+    
+    /**
+    * Releases temporary secure session stored 
+    * after secure session trial failed
+    * @since Series 60 3.2
+    */
+    void ReleaseTempSecure();
+    
+    /**
+    * Returns Mce session 
+    * @Since S60 3.2
+    * @param
+    * @return instance of session
+    */
+    const CMceSession& Session() const;
+    
+    /**
+    * Construcst audiostreams for MT and MO session
+    * @since Series 60 3.2
+    * @param None
+    * @return 
+    */   
+    void ConstructAudioStreamsL();
+
+    /**
+    * Starts SVP timer
+    * @since Series 60 3.2
+    * @param aMilliSeconds
+    * @param aTimerId
+    * @return 
+    */
+    void StartTimerL( TInt aMilliSeconds, TInt aTimerId );
+
+    /**
+     * Stop specified SVP timer
+     * @since Series 60 3.2
+     * @param aTimerId The ID of the timer to stop.
+     */
+     void StopTimer( TInt aTimerId );
+     
+     /**
+     * Stops started timers
+     * @since Series 60 3.2
+     * @return 
+     */
+     void StopTimers();
+     
+     /**
+     * Returns correct timer value (RFC 3261 chapter 14.1)
+     * @since Series 60 3.2
+     * @return 
+     */
+     TInt ReinviteCrossoverTime();     
+     
+    /**
+     * Sets observer for supplementary services events
+     * @since Series 60 3.2
+     * @return
+     */ 
+    void SetSsObserver( const MCCPSsObserver& aObserver );
+    
+    /**
+     * Gets supplementary services events observer of session
+     * @since Series 60 3.2
+     * @return MCCPSsObserver supplementary services events observer
+     */ 
+    const MCCPSsObserver& GetSsObserver( );
+    
+    /**
+    * Sets CCP DTMF observer to session
+    * @since Series 60 3.2
+    * @return 
+    */
+    void SetDtmfObserver( const MCCPDTMFObserver& aObserver );
+    
+    /**
+    * Gets CCP DTMF observer 
+    * @since Series 60 3.2
+    * @return MCCPDTMFObserver CCP DTMF observer
+    */
+    const MCCPDTMFObserver& DtmfObserver();
+    
+    /**
+    * Handles session state changes 
+    * @since Series 60 3.2
+    * @param aStatusCode Status code
+    * @return 
+    */
+    void SessionStateChanged( TInt aStatusCode );
+
+    /**
+    * Handles session state changed announcement.
+    * @since Series60 3.2
+    * @param aSession MCE session
+    * @return void
+    */
+    void HandleSessionStateChanged( CMceSession& aSession );
+    
+    /**
+     * Handles the state change of a given stream.
+     * @since S60 v3.2
+     * @param aStream Stream whose state has changed.
+     * @return void
+     **/
+    void HandleStreamStateChange( CMceMediaStream& aStream );
+    
+    /**
+     * Handles the state change of a given stream & sink.
+     * @since S60 v3.2
+     * @param aStream Stream whose state has changed.
+     * @param aSink Sink which is either Enabled or Disabled.
+     * @return void
+     **/
+    void HandleStreamStateChange( CMceMediaStream& aStream,
+            CMceMediaSink& aSink );
+    
+    /**
+     * Handles the state change of a given stream & source
+     * @since S60 v3.2
+     * @param aStream Stream whose state has changed.
+     * @param aSource Source which is either Enabled or Disabled.
+     * @return void
+     **/
+    void HandleStreamStateChange( CMceMediaStream& aStream,
+            CMceMediaSource& aSource );
+    
+    /**
+    * Handles remote action after session is established.
+    * @since Series60 3.2
+    * @param None
+    * @return
+    */
+    TInt IncomingRequest( CMceInSession& aUpdatedSession );
+    
+    /**
+    * Returns Hold session 
+    * @Since S60 3.2
+    * @param None
+    * @return Reference to the session hold controller
+    */
+    CSVPHoldController& HoldController() const;
+    
+    /**
+    * Finds out if the session has hold controller
+    * @since Series60 3.2
+    * @param None
+    * @return ETrue if session has hold controller, EFalse otherways
+    */
+    TBool HasHoldController() const;
+
+    /**
+     * Returns ETrue if session is muted
+     * @since Series 60 3.2
+     * @return TBool iMuted value
+     */
+    TBool IsSessionMuted() const;
+
+    /**
+    * Handles the event state changes.
+    * @since Series 60 3.2
+    * @param aEvent, the event that has changed.
+    * @param aStatusCode, status code
+	* @return KErrNone if succesfull, otherwise error code
+    */
+    TInt EventStateChanged( CMceEvent& aEvent,
+				            TInt aStatusCode ); 
+
+    /**
+    * Handles the received notify.
+    * @since Series 60 3.2
+    * @param aEvent, the event that has changed.
+    * @param aContainer, if present, holds details of received notify.
+    */
+    void NotifyReceived( CMceEvent& aEvent,
+                            TMceTransactionDataContainer* aContainer );
+				
+    /**
+    * Handles the refer state changes.
+    * @since Series 60 3.2
+    * @param aRefer, the refer that has changed.
+    * @param aStatusCode, status code
+    */
+    void ReferStateChanged( CMceRefer& aRefer,
+				            TInt aStatusCode ); 
+    
+
+    /**
+    * Return the data container.
+    * When session is the target session of the attended transfer.
+    * @since Series 60 3.2
+    * @return the mce data container
+    */
+    TMceTransactionDataContainer& MceTransactionDataContainer(); 
+    
+    /**
+     * New incoming refer received.
+     * @since Series 60 3.2
+	 * @param aRefer, the new inbound refer. Ownership is
+	 *	      transferred.
+     * @param aReferTo SIP specific Refer-to header 
+     * @param aContainer, if present, holds details of incoming refer.
+     */
+    void IncomingReferL( CMceInRefer* aRefer,
+                        const TDesC8& aReferTo,
+                        TMceTransactionDataContainer* aContainer );
+    
+    /**
+     * Checks the MCE refer object.
+     * @since S60 3.2
+     * @param aRefer - refer to check
+     * @return TBool true if same MCE refer object
+     */
+    TBool IsMceRefer( CMceRefer& aRefer ); 
+    
+    /**
+     * Indicates whether call is secured or not
+     * @since S60 3.2
+     * @return TBool ETrue if call is secured
+     */
+    TBool SecureMandatory() const;
+    
+    /**
+     * Is secure call prefered
+     * @since S60 3.2
+     * @return TBool ETrue is secure call is prefered
+     */    
+    TBool SecurePreferred() const;
+    
+    /**
+     * Set secure mandatody flag true or false
+     * @since S60 3.2
+     * @param aSecMandatory flag value
+     */   
+    void SetSecureMandatory( TBool aSecMandatory );
+    
+    /**
+     * Sets secure preferred flag true or false
+     * @since S60 3.2
+     * @param aSecPreferred flag value
+     */    
+    void SetSecurePreferred( TBool aSecPreferred );
+    
+    /**
+     * Sets call event to be sent, used in secure and attended transfer cases.
+     * @since S60 3.2
+     * @param aCallEventToBeSent event value
+     */   
+    void SetCallEventToBeSent( MCCPCallObserver::TCCPCallEvent aCallEventToBeSent );
+
+    /**
+     * Checks if transfer is attended or unattended.
+     * @since S60 3.2
+     * @return TBool true if attended case
+     */
+    TBool IsAttended( ); 
+
+    /**
+    * The new recipient of the call can be fetched via this method.
+    * @since S60 3.2
+    * @param none
+    * @return New recipient for the call after transfer
+    */
+    const TDesC& TransferTarget() const;
+
+    /**
+    * Set transfer data. Add Replaces and Referred-By headers.
+    * Update transfer target url to sips: if secure status 1 or 2,
+    * otherwise url updated to sip:
+    * @since S60 3.2
+    * @param aUserAgentHeaders On completion contains collected transfer headers.
+    * @param aSecureStatus secure status
+    */
+    void SetTransferDataL( CDesC8Array* aUserAgentHeaders, TInt aSecureStatus );
+
+    /**
+    * Send notify incoming transfer case.
+	* @param aStatusCode code coming from mce
+    * @since Series60 3.2
+    */
+    void SendNotify( TInt aStatusCode );
+    
+    /**
+    * Finds out if the session has incoming transfer ongoing
+    * @since Series60 3.2
+    * @return ETrue if incoming transfer ongoing, EFalse otherways
+    */
+    TBool IsIncomingTransfer();
+    
+	/**
+	* Sets the FromHeader data
+	* @since S60 3.2
+	* @param aFromHeader reference to the FromHeader data to store
+	* @return KErrNone if succesfull, otherwise another system wide error code
+	*/
+    TInt SetFromHeader( const TDesC8& aFromHeader );
+
+	/**
+    * Returns the FromHeader data. 
+	* @since S60 3.2
+	* @return pointer to FromHeader data
+	*/
+    TDesC8* FromHeader();
+
+	/**
+	* Sets the ToHeader data
+	* @since S60 3.2
+	* @param aToHeader reference to the ToHeader data to store
+	* @return KErrNone if succesfull, otherwise another system wide error code
+	*/
+    TInt SetToHeader( const TDesC8& aToHeader );
+
+	/**
+    * Returns the ToHeader data. 
+	* @since S60 3.2
+	* @return pointer to ToHeader data
+	*/
+    TDesC8* ToHeader();
+    
+	/**
+	* Sets the CallId data
+	* @since S60 3.2
+	* @param aCallId reference to the CallId data to store
+	* @return KErrNone if succesfull, otherwise another system wide error code
+	*/
+    TInt SetCallId( const TDesC8& aCallId );
+
+	/**
+	* Returns the CallId data. 
+	* @since S60 3.2
+	* @return pointer to CallId data
+	*/
+    TDesC8* CallId();    
+    
+    /**
+	* Sets the CSeq header data
+	* @since S60 3.2
+	* @param aCSeq reference to the CSeq header data to store
+	* @return KErrNone if succesfull, otherwise another system wide error code
+	*/
+    TInt SetCSeqHeader( const TDesC8& aCSeq );
+    
+    /**
+    * Returns the CSeqHeader data. 
+	* @since S60 3.2
+	* @return reference to CSeqHeader data
+	*/
+    const TDesC& CSeqHeader() const;    
+    
+    /**
+    * Method for setting crypto context to secure session
+    * @since S60 3.2
+    */
+    void SetCryptoContextL();
+  
+	/**
+    * Gets CCP session observer 
+    * @since Series 60 3.2
+    * @return CCP session observer.
+    */
+    MCCPCallObserver& GetCCPSessionObserver( );
+    
+    /**
+    * Handles update failure 
+    * @since Series 60 3.2
+    * @param aSession MCE session reference
+    * @param aStatusCode Status code of the response received
+    * @return None
+    */
+    void UpdateFailed( CMceSession& aSession, TInt aStatusCode );
+    
+    /**
+     * Returns session keepalive timer value
+     * @since Series 60 3.2
+     * @return TInt returns keepalive timer value
+     */
+    TInt GetKeepAliveTime();
+    
+    /**
+     * SVP received INVITE without SDP, this flag is set to
+     * prevent extra incomingcall callback to CCE
+     * @since Series 60 3.2
+     * @return none
+     */
+    void SetEmptyReInvite();
+    
+    /**
+     * Returns ETrue if empty re-INVITE was received by SVP
+     * @since Series 60 3.2
+     * @return TBool Flag value
+     */
+    TBool IsEmptyReInvite();
+    
+    /**
+     * Returns ETrue if iSessionState is still in initial state.
+     * @since Series 60 3.2
+     * @return TBool Flag value
+     */
+    TBool IsIdle();
+
+    /**
+     * Returns ETrue if anonymous call is on.
+     * @since Series 60 9.2
+     * @return TBool Flag value
+     */
+    TBool IsCLIROnL() const;
+
+// dtmf
+
+    /**
+	* Cancels asynchronous DTMF string sending.
+	* @since Series 60 3.2
+	* @return KErrNone is successful, otherwiee antoher system wide error code
+	*/
+	TInt CancelDtmfStringSending();
+
+	/**
+	* Starts the transmission of a single DTMF tone across a
+	* connected and active call.
+	* @since S60 3.2
+	* @param aTone Tone to be played.
+	* @return KErrNone if succesfull, otherwise another system wide error code
+	*/
+	TInt StartDtmfTone( const TChar aTone );
+
+	/**
+	* Stops playing current DTMF tone.
+	* @since S60 3.2
+    * @param none
+	* @return KErrNone if succesfull, otherwise another system wide error code
+	*/
+	TInt StopDtmfTone();
+
+	/**
+	* Plays DTMF string.
+	* @since S60 3.2
+	* @param aString String to be played.
+	* @return KErrNone if succesfull, otherwise another system wide error code
+	* KErrArgument if the specified string contains illegal DTMF characters
+	*/
+	TInt SendDtmfToneString( const TDesC& aString );  
+    
+	// from SVPDTMFEventObserver
+    void InbandDtmfEventOccurred( TSVPDtmfEvent aEvent );
+    
+public: // from base classes: timerobserver
+    
+    /**
+    * Notifies, that the previously set timer has now expired.
+    * Implemented by the class using the timer.
+    * @since Series 60 3.2
+    * @param TInt aTimerId The ID of the timer. Observer can identify 
+    * timers from each other with this ID.
+    * @return 
+    */
+    void TimedOut( TInt aTimerId ); 
+
+public: // from MSVPVolumeUpdateObserver
+ 
+    /**
+     * CSVPVolumeObserver calls this when volume level changes
+     * changed. 
+     *
+     * @since S60 3.2
+     * @param aVolume New volume level
+     */
+     void VolumeChanged( TInt aVolume );
+    
+public: // from base classes: MCCPCall
+		
+    /**
+    * Return if call secure status is specified or not.
+    * @since Series 60 5.0
+    * @param None
+    * @return TBool ETrue if security is specified, else EFalse.
+    */
+    TBool SecureSpecified() const;
+	    
+	/**
+    * Sets CCP call observer 
+    * @since Series 60 3.2
+    * @param aObserver observer to be set
+    * @return 
+    */
+    void AddObserverL( const MCCPCallObserver& aObserver );
+    
+    /**
+    * Remove an observer.
+    * @since S60 v3.2
+    * @param none
+    * @param aObserver Observer
+    * @return KErrNone if removed succesfully. KErrNotFound if observer was not found.
+    * Any other system error depending on the error.
+    */
+    TInt RemoveObserver( const MCCPCallObserver& aObserver );
+        
+    /**
+    * Answers to an incoming call.
+    * @since Series60 3.2
+    * @return KErrNotSupported
+    */
+    virtual TInt Answer();
+
+    /**
+    * Starts dialing to recipient
+    * @since Series60 3.2
+    * @return KErrNone or system wide error code
+    */
+    virtual TInt Dial();
+
+	/**
+	* Cancels ongoing dial or answer request
+	* @since Series60 3.2
+	* @return KErrNone or system wide error code
+	*/
+	virtual TInt Cancel();
+
+    /**
+    * Ends an ongoing call.
+    * @since Series60 3.2
+    * @return KErrNone or system wide error code
+    */
+    virtual TInt HangUp();
+
+    /**
+    * Rejects an incoming call.
+    * @since Series 60 3.2
+    * @return KErrNone or system wide error code
+    */
+    virtual TInt Reject();
+
+    /**
+    * Reguests plug-in to queue the call. 
+    * @since S60 3.2
+    * @return KErrNone or system wide error code
+    */
+    virtual TInt Queue();
+
+    /**
+    * Call is ringning
+    * @since S60 3.2
+    * @return KErrNone or system wide error code 
+    */
+    virtual TInt Ringing();
+
+    /**
+    * Puts the specified call on hold.
+    * @since Series60 3.2
+    * @return KErrNone or system wide error code 
+    */
+    virtual TInt Hold();
+
+    /**
+    * Resumes the call.
+    * @since Series60 3.2
+    * @return KErrNone or system wide error code
+    */
+    virtual TInt Resume();
+    
+    /**
+    * Swaps a connected call to its opposite state, either active or on hold
+    * @since Series60 3.2
+    * @return KErrNone or system wide error code 
+    */
+    virtual TInt Swap();
+
+    /**
+    * Releases all bindings to call and calls destructor
+    * @since Series60 3.2
+    * @return KErrNone  
+    */
+    virtual TInt Release();
+
+    /**
+    * Returns the recipient of the call.
+    * @since Series60 3.2
+    * @return recipient address,
+    */
+    virtual const TDesC& RemoteParty() const;
+
+    /**
+    * Returns display name of the recipient of the call.
+    * @since Series60 3.2
+    * @return Recipient's display name
+    */
+    virtual const TDesC& RemotePartyName();
+
+    /**
+    * Returns the original dialled party.
+    * @since Series60 3.2
+    * @return Dialled party,
+    */
+    virtual const TDesC& DialledParty() const;
+
+	/**
+    * Return boolean value, is incoming call forwarded or not.
+    * @since Series60 3.2
+    * @return ETrue if call is forwarded, else EFalse
+    */
+    virtual TBool IsCallForwarded() const;
+
+    /**
+    * Returns boolean value, is the call mobile originated.
+    * @since Series60 3.2
+    * @return ETrue if call is mobile originated, otherwise EFalse
+    */
+    virtual TBool IsMobileOriginated() const;
+
+    /**
+    * Returns the state of the call.
+    * @since Series60 3.2
+    * @return TCCPCallState The current state of the call
+    */
+    virtual MCCPCallObserver::TCCPCallState State() const;
+
+    /**
+    * Returns TUid of the Plug-In used for this call
+    * @since Series60 3.2
+    * @return TUid Implementation UID of the Plug-In
+    */
+    virtual TUid Uid() const;
+
+    /**
+    * Returns call control caps for this call This tells for CCE what call can
+    * currently do.
+    * @since Series60 3.2
+    * @return Call control caps defined in MCCPCallObserver::TCCPCallControlCaps.
+    */
+    virtual MCCPCallObserver::TCCPCallControlCaps Caps() const;
+
+    /**
+    * Get call's secure status.
+    * @since Series 60 3.2
+    * @return TBool ETrue if security is enabled, else EFalse.
+    */
+    virtual TBool IsSecured() const;
+
+    /**
+	* Get Conference extension methods
+	* @since Series 60 3.2
+	* @return Pointer to MCCPCSCallConfernece if succesfull, NULL if not available
+	*/
+	virtual MCCPConferenceCall* ConferenceProviderL( const MCCPConferenceCallObserver& aObserver );
+   
+    /**
+	* Get Forward provider
+	* @since Series 60 3.2
+	* @return Pointer to MCCPForwardProvider if succesfull, NULL if not available
+	*/
+	virtual MCCPForwardProvider* ForwardProviderL( const MCCPForwardObserver& aObserver );
+	
+	
+	 /**
+    * Get Call transfer provider
+    * @since Series 60 3.2
+    * @return Pointer to MCCPTransferProvider if succesfull, NULL if not available
+    */
+	MCCPTransferProvider* TransferProviderL( const MCCPTransferObserver& aObserver );
+	
+	
+	/**
+	* Set call parameters.
+	* @since S60 3.2
+	* @param aNewParams New call paramater information.
+	*/
+    void SetParameters( const CCCPCallParameters& aNewParams );
+
+    /**
+	* Cet call parameters.
+	* @since S60 3.2
+	* @param None
+	* @return Current call paramater information.
+	*/
+    virtual const CCCPCallParameters& Parameters() const;
+
+    /**
+    * Returns currently used tone for the call. Used in case tones are needed to be played.
+	* See defenition for TCCPTone.
+    * @since S60 3.2
+    * @param None.
+    * @return TCCPTone Used tone.
+    */
+    TCCPTone Tone() const;
+
+public: // from SVPHoldObserver
+
+    /**
+    * Notifies, that session has been holded.
+    * @since Series 60 3.2
+    */
+    virtual void SessionLocallyHeld();
+
+    /**
+    * Notifies, that session has been resumed.
+    * @since Series 60 3.2
+    */
+    virtual void SessionLocallyResumed();
+    
+    /**
+    * Notifies, that session has been remotely held.
+    * @since Series 60 3.2
+    */
+    virtual void SessionRemoteHeld();
+
+    /**
+    * Notifies, that session has been remotely resumed.
+    * @since Series 60 3.2
+    */
+    virtual void SessionRemoteResumed();
+    
+    /**
+    * Notifies, that hold request failed.
+    * @since Series 60 3.2
+    */
+    virtual void HoldRequestFailed();
+ 
+    /**
+    * Notifies, that resume request failed.
+    * @since Series 60 3.2
+    */
+    virtual void ResumeRequestFailed();
+
+         
+public: // from MSVPTransferObserver
+         
+    /**
+    * From MSVPTransferObserver
+    * Notifier for succesful transfer.
+    * @since Series60 3.2
+    * @param aNotifyCode The transfer notify code
+    */
+    virtual void TransferNotification( TInt aNotifyCode );
+
+    /**
+    * From MSVPTransferObserver
+    * Notifier for transfer failure.
+    * @since Series60 3.2
+    * @param aError The error Id.    
+    */
+    virtual void TransferFailed( TInt aError );     
+    
+public: // from MSVPPropertyWatchObserver   
+    
+    /**
+    * CSVPPropertyWatch calls this when some property under watching was
+    * changed. 
+    *
+    * @since S60 3.2
+    * @param aKey Property which was changed
+    * @param aValue New value of the property
+    */
+    void ValueChangedL( TInt aKey, TInt aValue );
+    
+    /**
+    * CSVPPropertyWatch calls this when property was deleted.
+    *
+    * @since S60 3.2
+    * @param aKey Property which was deleted
+    */
+    void PropertyDeleted( TInt aKey );
+
+protected: // new methods
+
+    /**
+     * Updates keepalive parameters for session
+     * @since Series 60 3.2
+     * @param aSession Session to be updated
+     * @param aSessionUpdateOngoing Determines whether session needs to be updated
+     * @return 
+     */
+    void UpdateKeepAliveL( CMceSession& aSession, TBool aSessionUpdateOngoing );
+
+    /**
+     * Worker function for session state change, called from
+     * SessionStateChanged().
+     * @since S60 v3.2
+     * @param aOrigStatus Original status code
+     * @param aError Mapped TCCPError
+     * @param aModStatus Modified status code
+     * @return void
+     */
+    virtual void SessionStateChangedL( TInt aOrigCode, TCCPError aError,
+        TInt aModStatus );
+        
+    /**
+     * Initializes mute P&S property watcher and CenRep volume watcher
+     * @Since S60 3.2
+     * @param
+     * @return instance of session
+     */
+    void InitializePropertyWatchingL();
+    
+    /**
+     * Sets RTP keep-alive timer value and payload
+     * @since Series 60 3.2
+     * @param aSession MCE session
+     * @param aSessionUpdateOngoing Determines whether session needs to be updated
+     * @return void
+     */
+    virtual void SetRtpKeepAliveL( CMceSession* aSession,
+                                   TBool aSessionUpdateOngoing );
+    
+    /**
+     * Executes session observer callback(Cb) if not NULL.
+     * @since Series 60 3.2
+     * @param aError the error code.
+     * @return System wide error code.
+     */
+    TInt ExecCbErrorOccurred( TCCPError aError );
+    
+    /**
+     * Sets new internal call state, and executes session observer callback(Cb)
+     * if not NULL.
+     * @since Series 60 3.2
+     * @param aNewState new state
+     * @return System wide error code.
+     */
+    TInt ExecCbCallStateChanged( MCCPCallObserver::TCCPCallState aNewState );
+    
+    /**
+     * Executes session observer callback(Cb) if not NULL.
+     * @since Series 60 3.2
+     * @param aEvent the new event.
+     * @return System wide error code.
+     */
+    TInt ExecCbCallEventOccurred( MCCPCallObserver::TCCPCallEvent aEvent );
+
+    /**
+     * Executes supplementary services(Ss) observer callback(Cb) if not NULL.
+     * Events can be e.g. call forward related events
+     * that are not call related to an existing call
+     * @since Series 60 3.2
+     * @param aEvent the new event.
+     * @return System wide error code.
+     */
+    TInt ExecCbSsEventOccurred( MCCPSsObserver::TCCPSsCallForwardEvent aEvent );
+
+
+private: // new methods
+    
+    /**
+     * Method for checking audio priorities in audio streams. Method checks
+     * that correct audio priorities are used in inband/outband DTMF cases and
+     * sets them accordingly to uplink side codecs.
+     * @since S60 v3.2
+     * @param aAudioStreams. Media streams in iSession.
+     * @return void
+     */
+    void CheckMmfPrioritiesForDtmfL(
+        const RPointerArray<CMceMediaStream>& aAudioStreams ) const;
+        
+    /**
+     * Method for seek remote party
+     * Handle possible leave
+     * @since Series 60 3.2
+     * @return void
+     * @leave system error if searching fails
+     */
+    void RemotePartyL() const;
+
+    /**
+     * Volume level changed
+     * Handle possible leave
+     * @since S60 3.2
+     * @param aVolume New volume level
+     * @return void
+     * @leave system error if volume settings fails
+     */
+    void VolumeChangedL( TInt aVolume );
+    
+    /**
+     * Performs mute / unmute
+     * @since S60 3.2
+     * @param aStreams Media streams
+     * @param aValue Mute change value
+     * @return void
+     * @leave system error if mute/unmute fails
+     */
+    void PerformMuteChangeL( const RPointerArray< CMceMediaStream >& aStreams,
+                             TInt aValue );
+
+    /**
+     * Sets Flag that indicates Error in UpLink (ICMP -3) happens the 1st Time
+     * @since Series 60 3.2
+     * @return none
+     */
+    void SetErrorInULandDLFirstTime( TBool aFirstTime );
+
+    /**
+     * Returns is the error in Uplink has happened the only 1st time
+     * @since Series 60 3.2
+     * @return TBool Flag value
+     */
+    TBool IsErrorInULandDLFirstTime();
+    
+    /**
+     * Returns ETrue if both UpLink and DownLink are disabled
+     * @since Series 60 3.2
+     * @return TBool Flag value
+     */
+    TBool IsBothStreamsDisabledL() const;
+
+    
+protected: // protected data
+    
+    /**
+     * Mce session
+     * Own.
+     */ 
+    CMceSession* iSession;
+    
+    /**
+     * Temporary secure session, needed so that old session deletion can be
+     * performed painlessly.
+     * Own.
+     */ 
+    CMceSession* iTempSecSession;
+    
+    /**
+     * reference to SVP utility class
+     */ 
+    CSVPUtility& iSVPUtility;
+    
+    /**
+     * reference to SVP Rtp observer class. Needed for RTCP resetting.
+     */
+    CSVPRtpObserver& iRtpObserver;
+    
+    /**
+     * SIP profile id 
+     */
+    TUint32 iSipProfileId;
+    
+    /**
+     * Converged call provider call observer
+     */
+    MCCPCallObserver* iCCPSessionObserver;
+    
+    /**
+     * Observer for supplementary services events 
+     */
+    MCCPSsObserver* iCCPSsObserver;
+    
+    /**
+     * Flag that indicates whether established session is secured or not
+     */
+    TBool iSecured;
+
+    /**
+     * Call event which will be sent in securepreferred or attended transfer cases.
+     */
+    MCCPCallObserver::TCCPCallEvent iCallEventToBeSent;
+
+    /**
+     * Id of VoIP profile
+     */
+    TUint32 iVoIPProfileId;
+    
+    /**
+     * Keep-alive timer value
+     */
+    TInt iKeepAliveValue;
+    
+    /**
+     * Call parameters
+     */
+    CCCPCallParameters* iCallParameters;
+    
+    /**
+     * User tries to call to sips: -uri, secpref 0 is used
+     * this flag is needed for event notification
+     */
+    TBool iTLSNotInUse;
+    
+    /**
+     * Prevents UI notes if error response received to BYE request
+     */
+    TBool iAlreadyTerminating;
+    
+    /**
+     * This flag indicates whether preconditions
+	 * are required in SIP headers or not 
+     */
+    TBool iPreconditions;
+    
+private:    // private data
+    
+    /**
+     * Transaction data container, not owned.
+     */
+    TMceTransactionDataContainer& iContainer;
+    
+    /*
+     * Instance of DTMF event generator, used in inband dtmf case
+     * Own.
+     */
+    CSVPDTMFEventGenerator* iEventGenerator;
+    
+    /**
+     * Instance of volume observer, observer CenRep
+     * Own.
+     */
+    CSVPVolumeObserver* iVolObserver;
+    
+    /**
+     * Instance of property watcher using P&S system
+     * Own.
+     */
+    CSVPPropertyWatch* iMutePropertyWatch;
+    
+    /**
+     * Session timers, need an array since there migh be more than one.
+     */
+    RPointerArray<CSVPTimer> iTimers;
+    
+    /**
+     * Contains current session state
+     */
+    MCCPCallObserver::TCCPCallState iSessionState;
+    
+    /**
+     * From header of the mce session, from headers
+     * Own.
+     */  
+    HBufC8* iFromHeader;
+    
+    /**
+     * To header of the mce session, from headers
+     * Own.
+     */    
+    HBufC8* iToHeader;
+    
+    /**
+     * Call id of the mce session, from headers
+     * Own.
+     */
+    HBufC8* iCallId;
+    
+    /**
+     * CSeq header of the mce session, from headers
+     * Own.
+     */
+    HBufC* iCSeqHeader;
+    
+    /**
+     * The address of the recipient of the SIP session.
+     * Own.
+     */
+    mutable HBufC* iRecipient;
+
+    /**
+     * Display name of the recipient of the SIP session.
+     * Own.
+     */
+    HBufC* iDisplayName;
+    
+    /**
+     * Pointer to a SVP hold controller.
+     * Own.
+     */
+    CSVPHoldController* iHoldController;
+    
+    /**
+     * Pointer to transfer controller.
+     * Own.
+     */    
+    CSVPTransferController* iTransferController;
+    
+    /**
+     * Terminating timeout time repeat control value when incoming transfer
+     * ongoing.
+     */ 
+    TInt iTerminatingRepeat;
+    
+    /**
+     * CCP DTMF observer
+     */
+    MCCPDTMFObserver* iCCPDtmfObserver;
+    
+    /**
+     * SVP session observer
+     */
+    MSVPSessionObserver& iObserver;
+    
+    /**
+     * Flag to indicate secure preference value 1 -> secure is preferred
+     */
+    TBool iSecurePreferred;
+    
+    /**
+     * Flag to indicate secure preference value 2 -> secure call mandatory
+     */
+    TBool iSecureMandatory;
+    
+    /**
+     * Mute flag
+     */
+    TBool iMuted;
+    
+    /**
+    * Flag that indicates that handling of received re-INVITE 
+    * without is SDP is ongoing
+    */
+    TBool iEmptyReInvite;
+    
+    /**
+     * Tone information. Updated everytime session state changes.
+     */
+    TCCPTone iTone;
+    
+    /* 
+     * Contains DTMF tone sent. Used with inband DTMF. 
+     */  
+    TChar iDtmfTone;
+    
+    /* 
+     * Contains DTMF string sent. Used with inband DTMF. 
+     */
+    HBufC* iDtmfString;
+    
+    /* 
+     * Keeps count of the current tone sent. Used with inband DTMF
+     */
+    TLex iDtmfLex;  
+
+    /**
+    * Flag that indicates that the case MediaStreams are 
+    * Disabled (ICMP -3 error) happens 1st time
+    */
+    TBool iErrorInULandDLFirstTime;
+
+    /**
+     * Flag that indicates whether earlymedia event should 
+	 * be sent again in ringing case
+     */
+    TBool iEarlyMediaOngoing;
+    
+private:
+    
+	// For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif // SVPSESSIONBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpsessionobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,59 @@
+/*
+* 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 observer methods for SVP
+*
+*/
+
+
+
+#ifndef SVPSESSIONOBSERVER_H
+#define SVPSESSIONOBSERVER_H
+
+
+class CSVPSessionBase;
+class CMceInSession;
+
+
+/**
+*  An interface to be implemented by users of MCE if they wish to receive
+*  information about SVP sessions: Used mainly for session cleanup procedures
+*
+*
+*  @lib svp.dll
+*/
+class MSVPSessionObserver
+    {
+
+public: // New functions
+        
+        /**
+        * Removes session from array.
+        * @since Series60 3.2
+        * @param aSession
+        * @return None.
+        */
+        virtual void RemoveFromArray( CSVPSessionBase& aSession ) = 0;
+        
+        /**
+        * Terminates session when Mt session creation has failed in early
+        * stages of session creation and CCE does not have information
+        * about incoming session
+        * @since Series60 3.2
+        * @param aSession Session to be terminated.
+        * @return None.
+        */
+        virtual void TerminateSession( CMceInSession& aSession ) = 0;				
+    };
+
+#endif // SVPSESSIONOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpsettings.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* 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 : Definition of service provider settings
+*
+*/
+
+
+#ifndef SVPSETTINGS_H
+#define SVPSETTINGS_H
+
+#include <e32base.h>
+#include <spdefinitions.h>
+#include <e32cmn.h>
+
+class CSPSettings;
+class CSPProperty;
+
+/**
+ *  Defines settings reader for VCC
+ *
+ *  @code
+ *  @endcode
+ *
+ *  @since S60 v3.2
+ */
+class SvpSettings
+ {
+ public:
+ 
+   /**
+    * 
+    * 
+    * @since S60 v3.2
+    * @return 
+    */
+    static TInt IntPropertyL( TUint aServiceId, 
+                TServicePropertyName aPropertyName );
+    
+  
+ // No copy, assigment or creation of this class.
+
+private:    
+    /**
+     * Assigment operator
+     * 
+     * @since S60 v3.2
+     */
+	SvpSettings& operator = ( const SvpSettings& );
+    
+    /**
+     * Default C++ constructor
+     * 
+     * @since S60 v3.2
+     */
+	SvpSettings();
+    
+    
+    /**
+     * Copy constructor
+     * 
+     * @since S60 v3.2
+     */
+	SvpSettings( const SvpSettings& );
+    
+ };
+
+#endif // SVPSETTINGS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpsipconsts.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  SIP constants for SVP.
+*
+*/
+
+
+
+#ifndef SVPSIPCONSTS_H
+#define SVPSIPCONSTS_H
+
+#include <e32base.h>
+
+// Reason phrases
+_LIT8( KSVPIntervalTooSmallReason, "Session Interval Too Small" );
+_LIT8( KSVPCallTransactDoesNotExistReason, "Call/Transaction Does Not Exist");
+_LIT8( KSVPQueuedReason, "Queued" );
+_LIT8( KSVPRequestTerminatedReason, "Request Terminated");
+_LIT8( KSVPIncompatibleMediaFormatReason, "Incompatible media format");
+_LIT8( KSVPNotAcceptableHereReason, "Not Acceptable Here" );
+
+//Response codes
+_LIT8( KSVPNotifyTrying, "SIP/2.0 100 Trying" );
+_LIT8( KSVPNotifyRinging, "SIP/2.0 180 Ringing" );
+_LIT8( KSVPNotifyOK, "SIP/2.0 200 OK" );
+_LIT8( KSVPBusyHereReason, "SIP/2.0 486 Busy Here" );
+_LIT8( KSVPNotifyServiceUnavailable, "SIP/2.0 503 Service Unavailable" );
+_LIT8( KSVPNotifyRinging183, "SIP/2.0 183 Ringing" );
+_LIT8( KSVPNotifyOk2, "SIP/2.0 200 Ok" );
+
+//Response messages
+//Provisional 1xx
+const TInt KSVPTryingVal                   = 100;
+const TInt KSVPRingingVal                  = 180;
+const TInt KSVPForwardedVal                = 181;
+const TInt KSVPQueuedVal                   = 182;
+const TInt KSVPSessionProgressVal          = 183;
+
+//Successful 2xx
+const TInt KSVPOKVal                       = 200;
+const TInt KSVPAcceptedVal                 = 202;
+
+// Call forwarding 3xx
+const TInt KSVPMultipleChoicesVal          = 300;
+const TInt KSVPMovedPermanentlyVal         = 301;
+const TInt KSVPMovedTemporarilyVal         = 302;
+const TInt KSVPUseProxyVal                 = 305;
+const TInt KSVPAlternativeServiceVal       = 380;
+
+//Request Failure 4xx
+const TInt KSVPBadRequestVal               = 400;
+const TInt KSVPUnauthorizedVal             = 401;
+const TInt KSVPPaymentRequiredVal          = 402;
+const TInt KSVPForbiddenVal                = 403;
+const TInt KSVPNotFoundVal                 = 404;
+const TInt KSVPMethodNotAllowedVal         = 405;
+const TInt KSVP406NotAcceptableVal         = 406;
+const TInt KSVPProxyAuthenticationRequiredVal = 407;
+const TInt KSVPRequestTimeoutVal           = 408;
+const TInt KSVPGoneVal                     = 410;
+const TInt KSVPRequestEntityTooLargeVal    = 413;
+const TInt KSVPRequestUriTooLongVal        = 414;
+const TInt KSVPUnsupportedMediaTypeVal     = 415;
+const TInt KSVPUnsupportedUriSchemeVal     = 416;
+const TInt KSVPBadExtensionVal             = 420;
+const TInt KSVPExtensionRequiredVal        = 421;
+const TInt KSVPSessionIntervalTooSmallVal  = 422;
+const TInt KSVPIntervalTooBriefVal         = 423;
+const TInt KSVPTemporarilyUnavailableVal   = 480;
+const TInt KSVPCallDoesNotExistVal         = 481;
+const TInt KSVPLoopDetectedVal             = 482;
+const TInt KSVPTooManyHopsVal              = 483;
+const TInt KSVPAddressIncompleteVal        = 484;
+const TInt KSVPAmbiguousVal                = 485;
+const TInt KSVPBusyHereVal                 = 486;
+const TInt KSVPRequestTerminatedVal        = 487;
+const TInt KSVPNotAcceptableHereVal        = 488;
+const TInt KSVPBadEventVal                 = 489;
+const TInt KSVPRequestPendingVal           = 491;
+const TInt KSVPSecurityAgreementRequiredVal = 494;
+
+//Server Failure 5xx
+const TInt KSVPServerInternalErrorVal      = 500;
+const TInt KSVPNotImplementedVal           = 501;
+const TInt KSVPBadGatewayVal               = 502;
+const TInt KSVPServiceUnavailableVal       = 503;
+const TInt KSVPServerTimeoutVal            = 504;
+const TInt KSVPVersionNotSupportedVal      = 505;
+const TInt KSVPMessageTooLargeVal          = 513;
+const TInt KSVPPreconditionFailureVal      = 580;
+
+//Global Failures 6xx
+const TInt KSVPDeclineVal                  = 603;
+const TInt KSVPBusyEverywhereVal           = 600;
+const TInt KSVPDoesNotExistAnywhereVal     = 604;
+const TInt KSVPNotAcceptableVal            = 606;
+
+//WarnCodes of the Response
+//Media type not available
+const TInt KSVPWarnMediaTypeNotAvailable   = 304;
+//Incompatible media format
+const TInt KSVPWarnIncompatibleMediaFormat = 305;
+
+
+#endif // SVPSIPCONSTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpsslogcall.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,164 @@
+/*
+* 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:  Logs call in case of Do Not Disturb 
+*
+*/
+
+
+
+#ifndef SVPSSLOGCALL_H
+#define SVPSSLOGCALL_H
+
+//  INCLUDES
+// logs
+#include <logwrap.h>
+#include <logcli.h>
+#include <logeng.h>
+#include <f32file.h>
+#include <e32base.h>
+#include <cntdef.h>
+#include <centralrepository.h>
+#include "svputdefs.h"
+
+#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
+#include <logwraplimits.h>
+#include <logengdurations.h>
+#endif
+
+/**
+ *  Logs call in case of Do Not Disturb.
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPSSLogCall : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CSVPSSLogCall* NewL();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CSVPSSLogCall();
+
+    public: // New functions
+        
+        /**
+        * Logs call
+        * @since Series 60 3.0
+        * @param aFrom Caller address
+        * @return None
+        */
+        void HandleCallLoggingL( const TDesC8& aFrom );
+        
+        /**
+        * Resets LogEvent
+        * @since Series 60 3.0
+        */
+        void Reset();
+                
+    public: // Functions from CActive
+        
+        /**
+        * From CActive Called when an aychronic request cancelled.
+        * @since Series 60 3.0
+        */
+        void DoCancel();
+        
+        /**
+        * From CActive Called when an aychronic request is completed.
+        * @since Series 60 3.0
+        */
+        void RunL();
+               
+    
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CSVPSSLogCall();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * Finds contact title from phonebook if one exists
+        * @since Series 60 3.0
+        * @param aSipUri Caller address
+        * @return contact title if match found, null otherwise
+        */
+        HBufC* FindContactTitleL( const TDesC& aSipUri );        
+        
+        /* 
+        * Removes some unused characters from SIP address. Firstly,
+        * display name, '<' and '>' are removed. Secondly, the "sip:"
+        * prefix is removed if needed.
+        * Since Series60 3.0
+        * @param aAddress for SIP URI descriptor.
+        */
+        void RemoveUnusedCharsFromSipAddress( TDes& aAddress );
+        
+        /*
+        * Compares plain SIP URIs. 
+        * Username part is case sensitive but uri path isn't.
+        * Since Series60 3.0
+        * @param aTelNumber contains number to compare.
+        * @param aPbookNumber contains phonebook number to compare.
+        * @return ETrue if match found, EFalse otherwise.
+        */            
+        TBool CompareSipUri( const TDesC& aTelNumber, 
+                                const TDesC& aPbookNumber );
+        
+        /*
+        * Parses and compares SIP URI username parts.
+        * Since Series60 3.0
+        * @param aTelNumber contains number to compare.
+        * @param aPbookNumber contains phonebook number to compare.
+        * @return ETrue if match found, EFalse otherwise.
+        */            
+        TBool CompareUsernamePart( const TDesC& aTelNumber, 
+                                        const TDesC& aPbookNumber );
+
+
+    private:    // Data
+    
+        // A handle to a file server session
+        RFs iFs;
+        
+        // Instance of Log Event
+        CLogEvent* iLogEvent;
+        
+        // Instance of Log Client
+        CLogClient* iLogClient;
+        
+        // A CR session & notifier for logs
+        CRepository* iLogsSession;
+    
+	private:
+		
+		// For testing
+		SVP_UT_DEFS
+    
+    };
+
+#endif      // SVPSSLOGCALL_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpsupplementaryservices.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,112 @@
+/*
+* 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 implementing Call Restrictions
+*
+*/
+
+
+#ifndef SVPSUPPLEMENTARYSERVICES_H
+#define SVPSUPPLEMENTARYSERVICES_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <centralrepository.h> 
+
+#include "svpconsts.h"
+#include "svpsslogcall.h"
+#include "svputdefs.h"
+
+/**
+ *  SVP supplementary services
+ *
+ *  Handles Do Not Disturb and anonymous call barring cases.
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2 
+ */
+// DATA TYPES
+enum TCheckingState
+    {
+    ESVPIdle,
+    ESVPAllowingDail,
+    ESVPMakingCallLog,
+    ESVPCheckingAnonymousToDial,
+    ESVPCheckingAnonymousToLog,
+    ESVPRejectingCall,
+    ESVPError
+    };
+class CSVPSupplementaryServices : public CBase
+    {
+
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        */
+        static CSVPSupplementaryServices* NewL();
+        static CSVPSupplementaryServices* NewLC();
+
+        /**
+        * For sending response to incoming INVITE.
+        * @since S60 3.2
+        * @param aHeaders SIP headers.  
+        * @return type of restriction.
+        */
+        TSupplementaryServicesEvent CheckRestrictionsL( 
+        		CDesC8Array& aHeaders);
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CSVPSupplementaryServices();
+
+    private:
+
+
+        /**
+        * C++ default constructor.
+        */
+        CSVPSupplementaryServices();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+    
+        /**
+        * Supplementary Services event
+        */
+        TSupplementaryServicesEvent iSSEvent;
+        
+        /**
+        * Instance of CSSLogCall for call logging (DND)
+        */
+        CSVPSSLogCall* iLogCall;
+        
+        /**
+        * Instance of Central Repository
+        */
+        CRepository* iRichCallRepository;
+
+	private:
+		
+		// For testing
+        SVP_UT_DEFS
+        
+    };
+
+#endif      // SVPSUPPLEMENTARYSERVICES_H
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svptimer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,118 @@
+/*
+* 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:  Timer services for SVP
+*
+*/
+
+
+
+#ifndef SVPTIMER_H
+#define SVPTIMER_H
+
+#include <e32base.h>
+#include "svputdefs.h"
+
+class MSVPTimerObserver;
+
+/**
+ *  SVP timer
+ *
+ *  Provides timer service for SVP 
+ *
+ *  @lib 
+ *  @since S60 3.2
+ */
+class CSVPTimer : public CTimer
+    {
+
+public:
+
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPTimer* NewL( MSVPTimerObserver& aObserver,
+                            TInt aTimerId );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPTimer();
+
+public: // new methods
+
+    /**
+    * Sets the timer to be fired after given number of milliseconds.
+    * @since Series 60 3.2
+    * @param aMilliSeconds Time in milliseconds 
+    * @return 
+    */
+    void SetTime( TInt aMilliSeconds );
+
+    /**
+    * Stops the timer.
+    * @since Series 60 3.2
+    * @return 
+    */
+    void Stop();
+
+    /**
+    * Returns the Timer ID
+    * @since Series 60 3.2
+    * @return TInt The timer ID.
+    */
+    TInt Id() const;
+    
+public: // methods from base classes
+
+    /**
+    * From CActive Called when an aychronic request is completed.
+    * @since Series 60 3.0
+    * @param None
+    * @return None
+    */
+    void RunL();
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPTimer( MSVPTimerObserver& aObserver, TInt aTimerId );
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+private: // data
+    
+    /**
+    * Reference to the observer.
+    */
+    MSVPTimerObserver& iObserver;
+  
+    /**
+    * The timer ID, given to observer when the timer fires.
+    * Timers can be identifies with this ID.
+    */
+    TInt iId;
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+		
+    };
+
+#endif // SVPTIMER_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svptimerobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Observer for SVP timer
+*
+*/
+
+
+#ifndef SVPTIMEROBSERVER_H
+#define SVPTIMEROBSERVER_H
+
+
+/**
+ *  SVP timer observer
+ *
+ *  Observer for SVP timer
+ *
+ *  @lib 
+ *  @since S60 3.2
+ */
+class MSVPTimerObserver
+    {
+
+public: // New functions
+        
+    /**
+    * Notifies, that the previously set timer has now expired.
+    * Implemented by the class using the timer.
+    * @since Series 60 3.2
+    * @param TInt aTimerId The ID of the timer. Observer can identify 
+    * timers from each other with this ID.
+    * @return 
+    */
+    virtual void TimedOut( TInt aTimerId ) = 0;       
+    				
+  		
+    };
+
+#endif // SVPTIMEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpuriparser.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,327 @@
+/*
+* 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:  provides uri parser methods for SVP
+*
+*/
+
+
+
+#ifndef SVPURIPARSER_H
+#define SVPURIPARSER_H
+
+#include <escapeutils.h>
+#include "svputdefs.h"
+
+ /**
+ *  Uri parser methods for SVP
+ *
+ *  @lib 
+ *  @since S60 3.2
+ */
+class CSVPUriParser : public CBase
+    {
+
+public: 
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPUriParser* NewL();
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPUriParser* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPUriParser();
+
+
+public: // new methods
+
+    
+    /**
+    * Method for setting user=phone parameter to invite
+    * @sinceSeries 60 3.2
+    * @param aValue ETrue or EFalse
+    */
+    void SetUserEqualsPhoneRequiredL( TBool aValue );
+
+    /**
+    * Method for checking if uri is valid for user=phone parameter
+    * @since Series 60 3.2
+    * @param aUri Uri to be checked
+    * @return TBool URI ETrue if valid, EFalse otherwise
+    */
+    static TBool IsUriValidForUserEqualsPhoneL( const TDesC8& aUri );
+    
+    /**
+    * Method for checking whether user=phone is needed
+    * @since Series 60 3.2
+    * @return TBool ETrue if valid, EFalse otherwise
+    */
+    TBool UserEqualsPhoneRequiredL() const;
+
+    /**
+    * Adds user=phone if neccessary
+    * @since Series 60 3.2
+    * @param aUri URI where the user=phone parameter is added
+    */
+    void AddUserEqualsPhoneL( HBufC8*& aUri ) const;
+
+   
+    /**
+    * Completes the recipients SIP Uri. 
+    * Adds "sip:", if it's missing.
+    * Adds "@", if it's missing.
+    * Adds the domain from own registered SIP Profile to the
+    * domain part of address if it's missing.
+    * Leaves on error.
+    * @since Series 60 3.2
+    * @param aUri The URI to be completed, non-modifiable descriptor.
+    * @param aAOR the address-of-record containing the domain part
+    * @param aIsEmergency Indicates emergency call
+    * @return Pointer to the altered URI
+    */
+    HBufC8* CompleteSipUriL( 
+        const TDesC8& aUri, 
+        const TDesC8& aAOR, 
+        TBool aIsEmergency = EFalse ) const;
+    
+    /**
+    * Completes the recipients SIP Uri. 
+    * Adds "sips:", if it's missing.
+    * Adds "@", if it's missing.
+    * Adds the domain from own registered SIP Profile to the
+    * domain part of address if it's missing.
+    * Leaves on error.
+    * @since Series 60 3.2
+    * @param aUri The URI to be completed, non-modifiable descriptor.
+    * @param aAOR the address of record containing the domain part
+    * @return Pointer to the altered URI
+    */
+    HBufC8* CompleteSecureSipUriL( const TDesC8& aUri, 
+                                   const TDesC8& aAOR ) const;
+    
+    /**
+    * Completes the recipients SIP Uri for SIP events. 
+    * Adds "sip:", if it's missing.
+    * Leaves on error.
+    * @since Series 60 3.2
+    * @param aUri The URI to be completed, non-modifiable descriptor.
+    * @return Pointer to the altered URI
+    */
+    HBufC8* CompleteEventSipUriL( const TDesC8& aUri ) const;
+
+    /**
+    * Parses aUri and returns its domain part
+    * @sinceSeries 60 3.2
+    * @param aUri URI for extracting domain
+    * @return Pointer to a newly allocated domain part
+    */
+    static HBufC8* DomainL( const TDesC8& aUri );
+    
+    /**
+    * Escape decodes the characters which are not acceptable in SIP URI  
+    * @since Series 60 3.2
+    * @param aSipUri SIP Uri to decode
+    * @return None
+    */  
+    static void EscapeDecodeSipUriL( HBufC8*& aSipUri );
+    
+    /**
+    * Escape encodes the characters which are not acceptable in SIP URI  
+    * @since Series 60 3.2
+    * @param aSipUri SIP Uri to encode
+    * @param aMode Defines the escaping mode
+    * @return None
+    */
+    static void EscapeEncodeSipUriL( HBufC8*& aSipUri, EscapeUtils::TEscapeMode aMode );
+
+    /**
+    * Parses and returns display name of the given remote party address  
+    * @since Series 60 3.2
+    * @param aAddress Remote party address
+    * @return Display name
+    */
+    static HBufC* ParseDisplayNameL( const TDesC8& aAddress );
+
+    /**
+    * Parses and returns URI of the given remote party address  
+    * @since Series 60 3.2
+    * @param aAddress Remote party address
+    * @return URI
+    */
+    static HBufC* ParseRemotePartyUriL( const TDesC8& aAddress );
+    
+private: // new methods
+    
+    /**
+    * Checks, if the URI given as parameter has
+    * "sips:" prefix.
+    * @since Series 60 3.2
+    * @param aUri The URI to be checked, non-modifiable descriptor.
+    * @return TBool ETrue, if the prefix is there,
+    *         EFalse, if not.
+    */
+    TBool CheckSipsPrefix( const TDesC8& aUri ) const;     
+    
+    
+    /**
+    * Checks, if the URI given as parameter has
+    * "sip:" prefix.
+    * @since Series 60 3.2
+    * @param aUri The URI to be checked, non-modifiable descriptor.
+    * @return TBool ETrue, if the prefix is there,
+    *         EFalse, if not.
+    */
+    TBool CheckSipPrefix( const TDesC8& aUri ) const;
+
+    /**
+    * Checks, if the URI given as parameter has
+    * the "@" character.
+    * @since Series 60 3.2
+    * @param aUri The URI to be checked, non-modifiable descriptor.
+    * @return TBool ETrue, if the chareacter is there,
+    *         EFalse, if not.
+    */
+    TBool CheckAt( const TDesC8& aUri ) const;
+    
+    /**
+    * Checks, if the URI given as parameter has
+    * the domain part.
+    * @since Series 60 3.2
+    * @param aUri The URI to be checked,non-modifiable descriptor.
+    * @return TBool ETrue, if the domain is there,
+    * EFalse, if not.
+    */
+    TBool CheckDomain( const TDesC8& aUri ) const;
+
+    /**
+    * Adds the "sip:" prefix to the URI given as parameter.
+    * Leaves if the adding failes.
+    * @since Series 60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @return None
+    */
+    void AddSipPrefixL( HBufC8*& aUri ) const;
+    
+     /**
+    * Adds the "sips:" prefix to the URI given as parameter.
+    * Leaves if the adding failes.
+    * @since Series 60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @return None
+    */
+    void AddSipsPrefixL( HBufC8*& aUri ) const;
+    
+    /**
+    * Removes the "sip:" prefix from the URI given as parameter.
+    * Leaves if the adding failes.
+    * @since Series 60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @return None
+    */
+    void RemoveSipPrefixL( HBufC8*& aUri ) const;
+    
+    /**
+    * Removes the "sips:" prefix from the URI given as parameter.
+    * Leaves if the adding failes.
+    * @since Series 60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @return None
+    */
+    void RemoveSipsPrefixL( HBufC8*& aUri ) const;
+
+    /**
+    * Checks, if the URI given as parameter has
+    * the "<" character.
+    * @since Series 60 3.2
+    * @param aUri The URI to be checked, non-modifiable descriptor.
+    * @return TBool ETrue, if the chareacter is there,
+    *         EFalse, if not.
+    */
+    TBool CheckLeftBracket( const TDesC8& aUri ) const;
+
+    /**
+    * Removes the "<" character from the URI given as parameter.
+    * @since Series 60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @return None
+    */
+    void RemoveLeftBracket( HBufC8*& aUri ) const;
+
+    /**
+    * Checks, if the URI given as parameter has
+    * the ">" character.
+    * @since Series 60 3.2
+    * @param aUri The URI to be checked, non-modifiable descriptor.
+    * @return TBool ETrue, if the chareacter is there,
+    *         EFalse, if not.
+    */
+    TBool CheckRightBracket( const TDesC8& aUri ) const;
+
+    /**
+    * Removes the ">" character from the URI given as parameter.
+    * @since Series 60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @return None
+    */
+    void RemoveRightBracket( HBufC8*& aUri ) const;
+
+    /**
+    * Adds the "@" character to the URI given as parameter.
+    * Leaves if the adding failes.
+    * @since Series 60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @return None
+    */
+    void AddAtL( HBufC8*& aUri ) const;
+
+    /**
+    * Adds the domain part to the URI
+    * Leaves if the adding failes.
+    * @since Series 60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @return None
+    */
+    void AddDomainL( HBufC8*& aUri, const TDesC8& aAOR ) const;
+        
+private: // methods
+    
+    /**
+    * C++ default constructor.
+    */
+    CSVPUriParser();
+    
+private: // data
+    
+    /**
+    * Variable for to check user=phone setting
+    */    
+    TBool iUserEqualsPhoneRequired;
+
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+		
+    };
+
+
+#endif // SVPUTILITY_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svputdefs.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 wide unit testing definitions.
+*
+*/
+
+#ifndef SVPUTDEFS_H
+#define SVPUTDEFS_H
+
+/*
+#ifdef IMPORT_C
+#undef IMPORT_C
+#define IMPORT_C
+#endif // IMPORT_C
+
+#ifdef EXPORT_C
+#undef EXPORT_C
+#define EXPORT_C
+#endif // EXPORT_C
+*/
+
+//#if (defined _DEBUG || defined DEBUG)
+#if (defined TEST_EUNIT)
+
+#define SVP_UT_DEFS \
+  friend class UT_SipVoipProviderUsecases;\
+  friend class UT_CSVPController;\
+  friend class UT_CSVPSessionBase;\
+  friend class CSVPSession_stub;\
+  friend class UT_CSVPDTMFEventGenerator;\
+  friend class UT_CSVPEmergencyConnection;\
+  friend class UT_CSVPEmergencyIapProvider;\
+  friend class UT_CSVPEmergencySession;\
+  friend class UT_CSVPPositioningProvider;\
+  friend class UT_CSVPHoldConnectedState;\
+  friend class UT_CSVPHoldContext;\
+  friend class UT_CSVPHoldController;\
+  friend class UT_CSVPHoldMediaHandler;\
+  friend class UT_CSVPHoldOutEstablishingState;\
+  friend class UT_CSVPHoldInEstablishingState;\
+  friend class UT_CSVPHoldDHState;\
+  friend class UT_CSVPHoldInState;\
+  friend class UT_CSVPHoldOutState;\
+  friend class UT_CSVPForwardProvider;\
+  friend class UT_CSVPMoSession;\
+  friend class UT_CSVPMtSession;\
+  friend class UT_CSVPPropertyWatch;\
+  friend class UT_CSVPSSLogCall;\
+  friend class UT_CSVPSuppServices;\
+  friend class UT_CSVPTimer;\
+  friend class UT_CSVPTransferController;\
+  friend class UT_CSVPTransferStateContext;\
+  friend class UT_CSVPTransferAcceptedState;\
+  friend class UT_CSVPTransferIdleState;\
+  friend class UT_CSVPTransferPendingState;\
+  friend class UT_CSVPTransferTerminatedState;\
+  friend class UT_CSVPTransferTerminatingState;\
+  friend class UT_CSVPUriParser;\
+  friend class UT_CSVPVolumeObserver;\
+  friend class UT_CSVPUtility;\
+  friend class UT_CSVPAudioUtility;
+
+#else // (defined _DEBUG || defined DEBUG)
+
+#define SVP_UT_DEFS
+
+#endif // (defined _DEBUG || defined DEBUG)
+
+
+#endif // SVPUTDEFS_H
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svputility.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,502 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Static utility functions for SVP.
+*
+*/
+
+
+
+#ifndef SVPUTILITY_H
+#define SVPUTILITY_H
+
+#include <e32base.h>
+#include <mceaudiostream.h>
+#include <mcedtmfobserver.h> // dtmf
+#include <mccpcallobserver.h>
+#include <mceinsession.h> 
+#include <ccpdefs.h>    // error definitions
+#include <mccpdtmfobserver.h> // dtmf
+
+#include "cipappphoneutils.h" // CIpAppPhoneUtils, KSVPMaxTerminalTypeLength
+#include "svpconsts.h"
+#include "svputdefs.h"
+
+// FORWARD DECLARATIONS
+class CRCSEProfileEntry;
+class CRCSEAudioCodecEntry;
+class CMceRtpSource;
+class CSIPProfile;
+class CVoipEventLog;
+class CVoipErrorEntry;
+
+/**
+ *  Static utility function for SVP usage.
+ *
+ *  @lib 
+ *  @since S60 3.2
+ */
+class CSVPUtility : public CBase
+    {
+
+public: 
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPUtility* NewL();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPUtility();
+
+
+public: // new methods
+    
+    /**
+     * Sets keep alive payload and timer when CN is provisioned
+     * @since Series 60 3.2
+     * @param aAudioStream Representation of Mce audio stream
+     * @param aKeepAliveValue Keep-alive timer value
+     * @return None
+     */
+    void SetCNKeepAliveL( CMceAudioStream& aAudioStream,
+                          TInt aKeepAliveValue );
+    /**
+     * Sets keep alive payload and timer when CN is not provisioned
+     * @since Series 60 3.2
+     * @param aAudioStream Representation of Mce audio stream
+     * @param aKeepAliveValue Keep-alive timer value
+     * @return None
+     */
+    void SetKeepAliveL( CMceAudioStream& aAudioStream,
+                        TInt aKeepAliveValue );
+    
+    /**
+     * Sets keep alive payload and timer when CN is not provisioned
+     * @since Series 60 3.2
+     * @param aStream Checks if CN codec is present in stream
+     * @return None
+     */
+    TBool IsComfortNoise( CMceAudioStream& aStream );
+    
+    /**
+    * Set codecs for given stream in Mo call case
+    * Set codecs settings from database
+    * Compares database codecs to those supported by Mce
+    * Leave with value KErrNotFound if codecs not found. 
+    * @since Series 60 3.2
+    * @param aVoIPProfileId VoIP profile ID number 
+    * @param audioInStream Representation of Mce audio stream
+    * @param aKeepAliveValue Keep-alive timer value
+    * @return None
+    */
+    void SetAudioCodecsMOL( TUint32 aVoIPProfileId, 
+                            CMceAudioStream& audioInStream,
+                            TInt aKeepAliveValue );
+
+    /**
+    * Set codecs for given stream in Mt call case
+    * Compares database codecs to those supported by Mce. 
+    * @since Series 60 3.2
+    * @param aVoIPProfile VoIP profile entry
+    * @param audioInStream Representation of Mce audio stream
+    * @param aKeepAliveValue Keepalive timer value
+    * @return None
+    */
+    void SetAudioCodecsMTL( CRCSEProfileEntry& aVoIPProfile, 
+                            CMceMediaStream& aAudioStream,
+                            TInt aKeepAliveValue,
+                            TBool aSessionUpdateOngoing = EFalse );
+
+    /**
+    * Sets G711 codecs (PCMA & PCMU) for emergency call when there is no VoIP 
+    * profile, i.e. calling emergency by IAP ID only. RCSE default profile 
+    * values are used when needed.
+    * @since Series 60 3.2
+    * @param audioInStream   Audio stream
+    * @param aKeepAliveValue Keep-alive value
+    * @param aVoipProfileId VoIP profile ID, KErrNotFound, if no VoIP profile
+    */
+    void SetAudioCodecsForEmergencyL( CMceAudioStream& aAudioInStream,
+                                      TInt aKeepAliveValue, 
+                                      TInt32 aVoipProfileId = KErrNotFound );
+
+    /**
+    * Matches Mce and Ccp errors 
+    * @since S60 3.2
+    * @param aErrorCode Error code - may be modified
+    * @param aTone Contains tone associated to possible error condition.
+    * @return TCCPError CCP error
+    */                             
+    TCCPError GetCCPError( TInt& aErrorCode, TCCPTone& aTone ) const;
+    
+                                         
+    /**
+     * Write mce/sip errors to the voip event logger
+     * @since S60 3.2
+     * @param aErrorCode Error code
+     * @param aSipProfileId Id of the SIP profile
+     * @param aRemoteURI Address of the remote party
+     * @param aMethod Failed method e.g. INVITE          
+     */                             
+    void LogVoipEventL( TInt aErrorCode, 
+                        TUint32 aSipProfileId,
+                        const TDesC& aRemoteURI,
+                        const TDesC& aMethod ) const;
+    
+        
+    /**
+    * Matches Mce and CCP DTMF events 
+    * @since S60 3.2
+    * @param aEvent Event received from Mce DTMF observer
+    * @param aDtmfStringSengin Flag needed to determine which events are 
+    *                          sent to client application
+    * @return TCCPDtmfEvent Matched CCP DTMF event
+    */ 
+    MCCPDTMFObserver::TCCPDtmfEvent GetDtmfEvent( MMceDtmfObserver::TMceDtmfEvent aEvent,
+                                                  TBool aDtmfStringSending );
+         
+   
+    /**
+    * Set provisioning data for VoIP profile.
+    * @param aVoIPProfile VoIP profile entry.
+    * @param aUserAgentHeaders On completion, contains collected user-agent header.
+    */
+    void SetProvisioningDataL( CRCSEProfileEntry& aVoipProfile, 
+                               CDesC8Array& aUserAgentHeaders,
+                               TUint32& aSecurityStatus,
+                               TBuf<KSVPMaxTerminalTypeLength>& aTerminalType,
+                               TBuf<KSVPWlanMacAddressLength>& aWlanMACAddress ) const;
+    /**
+    * Get the terminal type at startup.
+    * @since Series60 3.2
+    * @param aTerminalType
+    */                                                     
+    void GetTerminalTypeL( TBuf< KSVPMaxTerminalTypeLength >& aTerminalType );
+    
+    /**
+    * Get the Wlan MAC address at startup.
+    * @since Series 60 3.2
+    * @param aWlanMACAddress.
+    */
+    static void GetWlanMACAddressL( TBuf< KSVPWlanMacAddressLength >& aWlanMACAddress );
+    
+    /**
+    * Resolves the security mechanism, checks if TLS or SIPS is used in profile
+    * @since Series 60 3.2
+    * @param aProfile SIP profile which is used to call
+    * @param aSecureCallPreference Secure call preference of the call ( 0, 1 or 2 ) 
+    */
+    void ResolveSecurityMechanismL( const CSIPProfile& aProfile,
+                                    TUint32& aSecureCallPreference );
+
+    /**
+    * Check Calling Line Identification Restriction (CLIR) value.
+    * @since Series 60 3.2
+    * @return ETRue if CLIR is ON, otherwise EFalse.
+    */
+    TBool IsCLIROnL() const;
+
+    /**
+    * Set fromheader.
+    * If CLIR is on add anonymous info according sec status, otherwise nothing
+    * @since Series 60 3.2
+    * @return HBufC8* constructed fromheader.
+    */
+    HBufC8* SetMoFromHeaderLC( TUint aSecurityStatus );
+    
+	
+	/**
+    * Adds P-Preferred-Identity to user headers.
+    * @since Series 60 3.2
+	* @param aUserAgentHeaders user agent headers.
+	* @param aUri own sip uri.
+    * @return void
+    */
+    void AddPPreferredIdentityToUserHeadersL( 
+        CDesC8Array& aUserAgentHeaders, const TDesC8& aUri  );
+    
+    /**
+     * Updates the jitterbuffer size to given RTP source. Function resets
+     * the iJitterBufferSize member, which is got when finding MO/MT codecs
+     * in AppendCapabilitiesDataL. If iJitterBufferSize = 0, then default
+     * 10 frame jitterbuffer is used.
+     * @since S60 v3.2
+     * @param aRtpSource RTP source which to update.
+     * @return void
+     */
+    void UpdateJitterBufferSizeL( CMceRtpSource& aRtpSource );
+    
+    
+    /**
+     * Gets DTMF mode, Inband mode returns EFalse and Outband mode ETrue
+     * @since Series 60 3.2
+     * @return TBool EFalse for Inband, ETrue for Outband
+     */
+    TBool GetDTMFMode();
+    
+    /**
+     * Sets DTMF mode. This function is used when audiostreams have been
+     * studied about the inband/outband DTMF status.
+     * @since S60 v3.2
+     * @param aOutbandEnabled. ETrue if outband DTMF is enabled.
+     * @return void
+     */
+    void SetDtmfMode( TBool aOutbandEnabled );
+    
+    /**
+     * Gets keep-alive timer value by IAP id
+     * @since S60 v3.2
+     * @param aIapId IAP id
+     * @param aKeepAliveValue Keep-alive timer value
+     * @return ETrue if value found, else EFalse
+     */
+    TBool GetKeepAliveByIapIdL( TUint32 aIapId, TInt& aKeepAliveValue ) const;
+    
+    /**
+     * Gets keep-alive timer value by AOR
+     * @since S60 v3.2
+     * @param aAor AOR
+     * @param aKeepAliveValue Keep-alive timer value
+     * @return ETrue if value found, else EFalse
+     */
+    TBool GetKeepAliveByAORL( const TDesC8& aAor,
+        TInt& aKeepAliveValue ) const;
+
+     
+private: // new methods
+
+    /**
+     * Checks if outband DMTF is offerd  
+     * @Since S60 3.2
+     * @param aAudioStream Mce audiostream
+     * @return TBool, ETrue -> OB offered
+     */
+    TBool DtmfOBInOffer( CMceAudioStream& aAudioStream );
+    
+    /**
+     * Sets DTMF specific settings for audiostream
+     * @Since S60 v3.2
+     * @param aVoIPProfile Used VoIP profile
+     * @param aAudioStream Audiostream, used here to set codec order num to tel-ev.
+     * @return void
+     * @leave system error if setting fails
+     */ 
+    void SetDtmfL( const CRCSEProfileEntry& aVoIPProfile, 
+                  CMceAudioStream&  aAudioStream);
+    
+    /**
+    * Method for matching ISO-639-1 language tags to Symbian language codes
+    * @since Series 60 3.2
+    * @param aLanguageCode Symbian language code
+    * @param aLangMatch Language tag corresponding given Symbian language code
+    */
+    static void MatchLanguageTags( TInt aLanguageCode,
+        TDes& aLangMatch );
+ 
+
+    /**
+    * Get audio codecs from database for certain VoIP profile.
+    * @since Series60 3.2
+    * @param aProfile RCSE profile where to search the codecs ID's.
+    * @param aCodecIds 
+    */                               
+    void GetCodecIdsByVoIPProfileIdL( 
+        const CRCSEProfileEntry& aProfile,
+        RArray< TUint32 >& aCodecIds ) const;
+    /**
+     * Set audio codec values and append new codec in array.
+     * @since Series60 3.2 
+     * @param aAudioInStream Representation of Mce audio stream
+     * @param aVoIPProfile VoIP profile entry
+     * @param aCodecProfile Audio codec entry
+     * @return void
+     */                                                              
+    void MoCallCapabilitiesL( CMceAudioStream& aAudioInStream, 
+                              const CRCSEProfileEntry& aVoIPProfile,
+                              const CRCSEAudioCodecEntry& aCodecProfile );
+                                
+    /**
+     * Set AMR related provisioned parameters.
+     * @since Series60 3.2 
+     * @param aAudioInStream Representation of Mce audio stream
+     * @param aCodecProfile Audio codec entry
+     * @param aCodecNumber AMR codec number in codec array
+     * @return void
+     */                                                              
+    void SetAMRParameters( CMceAudioStream& aAudioInStream, 
+                           const CRCSEAudioCodecEntry& aCodecProfile,
+                           TInt aCodecNumber );
+
+    /**
+     * Set audio codec values and append new codec in array.
+     * @since Series60 3.2 
+     * @param aAudioInStream Representation of Mce audio stream
+     * @param aVoIPProfile VoIP profile entry
+     * @param aCodecProfile Audio codec entry
+     * @return void
+     */                            
+    void MtCallCapabilitiesL( CMceAudioStream& aAudioInStream, 
+                              const CRCSEProfileEntry& aVoIPProfile,
+                              const CRCSEAudioCodecEntry& aCodecProfile );
+                                       
+    /**
+    * Removes unnecessary codecs from Mce
+    * Codecs that are supported by Mce, but are found from database
+    * @since Series60 3.2
+    * @param aAudioInStream Representation of Mce audio stream
+    * @return None
+    */                                  
+    void RemoveUnnecessaryCodecsL( CMceAudioStream& aAudioInStream );
+     
+    /**
+     * Method for setting codec order priority in offer.
+     * @since S60 v3.2
+     * @param aAudioStream Representation of Mce audio stream.
+     * @return void
+     */       
+    void SetDtmfCodecOrderL( CMceAudioStream& aAudioStream ) const;
+    
+    /**
+     * Method for setting CN on for PCMA, PCMU and ILBC if 
+     * codecs provisioned and offered in incoming call
+     * @since S60 v3.2
+     * @param aAudioStream Representation of Mce audio stream.
+     * @return void
+     */     
+    void SetComfortNoiseL( CMceAudioStream& aAudioStream );
+   
+    /**
+     * Method for checking and setting red media attribute
+     * @since S60 v3.2
+     * @param aAudioStream Representation of Mce audio stream.
+     * @return void
+     */     
+    void SetRedundancyL( CMceAudioStream& aAudioStream );
+   
+    /**
+     * Sets Media level Quality Of Service. This is IP level type of service or
+     * DSCP value.
+     * @since S60 v3.2
+     * @param aQosValue Media QoS value in settings.
+     * @param aSession MCE session into which set the media QoS.
+     * @return void
+     */
+    void SetMediaQoSL( TUint32 aQosValue, CMceSession* aSession ) const;
+    
+    /**
+     * Enables or disables RTCP sending from RTP sinks in given media stream.
+     *
+     * @since S60 v3.2
+     * @param aRtcp RTCP setting value read from RCSE
+     * @param aStream Stream whose RTP sinks to update
+     * @return void
+     */
+    void CheckRtcpSettingL( TUint32 aRtcp, CMceMediaStream& aStream,
+                            TBool aSessionUpdateOngoing = EFalse ) const;
+    
+    /**
+      * Method for setting VAD (Voice Activity Detection) for provisioned and
+      * bound codecs.  
+      * @since S60 v3.2
+      * @param aInAudioStream Representation of Mce audio stream
+      * @param aVADSetting value of VAD setting
+      * @param aCodecName codec name
+      */
+    void SetVADL( CMceAudioStream& aInAudioStream, 
+                            TBool aVADSetting,
+                            const TDesC8& aCodecName );
+
+     /**
+     * Set AMR-WB (Adaptive Multi-Rate Wideband) related provisioned parameters.
+     * @since S60 v3.2
+     * @param aAudioInStream Representation of Mce audio stream.
+     * @param aCodecProfile Stored audio codec entry in RCSE.
+     * @param aCodecNumber Codec number in codec array.
+     */                                                              
+    void SetAmrWbParameters( CMceAudioStream& aAudioInStream, 
+                           const CRCSEAudioCodecEntry& aCodecProfile,
+                           TInt aCodecNumber );   
+
+private: // data
+
+
+    /**
+     * second-phase constructor
+     */
+    void ConstructL();
+    
+    /**
+     * C++ default constructor.
+     */
+    CSVPUtility();
+    
+    /**
+     * Flags to determine which codecs are matched
+     */
+    TBool iAMR;
+    TBool iILBC;
+    TBool iPCMU;
+    TBool iPCMA;
+    TBool iG729;
+    TBool iCN;
+    TBool iRed;
+    TBool iAMRWB;
+    
+    /**
+     * Flag which determines which DMTF mode is used
+     * ETrue => Outbound, EFalse => Inbound
+     */
+    TBool iTelEv;
+    
+    /**
+     * codec preference order
+     */
+    TInt iPreferredCodec;
+    
+    /**
+     * Codec match flag, determines if codec matched in Mt call case
+     */
+    TBool iCodecMatched;
+   
+    /** 
+     * Flag to determine whether DTMF settin is read already
+     */ 
+    TBool iDTMFChecked;
+    
+    /**
+     * Jitterbuffer length found from codec settings.
+     */
+    TInt32 iJitterBufferSize;
+    
+    /**
+     * Keeps track in Mt call case when matching codecs
+     */
+    TInt iRoundIndex;
+    
+    /**
+     * instance of the VoIP event logger class.
+     * own.
+     */
+    CVoipEventLog* iVoipEventLogger;
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+   
+    };
+
+#endif // SVPUTILITY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpvolumeobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Provides a central repository observer for telephone volume
+*
+*/
+
+
+#ifndef CSVPVOLUMEOBSERVER_H
+#define CSVPVOLUMEOBSERVER_H
+
+#include <e32base.h>
+#include <cenrepnotifyhandler.h>
+#include <MTelephonyAudioRoutingObserver.h>
+#include "svputdefs.h"
+
+// FORWARD DECLARATIONS
+class MSVPVolumeUpdateObserver;
+class CTelephonyAudioRouting;
+
+ /**
+  *  Provides a telephone volume for SVP session.
+  *
+  *  @lib svp.dll
+  *  @since S60 3.2
+  */
+class CSVPVolumeObserver : public CBase,
+                           public MCenRepNotifyHandlerCallback,
+                           public MTelephonyAudioRoutingObserver 
+    {
+    public: // default constructor and destructor
+           
+        /**
+         * Two-phased constructor.
+         */
+        static CSVPVolumeObserver* NewL(
+            MSVPVolumeUpdateObserver& aObserver );
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CSVPVolumeObserver();
+            
+    private:
+    
+        // from MTelephonyAudioRoutingObserver
+       
+        void AvailableOutputsChanged(
+            CTelephonyAudioRouting& aTelephonyAudioRouting );
+        
+        void OutputChanged( CTelephonyAudioRouting& aTelephonyAudioRouting );
+        
+        void SetOutputComplete(
+            CTelephonyAudioRouting& aTelephonyAudioRouting, TInt aError );
+        
+        // from MCenRepNotifyHandlerCallback
+        
+        /**
+          Notifies when a generic value has been changed
+          @since S60 3.2
+          @param aId Id of the key that has changed
+         */
+        void HandleNotifyGeneric( TUint32 aId );
+        
+    private:
+
+        /**
+         * C++ default constructor.
+         */
+        CSVPVolumeObserver( MSVPVolumeUpdateObserver& aObserver );
+
+        /**
+         * By default Symbian 2nd phase constructor is private.
+         */
+        void ConstructL();
+         
+    private:    // Data
+           
+        /**
+         * Current telephone IHF volume setting
+         */
+        TInt iCurrentIhfVolume;
+
+        /**
+         * Current telephone earpiece volume setting
+         */
+        TInt iCurrentEarVolume;
+
+        /**
+         * Current telephone mode (IHF/EARPIECE)
+         */
+        TInt iMode;
+        
+        /**
+         * Central repository instance
+         * Own.
+         */
+        CRepository* iRepository;
+        
+        /**
+         * Central repository notifier instance
+         * Own.
+         */
+        CCenRepNotifyHandler* iNotifier;
+       
+         /**
+         * Instance of telephony audio routing
+         * used to track mode changes between ear and Ihf
+         * Own.
+         */
+        CTelephonyAudioRouting* iTelephonyAudioRouting;
+           
+        /**
+         * Reference to volume upadte observer
+         * Used to inform session about volume updates
+         */
+        MSVPVolumeUpdateObserver& iVolumeUpdate;
+
+        
+    private: 
+    
+    	// For testing
+      	SVP_UT_DEFS
+    
+    };
+    
+
+                                  
+#endif //  C_SVPVOLUMEOBSERVER_H
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/inc/svpvolumeupdateobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Observers changes in volume levels, used by SVPVolumeObserver
+*
+*/
+
+
+#ifndef M_SVPVOLUMEUPDATEOBSERVER_H
+#define M_SVPVOLUMEUPDATEOBSERVER_H
+
+/**
+ *  Observers volume level changes 
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class MSVPVolumeUpdateObserver
+    {
+
+public:
+
+    /**
+     * CSVPVolumeObserver calls this when volume level changes
+     * changed. 
+     *
+     * @since S60 3.2
+     * @param aVolume New volume level
+     */
+    virtual void VolumeChanged( TInt aVolume ) = 0;
+    
+    };
+
+#endif // M_SVPVOLUMEUPDATEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/rom/svp.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* 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:  Image description file for project sipvoipprovider
+*
+*/
+
+#ifndef SVP_IBY
+#define SVP_IBY
+
+ECOM_PLUGIN( svp.dll, 10282587.rsc )
+
+#endif // SVP_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpaudioutility.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,656 @@
+/*
+* 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:  Provides static utility functions for SVP
+*
+*/
+
+
+#include <mceaudiostream.h>
+#include <mcertpsource.h>
+#include <mceaudiocodec.h>
+#include <mcespeakersink.h>
+#include <mcemicsource.h>
+#include <AudioPreference.h>
+#include "svpaudioutility.h"
+#include "svplogger.h"
+#include "svpconsts.h"
+#include "svpsessionbase.h"
+#include "svpemergencysession.h"
+#include "svpholdcontext.h"
+#include "svpholdcontroller.h"
+
+// LOCAL CONSTANTS
+// Constants for VoIP uplink audio preferences, renamed for better
+// readability and to clarify between IB/OB DTMF's. 
+// See <audiopreference.h> for more information.
+// Inband signalling uplink preference (i.e inband DTMF)
+const TUint KSVPAudioPrefUplinkIbDtmf = KAudioPrefVoipAudioUplinkNonSignal;
+// Outband signalling uplink preference (i.e outband DTMF)
+const TUint KSVPAudioPrefUplinkOobDtmf = KAudioPrefVoipAudioUplink;
+
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::IsDownlinkStream
+// ---------------------------------------------------------------------------
+//
+TBool SVPAudioUtility::IsDownlinkStream( CMceAudioStream& aStream )
+    {
+    SVPDEBUG2( "SVPAudioUtility::IsDownlinkStream source: 0x%x", aStream.Source() );
+    
+    if ( aStream.Source() && KMceRTPSource == aStream.Source()->Type() )
+        {
+        SVPDEBUG1( "SVPAudioUtility::IsDownlinkStream RTP SOURCE => DOWNLINK" );
+        return ETrue;
+        }
+    else
+        {
+        SVPDEBUG1( "SVPAudioUtility::IsDownlinkStream EFalse" );
+        
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::SetPriorityCodecValuesL
+// ---------------------------------------------------------------------------
+//
+TBool SVPAudioUtility::SetPriorityCodecValuesL(
+    CMceAudioStream& aAudioInStream,
+    CMceAudioStream& aAudioOutStream )
+    {
+    SVPDEBUG1("SVPAudioUtility::SetPriorityCodecValuesL In");
+    
+    // set MMF codec priorities  for all codecs in both streams
+    const TInt inCodecCount = aAudioInStream.Codecs().Count();
+    SVPDEBUG2(
+        "SVPAudioUtility::SetPriorityCodecValuesL codeccount IN: %d",
+            inCodecCount )
+     
+    const TInt outCodecCount = aAudioOutStream.Codecs().Count();
+    SVPDEBUG2(
+        "SVPAudioUtility::SetPriorityCodecValuesL codeccount OUT: %d",
+            outCodecCount )
+    
+    const TBool inDtmf = SVPAudioUtility::SetDtmfPriorityL( aAudioInStream );
+    const TBool outDtmf = SVPAudioUtility::SetDtmfPriorityL( aAudioOutStream );
+    
+    // inDtmf and outDtmf _must_ match. Either inband (both EFalse) or outband
+    // (both ETrue).
+    if ( inDtmf != outDtmf )
+        {
+        SVPDEBUG1("SVPAudioUtility::SetPriorityCodecValuesL KErrNotFound");
+        User::Leave( KErrNotFound );
+        }
+    
+    SVPDEBUG1( "SVPAudioUtility::SetPriorityCodecValuesL set IN priorities" );
+    
+    SetAudioCodecPrioritiesL( aAudioInStream, KAudioPrefVoipAudioDownlink );
+    
+    // Check which version of DTMF's are we using, inband or outband.
+    TBool outband( EFalse );
+    TUint uplinkPreference = KSVPAudioPrefUplinkIbDtmf;
+    if ( inDtmf && outDtmf )
+        {
+        SVPDEBUG1(
+            "SVPAudioUtility::SetPriorityCodecValuesL change to OOB DTMF" );
+        
+        uplinkPreference = KSVPAudioPrefUplinkOobDtmf;
+        outband = ETrue;
+        }
+    // else inband used.
+    
+    SVPDEBUG1( "SVPAudioUtility::SetPriorityCodecValuesL set OUT priorities" );
+    
+    SetAudioCodecPrioritiesL( aAudioOutStream, uplinkPreference );
+    
+    SVPDEBUG1( "SVPAudioUtility::SetPriorityCodecValuesL Out" );
+    
+    return outband;
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::SetDtmfPriorityL
+// ---------------------------------------------------------------------------
+//
+TBool SVPAudioUtility::SetDtmfPriorityL( CMceAudioStream& aAudioStream )
+    {
+    SVPDEBUG1( "SVPAudioUtility::SetDtmfPriorityL In" );
+    
+    const RPointerArray<CMceAudioCodec>& codecs = aAudioStream.Codecs();
+    TInt codCount( codecs.Count() );
+    
+    // loop through codecs in in stream
+    while ( codCount )
+        {
+        codCount--;
+        
+        SVPDEBUG2( "SVPAudioUtility::SetDtmfPriorityL, round: %d", codCount );
+        
+        // Check if codec is DTMF, note the return values of CompareF
+        if( !codecs[ codCount ]->SdpName().CompareF( KTELEVENT ) )
+            {
+            SVPDEBUG1( "SVPAudioUtility::SetDtmfPriorityL ETrue" );
+            
+            SVPDEBUG2( "SVPAudioUtility::SetDtmfPriorityL curr.prio: %d",
+                codecs[codCount]->MMFPriority() )
+            SVPDEBUG2( "SVPAudioUtility::SetDtmfPriorityL curr.pref: 0x%x",
+                codecs[codCount]->MMFPriorityPreference() )
+            
+            // Set the priorities.
+            codecs[ codCount ]->SetMMFPriorityL( KAudioPriorityDTMFString );
+            codecs[ codCount ]->SetMMFPriorityPreferenceL( KAudioDTMFString );
+            return ETrue;
+            }
+        }
+    
+    SVPDEBUG1( "SVPAudioUtility::SetDtmfPriorityL EFalse" );
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::SetAudioCodecPrioritiesL
+// ---------------------------------------------------------------------------
+//
+void SVPAudioUtility::SetAudioCodecPrioritiesL(
+    CMceAudioStream& aAudioStream,
+    TUint aAudioPref )
+    {
+    SVPDEBUG2( "SVPAudioUtility::SetAudioCodecPrioritiesL aAudioPref: 0x%x",
+        aAudioPref );
+    
+    const RPointerArray<CMceAudioCodec>& codecs = aAudioStream.Codecs();
+    TInt codCount( codecs.Count() );
+    
+    // loop through codecs in in stream
+    while ( codCount )
+        {
+        codCount--;
+        
+        SVPDEBUG2( "SVPAudioUtility::SetAudioCodecPrioritiesL, round: %d",
+            codCount );
+        
+        // Handle only real audio codecs.
+        if( codecs[ codCount ]->SdpName().CompareF( KTELEVENT ) )
+            {
+            SVPDEBUG2( "SVPAudioUtility::SetAudioCodecPrioritiesL curr.prio: %d",
+                codecs[codCount]->MMFPriority() )
+            SVPDEBUG2( "SVPAudioUtility::SetAudioCodecPrioritiesL curr.pref: 0x%x",
+                codecs[codCount]->MMFPriorityPreference() )
+                
+            // Priority is always the same for VoIP.
+            codecs[ codCount ]->SetMMFPriorityL( KAudioPriorityPhoneCall );
+            codecs[ codCount ]->SetMMFPriorityPreferenceL( aAudioPref );
+            }
+        } 
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::SetAudioCodecPrioritiesL
+// ---------------------------------------------------------------------------
+//
+void SVPAudioUtility::SetAudioStreamPrioritiesL(
+    CMceMediaStream& aMediaStream,
+    CMceMediaStream& aBoundStream )
+    {
+    SVPDEBUG1( "SVPAudioUtility::SetAudioStreamPrioritiesL In" );
+    
+    if ( KMceAudio != aMediaStream.Type() ||
+         KMceAudio != aBoundStream.Type() )
+        {
+        SVPDEBUG1( "SVPAudioUtility::SetAudioStreamPrioritiesL KErrArgument" );
+        SVPDEBUG2( "SVPAudioUtility::SetAudioStreamPrioritiesL media.Type: %u",
+            aMediaStream.Type() );
+        SVPDEBUG2( "SVPAudioUtility::SetAudioStreamPrioritiesL bound.Type: %u",
+            aBoundStream.Type() );
+        
+        User::Leave( KErrArgument );
+        }
+    // else stream types are OK, thus we proceed.
+    
+    // Set the codec MMF priorities here, first get the audiostreams.
+    CMceAudioStream& stream = static_cast<CMceAudioStream&>( aMediaStream );
+    CMceAudioStream& bound = static_cast<CMceAudioStream&>( aBoundStream );
+    
+    if ( SVPAudioUtility::IsDownlinkStream( stream ) )
+        {
+        SVPAudioUtility::SetPriorityCodecValuesL( stream, bound );
+        }
+    else
+        {
+        SVPAudioUtility::SetPriorityCodecValuesL( bound, stream );
+        }
+    
+    SVPDEBUG1( "SVPAudioUtility::SetAudioStreamPrioritiesL Out" );
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::EnableSpeakerSinkL
+// ---------------------------------------------------------------------------
+//
+void SVPAudioUtility::EnableSpeakerSinkL( 
+    const RPointerArray< CMceMediaSink >& aSink )
+    {
+    TInt snkCount( aSink.Count() );
+    while ( snkCount )
+        {
+        snkCount--;
+        if ( KMceSpeakerSink == aSink[ snkCount ]->Type() && 
+             !aSink[ snkCount ]->IsEnabled() )
+            {
+            SVPDEBUG1( "SVPAudioUtility::EnableSpeakerSinkL Speaker found" );
+            
+            aSink[ snkCount ]->EnableL();
+            
+            SVPDEBUG1( "SVPAudioUtility::EnableSpeakerSinkL Speaker ENABLED" );
+            }
+        } 
+    }
+    
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::DisableSpeakerSinkL
+// ---------------------------------------------------------------------------
+//
+void SVPAudioUtility::DisableSpeakerSinkL( 
+    const RPointerArray< CMceMediaSink >& aSink )
+    {
+    TInt snkCount( aSink.Count() );
+    while ( snkCount )
+        {
+        snkCount--;
+        if ( KMceSpeakerSink == aSink[ snkCount ]->Type() &&
+             aSink[ snkCount ]->IsEnabled() )
+            {
+            SVPDEBUG1( "SVPAudioUtility::DisableSpeakerSinkL Speaker found" );
+            
+            aSink[ snkCount ]->DisableL();
+            
+            SVPDEBUG1( "SVPAudioUtility::DisableSpeakerSinkL Speaker DISABLED" );
+            }
+        } 
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::EnableMicSourceL
+// ---------------------------------------------------------------------------
+//
+void SVPAudioUtility::EnableMicSourceL( CMceMediaSource& aMicSource )
+    {            
+    if ( KMceMicSource == aMicSource.Type() && !aMicSource.IsEnabled() )
+        {
+        SVPDEBUG1("SVPAudioUtility::EnableMicSourceL Mic found");
+        
+        aMicSource.EnableL();
+        
+        SVPDEBUG1("SVPAudioUtility::EnableMicSourceL Mic ENABLED");
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::DisableMicSourceL
+// ---------------------------------------------------------------------------
+//
+void SVPAudioUtility::DisableMicSourceL( CMceMediaSource& aMicSource )
+    {
+    if ( KMceMicSource == aMicSource.Type() && aMicSource.IsEnabled() )
+        {
+        SVPDEBUG1( "SVPAudioUtility::DisableMicSourceL Mic found" );
+        
+        aMicSource.DisableL();
+        
+        SVPDEBUG1( "SVPAudioUtility::DisableMicSourceL Mic DISABLED" );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::EnableSpeakerSinksL
+// ---------------------------------------------------------------------------
+//
+void SVPAudioUtility::EnableSpeakerSinksL(
+    const RPointerArray< CMceMediaStream >& aStreams )
+    {
+    SVPDEBUG1("SVPAudioUtility::EnableSpeakerSinksL In");
+    
+    TInt index( aStreams.Count() );
+    while( index-- )
+        {
+        if ( KMceAudio == aStreams[ index ]->Type() )
+            {
+            EnableSpeakerSinkL( aStreams[ index ]->Sinks() );
+            }
+        
+        if ( KMceAudio == aStreams[ index ]->BoundStreamL().Type() )
+            {
+            EnableSpeakerSinkL( aStreams[ index ]->BoundStreamL().Sinks() );
+            }
+        }
+    
+    SVPDEBUG1("SVPAudioUtility::EnableSpeakerSinksL Out");
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::DisableMicSourceL
+// ---------------------------------------------------------------------------
+//
+void SVPAudioUtility::DisableMicSourceL( CMceMediaStream& aStream )
+    {
+    SVPDEBUG1("SVPAudioUtility::DisableMicSourceL CMceMediaStream In");
+    
+    CMceMediaSource* source = NULL;
+    source = aStream.Source();
+    if ( source )
+        {
+        SVPDEBUG1("SVPAudioUtility::DisableMicSourceL aStream");
+        
+        DisableMicSourceL( *source );
+        }
+    
+    if ( aStream.BoundStream() )
+        {
+        source = aStream.BoundStreamL().Source();
+        if ( source )
+            {
+            SVPDEBUG1("SVPAudioUtility::DisableMicSourceL BoundStream");
+            
+            DisableMicSourceL( *source );
+            }
+        }
+        
+    SVPDEBUG1("SVPAudioUtility::DisableMicSourceL CMceMediaStream Out");
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::FindCodec
+// ---------------------------------------------------------------------------
+//
+CMceAudioCodec* SVPAudioUtility::FindCodec( CMceAudioStream& aAudiostream,
+    const TDesC8& aCodecname )
+    {
+    SVPDEBUG1("SVPAudioUtility::FindCodec In");
+    
+    const RPointerArray<CMceAudioCodec>& codecs = aAudiostream.Codecs();
+    TInt codecCount = codecs.Count();
+    while ( codecCount )
+        {
+        codecCount--;
+        if ( !codecs[codecCount]->SdpName().CompareF( aCodecname ) )
+            {
+            SVPDEBUG1("SVPAudioUtility::SVPAudioUtility Codec found");
+            
+            return codecs[codecCount];
+            }
+        }
+    
+    SVPDEBUG1("SVPAudioUtility::FindCodec Out NULL");
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::RemoveCodecL
+// ---------------------------------------------------------------------------
+//
+void SVPAudioUtility::RemoveCodecL( CMceAudioStream& aAudiostream,
+    const TDesC8& aCodecname )
+    {
+    SVPDEBUG1("SVPAudioUtility::RemoveCodecL In");
+    
+    CMceAudioCodec* codec = SVPAudioUtility::FindCodec( aAudiostream,
+        aCodecname );
+    
+    while ( codec )
+        {
+        SVPDEBUG1("SVPAudioUtility::RemoveCodecL Removing");
+        
+        aAudiostream.RemoveCodecL( *codec );
+        codec = SVPAudioUtility::FindCodec( aAudiostream, aCodecname );
+        }
+    
+    SVPDEBUG1("SVPAudioUtility::RemoveCodecL Out");
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::MmfPriorityUpdateNeededL
+// ---------------------------------------------------------------------------
+//
+TBool SVPAudioUtility::MmfPriorityUpdateNeededL(
+    const RPointerArray<CMceMediaStream>& aStreams )
+    {
+    SVPDEBUG1( "SVPAudioUtility::MmfPriorityUpdateNeededL In" )
+    
+    // We need to check if DTMF codec is found and then check uplink stream
+    // MMF priorities.
+    // 1) If DTMF codec is found and uplink stream codecs have preference
+    //    KSVPAudioPrefAudioUplinkOobDtmf no update is needed.
+    // 2) If DTMF codec is not found and uplink stream codecs have preference
+    //    KSVPAudioPrefAudioUplinkIbDtmf no update is needed.
+    // 3) In other cases we need to do MMF preference/priority update.
+    
+    // In order to do this we need to find uplink audio streams, check whether
+    // the stream has DTMF codec and then check which MMF preference the codec
+    // codec has. We may have multiple streams, but for simplicity sake if
+    // we find just one stream needing priority/preference update, we return
+    // ETrue as update need.
+    TInt strmCount( aStreams.Count() );
+    
+    SVPDEBUG2( "SVPAudioUtility::MmfPriorityUpdateNeededL strmCount: %d",
+        strmCount )
+    
+    while ( strmCount )
+        {
+        SVPDEBUG2( "SVPAudioUtility::MmfPriorityUpdateNeededL tb checked",
+            strmCount )
+        
+        strmCount--;
+        
+        // Basic assertions. Streams have to be KMceAudio and 'main' stream
+        // must have a bound stream.
+        __ASSERT_ALWAYS( KMceAudio == aStreams[strmCount]->Type(),
+            User::Leave( KErrArgument ) );
+        __ASSERT_ALWAYS( aStreams[strmCount]->BoundStream(),
+            User::Leave( KErrArgument ) );
+        __ASSERT_ALWAYS( KMceAudio == aStreams[strmCount]->BoundStreamL().Type(),
+            User::Leave( KErrArgument ) );
+        
+        // Now that we are clear from the asserts, we can safely do the casts
+        // and find the uplink stream for priority/preference checking.
+        CMceAudioStream* audioStream =
+            static_cast<CMceAudioStream*>( aStreams[strmCount] );
+        CMceAudioStream& boundStream =
+            static_cast<CMceAudioStream&>( audioStream->BoundStreamL() );
+        
+        CMceAudioStream* uplinkStream = NULL;
+        
+        if ( !IsDownlinkStream( *audioStream ) )
+            {
+            SVPDEBUG1( "SVPAudioUtility::MmfPriorityUpdateNeededL main is uplink" )
+            
+            uplinkStream = audioStream;
+            }
+        else if ( !IsDownlinkStream( boundStream ) )
+            {
+            SVPDEBUG1( "SVPAudioUtility::MmfPriorityUpdateNeededL bound is uplink" )
+            
+            uplinkStream = &boundStream;
+            }
+        
+        // Next assert handles the missing else branch.
+        __ASSERT_ALWAYS( uplinkStream, User::Leave( KErrNotFound ) );
+        
+        TBool res = MmfPriorityUpdateNeededL( *uplinkStream );
+        if ( res )
+            {
+            SVPDEBUG1( "SVPAudioUtility::MmfPriorityUpdateNeededL ETrue" )
+            return ETrue;
+            }
+        }
+    
+    SVPDEBUG1( "SVPAudioUtility::MmfPriorityUpdateNeededL EFalse" )
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::MmfPriorityUpdateNeededL
+// ---------------------------------------------------------------------------
+//
+TBool SVPAudioUtility::MmfPriorityUpdateNeededL(
+    CMceAudioStream& aUplinkStream )
+    {
+    SVPDEBUG1( "SVPAudioUtility::MmfPriorityUpdateNeededL (stream) In" )
+    
+    // Check which uplink preference we need to have based whether DTMF codec
+    // is part of the codec list.
+    TUint uplinkPreference = 0;
+    if ( FindCodec( aUplinkStream, KTELEVENT ) )
+        {
+        SVPDEBUG1( "SVPAudioUtility::MmfPriorityUpdateNeededL (stream) DTMF OB" )
+        
+        uplinkPreference = KSVPAudioPrefUplinkOobDtmf;
+        }
+    else
+        {
+        SVPDEBUG1( "SVPAudioUtility::MmfPriorityUpdateNeededL (stream) DTMF IB" )
+        
+        uplinkPreference = KSVPAudioPrefUplinkIbDtmf;
+        }
+    
+    // Given stream must have at least one codec in order to do the priority /
+    // preference check. This function is private and called inside, thus this
+    // assertion just adds to the checks done in caller.
+    const RPointerArray<CMceAudioCodec>& codecs = aUplinkStream.Codecs();
+    TInt codecCount = codecs.Count();
+    
+    SVPDEBUG2( "SVPAudioUtility::MmfPriorityUpdateNeededL (stream) codecCount: %d",
+        codecCount )
+    
+    __ASSERT_ALWAYS( codecCount, User::Leave( KErrArgument ) );
+    
+    while( codecCount )
+        {
+        SVPDEBUG2( "SVPAudioUtility::MmfPriorityUpdateNeededL (stream) tb checked: %d",
+            codecCount )
+        
+        codecCount--;
+        
+        SVPDEBUG2( "SVPAudioUtility::MmfPriorityUpdateNeededL curr.prio: %d",
+                codecs[codecCount]->MMFPriority() )
+        SVPDEBUG2( "SVPAudioUtility::MmfPriorityUpdateNeededL curr.pref: 0x%x",
+                codecs[codecCount]->MMFPriorityPreference() )
+        
+        // Do not include DTMF codec into the preference check. Note CompareF
+        // return value also, 0 means match.
+        if ( codecs[codecCount]->SdpName().CompareF( KTELEVENT ) &&
+            uplinkPreference != codecs[codecCount]->MMFPriorityPreference() )
+            {
+            SVPDEBUG1( "SVPAudioUtility::MmfPriorityUpdateNeededL (stream) ETrue" )
+            
+            return ETrue;
+            }
+        
+        // else preferences match, ne-ext please!!!
+        }
+    
+    SVPDEBUG1( "SVPAudioUtility::MmfPriorityUpdateNeededL (stream) EFalse" )
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::DtmfActionCapableSession
+// ---------------------------------------------------------------------------
+//
+TBool SVPAudioUtility::DtmfActionCapableSession(
+    const CSVPSessionBase& aSession )
+    {
+    if ( aSession.HasHoldController() &&
+         ESVPConnected == aSession.HoldController().HoldState() )
+        {
+        SVPDEBUG1( "SVPAudioUtility::DtmfActionCapableSession ETrue 1" )
+        
+        return ETrue;
+        }
+    else if ( !aSession.HasHoldController() )
+        {
+        SVPDEBUG1( "SVPAudioUtility::DtmfActionCapableSession ETrue 2" )
+        
+        return ETrue;
+        }
+    else
+        {
+        SVPDEBUG1( "SVPAudioUtility::DtmfActionCapableSession EFalse" )
+        
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Check DTMF capability of emergency session
+// ---------------------------------------------------------------------------
+//
+TBool SVPAudioUtility::DtmfActionCapableSession(
+    const CSVPEmergencySession& aSession )
+    {
+    if ( aSession.HasHoldController() &&
+         ESVPConnected == aSession.HoldController().HoldState() )
+        {
+        SVPDEBUG1( "SVPAudioUtility::DtmfActionCapableSession ETrue 1" )
+        
+        return ETrue;
+        }
+    else if ( !aSession.HasHoldController() )
+        {
+        SVPDEBUG1( "SVPAudioUtility::DtmfActionCapableSession ETrue 2" )
+        
+        return ETrue;
+        }
+    else
+        {
+        SVPDEBUG1( "SVPAudioUtility::DtmfActionCapableSession EFalse" )
+        
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// SVPAudioUtility::DtmfActionCapableStream
+// ---------------------------------------------------------------------------
+//
+TBool SVPAudioUtility::DtmfActionCapableStream(
+    const CMceMediaStream& aStream )
+    {
+    // We used to check for source's DtmfAvailable and DtmfActive attributes,
+    // but those are IPC calls which are not preferred for DTMF's real-time
+    // nature. Thus leaving those out and letting the server return us a
+    // error code if those attributes are not correct for DTMF sending
+    // actually does the same thing but improves performance.
+    // Thus what once was three IPC calls is now just one.
+    TBool ret = EFalse;
+    CMceMediaSource* source = aStream.Source();
+    
+#ifdef _DEBUG
+    SVPDEBUG2( "SVPAudioUtility::DtmfActionCapableStream type: %d", aStream.Type() )
+    SVPDEBUG2( "SVPAudioUtility::DtmfActionCapableStream source: 0x%x", source )
+    if ( source )
+        {
+        SVPDEBUG2( "SVPAudioUtility::DtmfActionCapableStream enabled: %d", source->IsEnabled() )
+        }
+#endif
+    
+    if ( KMceAudio == aStream.Type() && source && source->IsEnabled() )
+        {
+        ret = ETrue;
+        }
+    
+    SVPDEBUG2( "SVPAudioUtility::DtmfActionCapableStream ret: %d", ret )
+    
+    return ret;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpcontroller.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,3535 @@
+/*
+* 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:  Handles all common logic for SVP and handles sessions.        
+*
+*/
+
+#include <mcevideostream.h>
+#include <mceaudiocodec.h>
+#include <mcemediasink.h>
+#include <mcemediasource.h>
+#include <mceevent.h>
+#include <mcesession.h>
+#include <mceinrefer.h>
+#include <mcesecuresession.h>
+#include <mcertpsource.h>
+#include <mccpdtmfobserver.h>
+#include <sipstrings.h>
+#include <sipstrconsts.h>
+
+#include <crcseprofileentry.h>
+#include <crcseprofileregistry.h>
+
+#include <wlantrafficstreamparameters.h> // CWlanMgmtClient
+#include <ccpdefs.h>
+#include <featdiscovery.h>
+
+#include "svpcontroller.h"
+#include "svpmosession.h"
+#include "svpmtsession.h"
+#include "svplogger.h"
+#include "svptimer.h"
+#include "svputility.h"
+#include "svpholdcontext.h"
+#include "svpholdcontroller.h"
+#include "svpcleanupresetanddestroy.h"
+#include "svpaudioutility.h"
+#include "svpsipconsts.h"
+#include "svpemergencyiapprovider.h"
+#include "svprtpobserver.h"
+#include "svpsettings.h"
+#include "svptransferstatecontext.h"
+
+// ---------------------------------------------------------------------------
+// CSVPController::CSVPController
+// ---------------------------------------------------------------------------
+//
+CSVPController::CSVPController() : iSessionUpdateOngoing( EFalse )
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPController::ConstructL()
+    {
+    SVPDEBUG1( "CSVPController::ConstructL In" )
+    
+    iIncomingReferCallIndex = KErrNotFound;
+    iHoldCallIndex = KErrNotFound;
+    iSuppServices = CSVPSupplementaryServices::NewL();
+    iSVPUtility = CSVPUtility::NewL();
+    iRtpObserver = CSVPRtpObserver::NewL();
+    TBool wlanSupported = CFeatureDiscovery::IsFeatureSupportedL( KFeatureIdProtocolWlan );
+#ifndef __WINS__
+    if ( wlanSupported )
+        {
+        iWlanMgmt = CWlanMgmtClient::NewL();
+        }
+#endif // __WINS__
+
+    SVPDEBUG1( "CSVPController::ConstructL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPController* CSVPController::NewL()
+    {
+    CSVPController* self = new ( ELeave ) CSVPController();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::~CSVPController
+// ---------------------------------------------------------------------------
+//
+CSVPController::~CSVPController()
+    {
+    SVPDEBUG1( "CSVPController::~CSVPController In" )
+    
+#ifndef __WINS__
+    delete iWlanMgmt;
+#endif // __WINS__
+
+    delete iSVPUtility;
+    
+    // clean array that contains SVP sessions.
+    iSessionArray.ResetAndDestroy();
+    iSessionArray.Close();
+    
+    // SVP emergency session
+    delete iEmergencySession;
+ 
+    iEmergencyProfileIds.Close();
+    iEmergencyIapIds.Close();
+    
+    delete iSuppServices;
+    delete iMceManager;
+    delete iRtpObserver;
+    
+    delete iDtmfString;
+    
+    SVPDEBUG1( "CSVPController::~CSVPController Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::InitializeL 
+// ---------------------------------------------------------------------------
+//
+void CSVPController::InitializeL( const TUint32 aServiceId,
+		  					      const MCCPObserver& aMonitor, 
+		                          const MCCPSsObserver& aSsObserver )
+    {
+    
+    SVPDEBUG2( "CSVPController::InitializeL serviceId = %d", aServiceId )
+    
+    SVPDEBUG2( "CSVPController::InitializeL iCCPMonitor: 0x%x", iCCPMonitor )
+    
+    //Find callprovider plugin uid that should be used when registering to MCE
+    TInt ccpUid = SvpSettings::IntPropertyL( aServiceId, 
+										EPropertyCallProviderPluginId );
+    SVPDEBUG2( "CSVPController::InitializeL callproviderpluginuid=%d", ccpUid )
+
+    // See CConvergedCallProvider API documentation. If already called,
+    // leave with KErrAlreadyExists.
+    __ASSERT_ALWAYS( !iCCPMonitor, User::Leave( KErrAlreadyExists ) );
+    __ASSERT_ALWAYS( !iCCPSsObserver, User::Leave( KErrAlreadyExists ) );
+    __ASSERT_ALWAYS( iSVPUtility, User::Leave( KErrNotReady ) );
+    __ASSERT_ALWAYS( iRtpObserver, User::Leave( KErrNotReady ) );
+    
+    // save CCP monitor 
+    iCCPMonitor = const_cast< MCCPObserver* >( &aMonitor );
+     
+    // save CCP Supplementary Services observer
+    iCCPSsObserver = const_cast< MCCPSsObserver* >( &aSsObserver );
+    
+    // get terminal type and wlan mac address, needed for user agent header
+    iSVPUtility->GetTerminalTypeL( iTerminalType );
+    iSVPUtility->GetWlanMACAddressL( iWlanMacAddress );
+    
+    TUid uid = { ccpUid };
+    // create Mce Manager, establishes connection to Mce server
+    iMceManager = CMceManager::NewL( uid, &iContainer );
+    
+    // set observers for asynchronous events
+    iMceManager->SetSessionObserver( this );
+    iMceManager->SetInSessionObserver( this );
+    iMceManager->SetInReferObserver( this );
+    iMceManager->SetReferObserver( this );
+    iMceManager->SetMediaObserver( this );
+    iMceManager->SetEventObserver( this );
+    iMceManager->SetDtmfObserver( this );
+    iMceManager->SetRtpObserver( iRtpObserver );
+    
+    iTrafficStreamCreated = EFalse;
+    
+    SVPDEBUG1( "CSVPController::InitializeL Out" )
+    } 
+
+// ---------------------------------------------------------------------------
+// CSVPController::InitializeL 
+// ---------------------------------------------------------------------------
+//
+void CSVPController::InitializeL( const MCCPObserver& aMonitor,
+                                  const MCCPSsObserver& aSsObserver )
+    {
+    SVPDEBUG2( "CSVPController::InitializeL iCCPMonitor: 0x%x", iCCPMonitor )
+    SVPDEBUG2( "CSVPController::InitializeL iCCPSsObserver: 0x%x", iCCPSsObserver )
+    
+    // See CConvergedCallProvider API documentation. If already called,
+    // leave with KErrAlreadyExists.
+    __ASSERT_ALWAYS( !iCCPMonitor, User::Leave( KErrAlreadyExists ) );
+    __ASSERT_ALWAYS( !iCCPSsObserver, User::Leave( KErrAlreadyExists ) );
+    __ASSERT_ALWAYS( iSVPUtility, User::Leave( KErrNotReady ) );
+    __ASSERT_ALWAYS( iRtpObserver, User::Leave( KErrNotReady ) );
+    
+    // save CCP monitor 
+    iCCPMonitor = const_cast< MCCPObserver* >( &aMonitor );
+    
+    // save CCP Supplementary Services observer
+    iCCPSsObserver = const_cast< MCCPSsObserver* >( &aSsObserver );
+
+    // get terminal type and wlan mac address, needed for user agent header
+    iSVPUtility->GetTerminalTypeL( iTerminalType );
+    iSVPUtility->GetWlanMACAddressL( iWlanMacAddress );
+    
+    // create Mce Manager, establishes connection to Mce server
+    iMceManager = CMceManager::NewL( KSVPImplementationUid, &iContainer );
+    
+    // set observers for asynchronous events
+    iMceManager->SetSessionObserver( this );
+    iMceManager->SetInSessionObserver( this );
+    iMceManager->SetInReferObserver( this );
+    iMceManager->SetReferObserver( this );
+    iMceManager->SetMediaObserver( this );
+    iMceManager->SetEventObserver( this );
+    iMceManager->SetDtmfObserver( this );
+    iMceManager->SetRtpObserver( iRtpObserver );
+    
+    iTrafficStreamCreated = EFalse;
+
+    SVPDEBUG1( "CSVPController::InitializeL Out" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPController::NewCallL
+// ---------------------------------------------------------------------------
+// 
+MCCPCall* CSVPController::NewCallL( 
+                            const CCCPCallParameters& aParameters,
+                            const TDesC& aRecipient,
+                            const MCCPCallObserver& aObserver )
+    {
+    SVPDEBUG1( "CSVPController::NewCallL In" )
+   
+    __ASSERT_ALWAYS( &aParameters, User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( &aRecipient, User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( &aObserver, User::Leave( KErrArgument ) );
+ 
+#ifndef __WINS__
+    // Preliminary Call Admission Control implementation, run only if no stream yet open
+    if ( !iTrafficStreamCreated )
+        {
+        SVPDEBUG1( "CSVPController::NewCallL - Creating WLAN traffic stream.." )
+
+        TRequestStatus requestStatus;
+        TUint streamId = 0;
+        TWlanTrafficStreamParameters streamParams( KSVPWlanTrafficStreamParamUserPriority );
+        TWlanTrafficStreamStatus streamStatus = EWlanTrafficStreamStatusActive;
+
+        // Disabling WLAN traffic stream automation and get stream status
+        iWlanMgmt->CreateTrafficStream( requestStatus, streamParams, streamId, streamStatus );
+        User::WaitForRequest( requestStatus );
+        
+        // Save traffic stream ID, needed for stream deletion
+        iTrafficStreamId = streamId;
+
+        if ( EWlanTrafficStreamStatusInactiveNoBandwidth == streamStatus )
+            {
+            SVPDEBUG1( "CSVPController::NewCallL - No bandwidth in traffic stream, leaving with ECCPErrorNetworkBusy" )        
+
+            // Enabling WLAN traffic stream automation back by deleting used stream
+            iWlanMgmt->DeleteTrafficStream( requestStatus, iTrafficStreamId );
+            User::WaitForRequest( requestStatus );
+            
+            TCCPError err = ECCPErrorNetworkBusy;
+            User::Leave( err );
+            }
+        SVPDEBUG1( "CSVPController::NewCallL - WLAN traffic stream created, continuing with NewCallL" )
+
+        iTrafficStreamCreated = ETrue;
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPController::NewCallL - WLAN traffic stream already created, continuing with NewCallL" )
+        ;
+        }
+#endif // __WINS__
+    
+    SVPDEBUG2( "CSVPController::NewCallL aRecipient length = %d", aRecipient.Length() )
+    SVPDEBUG2( "CSVPController::NewCallL aRecipient = %S", &aRecipient )
+    SVPDEBUG2( "CSVPController::NewCallL Serviceid = %d", aParameters.ServiceId() )
+
+    // Prepare and remove possible DTMF suffix
+    HBufC* parsedRecipient = NULL;
+    parsedRecipient = ParseRecipientDtmfSuffixL( aRecipient );
+  
+    // "convert" recpient to 8-bit format
+    HBufC8* recipient = HBufC8::NewLC( parsedRecipient->Length() ); // CS:1
+    TPtr8 temp = recipient->Des();
+    temp.Copy( *parsedRecipient );
+
+    // Pointer to parsedRecipient no longer needed
+    delete parsedRecipient;
+    parsedRecipient = NULL;
+    
+    // fetch SIP profile ID from VoIP profiles
+    RPointerArray< CRCSEProfileEntry > entryArray;
+    CleanupResetAndDestroy<
+        RPointerArray<CRCSEProfileEntry> >::PushL( entryArray ); //CS:2
+    
+    CRCSEProfileRegistry* reg = CRCSEProfileRegistry::NewLC(); // CS:3
+    
+    // take service id to local variable
+    TUint32 serviceId = aParameters.ServiceId();
+    
+    // Get VoIP profile by service id
+    reg->FindByServiceIdL( serviceId, entryArray );
+    __ASSERT_ALWAYS( entryArray.Count(), User::Leave( KErrArgument ) );
+    
+    // Take first entry from array
+    CRCSEProfileEntry* entry = entryArray[0];
+    
+    // create new session
+    MCCPCall* moSessionTemp = CreateNewSessionL( *recipient, 
+                                                 *entry, 
+                                                 aParameters,
+                                                 aObserver );
+    
+    CleanupStack::PopAndDestroy( 2, &entryArray ); // CS:1
+    CleanupStack::PopAndDestroy( recipient ); // CS:0
+    
+    SVPDEBUG1( "CSVPController::NewCallL Out" )
+    return moSessionTemp;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::CreateNewSessionL
+// ---------------------------------------------------------------------------
+//
+MCCPCall* CSVPController::CreateNewSessionL( 
+    TDesC8& aRecipient, 
+    CRCSEProfileEntry& aVoipProfile, 
+    const CCCPCallParameters& aParameters,
+    const MCCPCallObserver& aObserver )
+    {
+    SVPDEBUG1( "CSVPController::CreateNewSessionL In" )
+    
+    // array for provisioned data
+    CDesC8ArrayFlat* userAgentHeaders = new( ELeave ) CDesC8ArrayFlat( 4 );
+    CleanupStack::PushL( userAgentHeaders ); // CS:1
+    
+    // variable for storing security status
+    TUint32 securityStatus( 0 );
+    
+    // set provisioning data
+    SVPDEBUG1( "CSVPController::CreateNewSessionL Set provisioning data..." )
+    iSVPUtility->SetProvisioningDataL( aVoipProfile, 
+                                       *userAgentHeaders,
+                                       securityStatus,
+                                       iTerminalType,
+                                       iWlanMacAddress  );
+    
+    SVPDEBUG2( "CSVPController::CreateNewSessionL Security status: %d", securityStatus )
+    SVPDEBUG2( "CSVPController::CreateNewSessionL UAHeaders count: %d", userAgentHeaders->Count() )
+    
+    // Creates a SVP Mo session 
+    CSVPMoSession* moSessionTemp = CSVPMoSession::NewL( *iMceManager,
+                                                        aRecipient,
+                                                        aVoipProfile, 
+                                                        aParameters,
+                                                        iContainer,
+                                                        *this,
+                                                        *iSVPUtility,
+                                                        *iRtpObserver,
+                                                        securityStatus,
+                                                        userAgentHeaders );
+    CleanupStack::Pop( userAgentHeaders ); // CS:0, to member data
+    CleanupStack::PushL( moSessionTemp ); // CS:1
+    
+    FinalizeSessionCreationL( moSessionTemp );
+    
+    // set CCP session observer to SVP session
+    moSessionTemp->AddObserverL( aObserver );
+    // set CCP supplementary services events observer to SVP session
+    moSessionTemp->SetSsObserver( *iCCPSsObserver );
+    
+    CleanupStack::Pop( moSessionTemp ); // CS:0
+    
+    // session pointer is passed to CCP
+    SVPDEBUG1( "CSVPController::CreateNewSessionL Out" )
+    return moSessionTemp;
+    }
+
+// ---------------------------------------------------------------------------
+// Releases call
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPController::ReleaseCall( MCCPCall& aCall )
+    {
+    SVPDEBUG1( "CSVPController::ReleaseCall In" )
+
+    TInt response = KErrNotFound;
+
+    // To ensure correct value
+    iIncomingReferCallIndex = KErrNotFound;
+    iSessionUpdateOngoing = EFalse;
+
+    for ( TInt i = 0; i < iSessionArray.Count(); i++ )
+        {
+        if ( iSessionArray[i] == &aCall )
+            {
+            if ( iDtmfStringSending )
+                {
+                SVPDEBUG1( "CSVPController::ReleaseCall - Abort DTMF Sending" )
+                
+                // send abort event
+                iSessionArray[i]->DtmfObserver().HandleDTMFEvent(
+                       MCCPDTMFObserver::ECCPDtmfSequenceAbort,
+                       KErrNone,
+                       iDtmfStringLex.Peek() );
+                
+                SVPDEBUG1( "CSVPController::ReleaseCall - Complete DTMF" )
+                
+                // send sequence completed event
+                iSessionArray[i]->DtmfObserver().HandleDTMFEvent(
+                    MCCPDTMFObserver::ECCPDtmfStringSendingCompleted,
+                    KErrNone,
+                    iDtmfStringLex.Peek() );
+                
+                // sequence complete, clear flags
+                iDtmfStringSending = EFalse;
+                iFirstDtmfSent = EFalse;
+                
+                delete iDtmfString;
+                iDtmfString = NULL;
+                }
+            iSessionArray[i]->Release();
+            response = KErrNone;
+            }
+        }
+
+#ifndef __WINS__
+    // Preliminary Call Admission Control implementation, delete only if created in NewCallL 
+    if ( iTrafficStreamCreated )
+        {
+        SVPDEBUG1( "CSVPController::ReleaseCall - Deleting WLAN traffic stream" )
+
+        TRequestStatus requestStatus;
+
+        // Enabling WLAN traffic stream automation back by deleting used stream
+        iWlanMgmt->DeleteTrafficStream( requestStatus, iTrafficStreamId );
+        User::WaitForRequest( requestStatus );
+        
+        iTrafficStreamCreated = EFalse;
+
+        SVPDEBUG1( "CSVPController::ReleaseCall - WLAN traffic stream deleted" )
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPController::ReleaseCall - No WLAN traffic stream to delete" )
+        ;
+        }
+#endif // __WINS__
+
+    SVPDEBUG1( "CSVPController::ReleaseCall Out" )
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// Releases emergency call
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPController::ReleaseEmergencyCall( MCCPEmergencyCall& /*aCall*/ )
+    {
+    SVPDEBUG1( "CSVPController::ReleaseEmergencyCall In" )
+
+    // To ensure correct value next time
+    iIncomingReferCallIndex = KErrNotFound;
+    iSessionUpdateOngoing = EFalse;
+
+    delete iEmergencySession;
+    iEmergencySession = NULL;
+    
+    SVPDEBUG1( "CSVPController::ReleaseEmergencyCall Out" )
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Releases conference call
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPController::ReleaseConferenceCall( MCCPConferenceCall& /*aCall*/ )
+    {
+    SVPDEBUG1( "CSVPController::ReleaseConferenceCall In" )
+    SVPDEBUG1( "CSVPController::ReleaseConferenceCall Out" )
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::RemoveFromArray
+// ---------------------------------------------------------------------------
+// 
+void CSVPController::RemoveFromArray( CSVPSessionBase& aSession )
+    {
+    SVPDEBUG1( "CSVPController::RemoveFromArray In" )
+    
+    // When Sessions destructor is called object be removed from array
+    // manually after when data has been deleted.
+    SVPDEBUG2( "CSVPController::RemoveFromArray aSession: 0x%x", &aSession )
+    
+    TInt index = FindSVPSession( aSession.Session() );  
+    if ( KErrNotFound != index )
+        {
+        SVPDEBUG1( "CSVPController::RemoveFromArray Session found - removing" )
+        iSessionArray.Remove( index );
+        iSessionArray.Compress();
+        }
+    
+    // Try also to remove it from RTCP observer. Ingore the return code, yet
+    // again this is "just in case" thing.
+    iRtpObserver->RemoveSessionFromObserving( &aSession );
+    SVPDEBUG1( "CSVPController::RemoveFromArray Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::FindSVPSession
+// ---------------------------------------------------------------------------
+//
+TInt CSVPController::FindSVPSession( const CMceSession& aSession ) const
+    {
+    SVPDEBUG1( "CSVPController::FindSVPSession In" )
+    
+    TInt count = iSessionArray.Count();
+    SVPDEBUG2( "CSVPController::FindSVPSession count = %d", count )
+    
+    while ( count )
+        {
+        count--;
+        
+        if (  &iSessionArray[count]->Session() == &aSession )
+            {
+            SVPDEBUG2( "CSVPController::FindSVPSession Out return: %d", count )
+            return count;
+            }
+        }
+    
+    SVPDEBUG1( "CSVPController::FindSVPSession Out return: KErrNotFound" )
+    return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::Uid
+// ---------------------------------------------------------------------------
+//
+const TUid& CSVPController::Uid() const
+    {
+    SVPDEBUG1( "CSVPController::Uid" )
+    return KSVPImplementationUid; 
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::CreateNonSecureSessionL
+// ---------------------------------------------------------------------------
+// 
+void CSVPController::CreateNonSecureSessionL( TInt aSessionIndex )
+    {
+    SVPDEBUG1( "CSVPController::CreateNonSecureSessionL In" )
+    
+    // secure session failed -> create non secure Mo session
+    static_cast< CSVPMoSession* >( iSessionArray[ aSessionIndex ] )->
+            CreateNonSecureSessionL( *iMceManager );
+    
+    SVPDEBUG1( "CSVPController::CreateNonSecureSessionL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::CheckIfSecureFailed
+// ---------------------------------------------------------------------------
+//    
+TBool CSVPController::CheckIfSecureFailed( TInt aStatusCode ) const
+    {
+    SVPDEBUG2( "CSVPController::CheckIfSecureFailed In, aStatusCode: %d", aStatusCode )
+    
+    // if secure fails with the following response codes
+    // normal session is tried next
+    if ( KSVPNotAcceptableHereVal == aStatusCode ||
+         KSVPNotAcceptableVal == aStatusCode ||
+         KSVPPreconditionFailureVal == aStatusCode ||
+         KSVPMethodNotAllowedVal == aStatusCode )
+        {
+        SVPDEBUG1( "CSVPController::CheckIfSecureFailed Out ETrue" )
+        return ETrue;
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPController::CheckIfSecureFailed Out EFalse" )
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::SessionStateChanged
+// ---------------------------------------------------------------------------
+// 
+void CSVPController::SessionStateChanged( CMceSession& aSession,
+    TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::SessionStateChanged In" )
+    
+    // Note, getting the status code may reset it in the container. So do it
+    // only once and be sure that it stays as it should be.
+    const TInt statusCode = aContainer->GetStatusCode();
+    SVPDEBUG2( "CSVPController::SessionStateChanged statusCode: %d", statusCode )
+    
+    // check if this is emergency session
+    if ( iEmergencySession )
+        {
+        SVPDEBUG1( "CSVPController::SessionStateChanged, emergency session" )
+        
+        if ( CMceSession::EEstablished == aSession.State() )
+            {
+            // Rest of the profiles not needed since session is established
+            iEmergencyProfileIds.Reset();
+            iEmergencyIapIds.Reset();
+            }
+        
+        if ( CMceSession::EEstablished == aSession.State() &&
+             iEmergencySession->HasHoldController() &&
+             ( ( iEmergencySession->HoldController() ).HoldInProgress() ||
+               ( iEmergencySession->HoldController() ).HoldRolledBack() ) )
+            {
+            // Handle hold
+            TRAPD( error, iEmergencySession->HoldSessionStateChangedL( aSession ) )
+            
+            if ( error )
+                {
+                SVPDEBUG2( "CSVPController::SessionStateChanged, emergency session error %d", error )
+                }
+            }
+        else
+            {
+            iEmergencySession->SessionStateChanged( statusCode );
+            }
+        }
+    else if ( iSessionUpdateOngoing )
+        {
+        // Non-hold session update, e.g. codec renegotiation ongoing; no actions
+        // needed until MCE session state is established.
+        SVPDEBUG1( "CSVPController::SessionStateChanged - MT Session Update" )
+        
+        if ( CMceSession::EEstablished == aSession.State() )
+            {
+            // Session update done (Ack received)
+            iSessionUpdateOngoing = EFalse;
+            SVPDEBUG1( "CSVPController::SessionStateChanged - MT Session Updated" )
+            }
+        }
+    else
+        {
+        // fetch correct session
+        const TInt ind = FindSVPSession( aSession );
+        
+        // KErrNone = status, status had to be error code
+        if ( KErrNotFound != ind &&
+             iSessionArray[ ind ]->SecurePreferred() &&
+             CheckIfSecureFailed( statusCode ) ||
+             CMceSession::ECancelling == aSession.State() )
+            {
+            SVPDEBUG1( "CSVPController::SessionStateChanged - Secure failed, trying normal session" )
+            
+            // trying normal session after secure session trial failed
+            TRAPD( err, CreateNonSecureSessionL( ind ) );
+            
+            if ( err )
+                {
+                iSessionArray[ ind ]->GetCCPSessionObserver().
+                    ErrorOccurred( ECCPRedirection, iSessionArray[ ind ] );
+                iSessionArray[ ind ]->GetCCPSessionObserver().
+                    CallStateChanged( MCCPCallObserver::ECCPStateIdle,
+                                      iSessionArray[ ind ]);
+                }
+            }
+        else if ( KErrNotFound != ind )
+            {
+            SVPDEBUG1( "CSVPController::SessionStateChanged - Session found" )
+            
+            CSVPSessionBase* session = iSessionArray[ ind ];
+            
+            if ( !session->CallId() &&
+                 KSVPMultipleChoicesVal != statusCode &&
+                 KSVPMovedPermanentlyVal != statusCode &&
+                 KSVPMovedTemporarilyVal != statusCode )
+                {
+                // CallId not stored yet and not a 3XX case,
+                // check and store headers data.
+                CheckHeadersData( session, aContainer );
+                }
+            
+            if ( !session->SecurePreferred() )
+                {
+                session->ReleaseTempSecure();
+                }
+            
+            // Release attended transfer target session index 
+            // if e.g. early stage session terminate
+            if ( CMceSession::ETerminated == aSession.State() )
+                {
+                iHoldCallIndex = KErrNotFound;
+                }
+            
+            if ( CMceSession::EProceeding == aSession.State() )
+                {
+                SVPDEBUG1( "CSVPController::SessionStateChanged EProceeding" )
+                
+                if ( KErrNotFound != iHoldCallIndex && iSessionArray.Count() > 1 )
+                    {
+                    SVPDEBUG3( "CSVPController::SessionStateChanged, atte trans target, ind %d, iHCInd %d",
+                                                ind, iHoldCallIndex )
+                    CheckCallEventToBeSent( session, iSessionArray[iHoldCallIndex] );
+                    ExecCbIncomingCall( session, *iSessionArray[iHoldCallIndex] );
+                    iHoldCallIndex = KErrNotFound;
+                    }
+                else if ( session->HasHoldController() &&
+                          ( session->HoldController() ).HoldInProgress() )
+                    {
+                    // Do nothing here; this only prevents wrong new call
+                    // callback to CCP.
+                    SVPDEBUG1( "CSVPController::SessionStateChanged - HoldInProgress" )
+                    }
+                else if ( session->IsEmptyReInvite() )
+                    {
+                    SVPDEBUG1( "CSVPController::SessionStateChanged - Empty re-Invite handling ongoing" )
+                    }
+                else if ( !session->IsIdle() )
+                    {
+                    SVPDEBUG1( "CSVPController::SessionStateChanged - NOP" )
+                    }
+                else
+                    {
+                    SVPDEBUG1( "CSVPController::SessionStateChanged Incoming" )
+                    ExecCbIncomingCall( session );
+                    session->SessionStateChanged( statusCode );
+                    }
+                }
+            else if ( CMceSession::EEstablished == aSession.State() &&
+                      session->HasHoldController() &&
+                    ( ( session->HoldController() ).HoldInProgress() ||
+                      ( session->HoldController() ).HoldRolledBack() ) )
+                {
+                SVPDEBUG1( "CSVPController::SessionStateChanged EEstablished & HoldController" )
+                
+                session->HandleSessionStateChanged( aSession );
+                }
+            else if ( ( CMceSession::EEstablished == aSession.State() || 
+                        CMceSession::ETerminated == aSession.State() ) &&
+                        KErrNone != statusCode &&
+                        KErrNotFound != iIncomingReferCallIndex &&
+                        iIncomingReferCallIndex < iSessionArray.Count() &&
+                        iSessionArray[ iIncomingReferCallIndex ]->IsIncomingTransfer() )
+                {
+                SVPDEBUG1( "CSVPController::SessionStateChanged transferor" )
+                
+                // Transferor sends notify to original when new session connected/failed.
+                // If secure is mandatory but path unsecure, attended transfer req must be rejected
+                if ( session->SecureMandatory() &&
+                     CMceSession::EControlPathUnsecure == aSession.ControlPathSecurityLevel() &&
+                     iSessionArray[ iIncomingReferCallIndex ]->IsAttended() )
+                    {
+                    iSessionArray[ iIncomingReferCallIndex ]->SendNotify( KSVPDeclineVal );
+                    }
+                else
+                    {
+                    iSessionArray[ iIncomingReferCallIndex ]->SendNotify( statusCode );
+                    }
+
+                if ( iSessionArray[ iIncomingReferCallIndex ]->IsAttended() )
+                    {
+                    // remotepartyinfo and/or secure status might have been changed,
+                    // proper event will be sent later on.
+                    CheckCallEventToBeSent( session, iSessionArray[iIncomingReferCallIndex] );
+                    }
+                iIncomingReferCallIndex = KErrNotFound;
+                session->SessionStateChanged( statusCode );
+                }
+            // 3xx Call forward handling
+            else if ( KSVPMultipleChoicesVal == statusCode  ||
+                      KSVPMovedPermanentlyVal == statusCode ||
+                      KSVPMovedTemporarilyVal == statusCode )
+                {
+                HandleCallForward( statusCode, ind, aContainer );
+                }
+            else
+                {
+                if ( ( aSession.State() == CMceSession::EOffering || 
+                       aSession.State() == CMceSession::ETerminating ||
+                       aSession.State() == CMceSession::ETerminated ) &&
+                       iSessionArray[ ind ]->HasHoldController() &&
+                       ( ( iSessionArray[ ind ]->HoldController() ).HoldInProgress() ||
+                       ( iSessionArray[ ind ]->HoldController() ).HoldRolledBack() ) )
+                    {
+                    // Failed hold e.g. 408 response
+                    SVPDEBUG1("CSVPController::SessionStateChanged()\
+                    State change: Failed && HoldController");            
+                    if ( 491 == statusCode )
+                        {
+                        SVPDEBUG1( 
+                        "CSVPController::SessionStateChanged - UpdateFailed()" )
+                        UpdateFailed( aSession, aContainer );
+                        }
+                    else if ( 100 <= statusCode && 200 > statusCode ) // Provisional response
+                        {
+                        // NOP
+                        SVPDEBUG1( 
+                        "CSVPController::SessionStateChanged - Provisional - NOP" )
+                        }
+                    else
+                        {
+                        iSessionArray[ ind ]->HandleSessionStateChanged( aSession );
+                        session->SessionStateChanged( statusCode );                
+                        }
+                    }                
+                
+                else if ( session->HasHoldController() )
+                    {
+                    // MCE Session Refresh; no actions by the SVP
+                    SVPDEBUG1( 
+                    "CSVPController::SessionStateChanged - Session refresh" )
+                    if ( CMceSession::ETerminating == aSession.State() ||
+                         CMceSession::ETerminated == aSession.State() )
+                        {
+                        session->SessionStateChanged( statusCode );
+                        }
+                    }
+                else if ( !iFailed )
+                    {
+                    SVPDEBUG1( 
+                    "CSVPController::SessionStateChanged - Not handled -> Notify session" )
+                    session->SessionStateChanged( statusCode );
+                    }                
+                else
+                    {
+                    // Failed() callback occurred before EEstablished state
+                    // -> No action needed, session termination timer is set
+                    }
+                }
+            }
+        else
+            {
+            SVPDEBUG1( "CSVPController::SessionStateChanged else" )
+            }
+        }
+    
+    SVPDEBUG1( "CSVPController::SessionStateChanged Out" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPController::SessionConnectionStateChanged
+// ---------------------------------------------------------------------------
+//  
+void CSVPController::SessionConnectionStateChanged(
+                CMceSession& aSession,
+                TBool aActive )
+    {
+    SVPDEBUG2("CSVPController::SessionConnectionStateChanged Active ETrue, Inactive EFalse: %d", aActive )
+    
+    if ( iEmergencySession )
+        {
+        iEmergencySession->SessionConnectionStateChanged( aSession, aActive );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPController::Failed
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CSVPController::Failed( CMceSession& aSession, TInt aError )
+#else
+void CSVPController::Failed( CMceSession& aSession, TInt /*aError*/ )
+#endif // _DEBUG
+    {
+    SVPDEBUG1("CSVPController::Failed In" )
+    SVPDEBUG2("CSVPController::Failed With error code: %d", aError )
+    
+    TInt ind = FindSVPSession( aSession );
+    
+    if ( KErrNotFound != ind )
+        {
+        SVPDEBUG1("CSVPController::Failed() Session found")
+        
+        if ( &iSessionArray[ ind ]->GetCCPSessionObserver() )
+            {
+        	iSessionArray[ ind ]->GetCCPSessionObserver().
+            	ErrorOccurred( ECCPErrorConnectionError, 
+            	               iSessionArray[ ind ] );
+        
+        	// Actually MCE session state should always 
+        	// be ETerminated when this method is 
+        	// called; but check anyway:        
+        	if ( CMceSession::ETerminated == aSession.State() )
+        	    {
+                iFailed = ETrue;
+        	    // start termination timer, needed for UI
+        	    // to handle Disconnected-bubble   
+        	    TRAP_IGNORE( iSessionArray[ ind ]->StartTimerL( 
+        	            KSVPTerminatingTime, KSVPTerminationTimerExpired ) );
+            
+        	    iSessionArray[ ind ]->GetCCPSessionObserver().
+        		    CallStateChanged( MCCPCallObserver::ECCPStateDisconnecting, 
+        		                      iSessionArray[ ind ] );
+            
+        	    SVPDEBUG1("CSVPController::Failed() Session terminating");            
+        	    }
+            }
+        else
+            {
+            iCCPMonitor->ErrorOccurred( MCCPObserver::ECCPIncomingCallFailed ); 
+            }
+        }
+    else
+        {
+        SVPDEBUG1("CSVPController::Failed() Session not Found!!");
+        }
+    
+    SVPDEBUG1("CSVPController::Failed Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::UpdateFailed
+// ---------------------------------------------------------------------------
+//
+void CSVPController::UpdateFailed(
+    			CMceSession& aSession,
+    			TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::UpdateFailed In" )
+    
+    TInt ind = FindSVPSession( aSession );
+    TInt statusCode = aContainer->GetStatusCode();
+    
+    SVPDEBUG2( "CSVPController::UpdateFailed statusCode: %d", statusCode )
+    
+    if ( KErrNotFound != ind )
+        {
+        iSessionArray[ ind ]->UpdateFailed( aSession, statusCode );
+        }
+    iSessionUpdateOngoing = EFalse;
+    SVPDEBUG1( "CSVPController::UpdateFailed Out" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPController::EventStateChanged
+// ---------------------------------------------------------------------------
+//			
+void CSVPController::EventStateChanged(
+    			CMceEvent& aEvent,
+				TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController:EventStateChanged In" )
+    
+    iContainer = *aContainer;
+    TInt ind = FindSVPSession( *aEvent.AssociatedSession() );
+    TInt statusCode = iContainer.GetStatusCode();
+    
+    SVPDEBUG2( "CSVPController:EventStateChanged statusCode: %d", statusCode )
+
+    if ( KErrNotFound != ind )
+        {
+        SVPDEBUG2( "CSVPController::EventStateChanged ind = %d", ind )
+        TInt err = iSessionArray[ ind ]->EventStateChanged( aEvent, statusCode );
+        
+        if ( KSVPOKVal == statusCode &&
+             iSessionArray[ ind ]->IsAttended() &&
+             KErrNone == err )
+            {
+            SVPDEBUG1( "CSVPController::EventStateChanged Atte transfer cont." )
+            
+            TRAP( err, CreateNewTransferSessionL( ind, ETrue ) );
+            
+            if ( err )
+                {
+                SVPDEBUG2( "CSVPController::EventStateChanged: err: %d", err )
+                }
+            }
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPController::EventStateChanged Session not Found!!" )
+        }
+
+    SVPDEBUG1("CSVPController:EventStateChanged OUT");
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPController::NotifyReceived
+// ---------------------------------------------------------------------------
+//
+void CSVPController::NotifyReceived(
+				CMceEvent& aEvent,
+				TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::NotifyReceived In" )
+    
+    TInt ind = FindSVPSession( *aEvent.AssociatedSession() );
+    
+    if ( KErrNotFound != ind )
+        {         
+        iSessionArray[ ind ]->NotifyReceived( aEvent, aContainer );
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPController::NotifyReceived, session not found !" )
+        }
+
+    SVPDEBUG1( "CSVPController::NotifyReceived Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::EventConnectionStateChanged
+// ---------------------------------------------------------------------------
+//			
+void CSVPController:: EventConnectionStateChanged(
+                CMceEvent& /*aEvent*/,
+                TBool /*aActive*/ )
+    {
+    SVPDEBUG1( "CSVPController:: EventConnectionStateChanged In" )
+    SVPDEBUG1( "CSVPController:: EventConnectionStateChanged Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::Failed
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CSVPController::Failed( CMceEvent& /*aEvent*/, TInt aError )
+#else
+void CSVPController::Failed( CMceEvent& /*aEvent*/, TInt /*aError*/ )
+#endif // _DEBUG
+    {
+    SVPDEBUG2("CSVPController::Failed Event failure, error: %d", aError )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::IncomingSession
+// ---------------------------------------------------------------------------
+//
+void CSVPController::IncomingSession(
+                CMceInSession* aSession,
+				TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::IncomingSession In" )
+    SVPDEBUG2( "CSVPController::IncomingSession - status code: %d", aContainer->GetStatusCode() )
+    
+    if ( iEmergencySession )
+        {
+        SVPDEBUG1( "CSVPController::IncomingSession - ongoing emergency call - reject incoming call" )
+        TRAP_IGNORE( aSession->RejectL( KSVPBusyHereReason, KSVPBusyHereVal ) )
+        // Ownership of aSession is changed, delete it
+        delete aSession;
+        aSession = NULL;
+        return;
+        }
+    
+    // IncomingSessionHandlerL is used to handle possible leave 
+    SVPDEBUG1( "CSVPController::IncomingSession IncomingSessionHandlerL" )
+    TRAPD( err, IncomingSessionHandlerL( aSession, aContainer ) );
+    
+    if ( err )
+        {
+        SVPDEBUG2( "CSVPController::IncomingSession: err: %d", err )
+        
+        // RejectL must be called in case SVP needs to delete session.
+        // TRAP is used because of RejectL might contain a leaver.
+        switch ( err )
+            {
+            case KErrNotSupported:
+                {
+                TRAP( err, aSession->RejectL( KSVPCallTransactDoesNotExistReason,
+                        KSVPCallDoesNotExistVal ) );
+                break;
+                }
+            
+            case KSVPErrWrongMinSE:
+                // NOP. Reject has been done as a result of call to
+                // IncomingSessionHandlerL.
+                break;
+            
+            case KSVPErrDnDRejection:
+                {
+                // Reject call because of Do not Disturb service active.
+                TRAP( err, aSession->RejectL( KSVPBusyHereReason,
+                        KSVPBusyHereVal ) );
+                break;
+                }
+             
+             case KSVPErrAnonymousCallRejection:
+                {
+                // Reject call because of Anonymous Barring service active.
+                TRAP( err, aSession->RejectL( KSVPNotAcceptableHereReason,
+                        KSVPNotAcceptableHereVal ) );
+                break;
+                }
+             
+             case KSVPErrCodecMismatch:
+                {
+                TRAP( err, aSession->RejectL( KSVPIncompatibleMediaFormatReason,
+                        KSVPNotAcceptableHereVal ) );
+                break;
+                }
+             
+             default:
+                {
+                // NOP.
+                break;
+                }
+            }
+        
+        if ( KErrNotFound == FindSVPSession( *aSession ) )
+            {
+            // Leave has occured before CSVPMtSession was created.
+            delete aSession;
+            }
+        else
+            {
+            SVPDEBUG1( "CSVPController::IncomingSession IncomingSessionHandlerL leave occurred" )
+            // clean up session 
+            TerminateSession( *aSession );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::TerminateSession
+// ---------------------------------------------------------------------------
+//
+void CSVPController::TerminateSession( CMceInSession& aSession ) 
+    {
+    SVPDEBUG1( "CSVPController::TerminateSession In" )
+    
+    // find correct session
+    TInt index =  FindSVPSession( aSession );
+    
+    if ( KErrNotFound != index )
+        {
+        CSVPSessionBase* tempBase = iSessionArray[ index ];
+        // remove session pointer from array and compress array
+        iSessionArray.Remove( index );
+        iSessionArray.Compress();
+        
+        // delete session  
+        delete tempBase;
+        tempBase = NULL;            
+        }
+            
+    SVPDEBUG1( "CSVPController::TerminateSession Out" )  
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::CheckMinSessionExpiresL
+// ---------------------------------------------------------------------------
+//
+void CSVPController::CheckMinSessionExpiresL( CMceInSession& aSession,
+                                              CDesC8Array& aHeaders, 
+                                              TInt aMinSE  )
+    {
+    SVPDEBUG1( "CSVPController::CheckMinSessionExpiresL In" )
+    
+    TInt count = aHeaders.MdcaCount();
+    TUint32 sessionExpires = 0;
+    TInt error = KErrNone;
+    while ( count-- )  
+    	{
+        TPtrC8 tmpHeader = aHeaders.MdcaPoint( count );
+        if ( KErrNotFound != tmpHeader.Find( KSVPSessionExpires ) )
+            {
+            // "Session-Expires:" found
+            SVPDEBUG1( "CSVPController::CheckMinSEL: 'Session-Expires:' found" )
+            
+            TInt offset = tmpHeader.FindF( KSVPRefresher );
+            if ( KErrNotFound != offset )
+                {
+                tmpHeader.Set( tmpHeader.Left( offset ) );
+                }
+            
+            TPtrC8 header;
+            header.Set( tmpHeader );
+            if ( header.FindF( KSVPCln ) )
+                {
+                // 5 digits should be enought for Min-SE
+                // For example: "Min-SE: 1200" 
+                TLex8 expires( header.Right( 5 ) ); 
+                TInt digits = 0;
+                while ( !expires.Eos() )
+                    {
+                    if ( expires.Peek().IsDigit() )
+                        {
+                        digits++; 
+                        }
+                    expires.Inc();
+                    }  
+                TLex8 expiresVal( header.Right( digits ) );
+                error = expiresVal.Val( sessionExpires, EDecimal );
+                SVPDEBUG2(" CSVPController::CheckMinSEL sesExp: %d", sessionExpires )
+
+                if ( error || aMinSE > sessionExpires  )  
+                    {
+                    SVPDEBUG2(" CSVPController::CheckMinSEL reject, err: %d", error )
+                    CDesC8ArrayFlat* minSEHeader = 
+                        new ( ELeave ) CDesC8ArrayFlat( 1 );
+                    CleanupStack::PushL( minSEHeader ); // CS:0
+                        
+                    HBufC8* header = HBufC8::NewL( 
+                                 KSVPMinExpiresLenght + digits  );
+                    CleanupStack::PushL( header );  // CS:1
+                    
+                    header->Des().Copy( KSVPMinSessionExpires );
+                    header->Des().AppendNum( aMinSE );
+                    minSEHeader[ 0 ].AppendL( *header );
+                    CleanupStack::PopAndDestroy( header ); // CS:1
+                    
+                    aSession.RejectL( KSVPIntervalTooSmallReason,
+              		 			      KSVPSessionIntervalTooSmallVal,
+                                      minSEHeader );
+                    
+                    // ownership to Mce
+                    CleanupStack::Pop( minSEHeader ); // CS:0
+                    User::Leave( KSVPErrWrongMinSE );
+                    }
+                }
+            }
+        }
+    
+    SVPDEBUG1( "CSVPController::CheckMinSessionExpiresL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::FetchExpiresTime
+// ---------------------------------------------------------------------------
+//
+void CSVPController::FetchExpiresTime( TUint32& aExpiresTime, 
+                                       CDesC8Array& aHeaders ) const
+    {
+    SVPDEBUG1( "CSVPController::FetchExpiresTime In" )
+    
+    TBool expiresTaken = EFalse;
+    for ( TInt i = 0; i < aHeaders.MdcaCount() && !expiresTaken; i++ )
+        {
+        TPtrC8 tmpHeader = aHeaders.MdcaPoint( i );
+        if ( KErrNotFound != tmpHeader.Find( KSVPExpiresHeader ) &&
+             KErrNotFound == tmpHeader.Find( KSVPSessionExpires ) )
+            {
+            // "Expires:" found
+            SVPDEBUG1(" CSVPController::FetchExpiresTimer: 'Expires:' found")
+
+            TInt colonMark = tmpHeader.FindF( KSVPCln );
+           
+            if ( colonMark )
+                {
+                
+                TLex8 expires( tmpHeader.Right( 5 ) ); // three digits max
+                TInt digits = 0;
+                while ( !expires.Eos() )
+                    {
+                    if ( expires.Peek().IsDigit() )
+                        {
+                        digits++; 
+                        }
+                    expires.Inc();
+                    }
+                TLex8 expiresVal( tmpHeader.Right( digits ) );
+                TInt error = expiresVal.Val( aExpiresTime, EDecimal );
+
+                if ( error )
+                    {
+                    SVPDEBUG2(" CSVPController::FetchExpiresTimer, set default value\
+                     Val error: %d", error );
+                    // if error occurred, set default time
+                    aExpiresTime = KSVPDefaultExpiresTime;
+                    expiresTaken = ETrue;
+                    } 
+                else if ( KSVPDefaultExpiresTime < aExpiresTime )
+                    {
+                    aExpiresTime = KSVPDefaultExpiresTime;
+                    expiresTaken = ETrue;
+                    }
+                else
+                    {
+                    SVPDEBUG2(" CSVPController::FetchExpiresTime: %d", aExpiresTime )
+                    expiresTaken = ETrue;
+                    }
+                }                 
+            }
+        }
+    
+    SVPDEBUG1( "CSVPController::FetchExpiresTime Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::IncomingSessionHandlerL
+// ---------------------------------------------------------------------------
+//
+void CSVPController::IncomingSessionHandlerL( CMceInSession* aSession,
+			                    	TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::IncomingSessionHandlerL In" )
+    
+    __ASSERT_ALWAYS( aSession, User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( aContainer, User::Leave( KErrArgument ) );
+
+    CDesC8Array* headers = aContainer->GetHeaders();
+    __ASSERT_ALWAYS( headers, User::Leave( KErrArgument ) );
+    CleanupStack::PushL( headers ); // CS:1
+
+    IsTransferTargetCaseL( headers );
+    
+    // check if Require header contains precondition and that Supported header
+    // includes option tag 100rel, providing support for PRACK's
+    iPreconditions = IsPreconditionRequired( *headers );
+
+    // Default expiration time (120 s) is set due IOP issue,
+	// otherwise incoming call would continue eternity in some cases.
+    TUint32 expireTime = KSVPDefaultExpiresTime;
+    // check if expires header is present and update expiration time
+    FetchExpiresTime( expireTime, *headers );
+    
+    // mt session temp
+    CSVPMtSession* mtSessionTemp = NULL;
+    
+    CRCSEProfileRegistry* reg = CRCSEProfileRegistry::NewLC();      // CS:2
+    
+    RPointerArray< CRCSEProfileEntry > voipProfiles;
+    CleanupResetAndDestroy< RPointerArray< CRCSEProfileEntry > >::PushL(
+        voipProfiles );                                             // CS:3
+    
+    reg->FindBySIPProfileIdL( aSession->Profile(), voipProfiles );
+    
+    // Take first profile from the array
+    const TUint32 voipProfileId = voipProfiles[ 0 ]->iId;
+    const TUint32 minSE = voipProfiles[ 0 ]->iSIPMinSE;
+    
+    CheckMinSessionExpiresL( *aSession, *headers, minSE );
+     
+    SVPDEBUG2("CSVPController::IncomingSessionHandlerL VoIP profile id: %d",
+        voipProfileId );
+             
+    // Take first profile from the array
+    const TUint32 serviceId = voipProfiles[ 0 ]->iServiceProviderId;
+    
+    SVPDEBUG2("CSVPController::IncomingSessionHandlerL Service id: %d",
+        serviceId );
+    
+    // create SIP and ProfileRegistry for profile handling
+    CSIP* sip = CSIP::NewLC( KSVPUid, *this );      // CS: 4
+    SVPDEBUG1( "CSVPController::IncomingSessionHandlerL sip CREATED" );
+    
+    CSIPProfileRegistry* sipProfileRegistry = 
+        CSIPProfileRegistry::NewLC( *sip, *this );  // CS: 5
+    
+    SVPDEBUG1( "CSVPController::IncomingSessionHandlerL\
+    profile registry CREATED" );
+    
+    // retrieve SIP profile by using sip profile id, note ownership transfer
+    CSIPProfile* profile = sipProfileRegistry->ProfileL( aSession->Profile() );
+    
+    // Get keep-alive timer value
+    TUint32 iapId = 0;
+    TBool found = EFalse;
+    TInt keepAliveValue;
+    
+    profile->GetParameter( KSIPAccessPointId, iapId );
+
+    TRAPD( errKeepAlive, 
+        found = iSVPUtility->GetKeepAliveByIapIdL( iapId, keepAliveValue ) );
+    
+    SVPDEBUG3( "CSVPController::IncomingSessionHandlerL\
+                GetKeepAliveByIapIdL: errKeepAlive = %d found = %d",
+                errKeepAlive, found );
+     
+    if ( !found )
+        {
+        const TDesC8* aor;
+        profile->GetParameter( KSIPUserAor, aor );
+        TRAP( errKeepAlive, found = 
+            iSVPUtility->GetKeepAliveByAORL( *aor, keepAliveValue ) );
+        
+        SVPDEBUG3( "CSVPController::IncomingSessionHandlerL\
+                    GetKeepAliveByAORL: errKeepAlive = %d found = %d",
+                    errKeepAlive, found );
+        }
+    
+    delete profile;
+    CleanupStack::PopAndDestroy( 2, sip );          // CS:3
+    
+    CMceRtpSource* rtpSource = NULL;
+    
+    // modify codecs and codec settings if streams found
+    if ( aSession->Streams().Count() )
+        {
+      	const RPointerArray<CMceMediaStream>& streams = aSession->Streams();
+      	
+        SVPDEBUG2("CSVPController::IncomingSessionHandlerL Streamcount: %d",
+            streams.Count() );
+        
+        // disable rtp source and speaker sink so that audio is not on
+        // before session is up signalling-wise
+        for ( TInt i = 0; i < streams.Count(); )
+            {
+            SVPDEBUG1( "CSVPController::IncomingSessionHandlerL disabling" );
+            
+            CMceMediaStream* stream1 = streams[i];
+            
+            // if stream is not audio stream -> remove 
+            if ( KMceAudio != stream1->Type() )
+                {
+                aSession->RemoveStreamL( *streams[ i ] );
+                }
+            else
+                {
+                // search for RTP source
+                if ( stream1->Source() && 
+                     KMceRTPSource == stream1->Source()->Type() )
+                    {
+                    SVPDEBUG1(
+                        "CSVPController::IncomingSessionHandlerL\
+                         RTPSource found" );
+                    
+                	rtpSource = static_cast<CMceRtpSource*>(
+                	    stream1->Source() );
+                    }
+            
+                SVPAudioUtility::DisableSpeakerSinkL( stream1->Sinks() );
+                SVPAudioUtility::DisableMicSourceL( *stream1 );
+                //remove all streams that not audio stream
+                i++;
+                }
+            }
+            
+        // sets MMF priorities and sets codec specific settings
+        CheckStreamsL( *voipProfiles[ 0 ], *aSession, keepAliveValue );
+        if ( rtpSource )
+            {
+            iSVPUtility->UpdateJitterBufferSizeL( *rtpSource );
+            }
+        
+        // create SVP Mt session    
+        mtSessionTemp = CSVPMtSession::NewL( aSession,
+                                             iContainer,
+                                             serviceId,
+                                             voipProfileId, 
+                                             *this, 
+                                             *iSVPUtility,
+                                             *iRtpObserver,
+                                             keepAliveValue,
+                                             iPreconditions );
+        
+        CleanupStack::PushL( mtSessionTemp );
+        FinalizeSessionCreationL( mtSessionTemp );
+        CleanupStack::Pop( mtSessionTemp );
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPController::IncomingSessionHandlerL NO streams!" );
+        
+        // no streams found, handle streams like in Mo-case  
+        mtSessionTemp = CSVPMtSession::NewL( aSession,
+                                             iContainer,
+                                             serviceId,
+                                             voipProfileId, 
+                                             *this, 
+                                             *iSVPUtility,
+                                             *iRtpObserver,
+                                             keepAliveValue,
+                                             iPreconditions );
+        
+        CleanupStack::PushL( mtSessionTemp );
+        // construct audio streams 
+        mtSessionTemp->ConstructAudioStreamsL();
+        FinalizeSessionCreationL( mtSessionTemp );
+        CleanupStack::Pop( mtSessionTemp );
+        }
+    
+    CleanupStack::PopAndDestroy( 3, headers );                          // CS:0
+    
+    // set expires timer
+    if ( expireTime )
+        {
+        SVPDEBUG2( "CSVPController::IncomingSessionHandlerL expireTime: %i s.", expireTime );
+        mtSessionTemp->StartTimerL( KSVPMilliSecondCoefficient * expireTime,
+                                    KSVPExpiresTimeExpired );
+        }
+    
+    SVPDEBUG1( "CSVPController::IncomingSessionHandlerL Updating call" );
+    
+    aSession->UpdateL();
+    
+    SVPDEBUG2( "CSVPController::IncomingSessionHandlerL, Call state after update: %i",
+        aSession->State() );
+    
+    if ( CMceSession::EProceeding == aSession->State() )
+        {
+        const TInt ind = FindSVPSession( *aSession );
+        iCCPMonitor->IncomingCall( iSessionArray[ ind ] );
+        
+        SVPDEBUG1( "CSVPController::IncomingSessionHandlerL - EProceeding" );
+        
+        iSessionArray[ ind ]->SessionStateChanged( KErrNone );
+        }
+    
+    // reset flag
+    iPreconditions = EFalse;
+    
+    SVPDEBUG1( "CSVPController::IncomingSessionHandlerL Out" )
+    }
+   
+// ---------------------------------------------------------------------------
+// CSVPController::CheckStreamsL
+// ---------------------------------------------------------------------------
+//    
+void CSVPController::CheckStreamsL( CRCSEProfileEntry& aVoipProfile, 
+                                    CMceSession& aInSession,
+                                    TInt aKeepAliveValue,
+                                    TBool aSessionUpdateOngoing)
+    {
+    SVPDEBUG1( "CSVPController::CheckStreamsL In" )
+    
+    __ASSERT_ALWAYS( &aInSession, User::Leave( KErrArgument ) );
+
+    const RPointerArray< CMceMediaStream >& streamArray = 
+        aInSession.Streams();
+    
+    const TInt streamCount( streamArray.Count() );
+    
+    SVPDEBUG3("CSVPController::CheckStreamsL aVoIPProfileId: %u streamCount: %d ",
+            aVoipProfile.iId, streamCount );
+    
+    // Set codec settings, this also removes unneeded codecs.
+    for ( TInt i = 0; i < streamCount; i++ )
+        {
+        iSVPUtility->SetAudioCodecsMTL( aVoipProfile, 
+                                        *streamArray[ i ], 
+                                        aKeepAliveValue,
+                                        aSessionUpdateOngoing );
+
+        // Set the priorities for the remaining codecs. This will handle also the
+        // DTMF priorites once correct codecs are set in the streams. Also note
+        // the downlink/uplink (in/out) discrimination.
+
+        if ( KMceAudio == streamArray[i]->Type() && 
+            streamArray[i]->BoundStream() )
+            {
+            SVPDEBUG2( "CSVPController::CheckStreamsL round: %d start", i )
+            
+            CMceAudioStream* stream = static_cast<CMceAudioStream*>( streamArray[i] );
+            
+            TBool dtmfMode = EFalse;
+            if ( SVPAudioUtility::IsDownlinkStream( *stream ) )
+                {
+                dtmfMode = SVPAudioUtility::SetPriorityCodecValuesL( *stream,
+                    static_cast<CMceAudioStream&>( stream->BoundStreamL() ) );
+                }
+            else
+                {
+                dtmfMode = SVPAudioUtility::SetPriorityCodecValuesL(
+                    static_cast<CMceAudioStream&>( stream->BoundStreamL() ),
+                        *stream );
+                }
+            
+            iSVPUtility->SetDtmfMode( dtmfMode );
+            
+            SVPDEBUG2( "CSVPController::CheckStreamsL round: %d done", i )
+            }
+        }
+    
+    SVPDEBUG1( "CSVPController::CheckStreamsL Out" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPController::GetCallIdFromUserHeadersL
+// Extract call id from user headers
+// -----------------------------------------------------------------------------
+//
+TBool CSVPController::GetCallIdFromUserHeadersL(
+    const CDesC8Array& aUserHeaders,
+    TDes8& aCallId )
+    {
+    // All variables is used for parser.
+    TInt tmpMark1 = 0;
+    TInt tmpMark2 = 0;
+    
+    TBool found = EFalse;
+
+    // Find replaces header descriptor from userheaders array.
+    for ( TInt m = 0; &aUserHeaders && m < aUserHeaders.Count() && !found; m++ )
+        {
+        TPtrC8 tmpHeader = aUserHeaders[m];
+        if ( KErrNotFound != tmpHeader.FindF( KSVPReplacesColonTxt ) )
+            {
+            SVPDEBUG1("  CSVPController::\
+            GetCallIdFromUserHeadersL: Replaces: found:");
+
+            // variables used for parse tags from replaces header.
+            tmpMark1 = tmpHeader.Locate( KSVPColonMark );
+            tmpMark2 = tmpHeader.Locate( KSVPSemiColonMark );
+            if ( KErrNotFound == tmpMark1 ||
+                 KErrNotFound == tmpMark2 )
+                {
+                SVPDEBUG3("CSVPController::GetCallIdFromUserHeadersL leave \
+                      tmpMark1: %d, tmpMark2: %d", tmpMark1, tmpMark2 )
+                User::Leave( KErrArgument );
+                }
+
+            // Call id is between tmpMark1 and tmpMark2 and there is a space
+            // between Replaces: -text and callid
+            if ( ( tmpHeader.Mid( tmpMark1+2, tmpMark2 - tmpMark1 - 2 ).Length() < KSVPTempStringlength ) )
+                {
+                aCallId.Copy( 
+                    tmpHeader.Mid( tmpMark1+2, tmpMark2 - tmpMark1 - 2 ) );
+
+                found = ETrue;                
+                }
+            else
+                {
+                SVPDEBUG1("  CSVPController::\
+                GetCallIdFromUserHeadersL: Replaces: Too long, Leave");
+                User::Leave( KErrArgument );
+                }
+            }
+        }
+    
+    SVPDEBUG2( "CSVPController::GetCallIdFromUserHeadersL return %d", found )
+    return found;
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPController::IsTransferTargetCaseL
+// -----------------------------------------------------------------------------
+//
+void CSVPController::IsTransferTargetCaseL( CDesC8Array* aHeaders )
+    {
+    SVPDEBUG1( "CSVPController::IsTransferTargetCaseL In" )
+    
+    iHoldCallIndex = KErrNotFound;
+    TBool found = EFalse;
+    
+    if ( aHeaders && aHeaders->Count() )
+        {
+        // Variable to contain callID from replaces header.
+        TBuf8< KSVPTempStringlength > repCallId( KNullDesC8 );
+
+        // This is transfer session if Replaces: text is found from userheader
+        if ( GetCallIdFromUserHeadersL( *aHeaders, repCallId ) )
+            {
+            SVPDEBUG1( "  CSVPController::IsTransferTargetCaseL: \
+                (attended) Transfer target case" )
+            
+            if ( repCallId.Length() != 0 )
+                {
+                // Find from SVP session array a session including same CallId
+                // that parsed from replace header.
+                for ( TInt v = 0; v < iSessionArray.Count() && !found; v++ )
+                    {
+                    SVPDEBUG2( "  CSVPController::IsTransferTargetCaseL v=%d", v )
+                    
+                    TBuf8< KSVPTempStringlength > holdCallId( KNullDesC8 );     
+                    TDesC8* callid2 = iSessionArray[v]->CallId();
+                    
+                    if ( callid2 )
+                        {
+                        TInt index = callid2->Find( KSVPCallId_replaces );
+                        holdCallId.Append( 
+                        callid2->Mid( index + KSVPCallId_replaces().Length() ) );
+
+                        SVPDEBUG2( "CSVPController::IsTransferTargetCaseL: SesState: %d",
+                                     iSessionArray[v]->State() )
+                        
+                        if ( repCallId == holdCallId && 
+                             MCCPCallObserver::ECCPStateDisconnecting != 
+                                iSessionArray[v]->State() )
+                            {
+                            iHoldCallIndex = v;
+                            }
+                        }
+                    }
+                
+                if ( KErrNotFound == iHoldCallIndex )
+                    {
+                    SVPDEBUG1("CSVPController::IsTransferTargetCaseL: \
+                        sessions or CallIds does not match, leave !!!" ) 
+                    User::Leave( KErrNotSupported );
+                    }
+                }
+            else
+                {
+                SVPDEBUG1("CSVPController::IsTransferTargetCaseL: \
+                    Transfer session but CallId wasn't found, leave !!!" )
+                User::Leave( KErrNotSupported );
+                }
+            }
+        else
+            {
+		    TSupplementaryServicesEvent restrictEvent = 
+		    	iSuppServices->CheckRestrictionsL( *aHeaders );
+
+			if ( ESVPSSDoNotDisturb == restrictEvent )
+				{
+				User::Leave( KSVPErrDnDRejection );
+				}
+			if ( ESVPSSAnonymousBarring == restrictEvent )
+				{
+				User::Leave( KSVPErrAnonymousCallRejection );
+				}
+            SVPDEBUG1("  CSVPController::IsTransferTargetCaseL: \
+                Normal incoming case");
+            }
+        }
+
+    SVPDEBUG2( "CSVPController::IsTransferTargetCaseL Out iHoldCallIndex: %d",
+                iHoldCallIndex )
+    }
+
+// --------------------------------------------------------------------------
+// CSVPController::IsPreconditionRequired
+// Check if Require header contains precondition and that Supported header
+// includes option tag 100rel, providing support for PRACK's
+// --------------------------------------------------------------------------
+TBool CSVPController::IsPreconditionRequired( CDesC8Array& aHeaders )
+    {
+    SVPDEBUG1( "CSVPController::IsPreconditionRequired In" )
+        
+    TInt count = aHeaders.MdcaCount();
+    TBool require = EFalse;
+    TBool supported = EFalse;
+    while ( count-- )  
+        {
+        TPtrC8 tmpHeader = aHeaders.MdcaPoint( count );
+        if ( KErrNotFound != tmpHeader.Find( KSVPRequire ) && !require )
+            {
+            // "Require:" found
+            SVPDEBUG1( "CSVPController::IsPreconditionRequired 'Require-header' found" )
+            
+            if ( tmpHeader.FindF( KSVPPrecondition ) )
+                {
+                // "precondition" found in Require header field
+                SVPDEBUG1( "CSVPController::IsPreconditionRequired 'precondition' found" )
+                require = ETrue;
+                }
+            }
+        else if ( KErrNotFound != tmpHeader.Find( KSVPSupported ) && !supported )
+            {
+            // "Supported:" found
+            SVPDEBUG1( "CSVPController::IsPreconditionRequired 'Supported-header' found" )
+            
+            if ( tmpHeader.FindF( KSVP100rel ) )
+                {
+                // "100rel" found in Supported header field
+                SVPDEBUG1( "CSVPController::IsPreconditionRequired '100rel' found" )
+                supported = ETrue;
+                }
+            }
+        }
+    if ( require && supported )
+        {
+        SVPDEBUG1( "CSVPController::IsPreconditionRequired return ETrue" )
+        return ETrue;
+        }        
+    SVPDEBUG1( "CSVPController::IsPreconditionRequired return EFalse" )
+    return EFalse;
+    }
+	
+// ---------------------------------------------------------------------------
+// CSVPController::CheckHeadersData
+// Check and store data (FromHeader, ToHeader, CallId) from the headers
+// to the SessionBase.
+// ---------------------------------------------------------------------------
+//    
+void CSVPController::CheckHeadersData( CSVPSessionBase* aSVPSession, 
+                            TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::CheckHeadersData In" )
+    
+    TRAPD( stringErr, SIPStrings::OpenL() );
+
+    if ( KErrNone == stringErr )
+        {
+        // get headers
+        CDesC8Array* headers = aContainer->GetHeaders();
+	    RStringF fromHdr = SIPStrings::StringF(SipStrConsts::EFromHeader);
+	    RStringF fromCompHdr = SIPStrings::StringF(SipStrConsts::EFromHeaderCompact);
+
+	    RStringF toHdr = SIPStrings::StringF(SipStrConsts::EToHeader);
+	    RStringF toCompHdr = SIPStrings::StringF(SipStrConsts::EToHeaderCompact);
+
+	    RStringF callidHdr = SIPStrings::StringF(SipStrConsts::ECallIDHeader);
+	    RStringF callidCompHdr = SIPStrings::StringF(SipStrConsts::ECallIDHeaderCompact);
+	    
+	    RStringF cSeqHdr = SIPStrings::StringF(SipStrConsts::ECSeqHeader);
+
+        if ( headers )
+            {
+            TBool fromFound( EFalse );
+            TBool toFound( EFalse );
+            TBool callIdFound( EFalse );
+            TBool cSeqFound( EFalse );
+
+            for( TInt i = 0;i < headers->MdcaCount();i++ )
+                {
+                TPtrC8 tmpHeader = headers->MdcaPoint( i );
+                TInt colonMark = tmpHeader.FindF( KSVPCln );
+                
+                SVPDEBUG2( "CSVPController::CheckHeadersData colonMark=%d", colonMark )
+                
+                TInt fromHdrPos = tmpHeader.FindF( fromHdr.DesC() );
+                TInt fromCompHdrPos = tmpHeader.FindF( fromCompHdr.DesC() );
+
+                TInt toHdrPos = tmpHeader.FindF( toHdr.DesC() );
+                TInt toCompHdrPos = tmpHeader.FindF( toCompHdr.DesC() );
+
+                TInt callidHdrPos = tmpHeader.FindF( callidHdr.DesC() );
+                TInt callidCompHdrPos = tmpHeader.FindF( callidCompHdr.DesC() );
+                
+                TInt cSeqHdrPos = tmpHeader.FindF( cSeqHdr.DesC() );
+
+                // Header name is separeted by colonmark from header body.
+                // There might be space between name and colonmark.
+
+                if ( !fromFound &&
+                     ( (KErrNotFound < fromHdrPos && fromHdrPos < colonMark) ||
+                       (KErrNotFound < fromCompHdrPos && fromCompHdrPos < colonMark ) ) )
+                    {
+                    fromFound = ETrue;
+                    aSVPSession->SetFromHeader( headers->MdcaPoint( i ) );
+                    }
+                else if ( !toFound &&
+                        ( (KErrNotFound < toHdrPos && toHdrPos < colonMark) ||
+                          (KErrNotFound < toCompHdrPos && toCompHdrPos < colonMark ) ) )
+                    {
+                    toFound = ETrue;
+                    aSVPSession->SetToHeader( headers->MdcaPoint( i ) );
+                    }
+                else if ( !callIdFound &&
+                        ( (KErrNotFound < callidHdrPos && callidHdrPos < colonMark) ||
+                          (KErrNotFound < callidCompHdrPos && callidCompHdrPos < colonMark ) ) )
+                    {
+                    callIdFound = ETrue;
+                    aSVPSession->SetCallId( headers->MdcaPoint( i ) );
+                    }
+                else if ( !cSeqFound && 
+                          KErrNotFound < cSeqHdrPos && cSeqHdrPos < colonMark )
+                    {
+                    cSeqFound = ETrue;
+                    aSVPSession->SetCSeqHeader( headers->MdcaPoint( i ) );
+                    }
+                }
+            }
+        
+        SIPStrings::Close();
+        delete headers;
+        headers = NULL;
+        }
+    else
+        {
+        SVPDEBUG2( "CSVPController::CheckHeadersData stringErr=%d", stringErr )
+        }
+    
+    SVPDEBUG1( "CSVPController::CheckHeadersData Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::CheckContactData
+// Check and store contact data from the headers to the MoSession
+// ---------------------------------------------------------------------------
+//    
+TInt CSVPController::CheckContactData( CSVPSessionBase* aSVPSession, 
+                            TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::CheckContactData In" )
+    
+    TInt count( 0 );
+    TRAPD( stringErr, SIPStrings::OpenL() );
+
+    if ( KErrNone == stringErr && aSVPSession->IsMobileOriginated() )
+        {
+        CDesC8Array* headers = aContainer->GetHeaders();
+
+        if ( headers )
+            {
+    	    RStringF contactHdr = SIPStrings::StringF(SipStrConsts::EContactHeader);
+    	    RStringF contactHdrComp = SIPStrings::StringF(SipStrConsts::EContactHeaderCompact);
+
+            CSVPMoSession* moSession = static_cast< CSVPMoSession* >( aSVPSession );
+            moSession->ResetForwardAddressChoices();
+
+            TInt ret( 0 );
+            for( TInt i( 0 ); i < headers->MdcaCount(); i++ )
+                {
+                TPtrC8 tmpHeader = headers->MdcaPoint( i );
+                TInt colonMark = tmpHeader.FindF( KSVPCln );
+                TPtrC8 left = tmpHeader.Left( colonMark ); // string until to first colon mark
+
+                if ( left.CompareF( contactHdr.DesC() ) == KErrNone ||
+                     left.CompareF( contactHdrComp.DesC() ) == KErrNone ) 
+                    {
+                    SVPDEBUG1( "CSVPController::CheckContactData - Contact header found" )
+
+                    // Get the remaining part of the contact header string and
+                    // send it to mo session for parsing 
+                    TPtrC8 right = tmpHeader.Right( 
+                        tmpHeader.Length() - left.Length() - 1 );
+
+                    TRAPD( addErr, ret = moSession->AddForwardAddressL( right ) );
+                    if (KErrNone == addErr)
+                        {
+                        count = count + ret;
+                        }
+                    else
+                        {
+                        SVPDEBUG2( "CSVPController::CheckContactData: addErr = %d", addErr )
+                        }
+                    }
+                }
+            }
+        else
+            {
+            SVPDEBUG1( "CSVPController::CheckContactData No headers" )
+            }
+
+        SIPStrings::Close();
+        delete headers;
+        headers = NULL;
+        }
+    else
+        {
+        SVPDEBUG2( "CSVPController::CheckContactData stringErr=%d", stringErr )
+        }
+    
+    SVPDEBUG2( "CSVPController::CheckContactData Out return=%d", count )
+    return count;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::IncomingUpdate
+// ---------------------------------------------------------------------------
+//			
+void CSVPController::IncomingUpdate(
+				CMceSession& aOrigSession, 
+				CMceInSession* aUpdatedSession,
+				TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::IncomingUpdate In" )
+    
+    iContainer = *aContainer;
+    const TInt sessionIndex = FindSVPSession( aOrigSession );
+    
+    if ( KErrNotFound != sessionIndex )
+        {
+        SVPDEBUG1( "CSVPController::IncomingUpdate - Session found" )
+        
+        // handle RE-INVITE without SDP
+        if ( !aUpdatedSession->Streams().Count() )
+            {
+            SVPDEBUG1( "CSVPController::IncomingUpdate No streams present" )
+            
+            // this call sets iEmptyReInvite flag to ETrue for session, 
+            // flag prevents "ghots session" to be seen on UI 
+            // when empty Re-Invite is received
+            iSessionArray[ sessionIndex ]->SetEmptyReInvite();
+                               
+            
+            #ifdef _DEBUG
+            
+            TRAPD( noSdpErr, IncomingUpdateNoSdpHandlerL( sessionIndex,
+                                                          aUpdatedSession ) );
+            
+            SVPDEBUG2( "CSVPController::IncomingUpdate trapped: %d", noSdpErr )
+            
+            #else   // _UREL
+            
+            TRAP_IGNORE( IncomingUpdateNoSdpHandlerL(
+                sessionIndex, aUpdatedSession ) )
+            
+            #endif  // _DEBUG
+            }
+        
+        else
+            {
+            SVPDEBUG1( "CSVPController::IncomingUpdate - Normal case" )
+            IncomingNormalUpdate( sessionIndex,
+                    aOrigSession, aUpdatedSession );
+            }
+        
+        SVPDEBUG1( "CSVPController::IncomingUpdate - Handled" )
+        }
+    else if ( iEmergencySession && 
+              aUpdatedSession && 
+              aUpdatedSession->Streams().Count() )
+        {
+        // Handle emergency hold
+        TRAPD( error, iEmergencySession->IncomingRequestL(
+                aUpdatedSession, iContainer ) );
+        
+        if ( error )
+            {
+            SVPDEBUG2( "CSVPController::IncomingUpdate, emergency error=%d",
+                    error )
+            }
+        }
+    
+    SVPDEBUG1( "CSVPController::IncomingUpdate Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::IncomingNormalUpdate
+// ---------------------------------------------------------------------------
+//
+void CSVPController::IncomingNormalUpdate( TInt aSessionIndex,
+                                           CMceSession& aOrigSession,
+                                           CMceInSession* aUpdatedSession )
+    {
+    SVPDEBUG1( "CSVPController::IncomingNormalUpdate In" )
+    
+    TInt err = iSessionArray[ aSessionIndex ]->IncomingRequest(
+        *aUpdatedSession );
+    
+    if ( KErrSVPHoldNotHoldRequest == err )
+        {
+        SVPDEBUG1( "CSVPController::IncomingNormalUpdate - Not Hold/Resume" )
+        
+        if ( iSessionArray[ aSessionIndex ]->HasHoldController() &&
+             KSVPHoldConnectedStateIndex != iSessionArray[ aSessionIndex ]->
+                 HoldController().HoldState() )
+            {
+            // Hold is active; must update MCE streams state 
+            // correspondingly
+            TRAP( err, iSessionArray[ aSessionIndex ]->HoldController().
+                            RefreshHoldStateL() );
+            SVPDEBUG2( "CSVPController::IncomingNormalUpdate - Err: %d", err )
+            }
+        
+        TRAP( err, UpdateSessionL( aOrigSession, *aUpdatedSession ) );
+        
+        SVPDEBUG2( "CSVPController::IncomingNormalUpdate - Updated err: %d",
+            err )
+        }
+    else if ( iDtmfStringSending )
+        {
+        SVPDEBUG1( "CSVPController::IncomingNormalUpdate - Dtmf sending will be stopped" )
+        // send stop event to the previous character in string 
+        // Default tone char
+        TChar dtmfToneChar( '0' );
+
+        iSessionArray[ aSessionIndex ]->DtmfObserver().HandleDTMFEvent( 
+                MCCPDTMFObserver::ECCPDtmfSequenceStop, 
+                KErrNone, 
+                dtmfToneChar );
+
+        // send sequence stop event
+        iSessionArray[ aSessionIndex ]->DtmfObserver().HandleDTMFEvent( 
+             MCCPDTMFObserver::ECCPDtmfStringSendingCompleted, 
+             KErrNone, 
+             dtmfToneChar );
+
+        // sequence complete, clear flags
+        iDtmfStringSending = EFalse;
+        iFirstDtmfSent = EFalse;
+        
+        SVPDEBUG1( "CSVPController::IncomingNormalUpdate - Dtmf sending stopped" )
+        }
+    else
+        {
+        SVPDEBUG2( "CSVPController::IncomingNormalUpdate - IncomingRequest err: %d", err )
+        }
+    
+    iSessionArray[ aSessionIndex ]->SetUpdatedSession( aUpdatedSession );
+    
+    SVPDEBUG1( "CSVPController::IncomingNormalUpdate Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::IncomingUpdateNoSdpHandlerL
+// ---------------------------------------------------------------------------
+//
+void CSVPController::IncomingUpdateNoSdpHandlerL( TInt aSessionIndex,
+        CMceInSession* aUpdatedSession )
+    {
+    SVPDEBUG1( "CSVPController::IncomingUpdateNoSdpHandlerL In" )
+    if ( iRtpObserver )
+        {
+        iRtpObserver->ResetSessionInObserving( iSessionArray[ aSessionIndex ] );
+		}
+    // set updated session to SVP, ownership is transferred
+    // old session is obsolete
+    iSessionArray[ aSessionIndex ]->SetUpdatedSession( aUpdatedSession );
+    
+    // construct audio streams again, adding all the supported codecs
+    iSessionArray[ aSessionIndex ]->ConstructAudioStreamsL();
+    
+    // finally update the session
+    aUpdatedSession->UpdateL();
+    
+    SVPDEBUG1( "CSVPController::IncomingUpdateNoSdpHandlerL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::UpdateSessionL
+// ---------------------------------------------------------------------------
+//			
+void CSVPController::UpdateSessionL( CMceSession& aOrigSession,
+                                     CMceInSession& aUpdatedSession )
+    {
+    SVPDEBUG1( "CSVPController::UpdateSessionL In" )
+    
+    __ASSERT_ALWAYS( &aOrigSession, User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( &aUpdatedSession, User::Leave( KErrArgument ) );
+    
+    CRCSEProfileRegistry* reg = CRCSEProfileRegistry::NewLC();
+    RPointerArray< CRCSEProfileEntry > voipProfiles;
+    CleanupResetAndDestroy< RPointerArray< CRCSEProfileEntry > >::PushL(
+        voipProfiles );
+    
+    reg->FindBySIPProfileIdL( aOrigSession.Profile(), voipProfiles );
+    
+    TInt keepAliveTime = 0;
+    TInt index = FindSVPSession( aOrigSession );
+    if ( KErrNotFound != index )
+        {
+        keepAliveTime = iSessionArray[ index ]->GetKeepAliveTime();
+        __ASSERT_ALWAYS( iRtpObserver, User::Leave( KErrTotalLossOfPrecision ) );
+        iRtpObserver->ResetSessionInObserving( iSessionArray[ index ] );
+        }
+
+    // flag prevents wrong handling after SessionStateChanged -callback
+    iSessionUpdateOngoing = ETrue;
+
+    // sets MMF priorities and sets codec specific settings
+    CheckStreamsL( *voipProfiles[ 0 ], aUpdatedSession, keepAliveTime,
+                   iSessionUpdateOngoing );
+    CleanupStack::PopAndDestroy( 2, reg );
+    
+    SVPDEBUG1( "CSVPController::UpdateSessionL - Checked" )
+    
+    aUpdatedSession.UpdateL();
+    SVPDEBUG1( "CSVPController::UpdateSessionL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::IncomingRefer
+// ---------------------------------------------------------------------------
+//			
+void CSVPController::IncomingRefer( CMceInRefer* aRefer,
+        const TDesC8& aReferTo, TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::IncomingRefer In" )
+    
+    // IncomingReferHandlerL is used to handle possible leave 
+    SVPDEBUG1( "CSVPController::IncomingRefer IncomingReferHandlerL" )
+    TRAPD( err, IncomingReferHandlerL( aRefer, aReferTo, aContainer ) );
+    
+    if ( err )
+        {
+        SVPDEBUG2("CSVPController::IncomingRefer: err: %d", err )
+        if ( err == KSVPErrTransferInProgress )
+            {
+            SVPDEBUG1( "CSVPController::IncomingRefer - transfer in progress \
+                -> ignore" )
+            }
+        else
+            {
+            // TRAP is used because of RejectL might leave.
+            SVPDEBUG1( "CSVPController::IncomingRefer -> reject" )
+            TRAP( err, aRefer->RejectL() );
+        
+            if ( err )
+                {
+                SVPDEBUG2("CSspController::IncomingRefer: RejectL err: \
+                    %d", err )
+                }
+            }
+        }
+    
+    SVPDEBUG1( "CSVPController::IncomingRefer Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::IncomingReferHandlerL
+// ---------------------------------------------------------------------------
+//			
+void CSVPController::IncomingReferHandlerL( CMceInRefer* aRefer,
+        const TDesC8& aReferTo, TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::IncomingReferHandlerL In" )
+    
+    __ASSERT_ALWAYS( aRefer, User::Leave( KErrArgument ) );
+    
+    iContainer = *aContainer;
+    TInt sessionIndex = FindSVPSession( *aRefer->AssociatedSession() );
+    
+    if ( KErrNotFound != sessionIndex )    
+        {
+        SVPDEBUG2( "CSVPController::InRefHL: AssoSes OK,ind=%d",
+                sessionIndex )
+        
+        iSessionArray[ sessionIndex ]->IncomingReferL( 
+                aRefer, aReferTo, aContainer );
+        
+        if ( iSessionArray[ sessionIndex ]->IsAttended() )
+            {
+            SVPDEBUG1( "CSVPController::InRefHL: - Attended case" )
+            }
+        else
+            {
+            SVPDEBUG1( "CSVPController::InRefHL: - Unattended case" )
+            // Create a new session
+            CreateNewTransferSessionL( sessionIndex, EFalse );
+            }
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPController::InRefHL: Session not Found!!" )
+        User::Leave( KErrNotFound );
+        }
+    
+    SVPDEBUG1( "CSVPController::IncomingReferHandlerL Out" ) 
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::CreateNewTransferSessionL
+// ---------------------------------------------------------------------------
+//
+void CSVPController::CreateNewTransferSessionL( TInt aSessionIndex,
+        TBool aAttended )
+    {
+    SVPDEBUG1( "CSVPController::CreateNewTransferSessionL In" )
+
+    iIncomingReferCallIndex = aSessionIndex;
+    // Create a new session
+    // fetch SIP profile ID from VoIP profiles
+    RPointerArray< CRCSEProfileEntry > entryArray;
+    CleanupResetAndDestroy<
+        RPointerArray<CRCSEProfileEntry> >::PushL( entryArray ); //CS: 1
+    
+    CRCSEProfileRegistry* reg = CRCSEProfileRegistry::NewLC(); //CS:2
+
+    const CCCPCallParameters& callParams = iSessionArray[ aSessionIndex ]->Parameters();
+    SVPDEBUG2(" CSVPController::CNTSL: iServiceId = %d", callParams.ServiceId() )
+
+    // Get VoIP profile by service id
+    reg->FindByServiceIdL( callParams.ServiceId(), entryArray );
+    // Take first entry from array
+    CRCSEProfileEntry* entry = NULL;
+    if (entryArray.Count() > 0)
+        {
+        entry = entryArray[0];
+        }
+    else
+        {
+        User::Leave(KErrNotFound);
+        }
+    // array for provisioned data
+    CDesC8ArrayFlat* userAgentHeaders = new( ELeave )CDesC8ArrayFlat( 4 );
+    CleanupStack::PushL( userAgentHeaders );
+    
+    // variable for storing security status
+    TUint32 securityStatus = 0;
+    
+    // set provisioning data
+    SVPDEBUG1( "CSVPController::CNTSL: Set provisioning data..." )
+    TRAP_IGNORE( iSVPUtility->SetProvisioningDataL( 
+                                *entry, 
+                                *userAgentHeaders,
+                                securityStatus,
+                                iTerminalType,
+                                iWlanMacAddress ) );
+    
+    // only one sip profile per voip profile
+    TInt sipProfileId = entry->iIds[ 0 ].iProfileId; 
+    SVPDEBUG2( "CSVPController::CNTSL: sipProfileId=%d", sipProfileId )
+    
+    if ( KSVPStatusNonSecure != securityStatus )
+        {
+        // If preferred sec is 1 or 2, we check also secure mechanism of sip profile.
+        // create SIP and ProfileRegistry for URI handling
+        CSIP* sip = CSIP::NewL( KSVPUid, *this );
+        CleanupStack::PushL( sip );
+        SVPDEBUG1( "CSVPController::CNTSL: sip CREATED" )
+        
+        CSIPProfileRegistry* sipProfileRegistry = 
+            CSIPProfileRegistry::NewL( *sip, *this );
+        CleanupStack::PushL( sipProfileRegistry );
+
+        SVPDEBUG1( "CSVPController::CNTSL: sipProfileRegistry CREATED" )
+        
+        // retrieve SIP profile by using sip profile id
+        CSIPProfile* profile = sipProfileRegistry->ProfileL( sipProfileId );
+        CleanupStack::PushL( profile );
+
+        // set secure status to 0 if no security mechanism found from SIP profile
+        iSVPUtility->ResolveSecurityMechanismL( *profile, securityStatus );
+
+        CleanupStack::PopAndDestroy( 3, sip );  // profile, sipProfileRegistry, sip
+        }
+    
+    // set transfer data
+    SVPDEBUG1( "CSVPController::CNTSL: Set transfer data..." )
+    iSessionArray[ aSessionIndex ]->SetTransferDataL(
+            userAgentHeaders, securityStatus );
+    
+    SVPDEBUG3( "CSVPController::CNTSL: Header count:%d, sec status:%d",
+            userAgentHeaders->Count(), securityStatus )
+    
+    CSVPMoSession* moSessionTemp = NULL;
+    
+    // In attended and unattended transfer case recipient is solved here
+    SVPDEBUG1( "CSVPController::CNTSL: (Un)Attended, create new mo session" )
+    const TDesC& referTo = iSessionArray[ aSessionIndex ]->TransferTarget();
+    // "convert" recpient to 8-bit format
+    HBufC8* recipient = HBufC8::NewLC( referTo.Length() );
+    recipient->Des().Copy( referTo );
+    
+    moSessionTemp = CSVPMoSession::NewL( *iMceManager,
+                                         *recipient,
+                                         *entry, 
+                                         callParams,
+                                         iContainer,
+                                         *this,
+                                         *iSVPUtility,
+                                         *iRtpObserver,
+                                         securityStatus,
+                                         userAgentHeaders );
+    
+    CleanupStack::PopAndDestroy( recipient );
+    CleanupStack::PushL( moSessionTemp );
+    
+    // dtmf and rtp observervers are set
+    moSessionTemp->SetDtmfObserver( iSessionArray[ aSessionIndex ]->DtmfObserver() );
+    iRtpObserver->AddSessionForObservingL( moSessionTemp );
+    
+    // created SVP session is appended to session array
+    iSessionArray.AppendL( moSessionTemp );
+    CleanupStack::Pop( moSessionTemp );
+    CleanupStack::Pop( userAgentHeaders );
+    CleanupStack::PopAndDestroy( 2, &entryArray );
+    
+    // set CCP session observer to SVP session
+    SVPDEBUG1( "CSVPController::CNTSL: AddObserverL" )
+    moSessionTemp->AddObserverL( iSessionArray[ aSessionIndex ]->GetCCPSessionObserver() );
+    
+    //set CCP supplementary services events observer to SVP session
+    SVPDEBUG1( "CSVPController::CNTSL: AddSsObserverL" )
+    moSessionTemp->SetSsObserver( iSessionArray[ aSessionIndex ]->GetSsObserver() );
+        
+    SVPDEBUG1( "CSVPController::CNTSL: callcreated, send to CCP" )
+    ExecCbCallCreated( moSessionTemp, iSessionArray[ aSessionIndex ], aAttended );
+    
+    SVPDEBUG1( "CSVPController::CreateNewTransferSessionL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::HandleForwardEvent
+// ---------------------------------------------------------------------------
+// 
+void CSVPController::HandleCallForward( TInt aStatusCode,
+        TInt aSessionIndex, TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::HandleForwardEvent In" )
+    SVPDEBUG2( "CSVPController::HandleForwardEvent aStatusCode=%d", aStatusCode )
+    
+    if ( !iSessionArray[ aSessionIndex ]->IsMobileOriginated() )
+        {
+        iSessionArray[ aSessionIndex ]->
+            GetCCPSessionObserver().ErrorOccurred( ECCPErrorNotReached, 
+                                              iSessionArray[ aSessionIndex ] );
+        }
+    else
+        {
+        CSVPMoSession* session = static_cast< CSVPMoSession* >(
+                iSessionArray[ aSessionIndex ] );
+        
+        switch ( aStatusCode )
+            {
+            case KSVPMultipleChoicesVal:    // 300
+            case KSVPMovedPermanentlyVal:   // 301
+                {
+                // Get contact headers and notify
+                TInt count = CheckContactData( session, aContainer );
+
+                if ( 0 < count )
+                    {
+                    session->NotifyForwardEvent( aStatusCode );
+                    }
+                else
+                    {
+                    session->GetCCPSessionObserver().ErrorOccurred( 
+                                                        ECCPErrorNotReached,
+                                                        session );
+                    }
+                break;
+                }
+            case KSVPMovedTemporarilyVal:   // 302
+                {
+                // Just notify, this call forward is handled automatically by mce
+                session->NotifyForwardEvent( aStatusCode );
+                session->GetCCPSessionObserver().
+                    CallStateChanged( MCCPCallObserver::ECCPStateForwarding,
+                                      session );
+                break;
+                }
+            default:
+                {
+                SVPDEBUG1( "CSVPController::HandleForwardEvent: unknown code" )
+                session->GetCCPSessionObserver().ErrorOccurred( 
+                                                    ECCPErrorNotReached,
+                                                    session );
+                }
+            }
+        }
+    
+    SVPDEBUG1( "CSVPController::HandleForwardEvent Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::StreamStateChanged
+// ---------------------------------------------------------------------------
+//			
+void CSVPController::StreamStateChanged( CMceMediaStream& aStream )
+    {
+    SVPDEBUG1("CSVPController::StreamStateChanged In" )
+    
+    if ( &aStream )
+        {
+        if ( !iEmergencySession )
+            {
+            const TInt index = FindSVPSession( *aStream.Session() );
+            if ( KErrNotFound != index )
+                {
+                iSessionArray[ index ]->HandleStreamStateChange( aStream );
+                }
+                
+            SVPDEBUG2( "CSVPController::StreamStateChanged index: %d", index )
+            }
+        else // Emergency session
+            {
+            iEmergencySession->StreamStateChanged( aStream );
+            }
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPController::StreamStateChanged, faulty arguments" )
+        }
+    
+    SVPDEBUG1("CSVPController::StreamStateChanged Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::StreamStateChanged
+// ---------------------------------------------------------------------------
+//
+void CSVPController::StreamStateChanged( CMceMediaStream& aStream,
+    CMceMediaSink& aSink )
+    {
+    SVPDEBUG1( "CSVPController::StreamStateChanged SINK In" )
+    
+    if ( &aStream && &aSink )
+        {
+        SVPDEBUG2( "CSVPController::StreamStateChanged SINK Stream State: %d", aStream.State() )
+        SVPDEBUG2( "CSVPController::StreamStateChanged SINK Sink IsEnabled: %d", aSink.IsEnabled() )
+        
+        if ( !iEmergencySession )
+            {
+            const TInt index = FindSVPSession( *aStream.Session() );
+            
+            if ( KErrNotFound != index )
+                {
+                iSessionArray[ index ]->HandleStreamStateChange( aStream, aSink );
+                }
+            
+            SVPDEBUG2( "CSVPController::StreamStateChanged SINK index: %d", index )
+            }
+        else // Emergency session
+            {
+            iEmergencySession->StreamStateChanged( aStream );
+            }
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPController::StreamStateChanged SINK, faulty arguments" )
+        }
+    
+    SVPDEBUG1( "CSVPController::StreamStateChanged SINK Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::StreamStateChanged
+// ---------------------------------------------------------------------------
+//
+void CSVPController::StreamStateChanged( CMceMediaStream& aStream,
+    CMceMediaSource& aSource )
+    {
+    SVPDEBUG1( "CSVPController::StreamStateChanged SOURCE In" )
+    
+    if ( &aStream && &aSource )
+        {
+        SVPDEBUG2( "CSVPController::StreamStateChanged SOURCE Stream State: %d", aStream.State() )
+        SVPDEBUG2( "CSVPController::StreamStateChanged SOURCE Source IsEnabled: %d", aSource.IsEnabled() )
+
+        if ( !iEmergencySession )
+            {
+            const TInt index = FindSVPSession( *aStream.Session() );           
+            if ( KErrNotFound != index )
+                {
+                iSessionArray[ index ]->HandleStreamStateChange( aStream, aSource );
+                }
+            
+            SVPDEBUG2( "CSVPController::StreamStateChanged SOURCE index: %d", index )
+            }
+        else // Emergency session
+            {
+            iEmergencySession->StreamStateChanged( aStream );
+            }        
+        
+        }
+    
+    SVPDEBUG1( "CSVPController::StreamStateChanged SOURCE Out" )
+    }
+
+
+// from ConvergedCallProvider
+// ---------------------------------------------------------------------------
+// CSVPController::NewEmergencyCallL
+// ---------------------------------------------------------------------------
+//
+MCCPEmergencyCall* CSVPController::NewEmergencyCallL( 
+    const TUint32 /*aServiceId*/,
+    const TDesC&  aAddress, 
+    const MCCPCallObserver& aObserver )                                            
+    {
+    SVPDEBUG1( "CSVPController::NewEmergencyCallL In" )
+    
+    // Retrieve available VoIP and IAP IDs
+    if ( 0 == iEmergencyProfileIds.Count() && 0 == iEmergencyIapIds.Count() )
+        {
+        CRCSEProfileRegistry* reg = CRCSEProfileRegistry::NewLC(); // CS:1
+        CSIP* sip = CSIP::NewLC( KSVPUid, *this ); // CS:2
+        CSIPProfileRegistry* sipProfileRegistry = CSIPProfileRegistry::NewLC( 
+            *sip, *this ); // CS:3
+        
+        // Get all VoIP profile IDs into an array
+        RArray< TUint32 > voipProfileIds;
+        CleanupClosePushL( voipProfileIds );    //CS: 4
+        reg->GetAllIdsL( voipProfileIds );
+    
+        // Sort the VoIP profile array so that registered profiles are first
+        for ( TInt i = 0; i < voipProfileIds.Count(); i++ )
+            {
+            TBool registered( EFalse );
+            CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC(); // CS:5
+            reg->FindL( voipProfileIds[i], *entry );
+            // There is only one (or zero) SIP profile per VoIP profile.
+            // If profileId is not found,
+            // CSVPEmergencySession::ConstructL will handle the error
+            if ( 0 < entry->iIds.Count() )
+                {
+                SVPDEBUG2( "CSVPController::NewEmergencyCallL, SIP Id count:%d",
+                        entry->iIds.Count() )
+                CSIPProfile* sipProfile = sipProfileRegistry->ProfileL( 
+                    entry->iIds[0].iProfileId );
+                sipProfile->GetParameter( KSIPProfileRegistered, registered );
+                delete sipProfile;
+                }
+            CleanupStack::PopAndDestroy( entry ); // CS:4
+            if ( registered )
+                {
+                // Move registered VoIP profile IDs to the front
+                iEmergencyProfileIds.Insert( voipProfileIds[i], 0 );
+                }
+            else
+                {
+                iEmergencyProfileIds.Append( voipProfileIds[i] );
+                }
+            }
+        
+        CleanupStack::PopAndDestroy( 4, reg ); 
+        // CS:0 voipProfileIds, sipProfileRegistry, sip, reg
+        
+        // Request and wait for IAP IDs
+        CSVPEmergencyIapProvider* iapProvider = 
+            CSVPEmergencyIapProvider::NewLC( 
+            CActive::EPriorityStandard ); // CS:1
+        iapProvider->RequestIapIds( iEmergencyIapIds );
+        CleanupStack::PopAndDestroy( iapProvider ); // CS:0
+        }
+    
+    SVPDEBUG2("CSVPController::NewEmergencyCallL, VoIP count:%d", 
+            iEmergencyProfileIds.Count() )
+    SVPDEBUG2("CSVPController::NewEmergencyCallL, IAP count:%d", 
+            iEmergencyIapIds.Count() )
+    
+    // Define last try
+    TBool isLastId( EFalse );
+    
+    if ( ( 0 == iEmergencyProfileIds.Count() && 
+           1 == iEmergencyIapIds.Count() ) ||
+         ( 1 == iEmergencyProfileIds.Count() && 
+           0 == iEmergencyIapIds.Count() )
+       )
+        {
+        isLastId = ETrue;
+        SVPDEBUG1("CSVPController::NewEmergencyCallL, last ID");
+        }
+    
+    // Create session
+    CSVPEmergencySession* emergencySession = NULL;
+    
+    if ( iEmergencyProfileIds.Count() )
+        {
+        // Create emergency session with VoIP ID
+        TRAPD( err, emergencySession = CSVPEmergencySession::NewL( 
+            *iMceManager,
+            iEmergencyProfileIds[0], 
+            aAddress,
+            aObserver,
+            *iSVPUtility, 
+            isLastId ) )
+    
+        if ( err )
+            {
+            // Create dummy session for session release
+            emergencySession = CSVPEmergencySession::NewL( 
+                *iMceManager,
+                iEmergencyProfileIds[0], 
+                aAddress,
+                aObserver,
+                *iSVPUtility, 
+                isLastId, 
+                ETrue );   
+            }
+        
+        // Update profile array
+        iEmergencyProfileIds.Remove( 0 );
+        }
+    else if ( iEmergencyIapIds.Count() )
+        {
+        // Create emergency session with IAP ID
+        TRAPD( err, emergencySession = CSVPEmergencySession::NewL( 
+            *iMceManager,
+            aAddress,
+            aObserver,
+            *iSVPUtility,
+            iEmergencyIapIds[0],  
+            isLastId ) )
+    
+        if ( err )
+            {
+            // Create dummy session for session release
+            emergencySession = CSVPEmergencySession::NewL( 
+                *iMceManager,
+                aAddress,
+                aObserver,
+                *iSVPUtility, 
+                iEmergencyIapIds[0], 
+                isLastId, 
+                ETrue );   
+            }        
+        
+        // Update IAP array
+        iEmergencyIapIds.Remove( 0 );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    // save emergency session to controller
+    iEmergencySession = emergencySession;
+    
+    if ( iCCPDtmfObserver )
+            {
+            SVPDEBUG1( "CSVPController::NewEmergencyCallL setting DTMFObserver" )
+            iEmergencySession->SetDtmfObserver( *iCCPDtmfObserver );
+            }
+    
+    SVPDEBUG1( "CSVPController::NewEmergencyCallL Out" )
+    // return pointer to CCP emergency call object
+    return emergencySession;
+    }
+                        
+// ---------------------------------------------------------------------------
+// CSVPController::NewConferenceL
+// ---------------------------------------------------------------------------
+//
+MCCPConferenceCall* CSVPController::NewConferenceL( 
+        const TUint32 /* aServiceId */, 
+        const MCCPConferenceCallObserver& /*aObserver*/ )
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPController::AcceptTransfer
+// ---------------------------------------------------------------------------
+//                 
+void CSVPController::AcceptTransfer( TBool /*aAccept*/ ) 
+    {
+    SVPDEBUG1( "CSVPController::AcceptTransfer In" )
+    SVPDEBUG1( "CSVPController::AcceptTransfer Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::ForwardCallToAddressL
+// ---------------------------------------------------------------------------
+//
+TInt CSVPController::ForwardCallToAddressL( const TInt /*aIndex*/ ) 
+    {
+    return NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPController::Caps
+// ---------------------------------------------------------------------------
+//
+TUint32 CSVPController::Caps() const
+    {
+    return 0;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::DTMFProvider
+// ---------------------------------------------------------------------------
+//
+MCCPDTMFProvider* CSVPController::DTMFProviderL(
+    const MCCPDTMFObserver& aObserver )
+    {
+    SVPDEBUG1( "CSVPController::DTMFProviderL In" )
+    
+    iCCPDtmfObserver = &aObserver;
+    
+    TInt sessions = iSessionArray.Count();
+    while ( sessions )
+        {
+        sessions--;
+        iSessionArray[ sessions ]->SetDtmfObserver( aObserver );
+        
+        SVPDEBUG2( "CSVPController::DTMFProviderL sessions: %d", sessions )
+        }
+    
+    if ( iEmergencySession )
+        {
+        iEmergencySession->SetDtmfObserver( aObserver );
+        }
+    
+    SVPDEBUG1( "CSVPController::DTMFProviderL Out" )
+    return this;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPController::ExtensionProvider
+// ---------------------------------------------------------------------------
+//
+MCCPExtensionProvider* CSVPController::ExtensionProviderL( 
+    const MCCPExtensionObserver& /*aObserver*/ )
+    {
+    return NULL;
+    }
+  
+// dtmf provider
+
+// ---------------------------------------------------------------------------
+// CSVPController::CancelDtmfStringSending
+// ---------------------------------------------------------------------------
+//
+TInt CSVPController::CancelDtmfStringSending()
+    {
+    SVPDEBUG1( "CSVPController::CancelDtmfStringSending In" )
+    
+    TInt err( KErrNotSupported ); 
+    // find active session
+    
+    TInt sesCount = iSessionArray.Count();
+    CSVPSessionBase* session = NULL;
+    while ( sesCount )
+        {
+        sesCount--;
+        session = iSessionArray[ sesCount ];
+        
+        if ( SVPAudioUtility::DtmfActionCapableSession( *session ) )
+            {
+            err = session->CancelDtmfStringSending();
+            }
+        SVPDEBUG3( "CSVPController::CancelDtmfStringSending sesCount: %d, err: %d",
+                     sesCount, err )
+        session = NULL;
+        }
+    
+    if ( iEmergencySession && 
+         SVPAudioUtility::DtmfActionCapableSession( *iEmergencySession ) )
+        {
+        err = iEmergencySession->CancelDtmfStringSending();
+        }
+        
+    SVPDEBUG2("CSVPController::CancelDtmfStringSending Out return=%d", err )
+    iDtmfStringSending = EFalse;
+    iFirstDtmfSent = EFalse;
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::StartDtmfTone
+// ---------------------------------------------------------------------------
+//
+TInt CSVPController::StartDtmfTone( const TChar aTone )
+    {
+    SVPDEBUG1( "CSVPController::StartDtmfTone In" )
+    
+    TInt err( KErrNotSupported );
+    
+    // Save DTMF tone for later use in outband dtmf start/stop events
+    iDtmfTone = aTone;
+    // Send the tone to all sessions, but check mute and hold cases where session must
+    // be in 'connected' state in order to send DTMF's. Session will then
+    // discriminate between inband and outband DTMF's.
+    TInt sesCount = iSessionArray.Count();
+    CSVPSessionBase* session = NULL;
+    while ( sesCount )
+        {
+        sesCount--;
+        session = iSessionArray[ sesCount ];
+        // Checking hold and mute status
+        if ( SVPAudioUtility::DtmfActionCapableSession( *session ) &&
+                !session->IsSessionMuted()  )
+            {
+            err = session->StartDtmfTone( aTone );
+            }
+        SVPDEBUG3( "CSVPController::StartDtmfTone sesCount: %d, err: %d",
+                      sesCount, err )
+        session = NULL;
+        }
+    
+    if ( iEmergencySession && 
+         SVPAudioUtility::DtmfActionCapableSession( *iEmergencySession ) )
+        {
+        err = iEmergencySession->StartDtmfTone( aTone );
+        }
+    
+    SVPDEBUG2("CSVPController::StartDtmfTone Out return=%d", err )
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::StopDtmfTone
+// ---------------------------------------------------------------------------
+//
+TInt CSVPController::StopDtmfTone()
+    {
+    SVPDEBUG1( "CSVPController::StopDtmfTone In" )
+    
+    TInt err( KErrNotSupported );
+    
+    TInt sesCount = iSessionArray.Count();
+    CSVPSessionBase* session = NULL;
+    while ( sesCount )
+        {
+        sesCount--;
+        session = iSessionArray[ sesCount ];
+        
+        if ( SVPAudioUtility::DtmfActionCapableSession( *session ) )
+            {
+            err = session->StopDtmfTone();
+            }
+        SVPDEBUG3( "CSVPController::StopDtmfTone sesCount: %d, err: %d",
+                     sesCount, err )
+        session = NULL;
+        }
+
+    if ( iEmergencySession && 
+         SVPAudioUtility::DtmfActionCapableSession( *iEmergencySession ) )
+        {
+        err = iEmergencySession->StopDtmfTone();
+        }
+
+    SVPDEBUG2("CSVPController::StopDtmfTone Out return=%d", err )
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::SendDtmfToneString
+// ---------------------------------------------------------------------------
+//
+TInt CSVPController::SendDtmfToneString( const TDesC& aString )
+    {
+    SVPDEBUG1( "CSVPController::SendDtmfToneString In" )
+    
+    TInt err( KErrNotSupported );
+    
+    delete iDtmfString;
+    iDtmfString = NULL;
+    TRAPD( errBuf, iDtmfString = HBufC::NewL( aString.Length() ) );
+    if ( KErrNone != errBuf )
+        {
+        return errBuf;
+        }
+    // Take local copy of the dtmf string to be sent
+    // This is needed for outband dtmf sequence start/stop event
+    *iDtmfString = aString;
+    iDtmfStringLex.Assign( *iDtmfString );
+    
+    TInt sesCount = iSessionArray.Count();
+    CSVPSessionBase* session = NULL;
+
+    while ( sesCount )
+        {
+        sesCount--;
+        session = iSessionArray[ sesCount ];
+        // Checking hold and mute status
+        if ( SVPAudioUtility::DtmfActionCapableSession( *session ) &&
+             !session->IsSessionMuted() )
+            {
+            err = session->SendDtmfToneString( aString );
+            if ( KErrNone == err )
+                {
+                iDtmfStringSending = ETrue;
+                iFirstDtmfSent = EFalse;
+                }
+            }
+        SVPDEBUG3( "CSVPController::SendDtmfToneString sesCount: %d, err: %d",
+                     sesCount, err )
+        session = NULL;
+        }
+    
+    if ( iEmergencySession )
+        {
+        if ( SVPAudioUtility::DtmfActionCapableSession( *iEmergencySession ) )
+            {
+            err = iEmergencySession->SendDtmfToneString( aString );
+            }
+        iDtmfStringSending = ETrue;
+        iFirstDtmfSent = EFalse;        
+        }
+
+    SVPDEBUG2("CSVPController::SendDtmfToneString Out return=%d", err )
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::ContinueDtmfStringSending
+// ---------------------------------------------------------------------------
+//
+TInt CSVPController::ContinueDtmfStringSending( const TBool /*aContinue*/ )
+    {
+    // SVP sessionbase used to implement this as only returning
+    // KErrNotSupported, so why not accept the situation here and just
+    // return KErrNotSupported.
+    
+    SVPDEBUG1( "CSVPController::ContinueDtmfStringSending KErrNotSupported" )
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::AddObserverL
+// ---------------------------------------------------------------------------
+//   
+void CSVPController::AddObserverL( const MCCPDTMFObserver& /*aObserver*/ )
+    {
+    SVPDEBUG1( "CSVPController::AddObserverL MCCPDTMFObserver" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::RemoveObserver
+// ---------------------------------------------------------------------------
+//
+TInt CSVPController::RemoveObserver( const MCCPDTMFObserver& /*aObserver*/ )
+    {
+    SVPDEBUG1( "CSVPController::RemoveObserver MCCPDTMFObserver" )
+    return KErrNotSupported;
+    }
+
+  
+// refer observer
+  
+// ---------------------------------------------------------------------------
+// CSVPController::ReferStateChanged
+// ---------------------------------------------------------------------------
+//
+void CSVPController::ReferStateChanged( CMceRefer& aRefer,
+        TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPController::ReferStateChanged In" )
+    
+    iContainer = *aContainer;
+    TInt ind = KErrNotFound;
+
+    // loop session array and check refer
+    for ( TInt s = 0; s < iSessionArray.Count() && 
+          KErrNotFound == ind; s++ )
+        { 
+        if ( iSessionArray[ s ]->IsMceRefer( aRefer ) )
+            {
+            ind = s;
+            } 
+        }
+
+    if ( KErrNotFound != ind )
+        {
+        SVPDEBUG2(" CSVPController::ReferStateChanged ind: %d", ind );
+        TInt statusCode = iContainer.GetStatusCode();
+
+        iSessionArray[ ind ]->ReferStateChanged( aRefer, statusCode );
+        }
+    
+    SVPDEBUG1( "CSVPController::ReferStateChanged Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::ReferConnectionStateChanged
+// ---------------------------------------------------------------------------
+//
+void CSVPController::ReferConnectionStateChanged( CMceRefer& /*aRefer*/,
+        TBool /*aActive*/ )
+    {
+    SVPDEBUG1( "CSVPController::ReferConnectionStateChanged" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::Failed
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CSVPController::Failed( CMceRefer& /*aRefer*/, TInt aError )
+#else
+void CSVPController::Failed( CMceRefer& /*aRefer*/, TInt /*aError*/ )
+#endif // _DEBUG
+    {
+    SVPDEBUG2( "CSVPController::Failed Refer failed with error: %d", aError )
+    }
+
+
+// Mce DMTF observer
+// ---------------------------------------------------------------------------
+// CSVPController::DtmfToneReceived
+// ---------------------------------------------------------------------------
+//
+void CSVPController::DtmfToneReceived( CMceSession& /*aSession*/,
+        CMceAudioStream& /*aStream*/, const TChar& /*aTone*/ )
+    {
+    // Not supported
+    SVPDEBUG1( "CSVPController:: DtmfToneReceived - Not supported" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPController::DtmfEventReceived
+// ---------------------------------------------------------------------------
+//
+void CSVPController::DtmfEventReceived( CMceSession& aSession,
+                                        CMceAudioStream& /*aStream*/,
+                                        CMceMediaSource& /*aSource*/,
+                                        TMceDtmfEvent aEvent )
+    {
+    SVPDEBUG3( "CSVPController::DtmfEventReceived In, aEvent: %d, iDtmfStringSending: %d",
+                   aEvent, iDtmfStringSending )
+    
+    // find what session received the event
+    const TInt index = FindSVPSession( aSession );
+    
+    if ( KErrNotFound != index )
+        {
+         // match dtmf event
+        MCCPDTMFObserver::TCCPDtmfEvent dtmfEvent = 
+            iSVPUtility->GetDtmfEvent( aEvent, iDtmfStringSending );
+        
+        // dtmf string
+        if ( iDtmfStringSending ) 
+            { 
+            // only start event received from mce
+            // logic below needed so that stop events can be sent
+            if ( MCCPDTMFObserver::ECCPDtmfSequenceStart == dtmfEvent )
+                {
+                if ( !iFirstDtmfSent )
+                    {
+                    SVPDEBUG1( "CSVPController::DtmfEventReceived FIRST SEND" )
+                    
+                    // send start
+                    iFirstDtmfSent = ETrue;
+                     // call back event to application
+                    iSessionArray[ index ]->
+                        DtmfObserver().HandleDTMFEvent( dtmfEvent, 
+                                                        KErrNone, 
+                                                        iDtmfStringLex.Peek() );
+                    }  
+                else
+                    {
+                    SVPDEBUG1( "CSVPController::DtmfEventReceived STOP TO PREVIOUS" )
+                    
+                    // send stop event to the previous character in string 
+                    iSessionArray[ index ]->DtmfObserver().HandleDTMFEvent( 
+                        MCCPDTMFObserver::ECCPDtmfSequenceStop, 
+                        KErrNone, 
+                        iDtmfStringLex.Get() );
+                     SVPDEBUG1("CSVPController::DtmfEventReceived START TO CURRENT");
+                    // send start event to the current character in string
+                    iSessionArray[ index ]->DtmfObserver().HandleDTMFEvent( 
+                        dtmfEvent, 
+                        KErrNone, 
+                        iDtmfStringLex.Peek() );
+                    }
+                }
+             else
+                {
+                SVPDEBUG1( "CSVPController::DtmfEventReceived STOP TO PREVIOUS AND LAST" )
+                
+                // send stop event to the previous character in string 
+                iSessionArray[ index ]->DtmfObserver().HandleDTMFEvent( 
+                        MCCPDTMFObserver::ECCPDtmfSequenceStop, 
+                        KErrNone, 
+                        iDtmfStringLex.Peek() );
+                
+                SVPDEBUG1( "CSVPController::DtmfEventReceived COMPLETE" )
+                
+                // send sequence stop event
+                iSessionArray[ index ]->DtmfObserver().HandleDTMFEvent( 
+                     MCCPDTMFObserver::ECCPDtmfStringSendingCompleted, 
+                     KErrNone, 
+                     iDtmfStringLex.Peek() );
+                // sequence complete, clear flags
+                iDtmfStringSending = EFalse;
+                iFirstDtmfSent = EFalse;
+               
+                delete iDtmfString;
+                iDtmfString = NULL;
+                }
+            }
+        // manual dtmf
+        else
+            {
+            // call back event to application
+            iSessionArray[ index ]->DtmfObserver().HandleDTMFEvent( 
+                                            dtmfEvent, 
+                                            KErrNone, 
+                                            iDtmfTone );
+            }
+        }
+    
+    else if ( iEmergencySession )
+        {
+        const MCCPDTMFObserver& dtmfObs = iEmergencySession->DtmfObserver();
+        SVPDEBUG2("CSVPController::DtmfEventReceived, %d = DtmfObserver()", &dtmfObs )
+         // match dtmf event
+        MCCPDTMFObserver::TCCPDtmfEvent dtmfEvent = 
+            iSVPUtility->GetDtmfEvent( aEvent, iDtmfStringSending );
+        
+        // dtmf string
+        if ( iDtmfStringSending && NULL != &dtmfObs ) 
+            { 
+            // only start event received from mce
+            // logic below needed so that stop events can be sent
+            if ( MCCPDTMFObserver::ECCPDtmfSequenceStart == dtmfEvent )
+                {
+                if ( !iFirstDtmfSent )
+                    {
+                    SVPDEBUG1(
+                    "CSVPController::DtmfEventReceived, emergency FIRST SEND")
+                    
+                    // send start
+                    iFirstDtmfSent = ETrue;
+                     // call back event to application
+                    dtmfObs.HandleDTMFEvent( dtmfEvent, KErrNone, iDtmfStringLex.Peek() );
+                    }  
+                else
+                    {
+                    SVPDEBUG1("CSVPController::DtmfEventReceived,\
+                     emergency STOP TO PREVIOUS")
+                    
+                    // send stop event to the previous character in string 
+                    dtmfObs.HandleDTMFEvent( 
+                        MCCPDTMFObserver::ECCPDtmfSequenceStop, 
+                        KErrNone, 
+                        iDtmfStringLex.Get() );
+                     SVPDEBUG1("CSVPController::DtmfEventReceived,\
+                      emergency START TO CURRENT")
+                    // send start event to the current character in string
+                    dtmfObs.HandleDTMFEvent( 
+                        dtmfEvent, 
+                        KErrNone, 
+                        iDtmfStringLex.Peek() );
+                    }
+                }
+             else
+                {
+                SVPDEBUG1("CSVPController::DtmfEventReceived,\
+                 emergency STOP TO PREVIOUS AND LAST")
+                
+                // send stop event to the previous character in string 
+                dtmfObs.HandleDTMFEvent( 
+                    MCCPDTMFObserver::ECCPDtmfSequenceStop, 
+                    KErrNone, 
+                    iDtmfStringLex.Peek() );
+                
+                SVPDEBUG1("CSVPController::DtmfEventReceived,\
+                 emergency COMPLETE")
+                
+                // send sequence stop event
+                dtmfObs.HandleDTMFEvent( 
+                     MCCPDTMFObserver::ECCPDtmfStringSendingCompleted, 
+                     KErrNone, 
+                     iDtmfStringLex.Peek() );
+                // sequence complete, clear flags
+                iDtmfStringSending = EFalse;
+                iFirstDtmfSent = EFalse;
+                
+                delete iDtmfString;
+                iDtmfString = NULL;
+                }
+            }
+        // manual dtmf
+        else if( NULL != &dtmfObs )
+            {
+            SVPDEBUG1("CSVPController::DtmfEventReceived,\
+                    manual dtmf ,  call back event to application")
+            dtmfObs.HandleDTMFEvent( dtmfEvent, KErrNone, iDtmfTone );
+            }
+        else
+            {
+            SVPDEBUG1("CSVPController::DtmfEventReceived, DtmfObs not set")
+            }
+        }
+    
+    SVPDEBUG1( "CSVPController::DtmfEventReceived Out" )
+    }
+                                  
+// ---------------------------------------------------------------------------
+// CSVPController::DtmfErrorOccured
+// ---------------------------------------------------------------------------
+//
+ void CSVPController::DtmfErrorOccured( CMceSession& aSession,
+         CMceAudioStream& /*aStream*/,CMceMediaSource& /*aSource*/,
+         TInt aError )
+    {
+    SVPDEBUG2( "CSVPController::DtmfErrorOccured In, aError: %d", aError )
+    
+    // find what session received the event
+    const TInt index = FindSVPSession( aSession );
+    if ( KErrNotFound != index )
+        {
+        // match dtmf event, unknown set as default in error case, 'tis ok?
+        const MCCPDTMFObserver::TCCPDtmfEvent dtmfEvent = 
+            MCCPDTMFObserver::ECCPDtmfUnknown;
+        
+        // default tone char
+        TChar dtmfToneChar('0');
+        
+        // call back error
+        iSessionArray[ index ]->
+            DtmfObserver().HandleDTMFEvent( dtmfEvent, 
+                                            aError, 
+                                            dtmfToneChar );  
+        }
+    
+    SVPDEBUG1( "CSVPController::DtmfErrorOccured Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::FinalizeSessionCreationL
+// ---------------------------------------------------------------------------
+//
+void CSVPController::FinalizeSessionCreationL( CSVPSessionBase* aSession )
+    {
+    SVPDEBUG2( "CSVPController::FinalizeSessionCreationL In, aSession: 0x%x",
+        aSession )
+    
+    __ASSERT_ALWAYS( aSession, User::Leave( KErrArgument ) );
+    
+    if ( iCCPDtmfObserver )
+      	{
+       	aSession->SetDtmfObserver( *iCCPDtmfObserver );
+       	}
+    
+    iRtpObserver->AddSessionForObservingL( aSession );
+    iSessionArray.AppendL( aSession );
+    
+    SVPDEBUG1( "CSVPController::FinalizeSessionCreationL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::ExecCbErrorOccurred
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPController::ExecCbErrorOccurred( MCCPObserver::TCCPError aError )
+    {
+    SVPDEBUG2( "CSVPController::ExecCbErrorOccurred In, aError=%d", aError )
+    
+    TInt status = KErrNotFound;
+    
+    if ( iCCPMonitor )
+        {
+        status = KErrNone;
+        iCCPMonitor->ErrorOccurred( aError );
+        }
+    
+    SVPDEBUG2( "CSVPController::ExecCbErrorOccurred Out return=%d", status )
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::IncomingCall
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPController::ExecCbIncomingCall( MCCPCall* aCall )
+    {
+    SVPDEBUG2( "CSVPController::ExecCbIncomingCall In, aCall= 0x%x", aCall )
+
+    TInt status = KErrNotFound;
+    
+    if ( iCCPMonitor )
+        {
+        status = KErrNone;
+        iCCPMonitor->IncomingCall( aCall );
+        }
+    
+    SVPDEBUG2( "CSVPController::ExecCbIncomingCall Out return=%d", status )
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::ExecCbIncomingCall
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPController::ExecCbIncomingCall( MCCPCall* aCall, MCCPCall& aTempCall )
+    {
+    SVPDEBUG2( "CSVPController::ExecCbIncomingCall In, aCall= 0x%x", aCall )
+    SVPDEBUG2( "CSVPController::ExecCbIncomingCall aTempCall= 0x%x", &aTempCall )
+    
+    TInt status = KErrNotFound;
+    
+    if ( iCCPMonitor )
+        {
+        status = KErrNone;
+        iCCPMonitor->IncomingCall( aCall, aTempCall );
+        }
+    
+    SVPDEBUG2( "CSVPController::ExecCbIncomingCall Out return=%d", status )
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::ExecCbCallCreated
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPController::ExecCbCallCreated( MCCPCall* aNewTransferCall,
+        MCCPCall* aOriginator, TBool aAttended )
+    {
+    SVPDEBUG2( "CSVPController::ExecCbCallCreated In, aNewTransferCall= 0x%x", aNewTransferCall )
+    SVPDEBUG2( "CSVPController::ExecCbCallCreated          aOriginator= 0x%x", aOriginator )
+    SVPDEBUG2( "CSVPController::ExecCbCallCreated            aAttended= %d", aAttended )
+    
+    TInt status = KErrNotFound;
+    
+    if ( iCCPMonitor )
+        {
+        status = KErrNone;
+        iCCPMonitor->CallCreated( aNewTransferCall, aOriginator, aAttended );
+        }
+    
+    SVPDEBUG2( "CSVPController::ExecCbCallCreated Out return=%d", status )
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::ParseRecipientDtmfSuffixL
+// ---------------------------------------------------------------------------
+// 
+HBufC* CSVPController::ParseRecipientDtmfSuffixL( const TDesC& aRecipient ) const
+    {
+    __ASSERT_ALWAYS( &aRecipient, User::Leave( KErrArgument ) );
+
+    SVPDEBUG2( "CSVPController::ParseRecipientDtmfSuffixL In, aRecipient=%S", &aRecipient )
+    
+    HBufC* result = aRecipient.AllocLC(); // CS:1
+    
+    TInt recipientLength = result->Length();
+    if ( recipientLength )
+        {
+        if ( IsValidDtmfRecipientL( *result ) )
+            {
+            TInt loopCount = 0;
+            if (  KErrNotFound != KSVPDtmfTelNumRange().Locate( result->Des()[loopCount] ) )
+                {
+                loopCount++;
+                TBool doLoop = ETrue;
+                do
+                    {
+                    if ( loopCount < recipientLength )
+                        {
+                        if ( KErrNotFound != 
+                            KSVPDtmfDelimiterRange().Locate( result->Des()[loopCount] ) )
+                            {
+                            TInt suffixLength = recipientLength - loopCount;
+                            result->Des().Delete( loopCount, suffixLength );
+                            doLoop = EFalse;
+                            SVPDEBUG1(
+                                 "CSVPController::ParseRecipientDtmfSuffixL, DTMF suffix removed" )
+                            }
+                        else 
+                            {
+                            loopCount++;
+                            }
+                        }
+                    else
+                        {
+                        doLoop = EFalse;
+                        }
+                    } while ( doLoop );
+                }
+            }
+        }
+    SVPDEBUG2( "CSVPController::ParseRecipientDtmfSuffixL Out, result=%S", result )
+    CleanupStack::Pop( result ); // CS:0
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::IsValidDtmfRecipientL
+// ---------------------------------------------------------------------------
+// 
+TBool CSVPController::IsValidDtmfRecipientL( const TDesC& aRecipient ) const
+    {
+    __ASSERT_ALWAYS( &aRecipient, User::Leave( KErrArgument ) );
+
+    SVPDEBUG1( "CSVPController::IsValidDtmfRecipientL In" )
+
+    TBool result = ETrue;
+    if ( aRecipient.Length() )
+        {
+        TBool loopDo = ETrue;
+        TInt loopCount = 0;
+        do
+            {
+            if ( loopCount < aRecipient.Length() )
+                {
+                if ( KErrNotFound == KSVPDtmfAllValidChars().Locate( aRecipient[loopCount] ) )
+                    {
+                    result = EFalse;
+                    loopDo = EFalse;
+                    }
+                else
+                    {
+                    loopCount++;
+                    }
+                }
+            else
+                {
+                loopDo = EFalse;
+                }
+            } while ( loopDo );
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPController::IsValidDtmfRecipientL, Invalid recipient length" )
+        result = EFalse;
+        }
+    SVPDEBUG2( "CSVPController::IsValidDtmfRecipientL Out, result=%d" , result )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPController::CheckCallEventToBeSent
+// ---------------------------------------------------------------------------
+//
+void CSVPController::CheckCallEventToBeSent( CSVPSessionBase* aNewSVPSession, 
+                     CSVPSessionBase* aOldSVPSession ) const
+    {
+    SVPDEBUG1( "CSVPController::CheckCallEventToBeSent In" )
+
+    if ( aOldSVPSession->IsSecured() != aNewSVPSession->IsSecured() )
+        {
+        // Session secure status changed, need to send proper event
+        if ( aNewSVPSession->IsSecured() )
+            {
+            SVPDEBUG1( "CSVPController::CheckCallEventToBeSent, unsecure -> secure case" )
+            aNewSVPSession->SetCallEventToBeSent( MCCPCallObserver::ECCPSecureCall );
+            }
+        else
+            {
+            SVPDEBUG1( "CSVPController::CheckCallEventToBeSent, secure -> unsecure case" )
+            aNewSVPSession->SetCallEventToBeSent( MCCPCallObserver::ECCPNotSecureCall );
+            }
+        }
+    else
+        {
+        // remoteparty will be updated anyway after attended transfer
+        SVPDEBUG1( "CSVPController::CheckCallEventToBeSent, remoteparty will be updated after attended transfer" )
+        aNewSVPSession->SetCallEventToBeSent( MCCPCallObserver::ECCPNotifyRemotePartyInfoChange );
+        }
+    SVPDEBUG1( "CSVPController::CheckCallEventToBeSent Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPObserver
+// CSVPController::IncomingRequest
+// ---------------------------------------------------------------------------
+// 
+void CSVPController::IncomingRequest( 
+    TUint32 /*aIapId*/, CSIPServerTransaction* /*aTransaction*/ )
+    {
+    SVPDEBUG1( "CSVPController::IncomingRequest" )
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPObserver
+// CSVPController::TimedOut
+// ---------------------------------------------------------------------------
+//     
+void CSVPController::TimedOut( 
+    CSIPServerTransaction& /*aSIPServerTransaction*/ )
+    {
+    SVPDEBUG1( "CSVPController::TimedOut" )
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver
+// CSVPController::ProfileRegistryErrorOccurred
+// ---------------------------------------------------------------------------
+//  
+void CSVPController::ProfileRegistryErrorOccurred( 
+    TUint32 /*aSIPProfileId*/, TInt /*aError*/ )
+    {
+    SVPDEBUG1( "CSVPController::ProfileRegistryErrorOccurred" )
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver
+// CSVPController::ProfileRegistryEventOccurred
+// ---------------------------------------------------------------------------
+//  
+void CSVPController::ProfileRegistryEventOccurred( 
+    TUint32 /*aProfileId*/, TEvent /*aEvent*/ )
+    {
+    SVPDEBUG1( "CSVPController::ProfileRegistryEventOccurred" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpdtmfeventgenerator.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,196 @@
+/*
+* 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:  Generates DTMF events in Inband DTMF    
+*
+*/
+
+
+#include "svpdtmfeventgenerator.h"
+#include "svplogger.h"
+#include "svpdtmfeventobserver.h"
+
+const TInt KSvpNormalEventInterval = 300000;
+// Pause character ('p') interval is 2500 ms
+const TInt KSvpPauseEventInterval = 2500000;
+
+// ---------------------------------------------------------------------------
+// CSVPDTMFEventGenerator::CSVPDTMFEventGenerator
+// ---------------------------------------------------------------------------
+//
+CSVPDTMFEventGenerator::CSVPDTMFEventGenerator(  
+                                           MSVPDTMFEventObserver& aObserver ): 
+                                  
+    CActive( EPriorityStandard ),      
+    iObserver( aObserver )
+    {
+    // add object to active scheduler
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPDTMFEventGenerator::CSVPDTMFEventGenerator
+// ---------------------------------------------------------------------------
+//
+void CSVPDTMFEventGenerator::ConstructL()
+    {
+    // create timer
+    User::LeaveIfError( iTimer.CreateLocal() );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPDTMFEventGenerator::CSVPDTMFEventGenerator
+// ---------------------------------------------------------------------------
+//
+CSVPDTMFEventGenerator* CSVPDTMFEventGenerator::NewL( 
+                                            MSVPDTMFEventObserver& aObserver )
+    {
+    CSVPDTMFEventGenerator* self = 
+        new ( ELeave ) CSVPDTMFEventGenerator( aObserver );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPDTMFEventGenerator::~CSVPDTMFEventGenerator
+// ---------------------------------------------------------------------------
+//  
+CSVPDTMFEventGenerator::~CSVPDTMFEventGenerator()
+    {
+    // cancel outgoing requests and close timer
+    Cancel();
+    iTimer.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPDTMFEventGenerator::RunL
+// ---------------------------------------------------------------------------
+//  
+void CSVPDTMFEventGenerator::RunL()
+    {
+    SVPDEBUG2( "CSVPDTMFEventGenerator::RunL tick: %u", User::TickCount() )
+    SVPDEBUG2( "CSVPDTMFEventGenerator::RunL iStatus: %d", iStatus.Int() )
+    SVPDEBUG2( "CSVPDTMFEventGenerator::RunL iStringLength: %d", iStringLength )
+    
+    if ( KErrNone == iStatus.Int() )
+        {
+        if ( !iStartSent && iStringLength )
+            {
+            iObserver.InbandDtmfEventOccurred( ESvpDtmfSendStarted );
+            iStartSent = ETrue;
+            iStringLength--;
+            TTimeIntervalMicroSeconds32 delay; 
+            if ( iPause )
+                {
+                delay = KSvpPauseEventInterval;
+                iPause = EFalse;
+                }
+            else
+                {
+                delay = KSvpNormalEventInterval;
+                }
+            if ( !IsActive() )
+                {
+                iTimer.After ( iStatus, delay );
+                SetActive(); 
+                }
+            }
+        else
+            {  
+            iObserver.InbandDtmfEventOccurred( ESvpDtmfSendStopped );
+            iStartSent = EFalse;
+            
+            if ( iStringLength )
+                {
+                TTimeIntervalMicroSeconds32 delay = KSvpNormalEventInterval;
+                if ( !IsActive() )
+                    {
+                    iTimer.After ( iStatus, delay );
+                    SetActive(); 
+                    }
+                }
+            else
+                {
+                iObserver.InbandDtmfEventOccurred( ESvpDtmfSendCompleted );
+                }
+            }     
+        }
+    else
+        {
+        User::Leave( iStatus.Int() );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPDTMFEventGenerator::StartDtmfEvents
+// ---------------------------------------------------------------------------
+//     
+void CSVPDTMFEventGenerator::StartDtmfEvents( TInt aStringLength, TBool aPause )
+    {
+    SVPDEBUG1("CSVPDTMFEventGenerator::StartDtmfEvents In");
+    Cancel();
+    // Give the time to CTimer as microseconds 
+    // event interval is default => 300ms  
+    if ( aStringLength )
+        {
+        // save string length    
+        iStringLength = aStringLength;
+        iPause = aPause;
+        iTimer.After( iStatus, KSvpNormalEventInterval );
+        SetActive(); 
+        } 
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPDTMFEventGenerator::DoCancel
+// ---------------------------------------------------------------------------
+// 
+void CSVPDTMFEventGenerator::DoCancel()
+    {
+    SVPDEBUG1( "CSVPDTMFEventGenerator::DoCancel" )
+    iStringLength = 0;
+    iStartSent = EFalse;
+    iPause = EFalse;
+    iTimer.Cancel();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPDTMFEventGenerator::StopEvents
+// ---------------------------------------------------------------------------
+//  
+void CSVPDTMFEventGenerator::StopEvents()
+    {
+    SVPDEBUG1("CSVPDTMFEventGenerator::StopEvents In");
+    // Always call through Cancel() as it will 
+    // cancel the request in the scheduler and then it will call DoCancel()
+    Cancel();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPDTMFEventGenerator::RunError
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPDTMFEventGenerator::RunError( TInt aError )
+    {
+    SVPDEBUG2( "CSVPDTMFEventGenerator::RunError aError: %d", aError )
+    
+    return aError;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpemergencyconnection.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,311 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 connection for emergency call when necessary
+*
+*/
+
+
+
+#include <nifman.h>   // For global variables
+
+#include "svpemergencyconnection.h"
+#include "svplogger.h" // For logging
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencyConnection
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencyConnection::CSVPEmergencyConnection( 
+    TPriority aPriority, MSVPEmergencyConnectionObserver& aObserver )
+    : CActive( aPriority ), 
+      iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencyConnection::ConstructL()
+    {
+    SVPDEBUG1("CSVPEmergencyConnection::ConstructL()")
+    
+    User::LeaveIfError( iSocketServer.Connect() );
+    User::LeaveIfError( iConnection.Open( iSocketServer ) );
+    }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencyConnection* CSVPEmergencyConnection::NewL( 
+    TPriority aPriority, MSVPEmergencyConnectionObserver& aObserver )
+    {
+    CSVPEmergencyConnection* self = CSVPEmergencyConnection::NewLC( 
+        aPriority, aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencyConnection* CSVPEmergencyConnection::NewLC( 
+    TPriority aPriority, MSVPEmergencyConnectionObserver& aObserver )
+    {
+    CSVPEmergencyConnection* self = 
+        new( ELeave ) CSVPEmergencyConnection( aPriority, aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencyConnection::~CSVPEmergencyConnection()
+    {
+    SVPDEBUG1("CSVPEmergencyConnection::~CSVPEmergencyConnection()")
+    
+    Cancel();
+
+    iConnection.Close();
+    iSocketServer.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Connects asynchronically with SNAP ID
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencyConnection::ConnectWithSnapIdL( TUint32 aSnapId )
+    {
+    SVPDEBUG2("CSVPEmergencyConnection::ConnectWithSnapIdL, ID: %d", aSnapId)
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    // Start connection
+    iRequestType = ESVPSnapConnect;
+    iSnapConnPref.SetSnap( aSnapId );
+    iConnection.Start( iSnapConnPref, iStatus );
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the used IAP ID of SNAP connection
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencyConnection::IapId( TUint32& aIapId )
+    {
+    SVPDEBUG1("CSVPEmergencyConnection::IapIdL()")
+    
+    _LIT( KIapId, "IAP\\Id" );
+    TRAPD( error, iConnection.GetIntSetting( KIapId, aIapId ) )
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Connects with IAP ID
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencyConnection::ConnectL( TUint32 aIapId )
+    {
+    SVPDEBUG2("CSVPEmergencyConnection::ConnectL(), IAP ID: %d", aIapId)
+    
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+    
+    // Start connection
+    iRequestType = ESVPConnect;
+    iConnPref.SetIapId( aIapId );
+    iConnPref.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
+    iConnection.Start( iConnPref, iStatus );
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// Requests for SIP proxy address
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CSVPEmergencyConnection::RequestSipProxyAddressL( TUint32 aIapId )
+#else
+void CSVPEmergencyConnection::RequestSipProxyAddressL( TUint32 /*aIapId*/ )
+#endif // __DEBUG
+    {
+    SVPDEBUG2("CSVPEmergencyConnection::RequestSipProxyAddressL(),\
+        IAP ID: %d", aIapId)
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    // Request SIP proxy address
+    iRequestType = ESVPSipProxyAddress;
+    iSipServerAddrBuf().index = 0;
+    iConnection.Ioctl( 
+        KCOLConfiguration, 
+        KConnGetSipServerAddr, // DHCP option 120
+        iStatus, 
+        &iSipServerAddrBuf );
+    SetActive();
+    }
+    
+// ---------------------------------------------------------------------------
+// From class CSVPEmergencyConnection.
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencyConnection::DoCancel()
+    {
+    SVPDEBUG1("CSVPEmergencyConnection::DoCancel()")
+    
+    iRequestType = ESVPNone;
+    iConnection.CancelIoctl();
+    iConnection.Close();
+    }
+    
+// ---------------------------------------------------------------------------
+// From class CActive.
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencyConnection::RunL()
+    {
+    TInt error = iStatus.Int();
+    SVPDEBUG2( "CSVPEmergencyConnection::RunL(), error: %d", error )
+    SVPDEBUG2( "CSVPEmergencyConnection::RunL(), Request type: %d", iRequestType )
+    
+    // execution goes to RunError() if error occured
+    User::LeaveIfError( iStatus.Int() );
+    switch ( iRequestType )
+        {
+        case ESVPSnapConnect:
+            SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPSnapConnect" )
+            iRequestType = ESVPNone;
+            iObserver.SnapConnected();
+            break;
+        
+        case ESVPConnect:
+            SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPConnect" )
+            iRequestType = ESVPNone;
+            iObserver.Connected();
+            break;
+            
+        case ESVPSipProxyAddress:
+            {
+            SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPSipProxyAddress" )
+            iRequestType = ESVPNone;
+            
+            // Copy SIP proxy address in dotted-decimal notation
+            HBufC16* sipProxyAddrBuf = HBufC16::NewLC( 39 ); // CS:1
+            TPtr16 sipProxyAddrPtr = sipProxyAddrBuf->Des();
+            iSipServerAddrBuf().address.Output( sipProxyAddrPtr );
+            SVPDEBUG2(
+                    "CSVPEmergencyConnection::RunL(), iSipServerAddrBuf: %S",
+                    sipProxyAddrBuf )
+            // Call observer
+            iObserver.SipProxyAddressReady( *sipProxyAddrBuf );
+            CleanupStack::PopAndDestroy( sipProxyAddrBuf ); // CS:0
+            break;
+            }
+        case ESVPSipDomainAddress:
+            {
+            SVPDEBUG1( "CSVPEmergencyConnection::RunL() - ESVPSipDomainAddress" )
+            iRequestType = ESVPNone;
+            
+            // Copy SIP proxy domain in dotted-decimal notation
+            HBufC16* sipDomainAddrBuf = HBufC16::NewLC( iSipServerDomainBuf().domainName.Length() ); // CS:1
+            TPtr16 sipDomainAddrPtr = sipDomainAddrBuf->Des();
+            sipDomainAddrPtr.Copy( iSipServerDomainBuf().domainName );
+            SVPDEBUG2(
+                    "CSVPEmergencyConnection::RunL(), iSipDomainAddrBuf: %S",
+                    sipDomainAddrBuf )
+            // Call observer
+            iObserver.SipProxyAddressReady( *sipDomainAddrBuf );
+            CleanupStack::PopAndDestroy( sipDomainAddrBuf ); // CS:0
+            break;
+            }
+            
+        default:
+            SVPDEBUG1( "CSVPEmergencyConnection::RunL() - Default" )
+            iRequestType = ESVPNone;
+            iObserver.ConnectionError( KErrGeneral );
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencyConnection::RunError
+//
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencyConnection::RunError( TInt aError )
+    {
+    SVPDEBUG2( "CSVPEmergencyConnection::RunError() %d", aError )
+    if ( iRequestType == ESVPSipProxyAddress )
+        {
+        /* 
+         * sip proxy address might be NULL if requested with KConnGetSipServerAddr
+         * and dhcp returns domain name to sip, instead of ipv4 or ipv6 type address.
+         * So try once again with KConnGetSipServerDomain.
+         */
+        SVPDEBUG1( "CSVPEmergencyConnection::RunError() - RequestDomain" )
+        RequestSipServerDomainL();    
+        return KErrNone;
+        }
+    else
+        {
+        iRequestType = ESVPNone;
+        SVPDEBUG2( "CSVPEmergencyConnection::RunError() - Notify Observer ConnectionError( %d )", aError )
+        iObserver.ConnectionError( aError );
+        return KErrNone;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Requests for SIP proxy address
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencyConnection::RequestSipServerDomainL()
+    {
+    SVPDEBUG1( 
+        "CSVPEmergencyConnection::RequestSipServerDomainL() - Try to get Sip server domain" )
+
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    iRequestType = ESVPSipDomainAddress;
+    iSipServerDomainBuf().index = 0;
+    // Request SIP server domain
+    iConnection.Ioctl(
+        KCOLConfiguration,
+        KConnGetSipServerDomain, // domain in textual format
+        iStatus,
+        &iSipServerDomainBuf );
+    SetActive();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpemergencyiapprovider.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 IAP IDs for emergency
+*
+*/
+
+
+#include "svpemergencyiapprovider.h"
+#include "svplogger.h" // For logging
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencyIapProvider::CSVPEmergencyIapProvider( TPriority aPriority )
+    : CActive( aPriority )
+    {  
+    CActiveScheduler::Add( this );
+    }
+    
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencyIapProvider::ConstructL()
+    {
+    SVPDEBUG1("CSVPEmergencyIapProvider::ConstructL()")
+    
+    User::LeaveIfError( iConnectionMonitor.ConnectL() );
+    iWait = new ( ELeave ) CActiveSchedulerWait();
+    }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencyIapProvider* CSVPEmergencyIapProvider::NewL( 
+    TPriority aPriority )
+    {
+    CSVPEmergencyIapProvider* self = CSVPEmergencyIapProvider::NewLC( 
+        aPriority );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencyIapProvider* CSVPEmergencyIapProvider::NewLC( 
+    TPriority aPriority )
+    {
+    CSVPEmergencyIapProvider* self = new( ELeave ) CSVPEmergencyIapProvider( 
+        aPriority );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencyIapProvider::~CSVPEmergencyIapProvider()
+    {
+    SVPDEBUG1("CSVPEmergencyIapProvider::~CSVPEmergencyIapProvider() In")
+    
+    Cancel();
+    
+    iConnectionMonitor.Close();
+    
+    delete iWait;
+    
+    SVPDEBUG1("CSVPEmergencyIapProvider::~CSVPEmergencyIapProvider() Out")
+    }
+
+// ---------------------------------------------------------------------------
+// Requests all IAP IDs
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencyIapProvider::RequestIapIds( RArray<TUint>& aIapIds )
+    {
+    SVPDEBUG1("CSVPEmergencyIapProvider::RequestIapIds()")
+    
+    if ( IsActive() )
+        {
+        return KErrInUse;
+        }
+    
+    // Make request for IAP IDs
+    iConnectionMonitor.GetPckgAttribute( 
+        EBearerIdWLAN, 0, KIapAvailability, iIapInfoBuf, iStatus );    
+    SetActive();
+    
+    // Wait until request completes
+    iWait->Start();
+    // Continues here after RunL completed
+
+    // Copy IAP IDs to array
+    if ( KErrNone == iError )
+        {
+        TUint count = iIapInfoBuf().iCount;
+        for ( TInt i = 0; i < count; i++ )
+            {
+            aIapIds.Append( iIapInfoBuf().iIap[i].iIapId );
+            }
+        }
+    
+    return iError;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencyIapProvider::DoCancel()
+    {
+    SVPDEBUG1("CSVPEmergencyIapProvider::DoCancel()")
+
+    iConnectionMonitor.CancelAsyncRequest( EConnMonGetPckgAttribute );    
+
+    if ( iWait->IsStarted() )
+        {
+        iWait->AsyncStop();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencyIapProvider::RunL()
+    {
+    iError = iStatus.Int();
+    SVPDEBUG2("CSVPEmergencyIapProvider::RunL(), error: %d", iError)
+
+    if ( iWait->IsStarted() )
+        {
+        iWait->AsyncStop();
+        // Returns right after iWait.Start() call
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpemergencysession.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1875 @@
+/*
+* 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:  SVP Emergency Sesssion class. Handles emergency 
+*                session methods.        
+*
+*/
+
+
+#include <sip.h>
+#include <sipprofile.h>
+#include <sipprofileregistry.h>
+
+#include <mceaudiostream.h>
+#include <mcertpsource.h>
+#include <mcertpsink.h>
+#include <mcemicsource.h>
+#include <mcespeakersink.h>
+#include <mcetransactiondatacontainer.h>
+
+#include "crcseprofileentry.h"
+#include "crcseprofileregistry.h"
+
+#include "svpemergencysession.h"
+#include "svpuriparser.h"
+#include "svputility.h"
+#include "svpsipconsts.h"
+#include "svpconsts.h"
+#include "svppositioningprovider.h"
+#include "svpemergencyconnection.h"
+#include "svpholdcontroller.h"
+#include "svpaudioutility.h"
+#include "svpdtmfeventgenerator.h"
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::CSVPEmergencySession
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencySession::CSVPEmergencySession( 
+    CSVPUtility& aSVPUtility, 
+    CMceManager& aMceManager, 
+    TBool aIsLastProfile, 
+    TBool aIsDummy )
+    : iSVPUtility( aSVPUtility ), 
+      iMceManager( aMceManager ), 
+      iSessionExpires( KSVPDefaultSessionExpires ), 
+      iIsLastProfile( aIsLastProfile ), 
+      iIsDummy( aIsDummy ), 
+      iIsDialed( EFalse ), 
+      iIsLIRequestReady( ETrue )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::ConstructL( TUint32 aVoipProfileId, 
+                                       const TDesC& aAddress, 
+                                       const MCCPCallObserver& aObserver, 
+                                       TBool aIsDummy )                                   
+    {
+    SVPDEBUG2("CSVPEmergencySession::ConstructL() IN, VoIP profile ID: %d", 
+        aVoipProfileId)
+
+    iEmergencyObserver = const_cast< MCCPCallObserver* >( &aObserver );
+    iVoipProfileId = ( TInt )aVoipProfileId;
+
+    // Start emergency timer, timeout 17 seconds
+    StartTimerL( KSVPEmergencyTimeout, KSVPEmergencyExpired );
+
+    if ( aIsDummy )
+        {
+        SVPDEBUG1("CSVPEmergencySession::ConstructL, dummy session")
+        return;
+        }
+
+    // Initialize registries
+    CRCSEProfileRegistry* reg = CRCSEProfileRegistry::NewLC(); // CS:1
+    CSIP* sip = CSIP::NewLC( KSVPUid, *this ); // CS:2
+    CSIPProfileRegistry* sipProfileRegistry = CSIPProfileRegistry::NewLC( 
+        *sip, *this ); // CS:3
+
+    // Find VoIP profile by its ID
+    CRCSEProfileEntry* voipProfile = CRCSEProfileEntry::NewLC();  // CS:4
+    reg->FindL( aVoipProfileId, *voipProfile );
+
+    // Set Session Expires value
+    iSessionExpires = ( TUint32 )voipProfile->iSIPSessionExpires;
+    
+    // There is only one (or zero) SIP profile per VoIP profile.
+    // if profileId doesn't exist, report an error ( ECCPErrorGeneral ).
+    if ( 0 == voipProfile->iIds.Count() )
+        {
+        SVPDEBUG1( "CSVPEmergencySession::ConstructL, no SIP profile, return" )
+        CleanupStack::PopAndDestroy( 4, reg ); // CS:0
+        ErrorOccurred( ECCPErrorGeneral );
+        return;
+        }
+    CSIPProfile* sipProfile = sipProfileRegistry->ProfileL( 
+        voipProfile->iIds[0].iProfileId );
+    CleanupStack::PushL( sipProfile ); // CS:5
+
+    // Get SIP profile ID
+    User::LeaveIfError( 
+        sipProfile->GetParameter( KSIPProfileId, iSipProfileId ) );
+       
+    // Get user AOR
+    const TDesC8* userAor = NULL;
+    User::LeaveIfError( sipProfile->GetParameter( KSIPUserAor, userAor ) );
+    iUserAor = HBufC8::NewL( userAor->Length() );
+    ( iUserAor->Des() ).Copy( *userAor );
+    
+    // Parse SIP URI
+    HBufC8* recipient = HBufC8::NewLC( aAddress.Length() ); // CS:6
+    ( recipient->Des() ).Copy( aAddress );
+    CSVPUriParser* uriParser = CSVPUriParser::NewLC(); // CS:7
+    iRecipientUri = uriParser->CompleteSipUriL( *recipient, *iUserAor, ETrue );
+    CleanupStack::PopAndDestroy( 2, recipient ); // uriparser, recipient CS:5
+
+    // Get registration status
+    TBool registered( EFalse );
+    sipProfile->GetParameter( KSIPProfileRegistered, registered );
+
+    // Get SNAP ID
+    TUint32 snapId( 0 );
+    TInt errSnap = sipProfile->GetParameter( KSIPSnapId, snapId );
+
+    // Define IAP ID
+    if ( !registered && KErrNone == errSnap )
+        {
+        SVPDEBUG2("CSVPEmergencySession::ConstructL, snapId: %d", snapId)
+        // Define IAP ID from SNAP ID, create WLAN connection
+        iEmergencyConnection = CSVPEmergencyConnection::NewL( 
+            CActive::EPriorityStandard, *this );
+        iEmergencyConnection->ConnectWithSnapIdL( snapId );
+        CleanupStack::PopAndDestroy( 5, reg );
+        // reg, sip, sipProfileRegistry, voipProfile, sipProfile CS:0
+        SVPDEBUG1("CSVPEmergencySession::ConstructL, return")
+        return;
+        }
+    else
+        {
+        User::LeaveIfError( 
+            sipProfile->GetParameter( KSIPAccessPointId, iIapId ) );
+        }
+
+    // Create MCE out session
+    if ( registered )
+        {
+        SVPDEBUG1("CSVPEmergencySession::ConstructL, registered")
+        iEmergencySession = CMceOutSession::NewL( 
+            iMceManager, *sipProfile, *iRecipientUri );
+        ConstructAudioStreamsL();
+        }
+    else
+        {
+        CreateUnregistedSessionL();
+        }
+    
+    CleanupStack::PopAndDestroy( 5, reg ); 
+    // CS:0 reg, sip, sipProfileRegistry, voipProfile, sipProfile
+
+    // Request for position information
+    RequestPosition( iIapId );
+
+    SVPDEBUG1("CSVPEmergencySession::ConstructL() OUT")
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::ConstructWithIapIdL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::ConstructWithIapIdL( 
+    TUint32 aIapId, 
+    const TDesC& aAddress, 
+    const MCCPCallObserver& aObserver, 
+    TBool aIsDummy )                                   
+    {
+    SVPDEBUG2("CSVPEmergencySession::ConstructWithIapIdL() In, IAP ID: %d", 
+        aIapId)
+
+    iEmergencyObserver = const_cast< MCCPCallObserver* >( &aObserver );
+    iVoipProfileId = KErrNotFound;
+    iIapId = aIapId;
+    
+    // Copy recipient address
+    iAddress = HBufC8::NewL( aAddress.Length() );
+    ( iAddress->Des() ).Copy( aAddress );
+    
+    // Start emergency timer, timeout 17 seconds
+    StartTimerL( KSVPEmergencyTimeout, KSVPEmergencyExpired );
+
+    if ( aIsDummy )
+        {
+        SVPDEBUG1("CSVPEmergencySession::ConstructWithIapIdL, dummy session")
+        return;
+        }
+
+    // Request for SIP proxy address
+    SVPDEBUG1("CSVPEmergencySession::ConstructWithIapIdL, SIP proxy address")
+    iEmergencyConnection = CSVPEmergencyConnection::NewL( 
+        CActive::EPriorityStandard, *this );
+    iEmergencyConnection->ConnectL( iIapId );
+    
+    SVPDEBUG1("CSVPEmergencySession::ConstructWithIapIdL() Out")
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::ContinueConstructWithIapIdL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::RequestSipProxyAddressL()
+    {
+    if ( NULL == iEmergencyConnection )
+        {
+        User::Leave( KErrGeneral );
+        }
+
+    iEmergencyConnection->RequestSipProxyAddressL( iIapId );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::ContinueConstructWithIapIdL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::ContinueConstructWithIapIdL( 
+    const TDesC16& aSipProxyAddress )
+    {
+    SVPDEBUG2("CSVPEmergencySession::ContinueConstructWithIapIdL(),\
+        SIP proxy address: %S", &aSipProxyAddress)
+
+    if ( 0 == aSipProxyAddress.Length() )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // Parse user AOR
+    iUserAor = HBufC8::NewL(
+        KSVPSipPrefix().Length() + 
+        KSVPAnonymous().Length() + 
+        KSVPAt().Length() + 
+        aSipProxyAddress.Length() );
+    TPtr8 userAorPtr = iUserAor->Des();
+    userAorPtr.Copy( KSVPSipPrefix );
+    userAorPtr.Append( KSVPAnonymous );
+    userAorPtr.Append( KSVPAt );
+    userAorPtr.Append( aSipProxyAddress );
+
+    // Parse SIP URI
+    SVPDEBUG1("CSVPEmergencySession::ContinueConstructWithIapIdL,\
+        parse SIP URI")
+    CSVPUriParser* uriParser = CSVPUriParser::NewLC(); // CS:1
+    iRecipientUri = uriParser->CompleteSipUriL( *iAddress, *iUserAor, ETrue );
+    CleanupStack::PopAndDestroy( uriParser ); // CS:0
+
+    // Create MCE session
+    CreateUnregistedSessionL();
+
+    // Request for position information
+    RequestPosition( iIapId );
+    
+    SVPDEBUG1("CSVPEmergencySession::ContinueConstructWithIapIdL() Out")
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencySession* CSVPEmergencySession::NewL(  
+                                        CMceManager& aMceManager, 
+                                        TUint32 aVoipProfileId, 
+                                        const TDesC& aAddress, 
+                                        const MCCPCallObserver& aObserver,
+                                        CSVPUtility& aSVPUtility, 
+                                        TBool aIsLastProfile, 
+                                        TBool aIsDummy )
+    {
+    CSVPEmergencySession* self = new( ELeave ) CSVPEmergencySession( 
+        aSVPUtility, aMceManager, aIsLastProfile, aIsDummy );
+    CleanupStack::PushL( self );
+    self->ConstructL( aVoipProfileId, aAddress, aObserver, aIsDummy );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencySession* CSVPEmergencySession::NewL(  
+                                        CMceManager& aMceManager, 
+                                        const TDesC& aAddress, 
+                                        const MCCPCallObserver& aObserver,
+                                        CSVPUtility& aSVPUtility, 
+                                        TUint32 aIapId, 
+                                        TBool aIsLastProfile, 
+                                        TBool aIsDummy )
+    {
+    CSVPEmergencySession* self = new( ELeave ) CSVPEmergencySession( 
+        aSVPUtility, aMceManager, aIsLastProfile, aIsDummy );
+    CleanupStack::PushL( self );
+    self->ConstructWithIapIdL( aIapId, aAddress, aObserver, aIsDummy );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::~CSVPEmergencySession
+// ---------------------------------------------------------------------------
+//
+CSVPEmergencySession::~CSVPEmergencySession()
+    {
+    SVPDEBUG1("CSVPEmergencySession::~CSVPEmergencySession() In")
+
+    StopTimers();  
+    iTimers.Close();
+
+    delete iEmergencySession;
+    delete iFailedEmergencySession;
+    
+    delete iUserAor;
+    delete iAddress;
+    delete iRecipientUri;
+    
+    delete iPositionInformation;
+    delete iPositioningProvider;
+    
+    delete iEmergencyConnection;
+    
+    delete iHoldController;
+    
+    delete iDTMFEventGenerator;
+    
+    delete iDtmfString;
+
+    SVPDEBUG1("CSVPEmergencySession::~CSVPEmergencySession() Out")
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::State
+// ---------------------------------------------------------------------------
+//
+MCCPCallObserver::TCCPCallState CSVPEmergencySession::State() const
+    {
+    SVPDEBUG1("CSVPEmergencySession::State()")
+
+    // ccpState can be safely initialized with StatusIdle
+    MCCPCallObserver::TCCPCallState ccpState = 
+        MCCPCallObserver::ECCPStateIdle;
+    
+    switch ( iEmergencySession->State() )
+        {
+        case CMceSession::EIdle:
+            SVPDEBUG1("CSVPEmergencySession::State, MCE EIdle")
+            ccpState = MCCPCallObserver::ECCPStateIdle;
+            break;
+       
+        case CMceSession::EProceeding:
+            SVPDEBUG1("CSVPEmergencySession::State, MCE EProceeding")
+            ccpState = MCCPCallObserver::ECCPStateConnecting;
+            break;
+            
+        case CMceSession::EEstablished:
+            SVPDEBUG1("CSVPEmergencySession::State, MCE EEstablished")
+            ccpState = MCCPCallObserver::ECCPStateConnected;
+            break;
+            
+        case CMceSession::ECancelling:
+            SVPDEBUG1("CSVPEmergencySession::State, MCE ECancelling")
+            ccpState = MCCPCallObserver::ECCPStateIdle;  
+            break;
+            
+        case CMceSession::ETerminating:
+            SVPDEBUG1("CSVPEmergencySession::State, MCE ETerminating")
+            ccpState = MCCPCallObserver::ECCPStateDisconnecting;
+            break;
+            
+        case CMceSession::ETerminated:
+            SVPDEBUG1("CSVPEmergencySession::State, MCE ETerminated")
+            if ( MCCPCallObserver::ECCPStateDisconnecting == iSessionState )
+                {
+                ccpState = MCCPCallObserver::ECCPStateDisconnecting;
+                }
+            else
+                {
+                ccpState = MCCPCallObserver::ECCPStateIdle;     
+                }
+            break;
+            
+        default:
+            SVPDEBUG1("CSVPEmergencySession::State, DEFAULT")
+            // This block should never be reached.
+            break;
+        }
+
+    return ccpState;
+    }
+
+// ---------------------------------------------------------------------------
+// Traps SessionStateChangedL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::SessionStateChanged( TInt aStatusCode )
+    {
+    TRAPD( err, SessionStateChangedL( aStatusCode ) )
+    if ( err )
+        {
+        SVPDEBUG2("CSVPEmergencySession::SessionStateChanged, err: %d", err)
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Session connection state changed
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::SessionConnectionStateChanged(
+    CMceSession& aSession, TBool aActive )
+    {
+    SVPDEBUG2("CSVPEmergencySession::SessionConnectionStateChanged - %d", 
+        aActive)
+    
+    if ( iEmergencySession == &aSession && aActive )
+        {
+        ProceedDial();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Stream state changed
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::StreamStateChanged( CMceMediaStream& aStream )
+    {
+    SVPDEBUG1("CSVPEmergencySession::StreamStateChanged()")
+    
+    if ( CMceMediaStream::EDisabled == aStream.State() &&
+         CMceSession::EEstablished == aStream.Session()->State() )
+        {
+        // Remote end died
+        iEmergencyObserver->CallStateChanged( 
+            MCCPCallObserver::ECCPStateDisconnecting, NULL );
+        TRAP_IGNORE( StartTimerL( 
+            KSVPTerminatingTime, KSVPRemoteEndDiedExpired ) )
+        }
+    else if ( CMceMediaStream::EStreaming == aStream.State() )
+        {
+        SVPDEBUG1("CSVPEmergencySession::StreamStateChanged() - EStreaming")
+        StopTimer( KSVPRemoteEndDiedExpired );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle incoming request, i.e. hold
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::IncomingRequestL( 
+    CMceInSession* aUpdatedSession, TMceTransactionDataContainer aContainer )
+    {
+    SVPDEBUG1("CSVPEmergencySession::IncomingRequest() In")
+
+    if ( !aUpdatedSession )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // Create hold controller
+    if ( NULL == iHoldController )
+        {
+        iHoldController = CSVPHoldController::NewL( 
+            *iEmergencySession,
+            aContainer,
+            this,
+            ETrue );
+        }
+
+    iEmergencySession = aUpdatedSession;
+
+    User::LeaveIfError( iHoldController->IncomingRequest( aUpdatedSession ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Returns ETrue, if hold controller exists
+// ---------------------------------------------------------------------------
+//
+TBool CSVPEmergencySession::HasHoldController() const
+    {
+    if ( iHoldController )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Returns reference to hold controller
+// ---------------------------------------------------------------------------
+//    
+CSVPHoldController& CSVPEmergencySession::HoldController() const
+    {
+    return *iHoldController;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles hold session state changes
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::HoldSessionStateChangedL( CMceSession& aSession )
+    {
+    SVPDEBUG1("CSVPEmergencySession::HoldSessionStateChangedL() In")
+    
+    if ( NULL == iHoldController )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    if ( iHoldController->HoldInProgress() )
+        {
+        SVPDEBUG1(
+            "CSVPEmergencySession::HoldSessionStateChangedL, in progress")
+        StopTimers();
+        if ( iHoldController->ContinueHoldProcessing( aSession ) )
+            {
+            iEmergencyObserver->ErrorOccurred( ECCPLocalHoldFail, NULL );
+            }
+        }
+
+    SVPDEBUG1("CSVPEmergencySession::HoldSessionStateChangedL() Out")
+    }
+
+// ---------------------------------------------------------------------------
+// Returns DTMF observer
+// ---------------------------------------------------------------------------
+//
+const MCCPDTMFObserver& CSVPEmergencySession::DtmfObserver()
+    {
+    return *iDtmfObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets DTMF observer
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::SetDtmfObserver( 
+    const MCCPDTMFObserver& aObserver )
+    {
+    SVPDEBUG1("CSVPEmergencySession::SetDtmfObserver()")
+    
+    iDtmfObserver = const_cast<MCCPDTMFObserver*>( &aObserver );
+    }
+
+// ---------------------------------------------------------------------------
+// Starts DTMF tone
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencySession::StartDtmfTone( const TChar aTone )
+    {
+    SVPDEBUG1("CSVPEmergencySession::StartDtmfTone() In")
+    
+    TInt dtmfErr( KErrNone );
+    if ( iSVPUtility.GetDTMFMode() )
+        {
+        const RPointerArray<CMceMediaStream>& streams = 
+            iEmergencySession->Streams();
+        TInt count = streams.Count();
+        while ( count )
+            {
+            count--;
+            CMceMediaStream& mediaStream = *streams[ count ];
+            if ( SVPAudioUtility::DtmfActionCapableStream( mediaStream ) )
+                {
+                TRAP( dtmfErr, mediaStream.Source()->StartDtmfToneL( aTone ) )
+                }
+            else
+                {
+                dtmfErr = KErrNotSupported;
+                }
+            
+            if ( KErrNone != dtmfErr )
+                {
+                SVPDEBUG2("CSVPEmergencySession::StartDtmfToneL dtmfErr: %d",
+                    dtmfErr)
+                return dtmfErr;
+                }
+            }
+        }
+    else
+        {
+        iDtmfTone = aTone;
+        DtmfObserver().HandleDTMFEvent( MCCPDTMFObserver::ECCPDtmfManualStart, 
+                                        KErrNone, 
+                                        aTone );
+        }
+    SVPDEBUG1("CSVPEmergencySession::StartDtmfTone() Out")
+    return dtmfErr;
+    }
+
+// ---------------------------------------------------------------------------
+// Stops DTMF tone
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencySession::StopDtmfTone()
+    {
+    SVPDEBUG1("CSVPEmergencySession::StopDtmfTone() In")
+    
+    TInt dtmfErr( KErrNone );
+    if ( iSVPUtility.GetDTMFMode() )
+        {
+        const RPointerArray<CMceMediaStream>& streams = 
+            iEmergencySession->Streams();
+        TInt count = streams.Count();
+        while( count )
+            {
+            count--;
+            CMceMediaStream& mediaStream = *streams[ count ];
+            if ( SVPAudioUtility::DtmfActionCapableStream( mediaStream ) )
+                {
+                TRAP( dtmfErr, mediaStream.Source()->StopDtmfToneL() )
+                }
+            // NOP with inband.
+            
+            if ( KErrNone != dtmfErr )
+                {
+                SVPDEBUG2("CSVPEmergencySession::StopDtmfTone dtmfErr: %d",
+                    dtmfErr)
+                
+                return dtmfErr;
+                }
+            }
+        }
+    else
+        {
+        DtmfObserver().HandleDTMFEvent( MCCPDTMFObserver::ECCPDtmfManualStop, 
+                                        KErrNone, 
+                                        iDtmfTone );
+        }
+    SVPDEBUG1("CSVPEmergencySession::StopDtmfTone() Out")
+    return dtmfErr;
+    }
+
+// ---------------------------------------------------------------------------
+// Sends DTMF tone string
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencySession::SendDtmfToneString( const TDesC& aString )
+    {
+    SVPDEBUG1("CSVPEmergencySession::SendDtmfToneString() In")
+    
+    TInt error( KErrNone );
+
+    TChar dtmfPause('p');
+    // MCE calls if outband DTMF.
+    // Exception is character 'p' which is handled always locally
+    if ( !iSVPUtility.GetDTMFMode() ||
+        ( aString.Length() == 1 &&
+          dtmfPause == aString[0] ) )   
+        {
+        delete iDtmfString;
+        iDtmfString = NULL;
+        TRAP( error, iDtmfString = HBufC::NewL( aString.Length() ) );
+        if ( KErrNone != error )
+            {
+            return error;
+            }
+                       
+        *iDtmfString = aString;
+        iDtmfLex.Assign( *iDtmfString );
+        
+        SVPDEBUG1("CSVPEmergencySession::SendDtmfToneString, inband")
+        if ( !iDTMFEventGenerator )
+            {
+            TRAP( error,
+            iDTMFEventGenerator = CSVPDTMFEventGenerator::NewL( *this ) );
+            }
+        
+        if ( KErrNone != error )
+            {
+            return error;    
+            }
+        
+        // Dtmf pause interval is 2.5s
+        TBool pauseChar = ( aString.Length() == 1 && 
+                            dtmfPause == aString[0] ); 
+        // start events
+        iDTMFEventGenerator->StartDtmfEvents( aString.Length(), pauseChar );
+        }
+    else
+        {
+        SVPDEBUG1("CSVPEmergencySession::SendDtmfToneString, outband")
+        
+        const RPointerArray<CMceMediaStream>& streams = 
+            iEmergencySession->Streams();
+        TInt count = streams.Count();
+        while( count && KErrNone == error )
+            {
+            count--;
+            CMceMediaStream& mediaStream = *streams[ count ];
+            if ( SVPAudioUtility::DtmfActionCapableStream( mediaStream ) )
+                {
+                TRAP( error, mediaStream.Source()->SendDtmfToneSequenceL( 
+                    aString ) )
+                }
+            else
+                {
+                error = KErrNotSupported;
+                }
+            }
+        }
+
+    SVPDEBUG2("CSVPEmergencySession::SendDtmfToneString, error: %d", error)
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels DTMF tone string sending
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencySession::CancelDtmfStringSending()
+    {
+    SVPDEBUG1("CSVPEmergencySession::CancelDtmfStringSending() In")
+    
+    TInt error( KErrNone );
+    if ( !iSVPUtility.GetDTMFMode() ) 
+        {
+        error = KErrNotFound;
+        if ( iDTMFEventGenerator )
+            {
+            iDTMFEventGenerator->StopEvents();
+            error = KErrNone;
+            }
+        }
+    else 
+        {
+        SVPDEBUG1("CSVPEmergencySession::CancelDtmfStringSending, outband")
+        error = KErrNotSupported;
+        }
+
+    SVPDEBUG2("CSVPEmergencySession::CancelDtmfStringSending, error: %d", 
+        error)
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::Dial
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencySession::Dial( const TDesC& /*aRecipient*/ )
+    {
+    SVPDEBUG1("CSVPEmergencySession::Dial()")
+
+    if ( iIsDummy )
+        {
+        SVPDEBUG1("CSVPEmergencySession::Dial, dummy session")
+        ErrorOccurred( ECCPErrorGeneral );
+        return KErrNone;
+        }
+
+    iIsDialed = ETrue;
+    ProceedDial();
+
+    iEmergencyObserver->CallStateChanged( 
+        MCCPCallObserver::ECCPStateDialling, NULL );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::Cancel
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencySession::Cancel()
+    {
+    SVPDEBUG1("CSVPEmergencySession::Cancel()")
+    
+    TInt error( KErrNone );    
+    if ( iEmergencySession )
+        {
+        TRAP( error, ( ( CMceOutSession* )iEmergencySession )->CancelL() )
+        if ( error )
+            {
+            SVPDEBUG2("CSVPEmergencySession::Cancel, error: %d", error)
+            iEmergencyObserver->CallStateChanged( 
+                MCCPCallObserver::ECCPStateIdle, NULL );
+            }
+        }
+    else
+        {
+        iEmergencyObserver->CallStateChanged( 
+            MCCPCallObserver::ECCPStateIdle, NULL );
+        }
+    
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::HangUp
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencySession::HangUp()
+    {
+    SVPDEBUG1("CSVPEmergencySession::HangUp()")
+
+    if ( NULL == iEmergencySession )
+        {
+        iEmergencyObserver->CallStateChanged( 
+            MCCPCallObserver::ECCPStateIdle, NULL );
+        return KErrNone;
+        }
+    
+    CMceSession::TState mceState = iEmergencySession->State();
+    SVPDEBUG2("CSVPEmergencySession::HangUp, MCE state: %d", mceState)
+    
+    TInt err( KErrNone );
+
+    if ( CMceSession::EEstablished == mceState || 
+         CMceSession::EOffering == mceState )
+        {
+        if ( CMceSession::EEstablished == mceState )
+            {
+            TRAP( err, iEmergencySession->TerminateL() )
+            }
+        else // CMceSession::EOffering
+            {
+            err = Cancel();
+            }
+        
+        if ( !err )
+            {
+            iEmergencyObserver->CallStateChanged( 
+                MCCPCallObserver::ECCPStateDisconnecting, NULL );
+            TRAP_IGNORE( StartTimerL( 
+                KSVPMoHangupTerminatingTime, KSVPHangUpTimerExpired ) )
+            }   
+        }    
+    else // Wrong MCE state
+        {
+        SVPDEBUG2("CSVPEmergencySession::HangUp, wrong state: %d ", mceState )
+        StopTimers();
+        iEmergencyObserver->CallStateChanged( 
+            MCCPCallObserver::ECCPStateIdle, NULL );
+        }
+    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::Answer
+// ---------------------------------------------------------------------------
+//
+TInt CSVPEmergencySession::Answer()
+    {
+    SVPDEBUG1("CSVPEmergencySession::Answer()")
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::TimedOut
+// ---------------------------------------------------------------------------
+// 
+void CSVPEmergencySession::TimedOut( TInt aTimerId )
+    {
+    SVPDEBUG1("CSVPEmergencySession::TimedOut()")
+    
+     // Find the timer and delete it.
+    for ( TInt t = 0; t < iTimers.Count(); )
+        {
+        if ( iTimers[t] ->Id() == aTimerId )
+            {
+            delete iTimers[t];
+            iTimers.Remove( t );
+            }
+        else
+            {
+            t++;
+            }
+        }
+
+    switch ( aTimerId )
+        {
+        case KSVPHangUpTimerExpired:
+            SVPDEBUG1("CSVPEmergencySession::TimedOut, hangup")
+            iEmergencyObserver->CallStateChanged( 
+                MCCPCallObserver::ECCPStateIdle, NULL );
+            break;
+
+        case KSVPTerminationTimerExpired:
+            SVPDEBUG1("CSVPEmergencySession::TimedOut, termination")
+            iSessionState = MCCPCallObserver::ECCPStateIdle;
+            iEmergencyObserver->CallStateChanged( State(), NULL );
+            break;
+
+        case KSVPInviteTimerExpired:
+            SVPDEBUG1("CSVPEmergencySession::TimedOut, invite")
+            // Connection made but no answer, no point trying other profiles
+            ErrorOccurred( ECCPEmergencyFailed );
+            Cancel();
+            iEmergencyObserver->CallStateChanged( 
+                MCCPCallObserver::ECCPStateDisconnecting, NULL );
+            iEmergencyObserver->CallStateChanged( 
+                MCCPCallObserver::ECCPStateIdle, NULL );
+            break;
+        
+        case KSVPEmergencyExpired:
+            SVPDEBUG1("CSVPEmergencySession::TimedOut, emergency")
+            ErrorOccurred( ECCPErrorTimedOut );
+            break;
+        
+        case KSVPRemoteEndDiedExpired:
+            SVPDEBUG1("CSVPEmergencySession::TimedOut, remote end died")
+            iEmergencyObserver->CallStateChanged( 
+                MCCPCallObserver::ECCPStateIdle, NULL );
+            break;
+        
+        default:
+            SVPDEBUG1("CSVPEmergencySession::TimedOut, no timer found")
+            break;
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPObserver
+// CSVPEmergencySession::IncomingRequest
+// ---------------------------------------------------------------------------
+// 
+void CSVPEmergencySession::IncomingRequest( 
+    TUint32 /*aIapId*/, CSIPServerTransaction* /*aTransaction*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPObserver
+// CSVPEmergencySession::TimedOut
+// ---------------------------------------------------------------------------
+//     
+void CSVPEmergencySession::TimedOut( 
+    CSIPServerTransaction& /*aSIPServerTransaction*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver
+// CSVPEmergencySession::ProfileRegistryErrorOccurred
+// ---------------------------------------------------------------------------
+//  
+void CSVPEmergencySession::ProfileRegistryErrorOccurred( 
+    TUint32 /*aSIPProfileId*/, TInt /*aError*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver
+// CSVPEmergencySession::ProfileRegistryEventOccurred
+// ---------------------------------------------------------------------------
+//  
+void CSVPEmergencySession::ProfileRegistryEventOccurred( 
+    TUint32 /*aProfileId*/, TEvent /*aEvent*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPPositioningProviderObserver.
+// Handles successful positioning requests
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::PositioningRequestComplete( 
+    const TDesC8& aPosition )
+    {
+    SVPDEBUG2("CSVPEmergencySession::PositioningRequestComplete() - \
+     length: %d", aPosition.Length())
+    
+    iIsLIRequestReady = ETrue;
+    
+    delete iPositionInformation;
+    iPositionInformation = NULL;
+    TRAPD( err, iPositionInformation = HBufC8::NewL( aPosition.Length() ) )
+    if ( !err )
+        {
+        ( iPositionInformation->Des() ).Copy( aPosition );
+        }
+
+    iPositioningProvider->CloseModule();
+    ProceedDial();
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPPositioningProviderObserver.
+// Handles failed positioning requests
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CSVPEmergencySession::PositioningErrorOccurred( TInt aError )
+#else
+void CSVPEmergencySession::PositioningErrorOccurred( TInt /*aError*/ )
+#endif // _DEBUG
+    {
+    SVPDEBUG2("CSVPEmergencySession::PositioningErrorOccurred( %d )", aError)
+    
+    iIsLIRequestReady = ETrue;
+    iPositioningProvider->CloseModule();
+    ProceedDial();
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPEmergencyConnectionObserver.
+// SNAP connection is established
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::SnapConnected()
+    {
+    SVPDEBUG1("CSVPEmergencySession::SnapConnected() In")
+    
+    if ( NULL == iEmergencyConnection )
+        {
+        SVPDEBUG1("CSVPEmergencySession::SnapConnected, no connection object")
+        ErrorOccurred( ECCPErrorGeneral );
+        return;
+        }
+    
+    TInt err = iEmergencyConnection->IapId( iIapId );
+    SVPDEBUG2("CSVPEmergencySession::ConnectionReady, IAP ID: %d", iIapId)
+    if ( err )
+        {
+        SVPDEBUG2("CSVPEmergencySession::SnapConnected, error: %d", err)
+        ErrorOccurred( ECCPErrorGeneral );
+        return;
+        }
+
+    TRAP( err, CreateUnregistedSessionL() )
+    if ( err )
+        {
+        SVPDEBUG2("CSVPEmergencySession::SnapConnected, error: %d", err)
+        ErrorOccurred( ECCPErrorGeneral );
+        return;
+        }
+
+    // Request for position information
+    RequestPosition( iIapId );    
+    
+    ProceedDial();
+        
+    SVPDEBUG1("CSVPEmergencySession::SnapConnected() Out")
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPEmergencyConnectionObserver.
+// Connection is established
+// ---------------------------------------------------------------------------
+//    
+void CSVPEmergencySession::Connected()
+    {
+    SVPDEBUG1("CSVPEmergencySession::Connected()")
+    
+    TRAPD( error, RequestSipProxyAddressL() )
+    if ( error )
+        {
+        SVPDEBUG2("CSVPEmergencySession::Connected, error: %d", error)
+        ErrorOccurred( ECCPErrorGeneral );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPEmergencyConnectionObserver.
+// SIP proxy address ready
+// ---------------------------------------------------------------------------
+//    
+void CSVPEmergencySession::SipProxyAddressReady( const TDesC16& aAddress )
+    {
+    SVPDEBUG1("CSVPEmergencySession::SipProxyAddressReady()")
+    
+    TRAPD( error, ContinueConstructWithIapIdL( aAddress ) )
+    if ( error )
+        {
+        SVPDEBUG2("CSVPEmergencySession::SipProxyAddressReady, error: %d", 
+            error)
+        ErrorOccurred( ECCPErrorGeneral );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPEmergencyConnectionObserver.
+// Connection error has occurred
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CSVPEmergencySession::ConnectionError( TInt aError )
+#else
+void CSVPEmergencySession::ConnectionError( TInt /*aError*/ )
+#endif // _DEBUG
+    {
+    SVPDEBUG2("CSVPEmergencySession::ConnectionError, error: %d", aError)
+    
+    ErrorOccurred( ECCPErrorGeneral );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPHoldObserver.
+// Local hold
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::SessionLocallyHeld()
+    {
+    SVPDEBUG1("CSVPEmergencySession::SessionLocallyHeld()")
+    iEmergencyObserver->CallStateChanged( MCCPCallObserver::ECCPStateHold, 
+                                          NULL );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPHoldObserver.
+// Local resume
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::SessionLocallyResumed()
+    {
+    SVPDEBUG1("CSVPEmergencySession::SessionLocallyResumed()")
+    iEmergencyObserver->CallStateChanged( 
+        MCCPCallObserver::ECCPStateConnected, NULL );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPHoldObserver.
+// Remote hold
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::SessionRemoteHeld()
+    {
+    SVPDEBUG1("CSVPEmergencySession::SessionRemoteHeld()")
+    iEmergencyObserver->CallEventOccurred( MCCPCallObserver::ECCPRemoteHold, 
+                                           NULL );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPHoldObserver.
+// Remote resume
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::SessionRemoteResumed()
+    {
+    SVPDEBUG1("CSVPEmergencySession::SessionRemoteResumed()")
+    iEmergencyObserver->CallEventOccurred( 
+        MCCPCallObserver::ECCPRemoteResume, NULL );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPHoldObserver.
+// Hold request failed
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::HoldRequestFailed()
+    {
+    SVPDEBUG1("CSVPEmergencySession::HoldRequestFailed()")
+    iEmergencyObserver->ErrorOccurred( ECCPLocalHoldFail, NULL );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSVPHoldObserver.
+// Resume request failed
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::ResumeRequestFailed()
+    {
+    SVPDEBUG1("CSVPEmergencySession::ResumeRequestFailed()")
+    iEmergencyObserver->ErrorOccurred( ECCPLocalResumeFail, NULL );
+    }
+
+// ---------------------------------------------------------------------------
+// Inband DTMF event occurred
+// ---------------------------------------------------------------------------
+//   
+void CSVPEmergencySession::InbandDtmfEventOccurred( TSVPDtmfEvent aEvent )
+    {
+    SVPDEBUG2("CSVPEmergencySession::InbandDtmfEventOccurred(), event:%d", 
+        aEvent)
+    
+    switch ( aEvent )
+        {
+        case ESvpDtmfSendStarted:
+            iDtmfObserver->HandleDTMFEvent( 
+                MCCPDTMFObserver::ECCPDtmfSequenceStart, 
+                KErrNone, 
+                iDtmfLex.Peek() );
+            break;
+            
+        case ESvpDtmfSendStopped:
+            iDtmfObserver->HandleDTMFEvent( 
+                MCCPDTMFObserver::ECCPDtmfSequenceStop, 
+                KErrNone, 
+                iDtmfLex.Get() );
+            break;
+            
+        case ESvpDtmfSendCompleted:
+            {
+            iDtmfObserver->HandleDTMFEvent( 
+                MCCPDTMFObserver::ECCPDtmfStringSendingCompleted, 
+                KErrNone, 
+                iDtmfLex.Peek() );
+            
+            // String can be deleted as whole string has been sent 
+            delete iDtmfString;
+            iDtmfString = NULL;
+            
+            break;
+            }
+            
+        default:
+            break;
+        }
+    
+    SVPDEBUG1("CSVPEmergencySession::InbandDtmfEventOccurred() Out");
+    }
+
+// ---------------------------------------------------------------------------
+// Deletes failed MCE session and creates a new one without LI. Used when 
+// 415 Unsupported Media Type received.
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::CreateNonLISessionL()
+    {
+    SVPDEBUG1("CSVPEmergencySession::CreateNonLISessionL() IN")
+
+    // Save failed emergency session
+    iFailedEmergencySession = iEmergencySession;
+    iEmergencySession = NULL;
+
+    // Delete LI
+    delete iPositionInformation;
+    iPositionInformation = NULL;
+    iIsLIRequestReady = ETrue;
+    
+    if ( KErrNotFound == iVoipProfileId )
+        {
+        // No VoIP profile, trying IAP emergency call
+        SVPDEBUG1("CSVPEmergencySession::CreateNonLISessionL, IAP EC")
+        CreateUnregistedSessionL();
+        return;
+        }
+    
+    // Initialize SIP registry
+    CSIP* sip = CSIP::NewLC( KSVPUid, *this ); // CS:1
+    CSIPProfileRegistry* sipProfileRegistry = CSIPProfileRegistry::NewLC( 
+        *sip, *this ); // CS:2
+
+    // Get SIP profile, only one SIP profile per VoIP profile
+    CSIPProfile* sipProfile = sipProfileRegistry->ProfileL( iSipProfileId );
+    CleanupStack::PushL( sipProfile ); // CS:3
+
+    // Create MCE out session
+    TBool registered( EFalse );
+    sipProfile->GetParameter( KSIPProfileRegistered, registered );
+    if ( registered )
+        {
+        SVPDEBUG1("CSVPEmergencySession::CreateNonLISessionL, registered")
+        iEmergencySession = CMceOutSession::NewL( 
+            iMceManager, *sipProfile, *iRecipientUri );
+        ConstructAudioStreamsL();
+        }
+    else
+        {
+        CreateUnregistedSessionL();        
+        }
+    
+    CleanupStack::PopAndDestroy( 3, sip ); 
+    // CS:0 sip, sipProfileRegistry, sipProfile
+
+    SVPDEBUG1("CSVPEmergencySession::CreateNonLISessionL() OUT")
+    }
+
+// ---------------------------------------------------------------------------
+// Creates unregistered MCE session
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::CreateUnregistedSessionL()
+    {
+    SVPDEBUG1("CSVPEmergencySession::CreateUnregistedSessionL()")
+    
+    iEmergencySession = CMceOutSession::NewL( 
+        iMceManager, iIapId, *iUserAor, *iRecipientUri );
+
+    ConstructAudioStreamsL();
+    }
+
+// ---------------------------------------------------------------------------
+// Handles emergency session state change
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::SessionStateChangedL( TInt aMceStatusCode )
+    {
+    SVPDEBUG3("CSVPEmergencySession::SessionStateChangedL,\
+     status: %d,state: %d ", aMceStatusCode, iEmergencySession->State() )
+         
+    // Match TCCPSessionError
+    TInt ccpStatusCode = aMceStatusCode;     
+    TCCPError ccpError = iSVPUtility.GetCCPError( ccpStatusCode, iTone );
+    
+    // Call voip event logger with original status
+    if ( ECCPErrorNone != ccpError && KErrNotFound != iVoipProfileId )
+        {
+        iSVPUtility.LogVoipEventL( 
+            aMceStatusCode, iSipProfileId, KNullDesC, KNullDesC );
+        }        
+   
+    // Status code returns KErrNone if TCCPSessionError is not found
+    if ( KErrNone != ccpStatusCode )
+        {
+        SVPDEBUG2("CSVPEmergencySession::SessionStateChanged:\
+         error: %d", aMceStatusCode )
+
+        if ( ECCPErrorRejected == ccpError || 
+             ECCPErrorBusy == ccpError || 
+             ECCPErrorTimedOut == ccpError )
+            {     
+            SVPDEBUG1("CSVPEmergencySession::SessionStateChanged\
+             iSessionState -> Disconnecting")
+            iSessionState = MCCPCallObserver::ECCPStateDisconnecting;
+            }
+        else if ( KSVPUnsupportedMediaTypeVal == aMceStatusCode && 
+                  CMceSession::ETerminated == iEmergencySession->State() && 
+                  iPositionInformation )
+            {
+            // MT cannot handle LI: create a new session without LI
+            CreateNonLISessionL();
+            ProceedDial();
+            return;
+            }
+
+        ErrorOccurred( ccpError );
+        }
+    
+    // Handle provisional responses 1XX
+    if ( KSVPRingingVal == aMceStatusCode || 
+         KSVPForwardedVal == aMceStatusCode || 
+         KSVPQueuedVal == aMceStatusCode || 
+         KSVPSessionProgressVal == aMceStatusCode )
+        {        
+        // Response received, stop emergency timer
+        StopTimer( KSVPEmergencyExpired );
+
+        if ( KSVPRingingVal == aMceStatusCode )
+            {
+            SVPDEBUG1(
+            "CSVPEmergencySession::SessionStateChanged, 180 Ringing received")
+            iEmergencyObserver->CallStateChanged( 
+                MCCPCallObserver::ECCPStateConnecting, NULL );
+            }
+        }
+
+    switch( iEmergencySession->State() )
+        {
+        case CMceSession::EEstablished:
+            {
+            StopTimers();
+            
+            // Save state because it may change while checking priorities
+            MCCPCallObserver::TCCPCallState ccpState = State();
+            
+            if ( SVPAudioUtility::MmfPriorityUpdateNeededL( 
+                     iEmergencySession->Streams() ) )
+                {
+                CheckMmfPrioritiesForDtmfL( iEmergencySession->Streams() );
+                }
+            
+            UpdateKeepAliveL();
+            
+            SVPAudioUtility::EnableSpeakerSinksL( 
+                iEmergencySession->Streams() );
+            
+            iEmergencyObserver->CallStateChanged( ccpState, NULL );
+            break;
+            }
+        case CMceSession::EAnswering:
+        case CMceSession::EReserving:
+        case CMceSession::EIncoming:
+        case CMceSession::EOffering:
+            {
+            SVPDEBUG1("CSVPEmergencySession:SessionStateChanged, no action")
+            break;
+            }
+        case CMceSession::ECancelling:
+        case CMceSession::EIdle:
+        case CMceSession::ETerminating:
+        case CMceSession::EProceeding:
+            {
+            SVPDEBUG1("CSVPEmergencySession:SessionStateChanged:\
+             Callback state change")
+            iEmergencyObserver->CallStateChanged( State(), NULL );
+            break;
+            }
+        case CMceSession::ETerminated:
+            {
+            SVPDEBUG1("CSVPEmergencySession::SessionStateChanged, terminated")
+            iSessionState = MCCPCallObserver::ECCPStateDisconnecting;
+            StartTimerL( KSVPTerminatingTime, KSVPTerminationTimerExpired );
+            iEmergencyObserver->CallStateChanged( State(), NULL );
+            break;
+            }
+        default:
+            {
+            SVPDEBUG1("CSVPEmergencySession:SessionStateChanged: default")
+            break;
+            }
+        }
+        
+    SVPDEBUG1("CSVPEmergencySession::SessionStateChanged Out")
+    }
+
+// ---------------------------------------------------------------------------
+// Determines if dialing can be proceeded
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::ProceedDial()
+    {
+    SVPDEBUG1("CSVPEmergencySession::ProceedDial()")
+    
+    if ( iIsDialed && 
+         iIsLIRequestReady && 
+         iEmergencySession &&
+         iEmergencySession->ConnectionActive() )
+        {
+        TRAPD( err, DialL() );
+        if ( err )
+            {
+            SVPDEBUG2("CSVPEmergencySession::ProceedDial(), error: %d", err)
+            ErrorOccurred( ECCPErrorGeneral );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::DialL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::DialL()
+    {
+    SVPDEBUG1("CSVPEmergencySession::DialL()")
+    
+    // Add priority header
+    CDesC8ArrayFlat* headers = new ( ELeave ) CDesC8ArrayFlat( 1 );
+    CleanupStack::PushL( headers ); // CS:1
+    headers->AppendL( KSVPEmergencyPriorityEmergency() );
+    
+    // Add location related headers
+    if ( iPositionInformation && iUserAor )
+        {
+        // Create content headers
+        CDesC8ArrayFlat* contentHeaders = new ( ELeave ) CDesC8ArrayFlat( 1 );
+        CleanupStack::PushL( contentHeaders ); // CS:2
+
+        // Content-ID: alice at atlanta.example.com
+        HBufC8* contentIdValue = ParseContentIdL( *iUserAor );
+        CleanupStack::PushL( contentIdValue ); // CS:3
+
+        HBufC8* contentId = HBufC8::NewLC( 
+            KSVPEmergencyContentIdName().Length() + 
+            contentIdValue->Length() ); // CS:4
+        ( contentId->Des() ).Copy( KSVPEmergencyContentIdName() );
+        ( contentId->Des() ).Append( *contentIdValue );
+
+        contentHeaders->AppendL( *contentId );
+        CleanupStack::PopAndDestroy( contentId ); // CS:3
+
+        // Geolocation: <cid:alice at atlanta.example.com>;
+        // inserted-by=alice at atlanta.example.com;recipient=endpoint
+        HBufC8* cidValue = ParseCidL( *contentIdValue );
+        CleanupStack::PushL( cidValue ); // CS:4
+        
+        HBufC8* geolocation = HBufC8::NewL( 
+            KSVPEmergencyGeolocation().Length() + 
+            cidValue->Length() + 
+            KSVPEmergencyTagInsertedBy().Length() + 
+            contentIdValue->Length() + 
+            KSVPEmergencyTagRecipientEndpoint().Length() );
+        ( geolocation->Des() ).Copy( KSVPEmergencyGeolocation() );
+        ( geolocation->Des() ).Append( *cidValue );
+        ( geolocation->Des() ).Append( KSVPEmergencyTagInsertedBy() );
+        ( geolocation->Des() ).Append( *contentIdValue );
+        ( geolocation->Des() ).Append( KSVPEmergencyTagRecipientEndpoint() );
+        
+        // cidValue, contentIdValue CS:2
+        CleanupStack::PopAndDestroy( 2, contentIdValue );
+        CleanupStack::PushL( geolocation ); // CS:3
+        headers->AppendL( *geolocation );
+        CleanupStack::PopAndDestroy( geolocation ); // CS:2
+
+        // Accept: application/pidf+xml
+        headers->AppendL( KSVPEmergencyAcceptApplicationSdp() );
+
+        // Content-Type: application/pidf+xml
+        HBufC8* contentType = HBufC8::NewLC( 
+            KSVPEmergencyApplicationPidfXml().Length() ); // CS:3
+        ( contentType->Des() ).Copy( KSVPEmergencyApplicationPidfXml() );
+
+        // Establish call
+        ( ( CMceOutSession* )iEmergencySession )->EstablishL( 
+            iSessionExpires, 
+            headers, 
+            contentType, 
+            iPositionInformation->AllocL(), 
+            contentHeaders );
+
+        // contentType, contentHeaders, Ownership transferred CS:1
+        CleanupStack::Pop( 2, contentHeaders );
+        }
+    else
+        {
+        ( ( CMceOutSession* )iEmergencySession )->EstablishL( 
+            iSessionExpires, headers );
+        }
+    CleanupStack::Pop( headers ); // Ownership transferred, CS:0
+    
+    // Start INVITE timer in case remote end does not respond
+    StartTimerL( KSVPInviteTimer, KSVPInviteTimerExpired );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::ConstructAudioStreamsL
+// ---------------------------------------------------------------------------
+//  
+void CSVPEmergencySession::ConstructAudioStreamsL()
+    {
+    SVPDEBUG1( "CSVPEmergencySession::ConstructAudioStreamsL In" )
+
+    // OUT STREAM
+    CMceAudioStream* audioOutStream = CMceAudioStream::NewLC(); // CS:1
+    // Set microphone as audio out source, only one source at a time    
+    CMceMicSource* mic = CMceMicSource::NewLC(); // CS:2
+    audioOutStream->SetSourceL( mic );
+    CleanupStack::Pop( mic ); // CS:1
+    CMceRtpSink* rtpSink = CMceRtpSink::NewLC(); // CS:2
+	audioOutStream->AddSinkL( rtpSink );
+	CleanupStack::Pop( rtpSink ); // CS:1
+  
+    // IN STREAM
+    CMceAudioStream* audioInStream = CMceAudioStream::NewLC(); // CS:2
+	CMceRtpSource* rtpSource = CMceRtpSource::NewLC( 
+	    KSvpJitterBufferLength, 
+	    KSvpJitterBufferThreshold, 
+	    KSvpStandbyTimerInMillisecs ); // CS:3
+	audioInStream->SetSourceL( rtpSource );
+	CleanupStack::Pop( rtpSource ); // CS:2
+	// Set speaker as audio in sink	
+	CMceSpeakerSink* speakerSink = CMceSpeakerSink::NewLC(); // CS:3
+	audioInStream->AddSinkL( speakerSink );
+	CleanupStack::Pop( speakerSink ); // CS:2
+
+	// Bind "audio out" stream to "audio in" stream
+	audioOutStream->BindL( audioInStream );
+	CleanupStack::Pop( audioInStream ); // CS: 1
+	
+    iEmergencySession->AddStreamL( audioOutStream );
+    CleanupStack::Pop( audioOutStream ); // CS: 0
+    
+    // Modify QoS preconditions off
+    iEmergencySession->SetModifierL( 
+        KMcePreconditions, KMcePreconditionsNotUsed );
+        
+    // Modify Old way hold on
+    iEmergencySession->SetModifierL( 
+        KMceMediaDirection, KMceMediaDirectionWithAddress );
+
+    SVPDEBUG2("CSVPEmergencySession::ConstructAudioStreamsL, in codecs: %d", 
+        audioInStream->Codecs().Count())
+    SVPDEBUG2("CSVPEmergencySession::ConstructAudioStreamsL, out codecs: %d", 
+        audioOutStream->Codecs().Count())
+
+    // Set keep-alive value
+    SetKeepAlive();
+    
+    // Add codecs to audiostream
+    iSVPUtility.SetAudioCodecsForEmergencyL( 
+        *audioInStream, iKeepAlive, iVoipProfileId );
+    
+    audioOutStream->SetLocalMediaPortL( audioInStream->LocalMediaPort() );
+    
+    iSVPUtility.UpdateJitterBufferSizeL( *rtpSource );
+    
+    // Set MMF priorities and preferences to codecs
+    iSVPUtility.SetDtmfMode( SVPAudioUtility::SetPriorityCodecValuesL( 
+        *audioInStream, *audioOutStream ) );
+                                         
+    SVPDEBUG1( "CSVPEmergencySession::ConstructAudioStreamsL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// Sets keep-alive value
+// ---------------------------------------------------------------------------
+//  
+void CSVPEmergencySession::SetKeepAlive()
+    {
+    SVPDEBUG1("CSVPEmergencySession::SetKeepAlive()")
+    
+    // Get keep-alive value, do not leave: return default value instead
+    TBool found( EFalse );
+    TRAPD( errKeepAlive, 
+        found = iSVPUtility.GetKeepAliveByIapIdL( iIapId, iKeepAlive ) )
+    if ( errKeepAlive || !found )
+        {
+        TRAP( errKeepAlive, found = iSVPUtility.GetKeepAliveByAORL( 
+            *iUserAor, iKeepAlive ) )
+        if ( errKeepAlive || !found )
+            {
+            iKeepAlive = KSVPDefaultUDPRefreshInterval;
+            }
+        }
+    
+    SVPDEBUG2("CSVPEmergencySession::KeepAlive, value: %d", iKeepAlive)
+    }
+
+// ---------------------------------------------------------------------------
+// Updates keepalive parameters for MCE session
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::UpdateKeepAliveL()
+    {
+    SVPDEBUG1("CSVPEmergencySession::UpdateKeepAliveL()")
+    
+    const RPointerArray<CMceMediaStream>& streamArray = 
+        iEmergencySession->Streams();
+    TInt streamCount( streamArray.Count() );
+    TBool cnInAnswer( EFalse );
+    
+    for ( TInt i = 0; i < streamCount; i++ )
+        {
+        CMceAudioStream* stream = 
+            static_cast<CMceAudioStream*>( streamArray[i] );
+        if ( iSVPUtility.IsComfortNoise( *stream ) )
+            {
+            cnInAnswer = ETrue;
+            iSVPUtility.SetCNKeepAliveL( *stream, iKeepAlive );
+            }
+        }
+    
+    if ( !cnInAnswer )
+        {
+        while( streamCount-- )
+            {
+            CMceAudioStream* stream = 
+                static_cast<CMceAudioStream*>( streamArray[streamCount] );
+            iSVPUtility.SetKeepAliveL( *stream, iKeepAlive );
+            }
+        }
+    
+    iEmergencySession->UpdateL();
+    }
+
+// ---------------------------------------------------------------------------
+// Check audio priorities in audio streams
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::CheckMmfPrioritiesForDtmfL(
+    const RPointerArray<CMceMediaStream>& aAudioStreams ) const
+    {
+    SVPDEBUG1( "CSVPEmergencySession::CheckMmfPrioritiesForDtmfL In" )
+    
+    RPointerArray<CMceMediaSource> micsToEnable;
+    CleanupClosePushL( micsToEnable );
+    const TInt streamCount( aAudioStreams.Count() );
+    
+    // First disable the mic before doing any priority updating.
+    for ( TInt s = 0; s < streamCount; s++ )
+        {
+        CMceMediaSource* mic = aAudioStreams[s]->Source();
+        
+        if ( mic && KMceMicSource == mic->Type() && mic->IsEnabled() )
+            {
+            mic->DisableL();
+            micsToEnable.AppendL( mic );
+            }
+        mic = NULL;
+        
+        if ( aAudioStreams[s]->BoundStream() )
+            {
+            mic = aAudioStreams[s]->BoundStreamL().Source();
+            if ( mic && KMceMicSource == mic->Type() && mic->IsEnabled() )
+                {
+                mic->DisableL();
+                micsToEnable.AppendL( mic );
+                }
+            }
+        mic = NULL;
+        }
+    
+    // Set the correct priority and preference values.
+    for ( TInt k = 0; k < streamCount; k++ )
+        {
+        if ( KMceAudio == aAudioStreams[k]->Type() && 
+            aAudioStreams[k]->BoundStream() )
+            {
+            CMceAudioStream* stream = 
+                static_cast<CMceAudioStream*>( aAudioStreams[k] );
+            
+            TBool dtmfMode = EFalse;
+            if ( SVPAudioUtility::IsDownlinkStream( *stream ) )
+                {
+                dtmfMode = SVPAudioUtility::SetPriorityCodecValuesL( 
+                    *stream,
+                    static_cast<CMceAudioStream&>( stream->BoundStreamL() ) );
+                }
+            else
+                {
+                dtmfMode = SVPAudioUtility::SetPriorityCodecValuesL(
+                    static_cast<CMceAudioStream&>( stream->BoundStreamL() ),
+                    *stream );
+                }
+            
+            iSVPUtility.SetDtmfMode( dtmfMode );
+            }
+        }
+        
+    // Priorities are now correct, so update the session.
+    iEmergencySession->UpdateL();
+    
+    // Now enable mics after we have correct priorities.
+    const TInt mics = micsToEnable.Count();
+    for ( TInt t = 0; t < mics; t++ )
+        {
+        micsToEnable[t]->EnableL();
+        }
+    
+    // Mics not owned
+    CleanupStack::PopAndDestroy( &micsToEnable );
+    
+    SVPDEBUG1( "CSVPEmergencySession::CheckMmfPrioritiesForDtmfL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::StartTimerL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::StartTimerL( TInt aMilliSeconds, TInt aTimerId )
+    {
+    CSVPTimer* timer = CSVPTimer::NewL( *this, aTimerId );
+    timer->SetTime( aMilliSeconds );
+    iTimers.Append( timer );
+    }
+
+// ---------------------------------------------------------------------------
+// Stop timer
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::StopTimer( TInt aTimerId )
+    {
+    SVPDEBUG2("CSVPEmergencySession::StopTimer, ID: %d", aTimerId)
+
+    for ( TInt i = 0; i < iTimers.Count(); )
+        {
+        if ( aTimerId == iTimers[i]->Id() )
+            {
+            iTimers[i]->Stop();
+            delete iTimers[i];
+            iTimers.Remove( i );
+            }
+        else
+            {
+            i++;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPEmergencySession::StopTimers
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::StopTimers()
+    {
+    SVPDEBUG1("CSVPEmergencySession::StopTimers")
+    
+    while ( iTimers.Count() )
+        {
+        iTimers[0]->Stop();
+        delete iTimers[0];
+        iTimers.Remove( 0 );   
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Notify client about an error
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::ErrorOccurred( TCCPError aError )
+    {
+    SVPDEBUG2("CSVPEmergencySession::ErrorOccurred: %d", (TInt)aError)
+    
+    if ( iIsLastProfile )
+        {
+        iEmergencyObserver->ErrorOccurred( ECCPEmergencyFailed, NULL );
+        }
+    else
+        {
+        iEmergencyObserver->ErrorOccurred( aError, NULL );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Traps leaves of RequestPositionL
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::RequestPosition( TUint32 aIapId )
+    {
+    SVPDEBUG1( "CSVPEmergencySession::RequestPosition" )
+    iIsLIRequestReady = EFalse;
+    TRAP_IGNORE( RequestPositionL( aIapId ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Initializes position provider and requests for position information
+// ---------------------------------------------------------------------------
+//
+void CSVPEmergencySession::RequestPositionL( TUint32 aIapId )
+    {
+    iPositioningProvider = CSVPPositioningProvider::NewL( 
+        KSVPEmergencyPositioningPriority, *this );
+    if ( iPositioningProvider )
+        {
+        iPositioningProvider->OpenModuleL( 
+            KSVPEmergencyDhcpDefaultPsyModuleId );
+        iPositioningProvider->MakePositioningRequestL( 
+            aIapId, 
+            KSVPEmergencyApplicationName, 
+            KSVPEmergencyPositioningTimeout );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Parses content ID from URI: removes "sip(s):" prefix, if one exists
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSVPEmergencySession::ParseContentIdL( const TDesC8& aUri )
+    {
+    HBufC8* contentId = HBufC8::NewLC( aUri.Length() ); // CS:1
+    ( contentId->Des() ).Copy( aUri );
+    if ( 0 == contentId->Find( KSVPSipPrefix ) )
+        {
+        contentId->Des().Delete( 0, KSVPSipPrefixLength );
+        }
+    else if ( 0 == contentId->Find( KSVPSipsPrefix ) )
+        {
+        contentId->Des().Delete( 0, KSVPSipsPrefixLength );
+        }
+    CleanupStack::Pop( contentId ); // CS:0
+    contentId = contentId->ReAllocL( contentId->Length() );
+    return contentId;
+    }
+
+// ---------------------------------------------------------------------------
+// Parses cid: adds "cid:" prefix and brackets
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSVPEmergencySession::ParseCidL( const TDesC8& aContentId )
+    {
+    HBufC8* cid = HBufC8::NewL( 
+        KSVPLeftBracketMark().Length() + 
+        KSVPCidPrefix().Length() + 
+        aContentId.Length() + 
+        KSVPRightBracketMark().Length() );
+
+    TPtr8 cidPtr = cid->Des();
+    cidPtr.Copy( KSVPLeftBracketMark() );
+    cidPtr.Append( KSVPCidPrefix() );
+    cidPtr.Append( aContentId );
+    cidPtr.Append( KSVPRightBracketMark() );
+    
+    return cid;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpforwardprovider.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Forward functionality provider
+*
+*/
+
+
+
+#include "svpforwardprovider.h"
+#include "svpmosession.h"
+#include "svplogger.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSVPForwardProvider::CSVPForwardProvider
+// ---------------------------------------------------------------------------
+//
+CSVPForwardProvider::CSVPForwardProvider()
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPForwardProvider::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPForwardProvider::ConstructL( CSVPMoSession& aSession )
+    {
+    
+    SVPDEBUG1( "CSVPForwardProvider::ConstructL" );
+    iMoSession = const_cast< CSVPMoSession* >( &aSession );
+    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPForwardProvider::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPForwardProvider* CSVPForwardProvider::NewL( CSVPMoSession& aSession )
+    {
+    CSVPForwardProvider* self = new( ELeave ) CSVPForwardProvider;
+    CleanupStack::PushL( self );
+    self->ConstructL( aSession );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CSVPForwardProvider::~CSVPForwardProvider
+// ---------------------------------------------------------------------------
+//
+CSVPForwardProvider::~CSVPForwardProvider()
+    {
+    
+    }
+
+
+
+
+// ---------------------------------------------------------------------------
+// From class MCCPForwardProvider.
+// CSVPForwardProvider::GetForwardAddressChoicesL
+// ---------------------------------------------------------------------------
+//
+const CDesC8Array& CSVPForwardProvider::GetForwardAddressChoicesL()
+    {
+    
+    SVPDEBUG1( "CSVPForwardProvider::GetForwardAddressChoicesL" );
+    return iMoSession->GetForwardAddressChoicesL();
+    
+    }
+    
+// ---------------------------------------------------------------------------
+// From class MCCPForwardProvider.
+// CSVPForwardProvider::ForwardToAddressL
+// ---------------------------------------------------------------------------
+//
+void CSVPForwardProvider::ForwardToAddressL( const TInt aIndex )
+    {
+    
+    SVPDEBUG1( "CSVPForwardProvider::ForwardToAddressL" );
+    iMoSession->ForwardToAddressL( aIndex );
+    
+    }
+
+// ---------------------------------------------------------------------------
+// From class MCCPForwardProvider.
+// CSVPForwardProvider::AddObserverL
+// ---------------------------------------------------------------------------
+//
+void CSVPForwardProvider::AddObserverL( const MCCPForwardObserver& aObserver )
+    {
+    
+    SVPDEBUG1( "CSVPForwardProvider::AddObserverL" );
+    iMoSession->AddForwardObserverL( aObserver );
+    
+    }
+    
+// ---------------------------------------------------------------------------
+// From class MCCPForwardProvider.
+// CSVPForwardProvider::RemoveObserver
+// ---------------------------------------------------------------------------
+//
+TInt CSVPForwardProvider::RemoveObserver( const MCCPForwardObserver& aObserver )
+    {
+    
+    SVPDEBUG1( "CSVPForwardProvider::RemoveObserver" );
+    return iMoSession->RemoveForwardObserver( aObserver );
+    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpmosession.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,963 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Representation of SVP Mo session         
+*
+*/
+
+#include <mcesecureoutsession.h>
+#include <badesca.h>
+#include <mccpforwardobserver.h>
+#include <uriutilscommon.h>      // TUriUtilsError
+#include <sipcodecerr.h>
+#include <crcseprofileentry.h>
+#include <crcseprofileregistry.h>
+
+#include "svpmosession.h"
+#include "svpuriparser.h"
+#include "svpforwardprovider.h"
+#include "svpsipconsts.h"
+#include "svplogger.h"
+#include "svputility.h"
+#include "svpcleanupresetanddestroy.h"
+
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::CSVPMoSession
+// ---------------------------------------------------------------------------
+//
+CSVPMoSession::CSVPMoSession( TUint32 aSessionExpires, 
+                              TMceTransactionDataContainer& aContainer,
+                              MSVPSessionObserver& aObserver, 
+                              CSVPUtility& aSVPUtility,
+                              CSVPRtpObserver& aRtpObserver ) 
+    : CSVPSessionBase( aContainer, aObserver, aSVPUtility, aRtpObserver ),
+      iSessionExpires( aSessionExpires )
+    {
+    SVPDEBUG1( "CSVPMoSession::CSVPMoSession In" )
+    SVPDEBUG1( "CSVPMoSession::CSVPMoSession Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPMoSession::ConstructL( 
+    CMceManager& aMceManager, 
+    CRCSEProfileEntry& aVoipProfile, 
+    const CCCPCallParameters& aParameters,
+    const TDesC8& aRecipient,
+    TUint32& aSecurityStatus,
+    CDesC8Array* aUserHeaders )
+    {
+    SVPDEBUG1( "CSVPMoSession::ConstructL In" )
+    
+    TBool userEqphone = EFalse;
+    TInt err = KErrNone;
+    
+    __ASSERT_ALWAYS( aVoipProfile.iIds.Count(), User::Leave( KErrArgument ) );
+    iSipProfileId = aVoipProfile.iIds[ 0 ].iProfileId; // save Sip profile id
+    iVoIPProfileId = aVoipProfile.iId; // save VoIP profile id
+    
+    iSecondCallRecipient.Copy( aRecipient ); // save recipient
+    SVPDEBUG2( "CSVPMoSession::ConstructL iSecondCallRecipient length: %d",
+        iSecondCallRecipient.Length() )
+    
+    // Copy call parameters
+     iCallParameters = aParameters.CloneL();
+
+    // create SIP and ProfileRegistry for URI handling
+    CSIP* sip = CSIP::NewL( KSVPUid, *this );
+    CleanupStack::PushL( sip );
+    SVPDEBUG1( "CSVPMoSession::ConstructL sip CREATED" )
+
+    CSIPProfileRegistry* sipProfileRegistry = CSIPProfileRegistry::NewL( *sip, *this );
+    CleanupStack::PushL( sipProfileRegistry );
+    SVPDEBUG1( "CSVPMoSession::ConstructL sipProfileRegistry CREATED" )
+
+    // retrieve SIP profile by using sip profile id
+    CSIPProfile* profile = sipProfileRegistry->ProfileL( iSipProfileId );
+    CleanupStack::PushL( profile );
+
+    // Not secure call event is sent later according this 
+    iCallEventToBeSent = MCCPCallObserver::ECCPSecureNotSpecified;
+
+    if ( KSVPStatusNonSecure != aSecurityStatus )
+        {
+        // set secure status to 0 if no security mechanism found from SIP profile
+        iSVPUtility.ResolveSecurityMechanismL( *profile, aSecurityStatus );
+        }
+    
+    // Check CLIR setting and add relevant information in fromheader.
+    HBufC8* fromheader = iSVPUtility.SetMoFromHeaderLC( aSecurityStatus );
+    
+    // check if user=phone needs to be added to outgoing INVITE
+    if ( CRCSEProfileEntry::EOn == aVoipProfile.iUserPhoneUriParameter )
+        {
+        userEqphone = ETrue;
+        }
+    
+    // complete sip uri according to the security status
+    HBufC8* uri = CompleteUriL( aRecipient,
+                                *profile,
+                                aSecurityStatus,
+                                userEqphone );
+    CleanupStack::PushL( uri );
+    
+    // Add P-Preferred-Identity header if CLIR is on  
+    if ( iSVPUtility.IsCLIROnL() )
+        {
+        HBufC8* userAor = NULL;
+        const MDesC8Array* aors( NULL ); // Array of registered address of records
+        
+        TInt result = profile->GetParameter( KSIPRegisteredAors, aors );
+        
+        if ( !aors || aors->MdcaCount() == KErrNone )
+            {
+            SVPDEBUG1( "CSVPMoSession::CompleteUriL - registered aors array empty" )
+            const TDesC8* userAorStr = NULL;
+            User::LeaveIfError( profile->GetParameter( KSIPUserAor, userAorStr ) );
+            SVPDEBUG2( "CSVPMoSession::CompleteUriL - KSIPUserAor result: %d", result )
+            userAor = userAorStr->AllocLC();
+            }
+        else
+            {
+            userAor = aors->MdcaPoint( 0 ).AllocLC();
+            }    
+
+        iSVPUtility.AddPPreferredIdentityToUserHeadersL( 
+            *aUserHeaders, *userAor );
+        CleanupStack::PopAndDestroy(); //userAor
+        }
+    
+    // create Mce out session 
+    if ( KSVPStatusNonSecure == aSecurityStatus )
+        {
+        // create non-secure session
+        // must be trapped, so that leave code can be changed to KErrArgument
+        // if uri contains error-causing characters
+        TRAP( err, iSession = CMceOutSession::NewL( aMceManager, 
+                *profile, *uri, fromheader ) );
+        SVPDEBUG2( "CSVPMoSession::ConstructL NonSecure trapped: %d", err )
+        
+        if ( KErrNone == err )
+            {
+            // set iSecured flag so UI can show right icon
+            iSecured = EFalse;
+            }
+        }
+    else if ( KSVPStatusSecurePreferred == aSecurityStatus )
+        {
+        TRAP( err, iSession = CMceSecureOutSession::NewL(
+                aMceManager, *profile, *uri, fromheader ) );
+        SVPDEBUG2( "CSVPMoSession::ConstructL SecurePreferred trapped: %d", err )
+        
+        if ( KErrNone == err )
+            {
+            // set crypto contexts
+            SetCryptoContextL();
+            // set secured flag to ETrue to indicate that this is secure session
+            SetSecurePreferred( ETrue );
+            // set iSecured flag so UI can show right icon
+            iSecured = ETrue;
+            }
+        }
+    else
+        {
+        TRAP( err, iSession = CMceSecureOutSession::NewL(
+                aMceManager, *profile, *uri, fromheader ) );
+        SVPDEBUG2( "CSVPMoSession::ConstructL SetSecureMandatory trapped: %d", err )
+        
+        if ( KErrNone == err )
+            {
+            // set crypto contexts
+            SetCryptoContextL();
+            // set secure mandatory flag ETrue, only secure session allowed       
+            SetSecureMandatory( ETrue );
+            // set iSecured flag so UI can show right icon
+            iSecured = ETrue;
+            }
+        }
+    
+    if ( KUriUtilsErrInvalidUserInfo == err ||      // -5016
+         KUriUtilsErrInvalidHost == err     ||      // -5017
+         KUriUtilsErrInvalidPort == err     ||      // -5018
+         KUriUtilsErrInvalidHeaders == err  ||      // -5022
+         KErrSipCodecTokenizer == err       ||      // -17751
+         KErrSipCodecFromOrToParams == err )        // -17775
+        {
+        User::Leave( KErrArgument );
+        }
+    else if ( KErrNone != err )
+        {
+        User::Leave( KErrDisconnected );
+        }
+    else
+        {
+        //For PC-Lint Note: #961
+        }
+    
+    CleanupStack::PopAndDestroy( uri );
+    CleanupStack::Pop( fromheader );
+    
+    // Get keep-alive timer value
+    TUint32 iapId = 0;
+    TBool found = EFalse;
+    
+    profile->GetParameter( KSIPAccessPointId, iapId );
+    TRAPD( errKeepAlive, found = iSVPUtility.GetKeepAliveByIapIdL( iapId, iKeepAliveValue ) );
+    SVPDEBUG3( "CSVPMoSession::ConstructL:GetKeepAliveByIapIdL: errKeepAlive = %d found = %d",
+            errKeepAlive, found )
+    
+    if ( !found )
+        {
+        const TDesC8* aor;
+        profile->GetParameter( KSIPUserAor, aor );
+        TRAP( errKeepAlive, found = iSVPUtility.GetKeepAliveByAORL( *aor, iKeepAliveValue ) );
+        SVPDEBUG3( "CSVPMoSession::ConstructL:GetKeepAliveByAORL: errKeepAlive = %d found = %d",
+                errKeepAlive, found )
+        }
+    
+    CleanupStack::PopAndDestroy( profile );
+    CleanupStack::PopAndDestroy( sipProfileRegistry );
+    CleanupStack::PopAndDestroy( sip );
+    
+    // constructs audio streams for this session and adds codecs to streams and
+    // streams to session
+    ConstructAudioStreamsL();
+    InitializePropertyWatchingL();
+    
+    // Create forward provider
+    iForwardProvider = CSVPForwardProvider::NewL( *this );
+    iForwardAddressList = new (ELeave) CDesC8ArrayFlat( KSVPContactArrayGranularity );
+    
+    // Cant leave anymore, store heap data
+    iUserHeaders = aUserHeaders; // save userheaders
+    iMceManager = &aMceManager; // not own
+    
+    SVPDEBUG1( "CSVPMoSession::ConstructL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPMoSession* CSVPMoSession::NewL( 
+    CMceManager& aMceManager,
+    const TDesC8& aRecipient,
+    CRCSEProfileEntry& aVoipProfile,  
+    const CCCPCallParameters& aParameters,
+    TMceTransactionDataContainer& aContainer,                                    
+	MSVPSessionObserver& aObserver,
+	CSVPUtility& aSVPUtility,
+	CSVPRtpObserver& aRtpObserver,
+	TUint32& aSecurityStatus,
+	CDesC8Array* aUserHeaders )
+    {
+    CSVPMoSession* self = new( ELeave ) CSVPMoSession(
+    		aVoipProfile.iSIPSessionExpires, aContainer, aObserver,
+    		aSVPUtility, aRtpObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL( aMceManager, 
+                      aVoipProfile,
+                      aParameters, 
+                      aRecipient, 
+                      aSecurityStatus,
+                      aUserHeaders );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::~CSVPMoSession
+// ---------------------------------------------------------------------------
+//
+CSVPMoSession::~CSVPMoSession()
+    {
+    SVPDEBUG1( "CSVPMoSession::~CSVPMoSession In" )
+   
+    delete iForwardProvider;
+    
+    if ( iUserHeaders )
+        {
+        iUserHeaders->Reset();
+        delete iUserHeaders;
+        }
+
+    if ( iForwardAddressList )
+        {
+        iForwardAddressList->Reset();
+        delete iForwardAddressList;
+        }
+    
+    SVPDEBUG1( "CSVPMoSession::~CSVPMoSession Out" )
+    }
+  
+// ---------------------------------------------------------------------------
+// CSVPMoSession::CompleteUriL
+// ---------------------------------------------------------------------------
+//  
+HBufC8* CSVPMoSession::CompleteUriL( const TDesC8& aRecipient, 
+                                     const CSIPProfile& aSIPProfile,
+                                     const TUint32& aSecurityStatus,
+                                     TBool aUserEqualsPhoneRequired )
+    {
+    SVPDEBUG1( "CSVPMoSession::CompleteUriL In" )
+
+    // create instance of uri parser
+    CSVPUriParser* uriParser = CSVPUriParser::NewLC();
+    
+    HBufC8* userAor( NULL );
+    const MDesC8Array* aors( NULL ); // Array of registered address of records
+    
+    TInt result = aSIPProfile.GetParameter( KSIPRegisteredAors, aors );
+    
+    if ( !aors || aors->MdcaCount() == KErrNone )
+        {
+        SVPDEBUG1( "CSVPMoSession::CompleteUriL - registered aors array empty" )
+        const TDesC8* userAorStr = NULL;
+        result = aSIPProfile.GetParameter( KSIPUserAor, userAorStr );
+        SVPDEBUG2( "CSVPMoSession::CompleteUriL - KSIPUserAor result: %d", result )
+        userAor = HBufC8::NewLC( userAorStr->Length() );
+        userAor->Des().Copy( *userAorStr );
+        }
+    else
+        {
+        #ifdef _DEBUG
+            TBuf<KSvpMaxDebugBufferSize> tmpUri;
+            for ( TInt i = 0; i < aors->MdcaCount(); i++ )
+                {
+                tmpUri.Copy( aors->MdcaPoint( i ) );
+                SVPDEBUG3( "CSVPMoSession::CompleteUriL - registered AOR[%d]: %S", i, &tmpUri )
+                }
+        #endif
+        userAor = HBufC8::NewLC( aors->MdcaPoint( 0 ).Length() );
+        userAor->Des().Copy( aors->MdcaPoint( 0 ) );
+        }
+    // set service id to uri parser, needed for setting user=phone
+    uriParser->SetUserEqualsPhoneRequiredL( aUserEqualsPhoneRequired );
+    
+    // complete URI by security status preference
+    HBufC8* uri = NULL;
+    if ( KSVPStatusNonSecure == aSecurityStatus )
+        {
+        SVPDEBUG1( "CSVPMoSession::CompleteUriL Completing SIP URI..." )
+        
+        // user tries to call to sips: -uri, secpref -> 0
+        // so iTLSNotInUse is set, so that user can be notified
+        // about non secure session
+        if ( KErrNotFound != aRecipient.Find( KSVPSipsPrefix ) )
+        	{
+        	iTLSNotInUse = ETrue;
+        	}
+        uri = uriParser->CompleteSipUriL( aRecipient, *userAor );
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPMoSession::CompleteUriL Completing SIPS URI..." )
+        uri = uriParser->CompleteSecureSipUriL( aRecipient, *userAor );
+        }
+    CleanupStack::PopAndDestroy( userAor );
+    CleanupStack::PopAndDestroy( uriParser );
+    
+    SVPDEBUG1( "CSVPMoSession::CompleteUriL Out" )
+    return uri;
+    }
+    
+
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::CreateNonSecureSessionL
+// ---------------------------------------------------------------------------
+//    
+void CSVPMoSession::CreateNonSecureSessionL( CMceManager& aMceManager )
+    {
+    SVPDEBUG1( "CSVPMoSession::CreateNonSecureSessionL In" )
+    
+    TBool userEqphone = EFalse;
+    
+    // save old secure session first, will be deleted later from SVPController
+    delete iTempSecSession;
+    iTempSecSession = iSession;
+    
+    // set iSecured flag so UI can show right icon
+    iSecured = EFalse;
+
+    // set correct event to be sent later on.
+    iCallEventToBeSent = MCCPCallObserver::ECCPNotSecureCall;
+
+    // clear secure preferred flag, needed when deciding whether 
+    // old session should be deleted
+    SetSecurePreferred( EFalse );
+    
+    // create SIP and ProfileRegistry for URI handling
+    CSIP* sip = CSIP::NewL( KSVPUid, *this );
+    CleanupStack::PushL( sip );
+    CSIPProfileRegistry* sipProfileRegistry = 
+        CSIPProfileRegistry::NewL( *sip, *this );
+    CleanupStack::PushL( sipProfileRegistry );
+    
+    // retrieve SIP profile by using sip profile id
+    CSIPProfile* profile = sipProfileRegistry->ProfileL( iSipProfileId );
+    CleanupStack::PushL( profile );
+    
+    // secure preference to 0
+    TUint32 securePreference = 0;
+    
+    RPointerArray< CRCSEProfileEntry > entryArray;
+    CleanupResetAndDestroy< RPointerArray<CRCSEProfileEntry> >::PushL( entryArray );
+    CRCSEProfileRegistry* reg = CRCSEProfileRegistry::NewLC();
+    reg->FindByServiceIdL( iCallParameters->ServiceId(), entryArray ); // Get VoIP profile by service id
+    
+    // Take first entry from array
+    __ASSERT_ALWAYS( entryArray.Count(), User::Leave( KErrArgument ) );
+    CRCSEProfileEntry* entry = entryArray[0];
+    
+    // check if user=phone needs to be added to outgoing INVITE
+    if ( CRCSEProfileEntry::EOn == entry->iUserPhoneUriParameter )
+        {
+        userEqphone = ETrue;
+        }
+    
+    // cleanup
+    CleanupStack::PopAndDestroy( 2, &entryArray );    // reg, entryArray
+    
+    // complete sip uri according to the security status
+    HBufC8* uri = CompleteUriL( iSecondCallRecipient,
+                                *profile,
+                                securePreference,
+                                userEqphone );
+    CleanupStack::PushL( uri );
+    
+    // nullify iSession member, but do not delete
+    iSession = NULL;
+    iSession = CMceOutSession::NewL( aMceManager, *profile, *uri );
+    
+    CleanupStack::PopAndDestroy( uri );
+    CleanupStack::PopAndDestroy( profile );
+    CleanupStack::PopAndDestroy( 2 ); // sip & sipProfileRegistry
+    
+    // constructs audio streams for this Mo session 
+    // adds codecs to streams and streams to session 
+    ConstructAudioStreamsL();
+    
+    // Dial, finally
+    User::LeaveIfError( Dial() );
+    
+    SVPDEBUG1( "CSVPMoSession::CreateNonSecureSessionL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::Dial
+// ---------------------------------------------------------------------------
+//    
+TInt CSVPMoSession::Dial()
+    {
+    SVPDEBUG1("CSVPMoSession::Dial In" )  
+    
+    TRAPD( errDial, DialL() );
+    
+    SVPDEBUG2("CSVPMoSession::Dial Out return=%d", errDial )
+    return errDial;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::DialL
+// ---------------------------------------------------------------------------
+//    
+void CSVPMoSession::DialL()
+    {
+    SVPDEBUG1( "CSVPMoSession::DialL In" )
+    
+    ExecCbCallStateChanged( MCCPCallObserver::ECCPStateDialling );
+    
+    // inform client about non secure session 
+    if ( iTLSNotInUse )
+        {
+        ExecCbCallEventOccurred( MCCPCallObserver::ECCPNotSecureSessionWithSips );
+        }
+
+    if ( iUserHeaders && iUserHeaders->MdcaCount() )
+        {
+        CDesC8ArrayFlat* userHeaders = new ( ELeave ) CDesC8ArrayFlat( 
+            iUserHeaders->MdcaCount() );
+        CleanupStack::PushL( userHeaders ); // CS:1
+        for ( TInt i = 0; i < iUserHeaders->MdcaCount(); i++ )
+            {
+            userHeaders->AppendL( iUserHeaders->MdcaPoint( i ) );
+            }
+        static_cast<CMceOutSession*>( iSession )->EstablishL( 
+            iSessionExpires, userHeaders, NULL, NULL );
+        CleanupStack::Pop( userHeaders ); // CS:0, ownership transferred
+        }
+    else
+        {
+        static_cast<CMceOutSession*>( iSession )->EstablishL(
+            iSessionExpires, NULL, NULL, NULL );
+        }
+
+    // start INVITE timer in case remote end does not repond
+    StartTimerL( KSVPInviteTimer, KSVPInviteTimerExpired );
+    
+    SVPDEBUG1( "CSVPMoSession::DialL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::Cancel
+// ---------------------------------------------------------------------------
+//  
+TInt CSVPMoSession::Cancel()
+    {
+    SVPDEBUG1( "CSVPMoSession::Cancel() Cancel dial" )
+    TRAPD( cancelErr, static_cast<CMceOutSession*>( iSession )->CancelL() );
+    return cancelErr;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::HangUp
+// ---------------------------------------------------------------------------
+//  
+TInt CSVPMoSession::HangUp()
+    {
+    SVPDEBUG1( "CSVPMoSession::HangUp In" )
+    
+    if ( CMceSession::EOffering == iSession->State() )
+        {
+        SVPDEBUG1( "CSVPMoSession::HangUp CancelL" )
+        TRAPD( err, static_cast<CMceOutSession*>( iSession )->CancelL() );
+        
+        ExecCbCallStateChanged( MCCPCallObserver::ECCPStateDisconnecting );
+        
+        if( !err )
+            {
+            TRAPD( errTimer, StartTimerL( KSVPMoHangupTerminatingTime,
+                    KSVPHangUpTimerExpired ) );
+            
+            if ( errTimer )
+                {
+                SVPDEBUG2("CSVPSessionBase::HangUp - timer leave code=%d", errTimer )
+                ExecCbCallStateChanged( MCCPCallObserver::ECCPStateIdle );
+                }
+            else
+                {
+                iAlreadyTerminating = ETrue;
+                }
+            }
+        else
+            {
+            ExecCbCallStateChanged( MCCPCallObserver::ECCPStateIdle );
+            }
+        
+        SVPDEBUG2( "CSVPMoSession::HangUp Out return=%d", err )
+        return err;
+        }
+    else
+        {
+        TInt status = CSVPSessionBase::HangUp();
+        SVPDEBUG2( "CSVPMoSession::HangUp Out return=%d", status )
+        return status;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::Release
+// ---------------------------------------------------------------------------
+//  
+TInt CSVPMoSession::Release()
+    {
+    SVPDEBUG1( "CSVPMoSession::Release" )
+    delete this;
+    return KErrNone;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPMoSession::Hold
+// ---------------------------------------------------------------------------
+//  
+TInt CSVPMoSession::Hold()
+    {
+    SVPDEBUG1( "CSVPMoSession::Hold" )
+    return CSVPSessionBase::Hold();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::Resume
+// ---------------------------------------------------------------------------
+//  
+TInt CSVPMoSession::Resume()
+    {
+    SVPDEBUG1( "CSVPMoSession::Resume" )
+    return CSVPSessionBase::Resume();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::IsMobileOriginated
+// ---------------------------------------------------------------------------
+//  
+TBool CSVPMoSession::IsMobileOriginated() const
+    {
+    SVPDEBUG1( "CSVPMoSession::IsMobileOriginated = ETrue" )
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::SessionStateChangedL
+// ---------------------------------------------------------------------------
+//
+void CSVPMoSession::SessionStateChangedL( TInt aOrigStatus,
+    TCCPError aError, TInt aModStatus )
+    {
+    SVPDEBUG1( "CSVPMoSession::SessionStateChangedL In" )
+    SVPDEBUG2( "CSVPMoSession::SessionStateChangedL aOrigStatus=%d",
+        aOrigStatus )
+    SVPDEBUG2( "CSVPMoSession::SessionStateChangedL aError=%d",
+        aError )
+    SVPDEBUG2( "CSVPMoSession::SessionStateChangedL aModStatus=%d",
+        aModStatus )
+
+    // Check security level, cancel secure mandatory call if the control path 
+    // is unsecure and the response is 1XX or 2XX
+    CMceSession::TControlPathSecurityLevel secLevel = 
+        iSession->ControlPathSecurityLevel();
+    
+    SVPDEBUG2( "CSVPMoSession::SessionStateChangedL, security level=%d", secLevel )
+    
+    if ( SecureMandatory() && CMceSession::EControlPathUnsecure == secLevel )
+        {
+        switch ( aOrigStatus )
+            {
+            case KSVPRingingVal:
+            case KSVPForwardedVal:
+            case KSVPQueuedVal:
+            case KSVPSessionProgressVal:
+            case KSVPOKVal:
+            case KSVPAcceptedVal:
+                {
+                SVPDEBUG1( "CSVPMoSession::SessionStateChangedL, path not secure, cancel call" )
+                HangUp();
+                ExecCbErrorOccurred( ECCPSecureCallFailed );
+                return;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    
+    if ( KSVPForwardedVal == aOrigStatus )
+        {
+        SVPDEBUG1( "CSVPMoSession::SessionStateChangedL 181 Call is Being Forwarded received" )
+        
+        if ( iForwardObserver )
+            {
+            iForwardObserver->ForwardEventOccurred(
+                    MCCPForwardObserver::ECCPRemoteForwarding );
+            }
+        }
+    
+    CSVPSessionBase::SessionStateChangedL( aOrigStatus, aError, aModStatus );
+    SVPDEBUG1("CSVPMoSession::SessionStateChangedL Out" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPMoSession::ForwardProviderL
+// ---------------------------------------------------------------------------
+// 
+MCCPForwardProvider* CSVPMoSession::ForwardProviderL( const MCCPForwardObserver& aObserver )
+    {
+    SVPDEBUG1( "CSVPMoSession::ForwardProviderL" )
+    iForwardObserver = const_cast< MCCPForwardObserver* >( &aObserver );
+    return iForwardProvider;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::GetForwardAddressChoicesL
+// ---------------------------------------------------------------------------
+// 
+const CDesC8Array& CSVPMoSession::GetForwardAddressChoicesL()
+    {
+    SVPDEBUG1( "CSVPMoSession::GetForwardAddressChoicesL" )
+    return *iForwardAddressList;    
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPMoSession::ForwardToAddressL
+// ---------------------------------------------------------------------------
+// 
+void CSVPMoSession::ForwardToAddressL( const TInt aIndex )
+    {
+    SVPDEBUG1( "CSVPMoSession::ForwardToAddressL In" )
+    SVPDEBUG2( "CSVPMoSession::ForwardToAddressL aIndex=%d", aIndex )
+    
+    if ( iForwardAddressList->MdcaCount() - 1 < aIndex ||
+         KErrNone > aIndex )
+        {
+        SVPDEBUG1( "CSVPMoSession::ForwardToAddressL - Index err! -> Leave!" )
+        User::Leave( KErrArgument );
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPMoSession::ForwardToAddressL - New mce session" )
+
+        // create SIP and ProfileRegistry for URI handling
+        CSIP* sip = CSIP::NewLC( KSVPUid, *this );
+
+        CSIPProfileRegistry* sipProfileRegistry = 
+            CSIPProfileRegistry::NewLC( *sip, *this );
+
+        // retrieve SIP profile by using sip profile id
+        CSIPProfile* profile = sipProfileRegistry->ProfileL( iSipProfileId );
+        CleanupStack::PushL( profile );
+
+        RPointerArray< CRCSEProfileEntry > entryArray;
+        CleanupResetAndDestroy<
+             RPointerArray<CRCSEProfileEntry> >::PushL( entryArray );
+
+        CRCSEProfileRegistry* reg = CRCSEProfileRegistry::NewLC();
+        
+        // Get VoIP profile by service id
+        reg->FindByServiceIdL( iCallParameters->ServiceId(), entryArray );
+        
+        // Take first entry from array
+        CRCSEProfileEntry* entry = entryArray[0];
+       
+        // check if user=phone needs to be added to outgoing INVITE     
+        TBool userEqphone = EFalse;
+        if ( CRCSEProfileEntry::EOn == entry->iUserPhoneUriParameter )
+            {
+            userEqphone = ETrue;
+            }
+            
+        // cleanup
+        CleanupStack::PopAndDestroy( 2, &entryArray );    // reg, entryArray
+
+        // complete sip uri according to the security status
+        HBufC8* uri = CompleteUriL( iForwardAddressList->MdcaPoint( aIndex ),
+                *profile, SecurePreferred(), userEqphone );
+        CleanupStack::PushL( uri );
+        
+        // Delete old mce session and create a new one
+        if ( iSession )
+            {
+            delete iSession;
+            iSession = NULL;
+            }
+        
+        TRAPD( err, iSession = CMceOutSession::NewL( *iMceManager, *profile, *uri ) );
+        
+        if ( KUriUtilsErrInvalidUserInfo == err ||
+             KUriUtilsErrInvalidHost == err )
+            {
+            SVPDEBUG1( "CSVPMoSession::ForwardToAddressL KSVPBadUriError" )
+            User::Leave( KErrArgument );
+            }
+        if ( err )
+            {
+            SVPDEBUG1( "CSVPMoSession::ForwardToAddressL KErrDisconnected" )
+            User::Leave( KErrDisconnected );
+            }
+
+        // constructs audio streams for this Mo session 
+        // adds codecs to streams and streams to session 
+        ConstructAudioStreamsL();
+
+        CleanupStack::PopAndDestroy( 4 ); // uri, profile, sipProfileRegistry, sip
+        
+        User::LeaveIfError( Dial() );
+        
+        SVPDEBUG1( "CSVPMoSession::ForwardToAddressL Out" )
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::AddForwardObserverL
+// ---------------------------------------------------------------------------
+// 
+void CSVPMoSession::AddForwardObserverL( const MCCPForwardObserver& aObserver )
+    {
+    SVPDEBUG1( "CSVPMoSession::AddForwardObserverL" )
+    iForwardObserver = const_cast<MCCPForwardObserver*>( &aObserver );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::RemoveForwardObserver
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPMoSession::RemoveForwardObserver( const MCCPForwardObserver& aObserver )
+    {
+    SVPDEBUG1( "CSVPMoSession::RemoveForwardObserver In" )
+    
+    TInt err = KErrNone;
+    
+    if ( const_cast<MCCPForwardObserver*>( &aObserver ) == iForwardObserver )
+        {
+        iForwardObserver = NULL;
+        }
+    else
+        {
+        err = KErrNotFound;
+        }
+    
+    SVPDEBUG2( "CSVPMoSession::AddForwardObserverL Out return=%d", err )
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::NotifyForwardEvent
+// ---------------------------------------------------------------------------
+// 
+void CSVPMoSession::NotifyForwardEvent( TInt aEventCode )
+    {
+    SVPDEBUG1( "CSVPMoSession::NotifyForwardEvent In" )
+    SVPDEBUG2( "CSVPMoSession::NotifyForwardEvent aEventCode=%d", aEventCode )
+    
+    if ( iForwardObserver )
+        {
+        switch ( aEventCode )
+            {
+            case KSVPMultipleChoicesVal:    // 300
+                {
+                iForwardObserver->ForwardEventOccurred( 
+                    MCCPForwardObserver::ECCPMultipleChoices );
+                break;
+                }
+            case KSVPMovedPermanentlyVal:   // 301
+                {
+                iForwardObserver->ForwardEventOccurred( 
+                    MCCPForwardObserver::ECCPMovedPermanentlyEvent );
+                break;
+                }
+            case KSVPMovedTemporarilyVal:   // 302
+                {
+                iForwardObserver->ForwardEventOccurred( 
+                    MCCPForwardObserver::ECCPMovedTemporarily );
+                break;
+                }
+            default:
+                {
+                SVPDEBUG1( "CSVPMoSession::NotifyForwardEvent unknown event" )
+                break;
+                }
+            }
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPMoSession::NotifyForwardEvent iForwardObserver not exists" )
+        }
+    
+    SVPDEBUG1( "CSVPMoSession::NotifyForwardEvent Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::AddForwardAddressL
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPMoSession::AddForwardAddressL( const TDesC8& aFwdAddress )
+    {
+    SVPDEBUG1("CSVPMoSession::AddForwardAddressL In" )
+
+    // On return, result contains count of appended forward addresses 
+    // or an error code
+    TInt result( 0 );
+    TInt count( 0 );
+
+    // Indicates length of unsearched part of string
+    TInt lenRight( aFwdAddress.Length() );
+    TBool ready( EFalse );
+    
+    while ( !ready )
+        {
+        TPtrC8 remainingBuf = aFwdAddress.Right( lenRight );
+        
+        // Search comma
+        TInt offset = remainingBuf.Find( KSVPComma );
+
+        if ( KErrNotFound != offset )
+            {
+            lenRight -= offset + 1; // Remove comma from remaining string
+            }
+        else
+            {
+            // Only one forward address remains
+            offset = lenRight;
+            ready = ETrue;
+            }
+
+        // Remove unnecessary spaces from the string
+        HBufC8* address = remainingBuf.Left( offset ).AllocLC();
+        TPtr8 modAddress = address->Des();
+        modAddress.TrimAll();
+
+        iForwardAddressList->AppendL( *address );
+        CleanupStack::PopAndDestroy( address );
+
+        count++;
+        result = count;
+        }
+    
+    SVPDEBUG2( "CSVPMoSession::AddForwardAddressL Out return=%d", result )
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::ResetForwardAddressChoices
+// ---------------------------------------------------------------------------
+// 
+void CSVPMoSession::ResetForwardAddressChoices()
+    {
+    SVPDEBUG1( "CSVPMoSession::ResetForwardAddressChoices" )
+    iForwardAddressList->Reset();
+    }
+
+// SIP
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::IncomingRequest
+// ---------------------------------------------------------------------------
+//  
+void CSVPMoSession::IncomingRequest( TUint32 /*aIapId*/, 
+        CSIPServerTransaction* /*aTransaction*/ )
+    {
+    SVPDEBUG1( "CSVPMoSession::IncomingRequest" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::TimedOut
+// ---------------------------------------------------------------------------
+//                               
+void CSVPMoSession::TimedOut( CSIPServerTransaction& /*aSIPServerTransaction*/ )
+    {
+    SVPDEBUG1( "CSVPMoSession::TimedOut SIPServerTransaction timed out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::ProfileRegistryErrorOccurred
+// ---------------------------------------------------------------------------
+//  
+void CSVPMoSession::ProfileRegistryErrorOccurred( TUint32 /*aSIPProfileId*/,
+        TInt /*aError*/ )
+    {
+    SVPDEBUG1( "CSVPMoSession::ProfileRegistryErrorOccurred" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMoSession::ProfileRegistryEventOccurred
+// ---------------------------------------------------------------------------
+//  
+void CSVPMoSession::ProfileRegistryEventOccurred( TUint32 /*aProfileId*/,
+        TEvent /*aEvent*/ )
+    {
+    SVPDEBUG1( "CSVPMoSession::ProfileRegistryEventOccurred" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpmtsession.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,382 @@
+/*
+* 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:  Representation of SVP MT session              
+*
+*/
+
+#include <centralrepository.h>
+#include <mcesecureoutsession.h>
+#include <mceaudiocodec.h>
+#include <settingsinternalcrkeys.h>
+#include <mcertpsink.h>
+#include <mceaudiostream.h>
+#include <mceinsession.h>
+#include <mcemediasource.h>
+#include <mcertpsource.h>
+
+#include "svpmtsession.h"
+#include "svpaudioutility.h"
+#include "svpsipconsts.h"
+#include "svplogger.h"
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::CSVPMtSession
+// ---------------------------------------------------------------------------
+//
+CSVPMtSession::CSVPMtSession( CMceInSession* aMtSession,
+                              TMceTransactionDataContainer& aContainer,
+                              TUint32 aVoIPProfileId,
+                              MSVPSessionObserver& aObserver, 
+                              CSVPUtility& aSVPUtility,
+                              CSVPRtpObserver& aRtpObserver,
+                              TInt aKeepAliveValue,
+                              TBool aPreconditions )
+    : CSVPSessionBase( aContainer, aObserver, aSVPUtility, aRtpObserver )
+    {
+    iSession = aMtSession;
+    iVoIPProfileId = aVoIPProfileId;
+    iKeepAliveValue = aKeepAliveValue;
+    iPreconditions = aPreconditions;
+    
+    CMceSession::TControlPathSecurityLevel securityLevel =
+         aMtSession->ControlPathSecurityLevel();
+
+    // Not secure call event is sent according this, in mt case event isn't sent
+    iCallEventToBeSent = MCCPCallObserver::ECCPSecureNotSpecified;
+
+    if ( CMceSession::EControlPathSecure == securityLevel &&
+         KMceSessionSecure == aMtSession->Type() )
+        {
+        SVPDEBUG1( "CSVPMtSession::CSVPMtSession Mt secure" )
+        iSecured = ETrue;
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPMtSession::CSVPMtSession Mt non secure" )
+        iSecured = EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPMtSession* CSVPMtSession::NewL( CMceInSession* aMtSession,
+                                    TMceTransactionDataContainer& aContainer,
+                                    TUint32 aServiceId,
+                                    TUint32 aVoIPProfileId,
+                                    MSVPSessionObserver& aObserver,
+                                    CSVPUtility& aSVPUtility,
+                                    CSVPRtpObserver& aRtpObserver,
+                                    TInt aKeepAliveValue,
+                                    TBool aPreconditions )
+    {
+    CSVPMtSession* self = new ( ELeave ) CSVPMtSession( aMtSession,
+                                                     aContainer, 
+                                                     aVoIPProfileId,
+                                                     aObserver,
+                                                     aSVPUtility,
+                                                     aRtpObserver,
+                                                     aKeepAliveValue,
+                                                     aPreconditions );
+    CleanupStack::PushL( self );
+    self->ConstructL( aServiceId );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::~CSVPMtSession
+// ---------------------------------------------------------------------------
+//
+CSVPMtSession::~CSVPMtSession()
+    {
+    SVPDEBUG1( "CSVPMtSession::~CSVPMtSession" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPMtSession::ConstructL( TUint32 aServiceId )
+    {
+    SVPDEBUG1( "CSVPMtSession::ConstructL In" )
+    
+    iCallParameters = CCCPCallParameters::NewL();
+    iCallParameters->SetServiceId( aServiceId );
+    iCallParameters->SetCallType( CCPCall::ECallTypePS );
+    
+    // modify QoS preconditions
+    if ( iPreconditions )
+        {
+        SVPDEBUG1( "CSVPMtSession::ConstructL preconditions supported" )
+        iSession->SetModifierL( KMcePreconditions, KMcePreconditionsSupported );
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPMtSession::ConstructL preconditions NOT supported" )
+        iSession->SetModifierL( KMcePreconditions, KMcePreconditionsNotUsed );
+        }
+    
+    // modify Old way hold on
+    iSession->SetModifierL( KMceMediaDirection, KMceMediaDirectionWithAddress );
+    
+    InitializePropertyWatchingL();
+    
+    SVPDEBUG1( "CSVPMtSession::ConstructL Out" )
+    }
+
+
+// from MCCPCall
+// ---------------------------------------------------------------------------
+// CSVPMtSession::Answer
+// ---------------------------------------------------------------------------
+//      
+TInt CSVPMtSession::Answer()
+    {
+    SVPDEBUG1( "CSVPMtSession::Answer In" )
+    
+    // stop expires timer
+    StopTimers();
+    
+    // answer to session
+    TRAPD( err, DoAnswerL() );
+    
+    if ( KErrNone != err )
+        {
+        SVPDEBUG2( "CSVPMtSession::Answer Out return(err)=%d", err )
+        return err;
+        }
+    else
+        {
+        ExecCbCallStateChanged( MCCPCallObserver::ECCPStateAnswering );
+        SVPDEBUG2( "CSVPMtSession::Answer Out return=%d", err )
+        return err;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::DoAnswerL
+// ---------------------------------------------------------------------------
+//      
+void CSVPMtSession::DoAnswerL()
+    {
+    SVPDEBUG1( "CSVPMtSession::DoAnswerL In" )
+    
+    static_cast<CMceInSession*>( iSession )->AcceptL();
+    HandleMtStreamsL( iSession->Streams() );
+    
+    SVPDEBUG1( "CSVPMtSession::DoAnswerL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::HandleMtStreamsL
+// ---------------------------------------------------------------------------
+// 
+void CSVPMtSession::HandleMtStreamsL(
+    const RPointerArray<CMceMediaStream>& aStreams )
+    {
+    SVPDEBUG1( "CSVPMtSession::HandleMtStreamsL In" )
+    
+    // go through streams and enable rtp source and speaker sink if found
+    for ( TInt i = 0; i < aStreams.Count(); i++ )
+        {
+        SVPDEBUG1( "CSVPMtSession::HandleMtStreamsL for-loop" )
+        
+        CMceMediaStream* stream1 = aStreams[ i ];
+        CMceMediaStream& boundStream = stream1->BoundStreamL();// fetch bound stream
+        
+        // enable RTP source
+        if ( stream1->Source() && stream1->Source()->Type() == KMceRTPSource )
+            {
+            SVPDEBUG1( "CSVPMtSession::HandleMtStreamsL RTPSource found" )
+        	stream1->Source()->EnableL();
+        	SVPDEBUG1( "CSVPMtSession::HandleMtStreamsL RTPSource ENABLED" )
+            }
+        
+        // enable speaker sink    
+        SVPAudioUtility::EnableSpeakerSinkL( stream1->Sinks() );
+        
+        // enable mic source
+        if ( stream1->Source() )
+            {
+            SVPAudioUtility::EnableMicSourceL( *stream1->Source() );
+        	}
+        
+        // enable mic source from bound stream, if found
+        if ( boundStream.Source() )
+            {
+            SVPAudioUtility::EnableMicSourceL( *boundStream.Source() );
+            }
+        }
+    
+    SVPDEBUG1( "CSVPMtSession::HandleMtStreamsL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::IsCallForwarded
+// ---------------------------------------------------------------------------
+//     
+TBool CSVPMtSession::IsCallForwarded() const
+    {
+    return EFalse;  
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPMtSession::Release
+// ---------------------------------------------------------------------------
+//      
+TInt CSVPMtSession::Release()
+    {
+    SVPDEBUG1( "CSVPMtSession::Release" )
+    delete this;
+    return KErrNone; 
+    }
+            
+// ---------------------------------------------------------------------------
+// CSVPMtSession::Reject
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPMtSession::Reject()
+    {
+    SVPDEBUG1( "CSVPMtSession::Reject In" )
+    
+    TRAPD( err, static_cast<CMceInSession*>(iSession )->RejectL(
+            KSVPBusyHereReason, KSVPBusyHereVal ) );
+    
+    if ( !err )
+        {
+        ExecCbCallStateChanged( MCCPCallObserver::ECCPStateIdle );
+        }
+    
+    SVPDEBUG2( "CSVPMtSession::Reject Out return=%d", err )
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::Queue
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPMtSession::Queue()
+    {
+    SVPDEBUG1( "CSVPMtSession::Queue In" )
+    
+    // Get PS waiting setting 
+    TInt error( KErrNone );
+    TInt psWaiting( EFalse );
+    CRepository* repository = NULL;
+    
+    TRAP( error, repository = CRepository::NewL( KCRUidRichCallSettings ) );
+    
+    if ( KErrNone == error )
+        {
+        error = repository->Get( KRCSPSCallWaiting, psWaiting );
+        delete repository;
+        repository = NULL;
+        
+        if ( psWaiting )
+            {
+            // send 180 ringing
+            Ringing();
+            SVPDEBUG1( "CSVPMtSession::Queue Sending 180 Ringing" )
+            
+            // send 182 queued
+            SVPDEBUG1( "CSVPMtSession::Queue() Sending 182 Queued" )
+            TRAPD( err, static_cast<CMceInSession*> ( iSession )->RespondL(
+                    KSVPQueuedReason, KSVPQueuedVal ) );
+            
+            if ( err )
+                {
+                SVPDEBUG2( "CSVPMtSession::Queue Out return=%d", err )
+                return err;
+                }
+            }
+        else
+            {
+            // ps waiting off, return error
+            SVPDEBUG1( "CSVPMtSession::Queue Out return=KErrNotReady" )
+            return KErrNotReady;
+            }
+        }
+    
+    SVPDEBUG2( "CSVPMtSession::Queue Out return=%d", error )
+    return error;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::Ringing
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPMtSession::Ringing()
+    {
+    SVPDEBUG1( "CSVPMtSession::Ringing In" )
+    
+    TRAPD( err, static_cast<CMceInSession*>( iSession )->RingL() );
+    
+    SVPDEBUG2( "CSVPMtSession::Ringing Out return=%d", err )
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::Hold
+// ---------------------------------------------------------------------------
+//
+TInt CSVPMtSession::Hold()
+    {
+    SVPDEBUG1( "CSVPMtSession::Hold In" )
+    
+    TBool sessionUpdateOngoing = ETrue;
+    TRAP_IGNORE( SetRtpKeepAliveL( iSession, sessionUpdateOngoing ) );
+    
+    TInt status = CSVPSessionBase::Hold();
+    
+    SVPDEBUG2( "CSVPMtSession::Hold Out return=%d", status )
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::Resume
+// ---------------------------------------------------------------------------
+//
+TInt CSVPMtSession::Resume()
+    {
+    SVPDEBUG1( "CSVPMtSession::Resume" )
+    return CSVPSessionBase::Resume();
+    }
+ 
+// ---------------------------------------------------------------------------
+// CSVPMtSession::IsMobileOriginated
+// ---------------------------------------------------------------------------
+//
+TBool CSVPMtSession::IsMobileOriginated() const
+    {
+    SVPDEBUG1( "CSVPMtSession::IsMobileOriginated = EFalse" )
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPMtSession::SetRtpKeepAliveL
+// ---------------------------------------------------------------------------
+//
+void CSVPMtSession::SetRtpKeepAliveL( CMceSession* aSession,
+        TBool aSessionUpdateOngoing )
+    {
+    SVPDEBUG1( "CSVPMtSession::SetRtpKeepAliveL In" )
+    
+    __ASSERT_ALWAYS( aSession, User::Leave( KErrArgument ) );
+    UpdateKeepAliveL( *aSession, aSessionUpdateOngoing );
+    
+    SVPDEBUG1( "CSVPMtSession::SetRtpKeepAliveL Out" )
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svppositioningprovider.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,209 @@
+/*
+* 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 position information
+*
+*/
+
+
+#include <dhcppsy.h>
+
+#include "svppositioningprovider.h"
+#include "svppositioningproviderobserver.h"
+#include "svplogger.h" // For logging
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+CSVPPositioningProvider::CSVPPositioningProvider( 
+    TPriority aPriority, MSVPPositioningProviderObserver& aObserver )
+    : CActive( aPriority ), 
+      iObserver( aObserver )
+    {  
+    iPositionServer = RPositionServer();
+    iPositioner = RPositioner();
+    
+    CActiveScheduler::Add( this );
+    }
+    
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPPositioningProvider::ConstructL()
+    {
+    User::LeaveIfError( iPositionServer.Connect() );
+    }
+
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CSVPPositioningProvider* CSVPPositioningProvider::NewL( 
+    TPriority aPriority, MSVPPositioningProviderObserver& aObserver )
+    {
+    CSVPPositioningProvider* self = 
+        CSVPPositioningProvider::NewLC( aPriority, aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPPositioningProvider* CSVPPositioningProvider::NewLC( 
+    TPriority aPriority, MSVPPositioningProviderObserver& aObserver )
+    {
+    SVPDEBUG1("CSVPPositioningProvider::NewLC");
+    
+    CSVPPositioningProvider* self = 
+        new( ELeave ) CSVPPositioningProvider( aPriority, aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CSVPPositioningProvider::~CSVPPositioningProvider()
+    {
+    SVPDEBUG1("CSVPPositioningProvider::~CSVPPositioningProvider");
+    
+    Cancel();
+    
+    iPositioner.Close();
+    iPositionServer.Close();
+    
+    delete iPositionGenericInfo;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Opens positioning module
+// ---------------------------------------------------------------------------
+//
+void CSVPPositioningProvider::OpenModuleL( TInt aModuleId )
+    {
+    SVPDEBUG1("CSVPPositioningProvider::OpenModuleL");
+    
+    TPositionModuleId moduleId;
+    moduleId.iUid = aModuleId;
+    User::LeaveIfError( iPositioner.Open( iPositionServer, moduleId ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Closes positioning module
+// ---------------------------------------------------------------------------
+//
+void CSVPPositioningProvider::CloseModule()
+    {
+    SVPDEBUG1("CSVPPositioningProvider::CloseModule");
+    
+    Cancel();
+    
+    iPositioner.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Requests position information asynchronically for the given SIP profile
+// ---------------------------------------------------------------------------
+//
+void CSVPPositioningProvider::MakePositioningRequestL( 
+    TUint32 aIapId, const TDesC& aApplicationName, TUint32 /*aTimeout*/ )
+    {
+    SVPDEBUG1("CSVPPositioningProvider::MakePositioningRequestL");
+    
+    delete iPositionGenericInfo;
+    iPositionGenericInfo = NULL;
+    iPositionGenericInfo = HPositionGenericInfo::NewL();
+    
+    // Set requested field
+    iPositionGenericInfo->SetRequestedField( EDhcpPsyIAPProfileIdField );
+    iPositionGenericInfo->SetValue( EDhcpPsyIAPProfileIdField, aIapId );
+    
+    // Set requestor 
+    // - ERequestorService: request originates from an application 
+    // - EFormatApplication: request contains the textual name of an 
+    //   application
+    User::LeaveIfError( iPositioner.SetRequestor( 
+        CRequestor::ERequestorService,
+        CRequestor::EFormatApplication,
+        aApplicationName ) );    
+    
+    /* TEMPORARY FIX
+    // Set timeout
+    TPositionUpdateOptions positionUpdateOptions;
+    positionUpdateOptions.SetUpdateTimeOut( 
+        TTimeIntervalMicroSeconds( aTimeout ) );
+    User::LeaveIfError( 
+        iPositioner.SetUpdateOptions( positionUpdateOptions ) );
+    */
+
+    // Make position request
+    iPositioner.NotifyPositionUpdate( *iPositionGenericInfo, iStatus);
+    SetActive();
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void CSVPPositioningProvider::DoCancel()
+    {
+    iPositioner.CancelRequest( EPositionerNotifyPositionUpdate );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CSVPPositioningProvider::RunL()
+    {
+    SVPDEBUG1("CSVPPositioningProvider::RunL");
+    
+    if ( KErrNone != iStatus.Int() )
+        {
+        iObserver.PositioningErrorOccurred( iStatus.Int() );
+        }
+    else if ( iPositionGenericInfo && 
+              iPositionGenericInfo->IsRequestedField( 
+                  EDhcpPsyLocationResultDataField ) 
+            )
+        {
+        TPtrC8 locInfo;
+        iPositionGenericInfo->GetValue( 
+            EDhcpPsyLocationResultDataField, locInfo );
+        iObserver.PositioningRequestComplete( locInfo );
+        }
+    else
+        {
+        iObserver.PositioningErrorOccurred( KErrNotFound );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svppropertywatch.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,124 @@
+/*
+* 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:  Active object for P&S property watching.
+*
+*/
+
+
+#include "svppropertywatch.h"
+#include "svplogger.h"
+
+
+
+// ---------------------------------------------------------------------------
+// CSVPPropertyWatch::CSVPPropertyWatch
+// ---------------------------------------------------------------------------
+//
+CSVPPropertyWatch::CSVPPropertyWatch( MSVPPropertyWatchObserver& aClient,
+    TInt aKey ) : CActive( EPriorityStandard ), iClient( aClient ), 
+                                                      iKey( aKey )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPPropertyWatch::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPPropertyWatch::ConstructL( const TUid& aCategory )
+    {
+    SVPDEBUG1("CSVPPropertyWatch::ConstructL - ATTACHING TO PROPERTY...");
+    User::LeaveIfError( iProperty.Attach( aCategory, iKey ) );
+
+    SVPDEBUG1("CSVPPropertyWatch::ConstructL - SUBSCRIBING TO PROPERTY...");
+    iProperty.Subscribe( iStatus );
+
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPPropertyWatch::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPPropertyWatch* CSVPPropertyWatch::NewL( 
+    MSVPPropertyWatchObserver& aClient,
+    const TUid& aCategory, TInt aKey )
+    {
+    CSVPPropertyWatch* self = new( ELeave ) CSVPPropertyWatch( aClient, 
+                                                               aKey );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aCategory );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPPropertyWatch::~CSVPPropertyWatch
+// ---------------------------------------------------------------------------
+//
+CSVPPropertyWatch::~CSVPPropertyWatch()
+    {
+    Cancel();
+    iProperty.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPPropertyWatch::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CSVPPropertyWatch::DoCancel()
+    {
+    iProperty.Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPPropertyWatch::RunL
+// ---------------------------------------------------------------------------
+//
+void CSVPPropertyWatch::RunL()
+    {
+    if( KErrNone == iStatus.Int() )
+        {
+        // Resubscribe before processing new value to prevent missing updates
+        iProperty.Subscribe( iStatus );
+        SetActive();
+
+        // Property updated, get new value
+        TInt newValue;
+        if ( KErrNotFound == iProperty.Get( newValue ) )
+            {
+            iClient.PropertyDeleted( iKey );
+            }
+        else
+            {
+            iClient.ValueChangedL( iKey, newValue );
+            }
+        }
+    else
+        {  
+        User::Leave( iStatus.Int() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPPropertyWatch::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CSVPPropertyWatch::RunError( TInt /* aError */)
+    {
+    return KErrNone;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpproxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  SVP Ecom proxyfile        
+*
+*/
+
+
+#include <e32base.h>
+#include <implementationproxy.h>
+#include "svpcontroller.h"
+#include "svplogger.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// TImplementationProxy::ImplementationTable
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 0x10282589, CSVPController::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// TImplementationProxy::ImplementationGroupProxy
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
+                                                        TInt& aTableCount )
+    {
+    SVPDEBUG1("SVPPROXY - A");
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    SVPDEBUG1("SVPPROXY - B");
+    return ImplementationTable;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svprtpobserver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,255 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RTP observation class
+*
+*/
+
+
+#include "svprtpobserver.h"
+#include "svprtpobserverrequest.h"
+#include "svpsessionbase.h"
+#include "svplogger.h"
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::CSVPRtpObserver
+// ---------------------------------------------------------------------------
+//
+CSVPRtpObserver::CSVPRtpObserver()
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::~CSVPRtpObserver
+// ---------------------------------------------------------------------------
+//
+CSVPRtpObserver::~CSVPRtpObserver()
+    {
+    iRequestArray.ResetAndDestroy();
+    iRequestArray.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPRtpObserver* CSVPRtpObserver::NewLC()
+    {
+    CSVPRtpObserver* self = new ( ELeave ) CSVPRtpObserver();
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPRtpObserver* CSVPRtpObserver::NewL()
+    {
+    CSVPRtpObserver* self = CSVPRtpObserver::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::SRReceived
+// ---------------------------------------------------------------------------
+//
+void CSVPRtpObserver::SRReceived( CMceSession& aSession,
+    CMceMediaStream& aStream )
+    {
+    SVPDEBUG1( "CSVPRtpObserver::SRReceived" )
+    
+    CSVPRtpObserverRequest* assocReq = FindByMceSession( &aSession );
+    if ( assocReq )
+        {
+        assocReq->RtcpPacketReceived( 
+            CSVPRtpObserverRequest::ERtcpSrPacket, aSession, aStream );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::RRReceived
+// ---------------------------------------------------------------------------
+//
+void CSVPRtpObserver::RRReceived( CMceSession& aSession,
+    CMceMediaStream& aStream )
+    {
+    SVPDEBUG1( "CSVPRtpObserver::RRReceived" )
+    
+    CSVPRtpObserverRequest* assocReq = FindByMceSession( &aSession );
+    if ( assocReq )
+        {
+        assocReq->RtcpPacketReceived(
+            CSVPRtpObserverRequest::ERtcpRrPacket, aSession, aStream );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::InactivityTimeout
+// ---------------------------------------------------------------------------
+//
+void CSVPRtpObserver::InactivityTimeout( CMceMediaStream& /*aStream*/,
+    CMceRtpSource& /*aSource*/ )
+    {
+    SVPDEBUG1( "CSVPRtpObserver::InactivityTimeout" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::SsrcAdded
+// ---------------------------------------------------------------------------
+//
+void CSVPRtpObserver::SsrcAdded( CMceMediaStream& /*aStream*/,
+    CMceRtpSource& /*aSource*/, TUint /*aSsrc*/ )
+    {
+    SVPDEBUG1( "CSVPRtpObserver::SsrcAdded" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::SsrcRemoved
+// ---------------------------------------------------------------------------
+//
+void CSVPRtpObserver::SsrcRemoved( CMceMediaStream& /*aStream*/,
+    CMceRtpSource& /*aSource*/, TUint /*aSsrc*/ )
+    {
+    SVPDEBUG1( "CSVPRtpObserver::SsrcRemoved" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::AddSessionForObservingL
+// ---------------------------------------------------------------------------
+//
+void CSVPRtpObserver::AddSessionForObservingL( CSVPSessionBase* aSession )
+    {
+    SVPDEBUG2( "CSVPRtpObserver::AddSessionForObservingL aSession: 0x%x",
+        aSession )
+        
+    __ASSERT_ALWAYS( aSession, User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( !FindBySvpSession( aSession ),
+        User::Leave( KErrAlreadyExists ) );
+    
+    CSVPRtpObserverRequest* req = CSVPRtpObserverRequest::NewLC( *aSession );
+    iRequestArray.AppendL( req );
+    CleanupStack::Pop( req );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::RemoveSessionFromObserving
+// ---------------------------------------------------------------------------
+//
+TInt CSVPRtpObserver::RemoveSessionFromObserving( CSVPSessionBase* aSession )
+    {
+    SVPDEBUG2( "CSVPRtpObserver::RemoveSessionFromObserving aSession: 0x%x",
+        aSession )
+    
+    TInt ret = KErrNone;
+    if ( !aSession )
+        {
+        ret = KErrArgument;
+        }
+    else
+        {
+        CSVPRtpObserverRequest* todel = FindBySvpSession( aSession );
+        if ( todel )
+            {
+            TInt index = iRequestArray.Find( todel );
+            iRequestArray.Remove( index );
+            delete todel;
+            }
+        else
+            {
+            ret = KErrNotFound;
+            }
+        }
+        
+    SVPDEBUG2( "CSVPRtpObserver::RemoveSessionFromObserving ret: %d", ret )
+    
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::ResetSessionInObserving
+// ---------------------------------------------------------------------------
+//
+TInt CSVPRtpObserver::ResetSessionInObserving( CSVPSessionBase* aSession )
+    {
+    SVPDEBUG2( "CSVPRtpObserver::ResetSessionInObserving aSession: 0x%x",
+        aSession )
+    
+    TInt ret = KErrNone;
+    if ( !aSession )
+        {
+        ret = KErrArgument;
+        }
+    else
+        {
+        CSVPRtpObserverRequest* toreset = FindBySvpSession( aSession );
+        if ( toreset )
+            {
+            toreset->Reset();
+            }
+        else
+            {
+            ret = KErrNotFound;
+            }
+        }
+    
+    SVPDEBUG2( "CSVPRtpObserver::ResetSessionInObserving ret: %d", ret )
+    
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::FindBySvpSession
+// ---------------------------------------------------------------------------
+//
+CSVPRtpObserverRequest* CSVPRtpObserver::FindBySvpSession(
+    const CSVPSessionBase* aSession )
+    {
+    TInt count = iRequestArray.Count();
+    CSVPRtpObserverRequest* ret( NULL );
+    while( count-- && !ret && aSession )
+        {
+        if ( aSession == iRequestArray[count]->SvpSession() )
+            {
+            ret = iRequestArray[count];
+            }
+        }
+        
+    SVPDEBUG2( "CSVPRtpObserver::FindBySvpSession ret: 0x%x", ret )
+    
+    return ret;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPRtpObserver::FindByMceSession
+// ---------------------------------------------------------------------------
+//
+CSVPRtpObserverRequest* CSVPRtpObserver::FindByMceSession(
+    const CMceSession* aSession )
+    {
+    TInt count = iRequestArray.Count();
+    CSVPRtpObserverRequest* ret( NULL );
+    while( count-- && !ret && aSession )
+        {
+        if ( aSession == iRequestArray[count]->MceSession() )
+            {
+            ret = iRequestArray[count];
+            }
+        }
+    
+    SVPDEBUG2( "CSVPRtpObserver::FindByMceSession ret: 0x%x", ret )
+    
+    return ret;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svprtpobserverrequest.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,255 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 RTP observation class
+*
+*/
+
+
+#include <mcemediastream.h>
+#include <mceaudiostream.h>
+#include <mceaudiocodec.h>
+#include "svprtpobserverrequest.h"
+#include "svpsessionbase.h"
+#include "svptimer.h"
+#include "svpconsts.h"
+#include "mccpcallobserver.h"
+#include "svplogger.h"
+#include "svpholdcontroller.h"
+
+// LOCAL CONSTANTS
+// RTCP timeout interval, 30 seconds.
+const TInt KSVPRtcpTimeout = 30000;
+// Drift 5 seconds, added to actual timeout allowing some randomness in
+// actual timeout.
+const TInt KSVPRtcpTimeoutDrift = 5000;
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::CSVPRtpObserverRequest
+// ---------------------------------------------------------------------------
+//
+CSVPRtpObserverRequest::CSVPRtpObserverRequest(
+    CSVPSessionBase& aSession  ) : iSession( aSession )
+    {
+    // No implementation required
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::~CSVPRtpObserverRequest
+// ---------------------------------------------------------------------------
+//
+CSVPRtpObserverRequest::~CSVPRtpObserverRequest()
+    {
+    delete iTimer;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPRtpObserverRequest* CSVPRtpObserverRequest::NewLC(
+    CSVPSessionBase& aSession )
+    {
+    CSVPRtpObserverRequest* self =
+        new ( ELeave ) CSVPRtpObserverRequest( aSession );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPRtpObserverRequest* CSVPRtpObserverRequest::NewL(
+    CSVPSessionBase& aSession )
+    {
+    CSVPRtpObserverRequest* self = CSVPRtpObserverRequest::NewLC( aSession );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPRtpObserverRequest::ConstructL()
+    {
+    // NB, no need for a special timer ID.
+    iTimer = CSVPTimer::NewL( *this, KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::SvpSession
+// ---------------------------------------------------------------------------
+//
+const CSVPSessionBase* CSVPRtpObserverRequest::SvpSession() const
+    {
+    return &iSession;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::MceSession
+// ---------------------------------------------------------------------------
+//
+const CMceSession* CSVPRtpObserverRequest::MceSession() const
+    {
+    return &( iSession.Session() );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::RtcpPacketReceived
+// ---------------------------------------------------------------------------
+//
+void CSVPRtpObserverRequest::RtcpPacketReceived(
+    TReceivedRtcpPacket /*aPacket*/,
+    CMceSession& aSession, 
+    CMceMediaStream& aStream )
+    {
+    SVPDEBUG2( "CSVPRtpObserverRequest::RtcpPacketReceived aStream.IsEnabled: %d",
+        aStream.IsEnabled() )
+    SVPDEBUG2( "CSVPRtpObserverRequest::RtcpPacketReceived aSession: 0x%x",
+        &aSession )
+    SVPDEBUG2( "CSVPRtpObserverRequest::RtcpPacketReceived iSession: 0x%x",
+        &( iSession.Session() ) )
+    
+    // Check that the given session matches ours
+    if ( &aSession == &( iSession.Session() ) )
+        {
+        SVPDEBUG1( "CSVPRtpObserverRequest::RtcpPacketReceived, (re)start timer" )
+        
+        // For the sake of "just to be sure", stop the timer first
+        const TInt timeout( DetermineTimeoutValue( aStream ) );
+        iTimer->Stop();
+        iTimer->SetTime( timeout );
+        iDisconnectSent = EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::Reset
+// ---------------------------------------------------------------------------
+//
+void CSVPRtpObserverRequest::Reset()
+    {
+    SVPDEBUG1( "CSVPRtpObserverRequest::Reset" )
+    
+    iTimer->Stop();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::TimedOut
+// ---------------------------------------------------------------------------
+//
+void CSVPRtpObserverRequest::TimedOut( TInt /*aTimerId*/ )
+    {
+    // For the sake of "just to be sure", stop the timer first
+    iTimer->Stop();
+    
+    if ( IsSessionInHoldState() )
+        {
+        SVPDEBUG1( "CSVPRtpObserverRequest::TimedOut, (re)start timer because Session is on HOLD" )
+        iTimer->SetTime( KSVPRtcpTimeout );
+        iDisconnectSent = EFalse;
+        }
+    else
+        {
+        SVPDEBUG2( "CSVPRtpObserverRequest::TimedOut iDisconnectSent: %d",
+            iDisconnectSent )
+        
+        // First CCE must be notified about 'disconnecting', state. Then timer is
+        // re-started so that CCE & UI can handle the events with time (i.e user
+        // has actually time to see the UI notifications).
+        // After timer has fired second time, then send 'idle' event to the
+        // CCE.
+        
+        
+        if ( !iDisconnectSent )
+            {
+            iSession.GetCCPSessionObserver().CallStateChanged(
+                MCCPCallObserver::ECCPStateDisconnecting, &iSession ); 
+            
+            iTimer->SetTime( KSVPTerminatingTime );
+            iDisconnectSent = ETrue;
+            }
+        else
+            {
+            iSession.GetCCPSessionObserver().CallStateChanged(
+                MCCPCallObserver::ECCPStateIdle, &iSession ); 
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::DetermineTimeoutValue
+// ---------------------------------------------------------------------------
+//
+TInt CSVPRtpObserverRequest::DetermineTimeoutValue(
+    CMceMediaStream& aStream ) const
+    {
+    // NB: aStream is not const because call to Codecs() is not const => this
+    // saves a const_cast and keeps some sanity in casting. Though, we do not
+    // modify anything in given aStream...
+    
+    TInt timeout( KSVPRtcpTimeout );
+    if ( KMceAudio == aStream.Type() )
+        {
+        CMceAudioStream& audio( static_cast<CMceAudioStream&>( aStream ) );
+        
+        const RPointerArray<CMceAudioCodec>& codecs( audio.Codecs() );
+        const TInt count = codecs.Count();
+        for( TInt k = 0; k < count; k++ )
+            {
+            // MCE API talks about ms' but returns somethings that look awfully
+            // close to seconds... Oh, well...
+            const TInt kpval(
+                codecs[k]->KeepAliveTimer() * KSVPMilliSecondCoefficient );
+            if ( kpval > timeout )
+                {
+                timeout = kpval;
+                }
+                
+            SVPDEBUG2( "CSVPRtpObserverRequest::DetermineTimeoutValue k: %d", k )
+            SVPDEBUG2( "CSVPRtpObserverRequest::DetermineTimeoutValue kpval: %d", kpval )
+            }
+            
+        SVPDEBUG2( "CSVPRtpObserverRequest::DetermineTimeoutValue count: %d", count )
+        }
+    
+    // Now add the drifting to the timeout.
+    timeout += KSVPRtcpTimeoutDrift;
+    
+    SVPDEBUG2( "CSVPRtpObserverRequest::DetermineTimeoutValue timeout: %d", timeout )
+    
+    return timeout;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPRtpObserverRequest::IsSessionInHoldState
+// ---------------------------------------------------------------------------
+//
+TBool CSVPRtpObserverRequest::IsSessionInHoldState()
+    {
+    if ( SvpSession()->HasHoldController() &&
+            ESVPOnHold == (SvpSession()->HoldController()).HoldState() )
+        {
+        SVPDEBUG1( "CSVPRtpObserverRequest::IsSessionInHoldState ETrue" )
+        return ETrue;
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPRtpObserverRequest::IsSessionInHoldState EFalse" )
+        return EFalse;
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpsessionbase.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,3294 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Session base class for SVP MO and MT sessions. Contains methods 
+*                common for SVP MO and MT sessions.
+*
+*/
+
+#include <e32math.h>
+#include <escapeutils.h>
+
+#include <mcetransactiondatacontainer.h>
+#include <mceaudiostream.h>
+#include <mcertpsink.h>
+#include <mcertpsource.h>
+#include <mceaudiocodec.h>
+#include <mcedefs.h>
+#include <mcesecuresession.h> 
+#include <mcesecureoutsession.h>
+#include <mcesecureinsession.h>
+#include <mcemicsource.h>
+#include <mcespeakersink.h>
+#include <siperr.h>
+#include <telephonydomainpskeys.h> // for mute 
+
+#include "svpsessionbase.h"
+#include "svpholdcontroller.h"
+#include "svptransfercontroller.h"
+#include "svptransferstatecontext.h"
+#include "svptimer.h"
+#include "svpsipconsts.h"
+#include "svpuriparser.h"
+#include "svpaudioutility.h"
+#include "svpvolumeobserver.h"
+#include "svplogger.h"
+#include "svputility.h"
+#include "svprtpobserver.h"
+#include "svppropertywatch.h"
+#include "svpdtmfeventgenerator.h"
+
+
+// Local Consts
+const TInt KMaxTimerValueMO = 4000;
+const TInt KMinTimerValueMO = 2100;
+const TInt KMaxTimerValueMT = 2000;
+const TInt KMinTimerValueMT = 10;
+
+const TInt KRandomDividerOne = 1000000;
+const TInt KRandomDividerTwo = 1000;
+
+const TInt KMaxPhoneVolume = 10;
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::CSVPSessionBase
+// ---------------------------------------------------------------------------
+//
+CSVPSessionBase::CSVPSessionBase( TMceTransactionDataContainer& aContainer,
+    MSVPSessionObserver& aObserver, CSVPUtility& aSVPUtility,
+    CSVPRtpObserver& aRtpObserver ) :
+    iSVPUtility( aSVPUtility ),
+    iRtpObserver( aRtpObserver ),
+    iContainer( aContainer ),
+    iObserver( aObserver ),
+    iErrorInULandDLFirstTime ( ETrue ),
+    iEarlyMediaOngoing ( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::~CSVPSessionBase
+// ---------------------------------------------------------------------------
+//
+CSVPSessionBase::~CSVPSessionBase()
+    {
+    SVPDEBUG1( "SVPSessionBase::~CSVPSessionBase In" )
+    
+    delete iCallParameters;
+    
+    delete iHoldController;
+    
+    iObserver.RemoveFromArray( *this );
+    
+    delete iSession;
+    
+    StopTimers();
+    
+    iTimers.Close();
+    
+    delete iRecipient;
+    
+    delete iDisplayName;
+    
+    delete iTransferController;
+    
+    delete iMutePropertyWatch;
+    
+    delete iVolObserver;
+    
+    delete iFromHeader;
+    
+    delete iToHeader;
+    
+    delete iCallId;
+    
+    delete iCSeqHeader;
+    
+    delete iEventGenerator;
+    
+    delete (iTempSecSession != iSession ? iTempSecSession : NULL );
+    
+    delete iDtmfString;
+    
+    SVPDEBUG1( "CSVPSessionBase::~CSVPSessionBase Out" )
+    }
+   
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::ReleaseTempSecure
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::ReleaseTempSecure()
+    {
+    delete iTempSecSession;
+    iTempSecSession = NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Session
+// ---------------------------------------------------------------------------
+//
+const CMceSession& CSVPSessionBase::Session() const   
+    {
+    return *iSession;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::StartTimerL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::StartTimerL( TInt aMilliSeconds, TInt aTimerId )
+    {
+    SVPDEBUG1( "CSVPSessionBase::StartTimerL In" )
+    
+    CSVPTimer* timer = CSVPTimer::NewL( *this, aTimerId );
+    CleanupStack::PushL( timer );
+    timer->SetTime( aMilliSeconds );
+    iTimers.AppendL( timer );
+    CleanupStack::Pop( timer );
+    
+    SVPDEBUG1( "CSVPSessionBase::StartTimerL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::StopTimers
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::StopTimers()
+    {
+    SVPDEBUG1( "CSVPSessionBase::StopTimers In" )
+    
+    while ( iTimers.Count() )
+        {
+        iTimers[0]->Stop();
+        delete iTimers[0];
+        iTimers.Remove( 0 );
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::StopTimers Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::ReinviteCrossoverTime
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::ReinviteCrossoverTime()
+    {
+    SVPDEBUG1( "CSVPSessionBase::ReinviteCrossoverTime In" )
+    
+    TInt maxValue( 0 );
+    TInt minValue( 0 );
+    
+    if ( IsMobileOriginated() )
+        {
+        minValue = KMinTimerValueMO;
+        maxValue = KMaxTimerValueMO;
+        }
+    else
+        {
+        minValue = KMinTimerValueMT;
+        maxValue = KMaxTimerValueMT; 
+        }
+    
+    TInt timerValue( 0 );
+    TTime time;
+    time.HomeTime();
+    TInt64 seed( time.Int64() );
+    
+    for ( TInt i = 0; i < ( maxValue - minValue ); i++ )
+        {
+        TInt random = Math::Rand( seed );
+        TReal random2 =  ( TReal )random / KRandomDividerOne;
+        TInt random3 = ( TInt )( minValue * random2 ) / KRandomDividerTwo;
+        
+        if ( minValue <= random3 && minValue >= random3 )
+            {
+            timerValue = random3;
+            break;
+            }
+        }
+    
+    SVPDEBUG2("CSVPSessionBase::ReinviteCrossoverTime Out return: %d", timerValue )
+    return timerValue;    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::StopTimer
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::StopTimer( TInt aTimerId )
+    {
+    SVPDEBUG2( "CSVPSessionBase::StopTimer In, Timer -- ID: %d", aTimerId )
+
+    // Find the timer and delete it.
+    for ( TInt t = 0; t < iTimers.Count(); )
+        {
+        if ( iTimers[ t ] ->Id() == aTimerId )
+            {
+            iTimers[t]->Stop();
+            delete iTimers[ t ];
+            iTimers.Remove( t );
+            }
+        else
+            {
+            t++;
+            }
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::StopTimer Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::TimedOut
+// ---------------------------------------------------------------------------
+//    
+void CSVPSessionBase::TimedOut( TInt aTimerId )
+    {
+    SVPDEBUG1( "CSVPSessionBase::TimedOut In" )
+     
+    // Find the timer and delete it.
+    for ( TInt t = 0; t < iTimers.Count(); )
+        {
+        if ( iTimers[ t ] ->Id() == aTimerId )
+            {
+            delete iTimers[ t ];
+            iTimers.Remove( t );
+            }
+        else
+            {
+            t++;
+            }
+        }
+    
+    if ( KSVPInviteTimerExpired == aTimerId )
+        {
+        // INVITE timer expired, notify client
+        SVPDEBUG1( "CSVPSessionBase::TimedOut Invite timer expired, callback" )
+        ExecCbErrorOccurred( ECCPErrorNotResponding );
+        
+        // send cancel
+        TRAPD( errCancel, static_cast< CMceOutSession* >( iSession )->CancelL() );
+        
+        if ( errCancel )
+            {
+            SVPDEBUG2( "CSVPSessionBase::TimedOut Cancel: %d", errCancel )
+            }
+        
+        ExecCbCallStateChanged( MCCPCallObserver::ECCPStateDisconnecting );
+
+        TRAPD( errTimer, StartTimerL( KSVPTerminatingTime, KSVPRemoteEndDiedExpired ));
+	    if ( errTimer )
+		    {
+			SVPDEBUG2("CSVPSessionBase::No Answer timer leave with error code %d",
+			        errTimer )
+            }
+        }
+    
+    if ( KSVPTerminationTimerExpired == aTimerId )
+        {
+        // Renew terminating timer to keep session alive when incoming 
+        // transfer ongoing, not longer than max default expire time (120s)
+        if ( IsIncomingTransfer() &&
+             !IsAttended() &&
+             iTerminatingRepeat < KSVPDefaultExpiresTime )
+            {
+            SVPDEBUG2( "CSVPSessionBase::TimedOut UnAtte case iTerminatingRepeat = %d",
+                iTerminatingRepeat )
+            
+            // Continue timeout time if the new session of the 
+            // incoming transfer not yet established
+            iTerminatingRepeat = iTerminatingRepeat +
+                KSVPTerminatingTime / KSVPMilliSecondCoefficient;
+            
+            TRAPD( errTimer, StartTimerL( KSVPTerminatingTime,
+                    KSVPTerminationTimerExpired ) );
+            
+            if ( errTimer )
+                {
+                SVPDEBUG2( "CSVPSessionBase::TimedOut Termination leave with code %d",
+                        errTimer )
+                }
+            }
+        else
+            {
+            SVPDEBUG1( "CSVPSessionBase::TimedOut Termination timer, callback" )
+            ExecCbCallStateChanged( MCCPCallObserver::ECCPStateIdle );
+            }
+        }
+    
+    if ( KSVPRemoteEndDiedExpired == aTimerId )    
+        {
+        SVPDEBUG1( "CSVPSessionBase::TimedOut remote end died, callback" )
+        // disconnecting state callback sent before timer started
+        ExecCbCallStateChanged( MCCPCallObserver::ECCPStateIdle );
+        }
+    
+    if ( KSVPHangUpTimerExpired == aTimerId )    
+        {
+        SVPDEBUG1( "CSVPSessionBase::TimedOut HangUp timer expired, callback" )
+        // disconnecting state callback sent before timer started
+        ExecCbCallStateChanged( MCCPCallObserver::ECCPStateIdle );
+        }
+    
+    if ( KSVPExpiresTimeExpired == aTimerId )
+        {
+        SVPDEBUG1( "CSVPSessionBase::TimedOut expires timer expired" )
+        // send 487
+        TRAPD( err, static_cast<CMceInSession*>( iSession )->RespondL(
+                KSVPRequestTerminatedReason, KSVPRequestTerminatedVal ) );
+        
+        if ( err )
+            {
+            // sending response failed
+            // not serious because session is put to idle state anyway
+            }
+        // event is needed in upper level for correct bubble and log handling
+        ExecCbCallEventOccurred( MCCPCallObserver::ECCPRemoteTerminated );
+        // idle can be sent directly without disconnecting state
+        ExecCbCallStateChanged( MCCPCallObserver::ECCPStateIdle );
+        }
+    
+    if ( KSVPHoldTimerExpired == aTimerId ||
+         KSVPResumeTimerExpired == aTimerId )
+        {
+        if ( iHoldController )
+            {
+            SVPDEBUG1( "CSVPSessionBase::TimedOut - Hold/Resume request Expired" )
+            
+            iHoldController->TimedOut();
+            TInt contErr = iHoldController->ContinueHoldProcessing( *iSession );
+            
+            if ( KSVPResumeTimerExpired == aTimerId &&
+                 CMceSession::EEstablished == iSession->State() )
+                {
+                // MCE state error prevents cancelling session; go to terminating
+                SVPDEBUG1( "CSVPSessionBase::TimedOut - MCE established" )
+                HandleSessionStateChanged( *iSession );
+                SVPDEBUG1( "CSVPSessionBase::TimedOut - hold/resume done" )
+                }
+            else
+                {
+                TRAPD( cancelErr, static_cast<CMceOutSession*>( iSession )->CancelL() );
+                
+                if ( cancelErr )
+                    {
+                    // This removes compile warnings; no need for other error 
+                    // handling
+                    SVPDEBUG2( "CSVPSessionBase::TimedOut - Hold/Resume, Err %i", 
+                            cancelErr )
+                    }
+                }
+            
+            SVPDEBUG2( "CSVPSessionBase::TimedOut - Hold/Resume Handled, Err %i",
+                    contErr )
+            }
+        }
+    
+    if ( KSVPReferTimerExpired == aTimerId )
+        {
+        // Refer timeout
+        SVPDEBUG1( "CSVPSessionBase::TimedOut Transfer/Refer timer expired" )
+        
+        if ( iTransferController )
+            {
+            // Inform application about the error
+            ExecCbErrorOccurred( ECCPTransferFailed );
+            // Terminate transfer
+            iTransferController->TerminateTransfer();
+			}
+        }
+    
+    if ( KSVPReInviteTimerExpired == aTimerId )
+        {
+        if ( iHoldController )
+            {
+            SVPDEBUG1( "CSVPSessionBase::TimedOut - ReInvite timer expired" )
+            iHoldController->RetryHoldRequest( iSession );
+            }
+        }
+
+    if ( KSVPICMPErrorTimerExpired == aTimerId )
+        {
+        TBool bothStreamsDisabled ( ETrue );
+        TRAP_IGNORE( bothStreamsDisabled = IsBothStreamsDisabledL() );
+        if ( bothStreamsDisabled )
+            {
+            SVPDEBUG1( "CSVPSessionBase::TimedOut Error In UL and DL \
+            NOT First Time! -> Start Terminating Timer and BYE" )
+            // notify CCE about the error & bring session down.
+            ExecCbErrorOccurred( ECCPErrorConnectionError );
+            ExecCbCallStateChanged( MCCPCallObserver::ECCPStateDisconnecting );
+        
+            TRAP_IGNORE( StartTimerL( KSVPTerminatingTime, KSVPRemoteEndDiedExpired ) );
+            }
+        else
+            {
+            SVPDEBUG1( "CSVPSessionBase::TimedOut UpLink or DownLink \
+            is not Disabled! -> No Terminating Timer needed, all is OK!" )
+            }
+        SetErrorInULandDLFirstTime( ETrue );        
+        }
+
+    if ( KSVPSinkResumeICMPErrorTimerExpired == aTimerId ||
+         KSVPSourceResumeICMPErrorTimerExpired == aTimerId )
+        {
+        if ( iHoldController )
+            {
+            // ICMP errors in resume disables RTP sink, try to enable it: 
+            SVPDEBUG1( "CSVPSessionBase::TimedOut - Resume ICMP error timer expired" )
+            TRAPD( refreshErr, HoldController().RefreshHoldStateL() );
+            if ( refreshErr )
+                {
+                // Removes compile warnings; no other error handling
+                SVPDEBUG2( "CSVPSessionBase::TimedOut - refreshHold err %d", refreshErr )
+                }
+            }
+        }
+
+    SVPDEBUG1( "CSVPSessionBase::TimedOut Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SessionStateChanged
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::SessionStateChanged( TInt aStatusCode )
+    {
+    SVPDEBUG2( "CSVPSessionBase::SessionStateChanged  In,  aStatusCode= %d", aStatusCode )
+    SVPDEBUG2( "CSVPSessionBase::SessionStateChanged iSession->State()= %d", iSession->State() )
+    
+    TInt status = aStatusCode;
+    TCCPError err = iSVPUtility.GetCCPError( status, iTone );
+    
+    // On error call voip event logger with original status, 3xx are not logged.
+    if ( ECCPErrorNone != err && ECCPErrorNotReached != err )
+        {
+        TRAP_IGNORE( iSVPUtility.LogVoipEventL( aStatusCode,
+                iSipProfileId, RemoteParty(), CSeqHeader() ) );
+        }
+    
+    #ifdef _DEBUG   // UDEB build
+    
+    TRAPD( trapErr, SessionStateChangedL( aStatusCode, err, status ) );
+    SVPDEBUG2( "CSVPSessionBase::SessionStateChanged trapErr: %d", trapErr )
+    
+    #else // UREL build
+    
+    TRAP_IGNORE( SessionStateChangedL( aStatusCode, err, status ) );
+    
+    #endif // _DEBUG
+    
+    SVPDEBUG1( "CSVPSessionBase::SessionStateChanged Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::InitializePropertyWatchingL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::InitializePropertyWatchingL()
+    {
+    SVPDEBUG1( "CSVPSessionBase::InitializePropertyWatchingL In" )
+    
+    // create property watcher for watching mute P&S property changes
+    iMutePropertyWatch = CSVPPropertyWatch::NewL(
+            *this, KPSUidTelMicrophoneMuteStatus, KTelMicrophoneMuteState );
+    
+    // check initial mute value                                  
+    TInt value( EPSTelMicMuteOff );
+    RProperty::Get( KPSUidTelMicrophoneMuteStatus, 
+            KTelMicrophoneMuteState, value );
+    
+    // check initial mute status 
+    if( EPSTelMicMuteOff == value )
+        {
+        SVPDEBUG1( "CSVPSessionBase::InitializePropertyWatchingL Initally mute: OFF" )
+        }
+    else if ( EPSTelMicMuteOn == value )
+        {
+        SVPDEBUG1( "CSVPSessionBase::InitializePropertyWatchingL Initially Mute: ON" )
+        // if mute is initially on, we must mute the audio
+        ValueChangedL( KTelMicrophoneMuteState, EPSTelMicMuteOn );
+        }
+    
+    // create instance of volume obsever
+    iVolObserver = CSVPVolumeObserver::NewL( *this );
+    
+    SVPDEBUG1( "CSVPSessionBase::InitializePropertyWatchingL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::ExecCbErrorOccurred
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPSessionBase::ExecCbErrorOccurred( TCCPError aError )
+    {
+    SVPDEBUG2( "CSVPSessionBase::ExecCbErrorOccurred In, aError= %d", aError )
+    
+    TInt status = KErrNotFound;
+    
+    if ( iCCPSessionObserver )
+        {
+        status = KErrNone;
+        iCCPSessionObserver->ErrorOccurred( aError, this );
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::ExecCbErrorOccurred Out return=%d", status )
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::ExecCbCallStateChanged
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPSessionBase::ExecCbCallStateChanged(
+        MCCPCallObserver::TCCPCallState aNewState )
+    {
+    SVPDEBUG2( "CSVPSessionBase::ExecCbCallStateChanged In, aNewState= %d", aNewState )
+    SVPDEBUG2( "CSVPSessionBase::ExecCbCallStateChanged iSessionState= %d", iSessionState )
+    
+    TInt status = (TInt) aNewState;
+    
+    if ( !( (TInt) MCCPCallObserver::ECCPStateIdle > status ) )
+        {
+        // state transition OK
+        iSessionState = (MCCPCallObserver::TCCPCallState) status;
+        
+        if ( iCCPSessionObserver )
+            {
+            status = KErrNone;
+            iCCPSessionObserver->CallStateChanged( iSessionState, this );
+            }
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::ExecCbCallStateChanged Out return=%d", status )
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::ExecCbCallEventOccurred
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::ExecCbCallEventOccurred(
+        MCCPCallObserver::TCCPCallEvent aEvent )
+    {
+    SVPDEBUG2( "CSVPSessionBase::ExecCbCallEventOccurred In, aEvent= %d", aEvent )
+    
+    TInt status = KErrNotFound;
+    
+    if ( iCCPSessionObserver )
+        {
+        status = KErrNone;
+        iCCPSessionObserver->CallEventOccurred( aEvent, this );
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::ExecCbCallEventOccurred Out, return= %d", status )
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::ExecCbSsEventOccurred
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::ExecCbSsEventOccurred(
+        MCCPSsObserver::TCCPSsCallForwardEvent aEvent )
+    {
+    SVPDEBUG2( "CSVPSessionBase::ExecCbSsEventOccurred In, aEvent= %d", aEvent )
+    
+    TInt status = KErrNotFound;
+    
+    if ( iCCPSsObserver )
+        {
+        status = KErrNone;
+        iCCPSsObserver->CallForwardEventOccurred( aEvent, *iRecipient );
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::ExecCbSsEventOccurred Out return=%d", status )
+    return status;
+    }
+
+
+//----------------------------------------------------------------------------
+//CSVPSessionBase::SetSsObserver
+//----------------------------------------------------------------------------
+//
+void CSVPSessionBase::SetSsObserver( const MCCPSsObserver& aObserver )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetSsObserver In" )
+    
+    iCCPSsObserver = const_cast< MCCPSsObserver* >( &aObserver );
+    
+    SVPDEBUG1( "CSVPSessionBase::SetSsObserver In" )
+    }
+
+//----------------------------------------------------------------------------
+//CSVPSessionBase::GetSsObserver
+//----------------------------------------------------------------------------
+//
+const MCCPSsObserver& CSVPSessionBase::GetSsObserver( )
+    {
+    SVPDEBUG1( "CSVPSessionBase::GetSsObserver" )
+    
+    return *iCCPSsObserver;    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SetDtmfObserver
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::SetDtmfObserver( const MCCPDTMFObserver& aObserver )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetDtmfObserver In" )
+    
+    iCCPDtmfObserver = const_cast< MCCPDTMFObserver* >( &aObserver );
+    
+    SVPDEBUG1( "CSVPSessionBase::SetDtmfObserver Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::DtmfObserver
+// ---------------------------------------------------------------------------
+//
+const MCCPDTMFObserver& CSVPSessionBase::DtmfObserver()
+    {
+    SVPDEBUG1( "CSVPSessionBase::DtmfObserver" )
+    
+    return *iCCPDtmfObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::EventStateChanged
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::EventStateChanged( CMceEvent& aEvent, TInt aStatusCode )
+    {
+    SVPDEBUG1( "CSVPSessionBase::EventStateChanged In" )
+    
+    TInt err( KErrNone );
+    
+    if ( iTransferController )
+        {
+        TRAP( err, iTransferController->HandleEventStateChangedL(
+                aEvent, aStatusCode ) );
+        
+        if ( KSVPErrTransferInProgress == err )
+            {
+            // Transfer allready in progress
+            SVPDEBUG1( "CSVPSessionBase::EventStateChanged, KSVPErrTransferInProgress" )
+            }
+        else if ( KErrNone != err )
+            {
+            SVPDEBUG2( "CSVPSessionBase::EventStateChanged, err = %d", err )
+            // Inform application about the error
+            ExecCbErrorOccurred( ECCPTransferFailed );
+            }
+        }
+    else
+        {
+        // Inform application about the error
+        ExecCbErrorOccurred( ECCPTransferFailed );
+        err = KSVPErrTransferErrorBase;
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::EventStateChanged Out return=%d", err )
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::NotifyReceived
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::NotifyReceived( CMceEvent& aEvent,
+        TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPSessionBase::NotifyReceived In" )
+    
+    if ( iTransferController )
+        {
+        TRAPD( err, iTransferController->NotifyReceivedL(
+                aEvent, aContainer ) );
+        
+        if ( KErrNone != err )
+            {
+            // Inform application about the error
+            ExecCbErrorOccurred( ECCPTransferFailed );
+            }
+        }
+    else
+        {
+        // Inform application about the error
+        ExecCbErrorOccurred( ECCPTransferFailed );
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::NotifyReceived Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::ReferStateChanged
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::ReferStateChanged( CMceRefer& aRefer, TInt aStatusCode )
+    {
+    SVPDEBUG1( "CSVPSessionBase::ReferStateChangedL In" )
+    
+    if ( iTransferController )
+        {
+        TRAPD( err, iTransferController->HandleReferStateChangeL(
+                aRefer, aStatusCode ) );
+        
+        if ( KErrNone != err )
+            {
+            // Inform application about the error
+            ExecCbErrorOccurred( ECCPTransferFailed );
+            }
+        }
+    else
+        {
+        // Inform application about the error
+        ExecCbErrorOccurred( ECCPTransferFailed );
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::ReferStateChangedL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::MceTransactionDataContainer
+// ---------------------------------------------------------------------------
+//
+TMceTransactionDataContainer& CSVPSessionBase::MceTransactionDataContainer()
+    {
+    return iContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IncomingReferL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::IncomingReferL( CMceInRefer* aRefer,
+        const TDesC8& aReferTo, TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPSessionBase::IncomingReferL In" )
+    
+    if ( !iTransferController )        
+        {
+        // Create new transfercontroller
+        iTransferController = CSVPTransferController::NewL(
+                iSession, this, iContainer, *this );
+        }
+    
+    iTransferController->IncomingReferL( aRefer, aReferTo, aContainer );
+    
+    SVPDEBUG1( "CSVPSessionBase::IncomingReferL Out" )    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsMceRefer
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsMceRefer( CMceRefer& aRefer )
+    {
+    if ( iTransferController )
+        {
+        return iTransferController->IsMceRefer( aRefer );        
+        }
+    else
+        {
+        return EFalse;    
+        }   
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsAttended
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsAttended()
+    {
+    if ( iTransferController )
+        {
+        return iTransferController->IsAttended();
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SetTransferDataL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::SetTransferDataL( CDesC8Array* aUserAgentHeaders,
+        TInt aSecureStatus )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetTransferDataL In" )
+    
+    if ( iTransferController )
+        {
+        iTransferController->SetTransferDataL(
+            aUserAgentHeaders, aSecureStatus );
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::SetTransferDataL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SendNotify
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::SendNotify( TInt aStatusCode )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SendNotify In" )
+    
+    if ( iTransferController )
+        {
+        #ifdef _DEBUG
+        
+        TRAPD( err, iTransferController->SendNotifyL( aStatusCode ) );
+        SVPDEBUG2("CSVPSessionBase::SendNotify SendNotifyL err: %d", err )
+        
+        #else
+        
+        TRAP_IGNORE( iTransferController->SendNotifyL( aStatusCode ) );
+        
+        #endif // _DEBUG
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::SendNotify Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsIncomingTransfer
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsIncomingTransfer()
+    {
+    if ( iTransferController )
+        {
+        return iTransferController->IsIncomingTransfer();
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::TransferTarget
+// ---------------------------------------------------------------------------
+//
+const TDesC& CSVPSessionBase::TransferTarget() const
+    {
+    SVPDEBUG1( "CSVPSessionBase::TransferTarget" )
+    
+    if ( iTransferController )
+        {
+        return iTransferController->TransferTarget();
+        }
+    else
+        {
+        return KNullDesC;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSessionBase::SetFromHeader
+// -----------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::SetFromHeader( const TDesC8& aFromHeader )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetFromHeader" )
+    
+    delete iFromHeader;
+    iFromHeader = NULL;
+    
+    TRAPD( err, iFromHeader = aFromHeader.AllocL() );
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSessionBase::FromHeader
+// -----------------------------------------------------------------------------
+//
+TDesC8* CSVPSessionBase::FromHeader()
+    {
+    return iFromHeader;
+    }  
+
+// -----------------------------------------------------------------------------
+// CSVPSessionBase::SetToHeader
+// -----------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::SetToHeader( const TDesC8& aToHeader )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetToHeader" )
+    
+    delete iToHeader;
+    iToHeader = NULL;
+    
+    TRAPD( err, iToHeader = aToHeader.AllocL() );
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSessionBase::ToHeader
+// -----------------------------------------------------------------------------
+//
+TDesC8* CSVPSessionBase::ToHeader()
+    {
+    return iToHeader;
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSessionBase::SetCallId
+// -----------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::SetCallId( const TDesC8& aCallId )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetCallId" )
+    
+    delete iCallId;
+    iCallId = NULL;
+    
+    TRAPD( err, iCallId = aCallId.AllocL() );
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSessionBase::CallId
+// -----------------------------------------------------------------------------
+//
+TDesC8* CSVPSessionBase::CallId()
+    {
+    return iCallId;
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSessionBase::SetCSeqHeader
+// -----------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::SetCSeqHeader( const TDesC8& aCSeq )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetCSeqHeader In" )
+    
+    delete iCSeqHeader;
+    iCSeqHeader = NULL;
+    
+    TRAPD( err, iCSeqHeader = HBufC::NewL( aCSeq.Length() ) );
+    iCSeqHeader->Des().Copy( aCSeq );
+    
+    // Check "CSeq:" and remove it from the beginning if exists
+    if ( 0 == iCSeqHeader->Des().FindF( KSVPCSeqPrefix ) )
+        {
+        // CSeq: is in the beginning of the string, remove it and 1 blank
+        iCSeqHeader->Des().Delete( 0, KSVPCSeqPrefixLength + 1 );
+        }
+    
+    // Check/remove the sequence number and the blank
+    const TInt spacePosition = iCSeqHeader->Des().Find( KSVPSpace2 );
+    
+    if ( spacePosition != KErrNotFound )
+        {
+        iCSeqHeader->Des().Delete( 0, spacePosition + 1 );
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::SetCSeqHeader Out return=%d", err )
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::CSeqHeader
+// ---------------------------------------------------------------------------
+// 
+const TDesC& CSVPSessionBase::CSeqHeader() const
+    {
+    SVPDEBUG1( "CSVPSessionBase::CSeqHeader In" )  
+    
+    if ( iCSeqHeader )
+        {
+        SVPDEBUG1( "CSVPSessionBase::CSeqHeader Out" )
+        return *iCSeqHeader;
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPSessionBase::CSeqHeader Out KNullDesC" )
+        return KNullDesC;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::AddObserverL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::AddObserverL( const MCCPCallObserver& aObserver )
+    {
+    SVPDEBUG1( "CSVPSessionBase::AddObserverL In" )
+    
+    // set session observer
+    // only one observer used at a time, replaces current one
+    iCCPSessionObserver = const_cast< MCCPCallObserver* >( &aObserver );
+    
+    SVPDEBUG1( "CSVPSessionBase::AddObserverL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::GetCCPSessionObserver
+// ---------------------------------------------------------------------------
+//
+MCCPCallObserver& CSVPSessionBase::GetCCPSessionObserver()
+    {
+    SVPDEBUG1( "CSVPSessionBase::GetCCPSessionObserver" )
+    // get session observer
+    return *iCCPSessionObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::RemoveObserver
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::RemoveObserver( const MCCPCallObserver& /*aObserver*/ )
+    {
+    return KErrNotSupported; 
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::InbandDtmfEventOccurred
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::InbandDtmfEventOccurred( TSVPDtmfEvent aEvent )
+    {
+    SVPDEBUG1( "CSVPSessionBase::InbandDtmfEventOccurred In" )
+    SVPDEBUG2( "CSVPSessionBase::InbandDtmfEventOccurred aEvent:%d", aEvent )
+      
+    switch ( aEvent )
+        {
+        case ESvpDtmfSendStarted:
+            {
+            DtmfObserver().
+                HandleDTMFEvent( MCCPDTMFObserver::ECCPDtmfSequenceStart, 
+                                 KErrNone, 
+                                 iDtmfLex.Peek() );
+            break;
+            }
+            
+        case ESvpDtmfSendStopped:
+            {
+            DtmfObserver().HandleDTMFEvent( 
+                                 MCCPDTMFObserver::ECCPDtmfSequenceStop, 
+                                 KErrNone, 
+                                 iDtmfLex.Get() );
+            break;
+            }
+            
+        case ESvpDtmfSendCompleted:
+            {
+            DtmfObserver().HandleDTMFEvent( 
+                     MCCPDTMFObserver::ECCPDtmfStringSendingCompleted, 
+                     KErrNone, 
+                     iDtmfLex.Peek() );
+            break;
+            }
+        
+        default:
+            {
+            SVPDEBUG1( "CSVPSessionBase::InbandDtmfEventOccurred Default" )
+            break;
+            }
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::InbandDtmfEventOccurred Out" )
+    }
+
+  
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::ConstructAudioStreamsL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::ConstructAudioStreamsL()
+    {
+    SVPDEBUG1( "CSVPSessionBase::ConstructAudioStreamsL In" )
+    
+    // OUT STREAM
+    // create "audio out" stream first, puts audioOutStream to cleanupstack
+    CMceAudioStream* audioOutStream = CMceAudioStream::NewLC();     // CS: 1
+    // create mic source
+    CMceMicSource* mic = CMceMicSource::NewLC();                    // CS: 2
+    // set source for "audio out" stream, in this case it's microphone
+    // there can be only one source at a time.
+    audioOutStream->SetSourceL( mic );
+    // pop mic from cleanupstack
+    CleanupStack::Pop( mic );                                       // CS: 1
+    // create rtp sink for mic
+    CMceRtpSink* rtpSink = CMceRtpSink::NewLC();                    // CS: 2
+    audioOutStream->AddSinkL( rtpSink );
+    CleanupStack::Pop( rtpSink );                                   // CS: 1
+    
+    // IN STREAM
+    // create "audio in" stream
+    CMceAudioStream* audioInStream = CMceAudioStream::NewLC();      // CS: 2
+    // create rtp source for "audio in" stream
+    CMceRtpSource* rtpSource = CMceRtpSource::NewLC(
+            KSvpJitterBufferLength, KSvpJitterBufferThreshold, 
+            KSvpStandbyTimerInMillisecs );                          // CS: 3
+    audioInStream->SetSourceL( rtpSource );
+    // pop rtp source from cleanupstack
+    CleanupStack::Pop( rtpSource );                                 // CS: 2
+    // create speaker sink for "audio in" stream
+    CMceSpeakerSink* speakerSink = CMceSpeakerSink::NewLC();        // CS: 3
+    audioInStream->AddSinkL( speakerSink );
+    // pop speaker from cleanupstack
+    CleanupStack::Pop( speakerSink );                               // CS: 2
+    
+    // Bind "audio out" stream to "audio in" stream. Ownership of the stream
+    // is transferred thus we must pop the instream from CS.
+    audioOutStream->BindL( audioInStream );
+    CleanupStack::Pop( audioInStream );                             // CS: 1
+    
+    // Add stream to session. Note that the ownership is transferred thus
+    // we pop the audioOutStream in this phase.
+    iSession->AddStreamL( audioOutStream );
+    CleanupStack::Pop( audioOutStream );                            // CS: 0
+    
+    // establish Old way hold support 
+    iSession->SetModifierL( KMceMediaDirection,
+            KMceMediaDirectionWithAddress );
+    
+    // preconditions are set so that long negotiation is taken in to use
+    // when establishing secure call
+    if ( SecureMandatory() || SecurePreferred() )
+        {
+        iSession->SetModifierL( KMceSecPreconditions, 
+                                KMcePreconditionsE2ESupported );
+        }
+    else
+        {
+        // else modify preconditions off
+        iSession->SetModifierL( KMcePreconditions, 
+                                KMcePreconditionsNotUsed );
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::ConstructAudioStreamsL audioInStream codec count: %d",
+            audioInStream->Codecs().Count() )
+    SVPDEBUG2( "CSVPSessionBase::ConstructAudioStreamsL audioOutStream codec count: %d",
+            audioOutStream->Codecs().Count() )
+    
+    // add codecs to audiostream
+    iSVPUtility.SetAudioCodecsMOL(
+            iVoIPProfileId, *audioInStream, iKeepAliveValue );
+
+    // set same local media port from InStream to OutStream 
+    audioOutStream->SetLocalMediaPortL( audioInStream->LocalMediaPort() );
+    iSVPUtility.UpdateJitterBufferSizeL( *rtpSource );
+    
+    // set MMF priorities and preferences to codecs
+    SVPDEBUG1( "CSVPSessionBase::ConstructAudioStreamsL Set MMF priorities" )
+    iSVPUtility.SetDtmfMode( SVPAudioUtility::SetPriorityCodecValuesL(
+            *audioInStream, *audioOutStream ) );
+    
+    SVPDEBUG1( "CSVPSessionBase::ConstructAudioStreamsL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::HangUp
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::HangUp()
+    {
+    SVPDEBUG1( "CSVPSessionBase::HangUp In" )
+    
+    TInt err( KErrNone );
+    
+    if ( CMceSession::EEstablished == iSession->State() )
+        {
+        SVPDEBUG1( "CSVPSessionBase::HangUp() TerminateL" )
+        
+        TRAP( err, iSession->TerminateL() );
+        
+        if ( !err )
+            {
+            ExecCbCallStateChanged( MCCPCallObserver::ECCPStateDisconnecting );
+            
+	        // IsAttended() and different timer values needed for 
+            // attended transfer when there is also one waiting call queued
+            // and ringing tone for queued session needs to be played
+            TInt timerID = 0;
+            TInt delay = 0;
+            
+            if ( IsAttended() )
+            	{
+	            delay = KSVPTerminatingTime;
+	            timerID = KSVPTerminationTimerExpired;
+            	}
+            else{
+	            delay = KSVPMoHangupTerminatingTime;
+	            timerID = KSVPHangUpTimerExpired;
+            	}
+            
+            TRAPD( errTimer, StartTimerL( delay, timerID ) );
+            
+            if ( errTimer )
+                {
+                SVPDEBUG2("CSVPSessionBase::HangUp timer leave with error code %d",
+                        errTimer )
+                }
+            else
+            	{
+            	iAlreadyTerminating = ETrue;
+            	}
+            }   
+        }
+    else
+        {
+        SVPDEBUG2( "CSVPSessionBase::HangUp() Wrong state: %d", iSession->State() )
+        
+        StopTimers();
+        ExecCbCallStateChanged( MCCPCallObserver::ECCPStateIdle );
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::HangUp Out return=%d", err )
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Hold
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::Hold()
+    {
+    SVPDEBUG1( "CSVPSessionBase::Hold In" )
+    
+    TInt err( KErrNone );
+    
+    if ( CMceSession::EEstablished == iSession->State() )
+        {
+        if ( !iHoldController )
+            {
+            TRAP( err, iHoldController = 
+                    CSVPHoldController::NewL( *iSession, 
+                                              iContainer, 
+                                              this,
+                                              IsMobileOriginated() ) );
+            if ( KErrNone != err )
+                {
+                return err;
+                }
+            }
+        
+        iHoldController->Muted( iMuted );
+        err = iHoldController->HoldSession( iSession );
+        
+        if ( KErrNone != err )
+            {
+            ExecCbErrorOccurred( ECCPLocalHoldFail );
+            }
+        else
+            {
+            TRAP( err, StartTimerL( KSVPHoldExpirationTime,
+                    KSVPHoldTimerExpired ) );
+            
+            SVPDEBUG2( "CSVPSessionBase::Hold - Started Expire timer, err %i",
+                       err )
+            }
+        }
+    
+    else
+        {
+        ExecCbErrorOccurred( ECCPLocalHoldFail );
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::Hold Out return=%d", err )
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Resume
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::Resume()
+    {
+    SVPDEBUG1( "CSVPSessionBase::Resume In" )
+    
+    TInt err( KErrNone );
+    
+    if ( !iHoldController )
+        {
+        TRAP( err, iHoldController = CSVPHoldController::NewL(
+                *iSession, iContainer, this, IsMobileOriginated() ) );
+        
+        if ( KErrNone != err )
+            {
+            SVPDEBUG2( "CSVPSessionBase::Resume Out return(err)=%d", err )
+            return err;
+            }
+        }
+    
+    iHoldController->Muted( iMuted );  
+    err = iHoldController->ResumeSession( iSession );
+    
+    if ( KErrNone != err )
+        {
+        ExecCbErrorOccurred( ECCPLocalResumeFail );
+        }
+    else
+        {
+        TRAP( err, StartTimerL( KSVPResumeExpirationTime,
+                KSVPResumeTimerExpired ) );
+        SVPDEBUG2("CSVPSessionBase::Resume - Started Expire timer, err %i",
+                   err );
+        }
+        
+    SVPDEBUG2( "CSVPSessionBase::Resume Out return=%d", err )
+    return err;  
+    }
+        
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IncomingRequest
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::IncomingRequest( CMceInSession& aUpdatedSession )
+    {
+    SVPDEBUG1( "CSVPSessionBase::IncomingRequest In" )
+
+    // Check if own request is ongoing
+    if ( iHoldController )
+        {
+        iHoldController->CheckCrossOver( *this );
+        }
+    
+    if ( &aUpdatedSession )
+        {
+        //Because there is an update we have to discard everything about ICMP -3
+        StopTimer ( KSVPICMPErrorTimerExpired );
+        if ( !IsErrorInULandDLFirstTime() )
+            {
+            SetErrorInULandDLFirstTime( ETrue );
+            }
+        
+        TInt err( KErrNone );
+        
+        if ( !iHoldController )
+            {
+            TRAP( err, iHoldController = CSVPHoldController::NewL(
+                    *iSession, iContainer, this, IsMobileOriginated() ) );
+            
+            if ( KErrNone != err )
+                {
+                return err;
+                }
+            
+            TBool sessionUpdateOngoing = ETrue;
+            
+            // Most likely a hold case, MT needs to set the keepalive
+            TRAP_IGNORE( SetRtpKeepAliveL( &aUpdatedSession,
+                    sessionUpdateOngoing ) );
+            }
+        
+        SVPDEBUG2( "CSVPSessionBase::IncomingRequest iSession: 0x%x", iSession )
+        
+        // Update changed session to the transfercontroller
+        if ( iTransferController )
+            {
+            iTransferController->SetMceSessionObject( &aUpdatedSession );
+            }
+        
+        iHoldController->Muted( iMuted );
+        
+        TInt status = iHoldController->IncomingRequest( &aUpdatedSession );
+        SVPDEBUG2( "CSVPSessionBase::IncomingRequest Out return=%d", status )
+        return status;
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPSessionBase::IncomingRequest Out illegal aUpdatedSession" )
+        return KErrArgument;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::HoldController
+// ---------------------------------------------------------------------------
+//    
+CSVPHoldController& CSVPSessionBase::HoldController() const
+    {
+    return *iHoldController;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::HasHoldController
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::HasHoldController() const
+    {
+    if ( iHoldController )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::HandleSessionStateChanged
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::HandleSessionStateChanged( CMceSession& aSession )
+    {
+    SVPDEBUG1( "CSVPSessionBase::HandleSessionStateChanged In" )
+    
+
+    if ( iHoldController )
+        {
+        if ( iHoldController->HoldInProgress() )
+            {
+            SVPDEBUG1( "CSVPSessionBase::HandleSessionStateChanged HoldInProgress" )
+            
+            StopTimers();
+            iHoldController->Muted( iMuted );
+            TInt err = iHoldController->ContinueHoldProcessing( aSession );
+            
+            if ( KErrNone != err )
+                {
+                SVPDEBUG2( "CSVPSessionBase::HandleSessionStateChanged, err: %d", err )
+                ExecCbErrorOccurred( ECCPLocalHoldFail );
+                }
+            }
+        else if ( iHoldController->ResumeFailed() )
+            {
+            // Must terminate session; timer expired
+            SVPDEBUG1( "CSVPSessionBase::HandleSessionStateChanged Resume failed - Terminating" )
+                       
+            TRAPD( err, iSession->TerminateL() );
+            
+            if ( !err )
+                {
+                SVPDEBUG1( "CSVPSessionBase::HandleSessionStateChanged Disconnecting" )
+                ExecCbCallStateChanged( MCCPCallObserver::ECCPStateDisconnecting );
+                
+                TRAP( err, StartTimerL( KSVPMoHangupTerminatingTime,
+                        KSVPHangUpTimerExpired ) );
+                
+                if ( KErrNone != err )
+                    {
+                    SVPDEBUG2("CSVPSessionBase::HandleSessionStateChanged Hangup-timer error %d",
+                            err )
+                    }
+                }
+            else
+                {
+                SVPDEBUG1( "CSVPSessionBase::HandleSessionStateChanged - Term ERROR!" )
+                }
+            }
+        else if ( iHoldController->HoldFailed() )
+            {
+            // Hold timer expired; no actions needed here
+            SVPDEBUG1( "CSVPSessionBase::HandleSessionStateChanged: Hold request failed - nothing to do" )
+            }
+        else
+            {
+            SVPDEBUG1( "CSVPSessionBase::HandleSessionStateChanged - else" )
+            }
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::HandleSessionStateChanged Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::HandleStreamStateChange
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::HandleStreamStateChange( CMceMediaStream& aStream )
+    {
+    SVPDEBUG2( "CSVPSessionBase::HandleStreamStateChange(aStream)  stream state= %d",
+            aStream.State() )
+    SVPDEBUG2( "CSVPSessionBase::HandleStreamStateChange(aStream)  stream  type= %d",
+        aStream.Type() )
+    SVPDEBUG2( "CSVPSessionBase::HandleStreamStateChange(aStream) session state= %d",
+        aStream.Session()->State() )
+
+    if ( CMceMediaStream::EStreaming == aStream.State() &&
+         CMceSession::EOffering == aStream.Session()->State() )
+        {
+        SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange(aStream) early media started" )
+        ExecCbCallEventOccurred( MCCPCallObserver::ECCCSPEarlyMediaStarted );
+        iEarlyMediaOngoing = ETrue;
+        }
+    TBool bothStreamsDisabled ( ETrue );
+    TRAP_IGNORE( bothStreamsDisabled = IsBothStreamsDisabledL() );
+    if ( bothStreamsDisabled &&
+         CMceSession::EEstablished == aStream.Session()->State() && 
+         IsErrorInULandDLFirstTime() )
+        {
+        SetErrorInULandDLFirstTime( EFalse ); 
+        TRAP_IGNORE( StartTimerL( KSVPICMPErrorTime, KSVPICMPErrorTimerExpired ) )
+        }
+      else if ( !bothStreamsDisabled && !IsErrorInULandDLFirstTime() )
+          {
+          SetErrorInULandDLFirstTime( ETrue );
+          StopTimer ( KSVPICMPErrorTimerExpired );
+          }
+    SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange(aStream) Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::HandleStreamStateChange
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::HandleStreamStateChange( CMceMediaStream& aStream,
+        CMceMediaSink& aSink )
+    {
+    SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange(aStream,aSink) In" )
+    
+    CMceSession::TState sessionState = CMceSession::ETerminated;
+    
+    if ( &aStream )
+        {
+        SVPDEBUG2( "CSVPSessionBase::HandleStreamStateChange(aStream,aSink) stream state=%d",
+                aStream.State() )
+        SVPDEBUG2( "CSVPSessionBase::HandleStreamStateChange(aStream,aSink) stream type=%d",
+                aStream.Type() )
+        }
+    
+    if ( &aStream && aStream.Session() )
+        {
+        sessionState = aStream.Session()->State();
+        SVPDEBUG2( "CSVPSessionBase::HandleStreamStateChange(aStream,aSink) session state=%d", sessionState )
+        }
+    
+    if ( &aSink )
+        {
+        SVPDEBUG2( "CSVPSessionBase::HandleStreamStateChange(aStream,aSink) is sink enabled=%d",
+                aSink.IsEnabled() )
+
+        if ( HasHoldController() && ESVPConnected == HoldController().HoldState() && 
+             !aSink.IsEnabled() && CMceSession::EEstablished == sessionState )
+            {
+            // Hold state is connected but sink is disabled -> try enable after a while
+            SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange - Resume ICMP, Sink" )
+            TRAP_IGNORE( StartTimerL( KSVPSinkResumeICMPErrorTime, KSVPSinkResumeICMPErrorTimerExpired ) )
+            }
+        
+        else if ( !HasHoldController() && !aSink.IsEnabled() && CMceSession::EEstablished == sessionState && 
+                  CMceMediaStream::EDisabled == aStream.State() )
+            {
+            // Not a hold case, mediaStream and sink is disabled -> try enable after a while
+            SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange - ICMP, Sink and MediaStream" )
+            if ( !IsSessionMuted() )
+                {
+                SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange - ICMP, Sink not enabled -> enable" )
+                aSink.EnableL();
+                }
+            }
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange(aStream,aSink) Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::HandleStreamStateChange
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::HandleStreamStateChange( CMceMediaStream& aStream,
+        CMceMediaSource& aSource )
+    {
+    SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange(aStream,aSource) In" )
+    
+    CMceSession::TState sessionState = CMceSession::ETerminated;
+    
+    if ( &aStream )
+        {
+        SVPDEBUG2( "CSVPSessionBase::HandleStreamStateChange(aStream,aSource) stream state=%d",
+                aStream.State() )
+        SVPDEBUG2( "CSVPSessionBase::HandleStreamStateChange(aStream,aSource) stream type=%d",
+                aStream.Type() )
+        }
+    
+    if ( &aStream && aStream.Session() )
+        {
+        sessionState = aStream.Session()->State();
+        SVPDEBUG2( "CSVPSessionBase::HandleStreamStateChange(aStream,aSource) session state=%d", sessionState )
+        }
+    
+    if ( &aSource )
+        {
+        SVPDEBUG2( "CSVPSessionBase::HandleStreamStateChange(aStream,aSource) is source enabled=%d",
+                aSource.IsEnabled() )
+
+        if ( HasHoldController() && ESVPConnected == HoldController().HoldState() && 
+             !aSource.IsEnabled() && CMceSession::EEstablished == sessionState )
+            {
+            // Hold state is connected but source is disabled -> try enable after a while
+            SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange - Resume ICMP, Source" )
+            TRAP_IGNORE( StartTimerL( KSVPSourceResumeICMPErrorTime, KSVPSourceResumeICMPErrorTimerExpired ) )
+            }
+        
+        else if ( !HasHoldController() && !aSource.IsEnabled() && CMceSession::EEstablished == sessionState && 
+                  CMceMediaStream::EDisabled == aStream.State() )
+            {
+            // Not a hold case, mediaStream and source is disabled -> try enable after a while
+            SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange - ICMP, Source and MediaStream" )
+            if ( !IsSessionMuted() )
+                {
+                SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange - ICMP, Source not enabled -> enable" )
+                aSource.EnableL();
+                }
+            }
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::HandleStreamStateChange(aStream,aSource) Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SessionLocallyHeld, from MSVPHoldObserver
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::SessionLocallyHeld()
+    {
+    SVPDEBUG1( "CSVPSessionBase::SessionLocallyHeld In" )
+    
+    ExecCbCallStateChanged( MCCPCallObserver::ECCPStateHold );
+    iRtpObserver.ResetSessionInObserving( this );
+    
+    SVPDEBUG1( "CSVPSessionBase::SessionLocallyHeld Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SessionLocallyResumed, from MSVPHoldObserver
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::SessionLocallyResumed()
+    {
+    SVPDEBUG1( "CSVPSessionBase::SessionLocallyResumed In" )
+    
+    ExecCbCallStateChanged( MCCPCallObserver::ECCPStateConnected );
+    iRtpObserver.ResetSessionInObserving( this );
+    
+    SVPDEBUG1( "CSVPSessionBase::SessionLocallyResumed Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SessionRemoteHeld, from MSVPHoldObserver
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::SessionRemoteHeld()
+    {
+    SVPDEBUG1( "CSVPSessionBase::SessionRemoteHeld In" )
+    
+    ExecCbCallEventOccurred( MCCPCallObserver::ECCPRemoteHold );
+    iRtpObserver.ResetSessionInObserving( this );
+    
+    SVPDEBUG1( "CSVPSessionBase::SessionRemoteHeld Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SessionRemoteResumed, from MSVPHoldObserver
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::SessionRemoteResumed()
+    {
+    SVPDEBUG1( "CSVPSessionBase::SessionRemoteResumed In" )
+    
+    ExecCbCallEventOccurred( MCCPCallObserver::ECCPRemoteResume );
+    iRtpObserver.ResetSessionInObserving( this );
+    
+    SVPDEBUG1( "CSVPSessionBase::SessionRemoteResumed Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::HoldRequestFailed, from MSVPHoldObserver
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::HoldRequestFailed()
+    {
+    SVPDEBUG1( "CSVPSessionBase::HoldRequestFailed In" )
+    
+    ExecCbErrorOccurred( ECCPLocalHoldFail );
+    
+    SVPDEBUG1( "CSVPSessionBase::HoldRequestFailed Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::ResumeRequestFailed, from MSVPHoldObserver
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::ResumeRequestFailed()
+    {
+    SVPDEBUG1( "CSVPSessionBase::ResumeRequestFailed In" )
+    
+    ExecCbErrorOccurred( ECCPLocalResumeFail );
+    
+    SVPDEBUG1( "CSVPSessionBase::ResumeRequestFailed Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::RemoteParty
+// ---------------------------------------------------------------------------
+// 
+const TDesC& CSVPSessionBase::RemoteParty() const
+    {
+    delete iRecipient;
+    iRecipient = NULL;
+    
+    // RemotePartyL is used to handle leave situations
+    TRAPD( remoteErr, RemotePartyL() );
+    
+    if ( KErrNone != remoteErr )
+        {
+        // something went wrong, return null
+        SVPDEBUG2( "CSVPSessionBase::RemoteParty remoteErr=%d", remoteErr )
+        return KNullDesC;
+        }
+    else
+        {
+        return *iRecipient;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::RemotePartyL
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::RemotePartyL() const
+    {
+    SVPDEBUG1( "CSVPSessionBase::RemotePartyL In" )
+    
+    // fetch recipient from Mce, convert recipient to 16-bit descriptor
+    if ( IsMobileOriginated() )
+        {
+        SVPDEBUG1( "CSVPSessionBase::RemotePartyL, mo case, Fetch: RECIPIENT" )
+        iRecipient = HBufC::NewL( iSession->Recipient().Length() );
+        iRecipient->Des().Copy( iSession->Recipient() );
+ 
+        // remove all extra parameters from recipient address
+        TInt index = iRecipient->Des().FindF( KSVPSemiColon );
+        
+        if ( KErrNotFound != index )
+            {
+            iRecipient->Des().Delete( index, iRecipient->Length() );
+            // remove left bracket if exists
+            TInt bracketLocation = iRecipient->Locate( KSVPLeftBracket );
+            if ( KErrNotFound != bracketLocation )
+                {
+                iRecipient->Des().Delete( bracketLocation, 1 );
+                }
+            }
+        
+        // check if anonymous address
+        index = iRecipient->Des().FindF( KSVPAnonymous );
+        if ( KErrNotFound != index )
+            {
+            // Anonymous address case
+            SVPDEBUG2( "CSVPSessionBase::RemotePartyL: Anonymous = %d", index )
+            iRecipient->Des().Copy( KNullDesC );
+            }
+        }
+    else 
+        {
+        SVPDEBUG1( "CSVPSessionBase::RemotePartyL, mt case, Fetch: ORIGINATOR" )
+        HBufC* uri = CSVPUriParser::ParseRemotePartyUriL( 
+            iSession->Originator() );
+        delete iRecipient;
+        iRecipient = uri;
+        uri = NULL;
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::RemotePartyL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::RemotePartyName
+// ---------------------------------------------------------------------------
+// 
+const TDesC& CSVPSessionBase::RemotePartyName()
+    {
+    SVPDEBUG1( "CSVPSessionBase::RemotePartyName()" )
+    
+    HBufC* displayName = NULL;
+    TRAPD( err, displayName = CSVPUriParser::ParseDisplayNameL( 
+        iSession->Originator() ) )
+
+    if ( err || NULL == displayName ) 
+        {
+        SVPDEBUG1( "CSVPSessionBase::RemotePartyName, return KNullDesC" )
+        delete displayName;
+        displayName = NULL;
+        return KNullDesC;
+        }
+    else
+        {
+        delete iDisplayName;
+        iDisplayName = displayName;
+        displayName = NULL;
+        return *iDisplayName;
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::DialledParty
+// ---------------------------------------------------------------------------
+// 
+const TDesC& CSVPSessionBase::DialledParty() const
+    {
+    SVPDEBUG1( "CSVPSessionBase::DialledParty not implemented" )  
+    return KNullDesC;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::State
+// ---------------------------------------------------------------------------
+//
+MCCPCallObserver::TCCPCallState CSVPSessionBase::State() const
+    {
+    SVPDEBUG1( "CSVPSessionBase::State In" )
+    SVPDEBUG2( "CSVPSessionBase::State iSession->State()=%d", iSession->State() )
+    
+    // ccpState can be safely initialized with StatusIdle
+    MCCPCallObserver::TCCPCallState ccpState =
+        MCCPCallObserver::ECCPStateIdle;
+    
+    switch ( iSession->State() )
+        {
+        case CMceSession::EIdle:
+            {
+            SVPDEBUG1( "CSVPSessionBase::State EIdle received" )
+            ccpState = MCCPCallObserver::ECCPStateIdle;
+            break;
+            }
+        case CMceSession::EOffering:
+            {
+            SVPDEBUG1( "CSVPSessionBase::State EOffering received" )
+            ccpState = MCCPCallObserver::ECCPStateConnecting;
+            break;
+            }
+        case CMceSession::EIncoming:
+            {
+            SVPDEBUG1( "CSVPSessionBase::State EIncoming received" )
+            ccpState = MCCPCallObserver::ECCPStateAnswering;
+            break;
+            }
+        case CMceSession::EReserving:
+            {
+            SVPDEBUG1( "CSVPSessionBase::State EReserving received" )
+            ccpState = MCCPCallObserver::ECCPStateConnecting;
+            break;
+            }
+        case CMceSession::EAnswering: 
+            {
+            SVPDEBUG1( "CSVPSessionBase::State EAnswering received" )
+            ccpState = MCCPCallObserver::ECCPStateAnswering;
+            break;
+            }
+        case CMceSession::EProceeding:
+            {
+            SVPDEBUG1( "CSVPSessionBase::State EProceeding received" )
+            ccpState = MCCPCallObserver::ECCPStateConnecting;
+            break;
+            }
+        case CMceSession::EEstablished:
+            {
+            SVPDEBUG1( "CSVPSessionBase::State EEstablished received" )
+            ccpState = MCCPCallObserver::ECCPStateConnected;
+            if( iHoldController && ESVPOnHold == iHoldController->HoldState() )
+                {
+                SVPDEBUG1( "    CSVPSessionBase::State Established and holded" )
+                ccpState = MCCPCallObserver::ECCPStateHold;
+                }
+            break;
+            }
+        case CMceSession::ECancelling:
+            {
+            SVPDEBUG1( "CSVPSessionBase::State ECancelling received" )
+            ccpState = MCCPCallObserver::ECCPStateIdle;  
+            break;
+            }
+        case CMceSession::ETerminating:
+            {
+            SVPDEBUG1( "CSVPSessionBase::State ETerminating received" )
+            ccpState = MCCPCallObserver::ECCPStateDisconnecting;
+            break;
+            }
+        case CMceSession::ETerminated:
+            {
+            SVPDEBUG1( "CSVPSessionBase::State ETerminated received" )
+            
+            if ( MCCPCallObserver::ECCPStateDisconnecting == iSessionState )
+                {
+                SVPDEBUG1( "CSVPSessionBase::State Saving state for termination timer" )
+                ccpState = MCCPCallObserver::ECCPStateDisconnecting;
+                }
+            else
+                {
+                ccpState = MCCPCallObserver::ECCPStateIdle;     
+                }
+            
+            break;
+            }
+        default:
+            {
+            SVPDEBUG1( "CSVPSessionBase::State DEFAULT" )
+            // This block should never be reached.
+            __ASSERT_DEBUG( EFalse, User::Panic(
+                    KSVPName, KSVPPanicBadArgument ) );
+            break;
+            }
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::State Out return=%d", ccpState )
+    return ccpState;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::GetKeepAliveTime
+// ---------------------------------------------------------------------------
+//    
+TInt CSVPSessionBase::GetKeepAliveTime()
+    {
+    return iKeepAliveValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Type
+// ---------------------------------------------------------------------------
+//
+TUid CSVPSessionBase::Uid() const
+    {
+    return KSVPImplementationUid;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Conference
+// ---------------------------------------------------------------------------
+//
+MCCPConferenceCall* CSVPSessionBase::ConferenceProviderL( 
+    const MCCPConferenceCallObserver& /*aObserver*/ )
+    {
+	return NULL;    
+	}
+	
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsSecured
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsSecured() const
+    {
+	SVPDEBUG2( "CSVPSessionBase::IsSecured: %d", iSecured )
+	return iSecured;    
+	}
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsMobileOriginated
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsMobileOriginated() const
+    {
+	SVPDEBUG1( "CSVPSessionBase::IsMobileOriginated" )
+	return EFalse;    
+	}
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsCallForwarded
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsCallForwarded() const
+    {
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Swap
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::Swap()
+    {
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Caps
+// ---------------------------------------------------------------------------
+// 
+MCCPCallObserver::TCCPCallControlCaps CSVPSessionBase::Caps() const
+    {
+    SVPDEBUG1( "CSVPSessionBase::Caps return ECCPCapsPSCall" )
+    return MCCPCallObserver::ECCPCapsPSCall;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Release
+// ---------------------------------------------------------------------------
+//    
+TInt CSVPSessionBase::Release()
+    {
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Dial
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::Dial()
+    {
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Answer
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::Answer()
+    {
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Cancel
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::Cancel()
+    {
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Reject
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPSessionBase::Reject()
+    {
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Queue
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPSessionBase::Queue()
+    {
+    return KErrNotSupported;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Ringing
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPSessionBase::Ringing()
+    {
+    return KErrNotSupported;  
+    }
+   
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::TransferProvider
+// ---------------------------------------------------------------------------
+//
+MCCPTransferProvider* CSVPSessionBase::TransferProviderL(
+     const MCCPTransferObserver& aObserver )
+    {
+    SVPDEBUG1( "CSVPSessionBase::TransferProviderL In" )
+    
+    if ( !iTransferController )
+        {
+        iTransferController = CSVPTransferController::NewL( 
+                                                        iSession,
+                                                        this,
+                                                        iContainer, 
+                                                        *this );
+        iTransferController->AddObserverL( aObserver );
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::TransferProviderL Out" )
+    return iTransferController;
+	}
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::ForwardProviderL
+// ---------------------------------------------------------------------------
+//
+MCCPForwardProvider* CSVPSessionBase::ForwardProviderL(
+     const MCCPForwardObserver& /*aObserver*/ )
+    {
+    return NULL;
+    }
+
+
+// transfer observer
+
+// ---------------------------------------------------------------------------
+// From MSVPTransferObserver
+// Notifier for succesful transfer.
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::TransferNotification( TInt aNotifyCode )
+    {
+    SVPDEBUG2( "CSVPSessionBase::TransferNotification In, aNotifyCode: %d",
+        aNotifyCode );
+    
+    if ( ESVPTransferOKHangUp == aNotifyCode )
+        {
+        SVPDEBUG1( "CSVPSessionBase::TransferNotification: ESVPTransferOKHangUp" )
+        // Transfer complete - hang up current session.
+        HangUp();
+        }
+    else if ( ESVPTransferDecline == aNotifyCode )
+        {
+        SVPDEBUG1( "CSVPSessionBase::TransferNotification: ESVPTransferDecline" )
+        // Inform application - transfer was rejected by the other party,
+        // not a failure, to be precise
+        ExecCbErrorOccurred( ECCPTransferFailed );
+        }
+    else if ( ESVPIncomingRefer == aNotifyCode )
+        {
+        SVPDEBUG1( "CSVPSessionBase::TransferNotification: ESVPIncomingRefer" )
+        // Currently no CallEventOccurred notify to the observer
+        }
+    else
+        {
+        // Internal transfer error if comes here
+        SVPDEBUG1( "CSVPSessionBase::TransferNotification: Unknown notify" )
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::TransferNotification Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// From MSVPTransferObserver
+// Notifier for transfer failure.
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CSVPSessionBase::TransferFailed( TInt aError )
+#else
+void CSVPSessionBase::TransferFailed( TInt /*aError*/ )
+#endif  // _DEBUG
+    {
+    SVPDEBUG1( "CSVPSessionBase::TransferFailed In" )
+    SVPDEBUG2(" CSVPSessionBase::TransferFailed aError=%d", aError )
+    
+    // Inform application about the error
+    ExecCbErrorOccurred( ECCPTransferFailed );
+    
+    SVPDEBUG1( "CSVPSessionBase::TransferFailed Out" )
+    }
+
+//  from CCP DTMF provider
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::CancelDtmfStringSending
+// ---------------------------------------------------------------------------
+// 
+TInt CSVPSessionBase::CancelDtmfStringSending()
+    {
+    SVPDEBUG1( "CSVPSessionBase::CancelDtmfStringSending In" )
+    
+    TInt dtmfErr( KErrNone );
+    
+    if ( !iSVPUtility.GetDTMFMode() ) 
+        {
+        dtmfErr = KErrNotFound;
+        if ( iEventGenerator )
+            {
+            iEventGenerator->StopEvents();
+            dtmfErr = KErrNone;
+            }
+        }
+    else 
+        {
+        const RPointerArray<CMceMediaStream>& streams = iSession->Streams();
+        TInt count = streams.Count();
+        while( count )
+            {
+            count--;
+            CMceMediaStream& mediaStream = *streams[ count ];
+            if ( SVPAudioUtility::DtmfActionCapableStream( mediaStream ) )
+                {
+                TRAP( dtmfErr, mediaStream.Source()->CancelDtmfToneSequenceL() );
+                }
+            else
+                {
+                dtmfErr = KErrNotSupported;
+                }
+            
+            if ( KErrNone != dtmfErr )
+                {
+                return dtmfErr;
+                }
+            }
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::CancelDtmfStringSending Out return=%d", dtmfErr )
+    return dtmfErr;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::StartDtmfTone
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::StartDtmfTone( const TChar aTone )
+    {
+    SVPDEBUG1( "CSVPSessionBase::StartDtmfTone In" )
+    
+    TInt dtmfErr( KErrNone );
+    
+    if ( iSVPUtility.GetDTMFMode() )
+        {
+        SVPDEBUG1( "CSVPSessionBase::StartDtmfTone DTMF Outband" )
+        // fetch streams
+        const RPointerArray<CMceMediaStream>& streams = iSession->Streams();
+        TInt count = streams.Count();
+        while ( count )
+            {
+            count--;
+            CMceMediaStream& mediaStream = *streams[ count ];
+            if ( SVPAudioUtility::DtmfActionCapableStream( mediaStream ) )
+                {
+                TRAP( dtmfErr, mediaStream.Source()->StartDtmfToneL( aTone ) );
+                }
+            else
+                {
+                dtmfErr = KErrNotSupported;
+                }
+            
+            if ( KErrNone != dtmfErr )
+                {
+                SVPDEBUG2( "CSVPSessionBase::StartDtmfToneL dtmfErr: %d",
+                    dtmfErr )
+                
+                return dtmfErr;
+                }
+            }
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPSessionBase::StartDtmfTone DTMF Inband" )
+        iDtmfTone = aTone;
+        DtmfObserver().HandleDTMFEvent( MCCPDTMFObserver::ECCPDtmfManualStart, 
+                                        KErrNone, 
+                                        aTone );
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::StartDtmfTone Out return=%d", dtmfErr )
+    return dtmfErr;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::StopDtmfTone
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::StopDtmfTone()
+    {
+    SVPDEBUG1( "CSVPSessionBase::StopDtmfTone In" )
+    
+    TInt dtmfErr( KErrNone );
+    
+    if ( iSVPUtility.GetDTMFMode() )
+        {
+        const RPointerArray<CMceMediaStream>& streams = iSession->Streams();
+        TInt count = streams.Count();
+        while( count )
+            {
+            count--;
+            CMceMediaStream& mediaStream = *streams[ count ];
+            if ( SVPAudioUtility::DtmfActionCapableStream( mediaStream ) )
+                {
+                TRAP( dtmfErr, mediaStream.Source()->StopDtmfToneL() );
+                }
+            // NOP with inband.
+            
+            if ( KErrNone != dtmfErr )
+                {
+                SVPDEBUG2( "CSVPSessionBase::StopDtmfTone dtmfErr: %d",
+                    dtmfErr )
+                
+                return dtmfErr;
+                }
+            }
+        }
+    else
+        {
+        DtmfObserver().HandleDTMFEvent( MCCPDTMFObserver::ECCPDtmfManualStop, 
+                                        KErrNone, 
+                                        iDtmfTone );
+        }
+
+    SVPDEBUG2( "CSVPSessionBase::StopDtmfTone Out return=%d", dtmfErr )
+    return dtmfErr;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SendDtmfToneString
+// ---------------------------------------------------------------------------
+//
+TInt CSVPSessionBase::SendDtmfToneString( const TDesC& aString )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SendDtmfToneString In" )
+    
+    TInt dtmfErr( KErrNone );
+    TChar dtmfPause('p');
+    // MCE calls if outband DTMF.
+    // Exception is pause character 'p' which is handled always locally
+    if ( !iSVPUtility.GetDTMFMode() ||
+         ( aString.Length() == 1 &&
+           dtmfPause == aString[0] ) ) 
+        {
+        SVPDEBUG1( "CSVPSessionBase::SendDtmfToneString Inband" )
+        
+        delete iDtmfString;
+        iDtmfString = NULL;
+        TRAP( dtmfErr, iDtmfString = HBufC::NewL( aString.Length() ) );
+        if ( KErrNone != dtmfErr )
+            {
+            return dtmfErr;
+            }
+                
+        *iDtmfString = aString;
+        iDtmfLex.Assign( *iDtmfString );
+        
+        if ( !iEventGenerator )
+            {
+            TRAP( dtmfErr,
+            iEventGenerator = CSVPDTMFEventGenerator::NewL( *this ) );
+            }
+        
+        if ( KErrNone != dtmfErr )
+            {
+            SVPDEBUG2( "CSVPSessionBase::SendDtmfToneString IB dtmfErr: %d",
+                dtmfErr )
+            
+            return dtmfErr;
+            }
+        
+        // Dtmf pause length is 2500ms
+        TBool pauseChar = ( aString.Length() == 1 && 
+                            dtmfPause == aString[0] ); 
+        // start events
+        iEventGenerator->StartDtmfEvents( aString.Length(), pauseChar );
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPSessionBase::SendDtmfToneString Outband" )
+        
+        const RPointerArray<CMceMediaStream>& streams = iSession->Streams();
+        TInt count = streams.Count();
+        while( count )
+            {
+            count--;
+            CMceMediaStream& mediaStream = *streams[ count ];
+            
+            if ( SVPAudioUtility::DtmfActionCapableStream( mediaStream ) )
+                {
+                TRAP( dtmfErr,
+                    mediaStream.Source()->SendDtmfToneSequenceL( aString ) );
+                }
+            else
+                {
+                dtmfErr = KErrNotSupported;
+                }
+            
+            if ( KErrNone != dtmfErr )
+                {
+                SVPDEBUG2( "CSVPSessionBase::SendDtmfToneString Out OB dtmfErr: %d", dtmfErr )
+                return dtmfErr;
+                }
+            }
+        }
+    
+    SVPDEBUG2( "CSVPSessionBase::SendDtmfToneString Out return=%d", dtmfErr )
+    return dtmfErr;
+    }
+
+
+// from MSVPPropertyWatchObserver
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::ValueChangedL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::ValueChangedL( TInt aKey, TInt aValue )
+    {
+    SVPDEBUG3("CSVPSessionBase::ValueChangedL In aKey: %d, aValue: %d ", aKey, aValue )
+
+    // fetch streams from session
+    const RPointerArray<CMceMediaStream>& streams = iSession->Streams();
+
+    switch ( aKey )
+        {
+        case KTelMicrophoneMuteState:
+            {
+            PerformMuteChangeL( streams, aValue );
+            break;
+            }
+        default:
+            {
+            SVPDEBUG1( "CSVPSessionBase::ValueChangedL DEFAULT - NOP" )
+            break;
+            }
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::ValueChangedL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::PerformMuteChangeL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::PerformMuteChangeL(
+        const RPointerArray<CMceMediaStream>& aStreams, TInt aValue )
+    {
+    SVPDEBUG1( "CSVPSessionBase::PerformMuteChangeL In" )
+    
+    if ( CMceSession::EOffering == iSession->State() ||
+         iHoldController && ESVPOnHold == iHoldController->HoldState() )
+        {
+		// call is ringing or on hold, we don't perform mute or unmute
+        SVPDEBUG1( "CSVPSessionBase::PerformMuteChangeL, no need for mute nor unmute" )
+        }
+    else
+        {
+        for ( TInt i = 0; i < aStreams.Count(); i++ )
+            {
+            if ( IsMobileOriginated() )
+                {
+                if ( aStreams[ i ]->Source() )
+                    {
+                    if ( EPSTelMicMuteOn == aValue )
+                        {
+                        // mute mic source
+                        SVPAudioUtility::DisableMicSourceL(
+                                *( aStreams[ i ]->Source() ) );
+                        }
+                    else
+                        {
+                        // un-mute mic source            
+                        SVPAudioUtility::EnableMicSourceL(
+                                *( aStreams[ i ]->Source() ) );
+                        }
+                    }
+                }
+            else
+                {
+                if( CMceSession::EEstablished == iSession->State() )
+                    {
+                    if ( EPSTelMicMuteOn == aValue )
+                        {
+                        // mute mic source
+                        SVPAudioUtility::DisableMicSourceL(
+                                *( aStreams[ i ]->BoundStreamL().Source() ) );
+                        }
+                    else
+                        {
+                        // un-mute mic source            
+                        SVPAudioUtility::EnableMicSourceL(
+                                *( aStreams[ i ]->BoundStreamL().Source() ) );
+                        }
+                    }
+                }
+            }
+        
+        if ( EPSTelMicMuteOff == aValue )
+            {
+            SVPDEBUG1( "CSVPSessionBase::PerformMuteChangeL - Enable Speaker" )
+            SVPAudioUtility::EnableSpeakerSinksL( aStreams );
+            }
+        }
+
+    if ( EPSTelMicMuteOn == aValue ) { iMuted = ETrue; }
+    if ( EPSTelMicMuteOff == aValue ) { iMuted = EFalse; }
+
+    if ( iHoldController )
+        {
+        SVPDEBUG1( "CSVPSessionBase::PerformMuteChangeL - update mute status" )
+        iHoldController->Muted( iMuted );
+        }
+
+    SVPDEBUG1( "CSVPSessionBase::PerformMuteChangeL Out" )    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::PropertyDeleted
+// ---------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CSVPSessionBase::PropertyDeleted( TInt aKey )
+#else
+void CSVPSessionBase::PropertyDeleted( TInt /*aKey*/ )
+#endif // __DEBUG
+    {
+    SVPDEBUG2("CSVPSessionBase::PropertyDeleted aKey=%d", aKey )
+    }
+
+
+// from MSVPVolumeUpdateObserver    
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::VolumeChanged
+// ---------------------------------------------------------------------------
+//  
+void CSVPSessionBase::VolumeChanged( TInt aVolume )
+    {
+#ifdef _DEBUG
+    TRAPD( volErr, VolumeChangedL( aVolume ) );
+    SVPDEBUG2("CSVPSessionBase::VolumeChanged volErr=%d", volErr )
+#else
+    TRAP_IGNORE( VolumeChangedL( aVolume ) )
+#endif // _DEBUG
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::VolumeChangedL
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::VolumeChangedL( TInt aVolume )
+    {
+    SVPDEBUG1( "CSVPSessionBase::VolumeChangedL In" )
+    
+    // fetch streams from session
+    const RPointerArray<CMceMediaStream>& stream = iSession->Streams();
+    
+    for ( TInt i = 0; i < stream.Count(); i++ )
+        {
+        // fetch mediastreams for handling
+        CMceMediaStream* mediaStream = stream[ i ];
+        CMceMediaStream& boundStream = mediaStream->BoundStreamL();
+        
+        // fetch sinks from current stream
+        const RPointerArray<CMceMediaSink>& sinks = mediaStream->Sinks();
+        
+        for ( TInt y = 0; y < sinks.Count(); y++ )
+            {
+            // find speaker sink
+            if ( KMceSpeakerSink == sinks[ y ]->Type() )
+                {
+                SVPDEBUG1( "CSVPSessionBase::VolumeChangedL Speaker found(A)" )
+                CMceSpeakerSink* speakerSink =
+                        static_cast<CMceSpeakerSink*>( sinks[ y ] );
+                // get sink max volume and adjust setVol accordingly
+                TInt maxVol = speakerSink->MaxVolumeL();
+                TInt setVol = maxVol * aVolume / KMaxPhoneVolume;
+
+                SVPDEBUG2("CSVPSessionBase::VolumeChangedL maxVol=%d", maxVol )
+                SVPDEBUG2("CSVPSessionBase::VolumeChangedL aVolume=%d", aVolume )
+                SVPDEBUG2("CSVPSessionBase::VolumeChangedL setVol=%d", setVol )
+
+                speakerSink->SetVolumeL( setVol );
+                }
+            } 
+        
+        const RPointerArray<CMceMediaSink>& boundSinks = boundStream.Sinks();
+        
+        for ( TInt z = 0; z < boundSinks.Count(); z++ )
+            {
+            // find speaker sink from bound stream
+            if ( KMceSpeakerSink == boundSinks[ z ]->Type() )
+                {
+                SVPDEBUG1( "CSVPSessionBase::VolumeChangedL Speaker found(B)" )
+                
+                CMceSpeakerSink* speakerSink =
+                        static_cast<CMceSpeakerSink*>( boundSinks[ z ] );
+                // get sink max volume and adjust setVol accordingly
+                TInt maxVol = speakerSink->MaxVolumeL();
+                TInt setVol = maxVol * aVolume / KMaxPhoneVolume;
+                
+                SVPDEBUG2("CSVPSessionBase::VolumeChangedL maxVol=%d", maxVol )
+                SVPDEBUG2("CSVPSessionBase::VolumeChangedL aVolume=%d", aVolume )
+                SVPDEBUG2("CSVPSessionBase::VolumeChangedL setVol=%d", setVol )
+
+                speakerSink->SetVolumeL( setVol );
+                }
+            }
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::VolumeChangedL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SecureMandatory
+// ---------------------------------------------------------------------------
+// 
+TBool CSVPSessionBase::SecureMandatory() const
+    {
+    SVPDEBUG2( "CSVPSessionBase::SecureMandatory=%d", iSecureMandatory )
+    return iSecureMandatory;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SecurePreferred
+// ---------------------------------------------------------------------------
+// 
+TBool CSVPSessionBase::SecurePreferred() const
+    {
+    SVPDEBUG2( "CSVPSessionBase::SecurePreferred=%d", iSecurePreferred )
+    return iSecurePreferred;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SetSecureMandatory
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::SetSecureMandatory( TBool aSecMandatory )
+    {
+    iSecureMandatory = aSecMandatory;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SetSecurePreferred
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::SetSecurePreferred( TBool aSecPreferred )
+    {
+    iSecurePreferred = aSecPreferred;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SetCallEventToBeSent
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::SetCallEventToBeSent( MCCPCallObserver::TCCPCallEvent aCallEventToBeSent )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetCallEventToBeSent" )
+    iCallEventToBeSent = aCallEventToBeSent;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SetParameters
+// ---------------------------------------------------------------------------
+// 
+void CSVPSessionBase::SetParameters( 
+    const CCCPCallParameters& /*aNewParams*/ )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetParameters - NOP" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Parameters
+// ---------------------------------------------------------------------------
+// 
+const CCCPCallParameters& CSVPSessionBase::Parameters() const
+    {
+    SVPDEBUG1( "CSVPSessionBase::Parameters In" )
+    return *iCallParameters;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::Tone
+// ---------------------------------------------------------------------------
+//    
+TCCPTone CSVPSessionBase::Tone() const
+    {
+    SVPDEBUG2( "CSVPSessionBase::Tone iTone: %d", iTone )
+    return iTone;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SetCryptoContextL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::SetCryptoContextL()
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetCryptoContextL In" )
+    
+    if ( KMceSessionSecure == iSession->Type() )
+        {
+        // get supported crypto contexts
+        if ( IsMobileOriginated() )
+            {
+            SVPDEBUG1( "CSVPSessionBase::SetCryptoContextL Secure Mo" )
+            
+            const RArray<TMceCryptoContext>& cryptoContext = 
+                static_cast<CMceSecureOutSession*> ( iSession )->
+                SupportedCryptoContextsL();
+            SVPDEBUG2( "CSVPSessionBase::SetCryptoContextL Supported crypto context count=%d",
+                    cryptoContext.Count() )
+            
+            // set crypto contexts to session
+            static_cast<CMceSecureOutSession*> ( iSession )->
+                SetCryptoContextsL( cryptoContext );
+            }
+        else
+            {
+            SVPDEBUG1( "CSVPSessionBase::SetCryptoContextL Secure Mt" )
+            
+            const RArray<TMceCryptoContext>& cryptoContext = 
+            static_cast<CMceSecureInSession*> ( iSession )->
+                SupportedCryptoContextsL();
+            SVPDEBUG2( "CSVPSessionBase::SetCryptoContextL Supported crypto context count=%d",
+                    cryptoContext.Count() )
+            
+            // set crypto contexts to session
+            static_cast<CMceSecureInSession*> ( iSession )->
+                SetCryptoContextsL( cryptoContext );
+            }
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::SetCryptoContextL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::CheckMmfPrioritiesForDtmfL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::CheckMmfPrioritiesForDtmfL(
+    const RPointerArray<CMceMediaStream>& aAudioStreams ) const
+    {
+    SVPDEBUG1( "CSVPSessionBase::CheckMmfPrioritiesForDtmfL In" )
+    
+    RPointerArray<CMceMediaSource> micsToEnable;
+    CleanupClosePushL( micsToEnable );
+    const TInt streamCount( aAudioStreams.Count() );
+    
+    SVPDEBUG2("CSVPSessionBase::CheckMmfPrioritiesForDtmfL streamCount: %d",
+        streamCount )
+    
+    // First disable the mic before doing any priority updating.
+    for ( TInt s = 0; s < streamCount; s++ )
+        {
+        CMceMediaSource* mic = aAudioStreams[s]->Source();
+        
+        if ( mic && KMceMicSource == mic->Type() && mic->IsEnabled() )
+            {
+            SVPDEBUG1( "CSVPSessionBase::CheckMmfPrioritiesForDtmfL disable mic 1" )
+            mic->DisableL();
+            micsToEnable.AppendL( mic );
+            }
+        
+        // At this point we must have a bound stream, otherwise the session
+        // would be a bit incomplete. Thus can and should leave here if bound
+        // stream is not found.
+        mic = NULL;
+        mic = aAudioStreams[s]->BoundStreamL().Source();
+        
+        if ( mic && KMceMicSource == mic->Type() && mic->IsEnabled() )
+            {
+            SVPDEBUG1( "CSVPSessionBase::CheckMmfPrioritiesForDtmfL disable mic 2" )
+            mic->DisableL();
+            micsToEnable.AppendL( mic );
+            }
+        
+        mic = NULL;
+        }
+    
+    // Set the correct priority and preference values.
+    for ( TInt k = 0; k < streamCount; k++ )
+        {
+        // No need to check against BoundStream(), see comments above.
+        if ( KMceAudio == aAudioStreams[k]->Type() )
+            {
+            SVPDEBUG2( "CSVPSessionBase::CheckMmfPrioritiesForDtmfL round: %d start", k )
+            CMceAudioStream* stream = static_cast<CMceAudioStream*>( aAudioStreams[k] );
+            
+            TBool dtmfMode = EFalse;
+            
+            if ( SVPAudioUtility::IsDownlinkStream( *stream ) )
+                {
+                dtmfMode = SVPAudioUtility::SetPriorityCodecValuesL( *stream,
+                    static_cast<CMceAudioStream&>( stream->BoundStreamL() ) );
+                }
+            else
+                {
+                dtmfMode = SVPAudioUtility::SetPriorityCodecValuesL(
+                    static_cast<CMceAudioStream&>( stream->BoundStreamL() ),
+                        *stream );
+                }
+            
+            iSVPUtility.SetDtmfMode( dtmfMode );
+            
+            SVPDEBUG2( "CSVPSessionBase::CheckMmfPrioritiesForDtmfL round: %d done", k )
+            }
+        }
+    
+    // Priorities are now correct, so update the session.
+    iSession->UpdateL();
+    
+    // Now enable mics after we have correct priorities.
+    const TInt mics = micsToEnable.Count();
+    
+    for ( TInt t = 0; t < mics; t++ )
+        {
+        SVPDEBUG2( "CSVPSessionBase::CheckMmfPrioritiesForDtmfL enabling mics, round: %d", t )
+        micsToEnable[t]->EnableL();
+        }
+    
+    // Mics not owned
+    CleanupStack::PopAndDestroy( &micsToEnable );
+    
+    SVPDEBUG1( "CSVPSessionBase::CheckMmfPrioritiesForDtmfL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SessionStateChangedL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::SessionStateChangedL( TInt aOrigStatus,
+    TCCPError aError, TInt aModStatus )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL In" )
+    SVPDEBUG2( "CSVPSessionBase::SessionStateChangedL aOrigStatus=%d",
+        aOrigStatus )
+    SVPDEBUG2( "CSVPSessionBase::SessionStateChangedL aError=%d",
+        aError )
+    SVPDEBUG2( "CSVPSessionBase::SessionStateChangedL aModStatus=%d",
+        aModStatus )
+    
+    // secure status was "secure call mandatory", only secure allowed
+    if ( KErrNone != aModStatus && SecureMandatory() )
+        {
+        if ( KSVPNotAcceptableHereVal == aModStatus ||
+             KSVPNotAcceptableVal == aModStatus ||
+             KSVPPreconditionFailureVal == aModStatus ||
+             KSVPMethodNotAllowedVal == aModStatus )
+            {
+            SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL - Secure session failed!" )
+            // secure call failed due to recipients restrictions
+            User::LeaveIfError( ExecCbErrorOccurred( ECCPSecureCallFailed ) );
+            }
+        else
+            {
+            // secure call failed with SIP error response
+            // inform application about the error response received
+            User::LeaveIfError( ExecCbErrorOccurred( aError ) );
+            
+            // start termination timer, needed for UI
+            // to handle Disconnected-bubble   
+            StartTimerL( KSVPTerminatingTime, KSVPTerminationTimerExpired );
+            User::LeaveIfError( ExecCbCallStateChanged( MCCPCallObserver::ECCPStateDisconnecting ) );
+            }
+        }
+   
+    if ( KSVPRingingVal == aOrigStatus )
+        {
+        SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL - 180 ringing received" )
+        User::LeaveIfError( ExecCbCallStateChanged( MCCPCallObserver::ECCPStateConnecting ) );
+        if ( iEarlyMediaOngoing )
+            {
+            // early media event is sent again to avoid simultaneous early media and ringback tone
+            SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL ringing ja earlymedia flag on" )
+            ExecCbCallEventOccurred( MCCPCallObserver::ECCCSPEarlyMediaStarted );
+            iEarlyMediaOngoing = EFalse;
+            }
+        }
+    
+    if ( KSVPQueuedVal == aOrigStatus )
+        {
+        SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL - 182 queued received" )
+        User::LeaveIfError( ExecCbSsEventOccurred( MCCPSsObserver::ESsCallWaiting ) );
+        }
+    
+    switch( iSession->State() )
+        {
+        case CMceSession::EEstablished:
+            {
+            // stop mt drop out timer or mo invite timer
+            StopTimers();
+            
+            // mute status must be checked again in Mt -> 
+            // there might be one call already in mute state        
+            TInt value( EPSTelMicMuteOff );
+            RProperty::Get( KPSUidTelMicrophoneMuteStatus, 
+                    KTelMicrophoneMuteState, value );
+            
+            // check initial mute status 
+            if ( EPSTelMicMuteOn == value )
+                {
+                SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL Mute: ON" )
+                ValueChangedL( KTelMicrophoneMuteState, EPSTelMicMuteOn );
+                }
+            // secure session created successfully, set iSecured flag to ETrue
+            if ( KMceSessionSecure == iSession->Type() && 
+                 CMceSession::EControlPathSecure == iSession->ControlPathSecurityLevel() )
+                {
+                SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL - Secure session created" )
+                iSecured = ETrue;
+                }
+            else
+                {
+                SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL - Non-secure session created" )
+                iSecured = EFalse;
+                if ( SecurePreferred() )
+                    {
+                    // Secure preferred but unsecure session created -> send info to ccp api
+                    SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL - secure was preferred" )
+                    iCallEventToBeSent = MCCPCallObserver::ECCPNotSecureCall;
+                    }
+                }
+            
+            // We need get the call state now because session state will
+            // change when doing CheckMmfPrioritiesForDtmfL because it updates
+            // the session. This leads into 'Offering' state which will
+            // panic our State() function call.
+            // Note: session's state will fall back to 'Established' because
+            // the priority update does not lead into a real update.
+            MCCPCallObserver::TCCPCallState callState = State();
+            
+            // We need to check MMF priorities only in MO case if really
+            // neccessary
+            if ( IsMobileOriginated() &&
+                 SVPAudioUtility::MmfPriorityUpdateNeededL( iSession->Streams() ) )
+                {
+                CheckMmfPrioritiesForDtmfL( iSession->Streams() );
+                }
+            if ( IsMobileOriginated() )
+                {
+                TBool sessionUpdateOngoing = EFalse;
+                UpdateKeepAliveL( *iSession, sessionUpdateOngoing );
+                }
+            
+            // enable speaker sink
+            SVPAudioUtility::EnableSpeakerSinksL( iSession->Streams() );
+            // call state callback
+            User::LeaveIfError( ExecCbCallStateChanged( callState ) );
+            
+            // 'NotSecure' call event must be sent after the
+            // 'callstatechanged' - event, not before because phone needs an
+            // active call for playing the unsecure tone.
+            if ( MCCPCallObserver::ECCPSecureNotSpecified != iCallEventToBeSent )
+                {
+                 if ( MCCPCallObserver::ECCPSecureCall == iCallEventToBeSent ||
+                     MCCPCallObserver::ECCPNotSecureCall == iCallEventToBeSent )
+                    {
+                    SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL - sending secure specific call event" )
+                    User::LeaveIfError( ExecCbCallEventOccurred( iCallEventToBeSent ) );
+                    }
+                SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL - sending remotePartyInfoChanged event" )
+                User::LeaveIfError( ExecCbCallEventOccurred( MCCPCallObserver::ECCPNotifyRemotePartyInfoChange ) );
+                iCallEventToBeSent = MCCPCallObserver::ECCPSecureNotSpecified;
+                }
+            break;
+            }
+        case CMceSession::EAnswering:
+        case CMceSession::EReserving:
+        case CMceSession::EIncoming:
+        case CMceSession::EOffering:
+            {
+            SVPDEBUG1( "CSVPSessionBase:SessionStateChangedL: No action" )
+            break;
+            }
+        case CMceSession::ECancelling:
+        case CMceSession::EIdle:
+        case CMceSession::ETerminating:
+        case CMceSession::EProceeding:
+            {
+            SVPDEBUG1( "CSVPSessionBase:SessionStateChangedL: Callback state change" )
+            User::LeaveIfError( ExecCbCallStateChanged( State() ) );
+            break;
+            }
+        case CMceSession::ETerminated:
+            {
+            SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL Terminated" )
+            
+            if ( MCCPCallObserver::ECCPStateDisconnecting != iSessionState &&
+                 MCCPCallObserver::ECCPStateIdle != iSessionState &&
+                 iCCPSessionObserver )
+                {
+                // probably some SIP error occurred, inform client
+                if ( aOrigStatus < 0 )
+                	{
+                    SVPDEBUG2( "CSVPSessionBase::SessionStateChangedL, aOrigStatus=%d", aOrigStatus )
+                    
+                    switch ( aOrigStatus )
+                        {
+                        case KErrSIPForbidden:
+                            {
+                            User::LeaveIfError( ExecCbErrorOccurred( ECCPErrorNoService ) );
+                            }
+                            break;
+                        default:
+                            {
+                            User::LeaveIfError( ExecCbErrorOccurred( ECCPGlobalFailure ) );
+                            }
+                            break;
+                        }
+                    }
+                
+                if ( KErrNone != aModStatus )
+                    {
+                    User::LeaveIfError( ExecCbErrorOccurred( aError ) );
+                    }
+                
+                iSessionState = MCCPCallObserver::ECCPStateDisconnecting;
+                iTerminatingRepeat = 0;
+                
+                StartTimerL( KSVPTerminatingTime, KSVPTerminationTimerExpired );
+                User::LeaveIfError( ExecCbCallStateChanged( State() ) );
+                
+                // Termination engaged by the remote end ->
+                // Client is informed with ECCPRemoteTerminated event
+                // This prevents automatic unhold when two calls, 
+                // one on hold and one active, exist.
+                if ( !iAlreadyTerminating )
+                    {
+                    User::LeaveIfError( ExecCbCallEventOccurred(
+                            MCCPCallObserver::ECCPRemoteTerminated ) );
+                    }
+                }
+            else if ( iCCPSessionObserver )
+                {
+                User::LeaveIfError( ExecCbCallStateChanged(
+                        MCCPCallObserver::ECCPStateIdle ) );
+                }
+            else
+                {
+                SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL Session creation failed in early stage - terminate" )
+                iObserver.TerminateSession(  (CMceInSession&) Session() );
+                }
+            break;
+            }
+        default:
+            {
+            SVPDEBUG1( "CSVPSessionBase:SessionStateChangedL DEFAULT" )
+            break;
+            }
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::SessionStateChangedL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::UpdateKeepAliveL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::UpdateKeepAliveL( CMceSession& aSession, 
+        TBool aSessionUpdateOngoing )
+    {
+    SVPDEBUG1( "CSVPSessionBase:UpdateKeepAliveL In" )
+    
+    // update keepalive -> mo and mt
+    SVPDEBUG1( "CSVPSessionBase::UpdateKeepAliveL Starting CN handling" )
+    
+    const RPointerArray<CMceMediaStream>& streamArray = aSession.Streams();
+    TInt streamCount( streamArray.Count() );
+    TBool cnInAnswer = EFalse;
+    
+    for ( TInt i = 0; i < streamCount; i++ )
+        {
+        CMceAudioStream* stream = static_cast<CMceAudioStream*>( streamArray[ i ] );
+        
+        if ( iSVPUtility.IsComfortNoise( *stream ) )
+            {
+            cnInAnswer = ETrue;
+            SVPDEBUG1( "CSVPSessionBase::UpdateKeepAliveL CN Found" )
+            iSVPUtility.SetCNKeepAliveL( *stream, iKeepAliveValue );
+            }
+        }
+    
+    if ( !cnInAnswer )
+        {
+        SVPDEBUG1( "CSVPSessionBase::UpdateKeepAliveL CN NOT Found" )
+        SVPDEBUG2( "CSVPSessionBase::SessionStateChangedL Streamcount: %d", streamCount )
+        
+        while( streamCount-- )
+            {
+            CMceAudioStream* stream = static_cast< CMceAudioStream* >( streamArray[ streamCount ] );
+            iSVPUtility.SetKeepAliveL( *stream, iKeepAliveValue );
+            }
+        }
+    
+    if ( !aSessionUpdateOngoing )
+        {
+        SVPDEBUG1( "CSVPSessionBase::UpdateKeepAliveL  -> UPDATE" )
+        aSession.UpdateL();
+        SVPDEBUG1( "CSVPSessionBase::UpdateKeepAliveL  -> UPDATE DONE" )
+        }
+    SVPDEBUG1("CSVPSessionBase:UpdateKeepAliveL Out")
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::UpdateFailed
+// ---------------------------------------------------------------------------
+//    
+void CSVPSessionBase::UpdateFailed( CMceSession& aSession, TInt aStatusCode )
+    {
+    SVPDEBUG1( "CSVPSessionBase::UpdateFailed In" )
+    SVPDEBUG2( "CSVPSessionBase::UpdateFailed aStatusCode=%d", aStatusCode )
+    
+    // Check if MCE Session has changed
+    if ( &Session() != &aSession )
+        {
+        // And if, then update to the current session
+        SVPDEBUG1( "CSVPSessionBase::UpdateFailed - update MCE Session" )
+        delete iSession;
+        iSession = &aSession;
+        }
+    
+    if ( iHoldController )
+        {
+        iHoldController->RequestFailed( aSession, aStatusCode, *this );
+        }
+    
+    SVPDEBUG1( "CSVPSessionBase::UpdateFailed Out" )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SetRtpKeepAliveL
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::SetRtpKeepAliveL( CMceSession* /*aSession*/, 
+                                        TBool /*aSessionUpdateOngoing*/ )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetRtpKeepAliveL" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SetUpdatedSession
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::SetUpdatedSession( CMceInSession* aUpdatedSession )
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetUpdatedSession In" )
+    
+    delete iSession;
+    iSession = aUpdatedSession;
+
+	// lets check should mic be muted 
+    const RPointerArray<CMceMediaStream>& streamsArray = iSession->Streams(); 
+    const TInt streamCount( streamsArray.Count() );
+    if ( streamCount && iMuted )
+        {
+        SVPDEBUG1( "CSVPSessionBase::SetUpdatedSession Mic should be muted" )
+        
+        if ( IsMobileOriginated() ) 
+            {
+            for ( TInt i = 0; i < streamCount; i++ )
+                {
+                if ( streamsArray[i]->Source()->IsEnabled() )
+                    {
+                    SVPDEBUG1( "CSVPSessionBase::SetUpdatedSession Mic is not muted" )
+                    SVPDEBUG1( " -> disable mic" )
+                    streamsArray[i]->Source()->DisableL();
+                    }
+                else 
+                    {
+                    SVPDEBUG1( "CSVPSessionBase::SetUpdatedSession Mic is already" )
+                    SVPDEBUG1( " muted -> no need to disable mic" )
+                    }
+                }
+            }
+        else
+            {
+            // mute mic source
+            for ( TInt i = 0; i < streamCount; i++ )
+                {
+                if ( streamsArray[i]->BoundStreamL().Source()->IsEnabled() )
+                    {
+                    streamsArray[i]->BoundStreamL().Source()->DisableL();
+                    }
+                }
+            }
+        }
+
+    // Update changed session also to the transfercontroller
+    if ( iTransferController )
+        {
+        SVPDEBUG1( "CSVPSessionBase::SetUpdatedSession also to the transfercontroller" )
+        iTransferController->SetMceSessionObject( aUpdatedSession );
+        }
+
+    SVPDEBUG1( "CSVPSessionBase::SetUpdatedSession Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SetEmptyReInvite
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::SetEmptyReInvite()
+    {
+    SVPDEBUG1( "CSVPSessionBase::SetEmptyReInvite In" )
+    iEmptyReInvite = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsEmptyReInvite
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsEmptyReInvite()
+    {
+    SVPDEBUG1( "CSVPSessionBase::IsEmptyReInvite In" )
+    return iEmptyReInvite;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsIdle
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsIdle()
+    {
+    SVPDEBUG1( "CSVPSessionBase::IsIdle In" )
+    return ( MCCPCallObserver::ECCPStateIdle == iSessionState );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SecureSpecified
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::SecureSpecified( ) const 
+   {
+   return ETrue;
+   }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::SetErrorInULandDLFirstTime
+// ---------------------------------------------------------------------------
+//
+void CSVPSessionBase::SetErrorInULandDLFirstTime( TBool aFirstTime )
+    {
+    iErrorInULandDLFirstTime = aFirstTime;
+    SVPDEBUG2("CSVPSessionBase::SetErrorInULandDLFirstTime=%d",iErrorInULandDLFirstTime)
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsErrorInULandDLFirstTime
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsErrorInULandDLFirstTime()
+    {
+    SVPDEBUG2("CSVPSessionBase::IsErrorInULandDLFirstTime=%d",iErrorInULandDLFirstTime)
+    return iErrorInULandDLFirstTime;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsBothStreamsDisabledL
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsBothStreamsDisabledL() const
+    {
+    SVPDEBUG1( "CSVPSessionBase::IsBothStreamsDisabledL() In" )
+    TBool bothStreamsDisabled = ETrue;
+    const RPointerArray<CMceMediaStream>& streams = Session().Streams();
+    TInt streamsCount = streams.Count();
+
+    for ( TInt i = 0; i < streamsCount; i++ )
+        {
+        if( streams[ i ]->State() != CMceMediaStream::EDisabled || 
+            streams[ i ]->BoundStreamL().State() != CMceMediaStream::EDisabled )
+            {
+            bothStreamsDisabled = EFalse;
+            }
+        }
+
+    SVPDEBUG2("CSVPSessionBase::IsBothStreamsDisabledL Out,ret=%d",bothStreamsDisabled)
+    return bothStreamsDisabled;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsSessionMuted
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsSessionMuted() const
+    {
+    SVPDEBUG2("CSVPSessionBase::IsSessionMuted: %d", iMuted )
+    return iMuted;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPSessionBase::IsCLIROnL
+// ---------------------------------------------------------------------------
+//
+TBool CSVPSessionBase::IsCLIROnL() const
+    {
+    return iSVPUtility.IsCLIROnL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpsettings.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,57 @@
+/*
+* 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 : Implements svp settings reader
+*
+*/
+
+#include <spsettings.h>
+#include <spproperty.h>
+#include <spdefinitions.h>
+#include <spentry.h>
+
+#include "svplogger.h"
+#include "svpsettings.h"
+
+// ---------------------------------------------------------------------------
+// Returns the id of VCC enabled VoIP service.
+// EPropertyCallProviderPluginId
+// ---------------------------------------------------------------------------
+//
+TInt SvpSettings::IntPropertyL( TUint aServiceId, 
+                TServicePropertyName aPropertyName )
+    {
+    SVPDEBUG1( "SvpSettings::IntPropertyL In" )
+    // Create settings object and then the property one
+    CSPSettings* settings = CSPSettings::NewLC();
+    CSPProperty* property = CSPProperty::NewLC();
+
+    // Now get the property of the given service
+    // First, get the property and then use the property to get its value.
+    settings->FindPropertyL( aServiceId, aPropertyName, *property );
+
+    TInt value;
+    TInt error = property->GetValue( value );
+    SVPDEBUG2( "SvpSettings::IntPropertyL serviceId = %d", aServiceId )
+    
+    User::LeaveIfError( error );
+
+    // Cleanup and return
+    CleanupStack::PopAndDestroy( property );
+    CleanupStack::PopAndDestroy( settings );
+    
+    SVPDEBUG1( "SvpSettings::IntPropertyL Out" )
+    
+    return value;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpsslogcall.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,500 @@
+/*
+* 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:  Logs Call details in case of Do Not Disturb
+*
+*/
+
+
+// INCLUDE FILES
+#include    "svpsslogcall.h"
+#include    "svpconsts.h"
+#include    "svplogger.h"
+
+#include    <utf.h> 
+
+#include	<cntitem.h>
+#include    <CPbkContactEngine.h> 
+#include    <CPbkContactIter.h>
+#include    <CPbkContactItem.h>
+#include    <CPbkFieldInfo.h>
+
+#include    <AknNotifyStd.h>
+#include    <AknSoftNotifier.h>
+#include    <LogsDomainCRKeys.h>
+
+#include    <RPbkViewResourceFile.h>
+#include    <coemain.h>
+
+// LOCAL CONSTANTS
+_LIT( KLogSubject, "0" );
+
+_LIT8( KLogTagVOIP, "VOIP" ); 
+_LIT8( KLogTagURL, "URL" );  
+_LIT8( KLogTagMA, "MA" );   
+_LIT8( KLogFieldDelimiter, "\t" );
+_LIT8( KLogValueDelimiter, "=" );
+
+const TInt KLogEventTempBufSize = 300;
+const TInt KMaxAddressLength = 256;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::SVPSSLogCall
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSVPSSLogCall::CSVPSSLogCall() : CActive(0)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSVPSSLogCall::ConstructL()
+    {
+    SVPDEBUG1("CSVPSSLogCall::ConstructL, Enter"); 
+    User::LeaveIfError( iFs.Connect() );
+
+    iLogEvent = CLogEvent::NewL();
+    iLogClient = CLogClient::NewL( iFs );
+	iLogsSession = CRepository::NewL( KCRUidLogs );
+
+    CActiveScheduler::Add(this);
+    SVPDEBUG1("CSVPSSLogCall::ConstructL, Exit"); 
+    }
+
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSVPSSLogCall* CSVPSSLogCall::NewL()
+    {
+    SVPDEBUG1("CSVPSSLogCall::NewL, Enter");
+    
+    CSVPSSLogCall* self = new( ELeave ) CSVPSSLogCall;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    SVPDEBUG1("CSVPSSLogCall::NewL, Exit");
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::~CSVPSSLogCall
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSVPSSLogCall::~CSVPSSLogCall()
+    {
+    SVPDEBUG1("CSVPSSLogCall::~CSVPSSLogCall, Enter"); 
+
+    Cancel();
+    delete iLogsSession;
+    delete iLogClient;
+    delete iLogEvent;
+	iFs.Close();
+
+	SVPDEBUG1("CSVPSSLogCall::~CSVPSSLogCall, Exit"); 
+    }
+
+
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::Reset
+// REsets iLogEvent
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSVPSSLogCall::Reset()
+    {
+    SVPDEBUG1("CSVPSSLogCall::Reset, Enter");
+    
+    iLogEvent->SetId( KLogNullId ); 
+    iLogEvent->SetEventType( KNullUid );
+    iLogEvent->SetRemoteParty( KNullDesC );
+    iLogEvent->SetDirection( KNullDesC );
+    iLogEvent->SetTime( Time::NullTTime() );
+    iLogEvent->SetDurationType( KLogNullDurationType );
+    iLogEvent->SetDuration( KLogNullDuration );
+    iLogEvent->SetStatus( KNullDesC ); 
+    iLogEvent->SetSubject( KNullDesC );
+    iLogEvent->SetNumber( KNullDesC );
+    iLogEvent->SetContact( KNullContactId ); 
+    iLogEvent->SetLink( KLogNullLink ); 
+    iLogEvent->SetDescription( KNullDesC ); 
+    iLogEvent->SetFlags( KLogNullFlags );  
+    TRAP_IGNORE( iLogEvent->SetDataL( KNullDesC8 ) );
+    
+    SVPDEBUG1("CSVPSSLogCall::Reset, Exit");
+    }
+
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::FindContactIdL
+// Finds contact if from phonebook if one exists 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+HBufC* CSVPSSLogCall::FindContactTitleL( const TDesC& aSipUri )
+    {
+    SVPDEBUG1("CSVPSSLogCall::FindContactTitleL, Enter");    
+    HBufC* title ( NULL );
+    TBool manyCompleteMatches( EFalse );
+	TContactItemId compId( NULL );    
+       
+    CPbkContactEngine* contacts = CPbkContactEngine::NewL();
+    CleanupStack::PushL( contacts );
+    
+    CPbkContactIter* iter = contacts->CreateContactIteratorLC();
+	TContactItemId contactId = iter->FirstL();
+
+    while ( contactId != KNullContactId && !manyCompleteMatches )
+        {
+        //Get contact item
+        CPbkContactItem* tempContactItem = iter->CurrentL();        
+        
+        TInt count = tempContactItem->CardFields().Count();
+        SVPDEBUG2("  CSVPSSLogCall::FindContactTitleL count: %d", count );
+
+        for ( TInt ind = 0; ind < count ; ind++ )
+            {
+            if ( EPbkFieldIdVOIP ==
+                     tempContactItem->CardFields()[ind].FieldInfo().FieldId() ||
+                 EPbkFieldIdXsp ==
+                     tempContactItem->CardFields()[ind].FieldInfo().FieldId() ||
+                 tempContactItem->CardFields()[ind].FieldInfo().IsVoipField() )
+                {
+                SVPDEBUG1("  CSVPSSLogCall::FindContactTitleL: Contact is FOUND" );
+                
+                //If contact have phone or Internet number fields, get address..  
+                TBuf<KMaxAddressLength> tmpPbookNumber( 
+                    tempContactItem->CardFields()[ind].Text() );
+				
+                RemoveUnusedCharsFromSipAddress( tmpPbookNumber );
+                
+                if ( EPbkFieldIdXsp == tempContactItem->CardFields(
+                         )[ind].FieldInfo().FieldId() )
+                    {
+                    SVPDEBUG1("CSVPSSLogCall::FindContactTitleL, EPbkFieldIdXsp" );
+                    // remove all characters before ":" only leftmost part
+                    TInt pos = tmpPbookNumber.Find( KSVPCln2 );
+                    if ( KErrNotFound != pos )
+                        {
+                        tmpPbookNumber.Delete( KErrNone, pos + 1 );
+                        }
+                    }
+                
+                SVPDEBUG3("  CSVPSSLogCall::FindContactTitleL FoundContactText%d = %S",
+                             ind, &tmpPbookNumber );
+                
+                // Compare complete addresses and set Id if found.
+                if ( CompareSipUri( aSipUri, tmpPbookNumber ) )
+                    {
+                    if ( compId )
+                        {
+                        SVPDEBUG1("CSVPSSLogCall::FindContactTitleL, manyCompleteMatches");
+                        manyCompleteMatches = ETrue;
+                        
+                        // Set to NULL if multiple matches                     
+                        if ( title )
+                            {
+                            delete title;
+                            title = NULL;
+                            }       
+                        }
+                    else
+                        {
+                        title = tempContactItem->GetContactTitleL();
+                        compId = contactId;
+                        ind = count;
+                        }
+                    }
+                }
+            }
+        contactId = iter->NextL();
+        }
+    
+    // Set contact if only one match found
+    if ( compId && !manyCompleteMatches )
+        {
+        iLogEvent->SetContact( compId );
+        } 
+
+    CleanupStack::PopAndDestroy( iter );
+    CleanupStack::PopAndDestroy( contacts );
+
+    SVPDEBUG1("CSVPSSLogCall::FindContactTitleL, Exit");
+    return title;
+    }
+
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::HandleCallLoggingL
+// Logs Call information 
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSVPSSLogCall::HandleCallLoggingL( const TDesC8& aFrom )
+    {
+    SVPDEBUG1("CSVPSSLogCall::HandleCallLoggingL, Enter");
+    
+    Reset();
+    
+    // For recognizing VoIP number and getting
+    // correct "Options" and internet call icon to log.
+	TBuf8<KLogEventTempBufSize> tempBufOne;
+    TBuf8<KLogEventTempBufSize> tempBufTwo;
+    
+    tempBufOne.Append( KLogTagVOIP() );
+    tempBufOne.Append( KLogFieldDelimiter() );
+    tempBufOne.Append( KLogTagURL() );
+    tempBufOne.Append( KLogValueDelimiter() );
+    
+    iLogEvent->SetEventType(KLogCallEventTypeUid);
+    iLogEvent->SetSubject(KLogSubject);
+    
+    TLogString missed;
+    iLogClient->GetString(missed, R_LOG_DIR_MISSED);
+    iLogEvent->SetDirection(missed);
+
+    iLogEvent->SetDurationType( KLogDurationNone );
+    TLogDuration duration = 0;
+    iLogEvent->SetDuration( duration );
+    
+    iLogEvent->SetNumber( KNullDesC );
+    
+    TLogString number;
+    CnvUtfConverter::ConvertToUnicodeFromUtf8( number, aFrom );
+    RemoveUnusedCharsFromSipAddress( number );
+    SVPDEBUG2("  CSVPSSLogCall::HandleCallLoggingL, number = %S", &number );
+
+    if ( KErrNotFound == aFrom.Find( KSVPAnonymousName8 ) )
+    	{
+        SVPDEBUG1("  CSVPSSLogCall::HandleCallLoggingL, URI address is seen" );
+        HBufC* contactName = FindContactTitleL( number );
+        if ( contactName )
+            { 
+            //  Phonebook contact id has been found
+            tempBufTwo.Copy( number );
+            iLogEvent->SetRemoteParty( contactName->Des() );
+            }
+        else
+            { // No phonebook contact id has been found
+           	tempBufTwo.Copy( number );
+           	iLogEvent->SetRemoteParty( number );
+            }
+        
+        if ( contactName )
+            {
+            delete contactName;
+            contactName = NULL;
+            }
+        
+        tempBufOne.Append( tempBufTwo );
+        tempBufTwo.Zero();
+        tempBufOne.Append( KLogFieldDelimiter() );
+        tempBufOne.Append( KLogTagMA() );
+        tempBufOne.Append( KLogValueDelimiter() );
+        }
+    else
+        {
+        SVPDEBUG1("  CSVPSSLogCall::HandleCallLoggingL, URI address is Anonymous" );
+        iLogEvent->SetRemoteParty( KSVPPrivateNumber );
+        }
+    TRAP_IGNORE( iLogEvent->SetDataL( tempBufOne ) );
+    TTime eventTime;
+    eventTime.UniversalTime();
+    iLogEvent->SetTime(eventTime);
+    if( !IsActive() )
+        {
+        iLogClient->AddEvent(*iLogEvent, iStatus);
+        SetActive();
+        }
+	SVPDEBUG1("CSVPSSLogCall::HandleCallLoggingL, Exit");
+    }
+
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::DoCancel
+// Called when an aychronic request is cancelled
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSVPSSLogCall::DoCancel()
+    {
+    SVPDEBUG1("CSVPSSLogCall::DoCancel"); 
+	iLogClient->Cancel();
+    }
+    
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::RunL
+// Called when an aychronic request is completed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CSVPSSLogCall::RunL()
+    {
+    SVPDEBUG1("CSVPSSLogCall::RunL, Enter");
+    // If LogClient AddEvent successful, then show missed call soft notifier
+    if ( KErrNone == iStatus.Int() )
+        {
+        TInt missedCallCount(0);
+        TInt err = iLogsSession->Get( KLogsNewMissedCalls, missedCallCount );
+        
+        if( KErrNotFound == err || KErrUnknown == err || missedCallCount < 0 )
+            {       
+            missedCallCount = 0;
+            iLogsSession->Set( KLogsNewMissedCalls, missedCallCount );
+            }
+        else
+            {
+            missedCallCount++;
+            iLogsSession->Set( KLogsNewMissedCalls, missedCallCount );    
+            }
+        SVPDEBUG2("  CSVPSSLogCall::RunL, missedCallCount: %d", missedCallCount );
+        }
+        
+	SVPDEBUG1("CSVPSSLogCall::RunL, Exit");
+    }
+  
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::RemoveUnusedCharsFromSipAddress
+// Removes unused chars from sip address
+// (other items were commented in a header). 
+// -----------------------------------------------------------------------------
+//
+void CSVPSSLogCall::RemoveUnusedCharsFromSipAddress( TDes& aAddress )
+    {
+    SVPDEBUG1("CSVPSSLogCall::RemoveUnusedCharsFromSipAddress: Enter" );
+    // Display name, '<' and '>' are not used when comparing addresses.
+    TInt pos = aAddress.Find( KSVPLeftBracketMark2 );
+    if ( KErrNotFound != pos )
+        {
+	    SVPDEBUG1("CSVPSSLogCall::RemoveUnusedCharsFromSipAddress: '<' from uri" );
+        aAddress.Delete( 0, pos + 1 );
+        }
+    
+    pos = aAddress.Find( KSVPRightBracketMark2 );
+    if ( KErrNotFound != pos )
+        {
+	    SVPDEBUG3("CSVPSSLogCall::RemoveUnusedCharsFromSipAddress: \
+    	'>' in uri pos = %d, length = %d",
+        pos, aAddress.Length() );
+        aAddress.Delete( pos, aAddress.Length() - pos );
+        }
+        
+    // "sip:" is not used when comparing addresses. 
+    if ( KSVPSipPrefixLength < aAddress.Length() )
+        {
+        TBuf<KSVPSipPrefixLength> sipPrefix;
+        sipPrefix.Copy( aAddress.Left( KSVPSipPrefixLength ) );
+        sipPrefix.LowerCase();
+        if ( !sipPrefix.Compare( KSVPSipPrefix2 ) )
+            {
+            SVPDEBUG1("CSVPSSLogCall::RemoveUnusedCharsFromSipAddress: 'sip:' in uri" );
+			aAddress.Delete( KErrNone, KSVPSipPrefixLength );
+            }
+        }
+
+    // remove all extra parameters from given address
+	pos = aAddress.Find( KSVPSemiColon );        
+    if ( KErrNotFound != pos )
+        {
+	    SVPDEBUG3("CSVPSSLogCall::RemoveUnusedCharsFromSipAddress: \
+    	There is ';' in uri pos = %d, length = %d",
+        pos, aAddress.Length() );
+
+        // Delete ";" and text after it
+        aAddress.Delete( pos, aAddress.Length() - pos );
+        }
+
+    SVPDEBUG1("CSVPSSLogCall::RemoveUnusedCharsFromSipAddress: Exit" );
+    }    
+
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::::CompareSipUri
+// Compares whole sip uri
+// (other items were commented in a header).  
+// -----------------------------------------------------------------------------
+//
+TBool CSVPSSLogCall::CompareSipUri( 
+    const TDesC& aTelNumber, const TDesC& aPbookNumber )
+    {
+    // Complete SIP address must contain host part.
+    if ( KErrNotFound < aTelNumber.Find( KSVPAt2 ) &&
+         KErrNotFound < aPbookNumber.Find( KSVPAt2 ) )
+        {
+        TBuf<KMaxAddressLength> tmpTelNumber( aTelNumber );
+        TBuf<KMaxAddressLength> tmpPbookNumber( aPbookNumber );
+    
+        // Compare username parts, which are case sensitive.
+        if ( CompareUsernamePart( tmpTelNumber, tmpPbookNumber ) )
+            {
+            // Convert descriptors to lowercase.
+            tmpTelNumber.LowerCase();
+            tmpPbookNumber.LowerCase();
+
+            // Compare host part, which is not case sensitive.
+            if ( !tmpTelNumber.Compare( tmpPbookNumber ) )
+                {
+                SVPDEBUG1("CSVPSSLogCall::CompareSipUri: SipUri's EQUAL");
+                return ETrue;
+                }
+            }
+        }
+    SVPDEBUG1("CSVPSSLogCall::CompareSipUri: SipUri's do NOT EQUAL");    
+    return EFalse;    
+    }
+    
+// -----------------------------------------------------------------------------
+// SVPSSLogCall::::CompareUsernamePart
+// Compares username of sip uri
+// (other items were commented in a header).  
+// -----------------------------------------------------------------------------
+//
+TBool CSVPSSLogCall::CompareUsernamePart( 
+    const TDesC& aTelNumber, const TDesC& aPbookNumber )
+    {
+    TBuf<KMaxAddressLength> tmpTelNumber( aTelNumber );
+    TBuf<KMaxAddressLength> tmpPbookNumber( aPbookNumber );
+    
+    // Remove uri part from tel. number.
+    TInt pos = tmpTelNumber.Find( KSVPAt2 );
+    if ( KErrNotFound < pos )
+        {
+        tmpTelNumber.Delete( pos, tmpTelNumber.Length() - pos );
+        }
+    
+    // Remove uri part from phonebook number.
+    pos = tmpPbookNumber.Find( KSVPAt2 );
+    if ( KErrNotFound < pos )
+        {
+        tmpPbookNumber.Delete( pos, tmpPbookNumber.Length() - pos );
+        }            
+
+    // Compare parsed numbers.
+    if ( !tmpTelNumber.Compare( tmpPbookNumber ) )
+        {
+        SVPDEBUG1("CSVPSSLogCall::CompareUsernamePart: Names EQUAL");
+        return ETrue;
+        }
+	SVPDEBUG1("CSVPSSLogCall::CompareUsernamePart: Names do NOT EQUAL");        
+    return EFalse;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpsupplementaryservices.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,238 @@
+/*
+* 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:  Class for implementing Call Restrictions Supplementary services
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    "svpsupplementaryservices.h"
+#include    "svplogger.h"
+#include    "svpconsts.h"
+#include     <settingsinternalcrkeys.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CSSCallRestrictionsApp::CSSCallRestrictionsApp
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CSVPSupplementaryServices::CSVPSupplementaryServices()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSupplementaryServices::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CSVPSupplementaryServices::ConstructL()
+    {
+    SVPDEBUG1("CSVPSupplementaryServices::ConstructL, Enter");
+
+    iRichCallRepository = CRepository::NewL( KCRUidRichCallSettings );
+    iLogCall = CSVPSSLogCall::NewL();
+    
+    SVPDEBUG1("CSVPSupplementaryServices::ConstructL, Exit");
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSupplementaryServices::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSVPSupplementaryServices* CSVPSupplementaryServices::NewL()
+    {
+    CSVPSupplementaryServices* self = CSVPSupplementaryServices::NewLC();
+    CleanupStack::Pop( self );
+    
+    SVPDEBUG1("CSVPSupplementaryServices::NewL, Exit");
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSupplementaryServices::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CSVPSupplementaryServices* CSVPSupplementaryServices::NewLC()
+    {
+    CSVPSupplementaryServices* self = 
+        new( ELeave ) CSVPSupplementaryServices;
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    SVPDEBUG1("CSVPSupplementaryServices::NewLC, Exit");
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSupplementaryServices::~CSVPSupplementaryServices
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CSVPSupplementaryServices::~CSVPSupplementaryServices()
+    {
+	SVPDEBUG1("CSVPSupplementaryServices::~CSVPSupplementaryServices, Enter");
+    delete iLogCall;
+    delete iRichCallRepository;
+    SVPDEBUG1("CSVPSupplementaryServices::~CSVPSupplementaryServices, Exit");
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSupplementaryServices::CheckRestrictionsL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TSupplementaryServicesEvent	CSVPSupplementaryServices::CheckRestrictionsL( 
+									CDesC8Array& aHeaders )
+    {
+    SVPDEBUG1("CSVPSupplementaryServices:CheckRestrictionsL, Enter");
+
+	TInt currentAnonymous( KSVPAnonymousBarringOff ); 
+	TInt currentDoNotDisturb( KSVPDoNotDisturbOff ); 
+
+	TInt isAnonymousAddress (0);
+	TInt isAnonymousSecAddress ( 0 );
+//  Should URI be checked separately too in case there is no display name?
+	TInt isAnonymousAddressWithoutName ( 0 );
+	TInt isAnonymousSecAddressWithoutName ( 0 );
+	TInt isAnonymousName8 ( 0 );
+
+	TPtrC8 originator = aHeaders.MdcaPoint( KSVPMceArrayIndexOriginator );
+	
+	TInt cycle ( 0 );
+	TCheckingState state ( ESVPIdle );
+	
+	while ( cycle == 0 ) 
+		{
+	    switch( state )
+	        {
+	        
+    	    case ESVPIdle:
+				//	Check from CRepository if anonymous barring is on. Else DnD is on.
+			    iRichCallRepository->Get( 
+        			KRCSEAnonymousCallBlockRule, currentAnonymous );
+				SVPDEBUG2(" CSVPSupplementaryServices:CheckRestrictionsL AnonymousBarring: %d",
+				            currentAnonymous );                                                  
+    			iRichCallRepository->Get( KRCSEDoNotDisturb, currentDoNotDisturb );
+				SVPDEBUG2(" CSVPSupplementaryServices:CheckRestrictionsL DoNotDisturb: %d",
+				            currentDoNotDisturb );
+				
+				if ( KSVPAnonymousBarringOff == currentAnonymous &&
+                     KSVPDoNotDisturbOff == currentDoNotDisturb )
+					{
+					state = ESVPAllowingDail;
+					}
+				else if ( KSVPAnonymousBarringOff == currentAnonymous &&
+                          KSVPDoNotDisturbOn == currentDoNotDisturb )
+					{
+					state = ESVPMakingCallLog;
+					}
+				else if ( KSVPAnonymousBarringOn == currentAnonymous )
+					{
+					isAnonymousAddress = originator.Find( KSVPMyAnonymousAddress );
+					isAnonymousSecAddress = originator.Find( KSVPMyAnonymousSecAddress );
+					isAnonymousAddressWithoutName = originator.Find( KSVPAnonymousAddressWithoutName );
+					isAnonymousSecAddressWithoutName = originator.Find( KSVPAnonymousSecAddressWithoutName );
+					isAnonymousName8 = originator.Find( KSVPAnonymousName8 );
+					
+					if ( KSVPDoNotDisturbOff == currentDoNotDisturb )
+						{
+						state = ESVPCheckingAnonymousToDial;
+						}
+					else if ( KSVPDoNotDisturbOn == currentDoNotDisturb )
+						{
+						state = ESVPCheckingAnonymousToLog;
+						}
+					else
+						{
+						state = ESVPError;
+						}	
+					}
+				else
+					{
+					state = ESVPError;
+					}	
+				break;
+
+        	case ESVPAllowingDail:
+        		iSSEvent = ESVPSSDefault;	
+        		state = ESVPIdle;
+        		cycle = 1;
+            	break;
+
+        	case ESVPMakingCallLog:
+    			iLogCall->HandleCallLoggingL( originator );
+    			
+        		iSSEvent = ESVPSSDoNotDisturb;	
+        		state = ESVPRejectingCall;
+            	break;
+
+        	case ESVPCheckingAnonymousToDial:
+        		if( KErrNotFound != isAnonymousAddress || 
+          			KErrNotFound != isAnonymousSecAddress || 
+          			KErrNotFound != isAnonymousAddressWithoutName || 
+          			KErrNotFound != isAnonymousSecAddressWithoutName || 
+          			KErrNotFound != isAnonymousName8 )
+ 	        		{
+	        		iSSEvent = ESVPSSAnonymousBarring;
+	        		state = ESVPRejectingCall;	
+	        		}
+	        	else 
+		        	{
+        			state = ESVPAllowingDail;	
+		        	};
+		        break;
+		        
+        	case ESVPCheckingAnonymousToLog:
+        		if( KErrNotFound != isAnonymousAddress || 
+          			KErrNotFound != isAnonymousSecAddress || 
+          			KErrNotFound != isAnonymousAddressWithoutName || 
+          			KErrNotFound != isAnonymousSecAddressWithoutName || 
+          			KErrNotFound != isAnonymousName8 ) 
+	        		{
+					iSSEvent = ESVPSSAnonymousBarring;	
+	        		state = ESVPRejectingCall;
+	        		}
+	        	else 
+		        	{
+        			state = ESVPMakingCallLog;
+		        	};
+		        break;
+        		
+        	case ESVPRejectingCall:
+        		state = ESVPIdle;
+        		cycle = 1;
+            	break;
+
+        	case ESVPError:
+        		// Collect error situation. Should not come there ever
+        		state = ESVPIdle;
+        		cycle = 1;
+            	break;
+			}
+		}
+
+	SVPDEBUG2("CSVPSupplementaryServices:CheckRestrictionsL Exit, event: %d", iSSEvent);
+	return iSSEvent; 
+
+    }
+
+//End of File    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svptimer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,121 @@
+/*
+* 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:  Timer service for SVP     
+*
+*/
+
+#include "svptimer.h"
+#include "svplogger.h"
+#include "svptimerobserver.h"
+
+
+const TInt KMicroSecondsCoefficient = 1000;
+
+
+// ---------------------------------------------------------------------------
+// CSVPTimer::CSVPTimer
+// ---------------------------------------------------------------------------
+//
+CSVPTimer::CSVPTimer( MSVPTimerObserver& aObserver, TInt aTimerId ): 
+    CTimer( EPriorityHigh ),
+    iObserver( aObserver ),
+    iId( aTimerId )
+    {
+    SVPDEBUG2("CSVPTimer::CSVPTimer -- ID: %i", iId );
+    
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTimer::CSVPTimer
+// ---------------------------------------------------------------------------
+//
+void CSVPTimer::ConstructL()
+    {
+    CTimer::ConstructL();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTimer::CSVPTimer
+// ---------------------------------------------------------------------------
+//
+CSVPTimer* CSVPTimer::NewL( MSVPTimerObserver& aObserver,
+                            TInt aTimerId )
+    {
+    CSVPTimer* self = new (ELeave) CSVPTimer( aObserver, aTimerId );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTimer::~CSVPTimer
+// ---------------------------------------------------------------------------
+//  
+CSVPTimer::~CSVPTimer()
+    {
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTimer::RunL
+// ---------------------------------------------------------------------------
+//  
+void CSVPTimer::RunL()
+    {
+    SVPDEBUG1("CSVPTimer::RunL In");
+    // Pass control to the observer.
+    SVPDEBUG2( "CSVPTimer::RunL Timer -- ID: %d", iId );
+    iObserver.TimedOut( iId );
+    SVPDEBUG1("CSVPTimer::RunL Out");
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTimer::SetTime
+// ---------------------------------------------------------------------------
+//  
+void CSVPTimer::SetTime( TInt aMilliSeconds )
+    {
+    SVPDEBUG2( "CSVPTimer::SetTime aMilliSeconds: %d", aMilliSeconds );
+    
+    // Milliseconds to microseconds conversion
+    const TTimeIntervalMicroSeconds32 time(
+        KMicroSecondsCoefficient * aMilliSeconds );
+    
+    CTimer::After( time ); // NB, CTimer::After calls SetActive
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTimer::Stop
+// ---------------------------------------------------------------------------
+//  
+void CSVPTimer::Stop()
+    {
+    SVPDEBUG2( "CSVPTimer::Stop Timer -- ID: %d", iId );
+    Cancel(); 
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTimer::Id
+// ---------------------------------------------------------------------------
+//  
+TInt CSVPTimer::Id() const
+    {
+    return iId;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpuriparser.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,830 @@
+/*
+* 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:  provides uri parser methods for SVP 
+*
+*/
+
+#include <uri8.h>
+#include <sipstrings.h>    // For remote party data parsing
+#include <sipfromheader.h> // For remote party data parsing
+#include <sipaddress.h>    // For remote party data parsing
+
+#include "svplogger.h"
+#include "svpconsts.h"
+#include "svpuriparser.h"
+#include "svpcleanupresetanddestroy.h"
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::CSVPUriParser
+// ---------------------------------------------------------------------------
+//
+CSVPUriParser::CSVPUriParser()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPUriParser* CSVPUriParser::NewLC()
+    {
+    CSVPUriParser* self = new ( ELeave ) CSVPUriParser;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPUriParser* CSVPUriParser::NewL()
+    {
+    CSVPUriParser* self = CSVPUriParser::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::~CSVPUriParser
+// ---------------------------------------------------------------------------
+//
+CSVPUriParser::~CSVPUriParser()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::SetUserEqualsPhoneRequiredL
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::SetUserEqualsPhoneRequiredL( TBool aValue )
+    {
+    SVPDEBUG1( "CSVPUriParser::SetUserEqualsPhoneRequiredL" )
+    iUserEqualsPhoneRequired = aValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::UserEqualsPhoneRequiredL
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUriParser::UserEqualsPhoneRequiredL() const
+    {
+    SVPDEBUG1( "CSVPUriParser::UserEqualsPhoneRequired In" )
+    // check if user=phone is required
+    SVPDEBUG2( "CSVPUriParser::UserEqualsPhoneRequired Out: %d",
+           iUserEqualsPhoneRequired )
+    return iUserEqualsPhoneRequired;    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::IsUriValidForUserEqualsPhoneL
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUriParser::IsUriValidForUserEqualsPhoneL( const TDesC8& aUri )
+    {
+    SVPDEBUG1( "CSVPUriParser::IsUriValidForUserEqualsPhoneL In" )
+    
+    /// flag to indicate if all checks are ok
+    TBool userEqPhoneCheck = EFalse;    
+    
+    // Extract user info
+    TUriParser8 uri8Parser;
+    uri8Parser.Parse( aUri );
+    CUri8* cUri8 = CUri8::NewLC( uri8Parser ); // CS:1
+    
+    const TUriC8& tempUri =  cUri8->Uri();
+    const TDesC8& userInfo = tempUri.Extract( EUriUserinfo );
+    
+    TLex8 user( userInfo );
+    TInt length = userInfo.Length();
+    const TChar KSvpPlus( '+' );
+    
+    // Check if there is a preceeding plus
+    if ( KSvpPlus == user.Peek() )
+        {
+        user.Inc();
+        length--;
+        }
+    
+    // Check the minimum length
+    if ( KSVPMinUserInfoLength > length )
+        {
+        userEqPhoneCheck = EFalse;
+        }
+    else // Check that there is only digits
+        {
+        userEqPhoneCheck = ETrue;
+        
+        while ( !user.Eos() )
+            {
+            if ( !user.Peek().IsDigit() )
+                {
+                userEqPhoneCheck = EFalse;
+                break;
+                }
+            
+            user.Inc();
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( cUri8 );
+    
+    SVPDEBUG2( "CSVPUriParser::IsUriValidForUserEqualsPhoneL Out: %d",
+           userEqPhoneCheck )
+    return userEqPhoneCheck;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::CompleteSipUriL
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSVPUriParser::CompleteSipUriL( 
+    const TDesC8& aUri, const TDesC8& aAOR, TBool aIsEmergency ) const
+    {
+    SVPDEBUG1( "CSVPUriParser::CompleteSipUriL In" )
+    
+    // Copy the parameter to a new buffer.
+    HBufC8* uri = aUri.AllocLC();   // CS: 1
+    
+#ifdef _DEBUG
+    TBuf<KSvpMaxDebugBufferSize> tmpStr;
+    tmpStr.Copy( aAOR );
+    SVPDEBUG2( "CSVPUriParser::CompleteSipUriL IN aAOR: %S", &tmpStr )
+    tmpStr.Copy( aUri );
+    SVPDEBUG2( "CSVPUriParser::CompleteSipUriL IN aURI: %S", &tmpStr )
+#endif // _DEBUG
+    
+    // Trim ALL white space from URI, even if used as an user name
+    uri->Des().TrimAll();
+
+    if ( uri )
+        {
+        //First check is this tel-uri. Domain part is not allowed in tel-uri.
+        if ( uri->Length() >= KTelPrefixLength &&
+             KErrNotFound != uri->Des().Left( KTelPrefixLength ).Find( KTelPrefix ) &&
+             KErrNotFound == uri->Des().Find( KSVPAt ) )
+            {
+            CleanupStack::Pop( uri );  // CS:0
+            return uri;
+            }
+        
+        // parse display name if exists
+        while ( KErrNotFound != uri->Find( KSVPSipPrefix ) )
+            {
+            TInt index = uri->Find( KSVPSipPrefix );
+            
+            if ( 0 == index )
+                {
+                uri->Des().Delete( index, 4 );
+                }
+            else
+                {
+                uri->Des().Delete( 0, index );
+                }
+            }
+        
+        // Check "<" and remove it if exists
+        if ( uri->Length() && CheckLeftBracket( *uri ) )
+            {
+            RemoveLeftBracket( uri );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        // Check ">" and remove it if exists
+        if ( uri->Length() && CheckRightBracket( *uri ) )
+            {
+            RemoveRightBracket( uri );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        // Check "sips:" and remove it if exists
+        if ( uri->Length() && CheckSipsPrefix( *uri ) )
+            {
+            RemoveSipsPrefixL( uri );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        // Add "sip:" prefix, if it's missing.
+        if ( !CheckSipPrefix( *uri ) )
+            {
+            AddSipPrefixL( uri );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        // Add "@" character if it's missing
+        if ( !CheckAt( *uri ) )
+            {
+            AddAtL( uri );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        // Add domain, if it's missing
+        if ( !CheckDomain( *uri ) )
+            {
+            AddDomainL( uri, aAOR );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        EscapeEncodeSipUriL( uri, EscapeUtils::EEscapeNormal );
+        CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+        CleanupStack::PushL( uri );
+        
+        // Emergency call has no knowledge of the service ID, therefore
+        // user=phone parameter is omitted
+        if ( !aIsEmergency &&
+             IsUriValidForUserEqualsPhoneL( *uri ) && 
+             UserEqualsPhoneRequiredL() )
+            {
+            AddUserEqualsPhoneL( uri );
+            }
+        }
+    else
+        {
+        SVPDEBUG1( "    CSVPUriParser::CompleteSipUriL uri null" )
+        }
+    
+#ifdef _DEBUG
+    tmpStr.Copy( *uri );
+    SVPDEBUG2( "CSVPUriParser::CompleteSipUriL OUT: %S", &tmpStr )
+#endif // _DEBUG
+    
+    CleanupStack::Pop( 1 ); // uri
+    return uri;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::AddUserEqualsPhone
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::AddUserEqualsPhoneL( HBufC8*& aUri ) const
+    {
+    SVPDEBUG1( "CSVPUriParser::AddUserEqualsPhoneL In" )
+   
+    aUri = aUri->ReAllocL( aUri->Length() + 
+                          KSVPUserEqualsPhoneLength + 
+                          KSVPDoubleBracketLength ); 
+    aUri->Des().Insert( 0, KSVPLeftBracketMark );
+    aUri->Des().Append( KSVPUserEqualsPhone );
+    aUri->Des().Append( KSVPRightBracketMark );
+    
+    SVPDEBUG1( "CSVPUriParser::AddUserEqualsPhoneL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::CompleteSecureSipUriL
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSVPUriParser::CompleteSecureSipUriL(
+    const TDesC8& aUri, const TDesC8& aAOR ) const
+    {
+    SVPDEBUG1( "CSVPUriParser::CompleteSecureSipUriL In" )
+    
+    // Copy the parameter to a new buffer.
+    HBufC8* uri = aUri.AllocLC();
+
+#ifdef _DEBUG
+    TBuf<KSvpMaxDebugBufferSize> tmpStr;
+    tmpStr.Copy( aAOR );
+    SVPDEBUG2( "CSVPUriParser::CompleteSecureSipUriL IN aAOR: %S", &tmpStr )
+    tmpStr.Copy( aUri );
+    SVPDEBUG2( "CSVPUriParser::CompleteSecureSipUriL IN aURI: %S", &tmpStr )
+#endif // _DEBUG
+    
+    // Trim ALL white space from URI, even if used as an user name 
+    uri->Des().TrimAll();
+
+    if ( uri )
+        {
+        //First check is this tel-uri. Domain part is not allowed in tel-uri.
+        if ( uri->Length() >= KTelPrefixLength &&
+             KErrNotFound != uri->Des().Left( KTelPrefixLength ).Find( KTelPrefix ) &&
+             KErrNotFound == uri->Des().Find( KSVPAt ) )
+            {
+            CleanupStack::Pop( uri );
+            return uri;
+            }
+        
+        // Check "<" and remove it if exists
+        if ( uri->Length() && CheckLeftBracket( *uri ) )
+            {
+            RemoveLeftBracket( uri );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        // Check ">" and remove it if exists
+        if ( uri->Length() && CheckRightBracket( *uri ) )
+            {
+            RemoveRightBracket( uri );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        // Check "sip:" and remove it if exists
+        if ( uri->Length() && CheckSipPrefix( *uri ) )
+            {
+            RemoveSipPrefixL( uri );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        // Add "sips:" prefix, if it's missing.
+        if ( !CheckSipsPrefix( *uri ) )
+            {
+            AddSipsPrefixL( uri );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        // Add "@" character if it's missing
+        if ( !CheckAt( *uri ) )
+            {
+            AddAtL( uri );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        // Add domain, if it's missing
+        if ( !CheckDomain( *uri ) )
+            {
+            AddDomainL( uri, aAOR );
+            CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+            CleanupStack::PushL( uri );
+            }
+        
+        EscapeEncodeSipUriL( uri, EscapeUtils::EEscapeNormal );
+        CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+        CleanupStack::PushL( uri );
+        
+        if ( UserEqualsPhoneRequiredL() &&
+             IsUriValidForUserEqualsPhoneL( *uri ) )
+            {
+            AddUserEqualsPhoneL( uri );
+            }
+        }
+    else
+        {
+        SVPDEBUG1( "    CSVPUriParser::CompleteSecureSipUriL uri null" )
+        }
+    
+#ifdef _DEBUG
+    tmpStr.Copy( *uri );
+    SVPDEBUG2( "CSVPUriParser::CompleteSecureSipUriL OUT: %S", &tmpStr )
+#endif // _DEBUG
+    
+    CleanupStack::Pop( 1 ); // uri
+    return uri;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::CompleteEventSipUriL
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSVPUriParser::CompleteEventSipUriL( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPUriParser::CompleteEventSipUriL In" )
+    
+    // Copy the parameter to a new buffer.
+    HBufC8* uri = aUri.AllocLC();
+    
+    // Add "sip:" prefix, if it's missing.
+    if ( !CheckSipPrefix( *uri ) )
+        {
+        AddSipPrefixL( uri );
+        }
+    
+    CleanupStack::Pop( 1 ); // uri
+    
+    SVPDEBUG1( "CSVPUriParser::CompleteEventSipUriL Out" )
+    return uri;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::CheckSipPrefix
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUriParser::CheckSipPrefix( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPUriParser::CheckSipPrefix" )
+    
+    // The "sip:" prefix is expected to be at the beginning of the URI.
+    if ( KErrNotFound == aUri.Find( KSVPSipPrefix ) )
+        {
+        return EFalse;
+        }
+    else
+        {
+        return ETrue;    
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::CheckSipsPrefix
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUriParser::CheckSipsPrefix( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPUriParser::CheckSipsPrefix" )
+    
+    // The "sips:" prefix is expected to be at the beginning of the URI.
+    return ( 0 == aUri.Find( KSVPSipsPrefix ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::CheckAt
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUriParser::CheckAt( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPUriParser::CheckAt" )
+    
+    // It is expected that there is atleast one character between 
+    // "sip:" prefix and "@" character.
+    return ( aUri.Find( KSVPAt ) >= KSVPSipPrefixLength );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::CheckDomain
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUriParser::CheckDomain( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPUriParser::CheckDomain" )
+    
+    // Check whether the "@" chearacter is the last one.
+    return ( aUri.Find( KSVPAt ) < aUri.Length() - 1 );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::DomainL
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSVPUriParser::DomainL( const TDesC8& aUri )
+    {
+    SVPDEBUG1( "CSVPUriParser::DomainL In" )
+    
+    HBufC8* ptr = NULL;
+    
+    // Check that URI is complete; it has domain part:
+    if ( aUri.Find( KSVPAt ) < aUri.Length() - 1 )
+        {
+        TInt uriLength = aUri.Length();
+        TInt atPos = aUri.Find( KSVPAt );
+        //__ASSERT_ALWAYS( atPos != KErrNotFound, User::Leave( KErrArgument ) );
+        TPtrC8 domainPart = aUri.Right( uriLength - atPos - 1 );
+        ptr = domainPart.AllocL();
+        }
+    
+    SVPDEBUG1( "CSVPUriParser::DomainL Out" )
+    return ptr;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::AddSipPrefixL
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::AddSipPrefixL( HBufC8*& aUri ) const 
+    {
+    SVPDEBUG1( "CSVPUriParser::AddSipPrefixL In" )
+    aUri = aUri->ReAllocL( aUri->Length() + KSVPSipPrefixLength );
+    aUri->Des().Insert( 0, KSVPSipPrefix );
+    
+    SVPDEBUG1( "CSVPUriParser::AddSipPrefixL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::RemoveSipPrefixL
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::RemoveSipPrefixL( HBufC8*& aUri ) const 
+    {
+    SVPDEBUG1( "CSVPUriParser::RemoveSipPrefixL" )
+    
+    aUri->Des().Delete( 0, KSVPSipPrefixLength );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::AddSipsPrefixL
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::AddSipsPrefixL( HBufC8*& aUri ) const 
+    {
+    SVPDEBUG1( "CSVPUriParser::AddSipsPrefixL In" )
+    
+    aUri = aUri->ReAllocL( aUri->Length() + KSVPSipsPrefixLength );
+    aUri->Des().Insert( 0, KSVPSipsPrefix );
+    
+    SVPDEBUG1( "CSVPUriParser::AddSipsPrefixL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::RemoveSipsPrefixL
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::RemoveSipsPrefixL( HBufC8*& aUri ) const 
+    {
+    SVPDEBUG1( "CSVPUriParser::RemoveSipsPrefixL" )
+    
+    aUri->Des().Delete( 0, KSVPSipsPrefixLength );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::AddAtL
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::AddAtL( HBufC8*& aUri ) const
+    {
+    SVPDEBUG1( "CSVPUriParser::AddAtL In" )
+    
+    aUri = aUri->ReAllocL( aUri->Length() + KSVPAtLength );
+    aUri->Des().Append( KSVPAt );
+    
+    SVPDEBUG1( "CSVPUriParser::AddAtL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::AddDomainL
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::AddDomainL( 
+    HBufC8*& aUri, const TDesC8& aAOR ) const 
+    {
+    SVPDEBUG1( "CSVPUriParser::AddDomainL In" )
+    
+    // Parse the domain part from the AOR.
+    HBufC8* domainBuf = HBufC8::NewLC( aAOR.Length() ); // CS : 1
+    TInt atPos = aAOR.Find( KSVPAt );
+    
+    // Check, that the "@" character is in AOR.
+    __ASSERT_ALWAYS( KErrNotFound != atPos, User::Leave( KErrArgument ) );
+    // Check, that there is a domain part.
+    __ASSERT_ALWAYS( atPos < aAOR.Length()-1, User::Leave( KErrArgument ) );
+    
+    // Copy the domain to the domain buffer.
+    domainBuf->Des().Append( aAOR.Mid( atPos + 1 ) );
+    
+    // Re-allocate the URI
+    aUri = aUri->ReAllocL( aUri->Length() + domainBuf->Length() );
+    aUri->Des().Append( *domainBuf ); // Append the domain.
+    
+    CleanupStack::PopAndDestroy( domainBuf ); // CS : 0
+    
+    SVPDEBUG1( "CSVPUriParser::AddDomainL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::CheckLeftBracket
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUriParser::CheckLeftBracket( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPUriParser::CheckLeftBracket" )
+    
+    // The "<" prefix is expected to be at the beginning of the URI.
+    return ( 0 == aUri.Find( KSVPLeftBracketMark ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::RemoveLeftBracket
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::RemoveLeftBracket( HBufC8*& aUri ) const 
+    {
+    SVPDEBUG1( "CSVPUriParser::RemoveLeftBracket" )
+    
+    aUri->Des().Delete( 0, KSVPSingleBracketLength );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::CheckRightBracket
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUriParser::CheckRightBracket( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPUriParser::CheckRightBracket" )
+    
+    // The ">" prefix is expected to be at the end of the URI.
+    return ( aUri.Length() == ( aUri.Find( KSVPRightBracketMark )
+                                + KSVPSingleBracketLength ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::RemoveRightBracket
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::RemoveRightBracket( HBufC8*& aUri ) const 
+    {
+    SVPDEBUG1( "CSVPUriParser::RemoveRightBracket" )
+    
+    aUri->Des().Delete( aUri->Length() - KSVPSingleBracketLength,
+                        KSVPSingleBracketLength );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::EscapeEncodeSipUriL
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::EscapeEncodeSipUriL( HBufC8*& aSipUri,
+        EscapeUtils::TEscapeMode aMode )
+    {
+    SVPDEBUG1( "CSVPUriParser::EscapeEncodeSipUriL In" )
+    
+    HBufC8* temp = EscapeUtils::EscapeEncodeL( *aSipUri, aMode );
+    CleanupStack::PushL( temp );
+    aSipUri = aSipUri->ReAllocL( temp->Length() );
+    *aSipUri = *temp;
+    CleanupStack::PopAndDestroy( temp );
+    
+    SVPDEBUG1( "CSVPUriParser::EscapeEncodeSipUriL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::EscapeDecodeSipUriL
+// ---------------------------------------------------------------------------
+//
+void CSVPUriParser::EscapeDecodeSipUriL( HBufC8*& aSipUri )
+    {
+    SVPDEBUG1( "CSVPUriParser::EscapeDecodeSipUriL In" )
+    
+    HBufC8* temp = EscapeUtils::EscapeDecodeL( *aSipUri );
+    CleanupStack::PushL( temp ); 
+    
+    if( temp->Length() > aSipUri->Length() )
+        {
+        aSipUri = aSipUri->ReAllocL( temp->Length() );
+        }
+    
+    *aSipUri = *temp;
+    
+    CleanupStack::PopAndDestroy( temp );
+    
+    SVPDEBUG1( "CSVPUriParser::EscapeDecodeSipUriL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::ParseDisplayNameL
+// ---------------------------------------------------------------------------
+// 
+HBufC* CSVPUriParser::ParseDisplayNameL( const TDesC8& aRemoteParty )
+    {
+    SVPDEBUG1( "CSVPUriParser::ParseDisplayNameL()" )
+        
+    // Open SIP string pool 
+    SIPStrings::OpenL();
+
+    // Make a local copy
+    HBufC8* utf8 = HBufC8::NewLC( aRemoteParty.Length() ); // CS:1
+    ( utf8->Des() ).Copy( aRemoteParty );
+    
+    // Escape decode
+    CSVPUriParser::EscapeDecodeSipUriL( utf8 );
+    
+    // Convert from UTF8 to unicode
+    HBufC* unicode16 = EscapeUtils::ConvertToUnicodeFromUtf8L( *utf8 );
+    CleanupStack::PopAndDestroy( utf8 ); // CS:0
+    CleanupStack::PushL( unicode16 ); // CS:1
+    HBufC8* unicode8 = HBufC8::NewL( unicode16->Length() );
+    ( unicode8->Des() ).Copy( *unicode16 );
+    CleanupStack::PopAndDestroy( unicode16 ); // CS:0
+    CleanupStack::PushL( unicode8 ); // CS:1
+    
+    // Create SIP From header
+    CSIPFromHeader* originatorHdr = CSIPFromHeader::DecodeL( *unicode8 );
+    CleanupStack::PopAndDestroy( unicode8 ); // CS:0
+    CleanupStack::PushL( originatorHdr ); // CS:1
+    
+    // Extract and parse display name, format is "..."
+    HBufC8* displayName8 = originatorHdr->SIPAddress().DisplayName().AllocL();
+    CleanupStack::PopAndDestroy( originatorHdr ); // CS:0
+    CleanupStack::PushL( displayName8 ); // CS:1
+
+    // Convert to 16-bit
+    HBufC* displayName = HBufC::NewL( displayName8->Length() );
+    ( displayName->Des() ).Copy( *displayName8 );
+    CleanupStack::PopAndDestroy( displayName8 ); // CS:0
+    
+    // Close SIP string pool
+    SIPStrings::Close();
+
+    // Parse: remove quotation marks from both ends
+    displayName->Des().Trim(); 
+    if ( KSVPQuotationMark() == displayName->Left( 1 ) && 
+         KSVPQuotationMark() == displayName->Right( 1 ) )
+        {
+        displayName->Des().Delete( 0, 1 );
+        displayName->Des().Delete( displayName->Length() - 1, 1 );
+        }
+    
+    // Parse: remove backslashes   
+    TLex lex( *displayName );
+    const TChar backslash = '\\';
+    TBool chDeleted = EFalse;
+    while ( !lex.Eos() )
+        {
+        if ( backslash == lex.Peek() && !chDeleted )
+            {
+            // Backslash found, delete it if not consecutive
+            displayName->Des().Delete( lex.Offset() , 1 );
+            lex.Inc();
+            chDeleted = ETrue;
+            }
+        else
+            {
+            // Not a backslash
+            lex.Inc();
+            chDeleted = EFalse;
+            }
+        }
+
+    // Handle anonymous
+    if ( KErrNotFound != displayName->Des().FindF( KSVPAnonymous ) )
+        {
+        SVPDEBUG1( "CSVPUriParser::ParseDisplayNameL, anonymous case" )
+        displayName->Des().Copy( KNullDesC );
+        }
+
+    SVPDEBUG2( "CSVPUriParser::ParseDisplayNameL, display name: %S", 
+        displayName )
+    return displayName;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUriParser::ParseRemotePartyUriL
+// ---------------------------------------------------------------------------
+// 
+HBufC* CSVPUriParser::ParseRemotePartyUriL( const TDesC8& aRemoteParty )
+    {
+    SVPDEBUG1( "CSVPUriParser::ParseRemotePartyUriL()" )
+        
+    // Open SIP string pool 
+    SIPStrings::OpenL();
+
+    // Make a local copy
+    HBufC8* utf8 = HBufC8::NewLC( aRemoteParty.Length() ); // CS:1
+    ( utf8->Des() ).Copy( aRemoteParty );
+
+    // Escape decode
+    CSVPUriParser::EscapeDecodeSipUriL( utf8 );
+    
+    // Convert from UTF8 to unicode
+    HBufC* unicode16 = EscapeUtils::ConvertToUnicodeFromUtf8L( *utf8 );
+    CleanupStack::PopAndDestroy( utf8 ); // CS:0
+    CleanupStack::PushL( unicode16 ); // CS:1
+    HBufC8* unicode8 = HBufC8::NewL( unicode16->Length() );
+    ( unicode8->Des() ).Copy( *unicode16 );
+    CleanupStack::PopAndDestroy( unicode16 ); // CS:0
+    CleanupStack::PushL( unicode8 ); // CS:1
+    
+    // Create SIP From header
+    CSIPFromHeader* originatorHdr = CSIPFromHeader::DecodeL( *unicode8 );
+    CleanupStack::PopAndDestroy( unicode8 ); // CS:0
+    CleanupStack::PushL( originatorHdr ); // CS:1
+        
+    // Extract URI, returned without angle brackets
+    HBufC8* uri8 = originatorHdr->SIPAddress().Uri8().Uri().UriDes().AllocL();
+    CleanupStack::PopAndDestroy( originatorHdr ); // CS:0
+    CleanupStack::PushL( uri8 ); // CS:1
+    
+    // Parse: remove URI parameters
+    TInt posSemiColon = uri8->FindF( KSVPSemiCln );
+    if ( KErrNotFound != posSemiColon )
+        {
+        uri8->Des().Delete( posSemiColon, uri8->Length() - posSemiColon );
+        }
+
+    // Convert to 16-bit
+    HBufC* uri = HBufC::NewL( uri8->Length() );
+    ( uri->Des() ).Copy( *uri8 );
+    CleanupStack::PopAndDestroy( uri8 ); // CS:0
+
+    // Handle anonymous
+    if ( KErrNotFound != uri->Des().FindF( KSVPAnonymous ) )
+        {
+        SVPDEBUG1( "CSVPUriParser::ParseRemotePartyUriL, anonymous case" )
+        uri->Des().Copy( KNullDesC );
+        }
+
+    // Close SIP string pool
+    SIPStrings::Close();
+    
+    SVPDEBUG2( "CSVPUriParser::ParseRemotePartyUriL, URI: %S", uri )
+    return uri;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svputility.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,2633 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Provides static utility functions for SVP
+*
+*/
+
+
+// #include <WlanInternalPSKeys.h>
+#include <sysutil.h>
+#include <sipprofile.h>
+ 
+#include <CommonEngineDomainCRKeys.h> // for accept-language -header
+#include <centralrepository.h> // for language code
+#include <settingsinternalcrkeys.h> // Settings UIs CR keys
+#include <unsafprotocolscrkeys.h>  // Keys for keep-alive value,ipappsrv_dom\nat_settings_api
+
+#include <mceaudiocodec.h>
+#include <mceamrcodec.h>
+#include <mceg711codec.h>
+#include <mceilbccodec.h>
+#include <mcecodec.h>
+#include <mcedtmfcodec.h>
+#include <mceamrwbcodec.h>
+#include <mcertpsource.h>
+#include <mcemicsource.h>
+#include <mcertpsink.h>
+#include <pathinfo.h>
+#include <crcseprofileentry.h>
+#include <crcseprofileregistry.h>
+#include <crcseaudiocodecregistry.h>
+#include <crcseaudiocodecentry.h>
+
+#include "voipeventlog.h"                   // CVoipEventLog
+#include "voiperrorentry.h"                 // CVoipErrorEntry
+#include "cipapputilsaddressresolver.h"     // CIPAppUtilsAddressResolver
+
+#include "svputility.h"
+#include "svplogger.h"
+#include "svpsipconsts.h"
+#include "svplanguagetagconsts.h"
+#include "svpaudioutility.h"
+
+// LOCAL CONSTANTS
+// Default audio frame size in milliseconds for calculating jitterbuffer size
+const TInt32 KJitterBufferFrameSize = 20;
+
+// Constants for iLBC 20 and 30ms modes
+const TUint32 KSvpilbcMode20ms = 20;
+const TUint32 KSvpilbcMode30ms = 30;
+
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPUtility* CSVPUtility::NewL()
+    {
+    CSVPUtility* self = new( ELeave ) CSVPUtility();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::ConstructL()
+    {
+    SVPDEBUG1("CSVPUtility::ConstructL()");                                                                            
+    iPreferredCodec = 0;
+    iRoundIndex = 0;
+    
+    // create CVoipEventLog
+    TRAP_IGNORE( iVoipEventLogger = CVoipEventLog::NewL() );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::CSVPUtility
+// ---------------------------------------------------------------------------
+//
+CSVPUtility::CSVPUtility()
+    {
+    SVPDEBUG1("CSVPUtility::CSVPUtility()");
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::~CSVPUtility
+// ---------------------------------------------------------------------------
+//
+CSVPUtility::~CSVPUtility()
+    {
+    SVPDEBUG1("CSVPUtility::~CSVPUtility()");
+    delete iVoipEventLogger;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetAudioCodecsMOL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetAudioCodecsMOL( TUint32 aVoIPProfileId, 
+                                     CMceAudioStream& aAudioInStream,
+                                     TInt aKeepAliveValue )
+    {
+    SVPDEBUG1("CSVPUtility::SetAudioCodecsMOL: IN");
+    
+    RArray< TUint32 > codecIds;
+    CleanupClosePushL( codecIds );
+     
+    // clear codec priority preferrence variable
+    iPreferredCodec = 0;
+
+    CRCSEProfileEntry* profile = CRCSEProfileEntry::NewLC();
+    CRCSEAudioCodecEntry* codecprofile = CRCSEAudioCodecEntry::NewLC();
+    CRCSEProfileRegistry* rCSEProfile = CRCSEProfileRegistry::NewLC();
+    CRCSEAudioCodecRegistry* rCSEAudioCodec = 
+                                     CRCSEAudioCodecRegistry::NewLC();
+    
+    // Get VoIP profile from RCSE
+    rCSEProfile->FindL( aVoIPProfileId, *profile );
+    
+    // fetch codec id's
+    GetCodecIdsByVoIPProfileIdL( *profile, codecIds );
+    TBool capabilitiesSet = EFalse;
+        
+    // Set capabilities
+    for( TInt j = 0; j < codecIds.Count(); j++ )
+        {
+        rCSEAudioCodec->FindL( codecIds[ j ], *codecprofile );
+        if ( !codecprofile->iMediaSubTypeName.CompareF( KAudioCodecCN ) )
+            {
+            iCN = ETrue;
+            }
+        else
+            {
+            SVPDEBUG2("CSVPUtility::SetAudioCodecsMOL: j: %d", j);
+            MoCallCapabilitiesL( aAudioInStream, 
+                                 *profile, 
+                                 *codecprofile );
+            capabilitiesSet = ETrue;
+            }
+        }
+     
+    // in Mo case, redundancy is never offered
+    iRed = EFalse;
+    
+    if ( capabilitiesSet )
+        {
+        SetDtmfL( *profile, aAudioInStream );
+        }
+    
+    SetMediaQoSL( profile->iMediaQOS, aAudioInStream.Session() );
+    
+    // set comfort noise for PCMA/PCMU & ILBC if CN provisioned
+    // also handles keep alive logics
+    if ( iCN )
+        {
+        SetComfortNoiseL( aAudioInStream );
+        RemoveUnnecessaryCodecsL( aAudioInStream );
+        SetCNKeepAliveL( aAudioInStream, aKeepAliveValue ); 
+        }
+    else
+        {
+        RemoveUnnecessaryCodecsL( aAudioInStream );
+        SetKeepAliveL( aAudioInStream, aKeepAliveValue ); 
+        }
+   
+    // Check RTCP for actual and bound stream as we do not have knowledge where
+    // the actual RTP sink is residing
+    CheckRtcpSettingL( profile->iRTCP, aAudioInStream );
+    if ( aAudioInStream.BoundStream() )
+        {
+        CheckRtcpSettingL( profile->iRTCP, aAudioInStream.BoundStreamL() );
+        }
+    
+    // RCSE objects can be deleted
+    CleanupStack::PopAndDestroy( 5, &codecIds );
+
+    // Leave if codec information was not found.
+    if ( !aAudioInStream.Codecs().Count() )
+        {
+        SVPDEBUG1("CSVPUtility::SetAudioCodecsMOL KErrNotFound");
+        User::Leave( KErrNotFound );
+        }
+    
+    SVPDEBUG1("CSVPUtility::SetAudioCodecsMOL: OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetKeepAliveL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetKeepAliveL( CMceAudioStream& aAudioStream,
+                                 TInt aKeepAliveValue )
+    {
+    SVPDEBUG1( "CSVPUtility::SetKeepAliveL In ")
+    
+    TInt count = aAudioStream.Codecs().Count();
+    SVPDEBUG2( "CSVPUtility::SetKeepAliveL Codec count: %d ", count )
+    
+    // values should be set to bound stream also
+    CMceAudioStream& boundStream = 
+        static_cast< CMceAudioStream& > ( aAudioStream.BoundStreamL() );
+    
+    __ASSERT_ALWAYS( &boundStream, User::Leave( KSVPErrCodecMismatch ) );
+    // Amount of codecs should be the same in audio- and boundstreams
+    __ASSERT_ALWAYS( count == boundStream.Codecs().Count(),
+                     User::Leave( KSVPErrCodecMismatch ) );
+    
+    TInt maxPl( 0 );
+    TInt minPl( 0 );
+    // first check the max payload in the codec set
+    while ( count-- )
+        {
+        minPl = aAudioStream.Codecs()[ count ]->PayloadType();
+        if ( minPl > maxPl )
+            {
+            maxPl = minPl;
+            }  
+        }
+    
+    count = aAudioStream.Codecs().Count();
+    // if max pl less than def 120, set 120 as pl
+    if ( KSVPDefKeepAlivePl > maxPl )
+        {
+        while( count-- )
+            {
+            SVPDEBUG1( "CSVPUtility::SetKeepAliveL A ")
+            aAudioStream.Codecs()[ count ]->SetKeepAlivePayloadTypeL( KSVPDefKeepAlivePl );
+            aAudioStream.Codecs()[ count ]->SetKeepAliveDataL( KNullDesC8 );
+            aAudioStream.Codecs()[ count ]->SetKeepAliveTimerL( aKeepAliveValue );
+            boundStream.Codecs()[ count ]->SetKeepAlivePayloadTypeL( KSVPDefKeepAlivePl );
+            boundStream.Codecs()[ count ]->SetKeepAliveDataL( KNullDesC8 );
+            boundStream.Codecs()[ count ]->SetKeepAliveTimerL( aKeepAliveValue );
+            }
+        }
+    else if ( KSVPDefKeepAlivePlMax > maxPl )
+        {
+        while( count-- )
+            {
+            SVPDEBUG1( "CSVPUtility::SetKeepAliveL B ")
+            aAudioStream.Codecs()[ count ]->SetKeepAlivePayloadTypeL( maxPl + 1 );
+            aAudioStream.Codecs()[ count ]->SetKeepAliveDataL( KNullDesC8 );
+            aAudioStream.Codecs()[ count ]->SetKeepAliveTimerL( aKeepAliveValue );
+            boundStream.Codecs()[ count ]->SetKeepAlivePayloadTypeL( maxPl + 1 );
+            boundStream.Codecs()[ count ]->SetKeepAliveDataL( KNullDesC8 );
+            boundStream.Codecs()[ count ]->SetKeepAliveTimerL( aKeepAliveValue );
+            }
+        }
+    
+    SVPDEBUG1( "CSVPUtility::SetKeepAliveL Out ")
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetCNKeepAliveL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetCNKeepAliveL( CMceAudioStream& aAudioStream,
+                                   TInt aKeepAliveValue )
+    {
+    SVPDEBUG1( "CSVPUtility::SetCNKeepAliveL In ")
+    
+    TInt count = aAudioStream.Codecs().Count();
+    SVPDEBUG2( "CSVPUtility::SetCNKeepAliveL Codec count: %d ", count )
+    
+    TInt mostPreferred = 0; 
+    // bound stream should be present always
+    CMceAudioStream& boundStream = 
+        static_cast< CMceAudioStream& > ( aAudioStream.BoundStreamL() );
+    
+    __ASSERT_ALWAYS( &boundStream, User::Leave( KSVPErrCodecMismatch ) );
+    // Amount of codecs should be the same in audio- and boundstreams
+    __ASSERT_ALWAYS( count == boundStream.Codecs().Count(),
+                     User::Leave( KSVPErrCodecMismatch ) );
+    
+    // find most preferred codec and set keepalive timer
+    // value and payload for most preferred codec
+    while( count-- )
+        {
+        const TDesC8& codec = aAudioStream.Codecs()[ count ]->SdpName();
+         
+        // handle only real audio codecs
+        if (  KErrNotFound == codec.Find( KCN ) && KErrNotFound == codec.Find( KTELEVENT )  )
+            {
+            if ( 0 == aAudioStream.Codecs()[ count ]->Preference() )
+                {
+                SVPDEBUG2( "Most preferred codec: %d ", count )
+                SVPDEBUG2( "Payload: %d ", aAudioStream.Codecs()[ count ]->PayloadType() )
+                aAudioStream.Codecs()[ count ]->SetKeepAliveTimerL( aKeepAliveValue );
+                aAudioStream.Codecs()[ count ]->SetKeepAlivePayloadTypeL( KSVPCNPayloadType );
+                aAudioStream.Codecs()[ count ]->SetKeepAliveDataL( KNullDesC8 );
+                boundStream.Codecs()[ count ]->SetKeepAliveTimerL( aKeepAliveValue );
+                boundStream.Codecs()[ count ]->SetKeepAlivePayloadTypeL( KSVPCNPayloadType );
+                boundStream.Codecs()[ count ]->SetKeepAliveDataL( KNullDesC8 );
+                mostPreferred = count;
+                }
+           }
+        }
+    
+    count = aAudioStream.Codecs().Count();
+    while ( count-- )
+        {
+        if ( mostPreferred != count )
+            {
+            SVPDEBUG2( "Timer value 0 for codec: %d ", count )
+            aAudioStream.Codecs()[ count ]->SetKeepAliveTimerL( 0 );
+            aAudioStream.Codecs()[ count ]->SetKeepAlivePayloadTypeL( KSVPCNPayloadType );
+            aAudioStream.Codecs()[ count ]->SetKeepAliveDataL( KNullDesC8 );
+            boundStream.Codecs()[ count ]->SetKeepAliveTimerL( 0 );
+            boundStream.Codecs()[ count ]->SetKeepAlivePayloadTypeL( KSVPCNPayloadType );
+            boundStream.Codecs()[ count ]->SetKeepAliveDataL( KNullDesC8 );
+            }
+        }
+    
+    SVPDEBUG1( "CSVPUtility::SetCNKeepAliveL Out ")
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::IsComfortNoise
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUtility::IsComfortNoise( CMceAudioStream& aStream )
+    {
+    SVPDEBUG1( "CSVPUtility::IsComfortNoise In ")
+    TInt count = aStream.Codecs().Count();
+    while ( count-- )
+        {
+        if ( !aStream.Codecs()[ count ]->SdpName().CompareF( KCN ) )
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetAudioCodecsForEmergencyL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetAudioCodecsForEmergencyL( 
+    CMceAudioStream& aAudioInStream,
+    TInt aKeepAliveValue, 
+    TInt32 aVoipProfileId )
+    {
+    SVPDEBUG1("CSVPUtility::SetAudioCodecsForEmergencyL() In")
+        
+    // clear codec priority preferrence variable
+    iPreferredCodec = 0;
+
+    // Default profile
+    CRCSEProfileEntry* profile = CRCSEProfileEntry::NewLC(); // CS:1
+    
+    // Set codecs
+    if ( KErrNotFound == aVoipProfileId )
+        {
+        // No VoIP profile, use default profile values
+        SVPDEBUG1("CSVPUtility::SetAudioCodecsForEmergencyL, no VoIP profile")
+
+        // Create default codecs (PCMA, PCMU, AMR, iLBC, G729) and set 
+        // capabilities
+        CRCSEAudioCodecEntry* codec = CRCSEAudioCodecEntry::NewLC(); // CS:2
+        codec->SetDefaultCodecValueSet( KAudioCodecPCMA() );
+        MoCallCapabilitiesL( aAudioInStream, *profile, *codec );
+        CleanupStack::PopAndDestroy( codec ); // CS:1
+
+        codec = CRCSEAudioCodecEntry::NewLC(); // CS:2
+        codec->SetDefaultCodecValueSet( KAudioCodecPCMU() );
+        MoCallCapabilitiesL( aAudioInStream, *profile, *codec );
+        CleanupStack::PopAndDestroy( codec ); // CS:1
+
+        codec = CRCSEAudioCodecEntry::NewLC(); // CS:2
+        codec->SetDefaultCodecValueSet( KAudioCodecAMR() );
+        MoCallCapabilitiesL( aAudioInStream, *profile, *codec );
+        CleanupStack::PopAndDestroy( codec ); // CS:1
+
+        codec = CRCSEAudioCodecEntry::NewLC(); // CS:2
+        codec->SetDefaultCodecValueSet( KAudioCodeciLBC() );
+        MoCallCapabilitiesL( aAudioInStream, *profile, *codec );
+        CleanupStack::PopAndDestroy( codec ); // CS:1
+
+        codec = CRCSEAudioCodecEntry::NewLC(); // CS:2
+        codec->SetDefaultCodecValueSet( KAudioCodecG729() );
+        MoCallCapabilitiesL( aAudioInStream, *profile, *codec );
+        CleanupStack::PopAndDestroy( codec ); // CS:1
+        }
+    else
+        {
+        // VoIP profile exists
+        SVPDEBUG1("CSVPUtility::SetAudioCodecsForEmergencyL, VoIP profile")
+        User::LeaveIfError( aVoipProfileId );
+            
+        // Get codec IDs from profile
+        CRCSEProfileRegistry* profileRegistry = 
+            CRCSEProfileRegistry::NewLC(); // CS:2
+        profileRegistry->FindL( aVoipProfileId, *profile );
+        CleanupStack::PopAndDestroy( profileRegistry ); // CS:1
+        RArray< TUint32 > codecIds;
+        CleanupClosePushL( codecIds ); // CS:2
+        GetCodecIdsByVoIPProfileIdL( *profile, codecIds );
+        
+        // Set flags
+        TBool isSetPCMA( EFalse );
+        TBool isSetPCMU( EFalse );
+
+        // Set capabilities
+        CRCSEAudioCodecRegistry* codecRegistry = 
+            CRCSEAudioCodecRegistry::NewLC(); // CS:3
+        CRCSEAudioCodecEntry* codec = NULL;
+        for( TInt j = 0; j < codecIds.Count(); j++ )
+            {
+            codec = CRCSEAudioCodecEntry::NewLC(); // CS:4
+            codecRegistry->FindL( codecIds[j], *codec );
+            MoCallCapabilitiesL( aAudioInStream, *profile, *codec );
+            
+            // Check G711
+            if ( !codec->iMediaSubTypeName.CompareF( KAudioCodecPCMA ) )
+                {
+                isSetPCMA = ETrue;
+                }
+            if ( !codec->iMediaSubTypeName.CompareF( KAudioCodecPCMU ) )
+                {
+                isSetPCMU = ETrue;
+                }
+            CleanupStack::PopAndDestroy( codec ); // CS:3
+            }
+        CleanupStack::PopAndDestroy( codecRegistry ); // CS:2
+        CleanupStack::PopAndDestroy( &codecIds ); // CS:1
+        
+
+        // Set G711 default capabilities if not set from profile
+        if ( !isSetPCMA )
+            {
+            codec = CRCSEAudioCodecEntry::NewLC(); // CS:2
+            codec->SetDefaultCodecValueSet( KAudioCodecPCMA() );
+            MoCallCapabilitiesL( aAudioInStream, *profile, *codec );
+            CleanupStack::PopAndDestroy( codec ); // CS:1
+            }
+        if ( !isSetPCMU )
+            {
+            codec = CRCSEAudioCodecEntry::NewLC(); // CS:2
+            codec->SetDefaultCodecValueSet( KAudioCodecPCMU() );
+            MoCallCapabilitiesL( aAudioInStream, *profile, *codec );
+            CleanupStack::PopAndDestroy( codec ); // CS:1
+            }
+        }
+    
+    SetDtmfL( *profile, aAudioInStream );
+    
+    SetMediaQoSL( profile->iMediaQOS, aAudioInStream.Session() );
+    
+    // in Mo case, redundancy is never offered
+    iRed = EFalse;
+    
+    // Set comfort noise for PCMA/PCMU & ILBC if CN provisioned and keep-alive
+    if ( iCN )
+        {
+        SetComfortNoiseL( aAudioInStream );
+        RemoveUnnecessaryCodecsL( aAudioInStream );
+        SetCNKeepAliveL( aAudioInStream, aKeepAliveValue );
+        }
+    else
+        {
+        RemoveUnnecessaryCodecsL( aAudioInStream );
+        SetKeepAliveL( aAudioInStream, aKeepAliveValue );
+        }
+    
+    // Check RTCP for actual and bound stream as we do not have knowledge where
+    // the actual RTP sink is residing
+    CheckRtcpSettingL( profile->iRTCP, aAudioInStream );
+    if ( aAudioInStream.BoundStream() )
+        {
+        CheckRtcpSettingL( profile->iRTCP, aAudioInStream.BoundStreamL() );
+        }
+    
+    CleanupStack::PopAndDestroy( profile ); // CS:0
+
+    // Leave if codec information was not found.
+    if ( !aAudioInStream.Codecs().Count() )
+        {
+        SVPDEBUG1("CSVPUtility::SetAudioCodecsForEmergencyL KErrNotFound")
+        User::Leave( KErrNotFound );
+        }
+    
+    SVPDEBUG1("CSVPUtility::SetAudioCodecsForEmergencyL() Out")
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetComfortNoiseL
+// ---------------------------------------------------------------------------
+//  
+void CSVPUtility::SetComfortNoiseL( CMceAudioStream& aAudioStream )
+    {
+    SVPDEBUG1("CSVPUtility::SetComfortNoiseL In");
+    
+    // fetch available codecs
+    const RPointerArray<CMceAudioCodec>& codecs = aAudioStream.Codecs();
+    
+    // Comfort Noise must be enabled for bound stream codecs also
+    CMceAudioStream& boundStream = 
+        static_cast< CMceAudioStream& > ( aAudioStream.BoundStreamL() ); 
+   
+    // fetch bound stream codecs 
+    const RPointerArray< CMceAudioCodec >& 
+        boundCodecs = boundStream.Codecs();
+    
+    iCN = EFalse;
+
+    for ( TInt z = 0; z < codecs.Count(); z++ )
+        {
+        if ( !codecs[ z ]->SdpName().CompareF( KCN ) && !iCN  )
+            {
+            SVPDEBUG1("CSVPUtility::SetComfortNoiseL CN found");
+            // enable CN from main and bound stream
+            aAudioStream.Codecs()[ z ]->SetStateL( CMceCodec::EEnabled );
+            boundStream.Codecs()[ z ]->SetStateL( CMceCodec::EEnabled );
+            // set flag to true, so CN is not removed from media attributes
+            iCN = ETrue;
+            
+            // set also correct priority order for CN => lowest priority
+            aAudioStream.Codecs()[ z ]->SetPreferenceL( codecs.Count() );
+            }
+        } 
+    if ( iCN )
+        {
+        for ( TInt i = 0; i < codecs.Count(); i++ )
+            {
+            if( !codecs[ i ]->SdpName().CompareF( KPCMA ) || 
+                !codecs[ i ]->SdpName().CompareF( KPCMU ) ||
+                !codecs[ i ]->SdpName().CompareF( KILBC ) )
+                {
+                SVPDEBUG1("CSVPUtility::SetComfortNoiseL Setting VAD");
+                codecs[ i ]->EnableVAD( ETrue );
+                boundCodecs[ i ]->EnableVAD( ETrue );
+                }
+            } 
+        }
+    SVPDEBUG1("CSVPUtility::SetComfortNoiseL Out");
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetDtmfL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetDtmfL( const CRCSEProfileEntry& aVoIPProfile, 
+    CMceAudioStream& aAudioStream )
+    {
+    SVPDEBUG3( "CSVPUtility::SetDtmfL IB STATUS: %d OB STATUS: %d",
+        aVoIPProfile.iInbandDTMF, aVoIPProfile.iOutbandDTMF )
+    
+    // If both on, not set or both off, prefer outband.
+    if ( ( CRCSEAudioCodecEntry::EOn == aVoIPProfile.iInbandDTMF &&
+           CRCSEAudioCodecEntry::EOn == aVoIPProfile.iOutbandDTMF ) ||
+         ( CRCSEAudioCodecEntry::EOONotSet == aVoIPProfile.iInbandDTMF &&
+           CRCSEAudioCodecEntry::EOONotSet == aVoIPProfile.iOutbandDTMF ) ||
+         ( CRCSEAudioCodecEntry::EOff == aVoIPProfile.iInbandDTMF &&
+           CRCSEAudioCodecEntry::EOff == aVoIPProfile.iOutbandDTMF ) )
+        {
+        SVPDEBUG1( "CSVPUtility::SetDtmfL IB/OB both enabled, not set or off" )
+        
+        iTelEv = ETrue;
+        SetDtmfCodecOrderL( aAudioStream );
+        }
+    // Check inband enabled situation
+    else if ( CRCSEAudioCodecEntry::EOn == aVoIPProfile.iInbandDTMF &&
+              CRCSEAudioCodecEntry::EOff == aVoIPProfile.iOutbandDTMF )
+        {
+        SVPDEBUG1( "CSVPUtility::SetDtmfL OB DTMF OFF, IB DTMF ON" )
+        
+        iTelEv = EFalse;
+        }
+    // Check outband enabled situation
+    else if ( CRCSEAudioCodecEntry::EOff == aVoIPProfile.iInbandDTMF &&
+              CRCSEAudioCodecEntry::EOn == aVoIPProfile.iOutbandDTMF )
+        {
+        SVPDEBUG1( "CSVPUtility::SetDtmfL OB DTMF ON, IB DTMF OFF" )
+        
+        iTelEv = ETrue;
+        SetDtmfCodecOrderL( aAudioStream );
+        }
+    // else all cases handled above.
+    }
+    
+//----------------------------------------------------------------------------
+// CSVPUtility::GetDTMFMode
+//----------------------------------------------------------------------------
+//    
+TBool CSVPUtility::GetDTMFMode()
+    {
+    SVPDEBUG2( "SVPUtility::GetDTMFMode iTelEv: %d", iTelEv )
+    
+    return iTelEv; // EFalse: DTMF Inband, ETrue: DTMF Outband
+    }
+
+//----------------------------------------------------------------------------
+// CSVPUtility::SetDtmfMode
+//----------------------------------------------------------------------------
+//
+void CSVPUtility::SetDtmfMode( TBool aOutbandEnabled )
+    {
+    SVPDEBUG2( "SVPUtility::SetDtmfMode aOutbandEnabled: %d",
+        aOutbandEnabled )
+    
+    iTelEv = aOutbandEnabled;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetAudioCodecsMTL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetAudioCodecsMTL( CRCSEProfileEntry& aVoIPProfile, 
+                                     CMceMediaStream& aAudioStream,
+                                     TInt aKeepAliveValue,
+                                     TBool aSessionUpdateOngoing )
+    {
+    SVPDEBUG1("CSVPUtility::SetAudioCodecsMTL In")
+    
+    RArray< TUint32 > codecIds;
+    CleanupClosePushL( codecIds );
+    
+    GetCodecIdsByVoIPProfileIdL( aVoIPProfile, codecIds );
+    
+    // create codec profile
+    CRCSEAudioCodecEntry* codecprofile = 
+                                    CRCSEAudioCodecEntry::NewLC();
+    CRCSEAudioCodecRegistry* rCSEAudioCodec = 
+                                    CRCSEAudioCodecRegistry::NewLC();
+    
+    // clearing the flag for next session 
+    iCodecMatched = EFalse;  
+    // Initialize round index variable (for the current session)
+    iRoundIndex = 0;
+ 
+    CMceAudioStream& audioStream =
+        static_cast<CMceAudioStream&>( aAudioStream );
+        
+    const RPointerArray< CMceAudioCodec >& supportedCodecs = 
+        audioStream.Codecs();
+    
+    const TInt suppCodecCount = supportedCodecs.Count();
+    
+    // loop as many times as needed 
+    while ( iRoundIndex < suppCodecCount )
+        {
+        for ( TInt codecCnt = 0; codecCnt < codecIds.Count(); codecCnt++ )
+            {
+            if ( !iCodecMatched )
+                {
+                rCSEAudioCodec->FindL( codecIds[ codecCnt ], *codecprofile );
+                MtCallCapabilitiesL( audioStream, aVoIPProfile, *codecprofile );
+                }
+            }
+        
+        if ( iCodecMatched )
+            {
+            SVPDEBUG1( "CSVPUtility::SetAudioCodecsMTL RED set" )
+            SetRedundancyL( audioStream );
+            SVPDEBUG1( "CSVPUtility::SetAudioCodecsMTL RED set done" )
+            break;
+            }
+        else
+            {
+            iRoundIndex++;    
+            }
+        }
+    
+    if ( !iCodecMatched )
+        {
+        User::Leave( KSVPErrCodecMismatch );
+        }
+    
+    SetMediaQoSL( aVoIPProfile.iMediaQOS, aAudioStream.Session() );
+    
+    // if outband DTMF offered, it's used even if inband is provisioned
+    if ( DtmfOBInOffer( audioStream ) )
+        {
+        SetDtmfCodecOrderL( audioStream );
+        iTelEv = ETrue;
+        }
+    else
+        {
+        SetDtmfL( aVoIPProfile, audioStream );
+        }
+    
+    // set comfort noise if provisioned and offered by caller
+    for ( TInt codecCnt = 0; codecCnt < codecIds.Count(); codecCnt++ )
+        {
+        // fetch codec profile
+        rCSEAudioCodec->FindL( codecIds[ codecCnt ], *codecprofile );
+        // set comfort noise
+        HBufC8* tempSdpName = 
+            HBufC8::NewLC( codecprofile->iMediaSubTypeName.Length() );
+        TPtr8 ptr = tempSdpName->Des();
+        ptr.Copy( codecprofile->iMediaSubTypeName );  
+        if ( !tempSdpName->CompareF( KCN ) )
+            {
+            SVPDEBUG1( "CSVPUtility::SetAudioCodecsMTL - CN Provisioned" )
+            SetComfortNoiseL( audioStream );    
+            }
+
+        CleanupStack::PopAndDestroy( tempSdpName );
+        }
+    
+    RemoveUnnecessaryCodecsL( audioStream );
+    
+    // CN provisioned and in offer
+    if ( iCN )
+        {
+        SVPDEBUG1( "CSVPUtility::SetAudioCodecsMTL - CN" )
+        SetCNKeepAliveL( audioStream, aKeepAliveValue );
+        }
+    // CN not provisioned or offered
+    else
+        {
+        SVPDEBUG1( "CSVPUtility::SetAudioCodecsMTL - No CN" )
+        SetKeepAliveL( audioStream, aKeepAliveValue );
+        }
+    
+    // Check RTCP for actual and bound stream as we do not have knowledge where
+    // the actual RTP sink is residing
+    CheckRtcpSettingL( aVoIPProfile.iRTCP, aAudioStream, aSessionUpdateOngoing );
+    if ( aAudioStream.BoundStream() )
+        {
+        CheckRtcpSettingL( aVoIPProfile.iRTCP, aAudioStream.BoundStreamL(), aSessionUpdateOngoing );
+        }
+    
+    // RCSE objects can be deleted
+    CleanupStack::PopAndDestroy( 3, &codecIds );
+         
+    SVPDEBUG1( "CSVPUtility::SetAudioCodecsMTL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::DtmfOBInOffer
+// ---------------------------------------------------------------------------
+//   
+TBool CSVPUtility::DtmfOBInOffer( CMceAudioStream& aAudioStream )
+	{
+	SVPDEBUG1( "CSVPUtility::DtmfOBInOffer In" )
+    const RPointerArray< CMceAudioCodec >& supportedCodecs = 
+        aAudioStream.Codecs();
+    TInt count = supportedCodecs.Count();
+    while ( count-- )
+        {
+        if ( !supportedCodecs[ count ]->SdpName().CompareF( KTELEVENT ) )
+            {
+            SVPDEBUG1( "CSVPUtility::DtmfOBInOffer Outband DTMF in offer" )
+            return ETrue;    
+            }
+        }
+    return EFalse;
+	}
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::RemoveUnnecessaryCodecsL
+// ---------------------------------------------------------------------------
+//    
+void CSVPUtility::RemoveUnnecessaryCodecsL( CMceAudioStream& aAudioInStream )
+    {
+    SVPDEBUG1("CSVPUtility::RemoveUnnecessaryCodecs In");
+    // if codec was not found, remove code from the codec array 
+    if ( !iAMR )
+        {
+        SVPAudioUtility::RemoveCodecL( aAudioInStream, KAMR );
+        }
+    if ( !iPCMA )
+        {
+        SVPAudioUtility::RemoveCodecL( aAudioInStream, KPCMA );
+        }
+    if ( !iPCMU )
+        {
+        SVPAudioUtility::RemoveCodecL( aAudioInStream, KPCMU );
+        }
+    if ( !iILBC )
+        {
+        SVPAudioUtility::RemoveCodecL( aAudioInStream, KILBC );
+        }
+    if ( !iG729 )
+        {
+        SVPAudioUtility::RemoveCodecL( aAudioInStream, KG729 );
+        }
+    if ( !iTelEv )
+        {
+        SVPAudioUtility::RemoveCodecL( aAudioInStream, KTELEVENT );
+        }
+    if ( !iCN )
+        {
+        SVPAudioUtility::RemoveCodecL( aAudioInStream, KCN );
+        iCN = EFalse;
+        }
+    if ( !iRed )
+        {
+        SVPAudioUtility::RemoveCodecL( aAudioInStream, KRED );
+        }
+    if ( !iAMRWB )
+        {
+        SVPAudioUtility::RemoveCodecL( aAudioInStream, KAMRWB );
+        }
+    
+    // clear codec flags for next session
+    iAMR = EFalse; 
+    iPCMA = EFalse;
+    iPCMU = EFalse;
+    iILBC = EFalse;
+    iG729 = EFalse;
+    iRed = EFalse;
+    iAMRWB = EFalse;
+    
+    SVPDEBUG1("CSVPUtility::RemoveUnnecessaryCodecs Out"); 
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPUtility::GetCodecIdsByVoIPProfileIdL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::GetCodecIdsByVoIPProfileIdL( 
+    const CRCSEProfileEntry& aProfile,
+    RArray< TUint32 >& aCodecIds ) const
+    {
+    SVPDEBUG1("CSVPUtility::GetCodecIdsByVoIPProfileIdL IN");
+    
+    aCodecIds.Reset();
+    
+    const TInt codCount = aProfile.iPreferredCodecs.Count();
+    for ( TInt codecCnt = 0; codecCnt < codCount; codecCnt++ )
+        {
+        // append codec id's in preference order
+        aCodecIds.AppendL( aProfile.iPreferredCodecs[ codecCnt ] );
+        }
+    
+    SVPDEBUG1("CSVPUtility::GetCodecIdsByVoIPProfileIdL OUT");
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::MtCallCapabilitiesL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::MtCallCapabilitiesL( 
+    CMceAudioStream& aAudioInStream, 
+    const CRCSEProfileEntry& aVoIPProfile,
+    const CRCSEAudioCodecEntry& aCodecProfile )
+    {
+    SVPDEBUG1( "CSVPUtility::MtCallCapabilitiesL IN" )
+    
+    // fetch the codecs mce supports
+    const RPointerArray< CMceAudioCodec >& supportedCodecs = 
+        aAudioInStream.Codecs();
+    
+    SVPDEBUG2( "CSVPUtility::MtCallCapabilitiesL: Supp. codec count: %d",
+         supportedCodecs.Count() )
+    
+    HBufC8* tempSdpName = 
+        HBufC8::NewLC( aCodecProfile.iMediaSubTypeName.Length() );
+    
+    TPtr8 ptr = tempSdpName->Des();
+    ptr.Copy( aCodecProfile.iMediaSubTypeName );
+    
+    // compare offered codec to codec supported by app. 
+    if ( *tempSdpName != supportedCodecs[ iRoundIndex ]->SdpName() ||
+         !supportedCodecs[ iRoundIndex ]->SdpName().CompareF( KCN ) ||
+         !supportedCodecs[ iRoundIndex ]->SdpName().CompareF( KTELEVENT ) ||
+         !supportedCodecs[ iRoundIndex ]->SdpName().CompareF( KRED ) )
+        {
+        SVPDEBUG1( "CSVPUtility::MtCallCapabilitiesL do nothing" )
+        }
+    else
+        {
+        SVPDEBUG2( "CSVPUtility::MtCallCapabilitiesL Mediasubtypename: %S",
+            &aCodecProfile.iMediaSubTypeName )
+        SVPDEBUG2( "CSVPUtility::MtCallCapabilitiesL - ptime: %d",
+            aCodecProfile.iPtime )
+        SVPDEBUG2( "CSVPUtility::MtCallCapabilitiesL - maxptime: %d",
+            aCodecProfile.iMaxptime )
+        
+        if ( aVoIPProfile.iStartMediaPort )
+            {
+            aAudioInStream.SetLocalMediaPortL( aVoIPProfile.iStartMediaPort );
+            
+            SVPDEBUG1( "CSVPUtility::MtCallCapabilitiesL start media port set" )
+            }
+
+        SVPDEBUG2( "CSVPUtility::MtCallCapabilitiesL codec ptime: %u",
+            supportedCodecs[ iRoundIndex ]->PTime() )
+        SVPDEBUG2( "CSVPUtility::MtCallCapabilitiesL codec maxptime: %u",
+            supportedCodecs[ iRoundIndex ]->MaxPTime() )
+        
+        if ( aCodecProfile.iPtime >= 0 && 
+             aCodecProfile.iMaxptime < 
+             supportedCodecs[ iRoundIndex ]->PTime() )
+            {   
+            supportedCodecs[ iRoundIndex ]->SetPTime( aCodecProfile.iPtime );
+            }
+        
+        if ( !aCodecProfile.iMediaSubTypeName.CompareF( KAudioCodecAMR ) )
+            {
+            // No actions taken in MT calls for AMR parameters. We accept
+            // them as-is for improved IOP.
+            iAMR = ETrue;
+            } 
+        
+        if ( !aCodecProfile.iMediaSubTypeName.CompareF( KAudioCodecPCMA ) )
+            {
+            iPCMA = ETrue;
+            }
+
+        if ( !aCodecProfile.iMediaSubTypeName.CompareF( KAudioCodecPCMU ) )
+            {
+            iPCMU = ETrue;
+            }
+
+        if ( !aCodecProfile.iMediaSubTypeName.CompareF( KAudioCodeciLBC ) )
+            {
+            iILBC = ETrue;
+            }
+
+        if ( !aCodecProfile.iMediaSubTypeName.CompareF( KAudioCodecAMRWB  ) )
+            {
+            iAMRWB = ETrue;
+            } 
+
+        if ( !aCodecProfile.iMediaSubTypeName.CompareF( KAudioCodecG729 ) )
+            {
+            // AnnexB is not set if it is not in the offer. MO side may not
+            // support AnnexB so we do not want to enforce it.
+            iG729 = ETrue;
+            }
+        else
+            {
+            // set VAD if other than G729 codec case
+            if ( CRCSEAudioCodecEntry::EOONotSet != aCodecProfile.iVAD )
+                {
+                SVPDEBUG1( "CSVPUtility::MtCallCapabilitiesL, codec and boundcodec VAD" );
+                // Setting VAD for codec
+                SetVADL( aAudioInStream, aCodecProfile.iVAD, *tempSdpName ); 
+
+                // Setting VAD also for bound codec
+                CMceAudioStream& boundStream = 
+                    static_cast< CMceAudioStream& > ( aAudioInStream.BoundStreamL() ); 
+                SetVADL( boundStream, aCodecProfile.iVAD, *tempSdpName ); 
+                }
+            }
+
+        // Take the largest jitterbuffer size from settings. NB. this does
+        // not actually take into account that we have codec spesific
+        // jitterbuffer sizes and MCE has session level jitterbuffer size.
+        // So we may end up using wrong jitterbuffer size if codec spesific
+        // jitterbuffer settings are different amongst each other.
+        if ( aCodecProfile.iJitterBufferSize > iJitterBufferSize )
+            {
+            iJitterBufferSize = aCodecProfile.iJitterBufferSize;
+            }
+
+        SVPDEBUG2( "CSVPUtility::MtCallCapabilitiesL iJitterBufferSize: %d",
+            iJitterBufferSize )
+
+        // set codec matched flag to ETrue, codec matched and set up
+        iCodecMatched = ETrue;
+        }
+    
+    CleanupStack::PopAndDestroy( tempSdpName );
+    
+    SVPDEBUG1( "CSVPUtility::MtCallCapabilitiesL OUT" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetRedundancyL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetRedundancyL( CMceAudioStream& aAudioStream ) 
+    {
+    SVPDEBUG1( "CSVPUtility::SetRedundancyL In");
+    const RPointerArray< CMceAudioCodec >& codecs = aAudioStream.Codecs();
+    for ( TInt z = 0; z < codecs.Count(); z++ )
+        {
+        if ( !codecs[ z ]->SdpName().CompareF( KRED ) )
+            {
+            SVPDEBUG1( "CSVPUtility::SetRedundancyL Setting Red pref.");          
+            // set preference 
+            aAudioStream.Codecs()[ z ]->
+                SetPreferenceL( codecs.Count() );
+            // set red flag so red media attribute is not removed
+            iRed = ETrue;
+            }
+        }
+    SVPDEBUG1( "CSVPUtility::SetRedundancyL Out");
+    }
+// ---------------------------------------------------------------------------
+// CSVPUtility::MoCallCapabilitiesL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::MoCallCapabilitiesL( 
+                              CMceAudioStream& aAudioInStream, 
+                              const CRCSEProfileEntry& aVoIPProfile,
+                              const CRCSEAudioCodecEntry& aCodecProfile )
+    {
+    SVPDEBUG1("CSVPUtility::MoCallCapabilitiesL In")
+    
+    // fetch the codecs mce supports 
+    const RPointerArray< CMceAudioCodec >& supportedCodecs = 
+        aAudioInStream.Codecs();
+    
+    SVPDEBUG2("CSVPUtility::MoCallCapabilitiesL, Supported codec count: %d",
+        supportedCodecs.Count() );
+    
+    HBufC8* tempSdpName = 
+        HBufC8::NewLC( aCodecProfile.iMediaSubTypeName.Length() );
+        
+    SVPDEBUG2("CSVPUtility::MoCallCapabilitiesL Mediasubtypename: %S",
+        &aCodecProfile.iMediaSubTypeName );
+    
+    // go through the array and find Sdp name match
+    for ( TInt z = 0; z < supportedCodecs.Count(); z++ )
+        {
+        TPtr8 ptr = tempSdpName->Des();
+        ptr.Copy( aCodecProfile.iMediaSubTypeName );
+          
+        if ( *tempSdpName == supportedCodecs[ z ]->SdpName() )
+            {
+            // first setting audio capabilities common for all codecs
+            
+            // set codec priority order
+            SVPDEBUG2("CSVPUtility::MoCallCapabilitiesL Codec order: %d",
+                iPreferredCodec );
+            
+            supportedCodecs[ z ]->SetPreferenceL( iPreferredCodec++ );
+            
+            // set media port
+            if ( aVoIPProfile.iStartMediaPort )
+                {
+                aAudioInStream.SetLocalMediaPortL( aVoIPProfile.iStartMediaPort );
+                SVPDEBUG1("CSVPUtility::MoCallCapabilitiesL start media port set");
+                }
+            
+            // set VAD    
+            if ( CRCSEAudioCodecEntry::EOONotSet != aCodecProfile.iVAD )
+                {
+                SVPDEBUG1( "CSVPUtility::MoCallCapabilitiesL Setting codec VAD" );
+
+                // Setting VAD for codec
+                SetVADL( aAudioInStream, aCodecProfile.iVAD, *tempSdpName ); 
+
+                SVPDEBUG1( "CSVPUtility::MoCallCapabilitiesL Setting bound VAD" );
+                // Setting VAD also for bound codec
+                CMceAudioStream& boundStream = 
+                    static_cast< CMceAudioStream& > ( aAudioInStream.BoundStreamL() ); 
+                SetVADL( boundStream, aCodecProfile.iVAD, *tempSdpName ); 
+                }
+            
+            // set maxptime
+            if ( aCodecProfile.iMaxptime >= 0 ) 
+                {
+                supportedCodecs[ z ]->SetMaxPTime( aCodecProfile.iMaxptime );
+                
+                SVPDEBUG2("CSVPUtility::MoCallCapabilitiesL iMaxptime: %d",
+                    aCodecProfile.iMaxptime );
+                }
+            
+            // set ptime
+            if ( aCodecProfile.iPtime >= 0 )     
+                {
+                SVPDEBUG2("CSVPUtility::MoCallCapabilitiesL, PTime: %d",
+                    aCodecProfile.iPtime );
+                
+                supportedCodecs[ z ]->SetPTime( aCodecProfile.iPtime );
+                } 
+            
+            if ( !aCodecProfile.iMediaSubTypeName.CompareF( KAudioCodecAMR ) )
+                {
+                iAMR = ETrue;
+                
+                // AMR specific settings: mode-set, mode-change-period,
+                // mode-change-neighbor and octet alignment vs. bw-efficient
+                // mode
+                SetAMRParameters( aAudioInStream, aCodecProfile, z );
+                if ( CRCSEAudioCodecEntry::EOn == aCodecProfile.iOctetAlign )
+                    {
+                    // use octet-alignment for MO call
+                    supportedCodecs[ z ]->SetCodecMode(
+                        EMceOctetAligned );
+                    }
+                }
+            
+            if ( !aCodecProfile.iMediaSubTypeName.
+                 CompareF( KAudioCodecPCMA ) )
+                {
+                iPCMA = ETrue;
+                }
+            if ( !aCodecProfile.iMediaSubTypeName.
+                 CompareF( KAudioCodecPCMU ) )
+                {
+                iPCMU = ETrue;
+                }
+            if ( !aCodecProfile.iMediaSubTypeName.
+                 CompareF( KAudioCodeciLBC ) )
+                {
+                iILBC = ETrue;
+                // Set mode according to mode-set.
+                if ( aCodecProfile.iModeSet.Count() )
+                    {
+                    if ( KSvpilbcMode20ms == aCodecProfile.iModeSet[0] )
+                        {
+                        supportedCodecs[ z ]->SetBitrate(
+                            KMceiLBCLevel20Bitrate );
+                        }
+                    else if( KSvpilbcMode30ms == aCodecProfile.iModeSet[0] )
+                        {
+                        supportedCodecs[ z ]->SetBitrate(
+                            KMceiLBCLevel30Bitrate );
+                        }
+                    }
+                }
+            
+            if ( !aCodecProfile.iMediaSubTypeName.
+                 CompareF( KAudioCodecG729 ) )
+                {
+                iG729 = ETrue;
+                // set annexb
+                if ( CRCSEAudioCodecEntry::EOn == aCodecProfile.iAnnexb )
+                    {
+                    supportedCodecs[ z ]->EnableVAD( ETrue );
+                    }
+                }
+     
+            if ( !aCodecProfile.iMediaSubTypeName.CompareF( KAudioCodecAMRWB ) )
+                {
+                iAMRWB = ETrue;
+                
+                // AMR-WB specific settings: mode-set, mode-change-period,
+                // mode-change-neighbor and octet alignment vs. bw-efficient
+                // mode
+                SetAmrWbParameters( aAudioInStream, aCodecProfile, z );
+                if ( CRCSEAudioCodecEntry::EOn == aCodecProfile.iOctetAlign )
+                    {
+                    // use octet-alignment for MO call
+                    supportedCodecs[ z ]->SetCodecMode(
+                        EMceOctetAligned );
+                    }
+                }
+
+			// Take the largest jitterbuffer size from settings. NB. this does
+            // not actually take into account that we have codec spesific
+            // jitterbuffer sizes and MCE has session level jitterbuffer size.
+            // So we may end up using wrong jitterbuffer size if codec spesific
+            // jitterbuffer settings are different amongst each other.
+            if ( aCodecProfile.iJitterBufferSize > iJitterBufferSize )
+                {
+                iJitterBufferSize = aCodecProfile.iJitterBufferSize;
+                }
+            
+            SVPDEBUG2( "CSVPUtility::MoCallCapabilitiesL iJitterBufferSize: %d",
+                iJitterBufferSize );
+            }   
+        }
+    CleanupStack::PopAndDestroy( tempSdpName );
+    
+    SVPDEBUG1( "CSVPUtility::MoCallCapabilitiesL OUT" );
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetAMRParameters
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetAMRParameters( CMceAudioStream& aAudioInStream, 
+                                    const CRCSEAudioCodecEntry& aCodecProfile,
+                                    TInt aCodecNumber )
+    {
+    SVPDEBUG1( "CSVPUtility::SetAMRParameters Entry" )
+
+    TUint allowedBitrates( 0 );
+    
+    // Set correct mode-set (default 0,1,2,3,4,5,6,7):
+    const RArray< TUint32 >& modeSetArray = aCodecProfile.iModeSet;
+    for ( TInt i = 0; i < modeSetArray.Count(); i++ )
+        {
+        TUint value = modeSetArray[ i ];
+        switch ( value )
+            {
+            case 0: { allowedBitrates |= KMceAllowedAmrNbBitrate475;  break; }
+            case 1: { allowedBitrates |= KMceAllowedAmrNbBitrate515;  break; }
+            case 2: { allowedBitrates |= KMceAllowedAmrNbBitrate590;  break; }
+            case 3: { allowedBitrates |= KMceAllowedAmrNbBitrate670;  break; }
+            case 4: { allowedBitrates |= KMceAllowedAmrNbBitrate740;  break; }
+            case 5: { allowedBitrates |= KMceAllowedAmrNbBitrate795;  break; }
+            case 6: { allowedBitrates |= KMceAllowedAmrNbBitrate102;  break; }
+            case 7: { allowedBitrates |= KMceAllowedAmrNbBitrate122;  break; }
+            }
+            
+        SVPDEBUG3( "CSVPUtility::SetAMRParameters round %d, value: %u",
+            i, value )
+        SVPDEBUG2( "CSVPUtility::SetAMRParameters allowedBitrates 0x%x",
+            allowedBitrates )
+        }
+    
+    if ( !allowedBitrates )
+        {
+        allowedBitrates = KMceAllowedAmrNbBitrateAll;
+        }
+    
+    SVPDEBUG2( "CSVPUtility::SetAMRParameters mode-set 0x%x", allowedBitrates )
+    
+    if ( 2 == aCodecProfile.iModeChangePeriod )
+        {
+        // Set correct mode-change-period (default == 1):
+        allowedBitrates |= KMceAllowedAmrNbChangePeriod2;
+        }
+
+    // Set correct mode-change-neighbor (default == 0)
+    if ( CRCSEAudioCodecEntry::EOn == aCodecProfile.iModeChangeNeighbor )
+        {
+        allowedBitrates |= KMceAllowedAmrNbChangeNeighbor1;
+        }
+
+    aAudioInStream.Codecs()[ aCodecNumber ]->SetAllowedBitrates(
+        allowedBitrates );
+
+    SVPDEBUG2( "CSVPUtility::SetAMRParameters, Exit 0x%x", allowedBitrates )
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPUtility::GetCCPError
+// ---------------------------------------------------------------------------
+//
+TCCPError CSVPUtility::GetCCPError( TInt& aErrorCode, TCCPTone& aTone  ) const
+    {
+    SVPDEBUG2( "CSVPUtility::GetCCPError aErrorCode: %d", aErrorCode )
+    
+    // See ccpdefs.h - this may require additional checking so that the
+    // tones are really correct.
+    TCCPError error = ECCPErrorNone;
+    TCCPTone tone = ECCPNoSoundSequence;
+   
+    switch ( aErrorCode )
+        {    
+        case KSVPDeclineVal:
+        case KSVPBusyHereVal:
+        case KSVPBusyEverywhereVal:
+            {
+            error = ECCPErrorBusy;  
+            tone = ECCPToneUserBusy;
+            break;
+            }
+            
+        case KSVPLoopDetectedVal:
+        case KSVPTooManyHopsVal:
+        case KSVPServerInternalErrorVal:
+        case KSVPNotImplementedVal:
+        case KSVPBadGatewayVal:
+        case KSVPServiceUnavailableVal:
+        case KSVPServerTimeoutVal:
+        case KSVPVersionNotSupportedVal:
+        case KSVPMessageTooLargeVal:
+        case KSVPPreconditionFailureVal:
+            {
+            error = ECCPErrorNetworkOutOfOrder;   
+            tone = ECCPToneCongestion;
+            break;
+            }
+           
+        case KSVPUseProxyVal:
+        case KSVPAlternativeServiceVal:
+            {
+            error = ECCPErrorNotReached; 
+            tone = ECCPToneSpecialInformation;
+            break;
+            }
+    
+                   
+        case KSVPRequestUriTooLongVal:
+        case KSVPUnsupportedUriSchemeVal:
+        case KSVPAddressIncompleteVal:
+        case KSVPAmbiguousVal:
+            {
+            error = ECCPErrorInvalidURI;   
+            tone = ECCPToneSpecialInformation;
+            break;
+            } 
+            
+        case KSVPBadRequestVal:
+        case KSVPMethodNotAllowedVal:
+        case KSVPUnsupportedMediaTypeVal:
+        case KSVP406NotAcceptableVal:
+        case KSVPRequestEntityTooLargeVal:
+        case KSVPBadExtensionVal:
+        case KSVPExtensionRequiredVal:
+        case KSVPCallDoesNotExistVal:
+        case KSVPNotAcceptableHereVal:
+        case KSVPNotAcceptableVal:
+            {
+            error = ECCPErrorNotAcceptable; 
+            tone = ECCPToneRadioPathNotAvailable;
+            break;
+            }
+        
+        case KSVPRequestTerminatedVal:
+        case KSVPNotFoundVal:
+        case KSVPTemporarilyUnavailableVal:
+            {
+            error = ECCPErrorNotResponding;  
+            tone = ECCPToneUserBusy;
+            break;
+            }
+            	
+        case KSVPMovedPermanentlyVal:
+        case KSVPGoneVal:
+        case KSVPDoesNotExistAnywhereVal:
+            {
+            error = ECCPErrorMovedPermanently; 
+            tone = ECCPToneRadioPathNotAvailable;
+            break; 
+            }
+        
+        case KSVPRequestTimeoutVal:
+            {
+            error = ECCPErrorConnectionErrorRedial;  
+            tone = ECCPToneSpecialInformation;
+            break;
+            }
+       
+        case KSVPUnauthorizedVal:
+        case KSVPPaymentRequiredVal:
+        case KSVPForbiddenVal:
+        case KSVPProxyAuthenticationRequiredVal:
+        case KSVPIntervalTooBriefVal:
+        case KSVPBadEventVal:
+        case KSVPSecurityAgreementRequiredVal:
+		    {
+            error = ECCPErrorNoService;
+            tone = ECCPToneCongestion;
+            break;
+            }
+                  
+        default:
+            {   
+            if ( 299 < aErrorCode && 400 > aErrorCode )
+                {
+                // Received a 3XX response not handled above
+                error = ECCPErrorNotReached;
+                break;
+                }
+            else if ( 399 < aErrorCode && 500 > aErrorCode )
+                {
+                // Received a 4XX response not handled above
+                error = ECCPErrorNotAcceptable;
+                tone = ECCPToneRadioPathNotAvailable;
+                break;
+                }
+            else if ( 499 < aErrorCode && 600 > aErrorCode )
+                {
+                // Received a 5XX response not handled above
+                error = ECCPErrorNetworkOutOfOrder;
+                tone = ECCPToneCongestion;
+                break;
+                }
+            else if ( 599 < aErrorCode && 700 > aErrorCode )
+                {
+                // Received a 6XX response not handled above
+                error = ECCPGlobalFailure;
+                tone = ECCPToneUserBusy;
+                break;
+                }
+            else 
+                {
+                SVPDEBUG1("CSVPUtility::GetCCPError Not an error code")
+                aErrorCode = KErrNone;
+                tone = ECCPNoSoundSequence;
+                break;
+                }  
+            }
+        }
+    SVPDEBUG3( "CSVPUtility::GetCCPError error: %d, tone: %d",
+        error, tone )
+    
+    aTone = tone;
+    return error;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::LogVoipEventL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::LogVoipEventL( TInt aErrorCode, TUint32 aSipProfileId,
+    const TDesC& aRemoteURI, const TDesC& aMethod ) const
+    {  
+    SVPDEBUG1( "CSVPUtility::LogVoipEventL In" );
+    HBufC* remote = NULL; 
+
+    if ( iVoipEventLogger )
+        {            
+        // set the profile id and remote URI to the error text parameter
+        // tab is used as value delimiter
+        TBuf<KSVPTempStringlength> entryArguments;
+        entryArguments.AppendNum( aSipProfileId );
+        entryArguments.Append( KSVPLogFieldDelimiter );
+        
+        // parse "sip:" away from the remote address
+        if ( aRemoteURI.Length() > 0 )
+            {
+            remote = aRemoteURI.AllocLC();
+
+            if ( 0 == remote->Find( KSVPSipPrefix2 ) )
+                {
+                remote->Des().Delete( 0, KSVPSipPrefixLength );
+                }
+                
+            entryArguments.Append( *remote );                
+        
+            CleanupStack::PopAndDestroy( remote );    
+            }                     
+        else
+            {
+            entryArguments.Append( aRemoteURI );
+            }
+        
+        entryArguments.Append( KSVPLogFieldDelimiter );
+        entryArguments.Append( aMethod );      
+
+        CVoipErrorEntry* entry = CVoipErrorEntry::NewLC( aErrorCode, 
+                                                         entryArguments );
+        iVoipEventLogger->WriteError( *entry );
+
+        CleanupStack::PopAndDestroy( entry );
+        
+        SVPDEBUG3( "CSVPUtility::LogVoipEventL: \
+                    err: %d, aMethod: %S", aErrorCode, &aMethod );       
+        
+        }
+
+    SVPDEBUG1( "CSVPUtility::LogVoipEventL Out" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::GetDtmfEvent
+// ---------------------------------------------------------------------------
+//
+MCCPDTMFObserver::TCCPDtmfEvent CSVPUtility::GetDtmfEvent( 
+    MMceDtmfObserver::TMceDtmfEvent aEvent,
+    TBool aDtmfStringSending )
+    {
+    SVPDEBUG1( "CSVPUtility::GetDtmfEvent In" )
+    
+    MCCPDTMFObserver::TCCPDtmfEvent event = MCCPDTMFObserver::ECCPDtmfUnknown;
+    
+    switch ( aEvent )
+        {
+        case MMceDtmfObserver::EDtmfSendStarted:
+            {
+            if ( aDtmfStringSending )
+                {
+                SVPDEBUG1( "CSVPUtility::GetDtmfEvent ECCPDtmfSequenceStart" )
+                
+                event = MCCPDTMFObserver::ECCPDtmfSequenceStart;
+                }
+            else
+                {
+                SVPDEBUG1( "CSVPUtility::GetDtmfEvent ECCPDtmfManualStart" )
+                
+                event = MCCPDTMFObserver::ECCPDtmfManualStart;  
+                }
+            
+            break;            
+            }
+        case MMceDtmfObserver::EDtmfSendCompleted:
+            {
+            if ( aDtmfStringSending )
+                {
+                SVPDEBUG1( "CSVPUtility::GetDtmfEvent ECCPDtmfStringSendingCompleted" )
+                
+                event = MCCPDTMFObserver::ECCPDtmfStringSendingCompleted;
+                }
+            // else NOP
+            
+            break;                  
+            } 
+        default:
+            {
+            // This block should never be reached.
+            SVPDEBUG1( "CSVPUtility::GetDtmfEvent default case!" )
+            
+            event = MCCPDTMFObserver::ECCPDtmfUnknown;
+            break;
+            }
+        }
+    
+    return event;
+    }
+
+
+       
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetProvisioningDataL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetProvisioningDataL( CRCSEProfileEntry& aVoipProfile,
+                     CDesC8Array& aUserAgentHeaders, 
+                     TUint32& aSecurityStatus,
+                     TBuf<KSVPMaxTerminalTypeLength>& aTerminalType,
+                     TBuf<KSVPWlanMacAddressLength>& aWlanMACAddress ) const
+    {
+    SVPDEBUG1("CSVPUtility::SetProvisioningDataL In" );
+
+    // fetch security status
+    aSecurityStatus = aVoipProfile.iSecureCallPreference;
+    
+    SVPDEBUG2("CSVPUtility::SetProvisioningDataL: aSecurityStatus = %d",
+            aSecurityStatus );
+
+    TBool terminalTypeEnabled = aVoipProfile.iSIPVoIPUAHTerminalType;
+     SVPDEBUG2("CSVPUtility::SetProvisioningDataL: terminalTypeEnabled = %d",
+            terminalTypeEnabled );
+    
+    TBool wlanMacEnabled = aVoipProfile.iSIPVoIPUAHeaderWLANMAC;
+    
+      SVPDEBUG2("CSVPUtility::SetProvisioningDataL: wlanMacEnabled = %d",
+            wlanMacEnabled );
+            
+    // temp descriptor for user-agent header
+    TBuf< KSVPMaxUAFreeTextLength > uaHeaderFreeString;
+    
+     // SIP VoIP User Agent header string
+    uaHeaderFreeString = aVoipProfile.iSIPVoIPUAHeaderString;
+    
+    // UA header found, append header name 
+    TBuf8<KSVPTempStringlength> userAgentString;
+    userAgentString.Append( KSVPUserAgent );
+    
+    // add terminat type
+    if( terminalTypeEnabled )
+        {
+        userAgentString.Append( KSVPSpaceMark );
+        userAgentString.Append( aTerminalType );
+        SVPDEBUG2("CSVPUtility::SetProvisioningDataL: aTerminalType = %S",
+            &aTerminalType );
+        userAgentString.Append( KSVPSpaceMark );
+        }
+    // add wlan mac address
+    if( wlanMacEnabled )
+        {
+        userAgentString.Append( aWlanMACAddress );
+        SVPDEBUG2("CSVPUtility::SetProvisioningDataL: aWlanMACAddress = %S",
+            &aWlanMACAddress );
+        userAgentString.Append( KSVPSpaceMark );
+        }
+    // add free string
+    if( 0 != uaHeaderFreeString.Length() )  
+        {
+        // append user agent header string part
+        userAgentString.Append( uaHeaderFreeString );
+        SVPDEBUG2("CSVPUtility::SetProvisioningDataL:\
+         uaHeaderFreeString = %S", &uaHeaderFreeString );
+        userAgentString.Append( KSVPSpaceMark );
+        } 
+    
+    // match language code and add to user-agent header    
+    TInt langCode =  User::Language();
+    TBuf< KSVPMaxLangCodeLength > languageTag; 
+    if ( langCode > 0 )
+        {
+        SVPDEBUG2("CSVPUtility::SetProvisioningDataL\
+         Language code: %d", langCode );
+        
+        MatchLanguageTags( langCode, languageTag );
+        
+        if ( languageTag.Length() != 0 )
+            {
+            SVPDEBUG2("CSVPUtility::SetProvisioninDataL ISO\
+            stanard language code: %S", &languageTag );
+            // add language tag to user agent string
+            userAgentString.Append( KSVPOpeningBracket );
+            userAgentString.Append( languageTag ); 
+            userAgentString.Append( KSVPClosingBracket );
+            }
+        }
+     
+    // add collected User-Agent string to header
+    aUserAgentHeaders.AppendL( userAgentString );
+    
+    // add accept language header
+    TBuf8<KSVPAcceptLangStringLength> acceptLanguageString;
+    acceptLanguageString.Append( KSVPAcceptLanguage );
+    acceptLanguageString.Append( languageTag );
+    
+    // add expires header
+     // add accept language header
+    TBuf8<KSVPExpiresHeaderLength> expiresHeaderString;
+    expiresHeaderString.Append( KSVPExpiresHeader );
+    expiresHeaderString.Append( KSVPExpires );
+    
+    aUserAgentHeaders.AppendL( acceptLanguageString );
+    aUserAgentHeaders.AppendL( expiresHeaderString );
+        
+    // Add Privacy header
+    TBuf8<KSVPPrivacyLength> privacyString;
+    privacyString.Append( KSVPPrivacy );
+
+    if ( IsCLIROnL() )
+        {
+        privacyString.Append( KSVPId );
+        }
+    else
+        {
+        privacyString.Append( KSVPNone );
+        }
+    aUserAgentHeaders.AppendL( privacyString );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::IsCLIROnL
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUtility::IsCLIROnL() const
+    {
+
+    TInt valueCLIR( KSVPClirOff ); 
+    TBool clirOn = EFalse;
+
+    CRepository* repository = NULL;
+    repository = CRepository::NewL( KCRUidRichCallSettings );
+    repository->Get( KRCSEClir, valueCLIR );
+    delete repository;
+    repository = NULL;
+
+    SVPDEBUG2("CSVPUtility::IsCLIROnL valueCLIR : %d", valueCLIR );
+    if ( KSVPClirOn == valueCLIR )
+        {
+        // 0 = KRCSEClirOff
+        clirOn = ETrue;
+        }
+    else
+        {
+        // 1 = KRCSEClirOn or 2 = KRCSEClirDefault
+        clirOn = EFalse;
+        }
+
+    SVPDEBUG2("CSVPUtility::IsCLIROnL returns %d", clirOn);
+    return clirOn;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetMoFromHeaderLC
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSVPUtility::SetMoFromHeaderLC( TUint aSecurityStatus )
+    {
+
+    HBufC8* fromheader = NULL;
+
+    if ( IsCLIROnL() )
+        {
+        SVPDEBUG1("CSVPMoSession::SetMoFromHeaderLC CLIR is ON");
+        if ( KSVPStatusNonSecure == aSecurityStatus )
+            {
+        	fromheader = HBufC8::NewLC(KSVPMyAnonymousAddress.iTypeLength);
+        	fromheader->Des().Append( KSVPMyAnonymousAddress );
+            }
+        else
+            {
+        	fromheader = HBufC8::NewLC(KSVPMyAnonymousSecAddress.iTypeLength);
+        	fromheader->Des().Append( KSVPMyAnonymousSecAddress );
+            }
+        }
+    else
+        {
+        SVPDEBUG1("CSVPMoSession::SetMoFromHeaderLC CLIR is OFF");
+    	fromheader = HBufC8::NewLC(KSVPEmpty.iTypeLength);
+    	fromheader->Des().Append( KSVPEmpty );
+        }
+
+    return fromheader;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::AddPPreferredIdentityToUserHeaders
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::AddPPreferredIdentityToUserHeadersL( 
+    CDesC8Array& aUserAgentHeaders, const TDesC8& aUri )
+    { 
+    SVPDEBUG1( "CSVPUtility::AddPPreferredIdentityToUserHeadersL In" )
+    
+    TBuf8<KSVPTempStringlength> pPreferredHeaderString;
+    pPreferredHeaderString.Append( KSVPPIdentity );
+    pPreferredHeaderString.Append( KSVPLeftBracketMark );
+    pPreferredHeaderString.Append( aUri );
+    pPreferredHeaderString.Append( KSVPRightBracketMark );
+    aUserAgentHeaders.AppendL( pPreferredHeaderString );
+    
+    SVPDEBUG1( "CSVPUtility::AddPPreferredIdentityToUserHeadersL Out " )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::GetTerminalTypeL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::GetTerminalTypeL(
+	    TBuf< KSVPMaxTerminalTypeLength >& aTerminalType )
+    {
+    // Using ipapputils functionality
+    TBuf<KSVPMaxTerminalTypeLength> terminalType (KNullDesC);
+    
+    CIpAppPhoneUtils* libIpAppPhoneUtils = CIpAppPhoneUtils::NewLC();
+    
+    libIpAppPhoneUtils->GetTerminalTypeL( terminalType );    
+
+    CleanupStack::PopAndDestroy( libIpAppPhoneUtils );
+    aTerminalType.Copy( terminalType );    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::GetWlanMACAddressL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::GetWlanMACAddressL(
+    TBuf< KSVPWlanMacAddressLength >& aWlanMACAddress ) 
+    {    
+    // Using ipapputils functionality
+    TBuf8<KSVPWlanMacAddressLength> wlanMacAddress (KNullDesC8);
+    
+    CIPAppUtilsAddressResolver* addressResolver = 
+            CIPAppUtilsAddressResolver::NewLC();    
+    
+    TInt ret = addressResolver->GetWlanMACAddress( wlanMacAddress, 
+            KSVPWlanMacAddressFrmt );
+		
+    SVPDEBUG2("CSVPUtility::GetWlanMACAddressL ret: %d", ret );
+	
+    CleanupStack::PopAndDestroy( addressResolver );
+    aWlanMACAddress.Copy( wlanMacAddress );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::ResolveSecurityMechanismL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::ResolveSecurityMechanismL( const CSIPProfile& aProfile,
+                                             TUint32& aSecureCallPreference )
+    {
+    const TDesC8* securityMechanism = NULL;
+    const TDesC8* sipUserAor = NULL;
+    const TDesC8* sipOutboundProxy = NULL;
+    const TDesC8* registeredContact = NULL;
+
+    aProfile.GetParameter( KSIPNegotiatedSecurityMechanism,
+                            securityMechanism );
+    aProfile.GetParameter( KSIPUserAor,
+                            sipUserAor );
+    aProfile.GetParameter( KSIPOutboundProxy,
+                            KSIPServerAddress,
+                            sipOutboundProxy );
+    aProfile.GetParameter( KSIPRegisteredContact,
+                            KSIPServerAddress,
+                            registeredContact );
+
+    if ( KErrNotFound == securityMechanism->Find( KSVPTLS ) &&
+         KErrNotFound == sipUserAor->Find( KSVPSipsPrefix ) &&
+         KErrNotFound == sipOutboundProxy->Find( KSVPSipsPrefix ) &&
+         KErrNotFound == registeredContact->Find( KSVPSipsPrefix ) )
+        {
+        SVPDEBUG1("CSVPUtility::ResolveSecurityMechanism:\
+         TLS not enabled (tls and sips: wasn't found)");
+        aSecureCallPreference = 0;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::MatchLanguageTags
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::MatchLanguageTags( TInt aLanguageCode, 
+    TDes& aLangMatch )
+    {
+    SVPDEBUG2("CSVPUtility::MatchLanguageTags Langcode: %d", aLanguageCode );
+    
+    switch( aLanguageCode)
+        {
+        case ESVPLangEnglish:
+            {
+            SVPDEBUG1("CSVPUtility::MatchLanguageTags -> English");
+            aLangMatch.Copy( KSVPLanguageTagEn );
+            break;
+            }  
+        case ESVPLangFrench:
+            {
+            aLangMatch.Copy( KSVPLanguageTagFr );
+            break;
+            }      
+        case ESVPLangGerman:
+            {
+            aLangMatch.Copy( KSVPLanguageTagDe );
+            break;
+            }       
+        case ESVPLangSpanish:
+            {
+            aLangMatch.Copy( KSVPLanguageTagEs );
+            break;
+            }      
+        case ESVPLangItalian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagIt );
+            break;
+            } 
+        case ESVPLangSwedish:
+            {
+            aLangMatch.Copy( KSVPLanguageTagSv );
+            break;
+            } 
+        case ESVPLangDanish:
+            {
+            aLangMatch.Copy( KSVPLanguageTagDa );
+            break;
+            }                      
+        case ESVPLangNorwegian: 
+            {
+            aLangMatch.Copy( KSVPLanguageTagNo );
+            break;
+            }
+        case ESVPLangFinnish: 
+            {
+            aLangMatch.Copy( KSVPLanguageTagFi );
+            break;
+            }
+        case ESVPLangAmerican:
+            {
+            aLangMatch.Copy( KSVPLanguageTagEn );
+            break;
+            }
+        case ESVPLangSwissFrench: 
+            {
+            aLangMatch.Copy( KSVPLanguageTagFr );
+            break;
+            }
+        case ESVPLangSwissGerman:
+            {
+            aLangMatch.Copy( KSVPLanguageTagDe );
+            break;
+            }
+        case ESVPLangPortuguese:
+            {
+            aLangMatch.Copy( KSVPLanguageTagPt );
+            break;
+            }
+        case ESVPLangTurkish: 
+            {
+            aLangMatch.Copy( KSVPLanguageTagTr );
+            break;
+            }
+        case ESVPLangIcelandic:
+            {
+            aLangMatch.Copy( KSVPLanguageTagIs );
+            break;
+            } 
+        case ESVPLangRussian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagRu );
+            break;
+            }
+        case ESVPLangHungarian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagHu );
+            break;
+            }
+        case ESVPLangDutch:
+            {
+            aLangMatch.Copy( KSVPLanguageTagNl );
+            break;
+            }
+        case ESVPLangBelgianFlemish:
+            {
+            aLangMatch.Copy( KSVPLanguageTagNl );
+            break;
+            }
+        case ESVPLangAustralian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagEn );
+            break;
+            }
+        case ESVPLangBelgianFrench:
+            {
+            aLangMatch.Copy( KSVPLanguageTagFr );
+            break;
+            }
+        case ESVPLangAustrian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagDe );
+            break;
+            }
+        case ESVPLangNewZealand:
+            {
+            aLangMatch.Copy( KSVPLanguageTagEn );
+            break;
+            }
+        case ESVPLangInternationalFrench:
+            {
+            aLangMatch.Copy( KSVPLanguageTagFr );
+            break;
+            }
+        case ESVPLangCzech:
+            {
+            aLangMatch.Copy( KSVPLanguageTagCs );
+            break;
+            }
+        case ESVPLangSlovak:
+            {
+            aLangMatch.Copy( KSVPLanguageTagSk );
+            break;
+            }
+        case ESVPLangPolish:
+            {
+            aLangMatch.Copy( KSVPLanguageTagPl );
+            break;
+            }
+        case ESVPLangSlovenian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagSl );
+            break;
+            }
+        case ESVPLangTaiwanChinese:
+            {
+            aLangMatch.Copy( KSVPLanguageTagTaiwaneseChinese );
+            break;
+            }
+        case ESVPLangHongKongChinese:
+            {
+            aLangMatch.Copy( KSVPLanguageTagHongKongChinese );
+            break;
+            }
+        case ESVPLangPrcChinese:
+            {
+            aLangMatch.Copy( KSVPLanguageTagChinese );
+            break;
+            }
+        case ESVPLangJapanese:
+            {
+            aLangMatch.Copy( KSVPLanguageTagJa );
+            break;
+            }
+        case ESVPLangThai:
+            {
+            aLangMatch.Copy( KSVPLanguageTagTh );
+            break;
+            }
+        case ESVPLangAfrikaans:
+            {
+            aLangMatch.Copy( KSVPLanguageTagAf );
+            break;
+            }
+        case ESVPLangAlbanian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagSq );
+            break;
+            }
+        case ESVPLangAmharic:
+            {
+            aLangMatch.Copy( KSVPLanguageTagAm );
+            break;
+            }
+        case ESVPLangArabic:
+            {
+            aLangMatch.Copy( KSVPLanguageTagAr );
+            break;
+            }
+        case ESVPLangArmenian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagHy );
+            break;
+            }
+        case ESVPLangTagalog:
+            {
+            aLangMatch.Copy( KSVPLanguageTagTl );
+            break;
+            }
+        case ESVPLangBelarussian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagBe );
+            break;
+            }
+        case ESVPLangBengali:
+            {
+            aLangMatch.Copy( KSVPLanguageTagBn );
+            break;
+            }
+        case ESVPLangBulgarian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagBg );
+            break;
+            }
+        case ESVPLangBurmese:
+            {
+            aLangMatch.Copy( KSVPLanguageTagMy );
+            break;
+            }
+        case ESVPLangCatalan:
+            {
+            aLangMatch.Copy( KSVPLanguageTagCa );
+            break;
+            }
+        case ESVPLangCroatian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagHr );
+            break;
+            }
+        case ESVPLangCanadianEnglish:
+        case ESVPLangInternationalEnglish:
+        case ESVPLangSouthAfricanEnglish:
+            {
+            aLangMatch.Copy( KSVPLanguageTagEn );
+            break;
+            }
+        case ESVPLangEstonian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagEt );
+            break;
+            }
+        case ESVPLangFarsi:
+            {
+            aLangMatch.Copy( KSVPLanguageTagFa );
+            break;
+            }
+        case ESVPLangCanadianFrench:
+            {
+            aLangMatch.Copy( KSVPLanguageTagCanadianFrench );
+            break;
+            }
+        case ESVPLangScotsGaelic:
+            {
+            aLangMatch.Copy( KSVPLanguageTagGd );
+            break;
+            }
+        case ESVPLangGeorgian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagKa );
+            break;
+            }
+        case ESVPLangGreek:
+            {
+            aLangMatch.Copy( KSVPLanguageTagEl );
+            break;
+            }
+        case ESVPLangCyprusGreek:
+            {
+            aLangMatch.Copy( KSVPLanguageTagCyprusGreek );
+            break;
+            }
+        case ESVPLangGujarati:
+            {
+            aLangMatch.Copy( KSVPLanguageTagGu );
+            break;
+            }
+        case ESVPLangHebrew:
+            {
+            aLangMatch.Copy( KSVPLanguageTagHe );
+            break;
+            }
+        case ESVPLangHindi:
+            {
+            aLangMatch.Copy( KSVPLanguageTagHi );
+            break;
+            }
+        case ESVPLangIndonesian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagId );
+            break;
+            }
+        case ESVPLangIrish:
+            {
+            aLangMatch.Copy( KSVPLanguageTagGa );
+            break;
+            }
+        case ESVPLangSwissItalian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagSwissItalian );
+            break;
+            }
+        case ESVPLangKannada:
+            {
+            aLangMatch.Copy( KSVPLanguageTagKn );
+            break;
+            }
+        case ESVPLangKazakh:
+            {
+            aLangMatch.Copy( KSVPLanguageTagKk );
+            break;
+            }
+        case ESVPLangKhmer:
+            {
+            aLangMatch.Copy( KSVPLanguageTagKm );
+            break;
+            }
+        case ESVPLangKorean:
+            {
+            aLangMatch.Copy( KSVPLanguageTagKo );
+            break;
+            }
+        case ESVPLangLao:
+            {
+            aLangMatch.Copy( KSVPLanguageTagLo );
+            break;
+            }
+        case ESVPLangLatvian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagLv );
+            break;
+            }
+        case ESVPLangLithuanian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagLt );
+            break;
+            }
+        case ESVPLangMacedonian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagMk );
+            break;
+            }
+        case ESVPLangMalay:
+            {
+            aLangMatch.Copy( KSVPLanguageTagMs );
+            break;
+            }
+        case ESVPLangMalayalam:
+            {
+            aLangMatch.Copy( KSVPLanguageTagMl );
+            break;
+            }
+        case ESVPLangMarathi:
+            {
+            aLangMatch.Copy( KSVPLanguageTagMr );
+            break;
+            }
+        case ESVPLangMoldavian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagMo );
+            break;
+            }
+        case ESVPLangMongolian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagMn );
+            break;
+            }
+        case ESVPLangNorwegianNynorsk:
+            {
+            aLangMatch.Copy( KSVPLanguageTagNorwegianNynorsk );
+            break;
+            }
+        case ESVPLangBrazilianPortuguese:
+            {
+            aLangMatch.Copy( KSVPLanguageTagBrazilianPortugese );
+            break;
+            }
+        case ESVPLangPunjabi:
+            {
+            aLangMatch.Copy( KSVPLanguageTagPa );
+            break;
+            }
+        case ESVPLangRomanian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagRo );
+            break;
+            }
+        case ESVPLangSerbian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagSr );
+            break;
+            }
+        case ESVPLangSinhalese:
+            {
+            aLangMatch.Copy( KSVPLanguageTagSi );
+            break;
+            }
+        case ESVPLangSomali:
+            {
+            aLangMatch.Copy( KSVPLanguageTagSo );
+            break;
+            }
+        case ESVPLangInternationalSpanish:
+            {
+            aLangMatch.Copy( KSVPLanguageTagEs );
+            break;
+            }
+        case ESVPLangLatinAmericanSpanish:
+            {
+            aLangMatch.Copy( KSVPLanguageTagAmericanSpanish );
+            break;
+            }
+        case ESVPLangSwahili:
+            {
+            aLangMatch.Copy( KSVPLanguageTagSw );
+            break;
+            }
+        case ESVPLangFinlandSwedish:
+            {
+            aLangMatch.Copy( KSVPLanguageTagFinlandSwedish );
+            break;
+            }
+        case ESVPLangReserved1:
+            {
+            aLangMatch.Copy( KSVPLanguageTagReserved );
+            break;
+            }
+        case ESVPLangTamil:
+            {
+            aLangMatch.Copy( KSVPLanguageTagTa );
+            break;
+            }
+        case ESVPLangTelugu:
+            {
+            aLangMatch.Copy( KSVPLanguageTagTe );
+            break;
+            }
+        case ESVPLangTibetan:
+            {
+            aLangMatch.Copy( KSVPLanguageTagBo );
+            break;
+            }
+        case ESVPLangTigrinya:
+            {
+            aLangMatch.Copy( KSVPLanguageTagTi );
+            break;
+            }
+        case ESVPLangCyprusTurkish:
+            {
+            aLangMatch.Copy( KSVPLanguageTagCyprusTurkish );
+            break;
+            }
+        case ESVPLangTurkmen:
+            {
+            aLangMatch.Copy( KSVPLanguageTagTurkaem );
+            break;
+            }
+        case ESVPLangUkrainian:
+            {
+            aLangMatch.Copy( KSVPLanguageTagUk );
+            break;
+            }
+        case ESVPLangUrdu:
+            {
+            aLangMatch.Copy( KSVPLanguageTagUr );
+            break;
+            }
+        case ESVPLangReserved2:
+            {
+            aLangMatch.Copy( KSVPLanguageTagReserved );
+            break;
+            }
+        case ESVPLangVietnamese:
+            {
+            aLangMatch.Copy( KSVPLanguageTagVi );
+            break;
+            }
+        
+        case ESVPLangWelsh:
+            {
+            aLangMatch.Copy( KSVPLanguageTagCy );
+            break;
+            }
+        case ESVPLangZulu:
+            {
+            aLangMatch.Copy( KSVPLanguageTagZu );
+            break;
+            }
+        case ESVPLangOther:
+            {
+            break;
+            }
+        case ESVPLangSouthSotho:
+            {
+            aLangMatch.Copy( KSVPLanguageTagSoth );
+            break;
+            }
+        case ESVPLangManufacturerEnglish:
+        case ESVPLangEnglish_Apac:
+        case ESVPLangEnglish_Taiwan:
+        case ESVPLangEnglish_HongKong:
+        case ESVPLangEnglish_Prc:
+        case ESVPLangEnglish_Japan:
+        case ESVPLangEnglish_Thailand:
+            {
+            aLangMatch.Copy( KSVPLanguageTagEn );
+            break;
+            }
+        case ESVPLangMalay_Apac:
+            {
+            aLangMatch.Copy( KSVPLanguageTagMalay );
+            break;
+            }
+        case ESVPLangNone:
+        case ESVPLangMaximum:
+            {
+            SVPDEBUG1("CSVPUtility::MatchLanguageTags Lang none/maximum");
+            break;
+            } 
+        default:
+            {
+            SVPDEBUG1("CSVPUtility::MatchLanguageTags Default");
+            aLangMatch.Copy( KSVPLanguageTagEn );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::UpdateJitterBufferSizeL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::UpdateJitterBufferSizeL( CMceRtpSource& aRtpSource )
+    {
+    // Convert the jitterbuffer size from milliseconds to RTP packets. This
+    // does not take into account the fact that RTP packet can hold n
+    // milliseconds of audio. Also G.711 may use 10ms frames, so and we are
+    // assuming 20ms frames here. But, MCC actually has the logic to handle
+    // this issue, as it also assumes initially that G.711 has 20ms frames and
+    // then adjusts accordingly.
+    TInt32 jBufSize = KSvpJitterBufferLength;
+    if ( iJitterBufferSize )
+        {
+        jBufSize = iJitterBufferSize / KJitterBufferFrameSize;
+        }
+    
+    SVPDEBUG2( "CSVPUtility::UpdateJitterBufferSizeL size: %d", jBufSize );
+    SVPDEBUG2( "CSVPUtility::UpdateJitterBufferSizeL iJitterBufferSize: %d",
+        iJitterBufferSize );
+    
+    // If jitterbuffer size goes to zero, then force it back to default. We
+    // cannot tolerate zero size jitterbuffer.
+    if ( !jBufSize )
+        {
+        SVPDEBUG1( "CSVPUtility::UpdateJitterBufferSizeL need to default" )
+        
+        jBufSize = KSvpJitterBufferLength;
+        }
+    
+    aRtpSource.UpdateL( jBufSize, 
+                        KSvpJitterBufferThreshold,
+                        KSvpStandbyTimerInMillisecs );
+                        
+    iJitterBufferSize = 0;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetDtmfCodecOrderL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetDtmfCodecOrderL( CMceAudioStream& aAudioStream ) const
+    {
+    SVPDEBUG1( "CSVPUtility::SetDtmfCodecOrderL In" );
+ 
+    const RPointerArray<CMceAudioCodec>& codecs = aAudioStream.Codecs();
+    const TInt codCount( codecs.Count() );
+     
+    // loop through codecs in in stream
+    for ( TInt i = 0; i < codCount; i++ )
+        {
+        // Check if codec is DTMF, note the return values of CompareF
+        if( !codecs[ i ]->SdpName().CompareF( KTELEVENT ) )
+            {
+            codecs[ i ]->SetPreferenceL( iPreferredCodec );
+            }
+        }
+    SVPDEBUG1( "CSVPUtility::SetDtmfCodecOrderL Out" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetMediaQoSL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetMediaQoSL( TUint32 aQosValue,
+    CMceSession* aSession ) const
+    {
+    SVPDEBUG2( "CSVPUtility::SetMediaQoSL aQosValue: %u", aQosValue );
+    
+    __ASSERT_ALWAYS( aSession, User::Leave( KErrArgument ) );
+    
+    // We need to do bitshifting on the IP TOS, because it's the upper 6 bits
+    // that are set and settings provide us the IP TOS as the lower 6 bits.
+    // The lower 2 bits are reserver for explicit congestion notification.
+    // See also more from:
+    // Symbian Developer Library / in_sock.h Global variables / KSoIpTOS
+    const TInt ipTosShift( 2 );
+    const TUint32 tosBits( aQosValue << ipTosShift );
+    
+    SVPDEBUG2( "CSVPUtility::SetMediaQoSL tosBits: %u", tosBits );
+    
+    aSession->SetServiceTypeL( tosBits );
+    
+    SVPDEBUG1( "CSVPUtility::SetMediaQoSL out" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::GetKeepAliveByIapIdL
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUtility::GetKeepAliveByIapIdL( TUint32 aIapId,
+    TInt& aKeepAliveValue ) const
+    {
+    SVPDEBUG2( "CSVPUtility::SetKeepAliveIapIdL IN, aIapId = %d", aIapId );
+
+    TBool found = EFalse;
+    TInt keepAliveValue = 0;
+    aKeepAliveValue = KSVPDefaultUDPRefreshInterval;
+    RArray< TUint32 > keys;
+    CleanupClosePushL( keys );
+
+    CRepository* rep = CRepository::NewLC( KCRUidUNSAFProtocols );
+
+    TInt err = rep->FindEqL( KUNSAFProtocolsIAPIdMask,
+                             KUNSAFProtocolsFieldTypeMask,
+                             static_cast<TInt>(aIapId),
+                             keys );
+
+    if ( KErrNone == err  && keys.Count() == 1 )
+        {
+
+        TUint32 key = ( KUNSAFProtocolsIAPIdMask^( keys[ 0 ] ) );
+        key |= KUNSAFProtocolsIAPTableMask;
+
+        // UDP refresh interval
+        SVPDEBUG2( "CSVPUtility::SetKeepAliveIapIdL UDP refresh interval key = %d", key );
+        if ( KErrNone == rep->Get( KUNSAFProtocolsIntervalUDPMask|key, keepAliveValue ) )
+            {
+            aKeepAliveValue = keepAliveValue;
+            found = ETrue;
+            }
+        }
+
+    CleanupStack::PopAndDestroy( 2, &keys );  // keys & rep
+    SVPDEBUG3( "CSVPUtility::SetKeepAliveIapIdL OUT keepAliveValue = %d found = %d",
+                    keepAliveValue, found );
+    return found;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::GetKeepAliveByAORL
+// ---------------------------------------------------------------------------
+//
+TBool CSVPUtility::GetKeepAliveByAORL( const TDesC8& aAor,
+    TInt& aKeepAliveValue ) const
+    {
+    SVPDEBUG1( "CSVPUtility::GetKeepAliveByAORL In" );
+
+    HBufC8* newAor = aAor.AllocLC();
+    // Domain name is what is after @ character
+    newAor->Des().Delete( 0, newAor->Find( KSVPAt ) + 1 );
+
+    TBool found = EFalse;
+    TInt keepAliveValue = 0;
+    aKeepAliveValue = KSVPDefaultUDPRefreshInterval;
+    RArray<TUint32> keys;
+    CleanupClosePushL( keys );
+
+    CRepository* rep = CRepository::NewLC( KCRUidUNSAFProtocols );
+
+    TInt err = rep->FindEqL( KUNSAFProtocolsDomainMask,
+                             KUNSAFProtocolsFieldTypeMask,
+                             *newAor,
+                             keys );
+
+    if ( KErrNone == err && keys.Count() == 1 )
+        {
+        TUint32 key = ( KUNSAFProtocolsDomainMask^( keys[0] ) );
+        key |= KUNSAFProtocolsDomainTableMask;
+
+        // UDP refresh interval
+        if ( KErrNone ==
+             rep->Get( KUNSAFProtocolsDomainIntervalUDPMask|key, keepAliveValue ) )
+            {
+            aKeepAliveValue = keepAliveValue;
+            found = ETrue;
+            }
+        }
+
+    CleanupStack::PopAndDestroy( 3, newAor );
+
+    if ( !found )
+        {
+        // Neither IapId nor Domain spesific keepalive value was not found.
+        SVPDEBUG1( "CSVPUtility::GetKeepAliveByAORL::GetKeepAliveByAORL use default keepalive" );
+        
+        aKeepAliveValue = KSVPDefaultUDPRefreshInterval;
+        }
+    
+    SVPDEBUG2( "CSVPUtility::GetKeepAliveByAORL Out found: %d", found );
+    return found;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::CheckRtcpSettingL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::CheckRtcpSettingL( TUint32 aRtcp,
+    CMceMediaStream& aStream, TBool aSessionUpdateOngoing ) const
+    {
+    SVPDEBUG2( "CSVPUtility::CheckRtcpSettingL aRtcp: %u", aRtcp );
+    
+    TBool rtcpsuppression = ETrue;
+    if ( CRCSEProfileEntry::EOn == aRtcp )
+        {
+        SVPDEBUG1("CSVPUtility::CheckRtcpSettingL RTCP=ON");
+        rtcpsuppression = EFalse;
+        }
+    
+    // At this point we should have only audio streams. Thus the leave.
+    if ( KMceAudio == aStream.Type() )
+        {
+        if ( !aStream.Source()->IsEnabled() && aSessionUpdateOngoing )
+            {
+            aStream.Source()->EnableL();
+            }
+
+        const RPointerArray<CMceMediaSink>& sinks = aStream.Sinks();
+        const TInt snkCount = sinks.Count();
+        for ( TInt k = 0; k < snkCount; k++ )
+            {
+
+            if ( !sinks[k]->IsEnabled()&& aSessionUpdateOngoing )
+                {
+                sinks[k]->EnableL();
+                }
+
+            if ( KMceRTPSink == sinks[k]->Type() )
+                {
+                SVPDEBUG2( "CSVPUtility::CheckRtcpSettingL updating: %d", k );
+                static_cast<CMceRtpSink*>(
+                    sinks[k] )->UpdateL( rtcpsuppression );
+                SVPDEBUG1( "CSspUtility::CheckRtcpSettingL update done" );
+                }
+            }
+        }
+    else
+        {
+        SVPDEBUG1( "CSspUtility::CheckRtcpSettingL KErrArgument" );
+        User::Leave( KErrArgument );
+        }
+    
+    SVPDEBUG1( "CSspUtility::CheckRtcpSettingL Exit" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetVADL
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetVADL( CMceAudioStream& aInAudioStream,
+                           TBool aVADSetting,
+                           const TDesC8& aCodecName )
+    {
+    SVPDEBUG1( "CSVPUtility::SetVADL In" )
+
+    __ASSERT_ALWAYS( &aCodecName, User::Leave( KErrArgument ) );
+
+    if ( &aInAudioStream )
+        {
+        CMceAudioCodec* codec = SVPAudioUtility::FindCodec( aInAudioStream, aCodecName );
+        if ( codec )
+            {
+            SVPDEBUG2( "CSVPUtility aInAudioStream and codec valid, setting VAD with %d", aVADSetting )
+            codec->EnableVAD( aVADSetting );
+            }
+        }
+
+    SVPDEBUG1( "CSVPUtility::SetVADL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPUtility::SetAmrWbParameters
+// ---------------------------------------------------------------------------
+//
+void CSVPUtility::SetAmrWbParameters( CMceAudioStream& aAudioInStream, 
+                                    const CRCSEAudioCodecEntry& aCodecProfile,
+                                    TInt aCodecNumber )
+    {
+    SVPDEBUG1( "CSVPUtility::SetAmrWbParameters In" )
+    
+    TUint allowedBitrates( 0 );
+    
+    // Set correct mode-set
+    const RArray< TUint32 >& modeSetArray = aCodecProfile.iModeSet;
+    for ( TInt i = 0; i < modeSetArray.Count(); i++ )
+        {
+        TUint value = modeSetArray[ i ];
+        switch ( value )
+            {
+            case 0: { allowedBitrates |= KMceAllowedAmrWbBitrate660;  break; }
+            case 1: { allowedBitrates |= KMceAllowedAmrWbBitrate885;  break; }
+            case 2: { allowedBitrates |= KMceAllowedAmrWbBitrate1265;  break; }
+            case 3: { allowedBitrates |= KMceAllowedAmrWbBitrate1425;  break; }
+            case 4: { allowedBitrates |= KMceAllowedAmrWbBitrate1585;  break; }
+            case 5: { allowedBitrates |= KMceAllowedAmrWbBitrate1825;  break; }
+            case 6: { allowedBitrates |= KMceAllowedAmrWbBitrate1985;  break; }
+            case 7: { allowedBitrates |= KMceAllowedAmrWbBitrate2305;  break; }
+            case 8: { allowedBitrates |= KMceAllowedAmrWbBitrate2305;  break; }
+            case 9: { allowedBitrates |= KMceAllowedAmrWbBitrate2385;  break; }
+            default: { allowedBitrates |= KMceAllowedAmrWbBitrateAll;  break; }
+            }
+
+        SVPDEBUG3( "SetAmrWbParameters round %d, value: %u",
+            i, value )
+        SVPDEBUG2( "SetAmrWbParameters allowedBitrates 0x%x",
+            allowedBitrates )
+        }
+
+    SVPDEBUG2( "SetAmrWbParameters mode-set 0x%x", allowedBitrates )
+    
+    // Set correct mode-change-period (mode-change-period=1):
+    if ( 2 == aCodecProfile.iModeChangePeriod )
+        {
+        allowedBitrates |= KMceAllowedAmrWbModeChangePeriod2;
+        }
+
+    // Set correct mode-change-neighbor (mode-change-neighbor=0)
+    if ( CRCSEAudioCodecEntry::EOn == aCodecProfile.iModeChangeNeighbor )
+        {
+        allowedBitrates |= KMceAllowedAmrWbModeChangeNeighbor1;
+        }
+
+    aAudioInStream.Codecs()[ aCodecNumber ]->SetAllowedBitrates(
+        allowedBitrates );
+
+    SVPDEBUG2( "CSVPUtility::SetAmrWbParameters Out, 0x%x", allowedBitrates )
+    }
+
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/src/svpvolumeobserver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,209 @@
+/*
+* 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:  SVP telephony volume observer.
+*
+*/
+
+
+#include <centralrepository.h>
+#include <TelephonyAudioRouting.h>
+#include <telephonydomaincrkeys.h>
+
+#include "svpvolumeobserver.h"
+#include "svplogger.h"
+#include "svpvolumeupdateobserver.h"
+
+// Default volume for initialization
+const TInt KDefaultVolume = 4;
+
+
+// ---------------------------------------------------------------------------
+// CSVPVolumeObserver::CSVPVolumeObserver
+// ---------------------------------------------------------------------------
+//
+CSVPVolumeObserver::CSVPVolumeObserver( MSVPVolumeUpdateObserver& aObserver ) 
+    : iCurrentIhfVolume( KDefaultVolume ), iCurrentEarVolume( KDefaultVolume ),
+    iMode( CTelephonyAudioRouting::EHandset ), iRepository( NULL ),
+    iVolumeUpdate( aObserver )
+    {
+    SVPDEBUG1("CSVPVolumeObserver::CSVPVolumeObserver()");
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPVolumeObserver::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPVolumeObserver::ConstructL()
+    {
+    iRepository = CRepository::NewL( KCRUidInCallVolume );
+    iNotifier = CCenRepNotifyHandler::NewL( *this, *iRepository );
+    
+    // Get the current EAR volume from repository
+    User::LeaveIfError( 
+        iRepository->Get( KTelIncallEarVolume, iCurrentEarVolume ) );
+        
+    // Get the current IHF volume from repository
+    User::LeaveIfError( iRepository->Get( KTelIncallLoudspeakerVolume, 
+        iCurrentIhfVolume ) );
+    
+    // create instance of telephony audio routing for tracking mode changes
+    iTelephonyAudioRouting = CTelephonyAudioRouting::NewL( *this );
+    
+    SVPDEBUG2("CSVPVolumeObserver::ConstructL iCurrentIhfVolume: %d",
+        iCurrentIhfVolume );
+    SVPDEBUG2("CSVPVolumeObserver::ConstructL iCurrentEarVolume: %d",
+        iCurrentEarVolume );
+    
+    iNotifier->StartListeningL();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPVolumeObserver::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPVolumeObserver* CSVPVolumeObserver::NewL( 
+        MSVPVolumeUpdateObserver& aObserver )
+    {
+    CSVPVolumeObserver* self = new( ELeave ) CSVPVolumeObserver( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPVolumeObserver::~CSVPVolumeObserver
+// ---------------------------------------------------------------------------
+//
+CSVPVolumeObserver::~CSVPVolumeObserver()
+    {
+    if ( iNotifier )
+        {
+        iNotifier->StopListening();
+        }
+    
+    delete iNotifier;
+    delete iRepository;
+    delete iTelephonyAudioRouting;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPVolumeObserver::HandleNotifyGeneric
+// ---------------------------------------------------------------------------
+//
+void CSVPVolumeObserver::HandleNotifyGeneric( TUint32 aId )
+    {
+    SVPDEBUG1("CSVPVolumeObserver::HandleNotifyGeneric() In");
+    TInt error = KErrArgument;
+    
+    if ( KTelIncallEarVolume == aId )
+        {
+        error = iRepository->Get( KTelIncallEarVolume, iCurrentEarVolume );
+        
+        SVPDEBUG2("CSVPVolumeObserver::HandleNotifyGeneric EAR VOL: %d",
+            iCurrentEarVolume );
+        }
+    else if ( KTelIncallLoudspeakerVolume == aId )
+        {
+        error = iRepository->Get( KTelIncallLoudspeakerVolume,
+            iCurrentIhfVolume );
+        
+        SVPDEBUG2("CSVPVolumeObserver::HandleNotifyGeneric IHF VOL: %d",
+            iCurrentIhfVolume );
+        }
+    // else we are not interested in this notification. Note that we set error
+    // to be KErrArgument and thus we do not set volume if aId is not what
+    // we accept it to be.
+    
+    if( KErrNone == error )
+        {
+        // Handle volume so that everything else is like earpiece but
+        // loudspeaker.
+        TInt volume =  KDefaultVolume;
+        if ( CTelephonyAudioRouting::ELoudspeaker == iMode )
+            {
+            volume = iCurrentIhfVolume;
+            }
+        else
+            {
+            volume = iCurrentEarVolume;
+            }
+            
+        // volume update
+        iVolumeUpdate.VolumeChanged( volume );
+        }
+        
+    SVPDEBUG2("CSVPVolumeObserver::HandleNotifyGeneric ERROR: %d", error );
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPVolumeObserver::OutputChanged
+// ---------------------------------------------------------------------------
+//
+void CSVPVolumeObserver::OutputChanged( 
+    CTelephonyAudioRouting& aTelephonyAudioRouting )
+    {
+    SVPDEBUG1("CSVPVolumeObserver::OutputChanged In");
+    
+    // Only unique audio route is the loudspeaker.
+    if ( CTelephonyAudioRouting::ELoudspeaker ==
+        aTelephonyAudioRouting.Output() )
+        {
+        SVPDEBUG1("CSVPVolumeObserver::OutputChanged to LOUDSPEAKER");
+        iMode = CTelephonyAudioRouting::ELoudspeaker;
+        iVolumeUpdate.VolumeChanged( iCurrentIhfVolume );
+        }
+    else
+        {
+        // in other cases apply earpiece volume level.
+        SVPDEBUG2("CSVPVolumeObserver::OutputChanged to %d",
+            aTelephonyAudioRouting.Output() );
+        
+        iMode = CTelephonyAudioRouting::EHandset;
+        iVolumeUpdate.VolumeChanged( iCurrentEarVolume );
+        }
+         
+    SVPDEBUG1("CSVPVolumeObserver::OutputChanged Out");
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPVolumeObserver::SetOutputComplete
+// ---------------------------------------------------------------------------
+//
+void CSVPVolumeObserver::SetOutputComplete( 
+    CTelephonyAudioRouting& /*aTelephonyAudioRouting*/, TInt /*aError*/ )
+    {
+    // no operations
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPVolumeObserver::AvailableOutputsChanged
+// ---------------------------------------------------------------------------
+//
+void CSVPVolumeObserver::AvailableOutputsChanged( 
+    CTelephonyAudioRouting& /*aTelephonyAudioRouting*/ )
+    {
+    // no operations
+    }
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholdattributehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Handles SDP direction attribute related issues.
+*
+*/
+
+
+#ifndef SVPHOLDATTRIBUTEHANDLER_H
+#define SVPHOLDATTRIBUTEHANDLER_H
+
+#include <e32base.h>
+
+
+/**
+*  Handles SDP direction attribute related issues.
+*  @lib svp.dll
+*  @since Series 60 3.2
+*/
+class CSVPHoldAttributeHandler : public CBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPHoldAttributeHandler* NewL();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPHoldAttributeHandler();
+
+public:  // New functions
+
+    /**
+    * Returns index of direction attribute.
+    * @since Series 60 3.2
+    * @param aAttributeLines Array of attribute lines. Ownership not transferred.
+    * @return Index to KSVPHoldDirectionAttributeMap.
+    */
+    TInt FindDirectionAttribute( MDesC8Array* aAttributeLines );
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPHoldAttributeHandler();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+    
+private: // data
+            
+    // Direction attribute array
+    CDesC8Array* iAttributeArray;
+
+    };
+
+#endif      // SVPHOLDATTRIBUTEHANDLER_H  
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholdconnectedstate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* 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:  Connected state class for hold state machine.
+*
+*/
+
+
+#ifndef SVPHOLDCONNECTEDSTATE_H
+#define SVPHOLDCONNECTEDSTATE_H
+
+#include "svpholdstatebase.h"
+#include "svpholdcontext.h"
+#include "svputdefs.h"
+
+/**
+*  State for hold requests in session connected state
+*  @lib svp.dll
+*  @since Series 60 3.2
+*/
+class CSVPHoldConnectedState : public CSVPHoldStateBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPHoldConnectedState* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPHoldConnectedState();
+
+protected:  // Functions from base classes
+    
+    /**
+    * From CSVPHoldStateBase Apply concrete state.
+    */
+    void DoApplyL( CSVPHoldContext& aContext );
+
+    /**
+    * From CSVPHoldStateBase Called when the state is entered.
+    */
+    void DoEnter( CSVPHoldContext& aContext );
+    
+    /**
+    * Checks if OutEstablishingState is active.
+    */
+    TBool IsOutEstablishingStateActive();
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPHoldConnectedState();
+    
+    /*
+    * Performs hold/resume request
+    */
+    TSVPHoldStateIndex PerformRequestL( CSVPHoldContext& aContext,
+                                        CMceMediaStream& aMediaStream,
+                                        CMceSession& aSession );   
+    /*
+    * Holds session locally
+    */
+    void HoldSessionLocallyL( CSVPHoldContext& aContext,
+                              CMceMediaStream& aMediaStream,
+                              CMceSession& aSession );
+    /*
+    * Handles remote resume requests
+    */
+    void RemoteSessionHoldL( CSVPHoldContext& aContext,
+                             CMceMediaStream& aMediaStream,
+                             CMceSession& aSession );
+
+private:
+    
+    // For testing
+    SVP_UT_DEFS
+
+    };
+
+#endif      // SVPHOLDCONNECTEDSTATE_H  
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholdcontext.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,584 @@
+/*
+* 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:  Base class for hold contexts. Contains methods 
+*                for creating the state array and controlling current state.
+*
+*/
+
+
+#ifndef SVPHOLDCONTEXT_H
+#define SVPHOLDCONTEXT_H
+
+#include    <e32base.h>
+#include    <mccpcallobserver.h>
+#include    "svputdefs.h"
+
+// Constants
+const TInt KSVPHoldDirectionAttributeCount  = 4;    // "sendonly" etc.
+const TInt KSVPMaxDirectionAttributeLength  = 10;   // "a=sendonly"
+const TInt KSVPHoldStateArraySize           = 5;
+const TInt KSVPHoldMaxLengthOfSDPMessage    = 1000;
+const TInt KSVPHoldMaxLengthOfInetAddr      = 32;
+
+// SDP Connection field content for oldway hold
+_LIT8( KSVPHoldZeroAddr, "0.0.0.0" );
+
+// SDP Direction attributes
+_LIT8( KSVPHoldAttributeSendrecv, "a=sendrecv" );
+_LIT8( KSVPHoldAttributeSendonly, "a=sendonly" );
+_LIT8( KSVPHoldAttributeRecvonly, "a=recvonly" );
+_LIT8( KSVPHoldAttributeInactive, "a=inactive" );
+
+// Indexes for direction attributes
+typedef TInt KSVPHoldAttributeIndex;
+const KSVPHoldAttributeIndex KSVPHoldSendrecvIndex      = 0;
+const KSVPHoldAttributeIndex KSVPHoldSendonlyIndex      = 1;
+const KSVPHoldAttributeIndex KSVPHoldRecvonlyIndex      = 2;
+const KSVPHoldAttributeIndex KSVPHoldInactiveIndex      = 3;
+
+// State indices
+typedef TInt TSVPHoldStateIndex;
+const TSVPHoldStateIndex KSVPHoldConnectedStateIndex    = 0;
+const TSVPHoldStateIndex KSVPHoldEstablishingStateIndex = 1;
+const TSVPHoldStateIndex KSVPHoldOutStateIndex          = 2;
+const TSVPHoldStateIndex KSVPHoldInStateIndex           = 3;
+const TSVPHoldStateIndex KSVPHoldDHStateIndex           = 4;
+
+/**
+* Hold transition
+*/
+// session hold state, needed for dtmf for determining active session
+enum TSVPSessionHoldState
+    {
+    ESVPConnected   = 0,
+    ESVPEstablishing,
+    ESVPOnHold
+    };
+    
+
+/**
+* Hold desired state change
+*/    
+enum TSVPHoldDesiredTransition
+    {
+    ESVPHoldNoRequest           = 0,
+    ESVPHoldToHold              = 1,
+    ESVPHoldToResume            = 2,
+    ESVPHoldIncoming            = 3
+    };
+
+/**
+* Hold request type
+*/    
+enum TSVPHoldRequestType
+    {
+    ESVPNoType                  = 0,
+    ESVPLocalHold               = 1,
+    ESVPLocalResume             = 2,
+    ESVPLocalDoubleHold         = 3,
+    ESVPLocalDoubleHoldResume   = 4,
+    ESVPRemoteHold              = 5,
+    ESVPRemoteResume            = 6,
+    ESVPRemoteDoubleHold        = 7,
+    ESVPRemoteDoubleHoldResume  = 8,
+    ESVPRequestError            = 9 // causes state to resume previous
+    };
+
+/**
+* Hold state
+*/
+enum TSVPHoldState
+    {
+    ESVPHoldConnected           = 0,
+    ESVPHoldLocallyHolded       = 1,
+    ESVPHoldRemoteHolded        = 2,
+    ESVPHoldLocallyDoubleHolded = 3,
+    ESVPHoldRemoteDoubleHolded  = 4
+    };
+
+
+class CSdpConnectionField;
+class TInetAddr;
+class CDesC8Array;
+class MDesC8Array;
+class CMceSession;
+class TMceTransactionDataContainer;
+class CSVPHoldStateBase;
+class MSVPHoldObserver;
+class CSVPHoldAttributeHandler;
+class CSVPHoldMediaHandler;
+
+
+/**
+*  Base class for session contexts.
+*
+*  @lib svp.dll
+*  @since Series 60 3.2
+*/
+class CSVPHoldContext : public CBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPHoldContext* NewL(
+                        CMceSession& aSession,
+                        TMceTransactionDataContainer& aContainer,
+                        MSVPHoldObserver* iObserver,
+                        TBool aIsMobileOriginated );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPHoldContext();
+
+public: // New functions
+    
+    /**
+    * Sets the current state for the context.
+    * Leaves with Error code if state transition is not acceptable.
+    * @since Series 60 3.2
+    * @param aContext Hold context
+    * @param aNewState New current state
+    */
+    void SetCurrentStateL( CSVPHoldContext& aContext,
+                           TSVPHoldStateIndex aNewState );
+
+    /**
+    * Returns the current state of the context
+    * @since Series 60 3.2
+    * @return TSVPHoldStateIndex the current state, index to it.
+    */
+    TSVPHoldStateIndex CurrentState() const;
+    
+    /**
+    * Applies the current state of the contex. This causes a
+    * state transition to next state of the state machine. The 
+    * current state sets the next state. Leaves on error
+    * @since Series 60 3.2
+    * @param aSession Session to be modified
+    * @param aTransition Desired operation
+    */
+    void ApplyCurrentStateL( CMceSession* aSession,
+                             TSVPHoldDesiredTransition aTransition );
+
+    /**
+    * Applies the current state of the contex. This causes a
+    * state transition to next state of the state machine. The 
+    * current state sets the next state. Leaves on error
+    * @since Series 60 3.2
+    */
+    void ApplyCurrentStateL();
+
+    /**
+    * Sets the reference to session object
+    * state leaves.
+    * @since Series 60 3.2
+    * @param aSession The session object
+    */
+    void SetSessionObject( CMceSession* aSession );
+    
+    /**
+    * Returns reference to session object
+    * state leaves.
+    * @since Series 60 3.2
+    * @return Pointer to session object
+    */
+    CMceSession* SessionObject();
+    
+    /**
+    * Returns type of hold request. This is valid during the complete
+    * state transition process, until next stable state is reached.
+    * @since Series 60 3.2
+    * @return Hold request type
+    */
+    TSVPHoldRequestType HoldRequest();
+    
+    /**
+    * Returns ETrue if hold/resume remote request.
+    * @since Series 60 3.2
+    * @return Boolean value
+    */
+    TBool IsRemoteRequest();
+        
+    /**
+    * After completed & succesful IN / OUT Request, returns occurred event.
+    * @since Series 60 3.2
+    * @return Occurred event to be informed to client application
+    */
+    MCCPCallObserver::TCCPCallEvent HoldEvent();
+    
+    /**
+    * Sets first attempt flag
+    * @since Series 60 3.2
+    * @param aValue Boolean value for -flag
+    */
+    void SetFirstAttempt( TBool aValue );
+    
+    /**
+    * Returns value of first attempt -flag
+    * @since Series 60 3.2
+    * @return Boolean value of first attempt -flag
+    */
+    TBool FirstAttempt();
+    
+    /**
+    * Sets remote request not processed -flag
+    * @since Series 60 3.2
+    * @param aValue Boolean value for flag
+    */
+    void SetRemoteRequestNotProcessed( TBool aValue );
+    
+    /**
+    * Returns value of the remote request not processed -flag
+    * @since Series 60 3.2
+    * @return Boolean value of the remote request not processed -flag
+    */
+    TBool RemoteRequestNotProcessed();
+            
+    /**
+    * Sets audio handling allowed -flag
+    * @since Series 60 3.2
+    * @param aValue Boolean value for flag
+    */
+    void SetAudioHandlingAllowed( TBool aValue );
+
+    /**
+    * Returns value of the audio handling allowed -flag
+    * @since Series 60 3.2
+    * @return Boolean value of the audio handling allowed -flag
+    */
+    TBool AudioHandlingAllowed();
+    
+    /**
+    * Returns reference to hold observer.
+    * @since Series 60 3.2
+    * @return Reference to hold observer.
+    */
+    MSVPHoldObserver& HoldObserver();
+        
+    /**
+    * Returns reference to attribute handler.
+    * @since Series 60 3.2
+    * @return Reference to attribute handler.
+    */
+    CSVPHoldAttributeHandler& AttributeHandler();
+    
+    /**
+    * Returns reference to media handler.
+    * @since Series 60 3.2
+    * @return Reference to media handler.
+    */
+    CSVPHoldMediaHandler& MediaHandler();
+    
+    /**
+    * Solves type of incoming request and returns next state of state machine.
+    * @since Series 60 3.2
+    * @param aSession Incoming updated MCE session
+    * @param aAttributeLines Attribute lines from incoming request.
+    * @param aCheckOldwayHold ETrue if oldwayhold need to be taken into account
+    * @return TSVPHoldRequestType Request type
+    */
+    TSVPHoldRequestType SolveRequestL( CMceSession& aSession,
+                                       MDesC8Array* aAttributeLines,
+                                       TBool aCheckOldwayHold = EFalse );
+                                       
+    /**
+    * Sets response status code
+    * @since Series 60 3.2
+    * @param aStatusCode Status code of response received
+    */
+    void SetResponseStatusCode( TInt aStatusCode );
+    
+    /**
+    * Gets response status code
+    * @since Series 60 3.2
+    * @return Status code
+    */
+    TInt ResponseStatusCode();
+    
+    /**
+    * Sets force hold flag value
+    * @since Series 60 3.2
+    * @param aForceHold Boolean value
+    */
+    void SetForceHold( TBool aForceHold );
+    
+    /**
+    * Gets force hold flag value
+    * @since Series 60 3.2
+    * @return Boolean value
+    */
+    TBool ForceHoldOccured();
+    
+    /**
+    * Handles and controls hold operation based on response status
+    * @since Series 60 3.2
+    * @param aNextState Valid hold state machine state after function call
+    * @return Boolean value ETrue if response needed special handling
+    */
+    TBool SpecialResponseHandling( TSVPHoldStateIndex& aNextState );
+    
+    /**
+    * Sets hold/resume request timed out -flag,
+    * called when hold/resume request has expired.
+    * @since Series 60 3.2
+    */
+    void TimedOut();
+    
+    /**
+    * Returns RollBack -boolean value
+    * @since Series 60 3.2
+    * @return Boolean value
+    */
+    TBool HoldRolledBack();
+    
+    /**
+    * Sets crossover situation on/off
+    * @since Series 60 3.2
+    * @param ETrue if CrossOver situation, EFalse otherways
+    * @return
+    */
+    void CrossOver( TBool aActive );
+
+    /**
+    * Returns Hold failed -boolean value. After this function call
+    * flag is cleared.
+    * @since Series 60 3.2
+    * @return ETrue if hold failed, EFalse otherways
+    */
+    TBool HoldFailed();
+
+    /**
+    * Returns Resume failed -boolean value
+    * @since Series 60 3.2
+    * @return ETrue if resume failed, EFalse otherways
+    */
+    TBool ResumeFailed();
+    
+    /**
+    * Returns IsMobileOriginated -boolean value
+    * @since Series 60 3.2
+    * @return ETrue if MobileOriginated, EFalse otherways
+    */
+    TBool IsMobileOriginated();
+
+    /**
+    * Sets mute state to Hold Controller
+    * @since Series 60 3.2
+    * @param aMuted Boolean value for mute value
+    */
+    void Muted( TBool aMuted );
+
+    /**
+    * Returns mute state
+    * @since Series 60 3.2
+    * @return Boolean value for mute value
+    */
+    TBool Muted();
+    
+    /**
+    * Sets CallRequestFailed status ETrue/EFalse
+    * @since Series 60 3.2
+    * @param aCallRequest Boolean value for call on hold request failed
+    */
+    void SetCallRequestFailed( TBool aCallRequest );
+    
+
+    /**
+    * Returns CallRequestFailed -boolean value
+    * @since Series 60 3.2
+    * @return ETrue if call on hold request failed, EFalse otherways
+    */
+    TBool CallRequestFailed();
+    
+    
+protected:  // New functions
+
+    /**
+    * Creates the states belonging to this context
+    * @since Series 60 3.2
+    */
+    void InitializeStateArrayL();
+
+    /**
+    * Checkes if a state transition to a given state is accepted.
+    * @since Series 60 3.2
+    * @param TSVPHoldStateIndex aStateIndex
+    * @return TBool, boolean value, is the transition valid.
+    */
+    TBool IsStateTransitionAccepted( 
+                        const TSVPHoldStateIndex aStateIndex );
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPHoldContext( TMceTransactionDataContainer& aContainer,
+                     TBool aIsMobileOriginated );
+
+    /**
+    * By default Symbian 2nd phase constructor is private. 
+    * Now it is protected.
+    */
+    void ConstructL( CMceSession& aSession,
+                     MSVPHoldObserver* iObserver );
+
+
+private:     // New functions
+    
+    /**
+    * Returns ETrue if establishing state is next, EFalse otherways
+    */
+    TBool ToEstablishing();
+    
+    /**
+    * Returns hold request type
+    */
+    TSVPHoldRequestType RequestType( 
+            TSVPHoldDesiredTransition aTransition );
+            
+    /**
+    * Returns hold request type
+    */
+    TSVPHoldRequestType RequestToHold();
+    
+    /**
+    * Returns hold request type
+    */
+    TSVPHoldRequestType RequestToResume();
+    
+    /**
+    * Returns hold request type
+    */
+    TSVPHoldRequestType RequestIncoming();
+                         
+    /**
+    * Updates right establishing state based on the direction of the request
+    */
+    void UpdateEstablishingStateL();
+    
+    /**
+    * 
+    */
+    TSVPHoldRequestType SolveRequestType( 
+            TInt aAttributeIndex,
+            TSVPHoldRequestType aPresumedRequest );
+                                                               
+    /**
+    * This method is used in mobile terminating(MT) calls, to check SDP
+    * body for Connection field, and to check the content of that field.
+    *
+    * @since    Series60 3.2
+    * @param    aSession Incoming updated MCE session
+    * @param    aPresumedRequest Enumeration for hold request type,
+    *                            assumed hold type passed as parameter.
+    * @return                    Enumerated value of hold request, after
+    *                            oldway hold is checked from the content.
+    */
+    TSVPHoldRequestType 
+    CheckOldwayHoldL( CMceSession& session,
+                      TSVPHoldRequestType aPresumedRequest );
+    
+    /**
+    * Rolls hold session state back to previous state
+    */
+    void RollBack( TSVPHoldStateIndex& aNextState );
+
+        
+protected:  // Data
+
+    // State array
+    RPointerArray< CSVPHoldStateBase >* iStates;
+
+    // Observer
+    MSVPHoldObserver* iObserver;
+    
+
+private:    // Data
+
+    // Current state
+    CSVPHoldStateBase* iCurrentState;
+    
+    // Current hold request type. Changed by SolveRequestType() and
+    // in special cases, e.g. when 2-phased hold needed (MO oldway)
+    TSVPHoldRequestType iHoldRequest;
+    
+    // Pointer to session object (not owned)
+    CMceSession* iSession;
+    
+    // Boolean value of request direction
+    TBool iOutgoing;
+    
+    // Instance of attribute handler
+    CSVPHoldAttributeHandler* iAttributeHandler;
+    
+    // Instance of media handler
+    CSVPHoldMediaHandler* iMediaHandler;
+    
+    // First attempt (not MO oldway hold)
+    TBool iFirstAttempt;
+    
+    // Flag for remote request in process
+    TBool iRemoteRequestNotProcessed;
+    
+    // Data container for mce session
+    TMceTransactionDataContainer& iContainer;
+    
+    // Hold event
+    MCCPCallObserver::TCCPCallEvent iHoldEvent;
+    
+    // Indicates that audio handling is allowed
+    TBool iAllowAudioHandling;
+    
+    // Status code of the response
+    TInt iResponseStatusCode;
+    
+    // Force hold occured flag;
+    TBool iForceHoldOccured;
+    
+    // Flag for timed out hold/resume request
+    TBool iTimedOut;
+    
+    // Flag for preventing audio enable/disable
+    TBool iRollBack;
+    
+    // Flag for failed hold
+    TBool iHoldFail;
+    
+    // Flag for failed resume (causes session to be terminated)
+    TBool iResumeFail;
+    
+    // Flag for SVP session direction
+    TBool iIsMobileOriginated;
+    
+    // Flag for mute
+    TBool iMuted;
+    
+    // Flag for cross over (simultaneous requests)
+    TBool iCrossOver;
+    
+    // Flag for callbackrequest
+    TBool iCallRequest;
+
+
+private:
+    
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif      // SVPHOLDCONTEXT_H 
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholdcontroller.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,287 @@
+/*
+* 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:  Hold controller, interface class for handling hold
+*
+*/
+
+
+#ifndef SVPHOLDCONTROLLER_H
+#define SVPHOLDCONTROLLER_H
+
+#include    <e32base.h>
+#include    <mccpcallobserver.h>
+#include    "svpholdcontext.h"
+#include    "svputdefs.h"
+
+class CMceSession;
+class MSVPHoldObserver;
+class CSVPSessionBase;
+
+const TInt KErrSVPHoldErrorBase                 = -2000;
+const TInt KErrSVPHoldStateError                = KErrSVPHoldErrorBase - 1;
+const TInt KErrSVPHoldInProgress                = KErrSVPHoldErrorBase - 2;
+const TInt KErrSVPHoldResumeInProgress          = KErrSVPHoldErrorBase - 3;
+const TInt KErrSVPHoldRequestPending            = KErrSVPHoldErrorBase - 4;
+const TInt KErrSVPHoldNotHoldRequest            = KErrSVPHoldErrorBase - 5;
+const TInt KErrSVPHoldUnacceptableResponseAttribute = KErrSVPHoldErrorBase - 6;
+const TInt KErrSVPHoldLocalOldwayholdNeeded     = KErrSVPHoldErrorBase - 7;
+const TInt KErrSVPHoldRequestProcessingNotReady = KErrSVPHoldErrorBase - 8;
+
+
+/**
+*  Hold controller.
+*  @lib svp.dll
+*  @since Series 60 3.2
+*/
+class CSVPHoldController : public CBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPHoldController* NewL(                             
+                        CMceSession& aSession,
+                        TMceTransactionDataContainer& aContainer,
+                        MSVPHoldObserver* aObserver,
+                        TBool aIsMobileOriginated );
+
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPHoldController* NewLC( 
+                        CMceSession& aSession,
+                        TMceTransactionDataContainer& aContainer,
+                        MSVPHoldObserver* aObserver,
+                        TBool aIsMobileOriginated );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPHoldController();
+
+public:  // Methods
+
+    /**
+    * Holds session. If hold fails then observer method is called
+    * @since Series 60 3.2
+    * @param aSession Session object. Ownership not transferred
+    * @return Error code
+    */
+    TInt HoldSession( CMceSession* aSession );
+
+    /**
+    * Resumes session. If resume fails then observer method is called
+    * @since Series 60 3.2
+    * @param aSession Session object. Ownership not transferred
+    * @return Error code
+    */
+    TInt ResumeSession( CMceSession* aSession );
+    
+    /**
+    * Retries previous failed request
+    * @since Series 60 3.2
+    * @param aSession Session object. Ownership not transferred
+    * @return Error code
+    */
+    TInt RetryHoldRequest( CMceSession* aSession );
+    
+    /**
+    * This method must be called after hold/resume expiration time is
+    * exceeded.
+    * @since Series 60 3.2
+    */
+    void TimedOut();
+    
+    /**
+    * Examines incoming request for the case of hold/resume.
+    * @since Series 60 3.2
+    * @param aSession Session object. Ownership not transferred
+    * @return KErrSVPHoldNot if is other type than hold/resume,
+    *         system wide error code or KErrNone if succesful.
+    *         If KErrNone, observer methods are called.
+    */
+    TInt IncomingRequest( CMceSession* aSession );
+    
+    /**
+    * Examines response for hold request.
+    * @since Series 60 3.2
+    * @param aSession Session object. Ownership not transferred
+    * @param aStatusCode Status code of the response
+    * @return KErrSVPHoldNotHoldRequest if is other type than hold/resume,
+    *         system wide error code or KErrNone if succesful.
+    *         If KErrNone, observer methods are called.
+    */
+    TInt IncomingResponse( CMceSession* aSession, TInt aStatusCode );
+        
+    /**
+    * Returns ETrue if holding/resuming session is ongoing.
+    * @since Series 60 3.2
+    * @return ETrue if holding/resuming of session is ongoing 
+    */
+    TBool HoldInProgress() const;
+    
+    /**
+    * Returns ETrue if holding/resuming error caused hold state
+    * to roll back to its previous state
+    * @since Series 60 3.2
+    * @return ETrue if holding/resuming rolleed back 
+    */
+    TBool HoldRolledBack() const;
+    
+    /**
+    * Returns Hold failed -boolean value. After this function call
+    * flag is cleared.
+    * @since Series 60 3.2
+    * @return ETrue if hold failed, EFalse otherways
+    */
+    TBool HoldFailed();
+
+    /**
+    * Returns Resume failed -boolean value. If resume has failed, session
+    * must be terminated, and it cannot do before MCE session state is
+    * in connected state.
+    * @since Series 60 3.2
+    * @return ETrue if resume failed, EFalse otherways
+    */
+    TBool ResumeFailed();
+    
+    /**
+    * Continues processing of local hold/resume request.
+    * @since Series 60 3.2
+    * @param aSession MCE session
+    * @return error code
+    */
+    TInt ContinueHoldProcessing( CMceSession& aSession );
+    
+    /**
+    * Hold / Resume request has failed
+    * @since Series 60 3.2
+    * @param aSession MCE session
+    * @param aStatusCode reason
+    * @param aBase SVP session base
+    * @return error code
+    */
+    TInt RequestFailed( CMceSession& aSession, TInt aStatusCode, CSVPSessionBase& aBase );
+    
+    /**
+    * Checks if currently crossover situation
+    * @since Series 60 3.2
+    * @param aBase SVP session base
+    */
+    void CheckCrossOver( CSVPSessionBase& aBase );
+    
+    /**
+    * Returns session hold state
+    * @since Series 60 3.2
+    * @return Current hold state (Holded only if local stream on hold)
+    */
+    TSVPSessionHoldState HoldState() const;
+
+    /**
+    * Returns session hold request type
+    * @since Series 60 3.2
+    * @return Current hold request type
+    */
+    TSVPHoldRequestType HoldRequest() const;
+
+    /**
+    * After completed & succesful IN / OUT Request, returns occurred event.
+    * @since Series 60 3.2
+    * @return Occurred event to be informed to client application
+    */
+    MCCPCallObserver::TCCPCallEvent HoldEvent();
+    
+    /**
+    * Sets mute state to Hold Controller
+    * @since Series 60 3.2
+    * @param aMuted Boolean value for mute value
+    */
+    void Muted( TBool aMuted );
+
+    /**
+    * Refreshes hold state in local hold state when non-hold re-invite received
+    * @since Series 60 3.2
+    * @param
+    */
+    void RefreshHoldStateL();
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPHoldController();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL( CMceSession& aSession,
+                     TMceTransactionDataContainer& aContainer,
+                     MSVPHoldObserver* aObserver,
+                     TBool aIsMobileOriginated );
+    
+    /**
+    * HoldAllowed
+    */
+    TBool HoldAllowed();
+    
+    /**
+    * ResumeAllowed
+    */
+    TBool ResumeAllowed();
+    
+    /**
+    * IncomingRequestAllowed
+    */
+    TBool IncomingRequestAllowed();
+        
+    /**
+    * IncomingResponseAllowed
+    */
+    TBool IncomingResponseAllowed();
+
+    /**
+    * Refresh hold state
+    * @since S60 3.2
+    * @param aMediaStream Representation of MCE media stream
+    */
+    void RefreshL( CMceMediaStream& aMediaStream );
+
+private: // data
+
+    // Context of hold
+    CSVPHoldContext* iContext;
+
+    // Previous hold state    
+    TSVPHoldState iPreviousHoldState;
+    
+    // Flag for readyness of hold request
+    TBool iHoldRequestCompleted;
+    
+    // Desired hold request for re-Invite crossover case
+    TSVPHoldDesiredTransition iHoldRequest;
+    
+    // Reinvite crossover flag (race condition)
+    TBool iReinviteCrossover;
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+		
+    };
+
+#endif      // SVPHOLDCONTROLLER_H  
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholddhstate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,96 @@
+/*
+* 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:  Double hold state class for hold state machine.
+*
+*/
+
+
+#ifndef SVPHOLDDHSTATE_H
+#define SVPHOLDDHSTATE_H
+
+#include "svpholdstatebase.h"
+#include "svpholdcontext.h"
+#include "svputdefs.h"
+
+/**
+*  Hold state for doubleholded session.
+*  @lib svp.dll
+*  @since Series 60 3.2
+*/
+class CSVPHoldDHState : public CSVPHoldStateBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPHoldDHState* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPHoldDHState();
+
+protected:  // Functions from base classes
+    
+    /**
+    * From CSVPHoldStateBase Apply concrete state.
+    */
+    void DoApplyL( CSVPHoldContext& aContext );
+
+    /**
+    * From CSVPHoldStateBase Called when the state is entered.
+    */
+    void DoEnter( CSVPHoldContext& aContext );
+
+    /**
+    * Checks if OutEstablishingState is active.
+    */
+    TBool IsOutEstablishingStateActive();
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPHoldDHState();
+            
+    /*
+    * Performs hold/resume request
+    */
+    TSVPHoldStateIndex PerformRequestL( CSVPHoldContext& aContext,
+                                        CMceMediaStream& aMediaStream,
+                                        CMceSession& aSession );   
+    /*
+    * Resumes locally doubleholded session
+    */
+    void ResumeDoubleHoldSessionLocallyL( CSVPHoldContext& aContext,
+                                          CMceMediaStream& aMediaStream,
+                                          CMceSession& aSession );
+    /*
+    * Handles remote doublehold resume requests
+    */
+    void RemoteDoubleHoldSessionResumeL( CSVPHoldContext& aContext,
+                                         CMceMediaStream& aMediaStream,
+                                         CMceSession& aSession );
+    
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif      // SVPHOLDDHSTATE_H  
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholdinestablishingstate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,105 @@
+/*
+* 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:  Establishing state class for incoming hold/resume requests.
+*
+*/
+
+
+#ifndef SVPHOLDINESTABLISHINGSTATE_H
+#define SVPHOLDINESTABLISHINGSTATE_H
+
+#include    "svpholdstatebase.h"
+#include    "svpholdcontext.h"
+#include    "svputdefs.h"
+
+/**
+*  Establishing state for incoming hold/resume requests
+*  @lib svp.dll
+*  @since Series 60 3.2
+*/
+class CSVPHoldInEstablishingState : public CSVPHoldStateBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPHoldInEstablishingState* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPHoldInEstablishingState();
+    
+
+protected:  // Functions from base classes
+    
+    /**
+    * From CSVPHoldStateBase Apply concrete state.
+    */
+    void DoApplyL( CSVPHoldContext& aContext );
+
+    /**
+    * From CSVPHoldStateBase Called when the state is entered.
+    */
+    void DoEnter( CSVPHoldContext& aContext );
+
+    /**
+    * Checks if OutEstablishingState is active.
+    */
+    TBool IsOutEstablishingStateActive();
+    
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPHoldInEstablishingState();
+
+    /**
+    * Handles local hold case.
+    */
+    void HandleRemoteHolding( TSVPHoldStateIndex& aNextState,
+                              TSVPHoldStateIndex aState = 0 );
+
+    /**
+    * Handles local resume case.
+    */
+    void HandleRemoteResuming( TSVPHoldStateIndex& aNextState,
+                               TSVPHoldStateIndex aState = 0 );
+
+    /**
+    * Checks acceptability of direction attribute from request.
+    */
+    TInt CheckAttribute( MDesC8Array* aAttributeLines,
+                         KSVPHoldAttributeIndex aNeededAttribute,
+                         TSVPHoldStateIndex& aNextState,
+                         CSVPHoldContext& aContext );
+                         
+    /**
+    * Defines state change in basic schene.
+    */
+    TInt DefineDefaultCaseStateChange( CSVPHoldContext& aContext,
+                                       TSVPHoldStateIndex& aNextState );
+        
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif      // SVPHOLDINESTABLISHINGSTATE_H  
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholdinstate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* 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:  Remote holded state for hold state machine.
+*
+*/
+
+
+#ifndef SVPHOLDINSTATE_H
+#define SVPHOLDINSTATE_H
+
+#include "svpholdstatebase.h"
+#include "svpholdcontext.h"
+#include "svputdefs.h"
+
+/**
+*  State for remote holded sesison.
+*  @lib svp.dll
+*  @since Series 60 3.2
+*/
+class CSVPHoldInState : public CSVPHoldStateBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPHoldInState* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPHoldInState();
+
+protected:  // Functions from base classes
+    
+    /**
+    * From CSVPHoldStateBase Apply concrete state.
+    */
+    void DoApplyL( CSVPHoldContext& aContext );
+
+    /**
+    * From CSVPHoldStateBase Called when the state is entered.
+    */
+    void DoEnter( CSVPHoldContext& aContext );
+
+    /**
+    * Checks if OutEstablishingState is active.
+    */
+    TBool IsOutEstablishingStateActive();
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPHoldInState();
+
+    /*
+    * Performs hold/resume request
+    */
+    TSVPHoldStateIndex PerformRequestL( CSVPHoldContext& aContext,
+                                        CMceMediaStream& aMediaStream,
+                                        CMceSession& aSession );   
+    /*
+    * Handles local session double holding
+    */
+    void LocalSessionDoubleHoldL( CSVPHoldContext& aContext,
+                                  CMceMediaStream& aMediaStream,
+                                  CMceSession& aSession );
+    /*
+    * Handles remote resume requests
+    */
+    void RemoteSessionResumeL( CSVPHoldContext& aContext,
+                               CMceMediaStream& aMediaStream,
+                               CMceSession& aSession );
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+
+    };
+
+#endif      // SVPHOLDINSTATE_H  
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholdmediahandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,161 @@
+/*
+* 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:  Pauses and resumes audio stream.
+*
+*/
+
+
+#ifndef SVPHOLDMEDIAHANDLER_H
+#define SVPHOLDMEDIAHANDLER_H
+
+#include <e32base.h>
+
+class CSVPHoldContext;
+class CMceMediaStream;
+
+
+/**
+*  Media handler class for SVP hold extension.
+*  @lib svp.dll
+*  @since S60 3.2
+*/
+class CSVPHoldMediaHandler : public CBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPHoldMediaHandler* NewL();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPHoldMediaHandler();
+
+public:  // New functions
+    
+    /**
+    * Disables/enables media stream based on the request.
+    * @since S60 3.2
+    * @param aMediaStream MCE Media stream
+    * @param aRequest Request type
+    */
+    void PerformMediaActionL( CMceMediaStream& aMediaStream,
+                              TSVPHoldRequestType aRequest );
+    
+    /**
+    * Disables needed sinks/sources.
+    * @since S60 3.2
+    * @param aContext SVP Hold context
+    * @param aLeaveSpeakerEnabled ETrue, when only mic source is disabled
+    */
+    void DisableAudioL( CSVPHoldContext& aContext,
+                        TBool aLeaveSpeakerEnabled = EFalse );
+    
+    /**
+    * Disables needed sinks/sources.
+    * @since S60 3.2
+    * @param aContext SVP Hold context
+    */
+    void EnableAudioL( CSVPHoldContext& aContext );
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPHoldMediaHandler();
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL() const;
+
+
+private: // New functions
+
+    /**
+    * Handles streams in local hold request cases.
+    * @since S60 3.2
+    * @param aMediaStream MCE Media stream
+    * @param aBoundStream MCE Media stream
+    */
+    void HandleLocalHoldingL( CMceMediaStream& aMediaStream,
+                              CMceMediaStream& aBoundStream );
+
+    /**
+    * Handles streams in local resume request cases.
+    * @since S60 3.2
+    * @param aMediaStream MCE Media stream
+    * @param aBoundStream MCE Media stream
+    * @param aRequest Request type
+    */
+    void HandleLocalResumingL( CMceMediaStream& aMediaStream,
+                               CMceMediaStream& aBoundStream,
+                               TSVPHoldRequestType aRequest );
+
+    /**
+    * Handles streams in remote hold request cases.
+    * @since S60 3.2
+    * @param aMediaStream MCE Media stream
+    * @param aBoundStream MCE Media stream
+    */
+    void HandleRemoteHoldingL( CMceMediaStream& aMediaStream,
+                               CMceMediaStream& aBoundStream,
+                               TSVPHoldRequestType aRequest );
+
+    /**
+    * Handles streams in local resume request cases.
+    * @since S60 3.2
+    * @param aMediaStream MCE Media stream
+    * @param aBoundStream MCE Media stream
+    * @param aRequest Request type
+    */
+    void HandleRemoteResumingL( CMceMediaStream& aMediaStream,
+                                CMceMediaStream& aBoundStream,
+                                TSVPHoldRequestType aRequest );
+    
+    /**
+    * Enables audio
+    * @since S60 3.2
+    * @param aMediaStream MCE Media stream
+    * @param aContext SVP Hold context
+    */
+    void EnableAudioL( CMceMediaStream& aMediaStream,
+                       CSVPHoldContext& aContext );
+
+                                             
+    /**
+    * Disables used audio stream (mic & speaker)
+    * @since S60 3.2
+    * @param aAudioStream MCE Media stream
+    */
+    void DisableAudioStreamL( CMceMediaStream& aAudioStream,
+                              TBool aLeaveSpeakerEnabled );
+
+    /**
+    * Disables used audio stream (mic & speaker)
+    * @since S60 3.2
+    * @param aAudioStream MCE Media stream
+    * @param aAllowMicEnable Boolean value
+    */
+    void EnableAudioStreamL( CMceMediaStream& aAudioStream,
+                             TBool aAllowMicEnable = ETrue );
+
+    };
+
+#endif      // SVPHOLDMEDIAHANDLER_H  
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholdobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,70 @@
+/*
+* 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:  Observer interface to be implemented by SVP controller.
+*
+*/
+
+
+#ifndef SVPHOLDOBSERVER_H
+#define SVPHOLDOBSERVER_H
+
+/**
+*  SVP Hold observer, implemented by SVP controller
+*  @lib svp.dll
+*  @since Series 60 3.2
+*/
+class MSVPHoldObserver
+    {
+public: // New functions
+
+    /**
+    * Notifies, that session has been holded.
+    * @since Series 60 3.2
+    */
+    virtual void SessionLocallyHeld() = 0;
+
+    /**
+    * Notifies, that session has been resumed.
+    * @since Series 60 3.2
+    */
+    virtual void SessionLocallyResumed() = 0;
+    
+    /**
+    * Notifies, that session has been remotely held.
+    * @since Series 60 3.2
+    */
+    virtual void SessionRemoteHeld() = 0;
+
+    /**
+    * Notifies, that session has been remotely resumed.
+    * @since Series 60 3.2
+    */
+    virtual void SessionRemoteResumed() = 0;
+    
+    /**
+    * Notifies, that hold request failed.
+    * @since Series 60 3.2
+    */
+    virtual void HoldRequestFailed() = 0;
+
+    /**
+    * Notifies, that resume request failed.
+    * @since Series 60 3.2
+    */
+    virtual void ResumeRequestFailed() = 0;
+
+    };
+
+#endif      // SVPHOLDOBSERVER_H   
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholdoutestablishingstate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* 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:  Establishing state class for outgoing hold/resume requests.
+*
+*/
+
+
+#ifndef SVPHOLDOUTESTABLISHINGSTATE_H
+#define SVPHOLDOUTESTABLISHINGSTATE_H
+
+#include    "svpholdstatebase.h"
+#include    "svpholdcontext.h"
+#include    "svputdefs.h"
+
+/**
+*  Establishing state for local hold/resume requests.
+*  @lib svp.dll
+*  @since Series 60 3.2
+*/
+class CSVPHoldOutEstablishingState : public CSVPHoldStateBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPHoldOutEstablishingState* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPHoldOutEstablishingState();
+
+protected:  // Functions from base classes
+    
+    /**
+    * From CSVPHoldStateBase Apply concrete state.
+    */
+    void DoApplyL( CSVPHoldContext& aContext );
+
+    /**
+    * From CSVPHoldStateBase Called when the state is entered.
+    */
+    void DoEnter( CSVPHoldContext& aContext );
+
+    /**
+    * Checks if OutEstablishingState is active.
+    */
+    TBool IsOutEstablishingStateActive();
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPHoldOutEstablishingState();
+    
+    /**
+    * Handles local cases.
+    */
+    void HandleLocalHoldL( CSVPHoldContext&  aContext,
+                           CMceMediaStream* aMediaStream,
+                           TSVPHoldStateIndex& aNextState );
+    /**
+    * Handles local hold case.
+    */
+    void HandleLocalHoldingL( CSVPHoldContext& aContext,
+                              CMceMediaStream* mediaStream,
+                              TSVPHoldStateIndex& aNextState,
+                              TSVPHoldStateIndex aState = 0 );
+
+    /**
+    * Handles local resume case.
+    */
+    void HandleLocalResumingL( CSVPHoldContext& aContext,
+                               CMceMediaStream* mediaStream,
+                               TSVPHoldStateIndex& aNextState,
+                               TSVPHoldStateIndex aState = 0 );
+
+    /**
+    * Checks acceptability of direction attribute from response.
+    */
+    TInt CheckAttributeL( MDesC8Array* aAttributeLines,
+                          KSVPHoldAttributeIndex aNeededAttribute,
+                          TSVPHoldStateIndex& aNextState,
+                          CSVPHoldContext& aContext );
+                          
+    /**
+    * Checks acceptability of direction attribute from response.
+    */
+    TInt DefineDefaultCaseStateChange( CSVPHoldContext& aContext,
+                                       TSVPHoldStateIndex& aNextState );
+                                       
+    /**
+    * Checks acceptability of response in case of sendrecv -response
+    */
+    TInt ResolveStateFromSendRecvIndex(
+                KSVPHoldAttributeIndex aNeededAttribute,
+                TSVPHoldStateIndex& aNextState );
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif      // SVPHOLDOUTESTABLISHINGSTATE_H  
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholdoutstate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* 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:  Locally holded state for hold state machine.
+*
+*/
+
+
+#ifndef SVPHOLDOUTSTATE_H
+#define SVPHOLDOUTSTATE_H
+
+#include "svpholdstatebase.h"
+#include "svpholdcontext.h"
+#include "svputdefs.h"
+
+/**
+*  Hold state for MO holded call.
+*  @lib svp.dll
+*  @since Series 60 3.2
+*/
+class CSVPHoldOutState : public CSVPHoldStateBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPHoldOutState* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPHoldOutState();
+
+protected:  // Functions from base classes
+    
+    /**
+    * From CSVPHoldStateBase Apply concrete state.
+    */
+    void DoApplyL( CSVPHoldContext& aContext );
+
+    /**
+    * From CSVPHoldStateBase Called when the state is entered.
+    */
+    void DoEnter( CSVPHoldContext& aContext );
+
+    /**
+    * Checks if OutEstablishingState is active.
+    */
+    TBool IsOutEstablishingStateActive();
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPHoldOutState();
+    
+    /*
+    * Performs hold/resume request
+    */
+    TSVPHoldStateIndex PerformRequestL( CSVPHoldContext& aContext,
+                                        CMceMediaStream& aMediaStream,
+                                        CMceSession& aSession );   
+    /*
+    * Resumes session locally
+    */
+    void ResumeSessionLocallyL( CSVPHoldContext& aContext,
+                                CMceMediaStream& aMediaStream,
+                                CMceSession& aSession );
+    /*
+    * Handles remote doublehold requests
+    */
+    void RemoteSessionDoubleHoldL( CSVPHoldContext& aContext,
+                                   CMceMediaStream& aMediaStream,
+                                   CMceSession& aSession );
+
+private:
+    
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif      // SVPHOLDOUTSTATE_H  
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/inc/svpholdstatebase.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,93 @@
+/*
+* 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 state.
+*
+*/
+
+
+#ifndef SVPHOLDSTATEBASE_H
+#define SVPHOLDSTATEBASE_H
+
+#include <e32base.h>
+
+class CSVPHoldContext;
+
+/**
+*  Base class for state.
+*  
+*  @lib svp.dll
+*  @since Series 60 3.2
+*/
+class CSVPHoldStateBase : public CBase
+    {
+public:  // Constructors and destructor
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPHoldStateBase();
+
+public: // New functions
+    
+    /**
+    * Applies the current state. Called after the state transition.
+    * Leaves on error.
+    * @since Series 60 3.2
+    * @param aContext The Context of hold
+    */
+    void ApplyL( CSVPHoldContext& aContext );
+
+    /**
+    * Called when the state is entered, before it is applied.
+    * @since Series 60 3.2
+    * @param aSession The MCE session
+    */
+    void Enter( CSVPHoldContext& aSession );
+
+    /**
+    * Checks if OutEstablishingState is active.
+    * @since Series 60 3.2
+    * @return ETrue if establishing state active, EFalse otherways
+    */
+    virtual TBool IsOutEstablishingStateActive();
+
+   
+protected:  // New functions
+    
+    /**
+    * Applies the current concrete state. Leaves on error.
+    * @since Series 60 3.2
+    * @param aContext SVP Hold context
+    * @return None
+    */
+    virtual void DoApplyL( CSVPHoldContext& aContex ) = 0;
+
+    /**
+    * Called when the state is entered. Implemented by
+    * concrete states.
+    * @since Series 60 3.2
+    * @param aContext SVP Hold context
+    * @return None
+    */
+    virtual void DoEnter( CSVPHoldContext& aContex ) = 0;
+    
+    /**
+    * C++ default constructor.
+    */
+    CSVPHoldStateBase();
+        
+    };
+
+#endif      // SVPHOLDSTATEBASE_H 
+            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/src/svpholdattributehandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,127 @@
+/*
+* 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:  Handles SDP direction attribute related issues.
+*
+*/
+
+
+#include    <badesca.h>
+#include    "svpholdattributehandler.h"
+#include    "svpholdcontext.h"
+#include    "svplogger.h"
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldAttributeHandler::CSVPHoldAttributeHandler
+// ---------------------------------------------------------------------------
+//
+CSVPHoldAttributeHandler::CSVPHoldAttributeHandler() :
+    iAttributeArray( NULL )
+    {
+    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldAttributeHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldAttributeHandler::ConstructL()
+    {
+    // Create attribute array
+    iAttributeArray =
+        new ( ELeave ) CDesC8ArrayFlat( KSVPHoldDirectionAttributeCount );
+        
+    iAttributeArray->InsertL( KSVPHoldSendrecvIndex,
+                              KSVPHoldAttributeSendrecv );
+    iAttributeArray->InsertL( KSVPHoldSendonlyIndex,
+                              KSVPHoldAttributeSendonly );
+    iAttributeArray->InsertL( KSVPHoldRecvonlyIndex,
+                              KSVPHoldAttributeRecvonly );
+    iAttributeArray->InsertL( KSVPHoldInactiveIndex,
+                              KSVPHoldAttributeInactive );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldAttributeHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPHoldAttributeHandler* CSVPHoldAttributeHandler::NewL()
+    {
+    CSVPHoldAttributeHandler* self = new ( ELeave ) CSVPHoldAttributeHandler;
+    CleanupStack::PushL( self );
+    
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldAttributeHandler::~CSVPHoldAttributeHandler
+// ---------------------------------------------------------------------------
+//
+CSVPHoldAttributeHandler::~CSVPHoldAttributeHandler()
+    {
+    if ( iAttributeArray )
+        {
+        iAttributeArray->Reset();
+        }
+        
+    delete iAttributeArray;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldAttributeHandler::FindDirectionAttribute
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldAttributeHandler::FindDirectionAttribute(
+    MDesC8Array* aAttributeLines )
+    {
+    if ( !aAttributeLines )
+        {
+        SVPDEBUG1( "CSVPHoldAttributeHandler::FindDirectionAttribute - NULL" )
+        
+        return KErrNotFound;
+        }
+        
+    SVPDEBUG2( "CSVPHoldAttributeHandler::FindDirectionAttribute - Attribute count is %i",
+        aAttributeLines->MdcaCount() )
+    
+    for ( TInt j = 0; j < aAttributeLines->MdcaCount(); j++ )
+        {
+        SVPDEBUG1( "CSVPHoldAttributeHandler::FindDirectionAttribute - Searching" )
+        
+        const TPtrC8 attr = aAttributeLines->MdcaPoint( j );
+        TInt pos = 0;
+        TInt res = iAttributeArray->Find(
+            attr.Left( KSVPMaxDirectionAttributeLength ), pos );
+        
+        SVPDEBUG2( "CSVPHoldAttributeHandler::FindDirectionAttribute res: %d",
+            res )
+        SVPDEBUG2( "CSVPHoldAttributeHandler::FindDirectionAttribute pos: %d",
+            pos )
+                
+        if( 0 == res )
+            {
+            // Found right direction attribute
+            return pos;
+            }
+        }
+    
+    SVPDEBUG1( "CSVPHoldAttributeHandler::FindDirectionAttribute - Not found" )
+    
+    return KErrNotFound;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/src/svpholdconnectedstate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,275 @@
+/*
+* 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:  Connected state class for hold state machine.
+*
+*/
+
+
+#include    <badesca.h>
+#include    <mcesession.h>
+#include    <mcemediastream.h>
+#include    <mcertpsource.h>
+#include    <mcertpsink.h>
+#include    <mceaudiostream.h>
+#include    <mcemediasource.h>
+#include    <mcemediasink.h>
+
+#include    "svpholdconnectedstate.h"
+#include    "svpholdcontroller.h"
+#include    "svpholdattributehandler.h"
+#include    "svpholdobserver.h"
+#include    "svpholdmediahandler.h"
+#include    "svplogger.h"
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldConnectedState::CSVPHoldConnectedState
+// ---------------------------------------------------------------------------
+CSVPHoldConnectedState::CSVPHoldConnectedState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldConnectedState::NewLC
+// ---------------------------------------------------------------------------
+CSVPHoldConnectedState* CSVPHoldConnectedState::NewLC()
+    {
+    CSVPHoldConnectedState* self = new ( ELeave ) CSVPHoldConnectedState;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldConnectedState::~CSVPHoldConnectedState
+// ---------------------------------------------------------------------------
+CSVPHoldConnectedState::~CSVPHoldConnectedState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldConnectedState::DoApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldConnectedState::DoApplyL( CSVPHoldContext& aContext )
+    {
+    SVPDEBUG1( "CSVPHoldConnectedState::DoApply" );
+    
+    CMceSession* session = aContext.SessionObject();
+    CMceSession::TState sessionState = session->State();
+    SVPDEBUG2( "CSVPHoldConnectedState::DoApply - MCE Session state is = %i",
+                sessionState );
+
+    const RPointerArray< CMceMediaStream >& streams = session->Streams();
+    TSVPHoldStateIndex nextState = KSVPHoldEstablishingStateIndex;
+    
+    TInt audioStreamsHandled = 0;
+    TInt streamCount = streams.Count();
+    SVPDEBUG2( "CSVPHoldConnectedState::DoApply - stream count = %i",
+                streamCount ); 
+    
+    for ( TInt i = 0; i < streamCount; i++ )
+        {
+        CMceMediaStream* mediaStream = streams[ i ];
+        TMceMediaType mediaType = mediaStream->Type();
+        if ( KMceAudio == mediaType )
+            {
+            // This media is audio stream. Handling depends on the request
+            SVPDEBUG2( "CSVPHoldConnectedState::DoApply - Hold request is = %i",
+                        aContext.HoldRequest() );
+
+            nextState = PerformRequestL( aContext, *mediaStream, *session );            
+            audioStreamsHandled++;
+            }
+        }
+    
+    if ( 0 == audioStreamsHandled )
+        {
+        SVPDEBUG1( "CSVPHoldConnectedState::DoApply - No streams - Leave" );
+        User::Leave( KErrSVPHoldStateError );
+        }    
+
+    aContext.SetCurrentStateL( aContext, nextState );
+    SVPDEBUG1( "CSVPHoldConnectedState::DoApply - Handled" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldConnectedState::PerformRequestL
+// ---------------------------------------------------------------------------
+//
+TSVPHoldStateIndex 
+CSVPHoldConnectedState::PerformRequestL( CSVPHoldContext& aContext,
+                                         CMceMediaStream& aMediaStream,
+                                         CMceSession& aSession )
+    {
+    TSVPHoldStateIndex nextState = KSVPHoldEstablishingStateIndex;
+    switch ( aContext.HoldRequest() )
+        {
+        case ESVPLocalHold:
+            {
+            HoldSessionLocallyL( aContext, aMediaStream, aSession );
+            break;
+            }
+
+        case ESVPRemoteHold:
+            {
+            RemoteSessionHoldL( aContext, aMediaStream, aSession );
+            break;
+            }                    
+            
+        case ESVPLocalResume:
+        case ESVPLocalDoubleHold:
+        case ESVPLocalDoubleHoldResume:
+        case ESVPRemoteResume:
+        case ESVPRemoteDoubleHold:
+        case ESVPRemoteDoubleHoldResume:
+            {
+            // Cannot occur in connected state
+            SVPDEBUG1( "CSVPHoldConnectedState::PerformRequestL - StateError" );
+            User::Leave( KErrSVPHoldStateError );                    
+            }
+
+        default:
+            {
+            // Error in request solving, no state change needed:
+            nextState = KSVPHoldConnectedStateIndex;
+            
+            SVPDEBUG2( "CSVPHoldConnectedState::PerformRequestL - Error, request %i", 
+                        aContext.HoldRequest() );
+            break;
+            }
+        }
+        
+    return nextState;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldConnectedState::HoldSessionLocallyL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldConnectedState::
+HoldSessionLocallyL( CSVPHoldContext& aContext,
+                     CMceMediaStream& aMediaStream,
+                     CMceSession& aSession )
+    {
+    SVPDEBUG1( "CSVPHoldConnectedState::HoldSessionLocallyL - IN" );
+    
+    // Handle media stream:
+    aContext.MediaHandler().
+        PerformMediaActionL( aMediaStream,
+                             ESVPLocalHold );
+        
+    // Disable all sources and sinks:
+    aContext.MediaHandler().DisableAudioL( aContext );
+                            
+    aSession.UpdateL();
+    SVPDEBUG1( "CSVPHoldConnectedState::HoldSessionLocallyL done" );    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldConnectedState::RemoteSessionHoldL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldConnectedState::
+RemoteSessionHoldL( CSVPHoldContext& aContext,
+                      CMceMediaStream& aMediaStream,
+                      CMceSession& aSession )
+    {
+    SVPDEBUG1( "CSVPHoldConnectedState::RemoteSessionHoldL - In" );
+    
+    MDesC8Array* sessionAttributeLines = aSession.SessionSDPLinesL();
+    CleanupDeletePushL( sessionAttributeLines );
+    TSVPHoldRequestType attribute =
+                      aContext.SolveRequestL( aSession,
+                                              sessionAttributeLines ); 
+    
+    CleanupStack::PopAndDestroy( sessionAttributeLines );
+    
+    MDesC8Array* attributeLines = aMediaStream.MediaAttributeLinesL();
+    CleanupDeletePushL( attributeLines );
+
+    // Check that request has reasonable direction attribute:
+    if ( ESVPNoType == attribute )
+        {
+        attribute = aContext.SolveRequestL( aSession,
+                                            attributeLines,
+                                            ETrue);        
+        }
+        
+    if ( ESVPNoType == attribute )
+        {
+        // Not hold request
+        SVPDEBUG1( "CSVPHoldConnectedState::RemoteSessionHoldL:");
+        SVPDEBUG1( "Not hold request" );
+        User::Leave( KErrSVPHoldNotHoldRequest );
+        }
+    
+    CleanupStack::PopAndDestroy( attributeLines );
+    
+    // Handle media stream:
+    aContext.MediaHandler().
+        PerformMediaActionL( aMediaStream,
+                             ESVPRemoteHold );
+    
+    // Update session
+    aSession.UpdateL();
+    
+    SVPDEBUG1( "CSVPHoldConnectedState::RemoteSessionHoldL - done" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldConnectedState::DoEnter
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldConnectedState::DoEnter( CSVPHoldContext& aContext )
+    {
+    SVPDEBUG1( "CSVPHoldConnectedState::DoEnter" );
+
+    TInt err = KErrNone;
+    TRAP( err, aContext.MediaHandler().EnableAudioL( aContext ) );
+
+    // succesfull action is informed to client
+    switch ( aContext.HoldRequest() )
+        {
+        case ESVPRemoteResume:
+            {
+            SVPDEBUG1( "CSVPHoldConnectedState::DoEnter - RemoteResume" );
+            aContext.HoldObserver().SessionRemoteResumed();
+            break;
+            }
+            
+        case ESVPLocalResume:
+            {
+            SVPDEBUG1( "CSVPHoldConnectedState::DoEnter - LocalResume" );
+            aContext.HoldObserver().SessionLocallyResumed();
+            break;
+            }
+            
+        default:
+            {
+            // Nothing to do; occurs only with state rollback
+            SVPDEBUG1( "CSVPHoldConnectedState::DoEnter - Default" );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldConnectedState::IsOutEstablishingStateActive
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldConnectedState::IsOutEstablishingStateActive()
+    {
+    return EFalse;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/src/svpholdcontext.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1213 @@
+/*
+* 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:  Base class for session context
+*
+*/
+
+
+#include    <s32mem.h>
+#include    <in_sock.h>
+#include    <in_pkt.h>
+#include    <badesca.h>
+#include    <mcesession.h>
+#include    <mcemanager.h>
+#include    <mcetransactiondatacontainer.h>
+#include    <mcertpsource.h>
+#include    <mcertpsink.h>
+#include    <mcemediastream.h>
+#include    <mceaudiostream.h>
+
+#include    <sdpcodecstringpool.h>
+#include    <sdpcodecstringconstants.h>
+#include    <sdpdocument.h>
+#include    <sdpconnectionfield.h>
+#include    "svpholdcontext.h"
+#include    "svpholdoutstate.h"
+#include    "svpholdinestablishingstate.h"
+#include    "svpholdoutestablishingstate.h"
+#include    "svpholdinstate.h"
+#include    "svpholdconnectedstate.h"
+#include    "svpholddhstate.h"
+#include    "svpholdcontroller.h"
+#include    "svpholdmediahandler.h"
+#include    "svpholdattributehandler.h"
+#include    "svpholdobserver.h"
+#include    "svplogger.h"
+#include    "svpaudioutility.h"
+#include    "svpsipconsts.h"
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::CSVPHoldContext
+// ---------------------------------------------------------------------------
+//
+CSVPHoldContext::CSVPHoldContext( TMceTransactionDataContainer& aContainer,
+                                  TBool aIsMobileOriginated ) :
+        iStates( NULL ),
+        iObserver( NULL ),
+        iCurrentState( NULL ),
+        iHoldRequest( ESVPNoType ),
+        iSession( NULL ),
+        iOutgoing( ETrue ),
+        iAttributeHandler( NULL ),
+        iMediaHandler( NULL ),
+        iFirstAttempt( ETrue ),
+        iRemoteRequestNotProcessed( ETrue ),
+        iContainer( aContainer ),
+        iAllowAudioHandling( EFalse ),
+        iResponseStatusCode( KErrNotFound ),
+        iForceHoldOccured( EFalse ),
+        iTimedOut( EFalse ),
+        iRollBack( EFalse ),
+        iHoldFail( EFalse ),
+        iResumeFail( EFalse ),
+        iMuted( EFalse ),
+        iCrossOver( EFalse ),
+        iCallRequest( EFalse )
+    {
+    iIsMobileOriginated = aIsMobileOriginated;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::ConstructL( CMceSession& aSession,
+                                  MSVPHoldObserver* aObserver )
+    {
+    SVPDEBUG1( "CSVPHoldContext::ConstructL In" );
+
+    iObserver = aObserver;
+    // Create the states in the state array.
+    InitializeStateArrayL();
+    iAttributeHandler = CSVPHoldAttributeHandler::NewL();
+    iMediaHandler = CSVPHoldMediaHandler::NewL();
+    
+    SetSessionObject( &aSession );
+    
+    // Initialize connected state to current state. Note, that it is not
+    // applied yet.
+    SetCurrentStateL( *this, KSVPHoldConnectedStateIndex );
+    SetAudioHandlingAllowed( ETrue );
+        
+    SVPDEBUG1( "CSVPHoldContext::ConstructL Done" );
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPHoldContext::NewL
+// -----------------------------------------------------------------------------
+//
+CSVPHoldContext* CSVPHoldContext::NewL( 
+                            CMceSession& aSession,
+                            TMceTransactionDataContainer& aContainer,
+                            MSVPHoldObserver* aObserver,
+                            TBool aIsMobileOriginated )
+    {    
+    CSVPHoldContext* self = new ( ELeave ) CSVPHoldContext( aContainer,
+                                                            aIsMobileOriginated );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aSession, aObserver );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::IsStateTransitionAccepted
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::
+IsStateTransitionAccepted( const TSVPHoldStateIndex aStateIndex )
+    {
+    TSVPHoldStateIndex current = CurrentState();
+    switch( current )
+        {
+        case KErrNotFound:
+            {
+            // Only connected state can be the first one.
+            if ( KSVPHoldConnectedStateIndex == aStateIndex )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+
+        case KSVPHoldConnectedStateIndex:
+        case KSVPHoldInStateIndex:
+        case KSVPHoldDHStateIndex:
+            { 
+            // From main states transitions to in or out establishing
+            // states are accepted.
+            if ( KSVPHoldEstablishingStateIndex  == aStateIndex )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+        
+        case KSVPHoldOutStateIndex:
+            {
+            // From hold out state transitions to in and out establishing
+            // and connected states are accepted.
+            if ( KSVPHoldEstablishingStateIndex  == aStateIndex ||
+                 KSVPHoldConnectedStateIndex  == aStateIndex )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+        
+        case KSVPHoldEstablishingStateIndex:
+            {
+            // From establishing states transitions to main states
+            // are accepted.
+            if ( KSVPHoldEstablishingStateIndex == aStateIndex ||
+                 KSVPHoldConnectedStateIndex  == aStateIndex ||
+                 KSVPHoldOutStateIndex == aStateIndex ||
+                 KSVPHoldInStateIndex == aStateIndex ||
+                 KSVPHoldDHStateIndex == aStateIndex )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+            
+        default:
+            {
+            // Should not come here, since all the states are handled
+            SVPDEBUG1( "CSVPHoldContext::IsStateTransitionAccepted - Error" );
+            
+            return EFalse;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::~CSVPHoldContext
+// ---------------------------------------------------------------------------   
+//
+CSVPHoldContext::~CSVPHoldContext()
+    {
+    SVPDEBUG1( "CSVPHoldContext::~CSVPHoldContext - In" );
+    if ( iStates )
+        {
+        iStates->ResetAndDestroy();
+        iStates->Close();
+        delete iStates;
+        }
+
+    delete iAttributeHandler;
+    delete iMediaHandler;
+    
+    SVPDEBUG1( "CSVPHoldContext::~CSVPHoldContext - Done" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::InitializeStateArrayL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::InitializeStateArrayL()
+    {
+    // Create state array
+    iStates = new ( ELeave ) RPointerArray< CSVPHoldStateBase >
+                                                ( KSVPHoldStateArraySize );
+    // States are created here:
+
+    // Connected state
+    CSVPHoldConnectedState* connectedState =
+                    CSVPHoldConnectedState::NewLC();
+    User::LeaveIfError( iStates->Insert( connectedState,
+                                         KSVPHoldConnectedStateIndex ) );
+    CleanupStack::Pop( connectedState );
+
+    // Establishing state initialized to outgoing (MO hold)
+    CSVPHoldOutEstablishingState* outEstState =
+                    CSVPHoldOutEstablishingState::NewLC();
+    User::LeaveIfError( iStates->Insert( outEstState,
+                                         KSVPHoldEstablishingStateIndex ) );
+    CleanupStack::Pop( outEstState );
+
+    // Outgoing state (MO hold)
+    CSVPHoldOutState* outState =
+                    CSVPHoldOutState::NewLC();
+    User::LeaveIfError( iStates->Insert( outState,
+                                         KSVPHoldOutStateIndex ) );
+    CleanupStack::Pop( outState );
+        
+    // Incoming state (MT hold)
+    CSVPHoldInState* inState =
+                    CSVPHoldInState::NewLC();
+    User::LeaveIfError( iStates->Insert( inState,
+                                         KSVPHoldInStateIndex ) );
+    CleanupStack::Pop( inState );
+    
+    // Doublehold state (MO & MT simultaneous hold)
+    CSVPHoldDHState* dhState =
+                    CSVPHoldDHState::NewLC();
+    User::LeaveIfError( iStates->Insert( dhState,
+                                         KSVPHoldDHStateIndex ) );
+    CleanupStack::Pop( dhState );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SetCurrentStateL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::SetCurrentStateL( CSVPHoldContext& aContext,
+                                        TSVPHoldStateIndex aStateIndex )
+    {
+    // Check that the transition is valid:
+    if ( !IsStateTransitionAccepted( aStateIndex ) )
+        {
+        SVPDEBUG2( "CSVPHoldContext::SetCurrentStateL - State error, New: %i",
+                    aStateIndex );
+
+        User::Leave( KErrSVPHoldStateError );
+        }        
+    else
+        {
+        SVPDEBUG2( "CSVPHoldContext::SetCurrentStateL - Set state from %i",
+                    CurrentState() );
+         
+        SVPDEBUG2( "CSVPHoldContext::SetCurrentStateL - Set state to %i",
+                    aStateIndex );
+
+        iCurrentState = ( *iStates )[ aStateIndex ];
+        iCurrentState->Enter( aContext );
+        iAllowAudioHandling = ETrue;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::CurrentState
+// ---------------------------------------------------------------------------
+//
+TSVPHoldStateIndex CSVPHoldContext::CurrentState() const
+   {
+   return iStates->Find( iCurrentState );
+   }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::ApplyCurrentStateL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::ApplyCurrentStateL( CMceSession* aSession,
+                    TSVPHoldDesiredTransition aTransition )
+    {
+    SVPDEBUG1( "CSVPHoldContext::ApplyCurrentStateL IN" )
+    
+    // Set back to false, because new hold/resume attemp starts
+    iRollBack = EFalse;
+    
+    SetSessionObject( aSession );
+    if ( ToEstablishing() && FirstAttempt() )
+        {
+        SVPDEBUG1( "CSVPHoldContext::ApplyCurrentStateL - New request" )
+        
+        iHoldRequest = RequestType( aTransition );
+        UpdateEstablishingStateL();
+        }
+
+    if ( ESVPHoldIncoming == aTransition )
+        {
+        SVPDEBUG1( "CSVPHoldContext::ApplyCurrentStateL - Remote request" )
+        
+        iHoldRequest = RequestType( aTransition );        
+        SetRemoteRequestNotProcessed( ETrue );
+        iCurrentState->ApplyL( *this );
+        }
+    
+    else
+        {
+        SVPDEBUG1( "CSVPHoldContext::ApplyCurrentStateL - Local request" )
+        
+        iHoldRequest = RequestType( aTransition );
+        if ( ESVPLocalResume == iHoldRequest )
+            {
+            SVPDEBUG1( "CSVPHoldContext::ApplyCurrentStateL - Enable oldway hold" );
+            
+            // establish Old way hold support 
+            aSession->SetModifierL( KMceMediaDirection, 
+                                    KMceMediaDirectionWithAddress );
+            }
+            
+        iCurrentState->ApplyL( *this );
+        }
+        
+    SVPDEBUG1( "CSVPHoldContext::ApplyCurrentStateL OUT" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::ApplyCurrentStateL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::ApplyCurrentStateL()
+    {
+    if ( KSVPHoldEstablishingStateIndex == CurrentState() )
+        {
+        SVPDEBUG1( "CSVPHoldContext::ApplyCurrentStateL2" );
+        iCurrentState->ApplyL( *this );
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPHoldContext::ApplyCurrentStateL2 - State error" );
+        User::Leave( KErrSVPHoldStateError );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SetSessionObject
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::SetSessionObject( CMceSession* aSession )
+    {
+    iSession = aSession;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SessionObject
+// ---------------------------------------------------------------------------
+//
+CMceSession* CSVPHoldContext::SessionObject()
+    {
+    return iSession;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::HoldRequest
+// ---------------------------------------------------------------------------
+//
+TSVPHoldRequestType CSVPHoldContext::HoldRequest()
+    {
+    return iHoldRequest;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::IsRemoteRequest
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::IsRemoteRequest()
+    {
+    TSVPHoldRequestType request = HoldRequest();
+    if ( ESVPRemoteHold == request || ESVPRemoteResume == request ||
+         ESVPRemoteDoubleHold == request ||
+         ESVPRemoteDoubleHoldResume == request )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::HoldEvent
+// ---------------------------------------------------------------------------
+//
+MCCPCallObserver::TCCPCallEvent CSVPHoldContext::HoldEvent()
+    {
+    return iHoldEvent;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SetFirstAttempt
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::SetFirstAttempt( TBool aValue )
+    {
+    iFirstAttempt = aValue;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::FirstAttempt
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::FirstAttempt()
+    {
+    return iFirstAttempt;
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SetRemoteRequestNotProcessed
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::SetRemoteRequestNotProcessed( TBool aValue )
+    {
+    iRemoteRequestNotProcessed = aValue;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::RemoteRequestNotProcessed
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::RemoteRequestNotProcessed()
+    {
+    return iRemoteRequestNotProcessed;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SetAudioHandlingAllowed
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::SetAudioHandlingAllowed( TBool aValue )
+    {
+    iAllowAudioHandling = aValue;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::AudioHandlingAllowed
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::AudioHandlingAllowed()
+    {
+    return iAllowAudioHandling;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::CheckOldwayHoldL
+// ---------------------------------------------------------------------------
+//
+TSVPHoldRequestType CSVPHoldContext::
+CheckOldwayHoldL( CMceSession& aSession,
+                  TSVPHoldRequestType aPresumedRequest )
+    {
+    SVPDEBUG1( "CSVPHoldContext::CheckOldwayHoldL" );
+    
+    TBool oldWayHold = EFalse;    
+    const RPointerArray< CMceMediaStream >& mediaStreams = aSession.Streams();
+        
+    for ( TInt i = 0; i < mediaStreams.Count(); i++ )
+        {
+        CMceAudioStream* stream = 
+            static_cast< CMceAudioStream* >( mediaStreams[ i ] );
+        
+        if ( !SVPAudioUtility::IsDownlinkStream( *stream ) )
+            {
+            if ( !stream->IsEnabled() )
+                {
+                oldWayHold = ETrue;
+                }
+            }
+
+        else if ( stream->BoundStream() )
+            {
+            CMceMediaStream& boundStream = stream->BoundStreamL();
+            if ( !boundStream.IsEnabled() )
+                {
+                oldWayHold = ETrue;
+                }
+            }
+        }
+    
+    if ( !oldWayHold )
+        {
+        // Oldway hold not in offer
+        SVPDEBUG1( "CSVPHoldContext::CheckOldwayHoldL - Direction only" );
+        return ESVPNoType;
+        }
+        
+    else
+        {
+        // Oldway hold used in offer
+        SVPDEBUG1( "CSVPHoldContext::CheckOldwayHoldL - Oldway hold ON" );
+        TUint modValue = KMceMediaDirectionWithAddress;
+        TMceSessionModifier modifier = KMceMediaDirection;
+        aSession.SetModifierL( modifier, modValue );
+        return aPresumedRequest;
+        }
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::HoldObserver
+// ---------------------------------------------------------------------------
+//
+MSVPHoldObserver& CSVPHoldContext::HoldObserver()
+    {
+    return *iObserver;
+    }
+        
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::AttributeHandler
+// ---------------------------------------------------------------------------
+//
+CSVPHoldAttributeHandler& CSVPHoldContext::AttributeHandler()
+    {
+    return *iAttributeHandler;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::MediaHandler
+// ---------------------------------------------------------------------------
+//
+CSVPHoldMediaHandler& CSVPHoldContext::MediaHandler()
+    {
+    return *iMediaHandler;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SolveRequestL
+// ---------------------------------------------------------------------------
+//
+TSVPHoldRequestType 
+CSVPHoldContext::SolveRequestL( CMceSession& aSession,
+                                MDesC8Array* aAttributeLines,
+                                TBool aCheckOldwayHold )
+    { 
+    SVPDEBUG1( "CSVPHoldContext::SolveRequestL IN" )
+    
+    TSVPHoldRequestType presumedRequest = HoldRequest();
+    TInt attributeIndex =
+        iAttributeHandler->FindDirectionAttribute( aAttributeLines );
+
+    SVPDEBUG2( "CSVPHoldContext::SolveRequestL - attributeIndex = %i",
+        attributeIndex )
+    SVPDEBUG2( "CSVPHoldContext::SolveRequestL - presumedRequest = %i",
+        presumedRequest )
+    
+    // Match Current state, attributeIndex and presumedRequest
+    TSVPHoldRequestType realizedRequest = 
+        SolveRequestType( attributeIndex, presumedRequest );
+    
+    SVPDEBUG2( "CSVPHoldContext::SolveRequestL - realizedRequest = %i",
+        realizedRequest )
+    
+    if ( ESVPNoType == realizedRequest && aCheckOldwayHold )
+        {
+        SVPDEBUG1( "CSVPHoldContext::SolveRequestL - Check oldway hold" )
+        
+        realizedRequest = CheckOldwayHoldL( aSession, presumedRequest );
+                                            
+        SVPDEBUG2( "CSVPHoldContext::SolveRequestL - if:realizedRequest = %i",
+            realizedRequest )
+        }
+                
+    return realizedRequest;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SolveRequestTypeL
+// Solves type of incoming request and returns accepted request type
+// ---------------------------------------------------------------------------
+//
+TSVPHoldRequestType 
+CSVPHoldContext::SolveRequestType( TInt aAttributeIndex,
+                                   TSVPHoldRequestType aPresumedRequest )
+    {
+    SVPDEBUG1( "CSVPHoldContext::SolveRequestType - Type is" );
+    
+    switch ( aPresumedRequest )
+        {
+        case ESVPRemoteHold:
+            {
+            // From connected state, MT hold requests:
+            SVPDEBUG1( "    ESVPRemoteHold" );
+            if ( KSVPHoldSendonlyIndex == aAttributeIndex ||
+                 KSVPHoldInactiveIndex == aAttributeIndex )
+                {
+                // Incoming hold
+                return ESVPRemoteHold; 
+                }
+
+            else
+                {
+                SVPDEBUG1( "    ESVPNoType" );
+                return ESVPNoType;
+                }
+            }
+        
+        case ESVPRemoteResume:
+            {            
+            SVPDEBUG1( "    ESVPRemoteResume" );
+            if ( KSVPHoldSendrecvIndex == aAttributeIndex ||
+                 KErrNotFound == aAttributeIndex )
+                {
+                // Incoming resume
+                return ESVPRemoteResume; 
+                }
+                                
+            else
+                {
+                SVPDEBUG1( "    ESVPNoType" );
+                return ESVPNoType;
+                }                
+            }
+        
+        case ESVPRemoteDoubleHold:
+            {
+            SVPDEBUG1( "    ESVPRemoteDoubleHold" );
+            if ( KSVPHoldInactiveIndex == aAttributeIndex )
+                {
+                // Incoming doublehold
+                return ESVPRemoteDoubleHold;
+                }
+
+            else
+                {
+                SVPDEBUG1( "    ESVPNoType" );
+                return ESVPNoType;
+                }
+            }
+        
+        case ESVPRemoteDoubleHoldResume:
+            {
+            SVPDEBUG1( "    ESVPRemoteDHResume" );
+            if ( KSVPHoldRecvonlyIndex == aAttributeIndex ||
+                 KSVPHoldSendrecvIndex == aAttributeIndex )
+                {
+                // Incoming doublehold resume
+                return ESVPRemoteDoubleHoldResume;
+                }
+
+            else
+                {
+                SVPDEBUG1( "    ESVPNoType" );
+                return ESVPNoType;
+                }
+            }
+        
+        
+        // -fallthtrough
+        case ESVPLocalHold:
+        case ESVPLocalResume:
+        case ESVPLocalDoubleHold:
+        case ESVPLocalDoubleHoldResume:
+        default:
+            {
+            // Local actions not handled here:
+            SVPDEBUG1( "CSVPHoldContext::SolveRequestType - Default" );            
+            return ESVPNoType;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::ToEstablishing
+// Solves if the next state should be establishing state
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::ToEstablishing()
+    {
+    if ( KSVPHoldEstablishingStateIndex != CurrentState() )
+        {
+        SVPDEBUG1( "CSVPHoldContext::ToEstablishing TRUE" )
+        
+        return ETrue;
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPHoldContext::ToEstablishing FALSE" )
+        
+        return EFalse;
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::RequestType
+// Solves request type based on current state and external request and
+// direction of request
+// ---------------------------------------------------------------------------
+//
+TSVPHoldRequestType 
+CSVPHoldContext::RequestType( TSVPHoldDesiredTransition aTransition )
+    {
+    // switch-case structure has no breaks because every case has return.
+    switch ( aTransition )
+        {
+        case ESVPHoldToHold:
+            {
+            return RequestToHold();
+            }
+        
+        case ESVPHoldToResume:
+            {
+            return RequestToResume();
+            }
+        
+        case ESVPHoldIncoming:
+            {
+            return RequestIncoming();
+            }
+            
+        default:
+            {
+            SVPDEBUG1( "CSVPHoldContext::RequestType - no transition!" );
+
+            return ESVPNoType;
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::RequestToHold
+// Solves request type for local hold
+// ---------------------------------------------------------------------------
+//
+TSVPHoldRequestType CSVPHoldContext::RequestToHold()
+    {
+    SVPDEBUG1( "CSVPHoldContext::RequestToHold" );
+        
+    TSVPHoldStateIndex current = CurrentState();
+    iOutgoing = ETrue;
+    iHoldEvent = MCCPCallObserver::ECCPLocalHold;
+
+    if ( KSVPHoldConnectedStateIndex == current )
+        {
+        return ESVPLocalHold;
+        }
+
+    else if ( KSVPHoldInStateIndex == current )
+        {
+        return ESVPLocalDoubleHold;
+        }
+
+    else
+        {
+        SVPDEBUG2( "CSVPHoldContext::RequestToHold - error(ToHold), %i",
+                    current );
+
+        return ESVPNoType;
+        }    
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::RequestToResume
+// Solves request type for local resume
+// ---------------------------------------------------------------------------
+//
+TSVPHoldRequestType CSVPHoldContext::RequestToResume()
+    {
+    SVPDEBUG1( "CSVPHoldContext::RequestToResume" );
+    
+    TSVPHoldStateIndex current = CurrentState();
+    iOutgoing = ETrue;
+    iHoldEvent = MCCPCallObserver::ECCPLocalResume;
+    if ( KSVPHoldOutStateIndex == current )
+        {
+        return ESVPLocalResume;
+        }
+        
+    else if ( KSVPHoldDHStateIndex == current )
+        {
+        return ESVPLocalDoubleHoldResume;
+        }
+        
+    else
+        {
+        SVPDEBUG2( "CSVPHoldContext::RequestToResume - error(ToResume), %i",
+                    current );
+
+        return ESVPNoType;
+        }    
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::RequestIncoming
+// Solves request type for incoming request
+// ---------------------------------------------------------------------------
+//
+TSVPHoldRequestType CSVPHoldContext::RequestIncoming()
+    {
+    SVPDEBUG1( "CSVPHoldContext::RequestIncoming: Incoming" )
+
+    // In this case return value stands for the most probable request:
+    const TSVPHoldStateIndex current = CurrentState();
+    SVPDEBUG2( "CSVPHoldContext::RequestIncoming - current = %i",
+                current );    
+    
+    iOutgoing = EFalse;
+    if ( KSVPHoldConnectedStateIndex == current )
+        {
+        iHoldEvent = MCCPCallObserver::ECCPRemoteHold;
+        return ESVPRemoteHold;
+        }
+        
+    else if ( KSVPHoldInStateIndex == current )
+        {
+        iHoldEvent = MCCPCallObserver::ECCPRemoteResume;
+        return ESVPRemoteResume;
+        }
+
+    else if ( KSVPHoldOutStateIndex == current )
+        {
+        iHoldEvent = MCCPCallObserver::ECCPRemoteHold;
+        return ESVPRemoteDoubleHold;
+        }
+
+    else if ( KSVPHoldDHStateIndex == current )
+        {
+        iHoldEvent = MCCPCallObserver::ECCPRemoteResume;
+        return ESVPRemoteDoubleHoldResume;
+        }
+        
+    else
+        {
+        SVPDEBUG2( "CSVPHoldContext::RequestIncoming - error(Incoming), %i",
+                    current );
+
+        return ESVPNoType;
+        }    
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::UpdateEstablishingStateL
+// Updates correct establishing state to state array
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::UpdateEstablishingStateL()
+    {
+    TBool outEstablishingActive =
+            ( *iStates )[ KSVPHoldEstablishingStateIndex ]->
+                                IsOutEstablishingStateActive();
+    
+    if ( iOutgoing && !outEstablishingActive )
+        {
+        // OutEstablishingState is needed to state array
+        delete ( *iStates )[ KSVPHoldEstablishingStateIndex ];
+        iStates->Remove( KSVPHoldEstablishingStateIndex );
+
+        CSVPHoldOutEstablishingState* outEstState =
+                        CSVPHoldOutEstablishingState::NewLC();
+                        
+        User::LeaveIfError( iStates->Insert( outEstState,
+                                             KSVPHoldEstablishingStateIndex ) );
+        CleanupStack::Pop( outEstState );
+
+        SVPDEBUG1( "CSVPHoldContext::UpdateEstablishingStateL - Outgoing" );
+        }
+        
+    else if ( !iOutgoing && outEstablishingActive )
+        {
+        // InEstablishingState is needed to state array
+        delete ( *iStates )[ KSVPHoldEstablishingStateIndex ];
+        iStates->Remove( KSVPHoldEstablishingStateIndex );
+
+        CSVPHoldInEstablishingState* inEstState =
+                        CSVPHoldInEstablishingState::NewLC();
+                        
+        User::LeaveIfError( iStates->Insert( inEstState,
+                                             KSVPHoldEstablishingStateIndex ) );
+        CleanupStack::Pop( inEstState );
+
+        SVPDEBUG1( "CSVPHoldContext::UpdateEstablishingStateL - Incoming" );
+        }
+        
+    else
+        {
+        SVPDEBUG1( "CSVPHoldContext::UpdateEstablishingStateL - No update needed" );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SetResponseStatusCode
+// Sets response status code
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::SetResponseStatusCode( TInt aStatusCode )
+    {
+    iResponseStatusCode = aStatusCode;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::ResponseStatusCode
+// Gets response status code
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldContext::ResponseStatusCode()
+    {
+    return iResponseStatusCode;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SetForceHold
+// Sets force hold flag value
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::SetForceHold( TBool aForceHold )
+    {
+    iForceHoldOccured = aForceHold;
+    }
+ 
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::ForceHoldOccured
+// Gets force hold flag value
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::ForceHoldOccured()
+    {
+    return iForceHoldOccured;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SpecialResponseHandling
+// Sets force hold flag value 
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::
+SpecialResponseHandling( TSVPHoldStateIndex& aNextState )
+    {
+    SVPDEBUG2( "CSVPHoldContext::SpecialResponseHandling - Code is %d ", 
+                ResponseStatusCode() );
+
+    if ( KErrNotFound == ResponseStatusCode() && !iTimedOut )
+        {
+        SVPDEBUG1( "CSVPHoldContext::SpecialResponseHandling - Not needed" );
+        return EFalse;
+        }
+        
+    if ( iTimedOut )
+        {
+        // No response to request received
+        SVPDEBUG1( "CSVPHoldContext::SpecialResponseHandling - Timed Out" );
+
+        RollBack( aNextState );
+        iTimedOut = EFalse;
+        return ETrue;
+        }
+    
+    if ( KSVPOKVal == ResponseStatusCode() && iCallRequest )
+        {
+        SVPDEBUG1( "CSVPHoldContext::SpecialResponseHandling - Forced" );
+        RollBack( aNextState );
+        iTimedOut = EFalse;
+        return ETrue;
+        }
+        
+    else if ( KSVPBadRequestVal <= ResponseStatusCode() )
+        {
+        // Need to roll back to previous state and inform client
+        SVPDEBUG1( "CSVPHoldContext::SpecialResponseHandling - Request failure" );
+        RollBack( aNextState );
+        iTimedOut = EFalse;
+        return ETrue;
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPHoldContext::SpecialResponseHandling - N/A" );
+        }
+        
+    return ETrue;   
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::TimedOut
+// Sets force hold flag value
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::TimedOut()
+    {
+    iTimedOut = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::HoldRolledBack
+// Sets force hold flag value
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::HoldRolledBack()
+    {
+    return iRollBack;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::CrossOver
+// Sets crossover situation on/off
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::CrossOver( TBool aActive )
+    {
+    iCrossOver = aActive;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::ResumeFailed
+// Returns resume failed flag value
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::ResumeFailed()
+    {
+    return iResumeFail;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::HoldFailed
+// Returns hold failed flag value
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::HoldFailed()
+    {
+    if ( iHoldFail )
+        {
+        iHoldFail = EFalse;
+        return ETrue;        
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::IsMobileOriginated
+// Returns IsMobileOriginated -flag value
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::IsMobileOriginated()
+    {
+    return iIsMobileOriginated;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::Muted
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::Muted( TBool aMuted )
+    {
+    iMuted = aMuted;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::Muted
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::Muted()
+    {
+    return iMuted;
+    }    
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::SetCallRequestFailed
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::SetCallRequestFailed( TBool aCallRequest )
+    {
+    iCallRequest = aCallRequest;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::CallRequestFailed
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldContext::CallRequestFailed()
+    {
+    return iCallRequest;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldContext::FallBack
+// Rolls hold session state to its previous state
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldContext::RollBack( TSVPHoldStateIndex& aNextState )
+    {
+    SVPDEBUG1( "CSVPHoldContext::RollBack" );
+    iRollBack = ETrue;
+    switch ( HoldRequest() )
+        {
+        // in local hold request fail, not inform client until MCE session 
+        // state is back to connected state.
+        case ESVPLocalHold:
+            {
+            SVPDEBUG1( "CSVPHoldContext - Local Hold failed" );
+            aNextState = KSVPHoldConnectedStateIndex;
+            iHoldFail = ETrue;
+            if ( !iCrossOver )
+                {
+                HoldObserver().HoldRequestFailed();
+                }
+            break;
+            }
+        
+        case ESVPLocalDoubleHold:
+            {
+            SVPDEBUG1( "CSVPHoldContext - Local DoubleHold failed" );
+            aNextState = KSVPHoldInStateIndex;
+            iHoldFail = ETrue;
+            if ( !iCrossOver )
+                {
+                HoldObserver().HoldRequestFailed();
+                }
+            break;
+            }
+        
+        // Resume request fail can be informed immediately to client because
+        // session will be terminated.
+        case ESVPLocalResume:
+            {
+            SVPDEBUG1( "CSVPHoldContext - Local Resume failed" );
+            iResumeFail = ETrue;
+            aNextState = KSVPHoldOutStateIndex;
+            if ( !iCrossOver )
+                {
+                HoldObserver().ResumeRequestFailed();
+                }
+            break;
+            }
+        
+        case ESVPLocalDoubleHoldResume:
+            {
+            SVPDEBUG1( "CSVPHoldContext - Local DoubleHold Resume failed" );
+            iResumeFail = ETrue;
+            aNextState = KSVPHoldDHStateIndex;
+            if ( !iCrossOver )
+                {
+                HoldObserver().ResumeRequestFailed();
+                }
+            break;
+            }
+        
+        case ESVPRemoteResume:
+            {
+            SVPDEBUG1( "CSVPHoldContext - Remote Resume failed" );
+            aNextState = KSVPHoldInStateIndex;
+            break;
+            }
+            
+        default:
+            {
+            SVPDEBUG1( "CSVPHoldContext - Local DoubleHold Resume failed" );
+            break;
+            }
+        }    
+    }
+
+
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/src/svpholdcontroller.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,664 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Hold controller, interface class to SVP sessions
+*
+*/
+ 
+
+#include    <mcesession.h>
+#include    <mcemediastream.h>
+#include    <mceaudiostream.h>
+
+#include    "svpholdcontroller.h"
+#include    "svpholdmediahandler.h"
+#include    "svpholdobserver.h"
+#include    "svpsessionbase.h"
+#include    "svpsipconsts.h"
+#include    "svpconsts.h"
+#include    "svplogger.h"
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::CSVPHoldController
+// ---------------------------------------------------------------------------
+//
+CSVPHoldController::CSVPHoldController() :
+        iContext( NULL ),
+        iPreviousHoldState( ESVPHoldConnected ),
+        iHoldRequestCompleted( EFalse ),
+        iHoldRequest( ESVPHoldNoRequest ),
+        iReinviteCrossover( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldController::ConstructL( 
+                            CMceSession& aSession,
+                            TMceTransactionDataContainer& aContainer,
+                            MSVPHoldObserver* aObserver,
+                            TBool aIsMobileOriginated )
+    {
+    iContext = CSVPHoldContext::NewL( aSession, aContainer, aObserver,
+                                      aIsMobileOriginated );
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPHoldController::NewL
+// -----------------------------------------------------------------------------
+//
+CSVPHoldController* CSVPHoldController::NewL( 
+                            CMceSession& aSession,
+                            TMceTransactionDataContainer& aContainer,
+                            MSVPHoldObserver* aObserver,
+                            TBool aIsMobileOriginated )
+    {    
+    CSVPHoldController* self = new ( ELeave ) CSVPHoldController();
+    
+    CleanupStack::PushL( self );
+    self->ConstructL( aSession, aContainer, aObserver,
+                      aIsMobileOriginated );
+                      
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPHoldController* CSVPHoldController::NewLC( 
+                            CMceSession& aSession,
+                            TMceTransactionDataContainer& aContainer,
+                            MSVPHoldObserver* aObserver,
+                            TBool aIsMobileOriginated )
+    {
+    CSVPHoldController* self = new ( ELeave ) CSVPHoldController();
+    CleanupStack::PushL( self );
+    self->ConstructL( aSession, aContainer, aObserver,
+                      aIsMobileOriginated );
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::~CSVPHoldController
+// ---------------------------------------------------------------------------
+//
+CSVPHoldController::~CSVPHoldController()
+    {
+    delete iContext;
+    SVPDEBUG1( "CSVPHoldController::~CSVPHoldController Done" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::RetryHoldRequest
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldController::RetryHoldRequest( CMceSession* aSession )
+    {
+    SVPDEBUG1( "CSVPHoldController::RetryHoldRequest -- IN" );
+    TInt err = KErrNone;
+    switch ( iHoldRequest )
+        {
+        case ESVPHoldToHold:
+            {
+            SVPDEBUG1( "CSVPHoldController::RetryHoldRequest -- Hold" );
+            err = HoldSession( aSession );
+            break;
+            }
+            
+        case ESVPHoldToResume:
+            {
+            SVPDEBUG1( "CSVPHoldController::RetryHoldRequest -- Resume" );
+            err = ResumeSession( aSession );
+            break;
+            }
+        
+        default:
+            {
+            SVPDEBUG1( "CSVPHoldController::RetryHoldRequest -- No request!!" );
+            err = KErrNotFound;
+            break;
+            }
+        }
+    
+    iHoldRequest = ESVPHoldNoRequest;
+    SVPDEBUG1( "CSVPHoldController::RetryHoldRequest -- OUT" );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::HoldSession
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldController::HoldSession( CMceSession* aSession )
+    {
+    SVPDEBUG1( "CSVPHoldController::HoldSession -- IN" );
+
+    if ( HoldAllowed() )
+        {
+        iHoldRequest = ESVPHoldToHold;
+        iHoldRequestCompleted = EFalse;
+        SVPDEBUG1( "CSVPHoldController::HoldSession -- Allowed" );
+        TInt err = KErrNone;
+        iContext->SetSessionObject( aSession );
+
+        TRAP( err, iContext->ApplyCurrentStateL( aSession,
+                                                 ESVPHoldToHold ) );
+        
+        SVPDEBUG2(
+        "CSVPHoldController::HoldSession -- ApplyCurrentState done, err = %i",
+         err );
+         
+        switch ( err )
+            {                
+            case KErrSVPHoldLocalOldwayholdNeeded:
+                {
+                SVPDEBUG1(
+                "CSVPHoldController::HoldSession: Oldway hold needed" );
+                
+                iContext->SetFirstAttempt( EFalse ); // Clearing the flag                
+                TRAP( err, iContext->ApplyCurrentStateL( aSession,
+                                                         ESVPHoldToHold ) );
+                return err;
+                }
+                
+            default:
+                {
+                SVPDEBUG2(
+                "CSVPHoldController::HoldSession - default, err: %i", err );
+                return err;
+                }
+            }        
+        }
+        
+    else
+        {
+        return KErrSVPHoldInProgress;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::ResumeSession
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldController::ResumeSession( CMceSession* aSession )
+    {
+    if ( ResumeAllowed() )
+        {
+        iHoldRequest = ESVPHoldToResume;
+        iHoldRequestCompleted = EFalse;
+        TInt err = KErrNone;
+        iContext->SetSessionObject( aSession );
+        TRAP( err, iContext->ApplyCurrentStateL( aSession,
+                                                 ESVPHoldToResume ) );
+        return err;
+        }
+    else
+        {
+        return KErrSVPHoldResumeInProgress;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::TimedOut
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldController::TimedOut()
+    {
+    iContext->TimedOut();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::IncomingRequest
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldController::IncomingRequest( CMceSession* aSession )
+    {
+    SVPDEBUG1( "CSVPHoldController::IncomingRequest IN" )
+    if ( IncomingRequestAllowed() )
+        {
+        SVPDEBUG1( "CSVPHoldController::IncomingRequest allowed" )
+        
+        iHoldRequestCompleted = EFalse;
+        iContext->SetSessionObject( aSession );
+        TInt err = KErrNone;
+        TRAP( err, iContext->ApplyCurrentStateL( aSession,
+                                                 ESVPHoldIncoming ) );
+        
+        if ( KErrSVPHoldNotHoldRequest == err )
+            {
+            iHoldRequestCompleted = ETrue;
+            }
+        
+        return err;            
+        }
+        
+    else
+        {
+        SVPDEBUG1( "CSVPHoldController::IncomingRequest not allowed!" )
+        
+        return KErrSVPHoldRequestPending;
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::IncomingResponse
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldController::IncomingResponse( 
+                            CMceSession* aSession, 
+                            TInt aStatusCode )
+    {
+    if ( IncomingResponseAllowed() )
+        {
+        SVPDEBUG1( "CSVPHoldController::IncomingResponse - Allowed" );
+        iContext->SetSessionObject( aSession );
+        iContext->SetResponseStatusCode( aStatusCode );
+        TInt err = KErrNone;
+        TRAP( err, iContext->ApplyCurrentStateL() );
+        iContext->SetResponseStatusCode( KErrNotFound );
+                                                 
+        SVPDEBUG2( "CSVPHoldController::IncomingResponse - Error = %i", err );                                         
+        return err;            
+        }
+        
+    else
+        {
+        SVPDEBUG1( "CSVPHoldController::IncomingResponse - not Allowed!" );
+        return KErrSVPHoldRequestPending;
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::HoldInProgress
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldController::HoldInProgress() const
+    {
+    return !iHoldRequestCompleted;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::HoldRolledBack
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldController::HoldRolledBack() const
+    {
+    return iContext->HoldRolledBack();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::HoldFailed
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldController::HoldFailed()
+    {
+    return iContext->HoldFailed();    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::ResumeFailed
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldController::ResumeFailed()
+    {
+    return iContext->ResumeFailed();    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::ContinueHoldProcessing
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldController::ContinueHoldProcessing( CMceSession& aSession )
+    {
+    SVPDEBUG1( "CSVPHoldController::ContinueHoldProcessing - IN" );
+    iReinviteCrossover = EFalse;
+    TInt err = KErrNone;
+    iContext->SetSessionObject( &aSession );
+
+    TRAP( err, iContext->ApplyCurrentStateL() );
+    
+    iHoldRequestCompleted = ETrue;
+    SVPDEBUG2( "CSVPHoldController::ContinueHoldProcessing - Ready, err = %i",
+                err );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::RequestFailed
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldController::RequestFailed( CMceSession& aSession, 
+                                        TInt aStatusCode, 
+                                        CSVPSessionBase& aBase )
+    {
+    SVPDEBUG1( "CSVPHoldController::RequestFailed - IN" );
+
+
+    aBase.StopTimers();
+    
+    // If 491 received first time, try it once more. No need to enable /
+    // disable audios
+    if ( KSVPRequestPendingVal == aStatusCode )
+        {
+        SVPDEBUG1( "CSVPHoldController::RequestFailed - 491 received" )
+        if ( !iReinviteCrossover )
+            {
+            // First 491 received              
+            iReinviteCrossover = ETrue;
+            iContext->CrossOver( ETrue );                
+            }
+        else
+            {
+            // Second 491; hold/resume request failed
+            iReinviteCrossover = EFalse;
+            iContext->CrossOver( EFalse );
+            }
+        }
+    
+    if ( 0 == aStatusCode && ESVPEstablishing == HoldState() )
+        {
+        SVPDEBUG1( "CSVPHoldController::RequestFailed - status 0 received" )
+        
+        iReinviteCrossover = EFalse;
+        iContext->CrossOver( EFalse );
+        
+        SVPDEBUG1( "CSVPHoldController::RequestFailed - set status code 400" )
+        aStatusCode = KSVPBadRequestVal;
+        }
+
+    TInt err = KErrNone;
+    if ( iReinviteCrossover )
+        {
+        TRAP( err, aBase.StartTimerL( aBase.ReinviteCrossoverTime(),
+                                       KSVPReInviteTimerExpired ) );
+        if ( err )
+            {
+            SVPDEBUG2("CSVPHoldController::RequestFailed - Timer, err %i",
+                       err )
+            }
+        }
+
+    iContext->SetCallRequestFailed( ETrue );
+    err = IncomingResponse( &aSession, aStatusCode );
+    iContext->SetCallRequestFailed( EFalse );
+    SVPDEBUG1( "CSVPHoldController::RequestFailed - OUT" );
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::CheckCrossOver
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldController::CheckCrossOver( CSVPSessionBase& aBase )
+    {
+    SVPDEBUG1( "CSVPHoldController::CheckCrossOver - IN" );
+    if ( iReinviteCrossover )
+        {
+        SVPDEBUG1("CSVPHoldController::CheckCrossOver - True");
+
+        aBase.StopTimers();
+        iReinviteCrossover = EFalse;
+        iContext->CrossOver( EFalse );
+ 
+        TSVPHoldRequestType previousRequest = HoldRequest();
+        
+        if ( ESVPLocalHold == previousRequest ||
+             ESVPLocalDoubleHold == previousRequest )
+            {
+            aBase.HoldRequestFailed();
+            }
+        
+        else if ( ESVPLocalResume == previousRequest ||
+                  ESVPLocalDoubleHoldResume == previousRequest )
+            {
+            aBase.ResumeRequestFailed();
+            }
+        
+        else
+            {
+            // This case should never happen
+            SVPDEBUG2( "CSVPHoldController::CheckCrossOver - Error,  = %i",
+                        previousRequest );
+            }
+        }
+    
+    SVPDEBUG1( "CSVPHoldController::CheckCrossOver - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::HoldState
+// Returns the hold state.
+// ---------------------------------------------------------------------------
+//
+TSVPSessionHoldState CSVPHoldController::HoldState() const
+    {
+    SVPDEBUG1( "CSVPHoldController::HoldState" );
+    
+    TSVPHoldStateIndex currentState = iContext->CurrentState();
+    
+    
+    if ( KSVPHoldConnectedStateIndex == currentState )
+        {
+        SVPDEBUG1( "CSVPHoldController::HoldState - CONNECTED" );
+        return ESVPConnected;
+        }
+        
+    else if ( KSVPHoldEstablishingStateIndex == currentState )
+        {
+        SVPDEBUG1( "CSVPHoldController::HoldState - ESTABLISHING" );
+        return ESVPEstablishing;
+        }
+        
+    else
+        {
+        SVPDEBUG1( "CSVPHoldController::HoldState - ONHOLD" );
+        return ESVPOnHold;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::HoldRequest
+// Returns the hold request type.
+// ---------------------------------------------------------------------------
+//
+TSVPHoldRequestType CSVPHoldController::HoldRequest() const
+    {
+    SVPDEBUG1( "CSVPHoldController::HoldRequest" );
+    return iContext->HoldRequest();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::HoldAllowed
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldController::HoldAllowed()
+    {
+    TSVPHoldStateIndex currentState = iContext->CurrentState();
+    
+    if ( KSVPHoldOutStateIndex == currentState ||
+         KSVPHoldEstablishingStateIndex == currentState ||
+         KSVPHoldDHStateIndex == currentState )
+        {
+        SVPDEBUG1( "CSVPHoldController::HoldAllowed - EFalse" );
+        return EFalse;
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPHoldController::HoldAllowed - ETrue" );
+        return ETrue;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::ResumeAllowed
+// ---------------------------------------------------------------------------
+//   
+TBool CSVPHoldController::ResumeAllowed()
+    {
+    TSVPHoldStateIndex currentState = iContext->CurrentState();
+    if ( KSVPHoldInStateIndex == currentState ||
+         KSVPHoldEstablishingStateIndex == currentState ||
+         KSVPHoldConnectedStateIndex == currentState )
+        {
+        return EFalse;
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPHoldController::ResumeAllowed" );
+        return ETrue;
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::Muted
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldController::Muted( TBool aMuted )
+    {
+    iContext->Muted( aMuted );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::IncomingRequestAllowed
+// ---------------------------------------------------------------------------
+//   
+TBool CSVPHoldController::IncomingRequestAllowed()
+    {
+    if ( KSVPHoldEstablishingStateIndex == iContext->CurrentState() )
+        {
+        return EFalse;
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPHoldController::IncomingRequestAllowed" );
+        
+        return ETrue;
+        }        
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldController::IncomingResponseAllowed
+// ---------------------------------------------------------------------------
+//   
+TBool CSVPHoldController::IncomingResponseAllowed()
+    {
+    if ( KSVPHoldEstablishingStateIndex == iContext->CurrentState() )
+        {
+        SVPDEBUG1( "CSVPHoldController::IncomingResponseAllowed" );
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }        
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::HoldEvent
+// ---------------------------------------------------------------------------
+//
+MCCPCallObserver::TCCPCallEvent CSVPHoldController::HoldEvent()
+    {
+    return iContext->HoldEvent();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::RefreshHoldStateL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldController::RefreshHoldStateL()
+    {
+    SVPDEBUG1( "CSVPHoldController::RefreshHoldStateL - In" );
+
+    CMceSession* session = iContext->SessionObject();
+    const RPointerArray< CMceMediaStream >& streams = session->Streams();
+    CMceMediaStream* mediaStream = NULL;
+
+    TInt streamCount = streams.Count();
+    for ( TInt i = 0; i < streamCount; i++ )
+        {
+        mediaStream = streams[ i ];
+        TMceMediaType mediaType = mediaStream->Type();
+        if ( KMceAudio == mediaType )
+            {
+            SVPDEBUG1( "CSVPHoldController::RefreshHoldStateL - Stream found" );
+            mediaStream = streams[ i ];
+            RefreshL( *mediaStream );
+            break;
+            }
+        }
+       
+    SVPDEBUG1( "CSVPHoldController::RefreshHoldStateL - Out" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldController::RefreshL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldController::RefreshL( CMceMediaStream& aMediaStream )
+    {
+    if ( &aMediaStream )
+        {
+        switch ( iContext->CurrentState() )
+            {
+            case KSVPHoldOutStateIndex:
+                {
+                iContext->MediaHandler().PerformMediaActionL(
+                        aMediaStream, ESVPLocalHold );
+                break;
+                }
+                
+            case KSVPHoldInStateIndex:
+                {
+                iContext->MediaHandler().PerformMediaActionL(
+                        aMediaStream, ESVPRemoteHold );
+                break;
+                }
+                
+            case KSVPHoldDHStateIndex:
+                {
+                iContext->MediaHandler().PerformMediaActionL(
+                        aMediaStream, ESVPLocalDoubleHold );
+                break;
+                }
+            
+            case KSVPHoldConnectedStateIndex:
+                {
+                // Special case here; for enablingIOP: audio is lost on Snom M3 when it unholds the call
+                SVPDEBUG1( "CSVPHoldController::RefreshL -> Refresh audio" );
+                iContext->MediaHandler().EnableAudioL( *iContext );
+                SVPDEBUG1( "CSVPHoldController::RefreshL <- Refresh audio done" );
+                break;
+                }
+                
+            case KSVPHoldEstablishingStateIndex:
+                {
+                SVPDEBUG1( "CSVPHoldController::RefreshL - Not needed" );
+                break;
+                }
+            }
+        }
+
+    SVPDEBUG1( "CSVPHoldController::RefreshL - Out" );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/src/svpholddhstate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,251 @@
+/*
+* 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:  Double hold state for hold state machine.
+*
+*/
+
+
+#include    <badesca.h>
+#include    <mcesession.h>
+#include    <mcertpsource.h>
+#include    <mcertpsink.h>
+#include    <mcemediastream.h>
+#include    <mceaudiostream.h>
+#include    "svpholddhstate.h"
+#include    "svpholdcontroller.h"
+#include    "svpholdobserver.h"
+#include    "svpholdmediahandler.h"
+#include    "svplogger.h"
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldDHState::CSVPHoldDHState
+// ---------------------------------------------------------------------------
+//
+CSVPHoldDHState::CSVPHoldDHState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldDHState::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPHoldDHState* CSVPHoldDHState::NewLC()
+    {
+    CSVPHoldDHState* self = new ( ELeave ) CSVPHoldDHState;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldDHState::~CSVPHoldDHState
+// ---------------------------------------------------------------------------
+//
+CSVPHoldDHState::~CSVPHoldDHState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldDHState::DoApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldDHState::DoApplyL( CSVPHoldContext& aContext )
+    {
+    SVPDEBUG1( "CSVPHoldDHState::DoApply" );
+    CMceSession* session = aContext.SessionObject();
+    const RPointerArray< CMceMediaStream >& streams = session->Streams();
+    TSVPHoldStateIndex nextState = KSVPHoldEstablishingStateIndex;
+    
+    TInt audioStreamsHandled = 0;
+    TInt streamCount = streams.Count();    
+    for ( TInt i = 0; i < streamCount; i++ )
+        {
+        CMceMediaStream* mediaStream = streams[ i ];
+        TMceMediaType mediaType = mediaStream->Type();
+        if ( KMceAudio == mediaType )
+            {
+            // This media is audio stream. Handling depends on the request
+            nextState = PerformRequestL( aContext, *mediaStream, *session );
+            audioStreamsHandled++;                
+            }
+        }
+    
+    if ( 0 == audioStreamsHandled )
+        {
+        SVPDEBUG1( "CSVPHoldDHState::DoApply - No streams - Leave" );
+        User::Leave( KErrSVPHoldStateError );
+        }    
+
+    aContext.SetCurrentStateL( aContext, nextState );
+    SVPDEBUG1( "CSVPHoldDHState::DoApply - Handled" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldDHState::PerformRequestL
+// ---------------------------------------------------------------------------
+//
+TSVPHoldStateIndex 
+CSVPHoldDHState::PerformRequestL( CSVPHoldContext& aContext,
+                                  CMceMediaStream& aMediaStream,
+                                  CMceSession& aSession )
+    {
+    TSVPHoldStateIndex nextState = KSVPHoldEstablishingStateIndex;
+    switch ( aContext.HoldRequest() )
+        {
+        case ESVPLocalDoubleHoldResume:
+            {
+            ResumeDoubleHoldSessionLocallyL( aContext, aMediaStream, aSession );
+            break;
+            }                    
+            
+        case ESVPRemoteDoubleHoldResume:
+            {
+            RemoteDoubleHoldSessionResumeL( aContext, aMediaStream, aSession );
+            break;
+            }
+
+        case ESVPLocalHold:
+        case ESVPLocalResume:
+        case ESVPLocalDoubleHold:
+        case ESVPRemoteHold:
+        case ESVPRemoteResume:
+        case ESVPRemoteDoubleHold:
+            {
+            // Cannot occur in doublehold state
+            User::Leave( KErrSVPHoldStateError );
+            break;                
+            }
+
+        default:
+            {
+            // Error in request solving,no state change needed:
+            nextState = KSVPHoldDHStateIndex;
+            
+            SVPDEBUG2( "CSVPHoldDHState::PerformRequestL - Error, request %i", 
+                        aContext.HoldRequest() );
+            break;
+            }                    
+        }    
+
+    return nextState;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldDHState::ResumeDoubleHoldSessionLocallyL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldDHState::
+ResumeDoubleHoldSessionLocallyL( CSVPHoldContext& aContext,
+                                 CMceMediaStream& aMediaStream,
+                                 CMceSession& aSession )
+    {
+    SVPDEBUG1( "CSVPHoldDHState::ResumeDoubleHoldSessionLocallyL - In" );
+
+    // Local resume from double holded stream. Handle media stream:
+    aContext.MediaHandler().
+        PerformMediaActionL( aMediaStream,
+                             ESVPLocalDoubleHoldResume );        		    
+    
+    // Update session
+    aSession.UpdateL();
+    SVPDEBUG1( "CSVPHoldDHState::ResumeDoubleHoldSessionLocallyL - done" );    
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldDHState::RemoteSoubleHoldSessionResumeL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldDHState::
+RemoteDoubleHoldSessionResumeL( CSVPHoldContext& aContext,
+                                CMceMediaStream& aMediaStream,
+                                CMceSession& aSession )
+    {
+    // Remote Resume from double holded stream:
+    SVPDEBUG1( "CSVPHoldDHState::RemoteDoubleHoldSessionResumeL - In" );
+    
+    MDesC8Array* attributeLines = aMediaStream.MediaAttributeLinesL();
+    CleanupDeletePushL( attributeLines );
+    
+    // Check that request has reasonable direction attribute:
+    TSVPHoldRequestType attribute =
+                aContext.SolveRequestL( aSession, attributeLines );
+
+    if ( ESVPNoType == attribute )
+        {
+        // Not hold request
+        SVPDEBUG1( "CSVPHoldDHState::RemoteSoubleHoldSessionResumeL:");
+        SVPDEBUG1( "Not hold request" );
+        
+        User::Leave( KErrSVPHoldNotHoldRequest );
+        }
+    
+    CleanupStack::PopAndDestroy( attributeLines );
+    
+    // Handle media stream:
+    aContext.MediaHandler().
+        PerformMediaActionL( aMediaStream,
+                             ESVPRemoteDoubleHoldResume );        		    
+    
+    // Update session
+    aSession.UpdateL();
+    
+    SVPDEBUG1( "CSVPHoldDHState::RemoteSoubleHoldSessionResumeL - done" );    
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldDHState::DoEnter
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldDHState::DoEnter( CSVPHoldContext& aContext )
+    {
+    SVPDEBUG1( "CSVPHoldDHState::DoEnter" );
+    
+    TInt err = KErrNone;
+    TRAP( err, aContext.MediaHandler().DisableAudioL( aContext ) );
+
+    // succesfull action is informed to client
+    switch ( aContext.HoldRequest() )
+        {
+        case ESVPLocalDoubleHold:
+            {
+            SVPDEBUG1( "CSVPHoldDHState::DoEnter - LocalDoubleHold" );
+            aContext.HoldObserver().SessionLocallyHeld();
+            break;
+            }
+            
+        case ESVPRemoteDoubleHold:
+            {
+            SVPDEBUG1( "CSVPHoldDHState::DoEnter - RemoteDoubleHold" );
+            aContext.HoldObserver().SessionRemoteHeld();
+            break;
+            }
+            
+        default:
+            {
+            // Nothing to do; occurs only with state rollback
+            SVPDEBUG1( "CSVPHoldDHState::DoEnter - Default" );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldDHState::IsOutEstablishingStateActive
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldDHState::IsOutEstablishingStateActive()
+    {
+    return EFalse;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/src/svpholdinestablishingstate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,304 @@
+/*
+* 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:  Incoming request establishing state for hold state machine.
+*
+*/
+ 
+
+#include    "mcesession.h"
+#include    "mcemediastream.h"
+#include    "mceaudiostream.h"
+#include    "svpholdinestablishingstate.h"
+#include    "svpholdcontroller.h"
+#include    "svpholdattributehandler.h"
+#include    "svplogger.h"
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInEstablishingState::CSVPHoldInEstablishingState
+// ---------------------------------------------------------------------------
+//
+CSVPHoldInEstablishingState::CSVPHoldInEstablishingState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInEstablishingState::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPHoldInEstablishingState* CSVPHoldInEstablishingState::NewLC()
+    {
+    CSVPHoldInEstablishingState* self = 
+        new ( ELeave ) CSVPHoldInEstablishingState;
+
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInEstablishingState::~CSVPHoldInEstablishingState
+// ---------------------------------------------------------------------------
+//
+CSVPHoldInEstablishingState::~CSVPHoldInEstablishingState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInEstablishingState::DoApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldInEstablishingState::DoApplyL( CSVPHoldContext& aContext )
+    {
+    SVPDEBUG1( "CSVPHoldInEstablishingState::DoApply" );
+
+    TSVPHoldStateIndex nextState = KSVPHoldEstablishingStateIndex; 
+    
+    const RPointerArray< CMceMediaStream >& streams =
+        aContext.SessionObject()->Streams();
+    
+    const TInt streamCount = streams.Count();
+    
+    if ( !aContext.SpecialResponseHandling( nextState ) )
+        {
+        for ( TInt i = 0; i < streamCount; i++ )
+            {
+            CMceMediaStream* mediaStream = streams[ i ];
+            if ( KMceAudio == mediaStream->Type() )
+                {
+                // This media is audio stream. Handling depends on the request
+                switch ( aContext.HoldRequest() )
+                    {
+                    case ESVPRemoteHold:
+                        {
+                        // From Connected state
+                        HandleRemoteHolding( nextState );
+                        break;
+                        }
+                        
+                    case ESVPRemoteResume:
+                        {
+                        // From In state
+                        HandleRemoteResuming( nextState );
+                        break;
+                        }
+
+                    case ESVPRemoteDoubleHold:
+                        {
+                        // From Out state
+                        HandleRemoteHolding( nextState,
+                                             KSVPHoldDHStateIndex );
+                        break;
+                        }
+
+                     case ESVPRemoteDoubleHoldResume:
+                        {
+                        // From Doublehold state
+                        HandleRemoteResuming( nextState,
+                                              KSVPHoldOutStateIndex );
+                        break;
+                        }
+
+                    case ESVPLocalHold:
+                    case ESVPLocalResume:
+                    case ESVPLocalDoubleHold:
+                    case ESVPLocalDoubleHoldResume:
+                        {
+                        SVPDEBUG1(
+                        "CSVPHoldInEstablishingState::DoApply\
+                         - Local action - State Error" );
+                        User::Leave( KErrSVPHoldStateError );
+                        break;
+                        }
+                        
+                    default:
+                        {
+                        // Error in request solving
+                        SVPDEBUG2(
+                        "CSVPHoldInEstablishingState::DoApply - Error, request %i",
+                                                        aContext.HoldRequest() );
+                        break;
+                        }
+                    }
+                }
+            }           
+        }
+
+    aContext.SetCurrentStateL( aContext, nextState );
+    SVPDEBUG1( "CSVPHoldInEstablishingState::DoApply - Handled" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldInEstablishingState::DoEnter
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldInEstablishingState::DoEnter( CSVPHoldContext& /*aContext*/ )
+    {
+    // Nothing to do.
+    SVPDEBUG1( "CSVPHoldInEstablishingState::DoEnter" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldInEstablishingState::IsOutEstablishingStateActive
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldInEstablishingState::IsOutEstablishingStateActive()
+    {
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInEstablishingState::HandleRemoteHoldingL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldInEstablishingState::
+HandleRemoteHolding( TSVPHoldStateIndex& aNextState,
+                     TSVPHoldStateIndex aState )
+    {
+    SVPDEBUG1(
+    "CSVPHoldInEstablishingState::HandleRemoteHoldingL" );
+    
+    if ( KSVPHoldDHStateIndex == aState )
+        {
+        SVPDEBUG1(
+        "CSVPHoldOutEstablishingState::HandleLocalHoldingL\
+         - Next KSVPHoldDHStateIndex" );
+        aNextState = KSVPHoldDHStateIndex;                
+        }
+    else
+        {
+        aNextState = KSVPHoldInStateIndex;
+        }
+            
+    SVPDEBUG1(
+    "CSVPHoldInEstablishingState::HandleRemoteHoldingL - Done" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInEstablishingState::HandleRemoteResumingL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldInEstablishingState::
+HandleRemoteResuming( TSVPHoldStateIndex& aNextState,
+                      TSVPHoldStateIndex aState )
+    {
+    if ( KSVPHoldOutStateIndex == aState )
+        {
+        SVPDEBUG1(
+        "CSVPHoldInEstablishingState::HandleRemoteResumingL KSVPHoldOutStateIndex" )
+        
+        aNextState = KSVPHoldOutStateIndex;
+        }
+    else
+        {
+        SVPDEBUG1(
+        "CSVPHoldInEstablishingState::HandleRemoteResumingL KSVPHoldConnectedStateIndex" )
+        
+        aNextState = KSVPHoldConnectedStateIndex;
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldInEstablishingState::CheckAttribute
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldInEstablishingState::
+CheckAttribute( MDesC8Array* aAttributeLines,
+                KSVPHoldAttributeIndex aNeededAttribute,
+                TSVPHoldStateIndex& aNextState,
+                CSVPHoldContext& aContext )
+    {
+    // Checks direction attribute from request whether it is acceptable or not.
+    SVPDEBUG1( "CSVPHoldInEstablishingState::CheckAttribute" );
+
+    KSVPHoldAttributeIndex requestAttribute =
+        aContext.AttributeHandler().FindDirectionAttribute( aAttributeLines );
+        
+    if ( aNeededAttribute == requestAttribute )
+        {
+        return DefineDefaultCaseStateChange( aContext, aNextState );
+        }
+        
+    else if ( KSVPHoldSendrecvIndex == aNeededAttribute &&
+              KErrNotFound == requestAttribute )
+        {
+        // If there is no direction attribute at all, default is sendrecv
+        SVPDEBUG1(
+        "CSVPHoldInEstablishingState::CheckAttributeL - No attribute" );
+        aNextState = KSVPHoldConnectedStateIndex;
+        return KErrNone;
+        }
+        
+    else if ( KSVPHoldSendonlyIndex == aNeededAttribute &&
+              KErrNotFound == requestAttribute )
+        {
+        // no-op request received
+        SVPDEBUG1(
+        "CSVPHoldInEstablishingState::CheckAttributeL - No-op" );
+        aNextState = KSVPHoldConnectedStateIndex;
+        return KErrNone;
+        }
+        
+    else
+        {
+        // Do not change the aNextState
+        SVPDEBUG1(
+        "CSVPHoldInEstablishingState::CheckAttributeL - else" );
+        return KErrSVPHoldUnacceptableResponseAttribute;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInEstablishingState::DefineDefaultCaseStateChange
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldInEstablishingState::
+DefineDefaultCaseStateChange( CSVPHoldContext& aContext,
+                          TSVPHoldStateIndex& aNextState )
+    {
+    switch ( aContext.HoldRequest() )
+        {
+        case ESVPRemoteHold:
+            {
+            aNextState = KSVPHoldInStateIndex;
+            return KErrNone;
+            }
+            
+        case ESVPRemoteResume:
+            {
+            aNextState = KSVPHoldConnectedStateIndex;
+            return KErrNone;
+            }
+            
+        case ESVPRemoteDoubleHold:
+            {
+            aNextState = KSVPHoldDHStateIndex;
+            return KErrNone;
+            }
+            
+        case ESVPRemoteDoubleHoldResume:
+            {
+            aNextState = KSVPHoldOutStateIndex;
+            return KErrNone;
+            }
+            
+        default:
+            {
+            SVPDEBUG1(
+            "CSVPHoldInEstablishingState::CheckAttributeL - Default" );
+            return KErrSVPHoldUnacceptableResponseAttribute;
+            }
+        }
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/src/svpholdinstate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,265 @@
+/*
+* 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:  Remote holded state for hold state machine.
+*
+*/
+
+
+#include    <badesca.h>
+#include    <mcesession.h>
+#include    <mcertpsource.h>
+#include    <mcertpsink.h>
+#include    <mcemediastream.h>
+#include    <mceaudiostream.h>
+#include    "svpholdinstate.h" 
+#include    "svpholdcontext.h"
+#include    "svpholdcontroller.h"
+#include    "svpholdobserver.h"
+#include    "svpholdmediahandler.h"
+#include    "svplogger.h"
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInState::CSVPHoldInState
+// ---------------------------------------------------------------------------
+//
+CSVPHoldInState::CSVPHoldInState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInState::NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPHoldInState* CSVPHoldInState::NewLC()
+    {
+    CSVPHoldInState* self = new ( ELeave ) CSVPHoldInState;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInState::~CSVPHoldInState
+// ---------------------------------------------------------------------------
+//
+CSVPHoldInState::~CSVPHoldInState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInState::DoApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldInState::DoApplyL( CSVPHoldContext& aContext )
+    {
+    SVPDEBUG1( "CSVPHoldInState::DoApply" )
+    
+    CMceSession* session = aContext.SessionObject();
+    const RPointerArray< CMceMediaStream >& streams = session->Streams();
+    TSVPHoldStateIndex nextState = KSVPHoldEstablishingStateIndex;
+    
+    SVPDEBUG2( "CSVPHoldInState::DoApply streams: %d", streams.Count() )
+    
+    TInt audioStreamsHandled = 0;
+    TInt streamCount = streams.Count();
+    while ( streamCount )
+        {
+        streamCount--;
+        CMceMediaStream* mediaStream = streams[ streamCount ];
+        if ( KMceAudio == mediaStream->Type() )
+            {
+            // This media is audio stream. Handling depends on the request            
+            SVPDEBUG2( "CSVPHoldInState::DoApply - Hold request = %i",
+                        aContext.HoldRequest() )
+            
+            nextState = PerformRequestL( aContext, *mediaStream, *session );
+            audioStreamsHandled++;
+            }
+        }
+    
+    if ( 0 == audioStreamsHandled )
+        {
+        SVPDEBUG1( "CSVPHoldInState::DoApply KErrSVPHoldStateError" )
+        
+        User::Leave( KErrSVPHoldStateError );
+        }    
+    
+    aContext.SetCurrentStateL( aContext, nextState );
+    
+    SVPDEBUG1( "CSVPHoldInState::DoApply - Handled" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInState::PerformRequestL
+// ---------------------------------------------------------------------------
+//
+TSVPHoldStateIndex 
+CSVPHoldInState::PerformRequestL( CSVPHoldContext& aContext,
+                                  CMceMediaStream& aMediaStream,
+                                  CMceSession& aSession )
+    {
+    TSVPHoldStateIndex nextState = KSVPHoldEstablishingStateIndex;
+    switch ( aContext.HoldRequest() )
+        {
+        case ESVPLocalDoubleHold:
+            {
+            LocalSessionDoubleHoldL( aContext, aMediaStream, aSession );
+            break;
+            }                    
+            
+        case ESVPRemoteResume:
+            {
+            RemoteSessionResumeL( aContext, aMediaStream, aSession );
+            break;
+            }                   
+
+        case ESVPLocalHold:
+        case ESVPLocalDoubleHoldResume:
+        case ESVPLocalResume:
+        case ESVPRemoteHold:
+        case ESVPRemoteDoubleHold:
+        case ESVPRemoteDoubleHoldResume:
+            {
+            // Cannot occur in In state
+            User::Leave( KErrSVPHoldStateError );
+            break;
+            }
+
+        default:
+            {
+            // Error in request solving, state change not needed:
+            nextState = KSVPHoldInStateIndex;
+            
+            SVPDEBUG2( "CSVPHoldInState::PerformRequestL - Error, request %i", 
+                        aContext.HoldRequest() );
+            break;
+            }                    
+        }
+    
+    return nextState;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldInState::LocalSessionDoubleHoldL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldInState::LocalSessionDoubleHoldL( CSVPHoldContext& aContext,
+                                               CMceMediaStream& aMediaStream,
+                                               CMceSession& aSession )
+    {
+    SVPDEBUG1( "CSVPHoldInState::LocalSessionDoubleHoldL - In" );
+    
+    // Handle media stream:
+    aContext.MediaHandler().
+        PerformMediaActionL( aMediaStream,
+                             ESVPLocalDoubleHold );
+    
+    // Update session
+    aSession.UpdateL();
+    SVPDEBUG1( "CSVPHoldInState::LocalSessionDoubleHoldL - done" );   
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldInState::RemoteSessionResumeL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldInState::RemoteSessionResumeL( CSVPHoldContext& aContext,
+                                            CMceMediaStream& aMediaStream,
+                                            CMceSession& aSession )
+    {
+    SVPDEBUG1( "CSVPHoldInState::RemoteSessionResumeL - In" )
+    
+    MDesC8Array* attributeLines = aMediaStream.MediaAttributeLinesL();
+    CleanupDeletePushL( attributeLines );
+    
+    // Check that request has reasonable direction attribute:
+    if ( ESVPNoType == aContext.SolveRequestL( aSession, attributeLines ) )
+        {
+        // Not hold request
+        SVPDEBUG1( "CSVPHoldInState::RemoteSessionResumeL ESVPNoType")
+        
+        User::Leave( KErrSVPHoldNotHoldRequest );
+        }
+    
+    CleanupStack::PopAndDestroy( attributeLines );
+    
+    // Handle media stream:
+    aContext.MediaHandler().PerformMediaActionL(
+        aMediaStream, ESVPRemoteResume );
+    
+    // Update session
+    aSession.UpdateL();
+    
+    SVPDEBUG1( "CSVPHoldInState::RemoteSessionResumeL - done" )
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldInState::DoEnter
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldInState::DoEnter( CSVPHoldContext& aContext )
+    {
+    SVPDEBUG1( "CSVPHoldInState::DoEnter" );
+
+    TInt err = KErrNone;
+    
+    // succesfull action is informed to client
+    switch ( aContext.HoldRequest() )
+        {
+        case ESVPRemoteHold:
+            {
+            SVPDEBUG1( "CSVPHoldInState::DoEnter - RemoteHold" );
+            // For music on hold IOP with some vendors leave speaker enabled:
+            TBool leaveSpeakerEnabled = ETrue;
+            TRAP( err, aContext.MediaHandler().
+                            DisableAudioL( aContext,
+                                           leaveSpeakerEnabled ) );
+
+            aContext.HoldObserver().SessionRemoteHeld();
+            break;
+            }
+            
+        case ESVPLocalDoubleHoldResume:
+            {
+            SVPDEBUG1( "CSVPHoldInState::DoEnter - Local DH resume" );
+            TRAP( err, aContext.MediaHandler().DisableAudioL( aContext ) );
+            aContext.HoldObserver().SessionLocallyResumed();
+            break;
+            }
+            
+        default:
+            {
+            // Nothing to do; occurs only with state rollback
+            SVPDEBUG1( "CSVPHoldInState::DoEnter - Default" );
+            break;
+            }        
+        }
+
+    if ( aContext.RemoteRequestNotProcessed() )
+        {
+        SVPDEBUG1( "CSVPHoldInState::DoEnter - Remote request completed" );
+        aContext.SetRemoteRequestNotProcessed( EFalse );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldInState::IsOutEstablishingStateActive
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldInState::IsOutEstablishingStateActive()
+    {
+    return EFalse;
+    }
+    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/src/svpholdmediahandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,491 @@
+/*
+* 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:  Pauses and resumes audio stream.
+*
+*/
+
+#include    <e32cmn.h>
+
+#include    <mcesession.h>
+#include    <mcemediastream.h>
+#include    <mceaudiostream.h>
+#include    <mcemediasource.h>
+#include    <mcemicsource.h>
+#include    <mcemediasink.h>
+#include    <mcespeakersink.h>
+#include    <mcertpsource.h>
+#include    <mcertpsink.h>
+
+#include    "svpholdcontext.h"
+#include    "svpholdmediahandler.h"
+#include    "svplogger.h"
+#include    "svpaudioutility.h"
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::CSVPHoldMediaHandler
+// ---------------------------------------------------------------------------
+//
+CSVPHoldMediaHandler::CSVPHoldMediaHandler()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPHoldMediaHandler* CSVPHoldMediaHandler::NewL()
+    {
+    CSVPHoldMediaHandler* self = new ( ELeave ) CSVPHoldMediaHandler;
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::~CSVPHoldMediaHandler
+// ---------------------------------------------------------------------------
+//
+CSVPHoldMediaHandler::~CSVPHoldMediaHandler()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::PerformMediaActionL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldMediaHandler::PerformMediaActionL( CMceMediaStream& aMediaStream,
+                                                TSVPHoldRequestType aRequest )
+    {
+    SVPDEBUG1( "CSVPHoldMediaHandler::PerformMediaActionL - IN" );
+
+    CMceMediaStream& boundStream = aMediaStream.BoundStreamL();
+    
+    // Always set the priorites because MCE/MCC must have those correctly
+    // all the time. This is due to the fact that we may do session update
+    // later and then the priority settings need to be correct.
+    SVPAudioUtility::SetAudioStreamPrioritiesL( aMediaStream, boundStream );
+    
+    switch ( aRequest )
+        {
+        case ESVPLocalHold:
+        case ESVPLocalDoubleHold:
+            {            
+            HandleLocalHoldingL( aMediaStream, boundStream );
+            break;
+            }
+            
+        case ESVPLocalResume:
+        case ESVPLocalDoubleHoldResume:
+            {
+            HandleLocalResumingL( aMediaStream, boundStream, aRequest );
+            break;
+            }
+                        
+        case ESVPRemoteHold:
+        case ESVPRemoteDoubleHold:
+            {
+            HandleRemoteHoldingL( aMediaStream, boundStream, aRequest );
+            break;
+            }
+        
+        case ESVPRemoteResume:
+        case ESVPRemoteDoubleHoldResume:
+            {
+            HandleRemoteResumingL( aMediaStream, boundStream, aRequest );
+            break;
+            }
+
+        default:
+            {
+            SVPDEBUG1( "CSVPHoldMediaHandler::PerformMediaActionL: Leave" );
+            User::Leave( KErrNotFound );            
+            }
+        }
+    SVPDEBUG1( "CSVPHoldMediaHandler::PerformMediaActionL - Out" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::HandleLocalHoldingL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldMediaHandler::
+HandleLocalHoldingL( CMceMediaStream& aMediaStream,
+                     CMceMediaStream& aBoundStream )
+    {
+    SVPDEBUG1( "CSVPHoldMediaHandler::HandleLocalHoldingL - In" );
+    
+    // In case of local hold RTP source must be disabled
+    if ( aMediaStream.Source() &&
+         KMceRTPSource == aMediaStream.Source()->Type() )
+        {
+        aMediaStream.DisableL();
+        }
+    else if ( aBoundStream.Source() &&
+              KMceRTPSource == aBoundStream.Source()->Type() )
+        {
+        aBoundStream.DisableL();
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPHoldMediaHandler::HandleLocalHoldingL:" );
+        SVPDEBUG1( "Local hold: No stream - User::Leave" );
+        User::Leave( KErrNotFound );
+        }
+    
+    SVPDEBUG1( "CSVPHoldMediaHandler::HandleLocalHoldingL - Out" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::HandleLocalResumingL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldMediaHandler::
+HandleLocalResumingL( CMceMediaStream& aMediaStream,
+                      CMceMediaStream& aBoundStream,
+                      TSVPHoldRequestType aRequest )
+    {
+    SVPDEBUG1( "CSVPHoldMediaHandler::HandleLocalResumingL - In" );
+    
+    switch ( aRequest )
+        {
+        case ESVPLocalResume:
+            {
+            // In case of local resume disabled stream must be enabled              
+            SVPDEBUG1( "CSVPHoldMediaHandler::HandleLocalResumingL - LocalResume" );
+            if ( !aBoundStream.IsEnabled() )
+                {
+                aBoundStream.EnableL();
+                }
+                
+            if ( !aMediaStream.IsEnabled() )
+                {
+                aMediaStream.EnableL();
+                }
+            
+            break;
+            }
+            
+        case ESVPLocalDoubleHoldResume:
+            {
+            // In case of localDH resume RTP source must be enabled
+            if ( KMceRTPSource == aMediaStream.Source()->Type() )
+                {
+                aMediaStream.EnableL();
+                }
+                
+            else if ( KMceRTPSource == aBoundStream.Source()->Type() )
+                {
+                aBoundStream.EnableL();
+                }
+                
+            else
+                {
+                SVPDEBUG1( "CSVPHoldMediaHandler::HandleLocalResumingL:" );
+                SVPDEBUG1( "Local DH resume: No stream - User::Leave" );
+                User::Leave( KErrNotFound );
+                }            
+
+            break;
+            }
+            
+        default:
+            {
+            User::Leave( KErrNotFound );
+            }
+        }
+    
+    SVPDEBUG1( "CSVPHoldMediaHandler::HandleLocalResumingL - Out" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::HandleRemoteHoldingL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldMediaHandler::
+HandleRemoteHoldingL( CMceMediaStream& aMediaStream,
+                      CMceMediaStream& aBoundStream,
+                      TSVPHoldRequestType aRequest )
+    {
+    SVPDEBUG1( "CSVPHoldMediaHandler::HandleRemoteHoldingL - In" );
+    
+    // In case of remote hold RTP sink must be disabled    
+    if ( KMceRTPSource == aMediaStream.Source()->Type() )
+        {
+        aBoundStream.DisableL();
+        if ( ESVPRemoteDoubleHold == aRequest )
+            {
+            aMediaStream.DisableL();
+            }
+        }
+        
+    else if ( KMceRTPSource == aBoundStream.Source()->Type() )
+        {
+        aMediaStream.DisableL();
+        if ( ESVPRemoteDoubleHold == aRequest )
+            {
+            aBoundStream.DisableL();
+            }
+        }
+        
+    else
+        {
+        SVPDEBUG1( "CSVPHoldMediaHandler::HandleRemoteHoldingL:" );
+        SVPDEBUG1( "Remote hold: No stream - User::Leave" );
+        User::Leave( KErrNotFound );
+        }    
+
+    SVPDEBUG1( "CSVPHoldMediaHandler::HandleRemoteHoldingL - Out" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::HandleRemoteResumingL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldMediaHandler::
+HandleRemoteResumingL( CMceMediaStream& aMediaStream,
+                       CMceMediaStream& aBoundStream,
+                       TSVPHoldRequestType aRequest )
+    {
+    SVPDEBUG1( "CSVPHoldMediaHandler::HandleRemoteResumingL - In" )
+    
+    switch ( aRequest )
+        {
+        case ESVPRemoteResume:
+            {
+            SVPDEBUG2( "CSVPHoldMediaHandler::HandleRemoteResumingL aBound ena: %d",
+                aBoundStream.IsEnabled() )
+            
+            SVPDEBUG2( "CSVPHoldMediaHandler::HandleRemoteResumingL aMedia ena: %d",
+                aMediaStream.IsEnabled() )
+            
+            // In case of remote resume disabled stream(s) must be enabled
+            if ( !aBoundStream.IsEnabled() )
+                {
+                SVPDEBUG1( "CSVPHoldMediaHandler::HandleRemoteResumingL RR 1st ena/dis" )
+                
+                aBoundStream.EnableL();
+                aMediaStream.DisableL();
+                }
+                
+            if ( !aMediaStream.IsEnabled() )
+                {
+                SVPDEBUG1( "CSVPHoldMediaHandler::HandleRemoteResumingL RR 2nd ena/dis" )
+                
+                aMediaStream.EnableL();
+                aBoundStream.DisableL();
+                }
+            
+            break;
+            }
+            
+        case ESVPRemoteDoubleHoldResume:
+            {
+            // In case of remoteDH resume RTP sink must be enabled                    
+            if ( KMceRTPSource == aMediaStream.Source()->Type() )
+                {
+                aBoundStream.EnableL();
+                aMediaStream.DisableL();
+                }
+            
+            else if ( KMceRTPSource == aBoundStream.Source()->Type() )
+                {
+                aMediaStream.EnableL();
+                aBoundStream.DisableL();
+                }
+            
+            else
+                {
+                SVPDEBUG1( "CSVPHoldMediaHandler::HandleRemoteResumingL:" );
+                SVPDEBUG1( "Remote DH resume: No stream - User::Leave" );
+                User::Leave( KErrNotFound );
+                }
+            
+            break;
+            }
+            
+        default:
+            {
+            User::Leave( KErrNotFound );
+            }
+        }
+    
+    SVPDEBUG1( "CSVPHoldMediaHandler::HandleRemoteResumingL - Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::DisableAudioL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldMediaHandler::DisableAudioL( CSVPHoldContext& aContext,
+                                          TBool aLeaveSpeakerEnabled )
+    {
+    if ( aContext.AudioHandlingAllowed() )
+        {
+        // Disable speaker & microphone
+        SVPDEBUG1( "CSVPHoldMediaHandler::DisableAudioL - Disabling audio..." );
+        CMceSession* session = aContext.SessionObject();
+        const RPointerArray< CMceMediaStream >& streams = session->Streams();
+        TInt streamCount = streams.Count();
+        for ( TInt i = 0; i < streamCount; i++ )
+            {
+            CMceMediaStream* mediaStream = streams[ i ];
+            TMceMediaType mediaType = mediaStream->Type();
+            if ( KMceAudio == mediaType )
+                {
+                TSVPHoldRequestType request = aContext.HoldRequest();
+                
+                CMceMediaStream& boundStream = mediaStream->BoundStreamL();
+                DisableAudioStreamL( boundStream, aLeaveSpeakerEnabled );
+                DisableAudioStreamL( *mediaStream, aLeaveSpeakerEnabled );
+                SVPDEBUG1( "CSVPHoldMediaHandler::DisableAudioL - Audio disabled" );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::DisableAudioStreamL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldMediaHandler::DisableAudioStreamL( CMceMediaStream& aAudioStream,
+                                                TBool aLeaveSpeakerEnabled )
+    {
+    SVPDEBUG1( "CSVPHoldMediaHandler::DisableAudioL - In" );
+    
+    SVPAudioUtility::DisableMicSourceL( aAudioStream );
+    if ( !aLeaveSpeakerEnabled )
+        {
+        SVPAudioUtility::DisableSpeakerSinkL( aAudioStream.Sinks() );
+        }
+    
+    SVPDEBUG1( "CSVPHoldMediaHandler::DisableAudioL - Out" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::EnableAudioL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldMediaHandler::EnableAudioL( CSVPHoldContext& aContext )
+    {
+    if ( aContext.AudioHandlingAllowed() )
+        {
+        // Enable speaker & microphone
+        SVPDEBUG1( "CSVPHoldMediaHandler::EnableAudioL - Enabling audio..." );
+        
+        const RPointerArray< CMceMediaStream >& streams =
+            aContext.SessionObject()->Streams();
+        const TInt streamCount = streams.Count();
+        for ( TInt i = 0; i < streamCount; i++ )
+            {
+            CMceMediaStream* mediaStream = streams[ i ];
+            if ( KMceAudio == mediaStream->Type() )
+                {
+                EnableAudioL( *mediaStream, aContext );
+                }
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::EnableAudioL (private)
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldMediaHandler::EnableAudioL( CMceMediaStream& aMediaStream,
+                                         CSVPHoldContext& aContext )
+    {
+    SVPDEBUG1( "CSVPHoldMediaHandler::EnableAudioL - Audio enabled In" );
+
+    TBool muted = aContext.Muted();
+    TBool mobileOriginated = aContext.IsMobileOriginated();
+
+    // Now enable the audio streams.
+    if ( !muted )
+        {
+        // Normal case, audio not muted
+        SVPDEBUG1( "CSVPHoldMediaHandler::EnableAudioL - no mute" );
+        EnableAudioStreamL( aMediaStream.BoundStreamL() );
+        EnableAudioStreamL( aMediaStream );
+        }
+        
+    else
+        {
+        // Enabling depends on the direction of muted stream
+        if ( mobileOriginated || aContext.IsRemoteRequest() )
+            {
+            SVPDEBUG1( "CSVPHoldMediaHandler::EnableAudioL - Bound" );
+            EnableAudioStreamL( aMediaStream.BoundStreamL(), EFalse );
+            EnableAudioStreamL( aMediaStream, EFalse );
+            // Make sure that mic is disabled
+            SVPAudioUtility::DisableMicSourceL( *( aMediaStream.Source() ) );
+            SVPAudioUtility::DisableMicSourceL( *( aMediaStream.BoundStreamL().
+                                                                  Source() ) );
+            }
+        else
+            {
+            SVPDEBUG1( "CSVPHoldMediaHandler::EnableAudioL - Main" );
+            EnableAudioStreamL( aMediaStream, EFalse );
+            EnableAudioStreamL( aMediaStream.BoundStreamL(), EFalse );
+            // Make sure that mic is disabled
+            SVPAudioUtility::DisableMicSourceL( aMediaStream );
+            SVPAudioUtility::DisableMicSourceL( aMediaStream.BoundStreamL() );
+            }
+        }
+
+    SVPDEBUG1( "CSVPHoldMediaHandler::EnableAudioL - Audio enabled Out" );    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldMediaHandler::EnableAudioStreamL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldMediaHandler::EnableAudioStreamL( CMceMediaStream& aAudioStream,
+                                               TBool aAllowMicEnable )
+    {
+    SVPDEBUG1( "CSVPHoldMediaHandler::EnableAudioStreamL - In" );
+    
+
+    const RPointerArray< CMceMediaSink >& sinks = aAudioStream.Sinks();
+    TInt snkCount( sinks.Count() );
+
+    // Go throug every sink that is associated to that stream
+    for ( TInt i = 0; i < snkCount; i++ )
+        {
+        SVPDEBUG2( "CSVPHoldMediaHandler::EnableAudioStreamL -  Check sink # %d", i );
+        if ( !sinks[ i ]->IsEnabled() )
+            {
+            SVPDEBUG1( "CSVPHoldMediaHandler::EnableAudioStreamL - disabled" )
+            sinks[ i ]->EnableL();            
+            SVPDEBUG1( "CSVPHoldMediaHandler::EnableAudioStreamL - ENABLED" )
+            }
+        }
+
+    if ( aAudioStream.Source() &&
+         ( KMceMicSource == aAudioStream.Source()->Type() ||
+           KMceRTPSource == aAudioStream.Source()->Type() ) )
+        {
+        CMceMediaSource* source = aAudioStream.Source();
+        if ( !source->IsEnabled() && aAllowMicEnable )
+            {
+            // Enable source
+            source->EnableL();
+            SVPDEBUG1( "CSVPHoldMediaHandler::EnableAudioStreamL - Source" );
+            }
+        }
+    
+    SVPDEBUG1( "CSVPHoldMediaHandler::EnableAudioStreamL - Out" );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/src/svpholdoutestablishingstate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,477 @@
+/*
+* 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:  Outgoing request establishing state for hold state machine.
+*
+*/
+
+
+#include    <badesca.h>
+#include    "mcesession.h"
+#include    "mcemediastream.h"
+#include    "mceaudiostream.h"
+#include    "svpholdoutestablishingstate.h"
+#include    "svpholdcontext.h"
+#include    "svpholdcontroller.h"
+#include    "svpholdattributehandler.h"
+#include    "svpholdobserver.h"
+#include    "svplogger.h"
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::CSVPHoldOutEstablishingState
+// ---------------------------------------------------------------------------
+CSVPHoldOutEstablishingState::CSVPHoldOutEstablishingState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::NewLC
+// ---------------------------------------------------------------------------
+CSVPHoldOutEstablishingState* CSVPHoldOutEstablishingState::NewLC()
+    {
+    CSVPHoldOutEstablishingState* self = 
+        new ( ELeave ) CSVPHoldOutEstablishingState;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::~CSVPHoldOutEstablishingState
+// ---------------------------------------------------------------------------
+CSVPHoldOutEstablishingState::~CSVPHoldOutEstablishingState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::DoApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldOutEstablishingState::DoApplyL( CSVPHoldContext& aContext )
+    {
+    SVPDEBUG1( "CSVPHoldOutEstablishingState::DoApply" );
+    
+    TSVPHoldStateIndex nextState = KSVPHoldEstablishingStateIndex; 
+    CMceSession* session = aContext.SessionObject();
+    const RPointerArray< CMceMediaStream >& streams = session->Streams();
+    TInt streamCount = streams.Count();
+    
+    // Hold / Resume handling depends on the response received from network and
+    // timers; any differences from normal handled in SpecialResponseHandling:
+    if ( !aContext.SpecialResponseHandling( nextState ) )
+        {
+        for ( TInt i = 0; i < streamCount; i++ )
+            {
+            CMceMediaStream* mediaStream = streams[ i ];
+            TMceMediaType mediaType = mediaStream->Type();
+            if ( KMceAudio == mediaType )
+                {
+                // This media is audio stream. Handling depends on the request
+                switch ( aContext.HoldRequest() )
+                    {
+                    case ESVPLocalHold:
+                    case ESVPLocalResume:
+                    case ESVPLocalDoubleHold:
+                    case ESVPLocalDoubleHoldResume:
+                        {
+                        HandleLocalHoldL( aContext, mediaStream, nextState );
+                        break;
+                        }
+                    
+                    case ESVPRemoteHold:
+                    case ESVPRemoteResume:
+                    case ESVPRemoteDoubleHold:
+                    case ESVPRemoteDoubleHoldResume:
+                        {
+                        SVPDEBUG1(
+                        "CSVPHoldOutEstablishingState::DoApply\
+                         - Remote action - State Error" );                   
+                        User::Leave( KErrSVPHoldStateError );
+                        }
+                        
+                    default:
+                        {
+                        // Error in request solving
+                        SVPDEBUG2(
+                        "CSVPHoldOutEstablishingState::CSVPHoldOutEstablishingState\
+                         - Error, request %i",
+                        aContext.HoldRequest() );
+                        break;
+                        }
+                    }
+                }
+            }    
+        }
+    
+    aContext.SetCurrentStateL( aContext, nextState );
+    SVPDEBUG1( "CSVPHoldOutEstablishingState::DoApply - Handled" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::DoEnter
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldOutEstablishingState::DoEnter( CSVPHoldContext& /*aContext*/ )
+    {
+    SVPDEBUG1( "CSVPHoldOutEstablishingState::DoEnter" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::IsOutEstablishingStateActive
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldOutEstablishingState::IsOutEstablishingStateActive()
+    {
+    return ETrue;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::HandleLocalHoldL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldOutEstablishingState::
+HandleLocalHoldL( CSVPHoldContext& aContext,
+                  CMceMediaStream* aMediaStream,
+                  TSVPHoldStateIndex& aNextState )
+    {
+    switch ( aContext.HoldRequest() )
+        {
+        case ESVPLocalHold:
+            {
+            // From Connected state
+            HandleLocalHoldingL( aContext,
+                                 aMediaStream,
+                                 aNextState );
+            break;
+            }
+            
+        case ESVPLocalResume:
+            {
+            // From Out state
+            HandleLocalResumingL( aContext,
+                                  aMediaStream,
+                                  aNextState );
+            break;
+            }
+
+        case ESVPLocalDoubleHold:
+            {
+            // From In state
+            HandleLocalHoldingL( aContext,
+                                 aMediaStream,
+                                 aNextState,
+                                 KSVPHoldDHStateIndex );
+            break;
+            }
+
+         case ESVPLocalDoubleHoldResume:
+            {
+            // From Doublehold state
+            HandleLocalResumingL( aContext,
+                                  aMediaStream,
+                                  aNextState,
+                                  KSVPHoldInStateIndex );
+            break;
+            }       
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::HandleLocalHoldingL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldOutEstablishingState::
+HandleLocalHoldingL( CSVPHoldContext& aContext,
+                     CMceMediaStream* mediaStream,
+                     TSVPHoldStateIndex& aNextState,
+                     TSVPHoldStateIndex aState )
+    {
+    SVPDEBUG1(
+    "CSVPHoldOutEstablishingState::HandleLocalHoldingL" );
+    
+    MDesC8Array* attributeLines = mediaStream->MediaAttributeLinesL();
+    CleanupDeletePushL( attributeLines );
+
+    if ( KSVPHoldDHStateIndex == aState )
+        {
+        SVPDEBUG1(
+        "CSVPHoldOutEstablishingState::HandleLocalHoldingL\
+         - Next KSVPHoldDHStateIndex" );
+        //aNextState = KSVPHoldDHStateIndex;
+        KSVPHoldAttributeIndex neededAttribute = KSVPHoldInactiveIndex;
+        CheckAttributeL( attributeLines,
+                         neededAttribute,
+                         aNextState,
+                         aContext );
+        }
+    else
+        {
+        SVPDEBUG1(
+        "CSVPHoldOutEstablishingState::HandleLocalHoldingL\
+         - Next KSVPHoldOutStateIndex" );
+        //aNextState = KSVPHoldOutStateIndex;
+        KSVPHoldAttributeIndex neededAttribute = KSVPHoldRecvonlyIndex;
+        CheckAttributeL( attributeLines,
+                         neededAttribute,
+                         aNextState,
+                         aContext );
+        }
+
+    CleanupStack::PopAndDestroy( attributeLines );
+    
+    SVPDEBUG1( "CSVPHoldOutEstablishingState::HandleLocalHoldingL - Done" );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::HandleLocalResumingL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldOutEstablishingState::
+HandleLocalResumingL( CSVPHoldContext& aContext,
+                      CMceMediaStream* mediaStream,
+                      TSVPHoldStateIndex& aNextState,
+                      TSVPHoldStateIndex aState )
+    {
+    SVPDEBUG1(
+    "CSVPHoldOutEstablishingState::HandleLocalResumingL" );
+    
+    MDesC8Array* attributeLines = mediaStream->MediaAttributeLinesL();
+    CleanupDeletePushL( attributeLines );
+    
+    if ( KSVPHoldInStateIndex == aState )
+        {
+        // Resume from doublehold:
+        SVPDEBUG1(
+        "CSVPHoldOutEstablishingState::HandleLocalResumingL\
+         - Next KSVPHoldInStateIndex" );
+        //aNextState = KSVPHoldInStateIndex;
+        KSVPHoldAttributeIndex neededAttribute = KSVPHoldSendonlyIndex;
+        CheckAttributeL( attributeLines,
+                         neededAttribute,
+                         aNextState,
+                         aContext );    
+        }
+        
+    else
+        {
+        // Basic resume:
+        SVPDEBUG1(
+        "CSVPHoldOutEstablishingState::HandleLocalResumingL\
+         - Next KSVPHoldConnectedStateIndex" );
+        //aNextState = KSVPHoldConnectedStateIndex;
+        KSVPHoldAttributeIndex neededAttribute = KSVPHoldSendrecvIndex;
+        CheckAttributeL( attributeLines,
+                         neededAttribute,
+                         aNextState,
+                         aContext );                                  
+        }
+        
+    CleanupStack::PopAndDestroy( attributeLines );
+
+    SVPDEBUG1(
+    "CSVPHoldOutEstablishingState::HandleLocalResumingL - Done" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::CheckAttributeL
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldOutEstablishingState::
+CheckAttributeL( MDesC8Array* aAttributeLines,
+                KSVPHoldAttributeIndex aNeededAttribute,
+                TSVPHoldStateIndex& aNextState,
+                CSVPHoldContext& aContext )
+    {
+    SVPDEBUG1( "CSVPHoldOutEstablishingState::CheckAttributeL" );
+
+    KSVPHoldAttributeIndex responseAttribute =
+        aContext.AttributeHandler().FindDirectionAttribute( aAttributeLines );
+
+    if ( KErrNotFound == responseAttribute )
+        {
+        SVPDEBUG1( "CSVPHoldOutEstablishingState::CheckAttributeL - Session level" );
+        
+        MDesC8Array* sessionAttributeLines =
+            aContext.SessionObject()->SessionSDPLinesL();
+        
+        responseAttribute =
+            aContext.AttributeHandler().FindDirectionAttribute(
+                sessionAttributeLines );
+        
+        aContext.SessionObject()->SetSessionSDPLinesL(
+            static_cast<CDesC8Array*>( sessionAttributeLines ) );
+        
+        SVPDEBUG1( "CSVPHoldOutEstablishingState::CheckAttributeL - Session level done" );
+        }
+        
+    if ( aNeededAttribute == responseAttribute || 
+         KErrNotFound == responseAttribute )
+        {
+        // If there is no attributes in response; but 200Ok is received;
+        // state change is done based to default cases.
+        return DefineDefaultCaseStateChange( aContext, aNextState );
+        }
+        
+    else if ( KSVPHoldSendrecvIndex == aNeededAttribute &&
+              KErrNotFound == responseAttribute )
+        {
+        // If there is no direction attribute at all, default is sendrecv
+        SVPDEBUG1(
+        "CSVPHoldOutEstablishingState::CheckAttributeL - No attribute" );
+        aNextState = KSVPHoldConnectedStateIndex;
+        return KErrNone;
+        }
+
+    else if ( KSVPHoldSendrecvIndex == aNeededAttribute &&
+              KSVPHoldRecvonlyIndex == responseAttribute )
+        {
+        // Radvision client fix (it responds to resume with recvonly)
+        SVPDEBUG1(
+        "CSVPHoldOutEstablishingState::CheckAttributeL - recvonly to resume.." );
+        aNextState = KSVPHoldConnectedStateIndex;
+        return KErrNone;
+        }
+    
+    else if ( KSVPHoldRecvonlyIndex == aNeededAttribute &&
+              KSVPHoldInactiveIndex == responseAttribute )
+        {
+        // Inactive response to local hold is allowed
+        SVPDEBUG1(
+        "CSVPHoldOutEstablishingState::CheckAttributeL - No attribute" );
+        aNextState = KSVPHoldOutStateIndex;
+        return KErrNone;
+        }
+        
+    else if( KSVPHoldSendonlyIndex == responseAttribute &&
+             KSVPHoldInactiveIndex == aNeededAttribute )
+        {
+        // Sendonly response to local DH (accept for IOP)
+        SVPDEBUG1(
+        "CSVPHoldOutEstablishingState::CheckAttributeL - Sendonly to Inactive request" );
+        aNextState = KSVPHoldDHStateIndex;
+        return KErrNone;        
+        }
+
+    else if( KSVPHoldSendonlyIndex == aNeededAttribute &&
+             KSVPHoldInactiveIndex == responseAttribute )
+        {
+        // Inactive response to local DH resume (accept for IOP)
+        SVPDEBUG1(
+        "CSVPHoldOutEstablishingState::CheckAttributeL - Inactive to DH resume request" );
+        aNextState = KSVPHoldInStateIndex;
+        return KErrNone;        
+        }   
+    
+    else if ( KSVPHoldSendrecvIndex == responseAttribute )
+        {
+        // Response has sendrecv -attribute
+        return ResolveStateFromSendRecvIndex( aNeededAttribute, aNextState );
+        }
+
+    else
+        {
+        SVPDEBUG1(
+        "CSVPHoldOutEstablishingState::CheckAttributeL - else" );
+        return KErrNone;
+        }        
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::DefineDefaultCaseStateChange
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldOutEstablishingState::
+DefineDefaultCaseStateChange( CSVPHoldContext& aContext,
+                              TSVPHoldStateIndex& aNextState )
+    {
+    SVPDEBUG1( "CSVPHoldOutEstablishingState::DefineDefaultCaseStateChange" );
+    // Basic cases (e.g for holding "sendonly" answer has "recvonly")
+    switch ( aContext.HoldRequest() )
+        {
+        case ESVPLocalHold:
+            {
+            SVPDEBUG1( "    ESVPLocalHold" );
+            aNextState = KSVPHoldOutStateIndex;
+            return KErrNone;
+            }
+             
+        case ESVPLocalResume:
+            {
+            SVPDEBUG1( "    ESVPLocalResume" );
+            aNextState = KSVPHoldConnectedStateIndex;
+            return KErrNone;
+            }
+            
+        case ESVPLocalDoubleHold:
+            {
+            SVPDEBUG1( "    ESVPLocalDoubleHold" );
+            aNextState = KSVPHoldDHStateIndex;
+            return KErrNone;
+            }
+            
+        case ESVPLocalDoubleHoldResume:
+            {
+            SVPDEBUG1( "    ESVPLocalDoubleHoldResume" );
+            aNextState = KSVPHoldInStateIndex;
+            return KErrNone;
+            }
+            
+        default:
+            {
+            SVPDEBUG1(
+            "CSVPHoldOutEstablishingState::DefineDefaultCaseStateChange" );
+             return KErrNone;
+            }
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutEstablishingState::ResolveStateFromSendRecvIndex
+// ---------------------------------------------------------------------------
+//
+TInt CSVPHoldOutEstablishingState::
+ResolveStateFromSendRecvIndex( KSVPHoldAttributeIndex aNeededAttribute,
+                               TSVPHoldStateIndex& aNextState )
+    {
+    SVPDEBUG1( "CSVPHoldOutEstablishingState::ResolveStateFromSendRecvIndex" );
+    switch ( aNeededAttribute )
+        {
+        case KSVPHoldRecvonlyIndex:
+            {
+            aNextState = KSVPHoldOutStateIndex;
+            return KErrNone;
+            }
+
+        case KSVPHoldInactiveIndex:
+            {
+            aNextState = KSVPHoldDHStateIndex;
+            return KErrNone;
+            }
+
+        case KSVPHoldSendonlyIndex:
+            {
+            aNextState = KSVPHoldInStateIndex;
+            return KErrNone;
+            }
+        
+        default:
+            {
+            SVPDEBUG1(
+            "CSVPHoldOutEstablishingState::CheckAttributeL - Last default" );
+            return KErrNone;
+            }
+        }
+    }    
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/src/svpholdoutstate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,284 @@
+/*
+* 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:  Local holded state for hold state machine.
+*
+*/
+
+
+#include    <badesca.h>
+#include    <mcesession.h>
+#include    <mcertpsource.h>
+#include    <mcertpsink.h>
+#include    <mcemediastream.h>
+#include    <mceaudiostream.h>
+#include    "svpholdoutstate.h"
+#include    "svpholdcontext.h"
+#include    "svpholdcontroller.h"
+#include    "svpholdobserver.h"
+#include    "svpholdattributehandler.h"
+#include    "svpholdmediahandler.h"
+#include    "svplogger.h"
+
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutState::CSVPHoldOutState
+// ---------------------------------------------------------------------------
+CSVPHoldOutState::CSVPHoldOutState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutState::NewLC
+// ---------------------------------------------------------------------------
+CSVPHoldOutState* CSVPHoldOutState::NewLC()
+    {
+    CSVPHoldOutState* self = new ( ELeave ) CSVPHoldOutState;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutState::~CSVPHoldOutState
+// ---------------------------------------------------------------------------
+CSVPHoldOutState::~CSVPHoldOutState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutState::DoApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldOutState::DoApplyL( CSVPHoldContext& aContext )
+    {
+    SVPDEBUG1( "CSVPHoldOutState::DoApply" );
+    CMceSession* session = aContext.SessionObject();
+    const RPointerArray< CMceMediaStream >& streams = session->Streams();
+    TSVPHoldStateIndex nextState = KSVPHoldEstablishingStateIndex;
+    
+    TInt audioStreamsHandled = 0;
+    TInt streamCount = streams.Count();
+    SVPDEBUG2( "CSVPHoldÓutState::DoApply - stream count = %i", streamCount ); 
+
+    for ( TInt i = 0; i < streamCount; i++ )
+        {
+        CMceMediaStream* mediaStream = streams[ i ];
+        TMceMediaType mediaType = mediaStream->Type();
+        if ( KMceAudio == mediaType )
+            {
+            // This media is audio stream. Handling depends on the request
+            SVPDEBUG2( "CSVPHoldOutState::DoApply - Hold request is = %i",
+                        aContext.HoldRequest() );
+
+            nextState = PerformRequestL( aContext, *mediaStream, *session );
+            audioStreamsHandled++;                
+            }
+        }
+    
+    if ( 0 == audioStreamsHandled )
+        {
+        SVPDEBUG1(
+        "CSVPHoldOutState::DoApply - No audio streams found!" );
+        User::Leave( KErrSVPHoldStateError );
+        }
+        
+    if ( aContext.ForceHoldOccured() )
+        {
+        nextState = KSVPHoldConnectedStateIndex;
+        aContext.SetForceHold( EFalse ); 
+        }
+
+    aContext.SetCurrentStateL( aContext, nextState );
+    SVPDEBUG1( "CSVPHoldOutState::DoApply - Handled" );    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutState::PerformRequestL
+// ---------------------------------------------------------------------------
+//
+TSVPHoldStateIndex 
+CSVPHoldOutState::PerformRequestL( CSVPHoldContext& aContext,
+                                   CMceMediaStream& aMediaStream,
+                                   CMceSession& aSession )
+    {
+    TSVPHoldStateIndex nextState = KSVPHoldEstablishingStateIndex;
+    switch ( aContext.HoldRequest() )
+        {
+        case ESVPLocalResume:
+            {
+            ResumeSessionLocallyL( aContext, aMediaStream, aSession );
+            break;
+            }
+
+        case ESVPRemoteDoubleHold:
+            {
+            RemoteSessionDoubleHoldL( aContext, aMediaStream, aSession );
+            break;
+            }                    
+            
+        case ESVPLocalHold:
+        case ESVPLocalDoubleHold:
+        case ESVPLocalDoubleHoldResume:
+        case ESVPRemoteHold:
+        case ESVPRemoteResume:
+        case ESVPRemoteDoubleHoldResume:
+            {
+            // Cannot occur in Out state
+            SVPDEBUG1( "CSVPHoldOutState::PerformRequestL - StateError" );
+            User::Leave( KErrSVPHoldStateError );                    
+            }
+
+        default:
+            {
+            // No state change needed:
+            nextState = KSVPHoldOutStateIndex;
+            
+            // Error in previous request solving
+            SVPDEBUG2( "CSVPHoldOutState::PerformRequestL - Error, request %i",
+                        aContext.HoldRequest() );
+                        
+            User::Leave( KErrSVPHoldStateError );
+            }               
+        }    
+
+    return nextState;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldOutState::ResumeSessionLocallyL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldOutState::ResumeSessionLocallyL( CSVPHoldContext& aContext,
+                                              CMceMediaStream& aMediaStream,
+                                              CMceSession& aSession )
+    {
+    SVPDEBUG1( "CSVPHoldOutState::ResumeSessionLocallyL - In" );
+
+    // Handle media stream:
+    aContext.MediaHandler().
+        PerformMediaActionL( aMediaStream,
+                             ESVPLocalResume );        		    
+
+    aSession.UpdateL();
+    SVPDEBUG1( "CSVPHoldOutState::ResumeSessionLocallyL - done" );    
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldOutState::RemoteSessionDoubleHoldL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldOutState::RemoteSessionDoubleHoldL( CSVPHoldContext& aContext,
+                                                 CMceMediaStream& aMediaStream,
+                                                 CMceSession& aSession )
+    {
+    SVPDEBUG1(
+    "CSVPHoldOutState::RemoteSessionDoubleHoldL - In" );
+    
+    MDesC8Array* attributeLines = aMediaStream.MediaAttributeLinesL();
+    CleanupDeletePushL( attributeLines );
+    
+    // Check that request has reasonable direction attribute:
+    TSVPHoldRequestType attribute =
+                  aContext.SolveRequestL( aSession,
+                                          attributeLines );
+
+    if ( ESVPNoType == attribute )
+        {
+        // Not hold request
+        SVPDEBUG1( "CSVPHoldOutState::RemoteSessionDoubleHoldL:");
+        SVPDEBUG1( "Not hold request" );
+        
+        User::Leave( KErrSVPHoldNotHoldRequest );
+        }
+    
+    CleanupStack::PopAndDestroy( attributeLines );
+    
+    // Handle media stream:
+    aContext.MediaHandler().
+        PerformMediaActionL( aMediaStream,
+                             ESVPRemoteDoubleHold );
+    
+    // Update session
+    aSession.UpdateL();
+    
+    SVPDEBUG1( "CSVPHoldOutState::RemoteSessionDoubleHoldL - done" );    
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPHoldOutState::DoEnter
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldOutState::DoEnter( CSVPHoldContext& aContext )
+    {
+    SVPDEBUG2( "CSVPHoldOutState::DoEnter - Request %i",
+                aContext.HoldRequest() );
+    
+    TInt err = KErrNone;
+    TRAP( err, aContext.MediaHandler().DisableAudioL( aContext ) );
+    
+    // succesfull action is informed to client
+    switch ( aContext.HoldRequest() )
+        {
+        case ESVPLocalHold:
+            {
+            SVPDEBUG1( 
+            "CSVPHoldOutState::DoEnter - LocalHold" );
+            if ( err )
+                {
+                aContext.HoldObserver().HoldRequestFailed();
+                }
+                
+            else
+                {
+                aContext.HoldObserver().SessionLocallyHeld();
+                }
+            
+            break;
+            }
+            
+        case ESVPRemoteDoubleHoldResume:
+            {
+            SVPDEBUG1(
+            "CSVPHoldOutState::DoEnter - ESVPRemoteDoubleHoldResume" );
+            if ( err )
+                {
+                //aContext.HoldObserver().ResumeRequestFailed();
+                }
+                
+            else
+                {
+                aContext.HoldObserver().SessionRemoteResumed();
+                }
+
+            break;            
+            }
+            
+        default:
+            {
+            // Nothing to do; occurs only with state rollback
+            SVPDEBUG1( "CSVPHoldOutState::DoEnter - Default" );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldOutState::IsOutEstablishingStateActive
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldOutState::IsOutEstablishingStateActive()
+    {
+    return EFalse;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svphold/src/svpholdstatebase.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,64 @@
+/*
+* 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 hold state machine state
+*
+*/
+
+
+// INCLUDE FILES
+#include    "svpholdstatebase.h"
+#include    "svpholdcontext.h" 
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSVPHoldStateBase::CSVPHoldStateBase
+// ---------------------------------------------------------------------------
+CSVPHoldStateBase::CSVPHoldStateBase()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldStateBase::~CSVPHoldStateBase
+// -----------------------------------------------------------------------------   
+CSVPHoldStateBase::~CSVPHoldStateBase()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldStateBase::ApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldStateBase::ApplyL( CSVPHoldContext& aContext )
+    {
+    DoApplyL( aContext );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldStateBase::Enter
+// ---------------------------------------------------------------------------
+//
+void CSVPHoldStateBase::Enter( CSVPHoldContext& aContext )
+    {
+    DoEnter( aContext );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPHoldStateBase::IsOutEstablishingStateActive
+// ---------------------------------------------------------------------------
+//
+TBool CSVPHoldStateBase::IsOutEstablishingStateActive()
+    {
+    return EFalse;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/inc/svptransferacceptedstate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,77 @@
+/*
+* 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:  Transfer state representing the accepted state
+*
+*/
+
+
+#ifndef SVPTRANSFERACCEPTEDSTATE_H
+#define SVPTRANSFERACCEPTEDSTATE_H
+
+#include "svptransferstatebase.h"
+#include "svputdefs.h"
+
+/**
+ *  Transfer accepted state
+ *
+ *  Handles logic concerning accepted state
+ *
+ *  @lib svp.dll
+ *  @since Series 60 3.2
+ */
+class CSVPTransferAcceptedState : public CSVPTransferStateBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSVPTransferAcceptedState* NewLC();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CSVPTransferAcceptedState();
+
+protected:
+
+// from base class CSVPTransferStateBase
+    
+    /**
+     * From CSVPTransferStateBase. Apply concrete state.
+     */
+    void DoApplyL( CSVPTransferStateContext& aContext );
+
+    /**
+     * From CSVPTransferStateBase. Called when the state is entered.
+     */
+    void DoEnter( CSVPTransferStateContext& aContext );
+
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CSVPTransferAcceptedState();
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+		
+    };
+
+#endif // SVPTRANSFERACCEPTEDSTATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/inc/svptransfercontroller.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,300 @@
+/*
+* 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:  Transfer controller class for blind and attended transfers
+*
+*/
+
+
+
+#ifndef SVPTRANSFERCONTROLLER_H
+#define SVPTRANSFERCONTROLLER_H
+
+#include <e32base.h>
+#include <mccpcall.h>                       // MCCPCall
+#include <mccptransferprovider.h>           // MCCPTransferProvider
+#include <mccptransferobserver.h>           // MCCPTransferObserver
+#include "svputdefs.h"
+
+class CSVPController;
+class CSVPSessionBase;
+class CMceSession;
+class TMceTransactionDataContainer;
+class CMceRefer;
+class CMceInRefer;
+class CMceEvent;
+class CSVPTransferStateContext;
+class MSVPTransferObserver;
+
+/**
+ *  Transfer controller
+ *
+ *  Handles blind and attended transfers
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPTransferController : public CBase,
+                               public MCCPTransferProvider
+    {
+
+public: // New methods
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSVPTransferController* NewL(
+                        CMceSession* aMceSession,
+                        CSVPSessionBase* aSVPSession,
+                        TMceTransactionDataContainer& aContainer, 
+                        MSVPTransferObserver& aObserver );
+
+    static CSVPTransferController* NewLC( 
+                        CMceSession* aMceSession,
+                        CSVPSessionBase* aSVPSession,
+                        TMceTransactionDataContainer& aContainer, 
+                        MSVPTransferObserver& aObserver );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CSVPTransferController();
+
+    /**
+     * Handle mce event state changes.
+     * The state of the event has changed.
+     * @since S60 3.2
+     * @param aEvent, event which state changed.
+     * @param aStatusCode, status code.
+     */
+    void HandleEventStateChangedL( CMceEvent& aEvent,
+				                  TInt aStatusCode );
+
+    /**
+     * Handle mce event observer notify events.
+     * The state of the event has changed.
+     * @since S60 3.2
+     * @param aEvent, event received notification.
+     * @param aContainer, if present, holds details of
+     *        transaction causing state change.
+     */
+    void NotifyReceivedL( CMceEvent& aEvent,
+                         TMceTransactionDataContainer* aContainer );
+
+    /**
+     * Handle the refer state change events.
+     * @since S60 3.2
+     * @param aRefer, the refer that has changed.
+     * @param aStatusCode, status code
+     */
+    void HandleReferStateChangeL( CMceRefer& aRefer,
+				                  TInt aStatusCode );
+
+    /**
+     * New incoming refer received.
+     * @since S60 3.2
+     * @param aRefer, the new inbound refer. Ownership is
+	 *        transferred.
+     * @param aReferTo SIP specific Refer-to header 
+     */
+    void IncomingReferL( CMceInRefer* aRefer, 
+                        const TDesC8& aReferTo,
+                        TMceTransactionDataContainer* aContainer );
+    
+				                  
+    /**
+     * Checks the MCE refer object.
+     * @since S60 3.2
+     * @param aRefer - refer to check
+     * @return TBool true if same MCE refer object
+     */
+    TBool IsMceRefer( CMceRefer& aRefer );
+    
+    /**
+     * Checks if transfer is attended or unattended.
+     * @since S60 3.2
+     * @return TBool true if attended case
+     */
+    TBool IsAttended( );
+
+    /**
+    * Set transfer data. Add Replaces and Referred-By headers.
+    * Update transfer target url to sips: if secure status 1 or 2,
+    * otherwise url updated to sip:
+    * @since S60 3.2
+    * @param aUserAgentHeaders On completion contains collected transfer headers.
+    * @param aSecureStatus secure status
+    */
+    void SetTransferDataL( CDesC8Array* aUserAgentHeaders, TInt aSecureStatus );
+
+    /**
+    * Sets the reference to the sip (mce) session object
+    * @since S60 3.2
+    * @param aSession The session object
+    * @return None
+    */
+    void SetMceSessionObject( CMceSession* aSession );
+
+    /**
+    * Send notify using the MCE event object
+    * @since S60 3.2
+    * @param aStatusCode code came from mce
+    */
+    void SendNotifyL( TInt aStatusCode );
+    
+    /**
+    * Check if ingoming transfer is ongoing
+    * @since S60 3.2
+    * @return TBool true if incoming transfer case
+    */
+    TBool IsIncomingTransfer();
+    
+    /**
+    * Terminate transfer due refer timer timeout
+    * @since S60 3.2
+    */
+    void TerminateTransfer();
+
+    /**
+    * The Leaving version of TerminateTransfer
+    * @since S60 3.2
+    */
+    void TerminateTransferL();
+
+public: // From MCCPTransferProvider
+
+    /**
+    * Attended transfer to given call recipient.
+    * There exist a call between A-B and A-C. A wants to transfer the call to B-C. 
+    * A itself will not be inline in case the transfer is made succesfully. 
+    * In above case C will be the aTransferTargetCall. B is the recipient of the 
+    * current call between A-B - called on A's call object transfer provider. 
+    * The A-B call is on hold.
+    * @since S60 3.2
+    * @param aTransferTargetCall - target receiver of the transferred call. 
+    *        In this case there exist a call 
+    * @return In case of an immediate error returns system error code,
+    *       if request has been started returns KErrNone.
+    */
+    TInt AttendedTransfer( MCCPCall& aTransferTargetCall );
+
+    /**
+    * Attended transfer to given address. There does not need to be 
+    * a current call between the given transfer target.
+    * @since S60 3.2
+    * @param aTransferTarget - transfer target address
+    * @return In case of an immediate error returns system error code,
+    *       if request has been started returns KErrNone.
+    */
+    TInt AttendedTransfer( const TDesC& aTransferTarget );
+
+    /**
+	* Unattended transfer. Call is requested to be transferred to given address.
+    * @since S60 3.2
+    * @param aTarget Address of the target
+    * @return In case of an immediate error returns system error code,
+    *       if request has been started returns KErrNone.
+    */
+    TInt UnattendedTransfer( const TDesC& aTransferTarget );
+
+    /**
+    * Notifies call about transfer status.
+    * @since S60 3.2
+    * @param aAccept Boolean value is transfer accepted or not.
+    * @return In case of an immediate error returns system error code,
+    *       if request has been started returns KErrNone.
+    */
+    TInt AcceptTransfer( const TBool aAccept );
+
+    /**
+    * When the other end of the call has requested call transfer to third party it is notified to 
+    * CCPCallCall::EventOccurred(ECCPRemoteTransferring).
+    * The new recipient of the call can be fetched via this method.
+    * @since S60 3.2
+    * @param none
+    * @return New recipient for the call after transfer
+    */
+    const TDesC& TransferTarget() const;
+
+    /**
+    * Add an observer for transfer related events.
+    * Plug-in dependent feature if duplicates or more than one observers 
+    * are allowed or not. Currently CCE will set only one observer.
+    * @since S60 v3.2
+    * @param aObserver Observer
+    * @return none
+    * @leave system error if observer adding fails
+    */
+    void AddObserverL( const MCCPTransferObserver& aObserver );
+
+    /**
+    * Remove an observer.
+    * @since S60 v3.2
+    * @param aObserver Observer
+    * @return KErrNone if removed succesfully. KErrNotFound if observer was not found.
+    */
+    TInt RemoveObserver( const MCCPTransferObserver& aObserver );
+	  
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CSVPTransferController();
+    
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL( CMceSession* aMceSession,
+                     CSVPSessionBase* aSVPSession,                     
+                     TMceTransactionDataContainer& aContainer,
+                     MSVPTransferObserver& aObserver );
+
+    /**
+    * Private transfer functionality.
+    * @since S60 3.2
+    * @param aAccept Boolean value is transfer accepted or not.
+    */
+    void TransferL( MCCPCall* aCall, 
+                    const TDesC& aTarget, 
+                    const TBool aAttendedTransfer );
+    
+
+private: // data
+
+    /**
+     * Transfer state context.
+     * Own.
+     */
+    CSVPTransferStateContext* iTransferContext;
+    
+    /**
+    * Transfer observer
+    */
+    MCCPTransferObserver* iCCPTransferObserver; 
+
+    /**
+     * 202 Accepted to the refer received, waiting still the notify
+     */
+    TBool iAccepted;      
+    
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+		
+    };
+
+#endif // CSVPTRANSFERCONTROLLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/inc/svptransferidlestate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,78 @@
+/*
+* 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:  Transfer state representing the idle state
+*
+*/
+
+
+
+#ifndef SVPTRANSFERIDLESTATE_H
+#define SVPTRANSFERIDLESTATE_H
+
+#include "svptransferstatebase.h"
+#include "svputdefs.h"
+
+/**
+ *  Transfer idle state
+ *
+ *  Handles logic concerning idle state
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPTransferIdleState : public CSVPTransferStateBase
+    {
+
+public:
+
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPTransferIdleState* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPTransferIdleState();
+
+protected:
+
+// from base class CSVPTransferStateBase
+    
+    /**
+    * From CSVPTransferStateBase. Apply concrete state.
+    */
+    void DoApplyL( CSVPTransferStateContext& aContext );
+
+    /**
+    * From CSVPTransferStateBase. Called when the state is entered.
+    */
+    void DoEnter( CSVPTransferStateContext& aContext );
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPTransferIdleState();
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif // SVPTRANSFERIDLESTATE_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/inc/svptransferobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,62 @@
+/*
+* 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:  SVP transfer observer interface
+*
+*/
+
+
+#ifndef SVPTRANSFEROBSERVER_H
+#define SVPTRANSFEROBSERVER_H
+
+#include <e32base.h>
+
+enum TSVPTransferNotifyCode
+    {
+    ESVPTransferOKHangUp,
+    ESVPTransferDecline,
+    ESVPIncomingRefer
+    };
+    
+/**
+ *  Transfer observer
+ *
+ *  An interface to be implemented by user of the transfer controller.
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class MSVPTransferObserver
+    {
+    
+public:  
+
+    /**
+     * Notifier for transfer.
+     *
+     * @since S60 3.2
+     * @param aNotifyCode transfer notify code
+     */
+    virtual void TransferNotification( TInt aNotifyCode ) = 0;    
+				
+    /**
+     * Notifier for transfer failure.
+     *
+     * @since S60 3.2
+     * @param aError transfer error code
+     */
+    virtual void TransferFailed( TInt aError ) = 0;
+				
+    };
+
+#endif // SVPTRANSFEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/inc/svptransferpendingstate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,78 @@
+/*
+* 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:  Transfer state representing the pending state
+*
+*/
+
+
+#ifndef SVPTRANSFERPENDINGSTATE_H
+#define SVPTRANSFERPENDINGSTATE_H
+
+#include "svptransferstatebase.h"
+#include "svputdefs.h"
+
+/**
+ *  Transfer pending state
+ *
+ *  Handles logic concerning pending state
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPTransferPendingState : public CSVPTransferStateBase
+    {
+
+public:
+
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPTransferPendingState* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPTransferPendingState();
+
+protected:
+
+// from base class CSVPTransferStateBase
+    
+    /**
+    * From CSVPTransferStateBase. Apply concrete state.
+    */
+    void DoApplyL( CSVPTransferStateContext& aContext );
+
+    /**
+    * From CSVPTransferStateBase. Called when the state is entered.
+    */
+    void DoEnter( CSVPTransferStateContext& aContext );
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPTransferPendingState();
+
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+		
+    };
+
+#endif // SVPTRANSFERPENDINGSTATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/inc/svptransferstatebase.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Transfer state base class for different transfer states
+*
+*/
+
+
+#ifndef SVPTRANSFERSTATEBASE_H
+#define SVPTRANSFERSTATEBASE_H
+
+#include <e32base.h>
+
+class CSVPTransferStateContext;
+
+/**
+ *  Transfer state base class
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPTransferStateBase : public CBase
+    {
+
+public: // Constructors and destructor
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CSVPTransferStateBase();
+    
+public: // New functions
+
+    /**
+     * Applies the current state. Called after the state transition.
+     * Leaves on error.
+     * @since S60 3.2
+     * @param aContext SVP Transfer context
+     */
+    void ApplyL( CSVPTransferStateContext& aContext );
+    
+    /**
+     * Called when the state is entered, before it is applied.
+     *
+     * @since S60 3.2
+     * @param aContext SVP Transfer context
+     */
+    void Enter( CSVPTransferStateContext& aContext );
+
+
+protected: // New functions
+
+    /**
+     * Applies the current concrete state. Leaves on error.
+     * Implemented by the concrete states.
+     *
+     * @since S60 3.2
+     * @param aContext SVP Transfer context
+     */
+    virtual void DoApplyL( CSVPTransferStateContext& aContext ) = 0;
+
+    /**
+     * Called when the state is entered. Implemented by the concrete states.
+     *
+     * @since S60 3.2
+     * @param aContext SVP Transfer context
+     */  
+    virtual void DoEnter( CSVPTransferStateContext& aContext ) = 0;
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPTransferStateBase();
+ 
+    };
+
+#endif // SVPTRANSFERSTATEBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/inc/svptransferstatecontext.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,566 @@
+/*
+* 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:  Transfer state context class for state machine logic
+*
+*/
+
+
+#ifndef SVPTRANSFERSTATECONTEXT_H
+#define SVPTRANSFERSTATECONTEXT_H
+
+#include <e32base.h>
+#include <badesca.h>                // CDesC8ArrayFlat
+#include "svputdefs.h"
+
+class CSVPController;
+class CSVPSessionBase;
+class CSVPTransferStateBase;        // iCurrentState
+class MSVPTransferObserver;         // iTransferObserver    
+class CMceSession;
+class TMceTransactionDataContainer; // iContainer
+class CMceRefer;                    // iMceRefer
+class CMceEvent;                    // iMceEvent
+
+typedef TInt TSVPTransferStateIndex;
+
+const TInt KSVPTransferStateArraySize = 5;
+const TInt KSVPHeaderArrayGranularity = 2;
+
+// State indices.
+const TSVPTransferStateIndex KSVPTransferIdleStateIndex         = 0;
+const TSVPTransferStateIndex KSVPTransferPendingStateIndex      = 1;
+const TSVPTransferStateIndex KSVPTransferAcceptedStateIndex     = 2;
+const TSVPTransferStateIndex KSVPTransferTerminatingStateIndex  = 3;
+const TSVPTransferStateIndex KSVPTransferTerminatedStateIndex   = 4;
+
+// Error codes
+const TInt KSVPErrTransferErrorBase = -2300;
+const TInt KSVPErrTransferStateError = KSVPErrTransferErrorBase - 1;
+const TInt KSVPErrTransferInProgress = KSVPErrTransferErrorBase - 2;
+const TInt KSVPErrTransferReferCreate = KSVPErrTransferErrorBase - 3;
+const TInt KSVPErrTransferApplyState = KSVPErrTransferErrorBase - 4;
+const TInt KSVPErrTransferReferStatusCodeNotHandled = 
+                                        KSVPErrTransferErrorBase - 5;
+const TInt KSVPErrTransferParamRefer = KSVPErrTransferErrorBase - 6;
+const TInt KSVPErrTransferReferTo = KSVPErrTransferErrorBase - 7;
+
+
+
+/**
+ *  Transfer state contexts.
+ *
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPTransferStateContext : public CBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSVPTransferStateContext* NewL( 
+                                CMceSession* aMceSession,
+                                CSVPSessionBase* aSVPSession,
+                                TMceTransactionDataContainer& aContainer, 
+                                MSVPTransferObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CSVPTransferStateContext();
+    
+    /**
+     * Sets the current state for the context.
+     * @since S60 3.2
+     * @param aNewState New current state
+     * @return Leaves with Error code if state transition is not
+     *          acceptable.
+     */
+    void SetCurrentStateL( TSVPTransferStateIndex aNewState );
+
+    /**
+     * Returns the current state of the context
+     * @since S60 3.2
+     * @return TSVPTransferStateIndex Index to the current state.
+     */
+    TSVPTransferStateIndex CurrentState() const;
+
+    /**
+     * Applies the current state of the contex. This causes a
+     * state transition to next state of the state machine. The 
+     * current state sets the next state. Leaves on error
+     * @since S60 3.2
+     */
+    void ApplyCurrentStateL();
+               
+    /**
+     * Returns reference to the transfer observer.
+     * @since S60 3.2
+     * @return Reference to the transfer observer
+     */    
+    MSVPTransferObserver& TransferObserver();
+       
+    /**
+    * Sets the reference to the sip (mce) session object
+    * @param aSession The session object
+    * @return None
+    */
+    void SetMceSessionObject( CMceSession* aSession );
+                       
+    /**
+    * Returns the sip (mce) session object.
+    * @since S60 3.2
+    * @return The sip (mce) session object
+    */
+    CMceSession* MceSessionObject();
+    
+    /**
+     * Sets the MCE refer object.
+     * @since Series 60 3.2
+     * @param aRefer New received refer
+     */
+    void SetMceRefer( CMceRefer* aRefer );
+    
+    /**
+     * Returns pointer to the MCE refer object.
+     * @since S60 3.2
+     * @return Pointer to the MCE refer object
+     */
+    CMceRefer* MceRefer();
+
+    /**
+     * Check if attended or unattended transfer.
+     * @since S60 3.2
+     * @return Boolean true (=attended) or false
+     */
+    TBool IsAttended();
+
+    /**
+     * Check if session is on remote hold. If yes, this is Snom or EyeBeam
+     * as unattended transferer case and we send OK notify
+     * to proceed unattended transfer.
+     * @since S60 3.2
+     * @return TBool true if session is remote hold
+     */
+    TBool CheckIsSessionRemoteHold();
+
+    /**
+    * Set transfer data. Add Replaces and Referred-By headers.
+    * Update transfer target url to sips: if secure status 1 or 2,
+    * otherwise url updated to sip:
+    * @since S60 3.2
+    * @param aUserAgentHeaders On completion contains collected transfer headers.
+    * @param aSecureStatus secure status
+    */
+    void SetTransferDataL( CDesC8Array* aUserAgentHeaders, TInt aSecureStatus );
+
+    /**
+     * Set attended/unattended.
+     * @since S60 3.2
+     * @param aAttended boolean true (=attended) or false
+     */
+    void SetAttended( const TBool aAttended );
+
+    /**
+     * Check if incoming transfer.
+     * @since S60 3.2
+     * @return Boolean true (=incoming) or false
+     */
+    TBool IsIncoming();
+
+    /**
+     * Set incoming "refer to" -string.
+     * @since S60 3.2
+     * @param aReferTo Reference to the string
+     */    
+    void SetIncomingReferToL( const TDesC8& aReferTo );
+
+	/**
+	* Sets the Referred-By data
+	* @since S60 3.2
+	* @param aReferredBy reference to the Referred-By data to store
+	*/
+    void SetIncomingReferredByL( const TDesC8& aReferredBy );
+
+    /**
+     * Return incoming "Referred By" -string.
+     * @since S60 3.2
+     * @return Reference to the string
+     */    
+    const TDesC& IncomingReferredBy();
+    
+    /**
+     * Return incoming "refer to" -string.
+     * @since S60 3.2
+     * @return Reference to the string
+     */    
+    const TDesC& IncomingReferTo();
+
+    /**
+     * Reset/clear incoming "refer to" -string.
+     * @since S60 3.2
+     */    
+    void ResetIncomingReferTo();       
+
+    /**
+     * Reset/clear incoming "Referred-By" -string.
+     * @since S60 3.2
+     */    
+    void ResetIncomingReferredBy();       
+
+    /**
+     * Set incoming "Replaces" -string.
+     * @since S60 3.2
+     * @param aString Reference to the string
+     */    
+    void SetIncomingReplacesL( const TDesC8& aString );
+
+    /**
+     * Return incoming "Replaces" -string.
+     * @since S60 3.2
+     * @return Reference to the string
+     */    
+    const TDesC& IncomingReplaces();
+    
+    /**
+     * Reset/clear incoming "Replaces" -string.
+     * @since S60 3.2
+     */    
+    void ResetIncomingReplaces();       
+    
+    /**
+     * Store the parameters for the mce out refer.
+     * @since S60 3.2
+     * @param aTargetSession target receiver of the transferred call, 
+     * null if address is given. 
+     * @param aTarget transfer target address, KNullDesC if call is given.
+     * @param aAttendedTransfer boolean true if attended transfer.
+     */
+    void SetTransferParmsL( CSVPSessionBase* aTargetSession, 
+                            const TDesC& aTarget,
+                            const TBool aAttendedTransfer );
+
+    /**
+     * Execute the refer, creates mce out event.
+     * @since S60 3.2
+     * @return KErrNone if ok, SVP transfer error on failure
+     */
+    void ExecuteReferL();
+
+    /**
+     * Sets the MCE event object.
+     * @since Series 60 3.2
+     * @param aEvent New received event
+     */
+    void SetMceEvent( CMceEvent* aEvent );
+    
+    /**
+     * Returns pointer to the MCE event object.
+     * @since S60 3.2
+     * @return Pointer to the MCE event object
+     */
+    CMceEvent* MceEvent();   
+    
+    /**
+     * Stop the refer timer.
+     * @since Series 60 3.2
+     */
+    void StopReferTimer();
+    
+    
+protected:  // New functions
+       
+    /**
+     * Creates the states belonging to this context
+     * @since S60 3.2
+     */
+    void InitializeStateArrayL();
+
+    /**
+     * Check if state transition to a new state is acceptable.
+     * @since S60 3.2
+     * @param aStateIndex New state to enter
+     * @return Boolean value, is the transition valid.
+     */
+    TBool IsStateTransitionAccepted( 
+                            const TSVPTransferStateIndex aStateIndex );
+
+    /**
+     * C++ default constructor.
+     */
+    CSVPTransferStateContext( CMceSession* aMceSession,
+                              CSVPSessionBase* aSVPSession,                              
+                              TMceTransactionDataContainer& aContainer, 
+                              MSVPTransferObserver& aObserver );
+    
+    /**
+     * By default Symbian 2nd phase constructor is private. 
+     * Now it is protected.
+     */ 
+    void ConstructL();
+
+  
+private: // New Functions
+
+    /**
+     * Set up headers for refer call.
+     * @since S60 3.2
+     * @return Pointer to the new created headers data     
+     */
+    CDesC8Array* SetupHeadersL();
+    
+    /**
+     * Create mce out refer using target address.
+     * @since S60 3.2
+     * @param aTarget Address of the target. 
+     */
+    void CreateMceOutReferL( const TDesC& aTarget );
+
+    /**
+     * Create mce out refer using session.
+     * @since S60 3.2
+     * @param aTargetSession Pointer to the target session.      
+     */
+    void CreateMceOutReferL( CSVPSessionBase* aTargetSession );
+
+    /**
+    * Method for completing referTo
+    * @since Series 60 3.2
+    * @param aReferTo referto
+    * @return HBufC8* constructed aReferTo
+    */
+    HBufC8* CompleteReferToL( const TDesC8& aReferTo );
+
+    /**
+    * Method for completing referred by
+    * @since Series 60 3.2
+    * @param aReferredBy Referred By
+    * @return HBufC8* constructed aReferredBy
+    */
+    HBufC8* CompleteReferredByL( const TDesC8& aReferredBy );
+
+    /**
+    * Method for completing Replaces
+    * @since Series 60 3.2
+    * @param aString Replaces string
+    * @return HBufC8* constructed Replaces string
+    */
+    HBufC8* CompleteReplacesL( const TDesC8& aString );
+
+    /**
+    * Checks, if the URI given as parameter has
+    * the "<" character.
+    * @since S60 3.2
+    * @param aUri The URI to be checked, non-modifiable descriptor.
+    * @return TInt, position of the character,
+    *         KErrNotFound, if not found.
+    */
+    TInt CheckLeftBracket( const TDesC8& aUri ) const;
+
+    /**
+    * Removes the "<" character and all characters 
+    * before the position from the URI given as parameter.
+    * @since S60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @param aPosition, position of string.
+    * @return None
+    */
+    void RemoveLeftBracket( HBufC8*& aUri, TInt aPosition ) const;
+
+    /**
+    * Checks, if the URI given as parameter has
+    * the ">" character.
+    * @since S60 3.2
+    * @param aUri The URI to be checked, non-modifiable descriptor.
+    * @return TInt, position of the character,
+    *         KErrNotFound, if not found.
+    */
+    TInt CheckRightBracket( const TDesC8& aUri ) const;
+
+    /**
+    * Removes the all characters from the URI after the position.
+    * @since S60 3.2
+    * @param aUri, the URI to be altered, modifiable descriptor.
+    * @param aPosition, position where removing starts.
+    * @return None
+    */
+    void CutStringFromPosition( HBufC8*& aUri, TInt aPosition ) const;
+
+    /**
+    * Checks, if the URI given as parameter has
+    * the "?X-Sipx-Authidentity=" string.
+    * Some server might add that to Refer-To header.
+    * @since S60 3.2
+    * @param aUri The URI to be checked, non-modifiable descriptor.
+    * @return TInt, position of the character,
+    *         KErrNotFound, if not found.
+    */
+    TInt CheckAuthidentity( const TDesC8& aUri ) const;
+
+    /**
+    * Checks, if the URI given as parameter has the "?Replaces=" text.
+    * @since S60 3.2
+    * @param aUri The URI to be checked, non-modifiable descriptor.
+    * @return TInt, position of the chareacter,
+    *         KErrNotFound, if not found.
+    */
+    TInt CheckReplacesTxt( const TDesC8& aUri ) const;
+
+    /**
+    * Checks, if the URI given as parameter has the "Referred-By:" text.
+    * @since S60 3.2
+    * @param aReferredBy The URI to be checked, non-modifiable descriptor.
+    * @return TInt, position of the chareacter,
+    *         KErrNotFound, if not found.
+    */
+    TInt CheckReferredByTxt( const TDesC8& aReferredBy ) const;
+
+    /**
+    * Removes the "Referred-By:" text
+    * @since S60 3.2
+    * @param aReferredBy The text to be altered, modifiable descriptor.
+    * @param aPosition, position of string.
+    * @return None
+    */
+    void RemoveReferredByTxt( HBufC8*& aReferredBy, TInt aPosition ) const;
+
+    /**
+    * Take the "?Replaces=" text and text after it.
+    * @since S60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @param aPosition, position of string.
+    * @return None
+    */
+    void TakeReplacesTxt( HBufC8*& aString, TInt aPosition ) const;
+
+    /**
+    * Checks, if the URI given as parameter has
+    * the ";user=phone" text.
+    * @since S60 3.2
+    * @param aUri The URI to be checked, non-modifiable descriptor.
+    * @return TInt, position of the chareacter,
+    *         KErrNotFound, if not found.
+    */
+    TInt CheckUserEqualsPhone( const TDesC8& aUri ) const;
+
+    /**
+    * Removes the ";user=phone" text and text after it.
+    * @since S60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @param aPosition, position of string.
+    * @return None
+    */
+    void RemoveUserEqualsPhone( HBufC8*& aUri, TInt aPosition ) const;
+
+    /**
+    * Removes all extra parameters from given address
+    * @since S60 3.2
+    * @param aUri The URI to be altered, modifiable descriptor.
+    * @return None
+    */
+    void RemoveExtraParameters( HBufC8*& aUri ) const;
+
+    /**
+     * Update transfer target url to sips: if secure status 1 or 2.
+     * Otherwise url updated to sip:
+     * @since S60 3.2
+     * @param aSecureStatus secure status
+     */    
+    void UpdateTransferTargetL( TInt aSecureStatus );
+
+private: // data
+  
+    /**
+     * Pointer to the mce session object.
+     * Not own.
+     */    
+    CMceSession* iMceSession;
+
+    /**
+     * Pointer to the SVP session object.
+     * Not own.
+     */    
+    CSVPSessionBase* iSVPSession;
+
+    /**
+     * Pointer to the target of attended transfer.
+     * Not own.
+     */    
+    CSVPSessionBase* iTargetSession;
+
+    /**
+     * Data container for mce session.
+     */
+    TMceTransactionDataContainer& iContainer;
+
+    /**
+     * Reference to the transfer observer.
+     */    
+    MSVPTransferObserver& iTransferObserver;     
+   
+    /**
+     * Transfer state array.
+     * Own.
+     */
+    RPointerArray< CSVPTransferStateBase >* iStates;
+
+    /**
+     * State object pointer to indicate current state.
+     */
+    CSVPTransferStateBase* iCurrentState;
+   
+    /**
+     * Mce refer, either in (MT) or out (MO) type.
+     * Own. 
+     */
+    CMceRefer* iMceRefer;   
+
+    /**
+     * Mce event, either in (MT) or out (MO) type.
+     * Own. 
+     */
+    CMceEvent* iMceEvent;
+
+    /**
+     * Attended (consultative) / unattended (blind) transfer.
+     */
+    TBool iAttended;      
+   
+    /**
+     * Incoming "refer to" parameter string
+     * Indicates also the incoming refer handling.
+     */    
+    HBufC* iIncomingReferTo;
+   
+    /**
+     * Incoming "Referred By" parameter string
+     */    
+    HBufC* iIncomingReferredBy;
+    
+    /**
+     * Incoming "Replaces" parameter string
+     */    
+    HBufC* iIncomingReplaces;
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+    
+    };
+
+#endif // SVPTRANSFERSTATECONTEXT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/inc/svptransferterminatedstate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* 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:  Transfer state representing the terminated state
+*
+*/
+
+
+
+#ifndef SVPTRANSFERTERMINATEDSTATE_H
+#define SVPTRANSFERTERMINATEDSTATE_H
+
+#include "svptransferstatebase.h"
+#include "svputdefs.h"
+
+/**
+ *  Transfer terminated state
+ *
+ *  Handles logic concerning terminated state
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPTransferTerminatedState : public CSVPTransferStateBase
+    {
+
+public:
+
+    /**
+    * Two-phased constructor.
+    */
+    static CSVPTransferTerminatedState* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPTransferTerminatedState();
+
+protected:
+
+// from base class CSVPTransferStateBase
+    
+    /**
+    * From CSVPTransferStateBase. Apply concrete state.
+    */
+    void DoApplyL( CSVPTransferStateContext& aContext );
+
+    /**
+    * From CSVPTransferStateBase. Called when the state is entered.
+    */
+    void DoEnter( CSVPTransferStateContext& aContext );
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPTransferTerminatedState();
+
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+		
+    };
+
+#endif // SVPTRANSFERTERMINATEDSTATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/inc/svptransferterminatingstate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,76 @@
+/*
+* 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:  Transfer state representing the terminating state
+*
+*/
+
+
+#ifndef SVPTRANSFERTERMINATINGSTATE_H
+#define SVPTRANSFERTERMINATINGSTATE_H
+
+#include "svptransferstatebase.h"
+#include "svputdefs.h"
+
+/**
+ *  Transfer terminating state
+ *  Handles logic concerning terminating state
+ *
+ *  @lib svp.dll
+ *  @since S60 3.2
+ */
+class CSVPTransferTerminatingState : public CSVPTransferStateBase
+    {
+
+public:
+
+	/**
+    * Two-phased constructor.
+    */
+    static CSVPTransferTerminatingState* NewLC();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSVPTransferTerminatingState();
+
+protected:
+
+// from base class CSVPTransferStateBase
+
+    /**
+    * From CSVPTransferStateBase Apply concrete state
+    */
+    void DoApplyL( CSVPTransferStateContext& aContext );
+
+    /**
+    * From CSVPTransferStateBase Called when the state is entered.
+    */
+    void DoEnter( CSVPTransferStateContext& aContext );
+
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CSVPTransferTerminatingState();
+
+private:
+
+    // For testing
+    SVP_UT_DEFS
+		
+    };
+
+#endif // SVPTRANSFERTERMINATINGSTATE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/src/svptransferacceptedstate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,90 @@
+/*
+* 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:  Transfer state representing the accepted state
+*
+*/
+
+
+#include "svptransferacceptedstate.h"
+#include "svptransferstatecontext.h"            // CSVPTransferStateContext
+#include "svptransferobserver.h"                // MSVPTransferObserver
+#include "svplogger.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSVPTransferAcceptedState::CSVPTransferAcceptedState
+// ---------------------------------------------------------------------------
+//
+CSVPTransferAcceptedState::CSVPTransferAcceptedState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferAcceptedState::NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPTransferAcceptedState* CSVPTransferAcceptedState::NewLC()
+    {
+    CSVPTransferAcceptedState* self = new( ELeave ) CSVPTransferAcceptedState;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPTransferAcceptedState::~CSVPTransferAcceptedState
+// ---------------------------------------------------------------------------
+//
+CSVPTransferAcceptedState::~CSVPTransferAcceptedState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferAcceptedState::DoApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferAcceptedState::DoApplyL( CSVPTransferStateContext& aContext )
+    {
+    SVPDEBUG1( "CSVPTransferAcceptedState::DoApplyL In" )
+    
+    if ( KSVPTransferAcceptedStateIndex == aContext.CurrentState() )
+        {
+        // No need to notify the observer.
+        }
+    else
+        {
+        // Notify the observer about the error
+        aContext.TransferObserver().TransferFailed( KSVPErrTransferStateError );
+        }
+    
+    SVPDEBUG1( "CSVPTransferAcceptedState::DoApplyL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferAcceptedState::DoEnter
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferAcceptedState::DoEnter( 
+                                    CSVPTransferStateContext& /*aContext*/ )
+    {
+    SVPDEBUG1( "CSVPTransferAcceptedState::DoEnter" );
+    }
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/src/svptransfercontroller.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,813 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Transfer controller class, transfer is controlled through 
+*                this class
+*
+*/
+
+#include <mceinrefer.h>                     // CMceInRefer
+#include <mceinevent.h>                     // CMceEvent, CMceInEvent
+#include <mcetransactiondatacontainer.h>    // TMceTransactionDataContainer
+
+#include "svptransfercontroller.h"
+#include "svptransferstatecontext.h"
+#include "svplogger.h"
+#include "svpsessionbase.h"             // CSVPSessionBase
+#include "svpsipconsts.h"
+#include "svpconsts.h"
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::CSVPTransferController
+// ---------------------------------------------------------------------------
+//
+CSVPTransferController::CSVPTransferController() :
+    iTransferContext (NULL),
+    iCCPTransferObserver (NULL),
+    iAccepted( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferController::ConstructL( 
+                                CMceSession* aMceSession,
+                                CSVPSessionBase* aSVPSession,
+                                TMceTransactionDataContainer& aContainer, 
+                                MSVPTransferObserver& aObserver )
+    {
+    // Transfer state context
+    iTransferContext = CSVPTransferStateContext::NewL( 
+                                aMceSession, aSVPSession, 
+                                aContainer, aObserver );
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::NewL
+// ---------------------------------------------------------------------------
+//
+CSVPTransferController* CSVPTransferController::NewL( 
+                            CMceSession* aMceSession,
+                            CSVPSessionBase* aSVPSession,
+                            TMceTransactionDataContainer& aContainer, 
+                            MSVPTransferObserver& aObserver )
+    {
+    CSVPTransferController* self = CSVPTransferController::NewLC( 
+                                        aMceSession, 
+                                        aSVPSession,
+                                        aContainer,
+                                        aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPTransferController* CSVPTransferController::NewLC( 
+                            CMceSession* aMceSession,
+                            CSVPSessionBase* aSVPSession,
+                            TMceTransactionDataContainer& aContainer, 
+                            MSVPTransferObserver& aObserver )
+    {
+    CSVPTransferController* self = new( ELeave ) CSVPTransferController;
+    CleanupStack::PushL( self );
+    self->ConstructL( aMceSession, aSVPSession, aContainer, aObserver );
+    return self;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::~CSVPTransferController
+// ---------------------------------------------------------------------------
+//
+CSVPTransferController::~CSVPTransferController()
+    {
+    delete iTransferContext;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// Handle mce event observer notify events. 
+// The state of the event has changed.
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferController::HandleEventStateChangedL( 
+                            CMceEvent& /* aEvent */,
+                            TInt aStatusCode )
+    {
+    if ( KSVPOKVal == aStatusCode )
+        {
+        if ( iTransferContext->IsAttended() )
+            {
+            SVPDEBUG1( "CSVPTransferController::HandleEventStateChangedL: KSVPOKVal & attended" );
+            if ( KSVPTransferAcceptedStateIndex == iTransferContext->CurrentState())
+                {
+                // F25 OK received - already acccepted 
+                // leave for not to create new session later
+                SVPDEBUG1( "CSVPTransferController::HandleEventStateChangedL: transfer in progress");
+                User::Leave( KSVPErrTransferInProgress );
+                }
+
+            // F18 OK received as response for "trying"
+            // Set and apply the next state - accepted
+            iTransferContext->SetCurrentStateL( KSVPTransferAcceptedStateIndex );
+            iTransferContext->ApplyCurrentStateL();
+            SVPDEBUG1( "CSVPTransferController::HandleEventStateChangedL:ApplyCurrentStateL done" );
+            }
+        else    // unattended transfer
+            {
+            SVPDEBUG1( "CSVPTransferController::HandleEventStateChangedL: KSVPOKVal unattended" );
+            if ( iTransferContext->CheckIsSessionRemoteHold() &&
+                 KSVPTransferAcceptedStateIndex == iTransferContext->CurrentState() )
+                {
+                // Transferer has put transferee on hold before sending refer
+                SVPDEBUG1( "CSVPTransferController::HandleEventStateChangedL: Snom or similar as transferer" );
+                SendNotifyL( aStatusCode ); // 200 OK
+                }
+            }
+        }
+    else
+        {
+        SVPDEBUG2("CSVPTransferController::HandleEventStateChangedL: aStatusCode = %d",
+              aStatusCode);
+        }
+    SVPDEBUG1("CSVPTransferController::HandleEventStateChangedL: Out");    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::NotifyReceivedL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferController::NotifyReceivedL( 
+                            CMceEvent& aEvent,
+                            TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1("CSVPTransferController::NotifyReceivedL: In");    
+    
+    // check data container and match the event to the active refer event
+    if ( aContainer && iTransferContext->MceEvent() == &aEvent )
+        {                  
+        TInt statusCode = aContainer->GetStatusCode();        
+        HBufC8* content = aContainer->GetContent();
+        
+        SVPDEBUG2( "CSVPTransferController::NotifyReceivedL:\
+            statusCode: %d", statusCode );
+        SVPDEBUG2( "CSVPTransferController::NotifyReceivedL:\
+            aContainer->GetContent()->Length(): %d", content->Length() );
+
+        if ( !content->Find( TPtrC8( KSVPNotifyTrying ) ) )
+            {
+            if ( iTransferContext->IsAttended() )
+                {                
+                SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, Attended case:\
+                    SIP/2.0 100 Trying" );
+
+                // Attended transfer (F17) NOTIFY , transferee is trying establish new session.
+                // Check if 202 Accepted already received
+                if ( iAccepted )
+                    {
+                    // Stop the refer timer
+                    iTransferContext->StopReferTimer( );
+                    // Set and apply the next state - accepted
+                    iTransferContext->SetCurrentStateL( 
+                                    KSVPTransferAcceptedStateIndex );
+                    iTransferContext->ApplyCurrentStateL();
+                    }
+                }
+            else
+                {
+                SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, UnAttended case:\
+                    SIP/2.0 100 Trying" );
+
+                // Check if 202 Accepted already received
+                if ( iAccepted )
+                    { 
+                    // Stop the refer timer
+                    iTransferContext->StopReferTimer( );
+
+                    SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, Unattended: is accepted" );
+                        
+                    // Unattended transfer: F7 NOTIFY, display "transferred" note
+                    if( iCCPTransferObserver )
+                        {
+                        SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, send local transfer" );
+                        iCCPTransferObserver->TransferEventOccurred( 
+                                MCCPTransferObserver::ECCPLocalTransfer );
+                        }                
+
+                    // Set and apply the next state - accepted
+                    iTransferContext->SetCurrentStateL( 
+                            KSVPTransferAcceptedStateIndex );
+                    iTransferContext->ApplyCurrentStateL();                
+                
+                    iTransferContext->SetCurrentStateL( 
+                                            KSVPTransferTerminatingStateIndex );
+                    iTransferContext->ApplyCurrentStateL();
+                    // Unattended transfer is ok, hangup the session
+                    iTransferContext->TransferObserver().TransferNotification( 
+                                                          ESVPTransferOKHangUp );
+                    }
+                }
+            }
+        else if ( !content->Find( TPtrC8( KSVPNotifyOK ) ) || 
+                  !content->Find( TPtrC8( KSVPNotifyOk2 ) ) )
+            {
+            if ( iTransferContext->IsAttended() )
+                {
+                SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, Attended case:\
+                    SIP/2.0 200 OK" );
+
+                // Attended transfer (F24) 200 OK
+                if( iCCPTransferObserver )
+                    {
+                    SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, send local transfer" );
+                    iCCPTransferObserver->TransferEventOccurred( 
+                                MCCPTransferObserver::ECCPLocalTransfer );  
+                    }
+
+                // Set and apply the next state - terminating
+                iTransferContext->SetCurrentStateL( 
+                                        KSVPTransferTerminatingStateIndex );
+                iTransferContext->ApplyCurrentStateL();
+
+                // Attended transfer is ok, hangup the session
+                iTransferContext->TransferObserver().TransferNotification(
+                                                      ESVPTransferOKHangUp );
+                }
+            else
+                {
+                SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, UnAttended: SIP/2.0 200 OK" );                    
+                }
+            }
+        else if ( ( !content->Find( TPtrC8( KSVPNotifyRinging ) ) || 
+                    !content->Find( TPtrC8( KSVPNotifyRinging183 ) ) ) &&
+                    !iTransferContext->IsAttended())
+            {
+            // Polycom send Ringing instead of Trying in unattended case.
+            SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, UnAttended and Ringing" );
+
+            // Check if 202 Accepted already received
+            if ( iAccepted )
+                { 
+                // Stop the refer timer
+                iTransferContext->StopReferTimer( );
+
+                SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, Unattended: Polycom case" );
+                    
+                // Unattended transfer: display "transferred" note
+                if( iCCPTransferObserver )
+                    {
+                    SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, send local transfer" );
+                    iCCPTransferObserver->TransferEventOccurred( 
+                            MCCPTransferObserver::ECCPLocalTransfer );
+                    }                
+
+                // Set and apply the next state - accepted
+                iTransferContext->SetCurrentStateL( 
+                        KSVPTransferAcceptedStateIndex );
+                iTransferContext->ApplyCurrentStateL();                
+            
+                iTransferContext->SetCurrentStateL( 
+                                        KSVPTransferTerminatingStateIndex );
+                iTransferContext->ApplyCurrentStateL();
+                // Unattended transfer is ok, hangup the session
+                iTransferContext->TransferObserver().TransferNotification( 
+                                                      ESVPTransferOKHangUp );
+                }
+            }
+        else if ( !content->Find( TPtrC8( KSVPNotifyServiceUnavailable ) ) )
+            {
+            // Notify that comes after the accepted refer, if
+            // the (wrong) address of the refer cannot be reached.
+            if ( KSVPTransferAcceptedStateIndex == iTransferContext->CurrentState() )
+                {
+                SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, 503 -> ECCPTransferFailed");
+
+                // Set and apply the next state - terminating
+                iTransferContext->SetCurrentStateL( 
+                                        KSVPTransferTerminatingStateIndex );
+                iTransferContext->ApplyCurrentStateL();
+
+                // Transfer fails, notify client.
+                iTransferContext->TransferObserver().TransferNotification(
+                                                      ESVPTransferDecline );
+                }
+            else
+                {
+                SVPDEBUG1( "CSVPTransferController::NotifyReceivedL, 503.");
+                }
+            }
+        else
+            {
+            SVPDEBUG1("CSVPTransferController::NotifyReceivedL:\
+                Unhandled container content");
+            }
+        
+        // Ownership transferred here   
+        delete content;
+        }
+        
+    SVPDEBUG1("CSVPTransferController::NotifyReceivedL: Out");    
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CSVPTransferController::HandleReferStateChangeL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferController::HandleReferStateChangeL( CMceRefer& aRefer,
+				                                TInt aStatusCode )
+    {
+    SVPDEBUG1("CSVPTransferController::HandleReferStateChangeL() In");    
+
+    if ( iTransferContext->MceRefer() == &aRefer )
+        {                          
+        if ( KSVPAcceptedVal == aStatusCode )
+            {
+            // Accepted unattended F6, Attended F16
+            SVPDEBUG2( "CSVPTransferController::HandleReferStateChangeL: Accept: %i",
+			             KSVPAcceptedVal );
+
+            // Display "transferring" note
+            if( iCCPTransferObserver )
+                {
+                SVPDEBUG1( "CSVPTransferController::HandleReferStateChangeL, send remote transferring" );
+                iCCPTransferObserver->TransferEventOccurred( 
+                        MCCPTransferObserver::ECCPRemoteTransferring ); 
+                }
+            // Continue acceptance when also notify F7 / F17 "trying" received
+            iAccepted = ETrue;
+            }
+        else if ( ( KSVPBadRequestVal <= aStatusCode && 
+                    KSVPRequestPendingVal >= aStatusCode ) ||
+                    KSVPDeclineVal == aStatusCode ||
+                    KSVPServerInternalErrorVal == aStatusCode ||
+                    KSVPPreconditionFailureVal == aStatusCode )
+            {
+            // Decline, Request Failure 4xx or Server Failure 5xx
+            SVPDEBUG2( "CSVPTransferController::HandleReferStateChangeL: Code: %i", aStatusCode );
+            // Stop the refer timer
+            iTransferContext->StopReferTimer( );
+
+            // Set and apply the next state - terminating
+            iTransferContext->SetCurrentStateL( 
+                                      KSVPTransferTerminatingStateIndex );
+            iTransferContext->ApplyCurrentStateL();            
+
+            // Notify the observer about the decline.
+            iTransferContext->TransferObserver().TransferNotification( 
+                                                    ESVPTransferDecline );
+            }
+            
+        else
+            {
+            // Not handled
+            SVPDEBUG2( "CSVPTransferController::HandleReferStateChangeL: \
+                Unknown StatusCode: %i", aStatusCode );
+            }
+        }    
+    else
+        {
+        // Unknown refer - not handled
+        SVPDEBUG1( "CSVPTransferController::HandleReferStateChangeL: \
+            Unknown refer");
+        }    
+
+    SVPDEBUG1("CSVPTransferController::HandleReferStateChangeL() Out");            
+    }
+        
+            
+// ---------------------------------------------------------------------------
+// CSVPTransferController::IncomingReferL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferController::IncomingReferL( CMceInRefer* aRefer,
+        const TDesC8& aReferTo, TMceTransactionDataContainer* aContainer )
+    {
+    SVPDEBUG1( "CSVPTransferController::IncomingReferL In" )
+    
+    // Is new incoming refer handling possible
+    if ( KSVPTransferIdleStateIndex == iTransferContext->CurrentState() )
+        {
+        SVPDEBUG1( "CSVPTransferController::IncomingReferL: allowed" )
+        
+        iTransferContext->SetMceRefer( static_cast<CMceRefer*>( aRefer ) );
+        iTransferContext->SetIncomingReferToL( aReferTo );
+        CDesC8Array* headers = aContainer->GetHeaders();// get headers
+        
+        if ( headers )
+            {
+            TBool found = EFalse;
+            
+            for( TInt i = 0; i < headers->MdcaCount() && !found; i++ )
+                {
+                TPtrC8 tmpHeader = headers->MdcaPoint( i );
+                
+                if ( KErrNotFound != tmpHeader.FindF( KSVPReferredBy ) )
+                    {
+                    SVPDEBUG1( "KSVPReferredBy found" )
+                    found = ETrue;
+                    iTransferContext->SetIncomingReferredByL( tmpHeader );
+                    }
+                }
+            }
+        
+        delete headers;
+        headers = NULL;
+        }
+    
+    else if ( KSVPTransferPendingStateIndex == iTransferContext->CurrentState() )
+        {
+        SVPDEBUG1( "CSVPTransferController::IncomingReferL: not allowed \
+            -> ignore" )
+        User::Leave( KSVPErrTransferInProgress );
+        }
+    
+    else
+        {
+        SVPDEBUG1( "CSVPTransferController::IncomingReferL: not allowed" )
+        User::Leave( KSVPErrTransferStateError );
+        }
+    
+    if ( iTransferContext->IsAttended() )
+        {
+        SVPDEBUG1( "CSVPTransferController::IncomingReferL: Attended case, send accept" )
+        
+        // send trying notification and wait respond for it
+        CMceInEvent* inEvent = NULL;
+        
+        TRAPD( acceptError, inEvent = static_cast<CMceInRefer*>(
+                iTransferContext->MceRefer() )->AcceptL() );
+        
+        if ( KErrNone == acceptError )
+            {
+            // Apply state, changes to next state (pending)
+            SVPDEBUG1( "CSVPTransferController::IncomingReferL: pending state" )
+            iTransferContext->SetMceEvent( static_cast<CMceEvent*>( inEvent ) );
+            iTransferContext->ApplyCurrentStateL();
+            }
+        else
+            {
+            // Set and apply the next state - terminating
+            SVPDEBUG2("CSVPTransferController::IncomingReferL: acc fails = %d", acceptError )
+            iTransferContext->SetCurrentStateL( KSVPTransferTerminatingStateIndex );
+            iTransferContext->ApplyCurrentStateL();
+            }
+        }
+    else
+        {
+        // Apply state, changes to next state (pending)
+        SVPDEBUG1( "CSVPTransferController::IncomingReferL: UnAttended case pending" )
+        iTransferContext->ApplyCurrentStateL();
+        }
+    
+    SVPDEBUG1( "CSVPTransferController::IncomingReferL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::IsMceRefer
+// ---------------------------------------------------------------------------
+//
+TBool CSVPTransferController::IsMceRefer( CMceRefer& aRefer )
+    {
+    return ( iTransferContext->MceRefer() == &aRefer );
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPTransferController::IsAttended
+// ---------------------------------------------------------------------------
+//
+TBool CSVPTransferController::IsAttended( )
+    {
+    return ( iTransferContext->IsAttended() );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::SetTransferDataL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferController::SetTransferDataL( CDesC8Array* aUserAgentHeaders,
+                                               TInt aSecureStatus )
+    {
+    SVPDEBUG1("  CSVPTransferController::SetTransferDataL" );
+    iTransferContext->SetTransferDataL( aUserAgentHeaders, aSecureStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::SetMceSessionObject
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferController::SetMceSessionObject( CMceSession* aSession )
+    {
+    iTransferContext->SetMceSessionObject( aSession );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::SendNotifyL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferController::SendNotifyL( TInt aStatusCode )
+    {
+    SVPDEBUG2("CSVPTransferController::SendNotifyL() code = %d", aStatusCode);
+
+    CMceInEvent* inEvent = static_cast< CMceInEvent* > (
+                                            iTransferContext->MceEvent());   
+    if (inEvent)
+        {
+        HBufC8* contentType = KSVPMessageSipfrag().AllocLC(); //message/sipfrag
+        HBufC8* content = NULL; 
+    
+        if (KSVPOKVal == aStatusCode )
+            {
+            content = KSVPNotifyOK().AllocLC(); // "SIP/2.0 200 OK"
+            }
+        else if ( KSVPNotFoundVal == aStatusCode ||
+                  KSVPBusyHereVal == aStatusCode ||
+                  KSVPDeclineVal == aStatusCode )
+            {
+            content = KSVPNotifyServiceUnavailable().AllocLC(); // "503"
+            }
+        else
+            {
+            SVPDEBUG2("CSVPTransferController::SendNotifyL unknown aStatusCode = %d", aStatusCode);
+            content = KSVPNotifyServiceUnavailable().AllocLC(); // "503"
+            }
+
+        CDesC8Array* headers = NULL;
+        headers = new( ELeave ) CDesC8ArrayFlat( KSVPContactArrayGranularity );
+        CleanupStack::PushL( headers );
+        headers->AppendL( KSVPSubsStateTerminated );
+
+        // Notify is sent to transferer (unattended  msg F15, attended msg F24)
+        TRAPD( errNotify, inEvent->TerminateL( headers, contentType, content ) );
+
+        if ( KErrNone == errNotify )
+            {
+            SVPDEBUG1("CSVPTransferController::SendNotifyL, notify sending OK");
+            CleanupStack::Pop( 3, contentType );    // headers, content, contentType
+            }
+        else
+            {
+            // error handling
+            SVPDEBUG2("CSVPTransferController::SendNotifyL: errNotify = %d", errNotify );
+            CleanupStack::PopAndDestroy( 3, contentType );    // headers, content, contentType
+            }
+        }
+        
+    if ( iTransferContext->IsAttended() )
+        {
+        SVPDEBUG1("CSVPTransferController::SendNotifyL() Attended done");
+        }
+    else
+        {
+        SVPDEBUG1("CSVPTransferController::SendNotifyL() UnAttended to terminating state");
+        // Finish unattended incoming transfer sequence
+        // Set and apply the next state - terminating
+        iTransferContext->SetCurrentStateL( KSVPTransferTerminatingStateIndex );
+        iTransferContext->ApplyCurrentStateL();
+        }
+
+    SVPDEBUG1("CSVPTransferController::SendNotifyL() Out");
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::IsIncomingTransfer
+// ---------------------------------------------------------------------------
+//
+TBool CSVPTransferController::IsIncomingTransfer()
+    {
+    SVPDEBUG2("CSVPTransferController::IsIncomingTransfer = %d",
+                iTransferContext->IsIncoming() );
+    return iTransferContext->IsIncoming();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::TerminateTransfer
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferController::TerminateTransfer()
+    {
+    SVPDEBUG1("CSVPTransferController::TerminateTransfer" )
+    TRAP_IGNORE( TerminateTransferL() );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::TerminateTransferL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferController::TerminateTransferL()
+    {
+    iTransferContext->SetCurrentStateL( KSVPTransferTerminatingStateIndex );
+    iTransferContext->ApplyCurrentStateL();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::AttendedTransfer
+// ---------------------------------------------------------------------------
+//
+TInt CSVPTransferController::AttendedTransfer( MCCPCall& aTransferTargetCall )
+    {  
+    SVPDEBUG1( "CSVPTransferController::AttendedTransfer call IN" );
+    TRAPD( transError, TransferL( &aTransferTargetCall, KNullDesC, ETrue ));
+    SVPDEBUG2( "CSVPTransferController::AttendedTransfer A return: %d", transError );
+    return transError;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::AttendedTransfer
+// ---------------------------------------------------------------------------
+//
+TInt CSVPTransferController::AttendedTransfer( const TDesC& aTransferTarget )
+    {  
+    SVPDEBUG1( "CSVPTransferController::AttendedTransfer target IN" );
+    TRAPD( transError, TransferL( NULL, aTransferTarget, ETrue ));
+    SVPDEBUG2( "CSVPTransferController::AttendedTransfer B return: %d", transError );
+    return transError;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::UnattendedTransfer
+// ---------------------------------------------------------------------------
+//
+TInt CSVPTransferController::UnattendedTransfer( const TDesC& aTransferTarget )
+    {  
+    SVPDEBUG1( "CSVPTransferController::UnattendedTransfer IN" );
+    TRAPD( transError, TransferL( NULL, aTransferTarget, EFalse ));
+    SVPDEBUG2( "CSVPTransferController::UnattendedTransfer return: %d", transError );
+    return transError;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::AcceptTransfer
+// ---------------------------------------------------------------------------
+//
+TInt CSVPTransferController::AcceptTransfer( const TBool aAccept )
+    {
+    SVPDEBUG2("CSVPTransferController::AcceptTransfer() IN aAccept = \
+        %d", aAccept);
+    TInt acceptError = KErrNone;
+    TInt stateError = KErrNone;
+    TInt currentState = iTransferContext->CurrentState();
+    CMceInEvent* inEvent(NULL);
+    
+    // Is state "pending"
+    if ( KSVPTransferPendingStateIndex == currentState )
+        {
+        if ( aAccept )
+            {
+            TRAP( acceptError, ( inEvent = static_cast< CMceInRefer* > (iTransferContext->MceRefer())->AcceptL()));
+            SVPDEBUG2("CSVPTransferController::AcceptTransfer()\
+                 AcceptL = %d", acceptError);
+            }
+        else
+            {
+            SVPDEBUG1("CSVPTransferController::AcceptTransfer() reject");
+            TRAP( acceptError, ( static_cast< CMceInRefer* > (iTransferContext->MceRefer())->RejectL()) );
+            }
+            
+        if ( KErrNone == acceptError )
+            {
+            if ( aAccept )
+                {
+                // Set the received event
+                iTransferContext->SetMceEvent(static_cast< CMceEvent* >(inEvent));
+                
+                // Set and apply the next state - accepted
+                TRAP( acceptError,
+                    iTransferContext->SetCurrentStateL( 
+                                            KSVPTransferAcceptedStateIndex );
+                    iTransferContext->ApplyCurrentStateL();
+                    );
+                }
+            else
+                {
+                // Set and apply the next state - terminating
+                TRAP( acceptError,
+                    iTransferContext->SetCurrentStateL( 
+                                            KSVPTransferTerminatingStateIndex );
+                    iTransferContext->ApplyCurrentStateL();        
+                    );
+                }
+            }
+        else
+            {
+            SVPDEBUG2("CSVPTransferController::AcceptTransfer()\
+                 fails = %d", acceptError);
+            // Set and apply the next state - terminating
+            TRAP( stateError,
+                iTransferContext->SetCurrentStateL( 
+                                        KSVPTransferTerminatingStateIndex );
+                iTransferContext->ApplyCurrentStateL();
+                );
+            SVPDEBUG2("CSVPTransferController::AcceptTransfer()\
+                 stateError = %d", stateError);
+            }
+        }
+    else
+        {
+        SVPDEBUG2("CSVPTransferController::AcceptTransfer()\
+             current state is not pending: %d", currentState);       
+        acceptError = KSVPErrTransferStateError;
+        }
+
+    SVPDEBUG2("CSVPTransferController::AcceptTransfer()\
+         OUT acceptError = %d", acceptError);    
+    return acceptError;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::TransferTarget
+// ---------------------------------------------------------------------------
+//
+const TDesC& CSVPTransferController::TransferTarget() const
+    {   
+    return iTransferContext->IncomingReferTo();
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::AddObserverL
+// ---------------------------------------------------------------------------
+//    
+void CSVPTransferController::AddObserverL( 
+                                    const MCCPTransferObserver& aObserver )
+    {
+    SVPDEBUG1("CSVPTransferController::AddObserverL() In");
+    // set transfer observer
+    // only one observer used at a time, replaces current one
+    iCCPTransferObserver = const_cast<MCCPTransferObserver*>(&aObserver);
+
+    SVPDEBUG1("CSVPTransferController::AddObserverL() Out");
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::RemoveObserver
+// ---------------------------------------------------------------------------
+//
+TInt CSVPTransferController::RemoveObserver( 
+                                    const MCCPTransferObserver& aObserver )
+    {
+    SVPDEBUG1("CSVPTransferController::RemoveObserver");
+    TInt err = KErrNone;
+    if ( iCCPTransferObserver == const_cast<MCCPTransferObserver*>
+                (&aObserver) )
+        {
+        iCCPTransferObserver = NULL;
+        }
+    else
+        {
+        err = KErrNotFound;
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferController::TransferL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferController::TransferL( MCCPCall* aCall, 
+                                        const TDesC& aTarget,
+                                        const TBool aAttendedTransfer )
+    {
+    SVPDEBUG1("CSVPTransferController::TransferL() In");
+
+    // Transfer possible.
+    if ( KSVPTransferIdleStateIndex == iTransferContext->CurrentState() )
+        {
+        iAccepted = EFalse;
+        
+        // Set transfer parameters
+        iTransferContext->SetTransferParmsL( 
+                            static_cast< CSVPSessionBase* >(aCall),
+                            aTarget,
+                            aAttendedTransfer );
+
+        // Apply state, execute the refer and change to next state (pending).
+        iTransferContext->ApplyCurrentStateL();
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPTransferController::TransferL: Error - transfer in progress" );
+        iTransferContext->TransferObserver().TransferFailed( KErrInUse );
+        TerminateTransferL();
+        }
+
+    SVPDEBUG1("CSVPTransferController::TransferL() OUT");
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/src/svptransferidlestate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,98 @@
+/*
+* 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:  Transfer state representing the idle state
+*
+*/
+
+
+#include "svptransferidlestate.h"
+#include "svptransferstatecontext.h"
+#include "svptransferobserver.h"                // MSVPTransferObserver
+#include "svplogger.h"
+
+// ---------------------------------------------------------------------------
+// CSVPTransferIdleState::CSVPTransferIdleState
+// ---------------------------------------------------------------------------
+//
+CSVPTransferIdleState::CSVPTransferIdleState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferIdleState::NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPTransferIdleState* CSVPTransferIdleState::NewLC()
+    {
+    CSVPTransferIdleState* self = new( ELeave ) CSVPTransferIdleState;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferIdleState::~CSVPTransferIdleState
+// ---------------------------------------------------------------------------
+//
+CSVPTransferIdleState::~CSVPTransferIdleState()
+    {
+    }    
+
+// ---------------------------------------------------------------------------
+// CSVPTransferIdleState::DoApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferIdleState::DoApplyL( CSVPTransferStateContext& aContext )
+    {
+    SVPDEBUG1( "CSVPTransferIdleState::DoApplyL In" )
+
+    if ( KSVPTransferIdleStateIndex  == aContext.CurrentState() )         
+        {          
+        if ( !aContext.IsIncoming() )
+            {                
+            // Execute the refer, creates mce out event. 
+            TRAPD( err, aContext.ExecuteReferL() );
+                                                                  
+            if ( KErrNone != err )
+                {
+                SVPDEBUG2( "CSVPTransferIdleState::DoApplyL: error: %i", err )
+                // Notify the observer about the error.
+                aContext.TransferObserver().TransferFailed( err );
+                // Set and apply to the terminating state
+                aContext.SetCurrentStateL( KSVPTransferTerminatingStateIndex );
+                aContext.ApplyCurrentStateL();
+                User::Leave( err );
+                }
+            }
+        
+        // Set and apply the next state - transfer pending
+        aContext.SetCurrentStateL( KSVPTransferPendingStateIndex );
+        aContext.ApplyCurrentStateL();
+        }
+    else
+        {
+        // Notify the observer about the error.
+        aContext.TransferObserver().TransferFailed( KSVPErrTransferStateError );
+        }
+    
+    SVPDEBUG1( "CSVPTransferIdleState::DoApplyL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferIdleState::DoEnter
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferIdleState::DoEnter( CSVPTransferStateContext& /*aContext*/ )
+    {
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/src/svptransferpendingstate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,98 @@
+/*
+* 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:  Transfer state representing the pending state
+*
+*/
+
+
+#include "svptransferpendingstate.h"
+#include "svptransferstatecontext.h"
+#include "svptransferobserver.h"            // MSVPTransferObserver
+#include "svplogger.h"
+
+// ---------------------------------------------------------------------------
+// CSVPTransferPendingState::CSVPTransferPendingState
+// ---------------------------------------------------------------------------
+//
+CSVPTransferPendingState::CSVPTransferPendingState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferPendingState::NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPTransferPendingState* CSVPTransferPendingState::NewLC()
+    {
+    CSVPTransferPendingState* self = new( ELeave ) CSVPTransferPendingState;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferPendingState::~CSVPTransferPendingState
+// ---------------------------------------------------------------------------
+//
+CSVPTransferPendingState::~CSVPTransferPendingState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferPendingState::DoApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferPendingState::DoApplyL( CSVPTransferStateContext& aContext )
+    {
+    SVPDEBUG1( "CSVPTransferPendingState::DoApplyL In" )
+
+    if ( aContext.CurrentState() == KSVPTransferPendingStateIndex )         
+        {        
+        if ( aContext.IsIncoming() )
+            {
+            // Incoming new refer received
+            
+            // Notify the observer
+            aContext.TransferObserver().TransferNotification( 
+                                                ESVPIncomingRefer );
+
+            // Next state is defined & applied when user action 
+            // event received in CSVPTransferController::AcceptTransfer
+            
+            }
+
+        // For outgoing refer -
+        // Next state is defined & applied when event received 
+        // in CSVPTransferController::HandleReferStateChangeL
+        }
+    else
+        {
+        // Notify the observer about the error.
+        aContext.TransferObserver().TransferFailed( KSVPErrTransferStateError );
+        // Set and apply to the terminating state
+        aContext.SetCurrentStateL( KSVPTransferTerminatingStateIndex );
+        aContext.ApplyCurrentStateL();
+        }
+    
+    SVPDEBUG1( "CSVPTransferPendingState::DoApplyL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferPendingState::DoEnter
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferPendingState::DoEnter( 
+                                CSVPTransferStateContext& /*aContext*/ )
+    {
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/src/svptransferstatebase.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* 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:  Transfer state base class for different states
+*
+*/
+
+
+#include "svptransferstatebase.h"
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateBase::CSVPTransferStateBase
+// ---------------------------------------------------------------------------
+//
+CSVPTransferStateBase::CSVPTransferStateBase()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateBase::~CSVPTransferStateBase
+// ---------------------------------------------------------------------------
+//
+CSVPTransferStateBase::~CSVPTransferStateBase()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPTransferStateBase::ApplyL
+// -----------------------------------------------------------------------------
+//
+void CSVPTransferStateBase::ApplyL( CSVPTransferStateContext& aContext )
+    {
+    DoApplyL( aContext );
+    }
+
+// -----------------------------------------------------------------------------
+// CSscSrvStateBase::Enter
+// -----------------------------------------------------------------------------
+//
+void CSVPTransferStateBase::Enter( CSVPTransferStateContext& aContext )
+    {
+    DoEnter( aContext );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/src/svptransferstatecontext.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1475 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Transfer state context class for state machine
+*
+*/
+
+#include <mcetransactiondatacontainer.h> // TMceTransactionDataContainer 
+#include <mceoutrefer.h>                 // CMceRefer, CMceOutRefer
+#include <mceoutevent.h>                 // CMceEvent
+#include <escapeutils.h>
+#include <mcesession.h>
+#include <crcseprofileentry.h>
+#include <crcseprofileregistry.h>
+
+#include "svpsessionbase.h"
+#include "svptransferstatecontext.h"
+#include "svptransferstatebase.h"
+#include "svptransferidlestate.h"
+#include "svptransferpendingstate.h"
+#include "svptransferacceptedstate.h"
+#include "svptransferterminatingstate.h"
+#include "svptransferterminatedstate.h" 
+#include "svptransferobserver.h"
+#include "svplogger.h"          
+#include "svpuriparser.h"
+#include "svpconsts.h"
+#include "svpholdcontext.h"
+#include "svpholdcontroller.h"
+#include "svpcleanupresetanddestroy.h"
+
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CSVPTransferStateContext::CSVPTransferStateContext( 
+                                CMceSession* aMceSession,                                
+                                CSVPSessionBase* aSVPSession,                                
+                                TMceTransactionDataContainer& aContainer, 
+                                MSVPTransferObserver& aObserver ) :
+        iMceSession( aMceSession ),
+        iSVPSession( aSVPSession ),        
+        iTargetSession( NULL ),
+        iContainer( aContainer ),
+        iTransferObserver( aObserver ),
+        iStates( NULL ),
+        iCurrentState( NULL ),
+        iMceRefer( NULL ),        
+        iMceEvent( NULL ),
+        iAttended( EFalse ),
+        iIncomingReferTo ( NULL ),
+        iIncomingReferredBy ( NULL ),
+        iIncomingReplaces (NULL)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::ConstructL() 
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::ConstructL In" )
+    
+    // Create the transfer states in the state array.
+    InitializeStateArrayL();  
+           
+    // Initialize idle state to current state. Note, that it is not
+    // applied yet.
+    SetCurrentStateL( KSVPTransferIdleStateIndex );
+    
+    SVPDEBUG1( "CSVPTransferStateContext::ConstructL Out" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPTransferStateContext::NewL
+// -----------------------------------------------------------------------------
+CSVPTransferStateContext* CSVPTransferStateContext::NewL( 
+                                CMceSession* aMceSession,
+                                CSVPSessionBase* aSVPSession,
+                                TMceTransactionDataContainer& aContainer, 
+                                MSVPTransferObserver& aObserver )
+    {    
+    CSVPTransferStateContext* self = new ( ELeave ) CSVPTransferStateContext(
+                                                        aMceSession,
+                                                        aSVPSession,
+                                                        aContainer, 
+                                                        aObserver );
+    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::~CSVPTransferStateContext
+// ---------------------------------------------------------------------------
+//
+CSVPTransferStateContext::~CSVPTransferStateContext()
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::~CSVPTransferStateContext In" )
+    
+    if ( iStates )
+        {
+        iStates->ResetAndDestroy();
+        iStates->Close();
+        delete iStates;
+        }
+    
+    delete iMceEvent;
+    delete iMceRefer;
+    delete iIncomingReferTo;
+    delete iIncomingReferredBy;
+    delete iIncomingReplaces;
+    
+    SVPDEBUG1( "CSVPTransferStateContext::~CSVPTransferStateContext Out" )        
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::SetCurrentStateL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::SetCurrentStateL(
+        TSVPTransferStateIndex aStateIndex )
+    {
+    // Check, if the transition is valid
+    if ( !IsStateTransitionAccepted( aStateIndex ) )
+        {
+        SVPDEBUG2( "CSVPTransferStateContext::SetCurrentStateL: STATE ERROR stateindex: %i", aStateIndex )
+        User::Leave( KSVPErrTransferStateError );
+        }
+    else
+        {
+        iCurrentState = ( *iStates )[ aStateIndex ];
+        iCurrentState->Enter( *this );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CurrentState
+// ---------------------------------------------------------------------------
+//
+TSVPTransferStateIndex CSVPTransferStateContext::CurrentState() const
+    {
+    return iStates->Find( iCurrentState );    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::ApplyCurrentStateL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::ApplyCurrentStateL()
+   {
+   iCurrentState->ApplyL( *this );
+   }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::TransferObserver
+// ---------------------------------------------------------------------------
+//
+MSVPTransferObserver& CSVPTransferStateContext::TransferObserver()
+    {
+    return iTransferObserver;    
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::SetMceSessionObject
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::SetMceSessionObject( CMceSession* aSession )
+    {
+    iMceSession = aSession;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::MceSessionObject
+// ---------------------------------------------------------------------------
+//
+CMceSession* CSVPTransferStateContext::MceSessionObject()
+    {
+    return iMceSession;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::SetMceRefer
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::SetMceRefer( CMceRefer* aRefer )
+    {
+    if ( iMceRefer != aRefer )
+        {
+        delete iMceRefer;
+        iMceRefer = aRefer;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::MceRefer
+// ---------------------------------------------------------------------------
+//
+CMceRefer* CSVPTransferStateContext::MceRefer()
+    {
+    return iMceRefer;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::SetAttended
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::SetAttended( const TBool aAttended )
+    {
+    iAttended = aAttended;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::IsAttended
+// ---------------------------------------------------------------------------
+//
+TBool CSVPTransferStateContext::IsAttended()
+    {
+    return iAttended;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CheckIsSessionRemoteHold
+// ---------------------------------------------------------------------------
+//
+TBool CSVPTransferStateContext::CheckIsSessionRemoteHold()
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::CheckIsSessionRemoteHold In" )
+    
+    TBool ret = EFalse;
+    
+    if ( iSVPSession->HasHoldController() &&
+         MCCPCallObserver::ECCPStateDisconnecting != iSVPSession->State() )
+        {
+        SVPDEBUG1("CSVPTransferStateContext::CheckIsSessionRemoteHold, Check hold state" )
+        
+        if ( ESVPOnHold == iSVPSession->HoldController().HoldState() &&
+             ESVPRemoteHold == iSVPSession->HoldController().HoldRequest() )
+            {
+            // Session is remote holded -> Snom/EyeBeam as unattended transferer case.
+            SVPDEBUG1( "CSVPTransferStateContext:CheckIsSessionRemoteHold, transferer is Snom, EyeBeam or similar" )
+            ret = ETrue;
+            }
+        }
+    
+    SVPDEBUG2("CSVPTransferStateContext::CheckIsSessionRemoteHold Out return: %d",ret )
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::SetTransferDataL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::SetTransferDataL(
+        CDesC8Array* aUserAgentHeaders, TInt aSecureStatus )
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::SetTransferDataL In" )
+    
+    if ( aUserAgentHeaders )
+        {
+        if ( iIncomingReplaces && IsAttended() )
+            {
+            SVPDEBUG1( "CSVPTransferStateContext::SetTransferDataL: Add replaces header" )
+            // fetch "replaces:" string
+            HBufC* replacesStringHeap16 = IncomingReplaces().AllocLC(); // CS: 1
+            
+            // Copy incoming replaces to 8-bit buffer
+            HBufC8* replacesStringHeap8 =
+                    HBufC8::NewLC( replacesStringHeap16->Length() +
+                                   KSVPReplacesColonTxt().Length() ); // CS: 2
+            
+            replacesStringHeap8->Des().Copy( *replacesStringHeap16 );
+            CleanupStack::Pop( 1 );
+            CleanupStack::PushL( replacesStringHeap8 ); // ReAlloc possible
+            
+            // add replaces header
+            replacesStringHeap8->Des().Insert( 0, KSVPReplacesColonTxt );
+            CleanupStack::Pop( 1 );
+            CleanupStack::PushL( replacesStringHeap8 ); // ReAlloc possible
+            SVPDEBUG2( "CSVPTransferStateContext::SetTransferDataL - length: %d", replacesStringHeap8->Length() )
+            
+            // Finally add collected Replaces string to header
+            aUserAgentHeaders->AppendL( *replacesStringHeap8 );
+            CleanupStack::PopAndDestroy( replacesStringHeap8 );      // CS: 1
+            CleanupStack::PopAndDestroy( replacesStringHeap16 );     // CS: 0
+            }
+        
+        if ( iIncomingReferredBy )
+            {
+            SVPDEBUG1( "CSVPTransferStateContext::SetTransferDataL: Add referredBy header" )
+            TBuf8<KSVPTempStringlength> referredByString;
+            referredByString.Append( KSVPReferredBy );
+            // add IncomingReferredBy
+            referredByString.Append( IncomingReferredBy() );
+            // Finally add collected Referred-By string to header
+            aUserAgentHeaders->AppendL( referredByString );
+            }
+        }
+    
+    // Update transfer target address according preferred securesetting.
+    UpdateTransferTargetL( aSecureStatus );
+    
+    SVPDEBUG1( "CSVPTransferStateContext::SetTransferDataL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::IsIncoming
+// ---------------------------------------------------------------------------
+//
+TBool CSVPTransferStateContext::IsIncoming()
+    {
+    return ( NULL != iIncomingReferTo );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::SetIncomingReferToL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::SetIncomingReferToL( const TDesC8& aReferTo )
+    {
+    SVPDEBUG1("CSVPTransferStateContext::SetIncomingReferToL In" )
+    
+    ResetIncomingReferTo();
+    
+    // modify aReferTo
+    HBufC8* referTo = CompleteReferToL( aReferTo );
+    CleanupStack::PushL( referTo );
+
+    // at this point referto must contains legal sip uri
+    RemoveExtraParameters( referTo );
+    
+    // Check length - moSession construct limitation
+    // sip: or sips: prefix will be added later, so 95 is maximum
+    if ( referTo->Length() < ( KSVPMaxUriLength - KSVPSipPrefixLength ) )
+        {
+        // Copy and convert the "refer to" -parameter.
+        iIncomingReferTo = HBufC::NewL( referTo->Length() );
+        TPtr temp = iIncomingReferTo->Des();
+        temp.Copy( *referTo );
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPTransferStateContext::SetIncomingReferToL: referTo too long, Leave" )
+        User::Leave( KErrArgument );
+        }
+    
+    CleanupStack::PopAndDestroy( referTo );
+    
+   SVPDEBUG2( "CSVPTransferStateContext::SetIncomingReferToL lenght: %d",
+            iIncomingReferTo->Length())
+    SVPDEBUG1( "CSVPTransferStateContext::SetIncomingReferToL Out" )
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPSessionBase::SetIncomingReferredByL
+// -----------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::SetIncomingReferredByL( const TDesC8& aReferredBy )
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::SetIncomingReferredByL In" )
+    
+    ResetIncomingReferredBy();
+    
+    // modify aReferredBy
+    HBufC8* referredBy = CompleteReferredByL( aReferredBy );
+    CleanupStack::PushL( referredBy );
+    
+    // Copy and convert the "Referred By" -parameter.    
+    iIncomingReferredBy = HBufC::NewL( referredBy->Length() );
+    TPtr temp = iIncomingReferredBy->Des();
+    temp.Copy( *referredBy );
+    CleanupStack::PopAndDestroy( referredBy );
+    
+    SVPDEBUG2( "CSVPTransferStateContext::SetIncomingReferredByL lenght: %d",
+            iIncomingReferredBy->Length() )
+    SVPDEBUG1( "CSVPTransferStateContext::SetIncomingReferredByL Out" )
+    }    
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::SetIncomingReplacesL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::SetIncomingReplacesL( const TDesC8& aString )
+    { 
+    SVPDEBUG1("CSVPTransferStateContext::SetIncomingReplacesL In" )
+    
+    ResetIncomingReplaces();
+    
+    // modify Replaces
+    HBufC8* string = CompleteReplacesL( aString );
+    CleanupStack::PushL( string );
+    
+    // Copy and convert the "Replaces" -parameter.    
+    iIncomingReplaces = HBufC::NewL( string->Length() );
+    TPtr temp = iIncomingReplaces->Des();
+    temp.Copy( *string );
+    CleanupStack::PopAndDestroy( string );
+    
+    SVPDEBUG2( "CSVPTransferStateContext::SetIncomingReplacesL lenght: %d",
+            iIncomingReplaces->Length() )
+    SVPDEBUG1( "CSVPTransferStateContext::SetIncomingReplacesL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CompleteReplacesL
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSVPTransferStateContext::CompleteReplacesL( const TDesC8& aString )
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::CompleteReplacesL In" )
+    
+    // Copy the parameter to a new buffer.
+    HBufC8* string = aString.AllocLC();
+    // If "?Replaces=" found attended transfer case
+    TInt position = CheckReplacesTxt( *string );
+    SVPDEBUG2( "    CheckReplacesTxt returns = %d", position );
+    
+    if ( KErrNotFound != position )
+        {
+        TakeReplacesTxt( string, position );
+        CleanupStack::Pop( 1 ); // string, ReAlloc possible
+        CleanupStack::PushL( string );
+        }
+    // Check "?X-Sipx-Authidentity=" and remove text after it if exists
+    position = CheckAuthidentity( *string );
+
+    if ( KErrNotFound != position )
+        {
+        // "?X-Sipx-Authidentity=" found
+        CutStringFromPosition( string, position );
+        CleanupStack::Pop( 1 ); // string, ReAlloc possible
+        CleanupStack::PushL( string );
+        }
+    
+    // Check ">" and remove text after it if exists
+    position = CheckRightBracket( *string );
+    SVPDEBUG2("    CheckRightBracket returns = %d" , position )
+    
+    if ( KErrNotFound != position )
+        {
+        // ">" found
+        CutStringFromPosition( string, position );
+        CleanupStack::Pop( 1 ); // string, ReAlloc possible
+        CleanupStack::PushL( string );
+        }
+    
+    HBufC8* temp = EscapeUtils::EscapeDecodeL( *string );
+    CleanupStack::PopAndDestroy( string );
+    
+    SVPDEBUG1( "CSVPTransferStateContext::CompleteReplacesL Out" )
+    return temp;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CompleteReferToL
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSVPTransferStateContext::CompleteReferToL( const TDesC8& aUri )
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::CompleteReferToL In" )
+    
+    // Copy the parameter to a new buffer.
+    HBufC8* uri = aUri.AllocLC();
+    
+    // Check "<" and remove it and text before it if exists
+    TInt position = CheckLeftBracket( *uri );
+    
+    if ( KErrNotFound != position )
+        {
+        RemoveLeftBracket( uri, position );
+        CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+        CleanupStack::PushL( uri );
+        }
+    
+    // Check ";user=phone" and remove if exists
+    position = CheckUserEqualsPhone( *uri );
+    
+    if ( KErrNotFound != position )
+        {
+        // ";user=phone" found
+        RemoveUserEqualsPhone( uri, position );
+        CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+        CleanupStack::PushL( uri );
+        }
+    
+    // Check ">" and remove text after it if exists
+    position = CheckRightBracket( *uri );
+    
+    if ( KErrNotFound != position )
+        {
+        // ">" found
+        CutStringFromPosition( uri, position );
+        CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+        CleanupStack::PushL( uri );
+        }
+    
+    // Check "KSVPQuesReplacesTxt" and remove text after it if exists
+    // If it is found -> attended transfer case
+    position = CheckReplacesTxt( *uri );
+    
+    if ( KErrNotFound != position )
+        {
+        // Found -> attended case.
+        SVPDEBUG1( "CSVPTransferStateContext::CompleteReferToL ?Replaces= found -> attended transfer" )
+        SetAttended( ETrue );
+        SetIncomingReplacesL( aUri );
+        CutStringFromPosition( uri, position );
+        }
+    else
+        {
+        // Not found -> unattended case.
+        SVPDEBUG1( "CSVPTransferStateContext::CompleteReferToL ?Replaces= not found -> unattended transfer" )
+        SetAttended( EFalse );
+        }
+
+    // Check "?X-Sipx-Authidentity=" and remove text after it if exists
+    position = CheckAuthidentity( *uri );
+
+    if ( KErrNotFound != position )
+        {
+        // "?X-Sipx-Authidentity=" found
+        CutStringFromPosition( uri, position );
+        CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+        CleanupStack::PushL( uri );
+        }
+
+    // Check "sip:" and remove it if exists
+    if ( KErrNone == uri->Find( KSVPSipPrefix ) )
+        {
+        // sip: is in the beginning of the string
+        SVPDEBUG1( "CSVPTransferStateContext::CompleteReferToL remove sip:" )
+        uri->Des().Delete( 0, KSVPSipPrefixLength );
+        }
+
+    // Check "sips:" and remove it if exists
+    if ( KErrNone == uri->Find( KSVPSipsPrefix ) )
+        {
+        // sips: is in the beginning of the string
+        SVPDEBUG1( "CSVPTransferStateContext::CompleteReferToL remove sips:" )
+        uri->Des().Delete( 0, KSVPSipsPrefixLength );
+        }
+
+    // Check ":" and remove text after it if exists,
+    // some server might add this after transfer target address
+    position = uri->Find( KSVPCln );
+
+    if ( KErrNotFound != position )
+        {
+        // ":" found
+        SVPDEBUG2( "CSVPTransferStateContext::CompleteReferToL remove text after %d ", position )
+        uri->Des().Delete( position, uri->Length() - position );
+        }
+
+    CleanupStack::Pop( 1 ); // uri, ReAlloc possible
+    
+    SVPDEBUG1( "CSVPTransferStateContext::CompleteReferToL Out" )
+    return uri;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CompleteReferredByL
+// ---------------------------------------------------------------------------
+//
+HBufC8* CSVPTransferStateContext::CompleteReferredByL(
+        const TDesC8& aReferredBy )
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::CompleteReferredByL In" )
+    
+    // Copy the parameter to a new buffer.
+    HBufC8* referredBy = aReferredBy.AllocLC();
+    
+    // Check "Referred-By:" and remove it
+    TInt position = CheckReferredByTxt( *referredBy );
+    
+    if ( KErrNotFound != position )
+        {
+        // "Referred-By:" found.
+        RemoveReferredByTxt( referredBy, position );
+        }
+    
+    CleanupStack::Pop( 1 ); // referredBy, ReAlloc possible
+    
+    SVPDEBUG1( "CSVPTransferStateContext::CompleteReferredByL Out" )
+    return referredBy;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CheckUserEqualsPhone
+// ---------------------------------------------------------------------------
+//
+TInt CSVPTransferStateContext::CheckUserEqualsPhone( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::CheckUserEqualsPhone" )
+    
+    return ( aUri.FindF( KSVPUserEqualsPhone ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::RemoveUserEqualsPhone
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::RemoveUserEqualsPhone(
+        HBufC8*& aUri, TInt aPosition ) const
+    {
+    SVPDEBUG2( "CSVPTransferStateContext::RemoveUserEqualsPhone posit = %d", aPosition )
+    
+    aUri->Des().Delete( aPosition, KSVPUserEqualsPhoneLenght );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::RemoveExtraParameters
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::RemoveExtraParameters( HBufC8*& aUri ) const 
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::RemoveExtraParameters In" )
+    
+    // remove all extra parameters from given address
+    TInt index = aUri->Locate( KSVPSemiColonMark );
+    TInt bracketLocation = KErrNotFound;
+    
+    SVPDEBUG3( "CSVPTransferStateContext::RemoveExtraParameters index = %d, length = %d",
+        index, aUri->Length() )
+    
+    if ( KErrNotFound != index )
+        {
+        // Delete ";" and text after it
+        aUri->Des().Delete( index, aUri->Length() );
+        }
+    
+    // Check "<" and remove it and text before it if exists
+    bracketLocation = CheckLeftBracket( *aUri );
+    
+    if ( KErrNotFound != bracketLocation )
+        {
+        RemoveLeftBracket( aUri, bracketLocation );
+        }
+    
+    // Check ">" and remove text after it if exists
+    bracketLocation = CheckRightBracket( *aUri );
+    
+    if ( KErrNotFound != bracketLocation )
+        {
+        CutStringFromPosition( aUri, bracketLocation );
+        }
+    
+    SVPDEBUG1( "CSVPTransferStateContext::RemoveExtraParameters Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CheckReplacesTxt
+// ---------------------------------------------------------------------------
+//
+TInt CSVPTransferStateContext::CheckReplacesTxt( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::CheckReplacesTxt" )
+    
+    return ( aUri.FindF( KSVPQuesReplacesTxt ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CutStringFromPosition
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::CutStringFromPosition(
+        HBufC8*& aUri, TInt aPosition ) const
+    {
+    SVPDEBUG2( "CSVPTransferStateContext::CutStringFromPosition posit = %d", aPosition )
+    aUri->Des().Delete( aPosition, aUri->Length() - aPosition );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CheckReferredByTxt
+// ---------------------------------------------------------------------------
+//
+TInt CSVPTransferStateContext::CheckReferredByTxt(
+        const TDesC8& aReferredBy ) const
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::CheckReferredByTxt" )
+    
+    return ( aReferredBy.FindF( KSVPReferredBy ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::RemoveReferredByTxt
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::RemoveReferredByTxt(
+        HBufC8*& aReferredBy, TInt aPosition ) const
+    {
+    SVPDEBUG2( "CSVPTransferStateContext::RemoveReferredByTxt posit = %d", aPosition )
+    
+    aReferredBy->Des().Delete( aPosition, KSVPReferredByLength + 1 );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::TakeReplacesTxt
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::TakeReplacesTxt(
+        HBufC8*& aString, TInt aPosition ) const
+    {
+    SVPDEBUG2( "CSVPTransferStateContext::TakeReplacesTxt posit = %d", aPosition )
+    
+    aString->Des().Delete( 0, aPosition + KSVPQuesReplacesTxtLength );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CheckLeftBracket
+// ---------------------------------------------------------------------------
+//
+TInt CSVPTransferStateContext::CheckLeftBracket( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::CheckLeftBracket" )
+    
+    // Return position of "<" or KErrNotFound
+    return ( aUri.Find( KSVPLeftBracketMark ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::RemoveLeftBracket
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::RemoveLeftBracket(
+        HBufC8*& aUri, TInt aPosition ) const
+    {
+    SVPDEBUG2( "CSVPTransferStateContext::RemoveLeftBracket posit = %d", aPosition )
+    
+    aUri->Des().Delete( 0, aPosition + KSVPSingleBracketLength );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CheckRightBracket
+// ---------------------------------------------------------------------------
+//
+TInt CSVPTransferStateContext::CheckRightBracket( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::CheckRightBracket" )
+    
+    return ( aUri.Find( KSVPRightBracketMark ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CheckAuthidentity  
+// ---------------------------------------------------------------------------
+//
+TInt CSVPTransferStateContext::CheckAuthidentity( const TDesC8& aUri ) const
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::CheckAuthidentity" )
+    TInt returnValue = aUri.Find( KSVPAuthidentity );
+    SVPDEBUG2( "CSVPTransferStateContext::CheckAuthidentity return: %d", returnValue )
+    if ( returnValue == KErrNotFound )
+        {
+        returnValue = aUri.Find( KSVPAuthidentity2 );
+        SVPDEBUG2( "CSVPTransferStateContext::CheckAuthidentity second return: %d", returnValue )
+        }
+    if ( returnValue == KErrNotFound )
+        {
+        returnValue = aUri.Find( KSVPAuthidentity3 );
+        SVPDEBUG2( "CSVPTransferStateContext::CheckAuthidentity third return: %d", returnValue )
+        }
+    return returnValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::IncomingReferTo
+// ---------------------------------------------------------------------------
+//
+const TDesC& CSVPTransferStateContext::IncomingReferTo()
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::IncomingReferTo" )
+    
+    return *iIncomingReferTo;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::UpdateTransferTargetL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::UpdateTransferTargetL( TInt aSecureStatus )
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::UpdateTransferTargetL In" )
+    
+    if ( iIncomingReferTo )
+        {
+        if ( KSVPStatusNonSecure == aSecureStatus )
+            {
+            SVPDEBUG1( "CSVPTransferStateContext::UpdateTransferTargetL add SIP uri" )
+            
+            // Check "sips:" and remove it if exists
+            if ( KErrNone == iIncomingReferTo->Des().FindF( KSVPSipsPrefix2 ) )
+                {
+                // sips: is in the beginning of the string, position 0
+                SVPDEBUG1( "CSVPTransferStateContext::UpdateTransferTargetL remove sips:" )
+                iIncomingReferTo->Des().Delete( 0, KSVPSipsPrefixLength );
+                }
+            
+            // Add "sip:" prefix in the beginning of the string, if it's missing.
+            if ( KErrNotFound == iIncomingReferTo->Des().FindF( KSVPSipPrefix2 ) )
+                {
+                SVPDEBUG1( "CSVPTransferStateContext::UpdateTransferTargetL add sip:" )
+                iIncomingReferTo = iIncomingReferTo->ReAllocL(
+                        iIncomingReferTo->Length() + KSVPSipPrefixLength );
+                iIncomingReferTo->Des().Insert( 0, KSVPSipPrefix2 );
+                }
+            }
+        else
+            {
+            SVPDEBUG1( "CSVPTransferStateContext::UpdateTransferTargetL add SIPS" )
+            
+            // Check "sip:" and remove it if exists
+            if ( KErrNone == iIncomingReferTo->Des().FindF( KSVPSipPrefix2 ) )
+                {
+                // sip: is in the beginning of the string
+                SVPDEBUG1( "CSVPTransferStateContext::UpdateTransferTargetL remove sip:" )
+                iIncomingReferTo->Des().Delete( 0, KSVPSipPrefixLength );
+                }
+            
+            // Add "sips:" prefix in the beginning of the string, if it's missing.
+            if ( KErrNotFound == iIncomingReferTo->Des().FindF( KSVPSipsPrefix2 ) )
+                {
+                SVPDEBUG1( "CSVPTransferStateContext::UpdateTransferTargetL add sips:" )
+                iIncomingReferTo = iIncomingReferTo->ReAllocL(
+                        iIncomingReferTo->Length() + KSVPSipsPrefixLength );
+                iIncomingReferTo->Des().Insert( 0, KSVPSipsPrefix2 );
+                }
+            }
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPTransferStateContext::UpdateTransferTargetL IncomingReferTo Not OK" )
+        }
+    
+    SVPDEBUG1( "CSVPTransferStateContext::UpdateTransferTargetL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::ResetIncomingReferTo
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::ResetIncomingReferTo()
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::ResetIncomingReferTo" )    
+    
+    if ( iIncomingReferTo )
+        {
+        delete iIncomingReferTo;
+        iIncomingReferTo = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::ResetIncomingReferredBy
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::ResetIncomingReferredBy()
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::ResetIncomingReferredBy" )
+    
+    if ( iIncomingReferredBy )
+        {
+        delete iIncomingReferredBy;
+        iIncomingReferredBy = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::IncomingReferredBy
+// ---------------------------------------------------------------------------
+//
+const TDesC& CSVPTransferStateContext::IncomingReferredBy()
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::IncomingReferredBy" )
+    
+    return *iIncomingReferredBy;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::IncomingReplaces
+// ---------------------------------------------------------------------------
+//
+const TDesC& CSVPTransferStateContext::IncomingReplaces()
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::IncomingReplaces" )
+    
+    return *iIncomingReplaces;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::ResetIncomingReplaces
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::ResetIncomingReplaces()
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::ResetIncomingReplaces" )
+    
+    if ( iIncomingReplaces )
+        {
+        delete iIncomingReplaces;
+        iIncomingReplaces = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::SetTransferParmsL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::SetTransferParmsL(
+        CSVPSessionBase* aTargetSession, const TDesC& aTarget,
+        const TBool aAttendedTransfer )
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::SetTransferParmsL In" )
+    
+    // No target session as default. 
+    iTargetSession = NULL;
+    
+    // Delete possible old refer 
+    delete iMceRefer;
+    iMceRefer = NULL;
+    
+    // Set attended/unattended transfer
+    SetAttended( aAttendedTransfer );
+    
+    // Create mce out refer using given target parameter or call
+    if ( aTarget.Length() > 0 )
+        {
+        CreateMceOutReferL( aTarget );
+        }
+    else
+        {
+        CreateMceOutReferL( aTargetSession );
+        }
+    
+    SVPDEBUG1( "CSVPTransferStateContext::SetTransferParmsL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CreateMceOutReferL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::CreateMceOutReferL( const TDesC& aTarget )
+    {
+    // Create mce out refer using target string (unattended).   
+    SVPDEBUG1( "CSVPTransferStateContext::CreateMceOutReferL(aTarget) In" )
+    
+    // Copy 'refer to' argument
+    HBufC8* target = HBufC8::NewLC( aTarget.Length() );
+    target->Des().Copy( aTarget );
+    
+    // Parse target with uri parser, use session recipient as domain source 
+    CSVPUriParser* uriParser = CSVPUriParser::NewLC();
+    HBufC8* referto = NULL;
+    RPointerArray< CRCSEProfileEntry > entryArray;
+    CleanupResetAndDestroy< RPointerArray<CRCSEProfileEntry> >::PushL( entryArray );
+    CRCSEProfileRegistry* reg = CRCSEProfileRegistry::NewLC();
+    
+    // Get VoIP profile by service id
+    reg->FindByServiceIdL( iSVPSession->Parameters().ServiceId(), entryArray );
+    __ASSERT_ALWAYS( entryArray.Count(), User::Leave( KErrArgument ) );
+    CRCSEProfileEntry* entry = entryArray[0];
+    uriParser->SetUserEqualsPhoneRequiredL(
+            CRCSEProfileEntry::EOn == entry->iUserPhoneUriParameter );
+    
+    CleanupStack::PopAndDestroy( reg );
+    CleanupStack::PopAndDestroy( &entryArray );
+
+    HBufC8* recipient = NULL;
+    const CMceSession& session = iSVPSession->Session();
+    __ASSERT_ALWAYS( &session, User::Leave( KErrArgument ) );
+    
+    TBool isCLIROn = iSVPSession->IsCLIROnL();
+    
+    if ( ( iSVPSession->IsMobileOriginated() && !isCLIROn ) 
+            || ( !iSVPSession->IsMobileOriginated() && isCLIROn ) )
+        {
+        SVPDEBUG1( "CSVPTransferStateContext::CreateMceOutReferL(aTarget), orig" )
+        const TDesC8& orig = session.Originator(); 
+        __ASSERT_ALWAYS( &orig, User::Leave( KErrArgument ) );
+        recipient = HBufC8::NewLC( orig.Length() );
+        recipient->Des().Copy( orig );
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPTransferStateContext::CreateMceOutReferL(aTarget), recip" )
+        const TDesC8& recip = session.Recipient(); 
+        __ASSERT_ALWAYS( &recip, User::Leave( KErrArgument ) );
+        recipient = HBufC8::NewLC( recip.Length() );
+        recipient->Des().Copy( recip );    
+        }
+
+    // remove all extra parameters from recipient address
+    RemoveExtraParameters( recipient );
+    
+    SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTarget) recipient->Length() = %d",
+               recipient->Length() )
+    
+    if ( iSVPSession->SecureMandatory() || iSVPSession->SecurePreferred() )
+        {
+        SVPDEBUG1( "CSVPTransferStateContext::CreateMceOutReferL(aTarget) SIPS URI..." )
+        referto = uriParser->CompleteSecureSipUriL( *target, *recipient );
+        }
+    else
+        {
+        SVPDEBUG1( "CSVPTransferStateContext::CreateMceOutReferL(aTarget) SIP URI..." )
+        referto = uriParser->CompleteSipUriL( *target, *recipient );
+        }
+    
+    CleanupStack::PushL( referto );
+    
+    SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTarget) 1 referto->Length() = %d",
+               referto->Length() )
+    
+    // remove all extra parameters from referto
+    RemoveExtraParameters( referto );
+
+    SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTarget) 2 referto->Length() = %d",
+               referto->Length() )
+    
+    // Create the refer
+    delete iMceRefer;
+    iMceRefer = NULL;
+    iMceRefer = CMceOutRefer::NewL( *iMceSession, *referto, CMceRefer::ENoSuppression );
+    CleanupStack::PopAndDestroy( referto );
+    
+    CleanupStack::PopAndDestroy( recipient );
+    CleanupStack::PopAndDestroy( uriParser );
+    CleanupStack::PopAndDestroy( target );
+    
+    SVPDEBUG1( "CSVPTransferStateContext::CreateMceOutReferL(aTarget) Out" )
+	}
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::CreateMceOutReferL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::CreateMceOutReferL( CSVPSessionBase* aTargetSession )
+    {
+    // Create mce out refer using session (attended).   
+    SVPDEBUG1( "CSVPTransferStateContext::CreateMceOutReferL(aTargetSession) In" )    
+    
+    // Store target session 
+    iTargetSession = aTargetSession;
+    
+    // Construct the refer-to string
+    HBufC8* referto = HBufC8::NewLC( KSVPTempStringlength );
+    TPtr8 refptr = referto->Des();
+    
+    if ( iTargetSession )
+        {
+        // Set refer-to for the attended transfer using the target session,
+        // that can not be the same as the owner session of the 
+        // transfer controller.
+        if ( iSVPSession != iTargetSession )
+            {
+            SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTargetSession) TargetSession = 0x%x", &iTargetSession )
+            
+            HBufC8* recipient = NULL;
+            const CMceSession& session = iTargetSession->Session();
+            __ASSERT_ALWAYS( &session, User::Leave( KErrArgument ) );
+            
+            if ( iTargetSession->IsMobileOriginated() ) 
+                {
+                const TDesC8& recip = session.Recipient();
+                __ASSERT_ALWAYS( &recip, User::Leave( KErrArgument ) );
+                recipient = HBufC8::NewLC( recip.Length() );
+                recipient->Des().Copy( recip );
+                }
+            else
+                {
+                const TDesC8& orig = session.Originator();
+                __ASSERT_ALWAYS( &orig, User::Leave( KErrArgument ) );
+                recipient = HBufC8::NewLC( orig.Length() );
+                recipient->Des().Copy( orig );    
+                }
+            
+            // remove all extra parameters from recipient address
+            RemoveExtraParameters( recipient );
+            
+            SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTargetSession) recipient->Length() = %d",
+               recipient->Length() )
+            
+            // Set the refer-to address (recipient)
+            refptr.Append( recipient->Des() );
+            CleanupStack::PopAndDestroy( recipient );
+            
+            // Gather up the rest of the refer-to data (replaces etc.)  
+            // from the target session (sessionbase) member variables.
+            TBuf8<KSVPTempStringlength> tmp( KNullDesC8 );
+            tmp.Append( KSVPQuesReplacesTxt ); // Set CallId
+            
+            if ( iTargetSession->CallId() )
+                {
+                // Set "replaces" callid string starting from next char 
+                // the of KSVPCallId_replaces -text
+                TDesC8* callid = iTargetSession->CallId();
+                TInt index = callid->Find( KSVPCallId_replaces );
+                
+                if ( KErrNotFound != index )
+                    {
+                    // Check and encode the possible @ char of the callid 
+                    // to "%40" format. This kind of callid e.g. in Cisco 7960.
+                    TInt index2 = callid->Find( KSVPAt );
+                    
+                    if ( KErrNotFound != index2 )
+                	    {
+                	    HBufC8* tmpCallId = HBufC8::NewLC( callid->Length() );
+                	    tmpCallId->Des().Append( callid->Mid( index +
+                	            KSVPCallId_replaces().Length() ) );
+                	    CSVPUriParser::EscapeEncodeSipUriL( tmpCallId,
+                                EscapeUtils::EEscapeUrlEncoded );
+                        tmp.Append( *tmpCallId );
+                        CleanupStack::Pop( 1 ); // tmpCallId, ReAlloc possible
+                        delete tmpCallId;
+                        }
+                    else
+                        {
+                        // Normal copy from the correct position
+                        tmp.Append( callid->Mid( index +
+                                KSVPCallId_replaces().Length() ) );
+                        }
+                    }
+                }
+            else
+                {
+                SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTargetSession) error - missing CallId %i", KSVPErrTransferReferTo )
+                User::Leave( KSVPErrTransferReferTo );
+                }
+            
+            // To-header                    
+            if ( iTargetSession->ToHeader() )
+                {
+                tmp.Append( KSVPTo_tag );
+                
+                // Set "to" tag string starting from next char 
+                // of the KSVPTo_tag_replaces -text
+                TDesC8* toHdr = iTargetSession->ToHeader();
+                TInt index = toHdr->Find( KSVP_tag );
+                SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTargetSession) toHdr index = %d", index )
+                
+                if ( KErrNotFound != index )
+                    {
+                    tmp.Append( toHdr->Mid( index + KSVPTagLength ) );
+                    }
+                }
+            else
+                {
+                SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTargetSession) error - missing ToHeader %i", KSVPErrTransferReferTo )        
+                User::Leave( KSVPErrTransferReferTo );
+                }
+            
+            // From-header
+            if ( iTargetSession->FromHeader() )
+                {                    
+                tmp.Append( KSVPFrom_tag );                    
+                
+                // Set "from" tag string starting from next char of 
+                // the KSVPTo_tag_replaces -text
+                TDesC8* fromHdr = iTargetSession->FromHeader();
+                TInt index = fromHdr->Find( KSVP_tag );
+                SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTargetSession) fromHdr index = %d", index )
+                
+                if ( KErrNotFound != index )
+                    {
+                    tmp.Append( fromHdr->Mid( index + KSVPTagLength ) );
+                    }
+                }
+            else
+                {
+                SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTargetSession) error - missing FromHeader %i", KSVPErrTransferReferTo )
+                User::Leave( KSVPErrTransferReferTo );
+                }
+            
+            refptr.Append( tmp );
+            } // if ( iSVPSession != iTargetSession )
+        else
+            {
+            SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTargetSession) error - the same target session %i", KSVPErrTransferReferTo )
+            User::Leave( KSVPErrTransferReferTo );
+            }
+        
+        // Create the refer
+        iMceRefer = CMceOutRefer::NewL( *iMceSession,
+                *referto, CMceRefer::ENoSuppression );
+        } // if (iTargetSession)
+    else
+        {
+        SVPDEBUG2( "CSVPTransferStateContext::CreateMceOutReferL(aTargetSession) error - no target session %i", KSVPErrTransferReferTo )        
+        User::Leave( KSVPErrTransferReferTo );
+        }
+    
+    CleanupStack::PopAndDestroy( referto );    	
+    
+    SVPDEBUG1( "CSVPTransferStateContext::CreateMceOutReferL(aTargetSession) Out" )        
+	}
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::ExecuteReferL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::ExecuteReferL()
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::ExecuteReferL In" )
+    
+    delete iMceEvent;
+    iMceEvent = NULL;
+    
+    // Create headers for refer call.
+    CDesC8Array* headers = SetupHeadersL();
+    CleanupStack::PushL( headers );
+    
+    // Refer with headers, passes ownership.
+    iMceEvent = static_cast< CMceOutRefer* >(MceRefer())->ReferL( headers );          
+    CleanupStack::Pop( headers );
+    
+    // Execution of the refer. Pass ownership of the arguments. Generates 
+    // event to the MMceReferObserver. New MceOutEvent is created and events 
+    // of that then through MMceEventObserver interface.
+    iSVPSession->StartTimerL( KSVPReferExpirationTime,
+            KSVPReferTimerExpired  );// Start refer timer
+    
+    SVPDEBUG1( "CSVPTransferStateContext::ExecuteReferL Out" )
+	}
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::SetMceEvent
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::SetMceEvent( CMceEvent* aEvent )
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::SetMceEvent In" )
+    
+    if ( iMceEvent != aEvent )
+        {
+        delete iMceEvent;
+        iMceEvent = aEvent;
+        SVPDEBUG1( "CSVPTransferStateContext::SetMceEvent Updated" )
+        }
+    
+    SVPDEBUG1( "CSVPTransferStateContext::SetMceEvent Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::MceEvent
+// ---------------------------------------------------------------------------
+//
+CMceEvent* CSVPTransferStateContext::MceEvent()
+    {
+    return iMceEvent;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::StopReferTimer
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::StopReferTimer()
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::StopReferTimer" )
+    
+    iSVPSession->StopTimer( KSVPReferTimerExpired );
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::SetupHeadersL
+// ---------------------------------------------------------------------------
+//
+CDesC8Array* CSVPTransferStateContext::SetupHeadersL()
+    {
+    SVPDEBUG1( "CSVPTransferStateContext::SetupHeadersL In" )
+    
+    CDesC8ArrayFlat* headers = new( ELeave ) CDesC8ArrayFlat(
+            KSVPHeaderArrayGranularity );
+    CleanupStack::PushL( headers );
+    
+    // Set "referred by" value - that is this end of the session.
+    TBuf8<KSVPTempStringlength> tempRefBy;
+    tempRefBy.Append( KSVPReferredBy );
+    
+    if ( iSVPSession->IsMobileOriginated() )
+        {
+        TDesC8* fromHdr = iSVPSession->FromHeader();
+        if ( fromHdr )
+            {
+            TInt indexLeft = fromHdr->Find( KSVPLeftBracketMark );
+            TInt indexRight = fromHdr->Find( KSVPRightBracketMark );
+            SVPDEBUG3( "CSVPTransferStateContext::SetupHeadersL: indexLeft = %d, indexRight =  %d", indexLeft, indexRight );
+
+            tempRefBy.Append( fromHdr->Mid( indexLeft,
+                    indexRight - indexLeft + KSVPSingleBracketLength ) );
+            }
+        }
+    else
+        {
+        TDesC8* toHdr = iSVPSession->ToHeader();
+        if ( toHdr )
+            {
+            TInt indexLeft = toHdr->Find( KSVPLeftBracketMark );
+            TInt indexRight = toHdr->Find( KSVPRightBracketMark );
+            SVPDEBUG3( "CSVPTransferStateContext::SetupHeadersL: indexLeft = %d, indexRight =  %d", indexLeft, indexRight )
+
+            tempRefBy.Append( toHdr->Mid( indexLeft,
+                    indexRight - indexLeft + KSVPSingleBracketLength ) );
+            }
+        }
+    
+    headers->AppendL( tempRefBy );
+    CleanupStack::Pop( headers );
+    
+    SVPDEBUG1( "CSVPTransferStateContext::SetupHeadersL Out" )
+    return headers;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferStateContext::InitializeStateArrayL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferStateContext::InitializeStateArrayL()
+    {
+    // Create the array of the transfer states.
+    iStates = new ( ELeave ) RPointerArray<CSVPTransferStateBase>
+            ( KSVPTransferStateArraySize );
+    
+    // Transfer state classes are created here:
+    // Idle state
+    CSVPTransferStateBase* state = CSVPTransferIdleState::NewLC();
+    User::LeaveIfError( iStates->Insert(
+            state, KSVPTransferIdleStateIndex ) );
+    CleanupStack::Pop( state );
+    
+    // Pending state
+    state = CSVPTransferPendingState::NewLC();
+    User::LeaveIfError( iStates->Insert(
+            state, KSVPTransferPendingStateIndex ) );
+    CleanupStack::Pop( state );
+    
+    // Accepted state
+    state = CSVPTransferAcceptedState::NewLC();
+    User::LeaveIfError( iStates->Insert(
+            state, KSVPTransferAcceptedStateIndex ) );
+    CleanupStack::Pop( state );
+    
+    // Terminating state
+    state = CSVPTransferTerminatingState::NewLC();
+    User::LeaveIfError( iStates->Insert(
+            state, KSVPTransferTerminatingStateIndex ) );
+    CleanupStack::Pop( state );
+    
+    // Terminated state
+    state = CSVPTransferTerminatedState::NewLC();
+    User::LeaveIfError( iStates->Insert(
+            state, KSVPTransferTerminatedStateIndex ) );
+    CleanupStack::Pop( state );
+    }
+
+// -----------------------------------------------------------------------------
+// CSVPTransferStateContext::IsStateTransitionAccepted
+// -----------------------------------------------------------------------------
+//
+TBool CSVPTransferStateContext::IsStateTransitionAccepted(
+        const TSVPTransferStateIndex aNewState )
+	{
+	TSVPTransferStateIndex current = CurrentState();
+	
+    SVPDEBUG2( "CSVPTransferStateContext::IsStateTransitionAccepted: current  = %d", current )
+    SVPDEBUG2( "CSVPTransferStateContext::IsStateTransitionAccepted: newstate = %d", aNewState )
+    
+    switch( current )
+        {
+        case KErrNotFound:
+            {
+            // Only idle state can be the first one.
+            if ( KSVPTransferIdleStateIndex  == aNewState )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+        
+        case KSVPTransferIdleStateIndex:
+            {
+            if ( KSVPTransferPendingStateIndex == aNewState ||
+                 KSVPTransferTerminatingStateIndex == aNewState )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+        
+        case KSVPTransferPendingStateIndex:
+            {
+            if ( KSVPTransferAcceptedStateIndex == aNewState ||
+                 KSVPTransferTerminatingStateIndex == aNewState )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+        
+        case KSVPTransferAcceptedStateIndex:
+            {
+            // If in accepted state, new transition is valid (return true).
+            // No transition actually occurs because
+            // state "changes" from accepted to accepted.
+            // This ignores sequent icoming NOTIFY's after REFER has been sent.
+            if ( KSVPTransferTerminatingStateIndex == aNewState ||
+                    KSVPTransferAcceptedStateIndex == aNewState)
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+        
+        case KSVPTransferTerminatingStateIndex:
+            {
+            // From terminating state, transition to terminated is accepted.
+            if ( KSVPTransferTerminatingStateIndex == aNewState ||
+                 KSVPTransferTerminatedStateIndex == aNewState )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+        
+        case KSVPTransferTerminatedStateIndex:
+            {
+            // From terminated state, transition to idle is accepted.
+            if ( KSVPTransferIdleStateIndex == aNewState )
+                {
+                return ETrue;
+                }
+            else
+                {
+                return EFalse;
+                }
+            }
+        
+        default:
+            {
+            // Should not come here, since all the states are handled
+            SVPDEBUG1( "CSVPTransferStateContext::IsStateTransitionAccepted - Error" )
+            return EFalse;
+            }
+        // No breaks in switch case due returns.  
+        }
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/src/svptransferterminatedstate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,82 @@
+/*
+* 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:  Transfer state representing the terminated state
+*
+*/
+
+
+#include "svptransferterminatedstate.h"
+#include "svptransferstatecontext.h"
+#include "svplogger.h"
+
+// ---------------------------------------------------------------------------
+// CSVPTransferTerminatedState::CSVPTransferTerminatedState
+// ---------------------------------------------------------------------------
+//
+CSVPTransferTerminatedState::CSVPTransferTerminatedState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferTerminatedState::NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPTransferTerminatedState* CSVPTransferTerminatedState::NewLC()
+    {
+    CSVPTransferTerminatedState* self = new( ELeave ) 
+                                        CSVPTransferTerminatedState;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferTerminatedState::~CSVPTransferTerminatedState
+// ---------------------------------------------------------------------------
+//
+CSVPTransferTerminatedState::~CSVPTransferTerminatedState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferTerminatedState::DoApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferTerminatedState::DoApplyL( 
+                                    CSVPTransferStateContext& aContext )
+    {
+    SVPDEBUG1( "CSVPTransferTerminatedState::DoApplyL In" )
+      
+    // Clear incoming refer handling indication data.
+    aContext.ResetIncomingReferTo();
+    aContext.ResetIncomingReferredBy();
+    aContext.ResetIncomingReplaces();
+    
+    // Clear refer and event data.
+    aContext.SetMceEvent( NULL );
+    aContext.SetMceRefer( NULL );
+    
+    // Set next state - idle. Do not apply yet.
+    aContext.SetCurrentStateL( KSVPTransferIdleStateIndex );
+    
+    SVPDEBUG1( "CSVPTransferTerminatedState::DoApplyL Out" )
+    }
+  
+// ---------------------------------------------------------------------------
+// CSVPTransferTerminatedState::DoEnter
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferTerminatedState::DoEnter( 
+                                    CSVPTransferStateContext& /*aContext*/ )
+    {
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sipvoipprovider/svptransfer/src/svptransferterminatingstate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,75 @@
+/*
+* 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:  Transfer state representing the terminating state
+*
+*/
+
+
+#include "svptransferterminatingstate.h"
+#include "svptransferstatecontext.h"
+#include "svplogger.h"
+
+// ---------------------------------------------------------------------------
+// CSVPTransferTerminatingState::CSVPTransferTerminatingState
+// ---------------------------------------------------------------------------
+//
+CSVPTransferTerminatingState::CSVPTransferTerminatingState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferTerminatingState::NewLC
+// ---------------------------------------------------------------------------
+//
+CSVPTransferTerminatingState* CSVPTransferTerminatingState::NewLC()
+    {
+    CSVPTransferTerminatingState* self = 
+        new( ELeave ) CSVPTransferTerminatingState;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferTerminatingState::~CSVPTransferTerminatingState
+// ---------------------------------------------------------------------------
+//
+CSVPTransferTerminatingState::~CSVPTransferTerminatingState()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferTerminatingState::DoApplyL
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferTerminatingState::DoApplyL( 
+                                    CSVPTransferStateContext& aContext )
+    {
+    SVPDEBUG1( "CSVPTransferTerminatingState::DoApplyL In" )
+    
+    // Set next state - terminated
+    aContext.SetCurrentStateL( KSVPTransferTerminatedStateIndex );
+    aContext.ApplyCurrentStateL();
+    
+    SVPDEBUG1( "CSVPTransferTerminatingState::DoApplyL Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// CSVPTransferTerminatingState::DoEnter
+// ---------------------------------------------------------------------------
+//
+void CSVPTransferTerminatingState::DoEnter( 
+                                    CSVPTransferStateContext& /*aContext*/ )
+    {
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd	Wed Sep 01 12:29:57 2010 +0100
@@ -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/voipplugins/accountcreationplugin/BWINS/accountcreationpluginU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,2 @@
+EXPORTS
+	?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * __cdecl CreateTestSuiteL(void)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/EABI/accountcreationpluginU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z16CreateTestSuiteLv @ 1 NONAME
+
Binary file voipplugins/accountcreationplugin/conf/accountcreationplugin.confml has changed
Binary file voipplugins/accountcreationplugin/conf/accountcreationplugin_2001e321.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/data/2000bef1.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,56 @@
+/*
+* 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:  Resource file for Account Creation Plugin
+*
+*/
+
+
+#include <AiwCommon.hrh>
+#include <ecom/registryinfov2.rh> 
+
+#include "accountcreationpluginuids.hrh"
+
+// RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+//   
+// theInfo
+// REGISTRY_INFO for ECom and AIW ServiceHandler
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2; 
+    dll_uid = KAccountCreationPluginDllUid;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KAiwClassBase;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KAccountCreationPluginImplUid;
+                    version_no = 1;
+                    display_name = r_acp_provider_list_title;
+                    default_data = "*";
+                    opaque_data = KAiwCmdCSCUiExtensionPluginsStr;
+                    }             
+                };
+            }
+        };
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/data/accountcreationplugin.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,565 @@
+/*
+* Copyright (c) 2007-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:  Recource file for Account Creation Plugin
+*
+*/
+
+NAME    ACP0
+
+#include <eikon.rh>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.loc>
+#include <accountcreationplugin.loc>
+
+#include "accountcreationplugin.hrh"
+
+// -----------------------------------------------------------------------------
+//
+// RSS_SIGNATURE   
+// Signature.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE { }
+
+
+RESOURCE TBUF
+    {
+    buf = r_acp_provider_list_title;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+// r_acp_name_in_customer_app
+// Account Creation Plugin name in customer application.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_acp_name_in_customer_app 
+    {
+    buf = qtn_servtab_plugin_name; 
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_provider_list_title
+// Provider list view title.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_acp_provider_list_title                         
+  { 
+  buf = qtn_servtab_catalog_view_title;
+  }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_search_for_wlan_text
+// Search for WLAN option in connection dialog.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_acp_search_for_wlan_text                         
+  {
+  buf = qtn_voip_search_for_wlan;
+  }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_provider_list_menubar
+// Provider list view menubar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_acp_provider_list_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            { 
+            menu_pane = r_acp_provider_list_menu; 
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_provider_list_menu
+// Provider list view options menu.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_acp_provider_list_menu
+    {
+    items =
+        {
+        MENU_ITEM
+          {
+          command = EAknSoftkeySelect;
+          txt = qtn_voip_option_service_details;
+          flags = EEikMenuItemSpecific;
+          },
+        MENU_ITEM
+          {
+          command = EAcpDownload;
+          txt = qtn_voip_option_service_download_service;
+          flags = EEikMenuItemSpecific;
+          },
+        MENU_ITEM 
+          { 
+          command = EAcpRefresh;
+          txt = qtn_servtab_catalog_options_refresh;
+          },
+        MENU_ITEM 
+          { 
+          command = EAcpHelp;
+          txt = qtn_options_help;
+          },
+        MENU_ITEM 
+          { 
+          command = EAknSoftkeyExit; 
+          txt = qtn_options_exit; 
+          }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_acp_softkeys_option_details_back
+// Softkeys (Option - Details - Exit)
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_acp_softkeys_option_details_back
+    {
+    flags = 0;
+    buttons =
+        {
+        CBA_BUTTON 
+            {
+            id = EAknSoftkeyOptions; 
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON 
+            {
+            id = EAknSoftkeyExit;
+            txt = text_softkey_exit;
+            },
+        CBA_BUTTON 
+            {
+            id = EAknSoftkeySelect; 
+            txt = qtn_msk_service_details; 
+            }
+        };
+    }
+
+
+// -----------------------------------------------------------------------------
+//   
+// r_acp_provider_list_view
+// Provider list view.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_acp_provider_list_view 
+    {
+    menubar = r_acp_provider_list_menubar;  
+    cba = r_acp_softkeys_option_details_back;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_provider_specific_menubar
+// Provider specific view menubar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_acp_provider_specific_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            { 
+            menu_pane = r_acp_provider_specific_menu; 
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_provider_specific_menu
+// Provider specific view options menu.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_acp_provider_specific_menu
+    {
+    items =
+        {
+        MENU_ITEM
+          { 
+          command = EAknSoftkeySelect; //EAcpDownload;
+          txt = text_softkey_details;
+          },
+        MENU_ITEM 
+          { 
+          command = EAknSoftkeyBack; 
+          txt = text_softkey_back; 
+          }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_acp_softkeys_get_back
+// Sotkeys (Get - Back)
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_acp_softkeys_get_back
+    {
+    buttons =
+        {
+        CBA_BUTTON 
+          { 
+          id = EAcpDownload;
+          txt = qtn_servtab_cd_softkey_get;
+          },
+        CBA_BUTTON 
+          { 
+          id = EAknSoftkeyCancel; 
+          txt = text_softkey_cancel; 
+          },
+          CBA_BUTTON 
+          { 
+          id = EAcpDownload; 
+          txt = qgn_prop_msk_select; 
+          }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+// r_acp_provider_specific_view
+// Provider specific view.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_acp_provider_specific_view
+    {
+    menubar = r_acp_provider_specific_menubar;   
+    cba = r_acp_softkeys_get_back;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_query_menubar
+// Query view menubar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_acp_query_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            { 
+            menu_pane = r_acp_query_menu; 
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_query_menu
+// Query view options menu.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_acp_query_menu
+    {
+    items =
+        {        
+        MENU_ITEM 
+          { 
+          command = EAknSoftkeyOk; 
+          txt = text_softkey_ok;
+          },
+        MENU_ITEM 
+          { 
+          command = EAknSoftkeySelect; 
+          txt = text_softkey_details;
+          },
+        MENU_ITEM 
+          { 
+          command = EAknSoftkeyCancel; 
+          txt = text_softkey_cancel; 
+          }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+// r_acp_query_view
+// Query view.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_acp_query_view
+    {
+    menubar = r_acp_query_menubar;   
+    cba = R_AVKON_SOFTKEYS_OK_CANCEL__SELECT;//R_AVKON_SOFTKEYS_OK_CANCEL;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_provider_list_no_providers
+// Provider list view data when there are no providers in list.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_acp_provider_list_no_providers                         
+  { 
+  buf = qtn_service_catalog_empty_text;
+  }
+    
+// -----------------------------------------------------------------------------
+//
+// r_acp_wait_note_text
+// Text to be shown in global wait note.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_acp_wait_note_text                         
+  { 
+  buf = qtn_servtab_updating_service_catalog;
+  }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_download_note_text
+// Text to be shown in global download wait note.
+//
+// -----------------------------------------------------------------------------
+//
+/*
+RESOURCE TBUF r_acp_download_note_text                         
+  { 
+  buf = qtn_acp_download_note_text;
+  }
+*/
+
+// -----------------------------------------------------------------------------
+//
+// r_servtab_cd_detail_name
+// Provider name to be shown in details.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_servtab_cd_detail_name                         
+  { 
+  buf = qtn_servtab_cd_detail_name;
+  }
+
+// -----------------------------------------------------------------------------
+//
+// r_servtab_cd_detail_type
+// Provider type to be shown in details.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_servtab_cd_detail_type                         
+  { 
+  buf = qtn_servtab_cd_detail_type;
+  }
+
+// -----------------------------------------------------------------------------
+//
+// r_servtab_cd_detail_description
+// Provider description to be shown in details.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_servtab_cd_detail_description                         
+  { 
+  buf = qtn_servtab_cd_detail_description;
+  }
+
+// -----------------------------------------------------------------------------
+//
+// r_servtab_cd_detail_size
+// Size to be shown in details.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_servtab_cd_detail_size                         
+  { 
+  buf = qtn_servtab_cd_detail_size;
+  }
+
+// -----------------------------------------------------------------------------
+//
+// r_servtab_cd_detail_vendor
+// Vendor to be shown in details.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_servtab_cd_detail_vendor                         
+  { 
+  buf = qtn_servtab_cd_detail_vendor;
+  }
+
+// -----------------------------------------------------------------------------
+//
+// r_servtab_cd_value_undefined
+// Undefined provider values in details.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_servtab_cd_value_undefined                         
+  { 
+  buf = qtn_servtab_cd_value_undefined;
+  }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_connection_query
+// Connection selection dialog.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LIST_QUERY r_acp_connection_query 
+    {
+    flags = EGeneralQueryFlags;
+    softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items = 
+        {
+         AVKON_LIST_QUERY_DLG_LINE 
+            {
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    flags = EAknListBoxSelectionList;
+                    };
+
+                heading = qtn_voip_select_connection_text;
+                };
+            }
+        };
+    }            
+
+// ---------------------------------------------------------------------------
+//   
+//    r_acp_connection_failed
+//    Error note text.
+//
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_acp_connection_failed
+    {
+    buf = qtn_servtab_creating_connection_failed_note;
+    }
+
+// ---------------------------------------------------------------------------
+//   
+//    r_acp_download_failed
+//    Error note text.
+//
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_acp_download_failed
+    {
+    buf = qtn_servtab_downloading_service_failed_note;
+    }
+
+// ---------------------------------------------------------------------------
+//   
+//    r_type_text
+//    Resource for Type Edwin
+//
+// ---------------------------------------------------------------------------
+//
+RESOURCE EDWIN r_acp_type 
+    {
+    flags = EEikEdwinReadOnly;
+    width = 100;
+    lines = 8;
+    maxlength = 300;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_connection_conf_query
+// Text to be shown in connection confirmation query.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_acp_connection_conf_query
+  { 
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationLayout;
+                label = qtn_servtab_connection_conf_query;
+                };
+            }
+        };
+  }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_service_installed_note
+// Text to be shown after successful service installation.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_acp_service_installed_note
+    {
+    buf = qtn_servtab_installation_completed_note;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_service_installed_from_widget_note
+// Text to be shown after successful service installation when installation
+// was initiated from homescreen service widget.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_acp_service_installed_from_widget_note
+    {
+    buf = qtn_servtab_installation_completed_msg_query;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_acp_downloading_provider_text
+// Text to be shown while settings are being downloaded
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_acp_downloading_provider_text
+    {
+    buf = qtn_servtab_downloading_settings_wait_note;
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/data/xmlfile.xml	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Sample XML file generated by XMLSpy v2005 rel. 3 U (http://www.altova.com)-->
+<Nokia-NSA-VoIP-QueryResp xmlns="urn:nokia:serviceactivation:voip:2007-11" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:nokia:serviceactivation:voip:2007-11
+U:\voip\voip-s60-schema.xsd">
+	<Provider>
+		<providerName>Slick - Sisfile</providerName>
+		<providerDescription>Slick sis-installation file</providerDescription>
+		<providerType>Installationfile</providerType>
+		<iconUrl>http://www.altova.com</iconUrl>
+		<createUrl/>
+		<activateUrl/>
+		<sis>
+			<sisUrl>http://Koti.mbnet.fi/ossik/xml/Slick.sis</sisUrl>
+			<reportUrl/>
+		</sis>
+	</Provider>
+	<Provider>
+		<providerName>Juutube - Activate account</providerName>
+		<providerDescription>Slick sis-installation file</providerDescription>
+		<providerType>Installationfile</providerType>
+		<iconUrl>http://www.altova.com</iconUrl>
+		<createUrl/>
+		<activateUrl/>
+		<sis>
+			<sisUrl></sisUrl>
+			<reportUrl/>
+		</sis>
+	</Provider>
+</Nokia-NSA-VoIP-QueryResp>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/BWINS/accountcreationengineu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,24 @@
+EXPORTS
+	?ActiveIndex@CAcpController@@QBEHXZ @ 1 NONAME ; int CAcpController::ActiveIndex(void) const
+	?CancelHttpRequest@CAcpController@@QAEXXZ @ 2 NONAME ; void CAcpController::CancelHttpRequest(void)
+	?CountOfProviders@CAcpController@@QBEHXZ @ 3 NONAME ; int CAcpController::CountOfProviders(void) const
+	?FetchActionFileL@CAcpController@@QAEXABVTDesC8@@@Z @ 4 NONAME ; void CAcpController::FetchActionFileL(class TDesC8 const &)
+	?FetchIconFileFromNetworkL@CAcpController@@QAEXAAVTDesC8@@@Z @ 5 NONAME ; void CAcpController::FetchIconFileFromNetworkL(class TDesC8 &)
+	?FetchParametersL@CAcpController@@QAEXAAVTDes16@@@Z @ 6 NONAME ; void CAcpController::FetchParametersL(class TDes16 &)
+	?FetchProviderListFromNetworkL@CAcpController@@QAEXXZ @ 7 NONAME ; void CAcpController::FetchProviderListFromNetworkL(void)
+	?FetchSisFileFromNetworkL@CAcpController@@QAEXAAVTDesC8@@@Z @ 8 NONAME ; void CAcpController::FetchSisFileFromNetworkL(class TDesC8 &)
+	?NewL@CAcpController@@SAPAV1@AAVMAcpControllerObserver@@@Z @ 9 NONAME ; class CAcpController * CAcpController::NewL(class MAcpControllerObserver &)
+	?NewLC@CAcpController@@SAPAV1@AAVMAcpControllerObserver@@@Z @ 10 NONAME ; class CAcpController * CAcpController::NewLC(class MAcpControllerObserver &)
+	?NotifyParsedProviderL@CAcpController@@UAEXABVCAcpProvider@@@Z @ 11 NONAME ; void CAcpController::NotifyParsedProviderL(class CAcpProvider const &)
+	?NotifyParsingCompleted@CAcpController@@UAEXH@Z @ 12 NONAME ; void CAcpController::NotifyParsingCompleted(int)
+	?ProviderActivationUrlFromIndexL@CAcpController@@QBE?BVTPtrC8@@H@Z @ 13 NONAME ; class TPtrC8 const CAcpController::ProviderActivationUrlFromIndexL(int) const
+	?ProviderBitmapsFromIndexL@CAcpController@@QBEXHAAPAVCFbsBitmap@@0@Z @ 14 NONAME ; void CAcpController::ProviderBitmapsFromIndexL(int, class CFbsBitmap * &, class CFbsBitmap * &) const
+	?ProviderCreationUrlFromIndexL@CAcpController@@QBE?BVTPtrC8@@H@Z @ 15 NONAME ; class TPtrC8 const CAcpController::ProviderCreationUrlFromIndexL(int) const
+	?ProviderDescriptionFromIndexL@CAcpController@@QBE?BVTPtrC16@@H@Z @ 16 NONAME ; class TPtrC16 const CAcpController::ProviderDescriptionFromIndexL(int) const
+	?ProviderIconUrlFromIndexL@CAcpController@@QBE?BVTPtrC8@@H@Z @ 17 NONAME ; class TPtrC8 const CAcpController::ProviderIconUrlFromIndexL(int) const
+	?ProviderNameFromIndexL@CAcpController@@QBE?BVTPtrC16@@H@Z @ 18 NONAME ; class TPtrC16 const CAcpController::ProviderNameFromIndexL(int) const
+	?ProviderSisUrlFromIndexL@CAcpController@@QBE?BVTPtrC8@@H@Z @ 19 NONAME ; class TPtrC8 const CAcpController::ProviderSisUrlFromIndexL(int) const
+	?ProviderTypeFromIndexL@CAcpController@@QBE?BVTPtrC16@@H@Z @ 20 NONAME ; class TPtrC16 const CAcpController::ProviderTypeFromIndexL(int) const
+	?SaveActiveIndex@CAcpController@@QAEXH@Z @ 21 NONAME ; void CAcpController::SaveActiveIndex(int)
+	?SessionId@CAcpController@@QAEABVTDesC8@@XZ @ 22 NONAME ; class TDesC8 const & CAcpController::SessionId(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/EABI/accountcreationengineU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,28 @@
+EXPORTS
+	_ZN14CAcpController15SaveActiveIndexEi @ 1 NONAME
+	_ZN14CAcpController16FetchActionFileLERK6TDesC8 @ 2 NONAME
+	_ZN14CAcpController16FetchParametersLER6TDes16 @ 3 NONAME
+	_ZN14CAcpController17CancelHttpRequestEv @ 4 NONAME
+	_ZN14CAcpController24FetchSisFileFromNetworkLER6TDesC8 @ 5 NONAME
+	_ZN14CAcpController25FetchIconFileFromNetworkLER6TDesC8 @ 6 NONAME
+	_ZN14CAcpController29FetchProviderListFromNetworkLEv @ 7 NONAME
+	_ZN14CAcpController4NewLER22MAcpControllerObserver @ 8 NONAME
+	_ZN14CAcpController5NewLCER22MAcpControllerObserver @ 9 NONAME
+	_ZN14CAcpController9SessionIdEv @ 10 NONAME
+	_ZNK14CAcpController11ActiveIndexEv @ 11 NONAME
+	_ZNK14CAcpController16CountOfProvidersEv @ 12 NONAME
+	_ZNK14CAcpController22ProviderNameFromIndexLEi @ 13 NONAME
+	_ZNK14CAcpController22ProviderTypeFromIndexLEi @ 14 NONAME
+	_ZNK14CAcpController24ProviderSisUrlFromIndexLEi @ 15 NONAME
+	_ZNK14CAcpController25ProviderBitmapsFromIndexLEiRP10CFbsBitmapS2_ @ 16 NONAME
+	_ZNK14CAcpController25ProviderIconUrlFromIndexLEi @ 17 NONAME
+	_ZNK14CAcpController29ProviderCreationUrlFromIndexLEi @ 18 NONAME
+	_ZNK14CAcpController29ProviderDescriptionFromIndexLEi @ 19 NONAME
+	_ZNK14CAcpController31ProviderActivationUrlFromIndexLEi @ 20 NONAME
+	_ZTI12CAcpProvider @ 21 NONAME ; #<TI>#
+	_ZTI16CAcpImageHandler @ 22 NONAME ; #<TI>#
+	_ZTI17CACPBrowserParams @ 23 NONAME ; #<TI>#
+	_ZTV12CAcpProvider @ 24 NONAME ; #<VT>#
+	_ZTV16CAcpImageHandler @ 25 NONAME ; #<VT>#
+	_ZTV17CACPBrowserParams @ 26 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/group/accountcreationengine.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2007-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 Account Creation Plugin
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../inc/accountcreationpluginuids.hrh"
+
+TARGET      accountcreationengine.dll
+CAPABILITY  CAP_GENERAL_DLL
+TARGETTYPE  dll
+
+UID         0x1000006C 0x2000BEF3
+VENDORID    VID_DEFAULT
+
+SOURCEPATH  ../src
+SOURCE      acpprovider.cpp
+SOURCE      acpcontroller.cpp
+SOURCE      acpxmlhandler.cpp
+SOURCE      acphttphandler.cpp
+SOURCE      acpbrowserparams.cpp
+SOURCE      acpimagehandler.cpp
+
+USERINCLUDE ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+LIBRARY     bafl.lib
+LIBRARY     http.lib
+LIBRARY     euser.lib
+LIBRARY     efsrv.lib
+LIBRARY     xmlframework.lib
+LIBRARY     inetprotutil.lib
+LIBRARY     estor.lib
+LIBRARY     downloadmgruilib.lib
+LIBRARY     downloadmgr.lib 
+LIBRARY     commdb.lib 
+LIBRARY	    etel.lib
+LIBRARY     etelmm.lib
+LIBRARY     eikcore.lib
+LIBRARY     sipprofilecli.lib
+LIBRARY     apparc.lib
+LIBRARY     apgrfx.lib 
+LIBRARY     cone.lib
+LIBRARY     charconv.lib
+LIBRARY     centralrepository.lib
+LIBRARY     imageconversion.lib
+LIBRARY     fbscli.lib
+LIBRARY     egul.lib
+LIBRARY     bitmaptransforms.lib
+LIBRARY     platformenv.lib
+LIBRARY     esock.lib
+LIBRARY     sipclient.lib
+LIBRARY     xdmsettingsapi.lib
+LIBRARY     presencesettingsapi.lib 
+LIBRARY     cryptography.lib
+LIBRARY     provisioningengine.lib
+
+#ifdef __PLUG_AND_PLAY_MOBILE_SERVICES    
+LIBRARY     pnp.lib
+#endif
+LIBRARY     sysversioninfo.lib 
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/group/accountcreationengine.xml	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,2054 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!DOCTYPE PROJECT [
+ <!ELEMENT PROJECT (TARGETLIST, TARGETORDER, GROUPLIST, DESIGNLIST?)>
+ <!ELEMENT TARGETLIST (TARGET+)>
+ <!ELEMENT TARGET (NAME, SETTINGLIST, FILELIST?, LINKORDER?, SEGMENTLIST?, OVERLAYGROUPLIST?, SUBTARGETLIST?, SUBPROJECTLIST?, FRAMEWORKLIST?, PACKAGEACTIONSLIST?)>
+ <!ELEMENT NAME (#PCDATA)>
+ <!ELEMENT USERSOURCETREETYPE (#PCDATA)>
+ <!ELEMENT PATH (#PCDATA)>
+ <!ELEMENT FILELIST (FILE*)>
+ <!ELEMENT FILE (PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?, ROOTFILEREF?, FILEKIND?, FILEFLAGS?)>
+ <!ELEMENT PATHTYPE (#PCDATA)>
+ <!ELEMENT PATHROOT (#PCDATA)>
+ <!ELEMENT ACCESSPATH (#PCDATA)>
+ <!ELEMENT PATHFORMAT (#PCDATA)>
+ <!ELEMENT ROOTFILEREF (PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?)>
+ <!ELEMENT FILEKIND (#PCDATA)>
+ <!ELEMENT FILEFLAGS (#PCDATA)>
+ <!ELEMENT FILEREF (TARGETNAME?, PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?)>
+ <!ELEMENT TARGETNAME (#PCDATA)>
+ <!ELEMENT SETTINGLIST ((SETTING|PANELDATA)+)>
+ <!ELEMENT SETTING (NAME?, (VALUE|(SETTING+)))>
+ <!ELEMENT PANELDATA (NAME, VALUE)>
+ <!ELEMENT VALUE (#PCDATA)>
+ <!ELEMENT LINKORDER (FILEREF*)>
+ <!ELEMENT SEGMENTLIST (SEGMENT+)>
+ <!ELEMENT SEGMENT (NAME, ATTRIBUTES?, FILEREF*)>
+ <!ELEMENT ATTRIBUTES (#PCDATA)>
+ <!ELEMENT OVERLAYGROUPLIST (OVERLAYGROUP+)>
+ <!ELEMENT OVERLAYGROUP (NAME, BASEADDRESS, OVERLAY*)>
+ <!ELEMENT BASEADDRESS (#PCDATA)>
+ <!ELEMENT OVERLAY (NAME, FILEREF*)>
+ <!ELEMENT SUBTARGETLIST (SUBTARGET+)>
+ <!ELEMENT SUBTARGET (TARGETNAME, ATTRIBUTES?, FILEREF?)>
+ <!ELEMENT SUBPROJECTLIST (SUBPROJECT+)>
+ <!ELEMENT SUBPROJECT (FILEREF, SUBPROJECTTARGETLIST)>
+ <!ELEMENT SUBPROJECTTARGETLIST (SUBPROJECTTARGET*)>
+ <!ELEMENT SUBPROJECTTARGET (TARGETNAME, ATTRIBUTES?, FILEREF?)>
+ <!ELEMENT FRAMEWORKLIST (FRAMEWORK+)>
+ <!ELEMENT FRAMEWORK (FILEREF, DYNAMICLIBRARY?, VERSION?)>
+ <!ELEMENT PACKAGEACTIONSLIST (PACKAGEACTION+)>
+ <!ELEMENT PACKAGEACTION (#PCDATA)>
+ <!ELEMENT LIBRARYFILE (FILEREF)>
+ <!ELEMENT VERSION (#PCDATA)>
+ <!ELEMENT TARGETORDER (ORDEREDTARGET|ORDEREDDESIGN)*>
+ <!ELEMENT ORDEREDTARGET (NAME)>
+ <!ELEMENT ORDEREDDESIGN (NAME, ORDEREDTARGET+)>
+ <!ELEMENT GROUPLIST (GROUP|FILEREF)*>
+ <!ELEMENT GROUP (NAME, (GROUP|FILEREF)*)>
+ <!ELEMENT DESIGNLIST (DESIGN+)>
+ <!ELEMENT DESIGN (NAME, DESIGNDATA)>
+ <!ELEMENT DESIGNDATA (#PCDATA)>
+]>
+<?codewarrior exportversion="1.0.1" ideversion="5.0" ?>
+<PROJECT>
+    <TARGETLIST>
+        <TARGET>
+            <NAME>ARMV5 UREL</NAME>
+            <SETTINGLIST>
+
+                <!-- Settings for "Source Trees" panel -->
+                <SETTING><NAME>UserSourceTrees</NAME></SETTING>
+
+                <!-- Settings for "Access Paths" panel -->
+                <SETTING><NAME>AlwaysSearchUserPaths</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>InterpretDOSAndUnixPaths</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>RequireFrameworkStyleIncludes</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SourceRelativeIncludes</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>UserSearchPaths</NAME>
+                    <SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\inc</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\eabi</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\src</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING></SETTING>
+                <SETTING><NAME>SystemSearchPaths</NAME>
+                    <SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\oem</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\middleware</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\domain\middleware</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\osextensions</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\domain\osextensions</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\ecom</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UREL</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\LIB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\rvct2_2</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING></SETTING>
+
+                <!-- Settings for "Debugger Runtime" panel -->
+                <SETTING><NAME>MWRuntimeSettings_WorkingDirectory</NAME><VALUE/></SETTING>
+                <SETTING><NAME>MWRuntimeSettings_CommandLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>MWRuntimeSettings_HostApplication</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>MWRuntimeSettings_EnvVars</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Target Settings" panel -->
+                <SETTING><NAME>Linker</NAME><VALUE>Symbian Linker v2</VALUE></SETTING>
+                <SETTING><NAME>PreLinker</NAME><VALUE/></SETTING>
+                <SETTING><NAME>PostLinker</NAME><VALUE>Symbian Installer v2</VALUE></SETTING>
+                <SETTING><NAME>Targetname</NAME><VALUE>ARMV5 UREL</VALUE></SETTING>
+                <SETTING><NAME>OutputDirectory</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UREL</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SaveEntriesUsingRelativePaths</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "File Mappings" panel -->
+                <SETTING><NAME>FileMappings</NAME>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>._i</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>._ii</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.c</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cc</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cfg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cia</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ciacpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cwlink</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>XML</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cxx</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.def</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.h</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.hrh</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.i</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.iby</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ii</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.inf</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ini</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.inl</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.loc</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ciacpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.mmp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.mmpi</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.pkg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.policy</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ra</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.resources</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Resource v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>XML</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>true</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rh</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rls</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rss</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rsg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.s</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.script</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.txt</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.a</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.lib</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.dso</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.o</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                </SETTING>
+
+                <!-- Settings for "Build Extras" panel -->
+                <SETTING><NAME>CacheModDates</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>DumpBrowserInfo</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CacheSubprojects</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>UseThirdPartyDebugger</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>BrowserGenerator</NAME><VALUE>2</VALUE></SETTING>
+                <SETTING><NAME>DebuggerAppPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>DebuggerCmdLineArgs</NAME><VALUE/></SETTING>
+                <SETTING><NAME>DebuggerWorkingDir</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CodeCompletionPrefixFileName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CodeCompletionMacroFileName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Debugger Target" panel -->
+                <SETTING><NAME>ConsoleEncoding</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>LogSystemMessages</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>AutoTargetDLLsPopUp</NAME><VALUE>2</VALUE></SETTING>
+                <SETTING><NAME>StopAtWatchpoints</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>PauseWhileRunning</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>PauseInterval</NAME><VALUE>5</VALUE></SETTING>
+                <SETTING><NAME>PauseUIFlags</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>AltExePath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>StopAtTempBPOnLaunch</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CacheSymbolics</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>TempBPFunctionName</NAME><VALUE>main</VALUE></SETTING>
+                <SETTING><NAME>TempBPType</NAME><VALUE>0</VALUE></SETTING>
+
+                <!-- Settings for "Remote Debug" panel -->
+                <SETTING><NAME>Enabled</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>ConnectionName</NAME><VALUE>Symbian MetroTrk</VALUE></SETTING>
+                <SETTING><NAME>DownloadPath</NAME><VALUE>C:\sys\bin\</VALUE></SETTING>
+                <SETTING><NAME>LaunchRemoteApp</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>RemoteAppPath</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CoreID</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>JTAGClockSpeed</NAME><VALUE>8000</VALUE></SETTING>
+                <SETTING><NAME>IsMultiCore</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OSDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>UseGlobalOSDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OSDownloadConnectionName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>OSDownloadPath</NAME><VALUE/></SETTING>
+                <SETTING><NAME>AltDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>AltDownloadConnectionName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Auto-target" panel -->
+                <SETTING><NAME>OtherExecutables</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Analyzer Connections" panel -->
+                <SETTING><NAME>AnalyzerConnectionName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Custom Keywords" panel -->
+                <SETTING><NAME>CustomColor1</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor2</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor3</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor4</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "ARM Debugger" panel -->
+                <SETTING><NAME>Processor</NAME><VALUE>Generic</VALUE></SETTING>
+                <SETTING><NAME>BraekPoinType_II</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseInitFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseConfigFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>IDexecutable</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>IDinitialized</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>IDuninitialized</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>IDconstant</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDexecutable</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDinitialized</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDuninitialized</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>SDconstant</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>VerifyMemWrites</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>ShowMPC107regs</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>InitializationFile</NAME><VALUE/></SETTING>
+                <SETTING><NAME>ConfigurationFile</NAME><VALUE/></SETTING>
+                <SETTING><NAME>BreakpointType</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>WatchpointType</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>TargetOS</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>RTOSPluginName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>ByteOrderType</NAME><VALUE>0</VALUE></SETTING>
+                <PANELDATA><NAME>CodeTest SYMBIAN Instrumenter</NAME><VALUE>
+                    0200020000000100000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000433A5C0000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000637466696C657300000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000636F6465746573742E6964620000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000
+                </VALUE></PANELDATA>
+
+                <!-- Settings for "Symbian Installation" panel -->
+                <SETTING><NAME>SymbianInstallationOutputFilename</NAME><VALUE>Application.sis</VALUE></SETTING>
+                <SETTING><NAME>SymbianInstallationOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>SymbianInstallationContentSearchLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UREL</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianInstallationPassword</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianInstallationCreateStubFile</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Installer Panel v2" panel -->
+                <SETTING><NAME>SymbianInstallationOutputFilename</NAME><VALUE>Application.sis</VALUE></SETTING>
+                <SETTING><NAME>SymbianInstallationOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>SymbianInstallationContentSearchLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UREL</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianInstallationPassword</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianInstallationCreateStubFile</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Resource Panel" panel -->
+                <SETTING><NAME>SymbianResourcesMMPFileLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesBinaryOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\data</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesHeaderFileOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Symbian Resources Panel v2" panel -->
+                <SETTING><NAME>SymbianResourcesMMPFileLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesBinaryOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\data</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesHeaderFileOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Remote Download" panel -->
+                <SETTING><NAME>FileList</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Symbian ARM Debugger" panel -->
+                <SETTING><NAME>Processor</NAME><VALUE>Generic</VALUE></SETTING>
+                <SETTING><NAME>UseInitFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseConfigFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>ResetTarget</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>InitializationFile</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>ConfigurationFile</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>TargetOS</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>RTOSPluginName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Symbian Common Panel" panel -->
+                <SETTING><NAME>ShowCommandLine</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SymbianEpocToolsPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE></VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Symbian Compiler Panel" panel -->
+                <SETTING><NAME>PrefixFile</NAME><VALUE>rvct2_2.h</VALUE></SETTING>
+                <SETTING><NAME>CompilerXMLDescriptor</NAME><VALUE>ARM RVCT2_2</VALUE></SETTING>
+                <SETTING><NAME>Macros</NAME><VALUE>__SYMBIAN32__,__ARMCC__,__EPOC32__,__MARM__,__EABI__,__ARMCC_2__,__ARMCC_2_2__,__MARM_ARMV5__,__DLL__,NDEBUG,_UNICODE,__SUPPORT_CPP_EXCEPTIONS__,__PRODUCT_INCLUDE__=\"feature_settings.hrh\"</VALUE></SETTING>
+                <SETTING><NAME>CodeTEST</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>EnableSWIC</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Arguments</NAME><VALUE> -O2 --diag_suppress 66,161,611,654,997,1152,1300,1464,1488,6318,6331  --diag_error 1267 --thumb  --fpu softvfp --exceptions --exceptions_unwind -D__MARM_THUMB__ -D__MARM_INTERWORK__  --cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --export_all_vtbl --no_vfe --apcs /inter --dllimport_runtime</VALUE></SETTING>
+                <SETTING><NAME>CIAArgs</NAME><VALUE>-x c++ -D__CIA__</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Debugging" panel -->
+                <SETTING><NAME>Parse Log File</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Log File Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Symbian SDK Folder</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Log Unresolved Modules</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Log Unresolved Sym Files</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Debug Non-XIP Executables</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Kernel Debugging" panel -->
+                <SETTING><NAME>Start Address</NAME><VALUE>0x00000000</VALUE></SETTING>
+                <SETTING><NAME>Run From Start Address</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Download Image</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OS Image Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Download Address</NAME><VALUE>0x00000000</VALUE></SETTING>
+                <SETTING><NAME>Ask First</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Debug Bootrom</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Bootrom Sym File</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "Symbian Linker Panel" panel -->
+                <SETTING><NAME>LinkOutputFile</NAME><VALUE>accountcreationengine.dll</VALUE></SETTING>
+                <SETTING><NAME>LinkCmdLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianImportLibrary</NAME><VALUE>accountcreationengine{000a0000}.lib</VALUE></SETTING>
+                <SETTING><NAME>canDebug</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>canRun</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian RomBuild Panel" panel -->
+                <SETTING><NAME>CommandLine</NAME><VALUE>buildrom -D_DEBUG devkit lubbock techview -olubbock_gui.img</VALUE></SETTING>
+                <SETTING><NAME>OutputPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>DisplayMessages</NAME><VALUE>true</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Target" panel -->
+                <SETTING><NAME>TargetArchitecture</NAME><VALUE>WINSCW</VALUE></SETTING>
+                <SETTING><NAME>LogMessages</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SuppressWarnings</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>GenerateSymbolics</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CompilerPrefix</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CompilerCmdLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianImportLibraryPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "Symbian Tools" panel -->
+                <SETTING><NAME>Gnu Tools Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Epoc32 Tools Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+            </SETTINGLIST>
+            <FILELIST>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengine.mmp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineu.def</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpprovider.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderfield.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpcontroller.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpxmlhandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acphttphandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpbrowserparams.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpimagehandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>bafl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>http.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>euser.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>efsrv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>xmlframework.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>inetprotutil.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>estor.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>swinstcli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>downloadmgruilib.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>downloadmgr.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>commdb.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>etel.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>etelmm.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>eikcore.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>sipprofilecli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>apparc.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>apgrfx.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>cone.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>charconv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>centralrepository.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>imageconversion.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>fbscli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>egul.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>bitmaptransforms.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineconstants.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginlogger.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpbrowserparams.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpcontroller.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acphttphandler.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpimagehandler.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpprovider.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderfield.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpxmlhandler.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>macpcontrollerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>macphttphandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>macpimagehandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>macpxmlhandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>PnpToPaosInterface.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>PnpUtilImpl.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineARMV5UREL.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+</FILELIST>
+            <LINKORDER>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengine.mmp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineu.def</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpprovider.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderfield.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpcontroller.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpxmlhandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acphttphandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpbrowserparams.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpimagehandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>bafl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>http.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>euser.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>efsrv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>xmlframework.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>inetprotutil.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>estor.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>swinstcli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>downloadmgruilib.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>downloadmgr.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>commdb.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>etel.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>etelmm.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>eikcore.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>sipprofilecli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>apparc.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>apgrfx.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>cone.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>charconv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>centralrepository.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>imageconversion.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>fbscli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>egul.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>bitmaptransforms.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineconstants.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginlogger.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpbrowserparams.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpcontroller.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acphttphandler.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpimagehandler.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpprovider.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderfield.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpxmlhandler.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>macpcontrollerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>macphttphandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>macpimagehandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>macpxmlhandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>PnpToPaosInterface.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>PnpUtilImpl.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineARMV5UREL.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</LINKORDER>
+        </TARGET><TARGET>
+            <NAME>ARMV5 UDEB</NAME>
+            <SETTINGLIST>
+
+                <!-- Settings for "Source Trees" panel -->
+                <SETTING><NAME>UserSourceTrees</NAME></SETTING>
+
+                <!-- Settings for "Access Paths" panel -->
+                <SETTING><NAME>AlwaysSearchUserPaths</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>InterpretDOSAndUnixPaths</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>RequireFrameworkStyleIncludes</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SourceRelativeIncludes</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>UserSearchPaths</NAME>
+                    <SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\inc</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\eabi</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\src</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING></SETTING>
+                <SETTING><NAME>SystemSearchPaths</NAME>
+                    <SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\oem</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\middleware</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\domain\middleware</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\osextensions</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\domain\osextensions</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\ecom</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UDEB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\LIB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\rvct2_2</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING></SETTING>
+
+                <!-- Settings for "Debugger Runtime" panel -->
+                <SETTING><NAME>MWRuntimeSettings_WorkingDirectory</NAME><VALUE/></SETTING>
+                <SETTING><NAME>MWRuntimeSettings_CommandLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>MWRuntimeSettings_HostApplication</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>MWRuntimeSettings_EnvVars</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Target Settings" panel -->
+                <SETTING><NAME>Linker</NAME><VALUE>Symbian Linker v2</VALUE></SETTING>
+                <SETTING><NAME>PreLinker</NAME><VALUE/></SETTING>
+                <SETTING><NAME>PostLinker</NAME><VALUE>Symbian Installer v2</VALUE></SETTING>
+                <SETTING><NAME>Targetname</NAME><VALUE>ARMV5 UDEB</VALUE></SETTING>
+                <SETTING><NAME>OutputDirectory</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UDEB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SaveEntriesUsingRelativePaths</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "File Mappings" panel -->
+                <SETTING><NAME>FileMappings</NAME>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>._i</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>._ii</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.c</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cc</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cfg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cia</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ciacpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cwlink</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>XML</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cxx</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.def</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.h</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.hrh</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.i</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.iby</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ii</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.inf</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ini</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.inl</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.loc</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ciacpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.mmp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.mmpi</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.pkg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.policy</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ra</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.resources</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Resource v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>XML</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>true</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rh</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rls</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rss</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rsg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.s</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.script</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.txt</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.a</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.lib</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.dso</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.o</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                </SETTING>
+
+                <!-- Settings for "Build Extras" panel -->
+                <SETTING><NAME>CacheModDates</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>DumpBrowserInfo</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CacheSubprojects</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>UseThirdPartyDebugger</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>BrowserGenerator</NAME><VALUE>2</VALUE></SETTING>
+                <SETTING><NAME>DebuggerAppPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>DebuggerCmdLineArgs</NAME><VALUE/></SETTING>
+                <SETTING><NAME>DebuggerWorkingDir</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CodeCompletionPrefixFileName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CodeCompletionMacroFileName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Debugger Target" panel -->
+                <SETTING><NAME>ConsoleEncoding</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>LogSystemMessages</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>AutoTargetDLLsPopUp</NAME><VALUE>2</VALUE></SETTING>
+                <SETTING><NAME>StopAtWatchpoints</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>PauseWhileRunning</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>PauseInterval</NAME><VALUE>5</VALUE></SETTING>
+                <SETTING><NAME>PauseUIFlags</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>AltExePath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>StopAtTempBPOnLaunch</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CacheSymbolics</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>TempBPFunctionName</NAME><VALUE>main</VALUE></SETTING>
+                <SETTING><NAME>TempBPType</NAME><VALUE>0</VALUE></SETTING>
+
+                <!-- Settings for "Remote Debug" panel -->
+                <SETTING><NAME>Enabled</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>ConnectionName</NAME><VALUE>Symbian MetroTrk</VALUE></SETTING>
+                <SETTING><NAME>DownloadPath</NAME><VALUE>C:\sys\bin\</VALUE></SETTING>
+                <SETTING><NAME>LaunchRemoteApp</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>RemoteAppPath</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CoreID</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>JTAGClockSpeed</NAME><VALUE>8000</VALUE></SETTING>
+                <SETTING><NAME>IsMultiCore</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OSDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>UseGlobalOSDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OSDownloadConnectionName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>OSDownloadPath</NAME><VALUE/></SETTING>
+                <SETTING><NAME>AltDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>AltDownloadConnectionName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Auto-target" panel -->
+                <SETTING><NAME>OtherExecutables</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Analyzer Connections" panel -->
+                <SETTING><NAME>AnalyzerConnectionName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Custom Keywords" panel -->
+                <SETTING><NAME>CustomColor1</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor2</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor3</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor4</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "ARM Debugger" panel -->
+                <SETTING><NAME>Processor</NAME><VALUE>Generic</VALUE></SETTING>
+                <SETTING><NAME>BraekPoinType_II</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseInitFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseConfigFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>IDexecutable</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>IDinitialized</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>IDuninitialized</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>IDconstant</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDexecutable</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDinitialized</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDuninitialized</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>SDconstant</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>VerifyMemWrites</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>ShowMPC107regs</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>InitializationFile</NAME><VALUE/></SETTING>
+                <SETTING><NAME>ConfigurationFile</NAME><VALUE/></SETTING>
+                <SETTING><NAME>BreakpointType</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>WatchpointType</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>TargetOS</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>RTOSPluginName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>ByteOrderType</NAME><VALUE>0</VALUE></SETTING>
+                <PANELDATA><NAME>CodeTest SYMBIAN Instrumenter</NAME><VALUE>
+                    0200020000000100000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000433A5C0000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000637466696C657300000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000636F6465746573742E6964620000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000
+                </VALUE></PANELDATA>
+
+                <!-- Settings for "Symbian Installation" panel -->
+                <SETTING><NAME>SymbianInstallationOutputFilename</NAME><VALUE>Application.sis</VALUE></SETTING>
+                <SETTING><NAME>SymbianInstallationOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>SymbianInstallationContentSearchLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UDEB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianInstallationPassword</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianInstallationCreateStubFile</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Installer Panel v2" panel -->
+                <SETTING><NAME>SymbianInstallationOutputFilename</NAME><VALUE>Application.sis</VALUE></SETTING>
+                <SETTING><NAME>SymbianInstallationOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>SymbianInstallationContentSearchLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UDEB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianInstallationPassword</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianInstallationCreateStubFile</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Resource Panel" panel -->
+                <SETTING><NAME>SymbianResourcesMMPFileLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesBinaryOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\data</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesHeaderFileOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Symbian Resources Panel v2" panel -->
+                <SETTING><NAME>SymbianResourcesMMPFileLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesBinaryOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\data</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesHeaderFileOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Remote Download" panel -->
+                <SETTING><NAME>FileList</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Symbian ARM Debugger" panel -->
+                <SETTING><NAME>Processor</NAME><VALUE>Generic</VALUE></SETTING>
+                <SETTING><NAME>UseInitFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseConfigFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>ResetTarget</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>InitializationFile</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>ConfigurationFile</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>TargetOS</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>RTOSPluginName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Symbian Common Panel" panel -->
+                <SETTING><NAME>ShowCommandLine</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SymbianEpocToolsPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE></VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Symbian Compiler Panel" panel -->
+                <SETTING><NAME>PrefixFile</NAME><VALUE>rvct2_2.h</VALUE></SETTING>
+                <SETTING><NAME>CompilerXMLDescriptor</NAME><VALUE>ARM RVCT2_2</VALUE></SETTING>
+                <SETTING><NAME>Macros</NAME><VALUE>__SYMBIAN32__,__ARMCC__,__EPOC32__,__MARM__,__EABI__,__ARMCC_2__,__ARMCC_2_2__,__MARM_ARMV5__,__DLL__,_DEBUG,_UNICODE,__SUPPORT_CPP_EXCEPTIONS__,__PRODUCT_INCLUDE__=\"feature_settings.hrh\"</VALUE></SETTING>
+                <SETTING><NAME>CodeTEST</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>EnableSWIC</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Arguments</NAME><VALUE> -O0 --diag_suppress 66,161,611,654,997,1152,1300,1464,1488,6318,6331  --diag_error 1267 --thumb  --fpu softvfp --exceptions --exceptions_unwind -D__MARM_THUMB__ -D__MARM_INTERWORK__  --cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --export_all_vtbl --no_vfe --apcs /inter --dllimport_runtime</VALUE></SETTING>
+                <SETTING><NAME>CIAArgs</NAME><VALUE>-x c++ -D__CIA__</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Debugging" panel -->
+                <SETTING><NAME>Parse Log File</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Log File Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Symbian SDK Folder</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Log Unresolved Modules</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Log Unresolved Sym Files</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Debug Non-XIP Executables</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Kernel Debugging" panel -->
+                <SETTING><NAME>Start Address</NAME><VALUE>0x00000000</VALUE></SETTING>
+                <SETTING><NAME>Run From Start Address</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Download Image</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OS Image Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Download Address</NAME><VALUE>0x00000000</VALUE></SETTING>
+                <SETTING><NAME>Ask First</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Debug Bootrom</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Bootrom Sym File</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "Symbian Linker Panel" panel -->
+                <SETTING><NAME>LinkOutputFile</NAME><VALUE>accountcreationengine.dll</VALUE></SETTING>
+                <SETTING><NAME>LinkCmdLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianImportLibrary</NAME><VALUE>accountcreationengine{000a0000}.lib</VALUE></SETTING>
+                <SETTING><NAME>canDebug</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>canRun</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian RomBuild Panel" panel -->
+                <SETTING><NAME>CommandLine</NAME><VALUE>buildrom -D_DEBUG devkit lubbock techview -olubbock_gui.img</VALUE></SETTING>
+                <SETTING><NAME>OutputPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>DisplayMessages</NAME><VALUE>true</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Target" panel -->
+                <SETTING><NAME>TargetArchitecture</NAME><VALUE>WINSCW</VALUE></SETTING>
+                <SETTING><NAME>LogMessages</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SuppressWarnings</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>GenerateSymbolics</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CompilerPrefix</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CompilerCmdLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianImportLibraryPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "Symbian Tools" panel -->
+                <SETTING><NAME>Gnu Tools Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Epoc32 Tools Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+            </SETTINGLIST>
+            <FILELIST>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengine.mmp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineu.def</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpprovider.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderfield.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpcontroller.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpxmlhandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acphttphandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpbrowserparams.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpimagehandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>bafl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>http.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>euser.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>efsrv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>xmlframework.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>inetprotutil.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>estor.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>swinstcli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>downloadmgruilib.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>downloadmgr.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>commdb.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>etel.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>etelmm.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>eikcore.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>sipprofilecli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>apparc.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>apgrfx.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>cone.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>charconv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>centralrepository.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>imageconversion.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>fbscli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>egul.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>bitmaptransforms.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineARMV5UDEB.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+</FILELIST>
+            <LINKORDER>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengine.mmp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineu.def</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpprovider.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderfield.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpcontroller.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpxmlhandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acphttphandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpbrowserparams.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpimagehandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>bafl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>http.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>euser.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>efsrv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>xmlframework.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>inetprotutil.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>estor.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>swinstcli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>downloadmgruilib.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>downloadmgr.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>commdb.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>etel.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>etelmm.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>eikcore.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>sipprofilecli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>apparc.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>apgrfx.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>cone.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>charconv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>centralrepository.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>imageconversion.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>fbscli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>egul.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>bitmaptransforms.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineARMV5UDEB.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</LINKORDER>
+        </TARGET><TARGET>
+<NAME>Build All</NAME><SETTINGLIST><SETTING><NAME>Linker</NAME><VALUE>None</VALUE></SETTING>
+<SETTING><NAME>Targetname</NAME><VALUE>Build All</VALUE></SETTING>
+</SETTINGLIST>
+<FILELIST></FILELIST>
+<LINKORDER></LINKORDER>
+<SUBTARGETLIST><SUBTARGET><TARGETNAME>ARMV5 UDEB</TARGETNAME></SUBTARGET>
+<SUBTARGET><TARGETNAME>ARMV5 UREL</TARGETNAME></SUBTARGET>
+</SUBTARGETLIST></TARGET></TARGETLIST>
+
+    <TARGETORDER>
+<ORDEREDTARGET><NAME>ARMV5 UDEB</NAME></ORDEREDTARGET>
+<ORDEREDTARGET><NAME>ARMV5 UREL</NAME></ORDEREDTARGET>
+<ORDEREDTARGET><NAME>Build All</NAME></ORDEREDTARGET>
+</TARGETORDER>
+
+    <GROUPLIST><FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengine.mmp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<GROUP><NAME>Source</NAME>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineu.def</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpprovider.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpproviderfield.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpcontroller.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpxmlhandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acphttphandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpbrowserparams.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpimagehandler.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</GROUP>
+<GROUP><NAME>Headers</NAME>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineconstants.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginlogger.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpbrowserparams.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpcontroller.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acphttphandler.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpimagehandler.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpprovider.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpproviderfield.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpxmlhandler.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>macpcontrollerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>macphttphandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>macpimagehandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>macpxmlhandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>PnpToPaosInterface.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>PnpUtilImpl.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</GROUP>
+<GROUP><NAME>Link</NAME>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineARMV5UREL.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UDEB</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineARMV5UDEB.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</GROUP>
+<GROUP><NAME>Libraries</NAME>
+<GROUP><NAME>ARMV5</NAME>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>bafl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>http.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>euser.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>efsrv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>xmlframework.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>inetprotutil.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>estor.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>swinstcli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>downloadmgruilib.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>downloadmgr.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>commdb.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>etel.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>etelmm.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>eikcore.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>sipprofilecli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>apparc.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>apgrfx.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>cone.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>charconv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>centralrepository.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>imageconversion.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>fbscli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>egul.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>bitmaptransforms.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UDEB</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</GROUP>
+</GROUP>
+</GROUPLIST>
+
+</PROJECT>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/accountcreationengineconstants.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 for accountcreationengine
+*
+*/
+
+
+#ifndef ACCOUNTCREATIONENGINECONSTANTS_H
+#define ACCOUNTCREATIONENGINECONSTANTS_H
+
+// UID of this engine.
+const TUid KAccountCreationEngineUid = { 0x2000BEF3 };
+
+_LIT8( KXmlMimeType,  "text/xml" );
+_LIT8( KSisMimeType,  "x-epoc/x-sisx-app" );
+_LIT8( KIconMimeType, "image/png");
+
+_LIT8( KActionMimeType, "application/vnd.wap.connectivity-wbxml" );
+_LIT8( KSessionId, ";jsessionid=" );
+
+const TInt KDefaultBufferSize = 256;
+const TUint KMaxElementLength = 128;
+const TUint KNameMaxLength    = 256;
+const TUint KBufferSize       = 2048;
+const TUint KMaxUriLength     = 256;
+const TUint KMaxSessionIdString = 64;
+const TInt KBitsPerByte = 8;
+
+_LIT( KXmlFile, "\\data\\xmlfile.xml" );
+_LIT( KSisFile, "\\data\\sisfile.sis" );
+
+const TInt KFileBufferSize = 1024;
+
+// Constant node types.
+_LIT8( KServiceProvider, "Provider" ); // Element.
+_LIT8( KSis, "sis" );                  // Element.
+
+// Constants strings (elements) for parsing.
+_LIT8( KProviderName,        "providerName" );
+_LIT8( KProviderDescription, "providerDescription" );
+_LIT8( KProviderType,        "providerType" );
+_LIT8( KIconUrl,             "iconUrl" );
+_LIT8( KActivateUrl,         "activateUrl" );
+_LIT8( KCreateUrl,           "createUrl" );
+_LIT8( KSisUrl,              "sisUrl" );
+_LIT8( KReportUrl,           "reportUrl" );
+
+_LIT8( KUserAgent, "Account Creation Plugin 1.0" );
+_LIT8( KAccept, "*/*" ); // Types to be accepted.
+
+// PhoneModule name
+_LIT( KPhoneModuleName, "Phonetsy.tsy" );
+_LIT( KPhoneName,       "DefaultPhone" );
+
+// Common
+_LIT( KAmperSand,     "&" );
+_LIT( KQuestionMark,  "?" );
+_LIT( KPlacing,       "=" );
+_LIT( KCharacterTwo,  "2" );
+_LIT( KHyph,          "-" );
+_LIT8( KQuestionMark8,  "?" );
+
+// Parameter names
+_LIT( KMnc,        "MNC" );
+_LIT( KMcc,        "MCC" );
+_LIT( KNonce,      "Nonce" );
+_LIT( KKeyInfo,    "Key" );
+_LIT( KDeviceInfo, "deviceinfo" );
+_LIT( KAction,     "action" );
+_LIT( KsType,      "sType" );
+_LIT( KcVersion,   "cVersion" );
+_LIT( KUsername,   "username" );
+_LIT( KPassword,   "password" );
+_LIT( KTempPassword, "temppass" );
+_LIT( KImei, "imei" );
+_LIT( KVariant, "variant" );
+
+// Parameter action value
+_LIT( KValueCreate,   "create" );
+_LIT( KValueActivate, "activate" );
+_LIT( KValueEmpty,    "" );
+_LIT( KValuecVersion, "email-0.1" );
+
+// Max should be 3 for both in practically, just in case bigger values
+const TUint KMaxMCC = 4;
+const TUint KMaxMNC = 8;
+
+#endif  // ACCOUNTCREATIONENGINECONSTANTS_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/accountcreationplugin.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 accountcreationplugin
+*
+*/
+
+
+#ifndef ACCOUNTCREATIONPLUGIN_HRH
+#define ACCOUNTCREATIONPLUGIN_HRH
+
+/** AIW requests. */
+enum TAcpAiwRequests
+    {
+    EInitialize = 1,
+    EExecute
+    };
+    
+#endif // ACCOUNTCREATIONPLUGIN_HRH
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/accountcreationpluginlogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 macros for logging
+*
+*/
+
+
+#ifndef ACCOUNTCREATIONPLUGINLOGGER_H
+#define ACCOUNTCREATIONPLUGINLOGGER_H
+
+#include <e32def.h>
+#include <e32debug.h>
+
+//----------------------------------------------------------------------------
+//  USER LOGGING SETTINGS
+//----------------------------------------------------------------------------
+
+#ifndef _DEBUG
+
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = RDebug
+***************************/ 
+
+#define ACP_DEBUG             0   // UREL BUILD
+
+#else
+
+#define ACP_DEBUG             1   // UDEB BUILD
+
+#endif // _DEBUG
+
+//----------------------------------------------------------------------------
+//  LOGGING MACROs (DO NOT EDIT)
+//
+//  USE THESE MACROS IN YOUR CODE
+//----------------------------------------------------------------------------
+
+#if ACP_DEBUG == 1    // RDebug
+
+#define ACPLOG(AA)           { RDebug::Print(_L(AA)); }
+#define ACPLOG2(AA,BB)       { RDebug::Print(_L(AA),BB); }
+#define ACPLOG3(AA,BB,CC)    { RDebug::Print(_L(AA),BB,CC); }
+#define ACPLOG4(AA,BB,CC,DD) { RDebug::Print(_L(AA),BB,CC,DD); }
+
+#else   // ACP_DEBUG == 0 or invalid -> Disable loggings
+
+#define ACPLOG(AA)          
+#define ACPLOG2(AA,BB)     
+#define ACPLOG3(AA,BB,CC)    
+#define ACPLOG4(AA,BB,CC,DD) 
+
+#endif  // ACP_DEBUG
+
+#endif  // ACCOUNTCREATIONPLUGINLOGGER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/accountcreationpluginuids.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 accountcreationplugin
+*
+*/
+
+
+
+#ifndef ACCOUNTCREATIONPLUGINUIDS_HRH
+#define ACCOUNTCREATIONPLUGINUIDS_HRH
+
+#define KAccountCreationPluginDllUid       0x2000BEF1
+#define KAccountCreationPluginImplUid      0x2000BEF2
+#define KAccountCreationPluginInterfaceUid 0x101F8650
+
+#endif // ACCOUNTCREATIONPLUGINUIDS_HRH
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/acpbrowserparams.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2007-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:  account creation plugin params header file
+*
+*/
+
+
+#ifndef ACPBROWSERPARAMS_H
+#define ACPBROWSERPARAMS_H
+
+#include <e32base.h>
+#include <etelmm.h>
+
+#ifdef __PLUG_AND_PLAY_MOBILE_SERVICES    
+#include <PnpUtilImpl.h>
+#else
+/*
+* temporary defines, remove when PNP is stuff available
+*/
+
+const TInt KMaxVersionStringLength(32);
+const TInt KNonceLength(8);
+const TInt KMaxKeyInfoLength(20);
+_LIT( KPnpUtilDllFileName, "Pnp.dll" );
+const TUid KPnpUtilDllUid = { 0x1020433A };
+
+class CPnpUtilImpl;
+#endif
+
+#include <wlaninternalpskeys.h>
+#include <sysversioninfo.h>
+
+#include "accountcreationengineconstants.h"
+
+
+/*
+* CACPBrowserParams
+* Encapsulates parameters needed for the Activation Server link
+*/
+class CACPBrowserParams : public CBase
+    {
+public:
+
+    static CACPBrowserParams* NewL();
+    static CACPBrowserParams* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CACPBrowserParams();
+
+    /**
+     * Gets parameters, i.e. appends parameters to given URL.
+     * 
+     * @since S60 v3.2
+     * @param aUrl URL in which parameters are appended.
+     */
+    void GetParameters( TDes& aUrl );
+
+private:
+
+    CACPBrowserParams();
+    void ConstructL( );
+
+    /**
+     * Retrieves parameters for the Service Activation link.
+     * 
+     * @since S60 v3.2 
+     */
+    void RetrieveParamsL();
+
+    /**
+     * Gets phone model and stores it to iPhoneModel. 
+     * 
+     * @since S60 v3.2
+     */
+    void RetrievePhoneModel();
+
+    /**
+     * Retrieves info on home network (incl. MCC, MNC).
+     * 
+     * @since S60 v3.2
+     */
+    void RetrieveHomeNetworkInfoL();
+
+    /**
+     * Retrieves Key info and creates nonce for signing
+     * (PnpProvisioning client).
+     * 
+     * @since S60 v3.2
+     */
+    void RetrieveSigningParamsL();
+
+    /**
+     * Retrieves WLAN MAC address.
+     * 
+     * @since S60 v3.2 
+     */
+    void RetrieveWlanMacAddress();
+    
+    /**
+     * Retrieves phone serial number (IMEI) and variant code.
+     *
+     * @since S60 v3.2 
+     */
+    void RetrievePhoneInfoL();
+
+    /**
+     * Checks if the phone has network or is searching for one.
+     * 
+     * @since S60 v3.2
+     * @return ETrue is network available, EFalse if no network available.
+     */
+    TBool RegisteredInNetwork();
+
+private:
+
+    /**
+     * Telephony Server (etelmm).
+     */
+    RTelServer iTelServer;
+
+    /**
+     * Phone Object
+     */
+    RMobilePhone iPhone;
+
+    /**
+     * Phone model.
+     */
+    TBuf<RMobilePhone::KPhoneModelIdSize> iPhoneModel;
+
+    /**
+     * Home MCC.
+     */
+    TBuf<KMaxMCC> iHomeMcc;
+
+    /**
+     * Home MNC.
+     */
+    TBuf<KMaxMNC> iHomeMnc;
+
+    /**
+     * Key information.
+     */
+    TBuf8<KMaxKeyInfoLength> iKeyInfo;
+
+    /**
+     * Nonce.
+     */
+    TBuf8<KNonceLength> iNonce;
+
+    /**
+     * WLAN MAC address.
+     */
+    TBuf<KPSWlanMacAddressLength*3> iWlanMACAddress;
+    
+    /**
+     * IMEI.
+     */
+    TBuf<RMobilePhone::KPhoneSerialNumberSize> iImei;
+    
+    /**
+     * Variant code.
+     */
+    TBuf<KSysVersionInfoTextLength> iVariant;
+    
+    /** 
+     * PnP utility class instance used in retrieving parameters.
+     */
+    CPnpUtilImpl* iPnpUtil;
+
+    };
+
+#endif // ACPBROWSERPARAMS_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/acpcontroller.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,487 @@
+/*
+* Copyright (c) 2007-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:  Declarition of CAcpController
+*
+*/
+
+ 
+#ifndef ACPCONTROLLER_H
+#define ACPCONTROLLER_H
+
+#include <e32base.h>
+#include <s32file.h>
+
+#include <sipobserver.h>
+#include <sipprofileregistryobserver.h>
+#include <sipmanagedprofileregistry.h>
+
+#include "accountcreationengineconstants.h"
+#include "macpxmlhandlerobserver.h"
+#include "macphttphandlerobserver.h"
+#include "macpimagehandlerobserver.h"
+
+class CFbsBitmap;
+class CAcpProvider;
+class CAcpXmlHandler;
+class CAcpImageHandler;
+class CAcpHttpHandler;
+class CAcpImageHandler;
+class MAcpControllerObserver;
+class CACPBrowserParams;
+class MSIPProfileRegistryObserver;
+class MImageHandlerObserver;
+
+/**
+ *  CAcpController class
+ *  Declarition of CAcpController.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CAcpController ) : public CBase,
+                                      public MAcpXmlHandlerObserver,
+                                      public MAcpHttpHandlerObserver,
+                                      public MSIPProfileRegistryObserver,
+                                      public MImageHandlerObserver
+    {
+public: 
+
+    /**
+     * Different kind of field types supported by ACP.
+     */
+    enum TFetchTypes
+        {
+        EXml = 0, // provider list in xml form (default)
+        ESis,     // sis file
+        EIcon,    // icon file (png)
+        EAction   // action file containing wbxml provisioning data
+        };    
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver Controller observer.
+     */
+    IMPORT_C static CAcpController* NewL(
+        MAcpControllerObserver& aObserver );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver Controller observer.
+     */
+    IMPORT_C static CAcpController* NewLC(
+        MAcpControllerObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAcpController();
+
+    /**
+     * Fetches provider list from network and parses it.
+     *
+     * @since S60 v3.2
+     */
+    IMPORT_C void FetchProviderListFromNetworkL();
+
+    /**
+     * Fetches SIS file from network.
+     *
+     * @since S60 v3.2
+     * @param aSisUrl URL where to download.
+     */
+    IMPORT_C void FetchSisFileFromNetworkL( TDesC8& aSisUrl );
+
+    /**
+     * Fetches icon file from network.
+     *
+     * @since S60 v3.2
+     * @param aIconUrl URL where to download.
+     */
+    IMPORT_C void FetchIconFileFromNetworkL( TDesC8& aIconUrl );
+
+    /**
+     * Returns count of providers in providers array.
+     *
+     * @since S60 v3.2
+     * @return Number of providers
+     */
+    IMPORT_C TInt CountOfProviders() const;
+
+    /**
+     * Returns provider information referenced by index.
+     *
+     * @since S60 v3.2
+     * @param aIndex Provider list index.
+     * @return Pointer to provider name.
+     */
+    IMPORT_C const TPtrC ProviderNameFromIndexL( TInt aIndex ) const;
+
+    /**
+     * Returns provider information referenced by index.
+     *
+     * @since S60 v3.2
+     * @param aIndex Provider list index.
+     * @return Pointer to provider SIS URL.
+     */
+    IMPORT_C const TPtrC8 ProviderSisUrlFromIndexL( TInt aIndex ) const;
+
+    /**
+     * Returns provider information referenced by index.
+     *
+     * @since S60 v3.2
+     * @param aIndex Provider list index.
+     * @return Pointer to provider activation URL.
+     */
+    IMPORT_C const TPtrC8 ProviderActivationUrlFromIndexL( 
+        TInt aIndex ) const;
+
+    /**
+     * Returns provider information referenced by index.
+     *
+     * @since S60 v3.2
+     * @param aIndex Provider list index.
+     * @return pointer Provider creation urlURL.
+     */
+    IMPORT_C const TPtrC8 ProviderCreationUrlFromIndexL( 
+        TInt aIndex ) const;
+
+    /**
+     * Returns provider information referenced by index.
+     *
+     * @since S60 v3.2
+     * @param aIndex Provider list index.
+     * @return Pointer to provider description.
+     */
+    IMPORT_C const TPtrC ProviderDescriptionFromIndexL( 
+        TInt aIndex ) const;
+
+    /**
+     * Returns provider information referenced by index.
+     *
+     * @since S60 v3.2
+     * @param aIndex Provider list index.
+     * @return Pointer to provider Type.
+     */
+    IMPORT_C const TPtrC ProviderTypeFromIndexL( TInt aIndex ) const;
+
+    /**
+     * Returns provider icon URL referenced by index.
+     *
+     * @since S60 v3.2
+     * @param aIndex Provider list index
+     * @return Pointer to provider icon URL.
+     */
+    IMPORT_C const TPtrC8 ProviderIconUrlFromIndexL( TInt aIndex ) const;
+
+    /**
+     * Returns provider bitmap referenced by index.
+     *
+     * @since S60 v3.2
+     * @param aIndex Provider list index.
+     * @return Pointer to bitmap owned by provider.
+     */
+    IMPORT_C void ProviderBitmapsFromIndexL( TInt aIndex,
+        CFbsBitmap*& aBitmap, CFbsBitmap*& aMask ) const;
+
+    /**
+     * Stores active list index in provider list view to member data.
+     *
+     * @since S60 v3.2
+     * @param aIndex Index to be stored.
+     */
+    IMPORT_C void SaveActiveIndex( TInt aIndex );
+
+    /**
+     * Returns active list index from member data.
+     *
+     * @since S60 v3.2
+     * @return Active list index in provider list view.
+     */
+    IMPORT_C TInt ActiveIndex() const;
+
+    /**
+     * Fetches the needed parameters for provisioning.
+     *
+     * @since S60 v3.2
+     * @param aUrl for URL.
+     */
+    IMPORT_C void FetchParametersL( TDes& aUrl );
+
+    /**
+     * Cancels ongoing HTTP request.
+     *
+     * @since S60 v3.2
+     */
+    IMPORT_C void CancelHttpRequest();
+
+    /**
+     * Starts downloading action (wbxml) file from the server.
+     * 
+     * @since S60 v3.2
+     * @param aUrl URL of the action file.
+     */
+    IMPORT_C void FetchActionFileL( const TDesC8& aUrl );
+
+    /**
+     * Gets session id that was received from the server.
+     * 
+     * @since S60 v3.2
+     * @return Session id descriptor.
+     */
+    IMPORT_C const TDesC8& SessionId();
+    
+// from base class MAcpXmlHandlerObserver
+    
+    /**
+     * From MAcpXmlHandlerObserver.
+     * Notifies observer when parsing is completed.
+     *
+     * @since S60 v3.2
+     * @param aError System wide error code.
+     */
+    IMPORT_C void NotifyParsingCompleted( TInt aError );
+
+    /**
+     * From MAcpXmlHandlerObserver.
+     * Notifies when new provider is available.
+     *
+     * @since S60 v3.2
+     * @param aError System wide error code.
+     */
+    IMPORT_C void NotifyParsedProviderL( const CAcpProvider& aProvider );
+
+// from base class MAcpHttpHandlerObserver
+
+    /**
+     * From MAcpHttpHandlerObserver.
+     * Notifies observer about HTTP events.
+     *
+     * @since S60 v3.2
+     * @param aEvent HTTP event.
+     */
+    void NotifyHttpEvent( TInt aEvent );
+
+    /**
+     * From MAcpHttpHandlerObserver.
+     * Notifies observer about HTTP event errors.
+     *
+     * @since S60 v3.2
+     * @param aError HTTP event error.
+     */
+    void NotifyHttpError( TInt aError );
+
+    /**
+     * From MAcpHttpHandlerObserver.
+     * Notifies observer about received body.
+     *
+     * @since S60 v3.2
+     * @param aBodyData Body data.
+     */
+    void NotifyBodyReceived( const TDesC8& aBodyData );
+
+    /**
+     * From MAcpHttpHandlerObserver.
+     * Notifies observer about received header.
+     *
+     * @since S60 v3.2
+     * @param aContentType Content data.
+     */
+    void NotifyContentTypeReceived( const TDesC8& aBodyData );
+
+    /**
+     * From MAcpHttpHandlerObserver.
+     * Notifies observer about received session id.
+     * 
+     * @since S60 v3.2
+     * @param aSession Id Session id received from the server.
+     */
+    void NotifySessionIdReceivedL( const TDesC8& aSessionId );
+    
+// from base class MImageHandlerObserver
+
+    /**
+     * From MImageHandlerObserver.
+     * Notifies completion of image handling.
+     * 
+     * @since S60 v3.2
+     * @param aErr Error code.
+     */
+    void NotifyImageCompletion( TInt aErr );   
+
+private:
+
+    CAcpController( MAcpControllerObserver& aObserver );
+    void ConstructL();
+
+    /**
+     * Creates XML file from received data.
+     *
+     * @since S60 v3.2
+     * @param aFilename File to be created.
+     */
+    void CreateFileFromDataL( const TDesC& aFilename );
+    
+    /**
+     * Parses received action file for wbxml content and sends it to
+     * provisioning engine.
+     * 
+     * @since S60 v3.2
+     */
+    void HandleActionFileL();
+
+    /**
+     * Returns next index with an icon URL in the providers list.
+     * 
+     * @since S60 v3.2
+     * 
+     * @param aResultUrl On return points to the icon URL if found.
+     * @return TInt Index in the providers list or KErrNotFound.
+     */
+    TInt NextIndexWithIconUrl( TPtrC8& aResultUrl );
+    
+    /**
+     * Parses a specific header value from head wrapper format.
+     * 
+     * @since S60 v3.2
+     * @param aHeaders Descriptor containing the headers.
+     * @param aParam Parameter to be parsed.
+     * @return Parameter value part of the header.
+     */
+    TPtrC8 GetHeaderParamL( const TDesC8& aHeaders, const TDesC8& aParam );
+    
+    /** 
+     * From MSIPProfileRegistryObserver.
+     * SIP profile information event.
+     *
+     * @since S60 v3.2
+     * @param aProfileId is id for profile
+     * @param aEvent type of information event
+     */
+    void ProfileRegistryEventOccurred(
+        TUint32 aSIPProfileId, 
+        TEvent aEvent );
+
+    /**
+     * From MSIPProfileRegistryObserver.
+     * An asynchronous error has occurred related to SIP profile.
+     *
+     * @since S60 v3.2
+     * @param aSIPProfileId the id of failed profile 
+     * @param aError a error code
+     */
+    void ProfileRegistryErrorOccurred(
+        TUint32 aSIPProfileId,
+        TInt aError );
+    
+private: // data
+
+    /**
+     * Reference for contoller observer.
+     */
+    MAcpControllerObserver& iObserver;
+
+    /**
+     * Handle to XML parser.
+     * Own.
+     */
+    CAcpXmlHandler* iParser;
+
+    /**
+     * Handle to HTTP handler.
+     * Own.
+     */
+    CAcpHttpHandler* iHttpHandler;
+
+    /**
+     * Array for providers.
+     * Own.
+     */
+    RPointerArray<CAcpProvider> iProviders;
+
+    /**
+     * Active list index, updated when provider specific view is opened.
+     */
+    TInt iActiveIndex;
+
+    /**
+     * Data fetched from network.
+     * Own.
+     */
+    HBufC8* iData;
+
+    /**
+     * Type of data fetched from network.
+     */
+    TFetchTypes iType;
+
+    /**
+     * File server.
+     */
+    RFs iFs; 
+
+    /**
+     * Name of the file.
+     */
+    TBuf<KNameMaxLength> iFilename;
+
+    /**
+     * Handler for PnPMS parameters.
+     */
+    CACPBrowserParams* iPnpmsparams;
+
+    /**
+     * Provides the image convertions.
+     * Own.
+     */
+    CAcpImageHandler* iImageHandler;
+    
+    /**
+     * Session id to be used for all transactions.
+     */
+    HBufC8* iSessionId;
+    
+    /**
+     * For getting SIP events.
+     */
+    CSIPManagedProfileRegistry* iSipModel;
+    
+    /**
+     * A flag telling if the previous download attempt failed.
+     * If it's ETrue, a new connection method is asked during the
+     * next download.
+     */
+    TBool iErrorDownloading;
+    
+    /**
+     * A flag telling if sis packet is downoloaded and sis installation
+     * will be made.
+     */
+    TBool iSisInstallation;
+
+    /**
+     * File write stream for SIS file downloading.
+     */
+    RFileWriteStream iWs;
+
+    // For unit testing.
+#ifdef _DEBUG
+    friend class T_CAcpController;
+#endif
+    };
+
+#endif // ACPCONTROLLER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/acphttphandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,304 @@
+/*
+* Copyright (c) 2007-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:  Declarition of CAcpHttpHandler
+*
+*/
+
+ 
+#ifndef ACPHTTPHANDLER_H
+#define ACPHTTPHANDLER_H
+
+#include <e32base.h>
+#include <http/rhttpsession.h>
+#include <http/mhttpdatasupplier.h>
+#include <http/mhttptransactioncallback.h>
+#include <es_sock.h>
+
+class RHTTPTransaction;
+class MAcpHttpHandlerObserver;
+
+/**
+ *  CAcpHttpHandler class
+ *  Declarition of CAcpHttpHandler.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CAcpHttpHandler ) : public CActive,
+                                       public MHTTPDataSupplier,
+                                       public MHTTPTransactionCallback
+    {
+public: 
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver for observer
+     */
+    static CAcpHttpHandler* NewL( MAcpHttpHandlerObserver& aObserver );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver for observer
+     */
+    static CAcpHttpHandler* NewLC( MAcpHttpHandlerObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAcpHttpHandler();
+
+    /**
+     * Fetches data from network.
+     *
+     * @since S60 v3.2
+     * @param aUrl Data URL.
+     * @param aContentType Content type.
+     * @param aBody Post data.
+     * @param aMimeTypeImage Image's mime type.
+     * @param aSessionId Session id to be stored in a cookie. Can be KNullDesC8.
+     */
+    void GetDataL( 
+        const TDesC8& aUrl, 
+        const TDesC8& aContentType,
+        const TDesC8& aBody,
+        TBool aMimeTypeImage,
+        const TDesC8& aSessionId,
+        TBool aGetSisFile = EFalse );
+
+    /**
+     * Cancels ongoing transaction and frees the resources.
+     *
+     * @since S60 v3.2
+     */
+    void CancelTransaction();
+    
+    /**
+     * Shuts down connection (RConnection and RSocketServ).
+     * 
+     * @since S60 v3.2
+     */
+    void ShutdownConnection();
+    
+    /**
+     * Handles known HTTP headers.
+     * 
+     * @since S60 v3.2
+     * @param aTransaction HTTP transaction that received the headers.
+     */
+    void ProcessHeadersL( RHTTPTransaction& aTransaction );
+    
+// from base class MHTTPTransactionCallback
+
+    /**
+     * From MHTTPTransactionCallback.
+     * Called when the filter's registration conditions are satisfied
+     * for events that occur on a transaction.
+     * 
+     * @since S60 v3.2
+     * @param aTransaction The transaction that the event has occurred on.
+     * @param aEvent The event that has occurred.
+     */
+    void MHFRunL( RHTTPTransaction aTransaction, const THTTPEvent& aEvent );
+
+    /**
+     * From MHTTPTransactionCallback.
+     * Called when RunL leaves from a transaction event.
+     * 
+     * @since S60 v3.2
+     * @param aError The leave code that RunL left with.
+     * @param aTransaction The transaction that was being processed.
+     * @param aEvent The Event that was being processed.
+     * @return KErrNone if the error has been cancelled or the code
+     *         of the continuing error otherwise.
+     */
+    TInt MHFRunError( TInt aError, RHTTPTransaction aTransaction, 
+        const THTTPEvent& aEvent );
+
+private:
+
+    CAcpHttpHandler( MAcpHttpHandlerObserver& aObserver );
+    void ConstructL();
+
+    /**
+     * Returns request method based on type.
+     *
+     * @since S60 v3.2
+     * @param aType for type of method
+     * @return request method
+     */
+    RStringF GetRequestMethod( TInt aType ) const;
+
+    /**
+     * Starts the connection asynchronously.
+     *
+     * @since S60 v3.2
+     */
+    void StartConnectionL();
+
+    /**
+     * Sets transaction's request headers.
+     *
+     * @since S60 v3.2
+     * @param aHeaders for headers
+     * @param aHdrField for header fields
+     * @param aHdrValue for header value
+     */
+    void SetHeaderL( RHTTPHeaders aHeaders, TInt aHdrField,  
+        const TDesC8& aHdrValue );
+    
+    /**
+     * Submits HTTP transaction.
+     * 
+     * @since S60 v3.2
+     */
+    void SubmitTransactionL();
+    
+// from base class MHTTPDataSupplier
+
+    /**
+     * From MHTTPDataSupplier.
+     * Release the current data part being held at the data
+     * supplier.
+     * 
+     * @since S60 v3.2
+     */
+    void ReleaseData();
+
+    /**
+     * From MHTTPDataSupplier.
+     * Obtain a data part from the supplier.
+     * 
+     * @since S60 v3.2
+     * @param aDataPart The data part.
+     * @return ETrue if this is the last part. EFalse otherwise
+     */
+    TBool GetNextDataPart( TPtrC8& aDataPart );
+
+    /**
+     * From MHTTPDataSupplier.
+     * Reset the data supplier.
+     * 
+     * @since S60 v3.2
+     * @return Error code.
+     */
+    TInt Reset();
+
+    /**
+     * From MHTTPDataSupplier.
+     * Obtain the overall size of the data being supplied,
+     * if known to the supplier.
+     * 
+     * @since S60 v3.2
+     * @return A size in bytes, or KErrNotFound if the size is not known.
+     */
+    TInt OverallDataSize();
+
+// from base class CActive.
+    
+    /**
+     * From CActive.
+     * 
+     * @since S60 v3.2
+     */
+    void RunL();
+
+    /**
+     * From CActive.
+     *      
+     * @since S60 v3.2
+     */
+    void DoCancel();
+    
+private: // data
+
+    /**
+     * Reference to observer.
+     * Not own.
+     */
+    MAcpHttpHandlerObserver& iObserver;
+
+    /**
+     * Handle for HTTP session.
+     * Own. 
+     */
+    RHTTPSession iSession;
+
+    /**
+     * Handle for HTTP transaction.
+     * Own. 
+     */
+    RHTTPTransaction iTransaction;
+    
+    /**
+     * Handle for connection.
+     */
+    RConnection iConnection;
+    
+    /*
+     * Handle for socket server.
+     */
+    RSocketServ iSocketServer;
+
+    /**
+     * Handle to post data.
+     * Own. 
+     */
+    HBufC8* iPostData;
+
+    /**
+     * Tells if a transaction is running.
+     */
+    TBool iTransactionRunning;
+    
+    /**
+     * Tells if the connection is open.
+     */
+    TBool iConnectionOpen;
+
+    /**
+     * Tells if MIME type is image.
+     */
+    TBool iMimeTypeImage;
+    
+    /**
+     * Tells if connection prompt has been shown once.
+     */
+    TBool iPromptShown;
+    
+    /**
+     * Selected IAP id.
+     */
+    TUint32 iIapId;
+    
+    /**
+     * Selected SNAP id.
+     */
+    TUint32 iNetId;
+    
+    /**
+     * Connection progress.
+     */
+    TNifProgress iNifProgress;
+
+    // For unit testing.
+#ifdef _DEBUG
+    friend class T_CAcpHttpHandler;
+#endif
+    };
+
+#endif // ACPHTTPHANDLER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/acpimagehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declarition of CAcpImageHandler
+*
+*/
+
+
+#ifndef ACPIMAGEHANDLER_H
+#define ACPIMAGEHANDLER_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <f32file.h>
+#include <imageconversion.h>
+
+class CFbsBitmap;
+class CBitmapRotator;
+class MImageHandlerObserver;
+
+/**
+ *  CAcpImageHandler class
+ *  Declarition of CAcpImageHandler.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+class CAcpImageHandler : public CActive
+    {
+private:
+    /**
+     * States of execution.
+     */
+    enum TState 
+        {
+        EIdle = 0,
+        EDecoding,
+        EScaling
+        };
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aController for observer.
+     */
+    static CAcpImageHandler* NewL( MImageHandlerObserver& aController );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAcpImageHandler();
+
+    /**
+     * Decodes an image to bitmap.
+     *
+     * @since S60 v3.2
+     * @param aFileName A file to be decoded to the bitmap.
+     */
+    void StartToDecodeL( const TDesC8& aSourceData,
+        const TDesC8& aContentType );
+
+    /**
+     * Get bitmap.
+     *
+     * @since S60 v3.2
+     * @return Reference to bitmap already converted.
+     */
+    CFbsBitmap* GetBitmap();
+
+    /**
+     * Get mask.
+     *
+     * @since S60 v3.2
+     * @return Reference to the mask from bitmap conversion.
+     */
+    CFbsBitmap* GetMask();
+
+protected: 
+
+// from base class CActive
+
+    /**
+     * From CActive.
+     * Cancels an outstanding request.
+     * 
+     * @since S60 v3.2
+     */
+    void DoCancel();
+
+    /**
+     * From CActive.
+     * Handles request completion event.
+     * 
+     * @since S60 v3.2
+     */
+    void RunL();
+
+private: 
+    CAcpImageHandler( MImageHandlerObserver& aController ); 
+    void ConstructL();
+
+private:  
+
+    /**
+     * Observer reference.
+     */
+	MImageHandlerObserver& iController;
+
+    /**
+     * Handle for file server.
+     */
+    RFs iFs;
+
+    /**
+     * Handle for image decoder.
+     * Own. 
+     */
+    CImageDecoder* iImageDecoder;
+
+    /**
+     * State of execution (decoding or scaling).
+     */
+    TState iState;
+
+    /**
+     * Converted bitmap.
+     * Own. 
+     */
+    CFbsBitmap* iBitmap;
+    
+    /**
+     * Converted mask.
+     * Own.
+     */
+    CFbsBitmap* iMask;
+    
+    // For unit testing.
+#ifdef _DEBUG
+    friend class T_CAcpImageHandler;
+#endif
+    };
+
+#endif // ACPIMAGEHANDLER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/acpprivatecrkeys.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Private CenRep keys for accountcreationplugin
+*
+*/
+
+
+#ifndef ACPPRIVATECRKEYS_H_
+#define ACPPRIVATECRKEYS_H_
+
+/** Central Repository UID for Account creation plugin. */
+const TUid KAccountCreationSettingsUid = { 0x2001E321 };
+
+// Keys.
+const TUint32 KAccountCreationPluginServerUri = 0x00000001;
+
+#endif /*ACPPRIVATECRKEYS_H_*/
+
+// End of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/acpprovider.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,284 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declarition of CAcpProvider
+*
+*/
+
+ 
+#ifndef ACPPROVIDER_H
+#define ACPPROVIDER_H
+
+#include <e32base.h>
+
+class CGulIcon;
+class CFbsBitmap;
+
+/**
+ *  CAcpProvider class
+ *  Declarition of CAcpProvider.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+class CAcpProvider : public CBase
+    {
+public: 
+
+    static CAcpProvider* NewL();
+    static CAcpProvider* NewLC();
+    virtual ~CAcpProvider();
+
+    /**
+     * Copies provider data from given parameter to member data.
+     *
+     * @since S60 v3.2
+     * @param aProvider for provider to be copies
+     */ 
+    void CopyL( const CAcpProvider& aProvider );
+
+    /**
+     * Returns name of the provider.
+     *
+     * @since S60 v3.2
+     * @return name of the provider
+     */ 
+    TPtrC ProviderName() const;
+
+    /**
+     * Sets name of the provider.
+     *
+     * @since S60 v3.2
+     * @param aProviderName for provider name
+     */ 
+    void SetProviderNameL( const TDesC& aProviderName );
+
+    /**
+     * Returns the location of icons.
+     *
+     * @since S60 v3.2
+     * @return location of icons
+     */ 
+    TPtrC8 IconUrl() const;
+
+    /**
+     * Sets the location of icons.
+     *
+     * @since S60 v3.2
+     * @param aIconUrl for location of icons
+     */ 
+    void SetIconUrlL( const TDesC8& aIconUrl );
+
+    /**
+     * Returns priority of the provider.
+     *
+     * @since S60 v3.2
+     * @return priority of the provider
+     */ 
+    TInt Priority() const;
+
+    /**
+     * Sets priority of the provider.
+     *
+     * @since S60 v3.2
+     * @param aPriority for provider
+     */ 
+    void SetPriority( TInt aPriority );
+
+    /**
+     * Returns the location of SIS file.
+     *
+     * @since S60 v3.2
+     * @return location of SIS file
+     */ 
+    TPtrC8 SisUrl() const;
+
+    /**
+     * Sets the location of SIS file.
+     *
+     * @since S60 v3.2
+     * @param aSisUrl for location of SIS file
+     */ 
+    void SetSisUrlL( const TDesC8& aSisUrl );
+
+    /**
+     * Returns the location of creation URL.
+     *
+     * @since S60 v3.2
+     * @return location of creation URL
+     */ 
+    TPtrC8 CreationUrl() const;
+
+    /**
+     * Sets the location of creation URL.
+     *
+     * @since S60 v3.2
+     * @param aSisUrl for location of creation URL
+     */ 
+    void SetCreationUrlL( const TDesC8& aCreationUrl );
+
+    /**
+     * Returns the location of activation URL.
+     *
+     * @since S60 v3.2
+     * @return location of activation URL
+     */ 
+    TPtrC8 ActivationUrl() const;
+
+    /**
+     * Sets the location of activation URL.
+     *
+     * @since S60 v3.2
+     * @param aSisUrl for location of activation URL
+     */ 
+    void SetActivationUrlL( const TDesC8& aActivationUrl );
+
+    /**
+     * Returns the content type of image file.
+     *
+     * @since S60 v3.2
+     * @return mime type of image file.
+     */ 
+    TPtrC8 ContentData() const;
+
+    /**
+     * Sets the content type of image file.
+     *
+     * @since S60 v3.2
+     * @param aContentData for type of image file
+     */ 
+    void SetContentDataL( const TDesC8& aContentData );
+
+    /**
+     * Returns the provider type
+     *
+     * @since S60 v3.2
+     * @return type of the provider
+     */ 
+    TPtrC ProviderType() const;
+
+    /**
+     * Sets type of the provider
+     *
+     * @since S60 v3.2
+     * @param aProviderType for provider type
+     */ 
+    void SetProviderTypeL( const TDesC& aProviderType );        
+
+    /**
+     * Returns the provider description
+     *
+     * @since S60 v3.2
+     * @return description of the provider
+     */ 
+    TPtrC ProviderDescription() const;
+
+    /**
+     * Sets the description of the provider
+     *
+     * @since S60 v3.2
+     * @param aProviderDescription for provider description
+     */ 
+    void SetProviderDescriptionL( const TDesC& aProviderDescription );        
+
+    /**
+     * Sets bitmap and mask for provider
+     *
+     * @since S60 v3.2
+     * @param aBitmap Bitmap.
+     * @param aMask Mask.
+     */
+    void SetBitmapL( CFbsBitmap* aBitmap, CFbsBitmap* aMask ); 
+
+    /**
+     * Returns bitmap
+     *
+     * @since S60 v3.2
+     * @param aBitmap Gets a pointer to the bitmap.
+     * @param aMask Gets a pointer to the mask.
+     */
+    void GetBitmaps( CFbsBitmap*& aBitmap, CFbsBitmap*& aMask );
+
+private: // Constructor
+
+    CAcpProvider();
+
+private: // data
+
+    /**
+     * Provider name.
+     * Own.
+     */
+    HBufC* iProviderName;
+
+    /**
+     * Location of the provider specific icon.
+     * Own.
+     */
+    HBufC8* iIconUrl;
+
+    /**
+     * Priority of the provider.
+     */
+    TInt iPriority;
+
+    /**
+     * Location of the provider specific SIS file.
+     * Own.
+     */
+    HBufC8* iSisUrl;
+
+    /**
+     * Url to be used in account creation.
+     * Own.
+     */
+    HBufC8* iCreationUrl;
+
+    /**
+     * Url to be used in account activation.
+     * Own.
+     */
+    HBufC8* iActivationUrl;
+
+    /**
+     * Mime type to be used when decoding image to bitmap.
+     * Own.
+     */
+    HBufC8* iMimeType;
+
+    /**
+     * Provider typr.
+     * Own.
+     */
+    HBufC* iProviderType;        
+
+    /**
+     * Provider description.
+     * Own.
+     */
+    HBufC* iProviderDescription;        
+
+    /**
+     * Bitmap reference
+     * Own.
+     */
+    CFbsBitmap* iBitmap;
+
+    /**
+     * Mask reference
+     * Own.
+     */
+    CFbsBitmap* iMask;
+    };
+
+#endif // ACPPROVIDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/acpproviderfield.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declarition of CAcpProviderField
+*
+*/
+
+ 
+#ifndef ACPPROVIDERFIELD_H
+#define ACPPROVIDERFIELD_H
+
+#include <e32base.h>
+
+/**
+ *  CAcpProviderField class
+ *  Declarition of CAcpProviderField.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+class CAcpProviderField : public CBase
+    {
+public:
+
+    /**
+     * Different kind of field types supported by ACP.
+     */
+    enum TFieldTypes
+        {
+        ETextual = 0, // default
+        ENumeric,
+        EPassword
+        };    
+
+    /**
+     * Two-phased constructor.
+     */
+    static CAcpProviderField* NewL();
+
+    /**
+     * Two-phased constructor.
+     */
+    static CAcpProviderField* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAcpProviderField();
+
+    /**
+     * Copies provider fields data from given parameter to member data.
+     *
+     * @since S60 v3.2
+     * @param aProviderField for provider fields to be copied
+     */ 
+    void CopyL( const CAcpProviderField& aProviderField );
+
+    /**
+     * Returns name of the field.
+     *
+     * @since S60 v3.2
+     * @return name of the field
+     */ 
+    TPtrC FieldName() const;
+
+    /**
+     * Sets name of the field.
+     *
+     * @since S60 v3.2
+     * @param aFieldName for field name
+     */ 
+    void SetFieldNameL( const TDesC& aFieldName );
+
+    /**
+     * Returns type of the field.
+     *
+     * @since S60 v3.2
+     * @return type of the field
+     */ 
+    CAcpProviderField::TFieldTypes FieldType() const;
+
+    /**
+     * Sets type of the field.
+     *
+     * @since S60 v3.2
+     * @param aType for field type
+     */ 
+    void SetFieldType( CAcpProviderField::TFieldTypes aType );
+
+    /**
+     * Returns data of the field.
+     *
+     * @since S60 v3.2
+     * @return data of the field
+     */ 
+    TPtrC FieldData() const;
+
+    /**
+     * Sets data of the field.
+     *
+     * @since S60 v3.2
+     * @param aFieldData for field data
+     */ 
+    void SetFieldDataL( const TDesC& aFieldData );
+
+private:
+
+    CAcpProviderField();
+
+private: // data
+
+    /**
+     * Name of the field.
+     * Own.
+     */
+    HBufC* iFieldName;
+
+    /**
+     * Type of the field.
+     */  
+    TFieldTypes iType;
+
+    /**
+     * Data of the field.
+     * Own.
+     */
+    HBufC* iFieldData;
+    };
+
+#endif // ACPPROVIDERFIELD_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/acpxmlhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,314 @@
+/*
+* 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:  Declarition of CAcpXmlHandler
+*
+*/
+
+ 
+#ifndef _ACPXMLHANDLER
+#define _ACPXMLHANDLER
+
+#include <e32base.h>
+#include <f32file.h>
+#include <xml/parser.h>
+#include <xml/parserfeature.h>
+#include <xml/contenthandler.h>
+
+using namespace Xml;
+
+class CAcpProvider;
+class MAcpXmlHandlerObserver;
+
+/**
+ *  CAcpXmlHandler class
+ *  Declarition of CAcpXmlHandler.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CAcpXmlHandler ) : public CActive, MContentHandler
+    {
+public: 
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver for notifying xml events
+     */
+    static CAcpXmlHandler* NewL( MAcpXmlHandlerObserver& aObserver );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver for notifying xml events
+     */
+    static CAcpXmlHandler* NewLC( MAcpXmlHandlerObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAcpXmlHandler();
+
+    /**
+     * Starts parsing xml with given filename.
+     * Function leaves on failure.
+     *
+     * @since S60 v3.2
+     * @param aFilename for file to be parsed
+     */
+    void StartParsingL( const TFileName& aFilename );
+
+    /**
+     * Returns provider information referenced by index.
+     *
+     * @since S60 v3.2
+     * @param aIndex for provider list index
+     * @return reference to provider information
+     */
+    const CAcpProvider& ProviderFromIndexL( TInt aIndex ) const;
+
+private:
+
+    CAcpXmlHandler( MAcpXmlHandlerObserver& aObserver );
+    void ConstructL();
+
+    /**
+     * Handles finished provider and notifies observer.
+     *
+     * @since S60 v3.2
+     */
+    void HandleFinishedProviderL();
+
+// from base class CActive
+
+    /**
+     * From CActive.
+     * Cancels an outstanding request.
+     * 
+     * @since S60 v3.2
+     */
+    void DoCancel();
+
+    /**
+     * From CActive.
+     * Handles request completion event.
+     * 
+     * @since S60 v3.2
+     */
+    void RunL();
+
+// from base class MContentHandler
+
+    /**
+     * From MContentHandler.
+     * Callback to indicate the start of the document.
+     * 
+     * @since S60 v3.2
+     * @param aDocParam Specifies the various parameters of the document.
+     * @param aErrorCode Error code. 
+     */
+    void OnStartDocumentL( const RDocumentParameters &aDocParam, 
+        TInt aErrorCode );
+
+    /**
+     * From MContentHandler.
+     * Callback to indicate the end of the document.
+     * 
+     * @since S60 v3.2
+     * param aErrorCode Error code.
+     */
+    void OnEndDocumentL( TInt aErrorCode );
+
+    /**
+     * From MContentHandler.
+     * Callback to indicate an element has been parsed.
+     * 
+     * @since S60 v3.2
+     * @param aElement Handle to the element's details.
+     * @param aAttributes Attributes for the element.
+     * @param aErrorCode Error code.
+     */
+    void OnStartElementL( const RTagInfo &aElement, 
+        const RAttributeArray &aAttributes,
+        TInt aErrorCode );
+
+    /**
+     * From MContentHandler.
+     * Callback to indicate the end of the element has been reached.
+     * 
+     * @since S60 v3.2
+     * @param Handle to the element's details.
+     * @param aErrorCode Error code.
+     */
+    void OnEndElementL( const RTagInfo &aElement, TInt aErrorCode );
+
+    /**
+     * From MContentHandler.
+     * Callback that sends the content of the element.
+     * Not all the content may be returned in one go. The data may be sent 
+     * in chunks. When an OnEndElementL is received this means there is no
+     *  more content to be sent.
+     * 
+     * @since S60 v3.2
+     * @param aBytes Raw content data for the element.
+     * @param aErrorCode Error code.
+     */
+    void OnContentL( const TDesC8 &aBytes, TInt aErrorCode );
+
+    /**
+     * From MContentHandler.
+     * Notification of the beginning of the
+     * scope of a prefix-URI Namespace mapping.
+     * Not used but here because of inheritance.
+     * 
+     * @since S60 v3.2
+     * @param aPrefix Namespace prefix being declared.
+     * @param aUri Namespace URI the prefix is mapped to.
+     * @param aErrorCode Error code.
+     */
+    void OnStartPrefixMappingL( const RString& /*aPrefix*/, 
+        const RString& /*aUri*/, TInt /*aErrorCode*/ );
+
+    /**
+     * From MContentHandler.
+     * Notification of the end of the scope of a prefix-URI mapping.
+     * Not used but here because of inheritance.
+     * 
+     * @since S60 v3.2
+     * @param aPrefix Namespace prefix that was mapped.
+     * @param aErrorCode Error code.
+     */
+    void OnEndPrefixMappingL( const RString& /*aPrefix*/, 
+        TInt /*aErrorCode*/ );
+
+    /**
+     * From MContentHandler.
+     * Notification of ignorable whitespace in element content.
+     * Not used but here because of inheritance.
+     * 
+     * @since S60 v3.2
+     * @param aBytes Ignored bytes from the document being parsed.
+     * @param aErrorCode Error code.
+     */
+    void OnIgnorableWhiteSpaceL( const TDesC8& /*aBytes*/, 
+        TInt /*aErrorCode*/ );
+
+    /**
+     * From MContentHandler.
+     * Notification of a skipped entity.
+     * Not used but here because of inheritance.
+     * 
+     * @since S60 v3.2
+     * @param aName Name of the skipped entity.
+     * @param aErrorCode Error code.
+     */
+    void OnSkippedEntityL( 
+        const RString& /*aName*/, 
+        TInt /*aErrorCode*/ );
+
+    /**
+     * From MContentHandler.
+     * Receive notification of a processing instruction.
+     * Not used but here because of inheritance.
+     * 
+     * @since S60 v3.2
+     * @param aTarget Processing instruction target.
+     * @param aData Processing instruction data. If empty none was supplied.
+     * @param aErrorCode Error code.
+     */
+    void OnProcessingInstructionL( 
+        const TDesC8& /*aTarget*/, 
+        const TDesC8& /*aData*/,
+        TInt /*aErrorCode*/ );
+
+    /**
+     * From MContentHandler.
+     * Indicates an error has occurred.
+     * 
+     * @since S60 v3.2
+     * @param aErrorCode Error code.
+     */
+    void OnError( TInt aErrorCode );
+
+    /**
+     * From MContentHandler.
+     * Obtains the interface matching the specified UID.
+     * Not used but here because of inheritance (always returns NULL).
+     * 
+     * @since S60 v3.2
+     * @param aUid UID identifying the required interface.
+     */
+    TAny* GetExtendedInterface( const TInt32 /*aUid*/ );
+
+private: // data
+
+    /**
+     * Reference to observer.
+     * Not own.
+     */
+    MAcpXmlHandlerObserver& iObserver;
+
+    /**
+     * Handle to parser object.
+     * Own.
+     */
+    CParser* iParser;
+
+    /**
+     * Handle to File Server.
+     */
+    RFs iFileServer;
+
+    /**
+     * Handle to Xml file to be parsed.
+     */
+    RFile iFile;
+
+    /**
+     * Handle to buffer which contains parsed data.
+     * Own.
+     */
+    HBufC8* iBuffer;
+
+    /**
+     * Handle to ongoing temporary provider.
+     * Own.
+     */
+    CAcpProvider* iProvider;
+
+    /**
+     * Ongoing element. Parsing is reached to this point.
+     * Own.
+     */
+    HBufC8* iOngoingAttr;
+
+    /**
+     * Flag indicates that next content data has to be saved.
+     */
+    TBool iGetContentNow;
+
+    /**
+     * XML file to be parsed and then deleted
+     */
+    TFileName iFilename;
+    
+    // For unit tests.
+#ifdef _DEBUG
+    friend class T_CAcpXmlHandler;
+#endif
+    };
+
+#endif // ACPXMLHANDLER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/macpcontrollerobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2007-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:  Header file for MAcpControllerObserver
+ *
+*/
+
+
+#ifndef MACPCONTROLLEROBSERVER_H
+#define MACPCONTROLLEROBSERVER_H
+
+class MAcpControllerObserver
+    {
+public:
+    /**
+     * Notifies observer about readiness of provider list.
+     *
+     * @since S60 v3.2
+     * @param aError System wide error code.
+     */ 
+    virtual void NotifyProviderListReady( TInt aError ) = 0;
+
+    /**
+     * Notifies observer about downloading.
+     *
+     * @since S60 v3.2
+     * @param aError System wide error code.
+     */ 
+    virtual void NotifyDownloadingCompleted( TInt aError ) = 0;
+    
+    /**
+     * Notifies observer about downloading sis.
+     *
+     * @since S60 v5.0
+     * @param aFileName sis file name
+     */ 
+    virtual void NotifyDownloadingSISCompleted( TDesC& aFileName ) = 0;
+    
+    /**
+     * Notifies observer about successfully parser/provisioned content.
+     * 
+     * @since S60 v3.2
+     */
+    virtual void NotifyProvisioningCompleted() = 0;
+    
+    /**
+     * Notifies observer when settings have been completely saved.
+     * 
+     * @since S60 v3.2
+     */
+    virtual void NotifySettingsSaved() = 0;
+    };
+    
+#endif // MACPCONTROLLEROBSERVER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/macphttphandlerobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MAcpHttpHandlerObserver
+ *
+*/
+
+
+#ifndef MACPHTTPHANDLEROBSERVER_H
+#define MACPHTTPHANDLEROBSERVER_H
+
+class RHTTPTransaction;
+
+class MAcpHttpHandlerObserver
+    {
+public:
+
+    /**
+     * Notifies observer about HTTP events.
+     *
+     * @since S60 v3.2
+     * @param aEvent HTTP event.
+     */ 
+    virtual void NotifyHttpEvent( TInt aEvent ) = 0;
+
+    /**
+     * Notifies observer about HTTP event errors.
+     *
+     * @since S60 v3.2
+     * @param aError HTTP event error.
+     */ 
+    virtual void NotifyHttpError( TInt aError ) = 0;
+
+    /**
+     * Notifies observer about received body.
+     *
+     * @since S60 v3.2
+     * @param aBodyData Body data.
+     */ 
+    virtual void NotifyBodyReceived( const TDesC8& aBodyData ) = 0;
+
+    /**
+     * Notifies observer about received header.
+     *
+     * @since S60 v3.2
+     * @param aContentType Content data.
+     */
+    virtual void NotifyContentTypeReceived( 
+        const TDesC8& aContentType ) = 0; 
+    
+    /**
+     * Notifies observer about received session id.
+     * 
+     * @since S60 v3.2
+     * @param aSession Id Session id received from the server.
+     */
+    virtual void NotifySessionIdReceivedL(
+        const TDesC8& aSessionId ) = 0;
+    };
+    
+#endif // MACPHTTPHANDLEROBSERVER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/macpimagehandlerobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MAcpImageHandlerObserver
+ *
+*/
+
+
+#ifndef MACPIMAGEHANDLEROBSERVER_H
+#define MACPIMAGEHANDLEROBSERVER_H
+
+class MImageHandlerObserver
+    {
+public:
+    /**
+     * Notifies completion of image handling.
+     * 
+     * @since S60 v3.2
+     * @param aErr Error code.
+     */
+    virtual void NotifyImageCompletion( TInt aErr ) = 0;
+    };
+
+#endif // MACPIMAGEHANDLEROBSERVER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/inc/macpxmlhandlerobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MAcpXmlHandlerObserver
+ *
+*/
+
+
+#ifndef MACPXMLHANDLEROBSERVER_H
+#define MACPXMLHANDLEROBSERVER_H
+
+class CAcpProvider;
+
+class MAcpXmlHandlerObserver
+    {
+public:
+    /**
+     * Notifies observer when parsing is completed.
+     *
+     * @since S60 v3.2
+     * @param aError System wide error code.
+     */ 
+    virtual void NotifyParsingCompleted( TInt aError ) = 0;
+
+    /**
+     * Notifies observer when new provider is available.
+     *
+     * @since S60 v3.2
+     * @param aError System wide error code.
+     */ 
+    virtual void NotifyParsedProviderL( 
+        const CAcpProvider& aProvider ) = 0;
+    };
+
+#endif // MACPXMLHANDLEROBSERVER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/src/acpbrowserparams.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,373 @@
+/*
+* Copyright (c) 2007-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:  account creation plugin params source file
+*
+*/
+
+
+#include <f32file.h>
+#include <mmtsy_names.h> // For getting network information.
+
+#include "acpbrowserparams.h"
+#include "accountcreationpluginlogger.h"
+#include "accountcreationengineconstants.h"
+
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::NewL
+// ---------------------------------------------------------------------------
+//
+CACPBrowserParams* CACPBrowserParams::NewL()
+    {
+    CACPBrowserParams* self = NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::NewLC
+// ---------------------------------------------------------------------------
+//
+CACPBrowserParams* CACPBrowserParams::NewLC()
+    {
+    CACPBrowserParams* self = new (ELeave) CACPBrowserParams();
+    CleanupStack::PushL(self);
+    self->ConstructL( );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::CACPBrowserParams
+// ---------------------------------------------------------------------------
+//
+CACPBrowserParams::CACPBrowserParams()         
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::~CACPBrowserParams
+// ---------------------------------------------------------------------------
+//
+CACPBrowserParams::~CACPBrowserParams()
+    {
+    iPhone.Close();
+    iTelServer.Close();
+    
+#ifdef __PLUG_AND_PLAY_MOBILE_SERVICES    
+    delete iPnpUtil;
+#endif    
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CACPBrowserParams::ConstructL( )
+    {
+    ACPLOG( "CACPBrowserParams::ConstructL begin" );
+
+#ifdef __PLUG_AND_PLAY_MOBILE_SERVICES    
+    // Create PnP utility class instance.
+    iPnpUtil = CPnpUtilImpl::NewLC();
+    CleanupStack::Pop( iPnpUtil );
+#endif
+    
+    // Initialize the telephone server
+    User::LeaveIfError( iTelServer.Connect() );
+    User::LeaveIfError( iTelServer.LoadPhoneModule( KPhoneModuleName ) );
+    User::LeaveIfError( iPhone.Open( iTelServer, KPhoneName ) );
+
+    RetrieveParamsL();
+
+    ACPLOG( "CACPBrowserParams::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::RetrieveParamsL
+// ---------------------------------------------------------------------------
+//
+void CACPBrowserParams::RetrieveParamsL()
+    {         
+    ACPLOG( "CACPBrowserParams::RetrieveParamsL begin" );
+
+    RetrievePhoneModel();
+    RetrieveHomeNetworkInfoL();
+    RetrieveSigningParamsL();
+    RetrieveWlanMacAddress();
+    RetrievePhoneInfoL();
+
+    ACPLOG( "CACPBrowserParams::RetrieveParamsL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::RetrievePhoneModel
+// ---------------------------------------------------------------------------
+//
+void CACPBrowserParams::RetrievePhoneModel()
+    {
+    ACPLOG( "CACPBrowserParams::RetrievePhoneModelL begin" );
+
+    RMobilePhone::TMobilePhoneIdentityV1 phoneIdentity;
+    TRequestStatus status( KRequestPending );
+    iPhone.GetPhoneId( status, phoneIdentity );
+    User::WaitForRequest( status );
+
+    iPhoneModel.Copy( phoneIdentity.iModel );
+
+    ACPLOG( "CACPBrowserParams::RetrievePhoneModelL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::RetrieveHomeNetworkInfoL
+// ---------------------------------------------------------------------------
+//
+void CACPBrowserParams::RetrieveHomeNetworkInfoL()
+    {
+    ACPLOG( "CACPBrowserParams::RetrieveHomeNetworkInfoL begin" );
+
+    RMobilePhone::TMobilePhoneNetworkCountryCode homeMcc( KNullDesC );
+    RMobilePhone::TMobilePhoneNetworkIdentity homeMnc( KNullDesC );
+
+    if ( RegisteredInNetwork() )
+        {
+        ACPLOG( " - registered in network, fetch info" );
+        iPnpUtil->FetchHomeNetworkInfoL();
+        homeMcc = iPnpUtil->HomeMccL();
+        homeMnc = iPnpUtil->HomeMncL();
+        }
+
+    _LIT( KZero, "0" );
+    if ( homeMcc.Length() )
+        {
+        iHomeMcc.Copy( homeMcc );
+        }
+    else
+        {
+        iHomeMcc.Copy( KZero );
+        }
+    
+    if ( homeMnc.Length() )
+        {
+        iHomeMnc.Copy( homeMnc );
+        }
+    else
+        {
+        iHomeMnc.Copy( KZero );
+        }
+    
+    ACPLOG( "CACPBrowserParams::RetrieveHomeNetworkInfoL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::RetrieveSigningParamsL
+// ---------------------------------------------------------------------------
+//
+void CACPBrowserParams::RetrieveSigningParamsL()
+    {
+    ACPLOG( "CACPBrowserParams::RetrieveSigningParamsL begin" );
+
+    // First reset nonce.
+    iNonce.Zero();
+
+#ifdef __PLUG_AND_PLAY_MOBILE_SERVICES    
+    // Create new nonce.
+    iPnpUtil->CreateNewNonceL( 0, iNonce );
+    
+    // Get key info.
+    iPnpUtil->GetKeyInfoL( iKeyInfo );
+#endif
+    
+    ACPLOG( "CACPBrowserParams::RetrieveSigningParamsL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::RetrieveWlanMacAddressL
+// ---------------------------------------------------------------------------
+//
+void CACPBrowserParams::RetrieveWlanMacAddress()
+    {
+    ACPLOG( "CACPBrowserParams::RetrieveWlanMacAddress begin" );
+
+    TBuf8<KPSWlanMacAddressLength> address;
+
+    RProperty::Get( 
+        KPSUidWlan, 
+        KPSWlanMacAddress, 
+        address );
+
+    for ( TInt counter = 0; counter < address.Length(); counter++ )
+        {
+        TUint a = (TUint)address[counter];
+        iWlanMACAddress.AppendNumFixedWidthUC( a, EHex, 2 );
+        iWlanMACAddress.Append( KHyph );
+        iWlanMACAddress.LowerCase();
+        }
+
+    // Delete the last ColonMark.
+    if ( iWlanMACAddress.Length() )
+        {
+        iWlanMACAddress.Delete( iWlanMACAddress.Length() -1, 1 );
+        }
+  
+    ACPLOG( "CACPBrowserParams::RetrieveWlanMacAddress end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::GetParameters
+// ---------------------------------------------------------------------------
+//
+void CACPBrowserParams::GetParameters( TDes& aUrl )
+    {
+    ACPLOG2( "CACPBrowserParams::GetParameters begin: %S", &aUrl );
+
+    if ( aUrl.Find( KQuestionMark ) != KErrNotFound )
+        {
+        aUrl.Append( KAmperSand );
+        }
+    else
+        {
+        aUrl.Append( KQuestionMark );
+        }    
+
+    // Home MNC.
+    aUrl.Append( KMnc );     
+    aUrl.Append( KPlacing );
+    if( iHomeMnc != KNullDesC )
+        {
+        aUrl.Append( iHomeMnc ); 
+        }
+    else
+        {
+        aUrl.Append( _L("0") );
+        }
+
+    aUrl.Append( KAmperSand );
+
+    // Home MCC.
+    aUrl.Append( KMcc );     
+    aUrl.Append( KPlacing );
+    if( iHomeMcc != KNullDesC )
+        {
+        aUrl.Append( iHomeMcc );
+        }
+    else
+        {
+        aUrl.Append( _L("0") );
+        }
+
+    aUrl.Append( KAmperSand );
+
+    // Nonce.
+    aUrl.Append( KNonce );     
+    aUrl.Append( KPlacing );
+    
+    TBuf<KNonceLength> nonce16;
+    nonce16.Copy( iNonce );
+    aUrl.Append( nonce16 );
+
+    aUrl.Append( KAmperSand );
+
+    // Key Info.
+    aUrl.Append( KKeyInfo );     
+    aUrl.Append( KPlacing );
+    
+    TBuf<KMaxKeyInfoLength> keyInfo16;
+    keyInfo16.Copy( iKeyInfo );
+    aUrl.Append( keyInfo16 );
+
+    aUrl.Append( KAmperSand );
+
+    // Phone Model.
+    aUrl.Append( KDeviceInfo );     
+    aUrl.Append( KPlacing );
+    aUrl.Append( iPhoneModel );
+
+    // SType value is 2
+    aUrl.Append( KAmperSand );
+    aUrl.Append( KsType );     
+    aUrl.Append( KPlacing );
+    aUrl.Append( KCharacterTwo ); 
+
+    // client version
+    aUrl.Append( KAmperSand );
+    aUrl.Append( KcVersion );     
+    aUrl.Append( KPlacing );
+    aUrl.Append( KValuecVersion );
+    
+    // IMEI
+    aUrl.Append( KAmperSand );
+    aUrl.Append( KImei );
+    aUrl.Append( KPlacing );
+    aUrl.Append( iImei );
+
+    // Variant
+    aUrl.Append( KAmperSand );
+    aUrl.Append( KVariant );
+    aUrl.Append( KPlacing );
+    aUrl.Append( iVariant );
+    
+    ACPLOG2( "CACPBrowserParams::GetParameters end: %S", &aUrl );    
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::RetrievePhoneInfoL
+// ---------------------------------------------------------------------------
+//
+void CACPBrowserParams::RetrievePhoneInfoL()
+    {
+    ACPLOG( "CACPBrowserParams::RetrievePhoneInfoL begin" );
+    
+    // Get IMEI.    
+    RMobilePhone::TMobilePhoneIdentityV1 id;
+    
+    TRequestStatus status;
+    iPhone.GetPhoneId( status, id );
+    User::WaitForRequest( status );
+    
+    iImei.Copy( id.iSerialNumber );
+    
+    // Get product code.
+    SysVersionInfo::GetVersionInfo( SysVersionInfo::EProductCode, iVariant );
+    
+    ACPLOG( "CACPBrowserParams::RetrievePhoneInfoL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CACPBrowserParams::RegisteredInNetworkL
+// ---------------------------------------------------------------------------
+//
+TBool CACPBrowserParams::RegisteredInNetwork()
+    {
+    ACPLOG( "CACPBrowserParams::RegisteredInNetwork begin" );
+    // Get registeration status
+    TRequestStatus status;
+    RMobilePhone::TMobilePhoneRegistrationStatus regStatus( 
+        RMobilePhone::ERegistrationUnknown );
+    iPhone.GetNetworkRegistrationStatus( status, regStatus );
+    ACPLOG2( " - network registration status %d", regStatus );
+    User::WaitForRequest( status );
+    if ( RMobilePhone::ERegistrationUnknown == regStatus || 
+        RMobilePhone::ENotRegisteredNoService == regStatus ||
+        RMobilePhone::ENotRegisteredEmergencyOnly == regStatus ||
+        RMobilePhone::ENotRegisteredSearching == regStatus )
+        {
+        ACPLOG( "CACPBrowserParams::RegisteredInNetwork end" );
+        return EFalse;
+        }
+    ACPLOG( "CACPBrowserParams::RegisteredInNetwork end" );
+    return ETrue;
+    }
+
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/src/acpcontroller.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1083 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CAcpController methods
+*
+*/
+
+#include <apgcli.h>
+#include <apgtask.h>
+#include <eikenv.h>
+#include <utf.h>
+#include <pathinfo.h> // For getting phone memory boot path.
+#include <f32file.h>  // For getting phone memory boot path.
+#include <sip.h>
+#include <sipprofileregistry.h>
+#include <sipmanagedprofileregistry.h>
+#include <sipprofile.h>
+#include <sipmanagedprofile.h>
+#include <XdmSettingsApi.h>
+#include <pressettingsapi.h>
+#include <centralrepository.h>
+#include <CWPEngine.h>
+#include <wspdecoder.h>
+#include <PnpUtilImpl.h>
+#include <imcvcodc.h>
+
+#include "acpprovider.h"
+#include "acpcontroller.h"
+#include "acpxmlhandler.h"
+#include "acphttphandler.h"
+#include "accountcreationpluginlogger.h"
+#include "macpcontrollerobserver.h"
+#include "acpbrowserparams.h"
+#include "acpimagehandler.h"
+#include "acpprivatecrkeys.h"
+
+// ---------------------------------------------------------------------------
+// CAcpController::CAcpController
+// ---------------------------------------------------------------------------
+//
+CAcpController::CAcpController( MAcpControllerObserver& aObserver ) 
+    : iObserver( aObserver ),
+    iActiveIndex( KErrNone ),
+    iSisInstallation( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAcpController::ConstructL()
+    {
+    ACPLOG( "CAcpController::ConstructL begin" );
+
+    iParser = CAcpXmlHandler::NewL( *this );
+    iHttpHandler = CAcpHttpHandler::NewL( *this );
+    iData = HBufC8::NewL( KBufferSize );
+    iImageHandler = CAcpImageHandler::NewL( *this );
+    User::LeaveIfError( iFs.Connect() );
+    iSessionId = HBufC8::NewL( 0 );
+
+    ACPLOG( "CAcpController::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CAcpController* CAcpController::NewL( 
+    MAcpControllerObserver& aObserver )
+    {
+    CAcpController* self = CAcpController::NewLC( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CAcpController::NewLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CAcpController* CAcpController::NewLC( 
+    MAcpControllerObserver& aObserver )
+    {
+    CAcpController* self = new ( ELeave ) CAcpController( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CAcpController::~CAcpController
+// ---------------------------------------------------------------------------
+//
+CAcpController::~CAcpController()
+    {
+    ACPLOG( "CAcpController::~CAcpController begin" );
+
+    iFs.Close();
+    iProviders.ResetAndDestroy();
+    delete iParser;
+    delete iHttpHandler;
+    delete iData;
+
+#ifdef __PLUG_AND_PLAY_MOBILE_SERVICES    
+    delete iPnpmsparams;
+#endif
+   
+    delete iImageHandler;
+    delete iSessionId;
+    delete iSipModel;
+
+    ACPLOG( "CAcpController::~CAcpController end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::FetchProviderListFromNetworkL
+// Fetches provider list from network and parses it.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CAcpController::FetchProviderListFromNetworkL()
+    {
+    ACPLOG( "CAcpController::FetchProviderListFromNetworkL begin" );
+
+    if ( !iSipModel )
+        {
+        // Create SIP profile registry. From now on we'll get SIP events.
+        iSipModel = CSIPManagedProfileRegistry::NewL( *this );
+        }
+    
+    // Delete old data, otherwise Refresh won't work.
+    delete iData;
+    iData = NULL;
+    iData = HBufC8::NewL( KBufferSize );    
+    iFilename.Zero();
+    iProviders.ResetAndDestroy();
+
+    // 'Restart' XML parser.
+    delete iParser;
+    iParser = NULL;
+    iParser = CAcpXmlHandler::NewL( *this );
+
+    // Get server URL from CenRep.
+    HBufC* url = HBufC::NewLC( KNameMaxLength * 2 );
+    CRepository* cenrep = CRepository::NewLC( KAccountCreationSettingsUid );
+    
+    TPtr urlPtr( url->Des() );
+    cenrep->Get( KAccountCreationPluginServerUri, urlPtr );
+    
+    CleanupStack::PopAndDestroy( cenrep );    
+
+    // Descriptor for body data.
+    TBuf8<KDefaultBufferSize> postData8;
+
+    // Get the download parameters.
+    FetchParametersL( urlPtr ); 
+    
+    // Convert unicode descriptor into UTF8.
+    HBufC8 *url8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *url );
+    CleanupStack::PushL( url8 );
+    
+    // Start dowloading provider list from network.
+    iHttpHandler->GetDataL( *url8, KXmlMimeType, postData8, EFalse,
+        KNullDesC8 );
+
+    CleanupStack::PopAndDestroy( 2, url ); // url8, url
+
+    // Set request type for the http observer because of downloading XML
+    // file from network.
+    // From now on, response events comes to NotifyHttpEvent, NotifyHttpError, 
+    // NotifyBodyReceived and NotifyContentTypeReceived.
+    iType = EXml;   
+
+    // Reset active index.
+    SaveActiveIndex( 0 );
+
+    ACPLOG( "CAcpController::FetchProviderListFromNetworkL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::FetchSisFileFromNetworkL
+// Fetches provider list from network and parses it.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CAcpController::FetchSisFileFromNetworkL( TDesC8& aSisUrl )
+    {
+    ACPLOG( "CAcpController::FetchSisFileFromNetworkL begin" );
+
+    // Delete old data.
+    delete iData;
+    iData = NULL;
+    iData = HBufC8::NewL( KBufferSize ); 
+    
+    // Descriptor for body data.
+    TBuf8<KDefaultBufferSize> postData8; 
+
+    iFs.Delete( KSisFile ); // Old file should delete at first.
+    iWs.Create( iFs , KSisFile, EFileWrite );// Create the file as requested.
+    iFilename.Copy( KSisFile );
+
+    // Start downloading sis file from network. Use saved session id.
+    iHttpHandler->GetDataL( aSisUrl, KSisMimeType, postData8, EFalse,
+        *iSessionId, ETrue );
+
+    // Set request type for the HTTP observer because of downloading SIS file
+    // from network.
+    // From now on, response events comes to NotifyHttpEvent, NotifyHttpError, 
+    // NotifyBodyReceived and NotifyContentTypeReceived.
+    iType = ESis;    
+    
+    // Reset error flag.
+    iErrorDownloading = EFalse;
+
+    ACPLOG( "CAcpController::FetchSisFileFromNetworkL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::FetchIconFileFromNetworkL
+// Fetches provider list from network and parses it.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CAcpController::FetchIconFileFromNetworkL( TDesC8& aIconUrl )
+    {
+    ACPLOG( "CAcpController::FetchIconFileFromNetworkL begin" );
+    ACPLOG2( " - fetching: %S", &aIconUrl );
+    
+    if ( aIconUrl.Length() )
+        {
+        // Descriptor for downloading icon file.
+        TBuf<KDefaultBufferSize> url;
+
+        // Copy the icon address into the descriptor with default size (256).
+        url.Copy( aIconUrl.Right( KDefaultBufferSize ) );
+
+        // Descriptor for body data.
+        TBuf8<KDefaultBufferSize> postData8;
+
+        // Use saved session id when fetching icons.
+        iHttpHandler->GetDataL( aIconUrl, KIconMimeType, postData8, ETrue,
+            *iSessionId );
+
+        // Set request type for the HTTP observer because of downloading icon
+        // file from network.
+        // From now on, response events comes to NotifyHttpEvent,
+        // NotifyHttpError, NotifyBodyReceived and NotifyContentTypeReceived.
+        iType = EIcon; 
+        }
+    
+    ACPLOG( "CAcpController::FetchIconFileFromNetworkL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::CountOfProviders
+// Returns count of providers in providers array.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CAcpController::CountOfProviders() const
+    {
+    TInt count = iProviders.Count();
+    ACPLOG2( "CAcpController::CountOfProviders: count=%d", count );
+    return count;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ProviderNameFromIndexL
+// Returns pointer to provider name by index.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TPtrC CAcpController::ProviderNameFromIndexL(
+    TInt aIndex ) const
+    {
+    if ( 0 > aIndex || aIndex >= iProviders.Count() ) 
+        {
+        User::Leave( KErrArgument );
+        }
+    CAcpProvider& provider = *iProviders[aIndex];
+    return provider.ProviderName();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ProviderSisUrlFromIndexL
+// Returns pointer to provider sisurl by index.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TPtrC8 CAcpController::ProviderSisUrlFromIndexL( 
+    TInt aIndex ) const
+    {
+    if ( 0 > aIndex || aIndex >= iProviders.Count() )
+        {
+        User::Leave( KErrArgument );
+        }
+    CAcpProvider& provider = *iProviders[aIndex];
+    return provider.SisUrl();   
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ProviderActivateUrlFromIndexL
+// Returns pointer to provider sisurl by index.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TPtrC8 CAcpController::ProviderActivationUrlFromIndexL( 
+    TInt aIndex ) const
+    {
+    if ( 0 > aIndex || aIndex >= iProviders.Count() )
+        {
+        User::Leave( KErrArgument ); 
+        }
+    CAcpProvider& provider = *iProviders[aIndex];
+    return provider.ActivationUrl(); 
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ProviderCreateUrlFromIndexL
+// Returns pointer to provider sisurl by index.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TPtrC8 CAcpController::ProviderCreationUrlFromIndexL( 
+    TInt aIndex ) const
+    {
+    if ( 0 > aIndex || aIndex >= iProviders.Count() )
+        {
+        User::Leave( KErrArgument );
+        }
+    CAcpProvider& provider = *iProviders[aIndex];
+    return provider.CreationUrl();    
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ProviderDescriptionFromIndexL
+// Returns pointer to provider description by index.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TPtrC CAcpController::ProviderDescriptionFromIndexL( 
+    TInt aIndex ) const
+    {
+    if ( 0 > aIndex || aIndex >= iProviders.Count() )
+        {
+        User::Leave( KErrArgument );
+        }
+    CAcpProvider& provider = *iProviders[aIndex];
+    return provider.ProviderDescription();    
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ProviderTypeFromIndexL
+// Returns pointer to provider Type by index.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TPtrC CAcpController::ProviderTypeFromIndexL( 
+    TInt aIndex ) const
+    {
+    if ( 0 > aIndex || aIndex >= iProviders.Count() )
+        {
+        User::Leave( KErrArgument );
+        }
+    CAcpProvider& provider = *iProviders[aIndex];
+    return provider.ProviderType();    
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ProviderIconUrlFromIndexL
+// Returns pointer to provider Type by index.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TPtrC8 CAcpController::ProviderIconUrlFromIndexL( 
+    TInt aIndex ) const
+    {
+    if ( 0 > aIndex || aIndex >= iProviders.Count() )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    CAcpProvider& provider = *iProviders[aIndex];
+    return provider.IconUrl();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::SaveActiveIndex
+// Stores active list index in provider list view to member data.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CAcpController::SaveActiveIndex( TInt aIndex )
+    {
+    iActiveIndex = aIndex;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ActiveIndex
+// Returns active list index from member data.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CAcpController::ActiveIndex() const
+    {
+    return iActiveIndex;
+    }    
+
+// ---------------------------------------------------------------------------
+// CAcpController::FetchParametersL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CAcpController::FetchParametersL( TDes& aUrl )
+    {
+    ACPLOG( "CAcpController::FetchParametersL begin" );
+
+#ifdef __PLUG_AND_PLAY_MOBILE_SERVICES    
+    if ( !iPnpmsparams )
+        {
+        iPnpmsparams = CACPBrowserParams::NewL();
+        }
+
+    // This is going to append detail data after the requested address because
+    // of downloading data from network later on.
+    iPnpmsparams->GetParameters( aUrl );
+#endif
+
+    ACPLOG( "CAcpController::FetchParametersL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::CancelHttpRequest
+// Cancels ongoing HTTP request (transaction).
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CAcpController::CancelHttpRequest()
+    {
+    ACPLOG( "CAcpController::CancelHttpRequest begin" );
+
+    iWs.Close();
+    if ( iHttpHandler )
+        {
+        iHttpHandler->CancelTransaction();
+        }
+    
+    ACPLOG( "CAcpController::CancelHttpRequest end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::FetchActionFileL
+// Starts downloading action (wbxml) file from the server.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CAcpController::FetchActionFileL( const TDesC8& aUrl )
+    {
+    ACPLOG( "CAcpController::FetchActionFileL begin" );
+    
+    if ( !aUrl.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    delete iData;
+    iData = NULL;
+    iData = HBufC8::NewL( KBufferSize );   
+
+    iType = EAction;
+    iHttpHandler->GetDataL( aUrl, KActionMimeType, *iData, EFalse,
+        *iSessionId );
+    
+    // Reset error flag.
+    iErrorDownloading = EFalse;
+    
+    ACPLOG( "CAcpController::FetchActionFileL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::SessionId
+// Returns session id received from the server.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC8& CAcpController::SessionId()
+    {
+    return *iSessionId;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ProviderBitmapFromIndexL
+// Returns pointer to provider icon by index.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CAcpController::ProviderBitmapsFromIndexL(
+    TInt aIndex, CFbsBitmap*& aBitmap, CFbsBitmap*& aMask ) const
+    {
+    ACPLOG2( "CAcpController::ProviderBitmapsFromIndexL (%d)", aIndex );
+    
+    // Check whether the index in range or not.
+    if ( aIndex < 0 || aIndex >= iProviders.Count() ) 
+        {
+        // Not in range next leaves with error
+        User::Leave( KErrArgument );
+        }
+
+    // Get provider.
+    CAcpProvider& provider = *iProviders[aIndex];
+    
+    // Set bitmaps.
+    provider.GetBitmaps( aBitmap, aMask );
+    
+    ACPLOG( "CAcpController::ProviderBitmapsFromIndexL out" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::CreateFileFromDataL
+// Creates file from data.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::CreateFileFromDataL( const TDesC& aFilename )
+    {
+    ACPLOG2( "CAcpController::CreateFileFromDataL file=%S", &aFilename );
+
+    RFileWriteStream ws; // Create stream for writing data into the file
+    CleanupClosePushL( ws );
+
+    iFs.Delete( aFilename ); // Old file should delete at first.
+    ws.Create( iFs , aFilename, EFileWrite );// Create the file as requested.
+    ws.WriteL( iData->Des() );// Write requested data into the file.
+    ws.CommitL(); // Ensure that the stream is not contain data anymore.
+    CleanupStack::PopAndDestroy( &ws );
+
+    // Delete content of the descriptor so it's ready to receive data again
+    // from network.
+    TPtr8 dataPtr( iData->Des() );
+    dataPtr.Delete( 0, iData->Length() );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::HandleActionFileL
+// Parses the received action file for wbxml content and sends it to
+// provisioning engine.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::HandleActionFileL()
+    {
+    ACPLOG( "CAcpController::HandleActionFileL begin" );
+    
+    if ( !iData || !iData->Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    // These values are from PnPMS documentation.
+    const TInt KContentTypeLenPos = 5;
+    const TInt KSkippableBytes = 6;
+    
+    // Parse content from the wrapper.
+    TUint32 headersLen( 0 );
+    TUint32 contentLen( 0 );
+    TUint8 contentTypeLen( (*iData)[KContentTypeLenPos] );
+
+    TPtrC8 decodeBuf( iData->Ptr() + KSkippableBytes + contentTypeLen );
+    TWspPrimitiveDecoder decoder( decodeBuf );
+    User::LeaveIfError( decoder.UintVar( headersLen ) );
+    ACPLOG2( " - headers length: %d", headersLen );
+    
+    User::LeaveIfError( decoder.UintVar( contentLen ) );
+    ACPLOG2( " - content length: %d", contentLen );
+    if ( !contentLen || !headersLen )
+        {
+        User::Leave( KErrCorrupt );
+        }
+    
+    // Get data and header pointers.
+    const TInt dataOffset( iData->Length() - contentLen );
+    const TUint8* dataPtr( iData->Ptr() + dataOffset ); 
+    const TInt headerOffset( iData->Length() - contentLen - headersLen );
+    const TUint8* headerPtr( iData->Ptr() + headerOffset );
+    
+    TPtrC8 wbxmlPtr( dataPtr, contentLen ); // Pointer to wbxml data.
+    TPtrC8 hdrPtr( headerPtr, headersLen ); // Pointer to headers.
+
+    // Validate data with PnPUtil.
+    CPnpUtilImpl* pnpUtil = CPnpUtilImpl::NewLC();
+    
+    HBufC8* nonce = HBufC8::NewLC( KNonceLength );
+    TPtr8 noncePtr( nonce->Des() );
+    pnpUtil->GetNonceL( noncePtr );
+    
+    _LIT8( KSignatureValue, "SignValue:" );
+    _LIT8( KDigestValue, "DigValue:" );
+
+    TPtrC8 digestEnc( GetHeaderParamL( hdrPtr, KDigestValue ) );
+    TPtrC8 signatureEnc( GetHeaderParamL( hdrPtr, KSignatureValue ) );
+    
+    if ( pnpUtil->VerifySignatureL(
+        digestEnc, signatureEnc, wbxmlPtr, *nonce ) )
+        {
+        ACPLOG( " - signature verified" );
+        }
+    else
+        {
+        ACPLOG( " - cannot verify signature" );
+        User::Leave( KErrCorrupt );
+        }
+    
+    CleanupStack::PopAndDestroy( 2, pnpUtil );    
+    
+    // Import the OMA CP message.
+    CWPEngine* provEngine = CWPEngine::NewLC();
+    provEngine->ImportDocumentL( wbxmlPtr );
+    
+    // Populate OMA message to adapters.
+    provEngine->PopulateL();
+    
+    // Save OMA message.
+    const TInt itemCount = provEngine->ItemCount();
+    for ( TInt counter = 0; counter < itemCount; counter++ )
+        {
+        provEngine->SaveL( counter );
+        }
+
+    CleanupStack::PopAndDestroy( provEngine );
+    
+    iObserver.NotifyProvisioningCompleted();
+
+    ACPLOG( "CAcpController::HandleActionFileL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::NextIndexWithIconUrl
+// Returns next index with an icon URL in the providers list.
+// ---------------------------------------------------------------------------
+//
+TInt CAcpController::NextIndexWithIconUrl( TPtrC8& aResultUrl )
+    {
+    ACPLOG( "CAcpController::NextIndexWithIconUrl begin" );
+    
+    TInt ret( KErrNotFound );
+
+    const TInt startIndex( iActiveIndex );
+    for ( TInt i = startIndex; i < iProviders.Count(); i++ )
+        {
+        TPtrC8 iconUrl;
+        TRAPD( error, iconUrl.Set( ProviderIconUrlFromIndexL( i ) ) );
+        if ( KErrNone == error && iconUrl.Length() )
+            {
+            SaveActiveIndex( i );
+            aResultUrl.Set( iconUrl );
+            ret = i;
+            break;
+            }
+        }
+    
+    ACPLOG2( "CAcpController::NextIndexWithIconUrl end (%d)", ret );
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::GetHeaderParamL
+// Parses a specific header value from head wrapper format.
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CAcpController::GetHeaderParamL( const TDesC8& aHeaders,
+    const TDesC8& aParam )
+    {
+    ACPLOG( "CAcpController::GetHeaderParamL begin" );
+    
+    if ( !aHeaders.Length() || !aParam.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    TInt paramLoc = aHeaders.Find( aParam );
+    
+    if ( KErrNotFound == paramLoc )
+        {
+        ACPLOG( " - error: Given parameter not found in headers" );
+        User::Leave( KErrNotFound );
+        }
+    else
+        {
+        paramLoc = paramLoc + aParam.Length();
+        }
+    
+    TPtrC8 paramToEndPtr( aHeaders.Mid( paramLoc ) );
+    TInt paramLen = paramToEndPtr.Locate( '\n' );
+    if ( KErrNotFound == paramLen )
+        {
+        paramLen = aHeaders.Length() - paramLoc;
+        }
+    ACPLOG2( " - parameter length: %d", paramLen );
+    
+    TPtrC8 param( aHeaders.Ptr() + paramLoc, paramLen );
+
+    ACPLOG( "CAcpController::GetHeaderParamL end" );
+    return param;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::NotifyParsingCompleted
+// From MAcpXmlHandlerObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::NotifyParsingCompleted( TInt aError )
+    {
+    ACPLOG( "CAcpController::NotifyParsingCompleted begin" );
+
+    iFs.Delete( iFilename ); 
+    
+    // Forward error code to the observer and return.
+    if ( KErrNone != aError )
+        {
+        iObserver.NotifyProviderListReady( aError );
+        return;
+        }
+
+    // Descriptor for downloading icon file from network.
+    SaveActiveIndex( 0 );
+    TPtrC8 iconUrl;
+    TInt index = NextIndexWithIconUrl( iconUrl );
+    
+    if ( KErrNotFound != index )
+        {
+        // Provider with icon URL found, start downloading.
+        TRAP( aError, FetchIconFileFromNetworkL( iconUrl ) );
+        if ( KErrNone != aError )
+            {
+            iObserver.NotifyProviderListReady( aError );
+            CancelHttpRequest();
+            }
+        }
+    else
+        {
+        // None of the providers contains icons -> loading done.
+        iObserver.NotifyProviderListReady( KErrNone );
+        CancelHttpRequest();
+        }
+
+    ACPLOG( "CAcpController::NotifyParsingCompleted end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::NotifyParsedProviderL
+// From MAcpXmlHandlerObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::NotifyParsedProviderL( const CAcpProvider& aProvider )
+    {
+    // To save a data from the received provider then new instace of provider
+    // must be created at first.
+    CAcpProvider* provider = CAcpProvider::NewLC();
+    provider->CopyL( aProvider );
+    iProviders.Append( provider );
+    CleanupStack::Pop( provider );
+
+    ACPLOG( "CAcpController::NotifyParsedProvider: New provider added!" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::NotifyHttpError
+// From MAcpHttpHandlerObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::NotifyHttpError( TInt aError )
+    {
+    ACPLOG2( "CAcpController::NotifyHttpError: Error occurred: %d", aError );
+    iObserver.NotifyProviderListReady( aError );
+    iWs.Close();
+    // Set error flag if error occurred.
+    if ( aError )
+        {
+        iErrorDownloading = ETrue;
+        }
+    }           
+
+// ---------------------------------------------------------------------------
+// CAcpController::NotifyHttpEvent
+// From MAcpHttpHandlerObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::NotifyHttpEvent( TInt aEvent )
+    {
+    ACPLOG2( "CAcpController::NotifyHttpEvent begin (%d)", aEvent );
+
+    TInt error( KErrNone ); // For all operations
+
+    switch ( aEvent )
+        {
+        // To ignore the following
+        case THTTPEvent::EGotResponseHeaders:
+            break;
+        case THTTPEvent::EGotResponseBodyData:
+            break;
+        case THTTPEvent::EResponseComplete:
+            break;
+        // Request succeeded
+        case THTTPEvent::ESucceeded:
+            {
+            switch ( iType )
+                {
+                // XML file for parsing the provider specific data.
+                case EXml:
+                    {
+                    // Xml data has arrived from server successfully.
+
+                    // First parse memory root path.
+                    TParse parse;
+                    parse.Set( PathInfo::PhoneMemoryRootPath(), NULL, NULL );
+                    TFileName xmlFile( parse.Drive() );
+                    // Then append file path to memory root.
+                    xmlFile.Append( KXmlFile );
+                    iFilename.Copy( xmlFile );
+                    TRAP( error, CreateFileFromDataL( iFilename ) );
+
+                    if ( KErrNone == error )
+                        {
+                        TRAP( error, iParser->StartParsingL( iFilename ) );
+                        }
+                    }
+                    break;
+                // SIS file for installing the provider data on phone.
+                case ESis:
+                    {
+                    // SIS data has arrived from server successfully.
+
+                    // First parse memory root path.
+                    TParse parse;
+                    parse.Set( PathInfo::PhoneMemoryRootPath(), NULL, NULL );
+                    TFileName sisFile( parse.Drive() );
+                    // Then append file path to memory root.
+                    sisFile.Append( KSisFile );
+                    iFilename.Copy( sisFile );
+
+                    TRAP( error, iWs.CommitL() );
+                    iWs.Close();
+                    if ( KErrNone == error )
+                        {
+                        // Set sis installation flag and notify 
+                        // sis downloading completed.
+                        iSisInstallation = ETrue;
+                        iObserver.NotifyDownloadingSISCompleted( iFilename );           
+                        }
+                    }
+                    break;
+                // Icon file of the provider for displaying own icon on the
+                // provider list view.
+                case EIcon:
+                    {
+                    const TInt index = ActiveIndex();
+                    if ( index < iProviders.Count() && index >= 0 )
+                        {
+                        CAcpProvider& provider = *iProviders[index];
+                        TPtrC8 mimeType = provider.ContentData();
+                        TRAP( error,  iImageHandler->StartToDecodeL( 
+                            *iData, mimeType ) );
+                        }
+                    }
+                    break;
+                // Action file received successfully.
+                case EAction:
+                    {
+                    TRAP( error, HandleActionFileL() );
+                    ACPLOG2( " - HandleActionFileL error %d", error );
+                    iObserver.NotifyDownloadingCompleted( error );
+                    }
+                    break;
+                }
+            }            
+            break;
+        case THTTPEvent::EFailed:
+            {
+            ACPLOG( "CAcpController::NotifyHttpEvent:HTTP request failed!" );
+            iWs.Close();
+            iObserver.NotifyProviderListReady( KErrGeneral );
+            
+            // Set error flag.
+            iErrorDownloading = ETrue;
+            }            
+            break;
+        // Ignore all unspecified events.
+        default:
+            {
+            ACPLOG( "CAcpController::NotifyHttpEvent:Unknown HTTP request!" );
+            }
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::NotifyBodyReceived
+// From MAcpHttpHandlerObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::NotifyBodyReceived( const TDesC8& aBodyData )
+    {
+    ACPLOG( "CAcpController::NotifyBodyReceived begin" );
+    ACPLOG2( " - length of received data: %d", aBodyData.Length() );
+
+    // For SIS files we use RFileWriteStream for storing data.
+    if ( 0 == iFilename.Compare( KSisFile() ) )
+        {
+        TRAP_IGNORE( iWs.WriteL( aBodyData ) );
+        ACPLOG( "CAcpController::NotifyBodyReceived end" );   
+        return;
+        }
+
+    // Data should exist before going to copy the data received from network.
+    if ( iData && aBodyData.Length() > 0 )
+        {
+        TPtr8 dataPtr( iData->Des() );
+        TRAPD( error, iData = iData->ReAllocL(
+            iData->Length() + aBodyData.Length() ) );
+
+        if ( KErrNone == error )
+            {
+            // Get old descriptor data into the pointer.
+            dataPtr.Set( iData->Des() );
+            // Copy the new data at the end of the descriptor.
+            dataPtr.Append( aBodyData );
+            }
+        }
+
+    ACPLOG( "CAcpController::NotifyBodyReceived end" );   
+    }           
+
+// ---------------------------------------------------------------------------
+// CAcpController::NotifyContentTypeReceived
+// From MAcpHttpHandlerObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::NotifyContentTypeReceived( const TDesC8& aContentData )
+    {
+    ACPLOG( "CAcpController::NotifyContentTypeReceived begin" );
+
+    TInt index = ActiveIndex();
+
+    if ( index >= 0 && index < iProviders.Count() )
+        {
+        CAcpProvider& provider = *iProviders[index];
+        // Set the new content type of the received file
+        // into the provider content 
+        TRAP_IGNORE( provider.SetContentDataL( aContentData ) );
+        }
+
+    ACPLOG( "CAcpController::NotifyContentTypeReceived end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::NotifySessionIdReceivedL
+// From MAcpHttpHandlerObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::NotifySessionIdReceivedL( const TDesC8& aSessionId )
+    {
+    delete iSessionId;
+    iSessionId = NULL;
+    iSessionId = aSessionId.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::NotifyImageCompletion
+// From class MImageHandlerObserver.
+// An asynchronous notify has occurred related to a icon 
+// file downloading for the provider.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::NotifyImageCompletion( TInt aErr )
+    {
+    ACPLOG2( "CAcpController::NotifyImageCompletion begin status=%d", aErr );
+
+    const TInt providerCount = iProviders.Count();
+
+    if ( KErrNone == aErr )
+        {
+        // Gets an index activated.
+        TInt index = ActiveIndex();
+
+        // Checks the index validity.
+        if ( index < providerCount )
+            {
+            // Gets a provider.
+            CAcpProvider& provider = *iProviders[index];
+
+            // Gets a bitmap already converted.
+            CFbsBitmap* bitmap = iImageHandler->GetBitmap();
+            CFbsBitmap* mask = iImageHandler->GetMask();
+
+            if ( bitmap && mask )
+                {
+                // Set the bitmap to the provider.
+                TRAP_IGNORE( provider.SetBitmapL( bitmap, mask ) );
+                }
+
+            // Handle next index if the providers list end wasn't reached.
+            index++;
+            SaveActiveIndex( index );
+            if ( index < providerCount )
+                {
+                TPtrC8 iconUrl;
+                
+                // Find the next index with an icon URL.
+                index = NextIndexWithIconUrl( iconUrl );
+
+                if ( KErrNotFound != index )
+                    {
+                    // Delete data buffer.
+                    TPtr8 dataPtr( iData->Des() );
+                    dataPtr.Delete( 0, iData->Length() );
+                    
+                    // Downloading the icon file from network.
+                    TRAPD( err, FetchIconFileFromNetworkL( iconUrl ) );
+                    if ( KErrNone != err )
+                        {
+                        iObserver.NotifyProviderListReady( err );
+                        }
+                    }
+                else // No more icons to load, notify the observer.
+                    {
+                    iObserver.NotifyProviderListReady( KErrNone );
+                    }
+                }
+            else
+                {
+                // Tell the client that the provider list is now ready
+                // for displaying on the screen.
+                iObserver.NotifyProviderListReady( KErrNone );
+                }
+            }
+        }
+    else
+        {
+        // An error notify to the client.
+        iObserver.NotifyProviderListReady( aErr );
+        }
+    ACPLOG( "CAcpController::NotifyImageCompletion end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ProfileRegistryEventOccurred
+// From MSIPProfileRegistryObserver.
+// SIP profile information event.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::ProfileRegistryEventOccurred( 
+    TUint32 /*aSIPProfileId*/, 
+    TEvent aEvent )
+    {
+    ACPLOG2( "CAcpController::ProfileRegistryEventOccurred: %d", aEvent );
+
+    switch ( aEvent )
+        {
+        case EProfileCreated:
+            {
+            // Notify settings saved if not sis-installation
+            if ( !iSisInstallation )
+                {
+                iObserver.NotifySettingsSaved();
+                }           
+            }
+            break;
+            
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpController::ProfileRegistryErrorOccurred
+// From MSIPProfileRegistryObserver.
+// An asynchronous error has occurred related to SIP profile.
+// ---------------------------------------------------------------------------
+//
+void CAcpController::ProfileRegistryErrorOccurred(
+    TUint32 /*aSIPProfileId*/,
+    TInt aError )
+    {
+    ACPLOG2( "CAcpController::ProfileRegistryErrorOccurred: %d", aError );
+    //To remove warning: variable / argument 'aError' is not used in function
+    aError = aError;
+    }
+
+
+// End of file. 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/src/acphttphandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,704 @@
+/*
+* Copyright (c) 2007-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:  Implements CAcpHttpHandler methods
+*
+*/
+
+
+#include <http/thttpevent.h>
+#include <http/rhttpheaders.h>
+#include <httpstringconstants.h>
+#include <http/rhttptransaction.h>
+#include <http/rhttpconnectioninfo.h>
+#include <http/thttphdrval.h>
+
+
+#include <commdbconnpref.h>
+#include <es_enum.h>
+#include <escapeutils.h>
+
+#include "acphttphandler.h"
+#include "accountcreationpluginlogger.h"
+#include "macphttphandlerobserver.h"
+#include "accountcreationengineconstants.h"
+
+
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::CAcpHttpHandler
+// ---------------------------------------------------------------------------
+//
+CAcpHttpHandler::CAcpHttpHandler( MAcpHttpHandlerObserver& aObserver )
+    : CActive( CActive::EPriorityStandard ), iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::ConstructL()
+    {
+    ACPLOG( "CAcpHttpHandler::ConstructL begin" );
+    
+    iSession.OpenL();
+    
+    ACPLOG( "CAcpHttpHandler::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CAcpHttpHandler* CAcpHttpHandler::NewL( MAcpHttpHandlerObserver& aObserver )
+    {
+    CAcpHttpHandler* self = CAcpHttpHandler::NewLC( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::NewLC
+// ---------------------------------------------------------------------------
+//
+CAcpHttpHandler* CAcpHttpHandler::NewLC( MAcpHttpHandlerObserver& aObserver )
+    {
+    CAcpHttpHandler* self = new ( ELeave ) CAcpHttpHandler( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::~CAcpHttpHandler
+// ---------------------------------------------------------------------------
+//
+CAcpHttpHandler::~CAcpHttpHandler()
+    {
+    ACPLOG( "CAcpHttpHandler::~CAcpHttpHandler begin" );
+
+    if ( IsActive() )
+        {
+        Cancel();
+        }
+
+    // Closing the session closes all transactions.
+    iSession.Close();
+    
+    ShutdownConnection();
+
+    delete iPostData;
+
+    ACPLOG( "CAcpHttpHandler::~CAcpHttpHandler end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::GetDataL
+// Fetches data from network.
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::GetDataL( const TDesC8& aUrl,
+    const TDesC8& aContentType, const TDesC8& aBody, TBool aMimeTypeImage,
+    const TDesC8& aSessionId, TBool aGetSisFile )
+    {
+    ACPLOG( "CAcpHttpHandler::GetDataL begin" ); 
+
+    // Mime type in use.
+    iMimeTypeImage = aMimeTypeImage;
+
+    // Copy data to be posted into member variable.
+    delete iPostData;
+    iPostData = NULL;
+    iPostData = aBody.AllocL();
+
+    RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
+    RStringPool pool = iSession.StringPool();
+
+    // Start connection.
+    if ( !iConnectionOpen )
+        {
+        iPromptShown = EFalse; // Always show connection prompt first.
+        StartConnectionL();
+        }
+
+    connInfo.SetPropertyL(
+        pool.StringF( HTTP::EHttpSocketServ, RHTTPSession::GetTable() ),
+        THTTPHdrVal( iSocketServer.Handle() ) );
+
+    connInfo.SetPropertyL(
+        pool.StringF( HTTP::EHttpSocketConnection, RHTTPSession::GetTable() ),
+        THTTPHdrVal( reinterpret_cast<TInt>( &iConnection ) ) );
+
+    TBuf8<KMaxUriLength> url;
+
+    // Insert session id in URLs other than sis URLs.
+    if ( aSessionId.Length() && KSisMimeType().Compare( aContentType ) )
+        {
+        // Change http://address?param=value to
+        //        http://adress;jsessionid=[sessionid]?param=value
+
+        // Find ? and insert the session id part before it.
+        TInt index = aUrl.Find( KQuestionMark8 );
+        if ( KErrNotFound != index )
+            {
+            url.Append( aUrl.Mid( 0, index ) );
+            url.Append( KSessionId );
+            url.Append( aSessionId );
+            url.Append( aUrl.Mid( index ) );
+            }
+        }
+    else
+        {
+        // Use original URL.
+        url.Copy( aUrl );
+        }
+
+    HBufC8* encoded = EscapeUtils::EscapeEncodeL( url,
+        EscapeUtils::EEscapeNormal );
+    CleanupStack::PushL( encoded );
+
+    TBuf<KMaxUriLength> urlTemp;
+    urlTemp.Copy( *encoded );
+    ACPLOG2( " - using url: %S", &urlTemp );
+
+    TUriParser8 uriParser;
+    User::LeaveIfError( uriParser.Parse( *encoded ) );
+
+    // Use HTTP GET when downloading SIS files.
+    if ( aGetSisFile )
+        {
+        iTransaction = iSession.OpenTransactionL( uriParser, *this,
+            GetRequestMethod( HTTP::EGET ) );
+        }
+    else
+        {
+        iTransaction = iSession.OpenTransactionL( uriParser, *this,
+            GetRequestMethod( HTTP::EPOST ) );
+        }
+
+    CleanupStack::PopAndDestroy( encoded );
+
+    // Set request headers.
+    RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
+
+    SetHeaderL( hdr, HTTP::EUserAgent, KUserAgent );
+    SetHeaderL( hdr, HTTP::EAccept, KAccept );
+
+    // For POST add Content-Type header and set body.
+    if ( !aGetSisFile )
+        {
+        SetHeaderL( hdr, HTTP::EContentType, aContentType );
+        iTransaction.Request().SetBody( *this );
+        }
+
+    // If connection has been opened already, submit transaction.
+    if ( iConnectionOpen )
+        {
+        iConnection.Progress( iNifProgress );
+
+        if ( !iNifProgress.iError && KLinkLayerOpen == iNifProgress.iStage )
+            {
+            ACPLOG( " - connection still open, submit next transaction" );
+            SubmitTransactionL();
+            }
+        else
+            {
+            // Connection lost or not started, restart it.
+            ACPLOG( " - connection lost, reconnect" );
+
+            iConnectionOpen = EFalse;
+
+            if ( !IsActive() ) 
+                {
+                iConnection.Start( iStatus );
+                SetActive();
+                }
+            }
+        }
+
+    ACPLOG( "CAcpHttpHandler::GetDataL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::SubmitTransactionL
+// Submits HTTP transaction.
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::SubmitTransactionL()
+    {
+    ACPLOG( "CAcpHttpHandler::SubmitTransactionL begin" );
+    
+    // Submit the transaction. 
+    // From now on, response event comes to MHFRunL and/or MHFRunError.
+    iTransaction.SubmitL();
+    iTransactionRunning = ETrue;
+    
+    ACPLOG( "CAcpHttpHandler::SubmitTransactionL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::GetRequestMethod
+// Returns request method based on type.
+// ---------------------------------------------------------------------------
+//
+RStringF CAcpHttpHandler::GetRequestMethod( TInt aType ) const
+    {
+    return iSession.StringPool().StringF( aType, RHTTPSession::GetTable() );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::StartConnectionL
+// Starts the connection asynchronously.
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::StartConnectionL()
+    {
+    ACPLOG( "CAcpHttpHandler::StartConnectionL begin" );
+    
+    User::LeaveIfError( iSocketServer.Connect() );
+    User::LeaveIfError( iConnection.Open( iSocketServer ) );
+    
+    TCommDbConnPref pref;
+    pref.SetDirection( ECommDbConnectionDirectionOutgoing );
+    pref.SetBearerSet( KCommDbBearerLAN | KCommDbBearerCSD |
+        KCommDbBearerWcdma | KCommDbBearerWLAN );
+    
+    // Show connection prompt only once.
+    if ( !iPromptShown )
+        {
+        ACPLOG( " - show connection prompt" );
+        pref.SetDialogPreference( ECommDbDialogPrefPrompt );
+        iPromptShown = ETrue;
+        }
+    else
+        {
+        ACPLOG3( " - set iap %d / net %d", iIapId, iNetId );
+        pref.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
+        pref.SetIapId( iIapId );
+        pref.SetNetId( iNetId );
+        }
+
+    if ( !IsActive() ) 
+        {
+        iConnection.Start( pref, iStatus );
+        SetActive();
+        }
+
+    ACPLOG( "CAcpHttpHandler::StartConnectionL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::CancelTransaction
+// Cancels ongoing transaction and frees the resources.
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::CancelTransaction()
+    {
+    ACPLOG( "CAcpHttpHandler::CancelTransaction begin" );
+    
+    if ( !iTransactionRunning )
+        {
+        ACPLOG( "CAcpHttpHandler::CancelTransaction end (not running)" );
+        return;
+        }
+    
+    iTransaction.Close();
+    ACPLOG( " - transaction closed" );
+    
+    iTransactionRunning = EFalse;
+    ACPLOG( "CAcpHttpHandler::CancelTransaction end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::ShutdownConnection
+// Shuts down connection.
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::ShutdownConnection()
+    {
+    ACPLOG( "CAcpHttpHandler::ShutdownConnection begin" );
+    
+    iConnection.Close();
+    iSocketServer.Close();
+    
+    ACPLOG( "CAcpHttpHandler::ShutdownConnection end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::SetHeaderL
+// Sets transaction's request headers.
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::SetHeaderL( 
+    RHTTPHeaders aHeaders, 
+    TInt aHdrField, 
+    const TDesC8& aHdrValue )
+    {
+    RStringF valStr = iSession.StringPool().OpenFStringL( aHdrValue );
+    CleanupClosePushL( valStr );
+    THTTPHdrVal val( valStr );
+    aHeaders.SetFieldL( iSession.StringPool().StringF(
+        aHdrField, RHTTPSession::GetTable() ), val );
+    CleanupStack::PopAndDestroy( &valStr );
+
+    ACPLOG( "CAcpHttpHandler::SetHeaderL: Request headers set." );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::GetNextDataPart
+// From MHTTPDataSupplier.
+// ---------------------------------------------------------------------------
+//
+TBool CAcpHttpHandler::GetNextDataPart( TPtrC8& aDataPart )
+    {
+    ACPLOG( "CAcpHttpHandler::GetNextDataPart begin" );
+    
+    if ( iPostData )
+        {
+        aDataPart.Set( iPostData->Des() );
+        }
+    
+    ACPLOG( "CAcpHttpHandler::GetNextDataPart end" );
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::ReleaseData
+// From MHTTPDataSupplier.
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::ReleaseData()
+    {
+    ACPLOG( "CAcpHttpHandler::ReleaseData begin" );
+    
+    delete iPostData;
+    iPostData = NULL;
+    
+    ACPLOG( "CAcpHttpHandler::ReleaseData end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::OverallDataSize
+// From MHTTPDataSupplier.
+// ---------------------------------------------------------------------------
+//
+TInt CAcpHttpHandler::OverallDataSize()
+    {
+    ACPLOG( "CAcpHttpHandler::OverallDataSize begin" );
+    
+    if ( iPostData )
+        {
+        ACPLOG2( "CAcpHttpHandler::OverallDataSize end (%d)",
+            iPostData->Length() );
+        return iPostData->Length();
+        }
+    else
+        {
+        ACPLOG( "CAcpHttpHandler::OverallDataSize end" );
+        return KErrNotFound ;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::Reset
+// From MHTTPDataSupplier.
+// ---------------------------------------------------------------------------
+//
+TInt CAcpHttpHandler::Reset()
+    {
+    if ( iPostData )
+        {
+        // iPostData (which is used as data source) is found.
+        return KErrNone;
+        }
+    
+    return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::MHFRunL
+// From MHTTPTransactionCallback.
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::MHFRunL( 
+    RHTTPTransaction aTransaction, 
+    const THTTPEvent& aEvent )
+    {
+    ACPLOG2( "CAcpHttpHandler::MHFRunL: THTTPEvent=%d", aEvent.iStatus );
+
+    switch ( aEvent.iStatus )
+        {
+        case THTTPEvent::EGotResponseHeaders:
+            {
+            ProcessHeadersL( aTransaction );
+            iObserver.NotifyHttpEvent( aEvent.iStatus );
+            }
+            break;
+        case THTTPEvent::EGotResponseBodyData:
+            {
+            MHTTPDataSupplier* body = aTransaction.Response().Body();
+            TPtrC8 dataChunk;
+
+            TBool isLast = body->GetNextDataPart( dataChunk );
+            iObserver.NotifyBodyReceived( dataChunk );
+
+            // Check if more data is expected.
+            if ( isLast )
+                {
+                iObserver.NotifyHttpEvent( aEvent.iStatus );
+                }
+
+            // Always remember to release the body data.
+            body->ReleaseData();
+            }           
+            break;
+        case THTTPEvent::EResponseComplete:
+            {
+            iObserver.NotifyHttpEvent( aEvent.iStatus );
+            }           
+            break;
+        case THTTPEvent::ESucceeded:
+            {
+            ACPLOG( " - HTTP event: succeeded" );
+            CancelTransaction();
+            iObserver.NotifyHttpEvent( aEvent.iStatus );
+            }           
+            break;
+        case THTTPEvent::EFailed:
+            {
+            ACPLOG( " - HTTP event: failed" );
+            CancelTransaction();
+            iObserver.NotifyHttpEvent( aEvent.iStatus );
+            }           
+            break;
+        default:
+            {
+            // Check if some other real error received.
+            if ( aEvent.iStatus != THTTPEvent::ERedirectedTemporarily )
+                {
+                CancelTransaction();
+                iObserver.NotifyHttpError( aEvent.iStatus );
+                
+                // HTTP error occurred, it's safer to restart the connection.
+                iConnectionOpen = EFalse;
+                iSession.Close();
+                iConnection.Close();
+                iSocketServer.Close();
+                // Reopen session.
+                iSession.OpenL();
+                }
+            }
+            break;
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::MHFRunError
+// From MHTTPTransactionCallback.
+// ---------------------------------------------------------------------------
+//
+TInt CAcpHttpHandler::MHFRunError( 
+    TInt aError, 
+    RHTTPTransaction /*aTransaction*/, 
+    const THTTPEvent& /*aEvent*/ )
+    {
+    ACPLOG2( "CAcpHttpHandler::MHFRunError: aError = %d", aError );
+    iObserver.NotifyHttpError( aError );
+    
+    // HTTP error occurred, it's safer to restart the connection.
+    iConnectionOpen = EFalse;
+    iSession.Close();
+    iConnection.Close();
+    iSocketServer.Close();
+    // Reopen session.
+    TRAP_IGNORE( iSession.OpenL() );
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::RunL
+// From CActive.
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::RunL()
+    {
+    ACPLOG( "CAcpHttpHandler::RunL begin" );
+    
+    if ( KErrNone == iStatus.Int() )
+        {
+        ACPLOG( " - Connection started, submit transaction" );
+        TUint connCount( KErrNone );
+        iConnection.EnumerateConnections( connCount );
+        ACPLOG2( " - Connection count %d", connCount );
+        
+        if ( connCount )
+            {
+            TConnectionInfoBuf connInfoPckg;
+            iConnection.GetConnectionInfo( 1, connInfoPckg );
+            TConnectionInfo connInfo = connInfoPckg();
+            
+            ACPLOG3( "   - iapId: %d    netId: %d", connInfo.iIapId,
+                connInfo.iNetId );
+            
+            iIapId = connInfo.iIapId;
+            iNetId = connInfo.iNetId;
+            
+            iConnectionOpen = ETrue;
+            }
+        
+        // Submit the first transaction. Further transactions are submitted
+        // in GetDataL.
+        SubmitTransactionL();
+        }
+    else
+        {
+        // Error occurred, notify observer.
+        iObserver.NotifyHttpError( iStatus.Int() );
+        }
+    
+    ACPLOG( "CAcpHttpHandler::RunL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::DoCancel
+// From CActive.
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::DoCancel()
+    {
+    ACPLOG( "CAcpHttpHandler::DoCancel" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpHttpHandler::ProcessHeadersL
+// Handles known HTTP headers.
+// ---------------------------------------------------------------------------
+//
+void CAcpHttpHandler::ProcessHeadersL( RHTTPTransaction& aTransaction )
+    {
+    ACPLOG( "CAcpHttpHandler::ProcessHeadersL begin" );
+    
+    RHTTPHeaders header = aTransaction.Response().GetHeaderCollection();
+    RStringPool pool = aTransaction.Session().StringPool();
+    THTTPHdrFieldIter filter = header.Fields();
+
+    while ( !filter.AtEnd() )
+        {
+        RStringTokenF fieldName = filter();
+        RStringF fieldNameStr = pool.StringF( fieldName );
+        THTTPHdrVal fieldVal;
+        if ( KErrNone == header.GetField( fieldNameStr, 0, fieldVal ) )
+            {
+            TBuf<KDefaultBufferSize> tmp;
+            tmp.Copy( fieldNameStr.DesC() );
+            ACPLOG2( " - field: %S", &tmp );
+            
+            if ( THTTPHdrVal::KStrFVal == fieldVal.Type() )
+                {
+                tmp.Copy( fieldVal.StrF().DesC() );
+                ACPLOG2( " - value: %S", &tmp );
+                }
+            else if ( THTTPHdrVal::KStrVal == fieldVal.Type() )
+                {
+                tmp.Copy( fieldVal.Str().DesC() );
+                ACPLOG2( " - value: %S", &tmp );
+                }
+            else if ( THTTPHdrVal::KTIntVal == fieldVal.Type() )
+                {
+                ACPLOG2( " - value: %d", fieldVal.Int() );
+                }
+            
+            // Get image content type.
+            if ( iMimeTypeImage )
+                {
+                RStringF contentType = pool.StringF(
+                    HTTP::EContentType, RHTTPSession::GetTable() );
+                if ( fieldNameStr == contentType )
+                    {
+                    if ( fieldVal.StrF().DesC().Length() )
+                        {
+                        // Informs provider for content type of image.
+                        iObserver.NotifyContentTypeReceived( 
+                            fieldVal.StrF().DesC() );
+                        }
+                    }
+                }
+            
+            // Get session id from a cookie.
+            RStringF setCookieStr = pool.StringF( HTTP::ESetCookie,
+                RHTTPSession::GetTable() );
+            if ( fieldNameStr == setCookieStr )
+                {
+                ACPLOG( " - cookie field found" );
+                
+                RStringF cookieStr = pool.StringF(
+                    HTTP::ECookie, RHTTPSession::GetTable() );
+                
+                if ( cookieStr == fieldVal.StrF() )
+                    {
+                    RStringF cookieNameStr = pool.StringF(
+                        HTTP::ECookieName, RHTTPSession::GetTable() );
+                    
+                    THTTPHdrVal cookieName;
+                    
+                    if ( KErrNone == header.GetParam(
+                        setCookieStr, cookieNameStr, cookieName ) )
+                        {
+                        RStringF cookieValueStr = pool.StringF(
+                            HTTP::ECookieValue, RHTTPSession::GetTable() );
+                        THTTPHdrVal cookieVal;
+                    
+                        if ( KErrNone == header.GetParam(
+                            setCookieStr, cookieValueStr, cookieVal ) ) 
+                            {
+                            if ( THTTPHdrVal::KStrFVal == cookieVal.Type() )
+                                {
+                                TBuf<KDefaultBufferSize> cookieTmp;
+                                cookieTmp.Copy( cookieVal.StrF().DesC() );
+                            
+                                if ( cookieTmp.Length() )
+                                    {
+                                    iObserver.NotifySessionIdReceivedL(
+                                            cookieVal.StrF().DesC() );
+                                    }
+                                ACPLOG2( " -session id set to %S", &cookieTmp );
+                                }
+                            else if ( THTTPHdrVal::KStrVal == cookieVal.Type() )
+                                {
+                                TBuf<KDefaultBufferSize> cookieTmp;
+                                cookieTmp.Copy( cookieVal.Str().DesC() );
+                                
+                                if ( cookieTmp.Length() )
+                                    {
+                                    iObserver.NotifySessionIdReceivedL(
+                                            cookieVal.Str().DesC() );
+                                    }
+                                ACPLOG2( " -session id set to %S", &cookieTmp );
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        // Proceed to next header.
+        ++filter;
+        }
+    
+    ACPLOG( "CAcpHttpHandler::ProcessHeadersL end" );
+    }
+
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/src/acpimagehandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,229 @@
+/*
+* 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:  account creation plugin params source file
+*
+*/
+
+
+#include <bitmaptransforms.h>
+#include <fbs.h>
+#include <gulicon.h>
+
+#include "acpimagehandler.h" 
+#include "accountcreationpluginlogger.h"
+#include "macpimagehandlerobserver.h"
+#include "accountcreationengineconstants.h"
+
+
+// ---------------------------------------------------------------------------
+// CAcpImageHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CAcpImageHandler* CAcpImageHandler::NewL( MImageHandlerObserver& aController )
+    {
+    ACPLOG( "CAcpImageHandler::NewL begin" );
+    CAcpImageHandler* self = new(ELeave) CAcpImageHandler( aController );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    ACPLOG( "CAcpImageHandler::NewL end" );
+    return self; 
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpImageHandler::CAcpImageHandler
+// ---------------------------------------------------------------------------
+//    
+CAcpImageHandler::CAcpImageHandler( MImageHandlerObserver& aController )
+    : CActive( EPriorityStandard ),
+    iController( aController )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpImageHandler::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CAcpImageHandler::ConstructL()
+    {
+    ACPLOG( "CAcpImageHandler::ConstructL begin" );
+
+    // Create file server connection.
+    User::LeaveIfError( iFs.Connect() );
+
+    // Create a new active object scheduler for this objects.
+    CActiveScheduler::Add( this );
+
+    ACPLOG( "CAcpImageHandler::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpImageHandler::~CAcpImageHandler()
+// ---------------------------------------------------------------------------
+//
+CAcpImageHandler::~CAcpImageHandler()
+    {
+    ACPLOG( "CAcpImageHandler::~CAcpImageHandler begin" );
+
+    Cancel();
+    iFs.Close();
+
+    delete iImageDecoder;
+    delete iBitmap;
+    delete iMask;
+
+    ACPLOG( "CAcpImageHandler::~CAcpImageHandler end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpImageHandler::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CAcpImageHandler::DoCancel()
+    {
+    ACPLOG( "CAcpImageHandler::DoCancel begin" );
+
+    if ( iImageDecoder )
+        {
+        iImageDecoder->Cancel();
+        }
+
+    ACPLOG( "CAcpImageHandler::DoCancel end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpImageHandler::RunL
+// ---------------------------------------------------------------------------
+//	
+void CAcpImageHandler::RunL()
+    {
+    ACPLOG( "CAcpImageHandler::RunL begin" );
+
+    if ( iStatus == KErrUnderflow )
+        {
+        // Converting continues..
+        iImageDecoder->ContinueConvert( &iStatus );
+
+        // Requests of the active object outstanding.
+        SetActive();
+        }
+    else
+        {
+        iState = EIdle; // Bitmap done and decoder state is idle.
+        // Send a client notify about that.
+        iController.NotifyImageCompletion( iStatus.Int() );
+
+        // Now it's safe to delete image decoder and close file system handle.
+        Cancel();
+        delete iImageDecoder;
+        iImageDecoder = NULL;
+        
+        iFs.Close();
+        }
+
+    ACPLOG( "CAcpImageHandler::RunL end" );  
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpImageHandler::StartToDecodeL
+// Decodes a received image to the bitmap
+// ---------------------------------------------------------------------------
+//
+void CAcpImageHandler::StartToDecodeL( const TDesC8& aSourceData, 
+    const TDesC8& aContentType )
+    {
+    ACPLOG( "CAcpImageHandler::StartToDecodeL begin");
+
+    ACPLOG2( " - Data length: %d", aSourceData.Length() );
+
+    if ( aSourceData.Length() > KErrNone )
+        {
+        // Encoding the image
+        iState = EDecoding;
+
+        // Delete decoder
+        delete iImageDecoder;
+        iImageDecoder = NULL;
+
+        // Create new image decoder.
+        iImageDecoder = CImageDecoder::DataNewL( iFs, aSourceData,
+            aContentType, CImageDecoder::EAllowGeneratedMask );
+
+        // Recreate bitmap.
+    	delete iBitmap;
+    	iBitmap = NULL;
+        iBitmap = new (ELeave) CFbsBitmap();
+
+        // Delete old mask.
+        delete iMask;
+        iMask = NULL;
+        
+        // Check if a mask is present.
+        if ( iImageDecoder->FrameInfo().iFlags &
+            TFrameInfo::ETransparencyPossible )
+            {
+            iMask = new (ELeave) CFbsBitmap();
+            }
+        
+        TSize frameinfo = iImageDecoder->FrameInfo().iOverallSizeInPixels;
+        TDisplayMode frameDisplayMode = 
+            iImageDecoder->FrameInfo().iFrameDisplayMode;
+        
+        ACPLOG2( " - Converted data length: %d bytes",
+            iImageDecoder->FrameInfo().iBitsPerPixel * 
+            frameinfo.iWidth * frameinfo.iHeight / KBitsPerByte );
+
+        // Creates a bitmap and mask with the image sizes and display mode.
+        iBitmap->Create( frameinfo, frameDisplayMode );
+        
+        if ( iMask )
+            {
+            iMask->Create( frameinfo, EGray256 );
+            ACPLOG( " - created mask with 8-bit transparency" );
+
+            iImageDecoder->Convert( &iStatus, *iBitmap, *iMask );
+            }
+        else
+            {
+            iImageDecoder->Convert( &iStatus, *iBitmap );
+            }
+
+        // The active object has requested.
+        SetActive();
+        }
+
+    ACPLOG( "CAcpImageHandler::StartToDecodeL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpImageHandler::GetBitmap
+// Reference to already converted bitmap
+// ---------------------------------------------------------------------------
+//	
+CFbsBitmap* CAcpImageHandler::GetBitmap()
+    {
+    return iBitmap; // Bitmap already converted from given image file.
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpImageHandler::GetMask
+// Reference to already converted mask
+// ---------------------------------------------------------------------------
+//  
+CFbsBitmap* CAcpImageHandler::GetMask()
+    {
+    return iMask;
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/src/acpprovider.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,532 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CAcpProvider methods
+*
+*/
+
+
+#include <fbs.h>
+#include <gulicon.h>
+
+#include "acpprovider.h"
+#include "accountcreationpluginlogger.h"
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::CAcpProvider
+// ---------------------------------------------------------------------------
+//
+CAcpProvider::CAcpProvider() 
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::NewL
+// ---------------------------------------------------------------------------
+//
+CAcpProvider* CAcpProvider::NewL()
+    {
+    CAcpProvider* self = CAcpProvider::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::NewLC
+// ---------------------------------------------------------------------------
+//
+CAcpProvider* CAcpProvider::NewLC()
+    {
+    CAcpProvider* self = new ( ELeave ) CAcpProvider();
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::~CAcpProvider
+// ---------------------------------------------------------------------------
+//
+CAcpProvider::~CAcpProvider()
+    {
+    ACPLOG( "CAcpProvider::~CAcpProvider begin" );
+
+    delete iProviderName;
+    delete iIconUrl;
+    delete iSisUrl;
+    delete iCreationUrl;
+    delete iActivationUrl;
+    delete iBitmap;
+    delete iMask;
+    delete iProviderDescription;
+    delete iProviderType;
+    delete iMimeType;
+
+    ACPLOG( "CAcpProvider::~CAcpProvider end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::CopyL
+// Copies provider data from given parameter to member data.
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::CopyL( const CAcpProvider& aProvider )
+    {
+    ACPLOG( "CAcpProvider::CopyL begin" );
+
+    SetProviderNameL( aProvider.ProviderName() );
+    SetIconUrlL( aProvider.IconUrl() );
+    SetPriority( aProvider.Priority() );
+    SetSisUrlL( aProvider.SisUrl() );
+    SetCreationUrlL( aProvider.CreationUrl() );
+    SetActivationUrlL( aProvider.ActivationUrl() );
+    SetProviderTypeL( aProvider.ProviderType() );
+    SetProviderDescriptionL( aProvider.ProviderDescription() );
+
+    ACPLOG( "CAcpProvider::CopyL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::ProviderName
+// Returns name of the provider.
+// ---------------------------------------------------------------------------
+//
+TPtrC CAcpProvider::ProviderName() const
+    {
+    if ( !iProviderName )
+        {
+        return KNullDesC();
+        }
+    return *iProviderName;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::SetProviderNameL
+// Sets name of the provider.
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::SetProviderNameL( const TDesC& aProviderName )
+    {
+    ACPLOG2( "CAcpProvider::SetProviderNameL: %S", &aProviderName );
+
+    // Check whether the provider name defined or not.
+    if ( !aProviderName.Length() )
+        {
+        return;
+        }
+
+    if ( !iProviderName ) 
+        {
+        iProviderName = HBufC::NewL( aProviderName.Length() );
+        }
+    else
+        {
+        iProviderName = iProviderName->ReAllocL( 
+            iProviderName->Length() + aProviderName.Length() );
+        }
+    iProviderName->Des().Append( aProviderName );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::IconUrl
+// Returns the location of icons.
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CAcpProvider::IconUrl() const
+    {
+    if ( !iIconUrl )
+        {
+        return KNullDesC8();
+        }
+
+    return *iIconUrl;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::SetIconUrlL
+// Sets the location of icons.
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::SetIconUrlL( const TDesC8& aIconUrl )
+    {
+    ACPLOG2( "CAcpProvider::SetIconUrlL: %S", &aIconUrl );
+
+    // Check whether the icon address is defined or not.
+    if ( !aIconUrl.Length() )
+        {
+        return;
+        }
+ 
+    if ( !iIconUrl )
+        {
+        iIconUrl = HBufC8::NewL( aIconUrl.Length() );
+        }
+    else
+        {
+        iIconUrl = iIconUrl->ReAllocL( 
+            iIconUrl->Length() + aIconUrl.Length() );
+        }
+
+    iIconUrl->Des().Append( aIconUrl );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::Priority
+// Returns priority of the provider.
+// ---------------------------------------------------------------------------
+//
+TInt CAcpProvider::Priority() const
+    {
+    return iPriority;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::SetPriority
+// Sets priority of the provider.
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::SetPriority( TInt aPriority )
+    {
+    ACPLOG2( "CAcpProvider::SetPriority: %d", aPriority );
+    iPriority = aPriority;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::SisUrl
+// Returns the location of SIS file.
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CAcpProvider::SisUrl() const
+    {
+    if ( iSisUrl )
+        {
+        return *iSisUrl;
+        }
+
+    return KNullDesC8();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::SetSisUrlL
+// Sets the location of SIS file.
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::SetSisUrlL( const TDesC8& aSisUrl )
+    {
+    ACPLOG2( "CAcpProvider::SetSisUrlL: %S", &aSisUrl );
+
+    // Check whether the SIS address defined or not.
+    if ( !aSisUrl.Length() )
+        {
+        return;
+        }
+
+    if ( !iSisUrl )
+        {
+        iSisUrl = HBufC8::NewL( aSisUrl.Length() );
+        }
+    else
+        {
+        iSisUrl = iSisUrl->ReAllocL( iSisUrl->Length() + aSisUrl.Length() );
+        }
+    iSisUrl->Des().Append( aSisUrl );
+
+    ACPLOG( "CAcpProvider::SetSisUrlL: end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::CreationUrl
+// Returns the location of creation URL.
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CAcpProvider::CreationUrl() const
+    {
+    if ( iCreationUrl )
+        {
+        return *iCreationUrl;
+        }
+    return KNullDesC8();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::SetCreationUrlL
+// Sets the location of creation URL.
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::SetCreationUrlL( const TDesC8& aCreationUrl )
+    {
+    ACPLOG( "CAcpProvider::SetCreationUrlL: begin ");
+
+    // Check whether the creation address defined or not
+    if ( !aCreationUrl.Length() )
+        {
+        return;
+        }
+
+    if ( !iCreationUrl )
+        {
+        iCreationUrl = HBufC8::NewL( aCreationUrl.Length() );
+        }
+    else
+        {
+        iCreationUrl = iCreationUrl->ReAllocL( 
+            iCreationUrl->Length() + aCreationUrl.Length() );
+        }
+    iCreationUrl->Des().Append( aCreationUrl );
+
+    ACPLOG( "CAcpProvider::SetCreationUrlL end")
+    }    
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::ActivationUrl
+// Returns the location of activation URL.
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CAcpProvider::ActivationUrl() const
+    {
+    if ( iActivationUrl )
+        {
+        return *iActivationUrl;
+        }
+
+    return KNullDesC8();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::SetActivationUrlL
+// Sets the location of activation URL.
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::SetActivationUrlL( const TDesC8& aActivationUrl )
+    {
+    ACPLOG2( "CAcpProvider::SetActivationUrlL: %S", &aActivationUrl );
+
+    // Check whether the activation address defined or not.
+    if ( !aActivationUrl.Length() )
+        {
+        return;
+        }
+
+    if ( !iActivationUrl )
+        {
+        iActivationUrl = HBufC8::NewL( aActivationUrl.Length() );
+        }
+    else
+        {
+        iActivationUrl = iActivationUrl->ReAllocL( 
+            iActivationUrl->Length() + aActivationUrl.Length() );
+        }
+
+    iActivationUrl->Des().Append( aActivationUrl ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::ContentData
+// Returns the mime type of image file.
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CAcpProvider::ContentData() const
+    {
+    if ( iMimeType )
+        {
+        return *iMimeType;
+        }
+    return KNullDesC8();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::SetContentDataL
+// Sets the content type of image file.
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::SetContentDataL( const TDesC8& aContentData )
+    {
+    ACPLOG2( "CAcpProvider::SetContentDataL: %S", &aContentData );
+    
+    // Check whether content data defined or not.
+    if ( !aContentData.Length() )
+        {
+        return;
+        }
+
+    if ( !iMimeType )
+        {
+        iMimeType = HBufC8::NewL( aContentData.Length() );
+        }
+    else
+        {
+        iMimeType = iMimeType->ReAllocL( 
+            iMimeType->Length() + aContentData.Length() );
+        }
+    iMimeType->Des().Append( aContentData ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::ProviderType
+// Returns the provider type
+// ---------------------------------------------------------------------------
+//
+TPtrC CAcpProvider::ProviderType() const
+    {
+    if ( iProviderType )
+        {
+        return *iProviderType;
+        }
+    return KNullDesC();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::SetProviderTypeL
+// Sets the provider type
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::SetProviderTypeL( const TDesC& aProviderType )
+    {
+    ACPLOG2( "CAcpProvider::SetProviderTypeL: %S", &aProviderType );
+
+    // Check whether provider type defined or not.
+    if ( !aProviderType.Length() )
+        {
+        return;
+        }
+
+    if ( !iProviderType )
+        {
+        iProviderType = HBufC::NewL( aProviderType.Length() );
+        }
+    else
+        {
+        iProviderType = iProviderType->ReAllocL( 
+            iProviderType->Length() + aProviderType.Length() );
+        }
+    iProviderType->Des().Append( aProviderType );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::ProviderDescription
+// Returns the provider description
+// ---------------------------------------------------------------------------
+//
+TPtrC CAcpProvider::ProviderDescription() const
+    {
+    if ( iProviderDescription )
+        {
+        return *iProviderDescription; 
+        }
+    return KNullDesC();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::SetProviderDescriptionL
+// Sets the provider description
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::SetProviderDescriptionL( const TDesC& aProviderDescription )
+    {
+    ACPLOG2( "CAcpProvider::SetProviderDescriptionL: %S", &aProviderDescription );
+
+    // Check whether the provider description defined or not.
+    if ( !aProviderDescription.Length() )
+        {
+        return;
+        }
+
+    if ( !iProviderDescription )
+        {
+        iProviderDescription = HBufC::NewL( aProviderDescription.Length() );
+        }
+    else
+        {
+        iProviderDescription = iProviderDescription->ReAllocL( 
+            iProviderDescription->Length() + aProviderDescription.Length() );
+        }
+
+    iProviderDescription->Des().Append( aProviderDescription );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::SetBitmapL
+// Copies a bitmap.
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::SetBitmapL( CFbsBitmap* aBitmap, CFbsBitmap* aMask )
+    {
+    ACPLOG( "CAcpProvider::SetBitmapL begin" );
+    
+    if ( !aBitmap ) // Mask is not needed.
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    const TSize bitmapSize = aBitmap->SizeInPixels();
+    if ( bitmapSize.iHeight > 0 && bitmapSize.iWidth > 0 )
+        {
+        ACPLOG3( " - bitmap size %d x %d pixels", bitmapSize.iWidth,
+            bitmapSize.iHeight );
+        
+        delete iBitmap;
+        iBitmap = NULL;
+        delete iMask;
+        iMask = NULL;
+        
+        ACPLOG( " - deleted bitmaps" );
+    
+        // Create new bitmap.
+        iBitmap = new (ELeave) CFbsBitmap();
+        iBitmap->Create( bitmapSize, aBitmap->DisplayMode() );
+        ACPLOG( " - created new bitmap" );
+        
+        // Calculate data length.
+        TInt stride = CFbsBitmap::ScanLineLength( bitmapSize.iWidth,
+            aBitmap->DisplayMode() );
+        TInt length = stride * bitmapSize.iHeight;
+        ACPLOG2( " - actual data length: %d", length );
+    
+        aBitmap->LockHeap();
+        Mem::Copy( iBitmap->DataAddress(), aBitmap->DataAddress(), length );
+        aBitmap->UnlockHeap();
+
+        // Create mask if needed.
+        if ( aMask )
+            {
+            iMask = new (ELeave) CFbsBitmap();
+            iMask->Create( aMask->SizeInPixels(), aMask->DisplayMode() );
+            ACPLOG( " - created new mask" );
+
+            // Calculate data length.
+            TSize maskSize = aMask->SizeInPixels();
+            TInt stride = CFbsBitmap::ScanLineLength( maskSize.iWidth,
+                aMask->DisplayMode() );
+            TInt length = stride * maskSize.iHeight;
+            ACPLOG2( " - actual mask data length: %d", length );
+            
+            aMask->LockHeap();
+            Mem::Copy( iMask->DataAddress(), aMask->DataAddress(), length );
+            aMask->UnlockHeap();
+            }
+        }
+
+    ACPLOG( "CAcpProvider::SetBitmapL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProvider::BitMap
+// Reference to bitmap and mask.
+// ---------------------------------------------------------------------------
+//
+void CAcpProvider::GetBitmaps( CFbsBitmap*& aBitmap, CFbsBitmap*& aMask )
+    {
+    aBitmap = iBitmap;
+    aMask = iMask;
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/src/acpproviderfield.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CAcpProviderField methods
+*
+*/
+
+
+#include "acpproviderfield.h"
+#include "accountcreationpluginlogger.h"
+
+
+// ---------------------------------------------------------------------------
+// CAcpProviderField::CAcpProviderField
+// ---------------------------------------------------------------------------
+//
+CAcpProviderField::CAcpProviderField() 
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderField::NewL
+// ---------------------------------------------------------------------------
+//
+CAcpProviderField* CAcpProviderField::NewL()
+    {
+    CAcpProviderField* self = CAcpProviderField::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderField::NewLC
+// ---------------------------------------------------------------------------
+//
+CAcpProviderField* CAcpProviderField::NewLC()
+    {
+    CAcpProviderField* self = new ( ELeave ) CAcpProviderField();
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderField::~CAcpProviderField
+// ---------------------------------------------------------------------------
+//
+CAcpProviderField::~CAcpProviderField()
+    {
+    ACPLOG( "CAcpProviderField::~CAcpProviderField begin" );
+    delete iFieldName; // Field name
+    delete iFieldData; // Field data
+    ACPLOG( "CAcpProviderField::~CAcpProviderField end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderField::CopyL
+// Copies provider fields data from given parameter to member data.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderField::CopyL( const CAcpProviderField& aProviderField )
+    {
+    ACPLOG( "CAcpProviderField::CopyL begin" );
+
+    // Set field name descriptor 
+    SetFieldNameL( aProviderField.FieldName() );
+    // Set field type
+    iType = aProviderField.iType;
+
+    ACPLOG( "CAcpProviderField::CopyL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderField::FieldName
+// Returns name of the field.
+// ---------------------------------------------------------------------------
+//
+TPtrC CAcpProviderField::FieldName() const
+    {
+    if ( iFieldName )
+        {
+        return *iFieldName;
+        }
+    return KNullDesC();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderField::SetFieldNameL
+// Sets name of the field.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderField::SetFieldNameL( const TDesC& aFieldName )
+    {
+    // Check whether field name defined or not
+    if( aFieldName.Length() > KErrNone )
+        {
+        // Old filed name should be deleted at first
+        delete iFieldName;
+        iFieldName = NULL;
+        // Allocate descriptor for the filed name with the 
+        // requested maximum length
+        iFieldName = HBufC::NewL( aFieldName.Length() );
+        // Copy the filed name into the descriptor
+        iFieldName->Des().Copy( aFieldName );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderField::FieldType
+// Returns type of the field.
+// ---------------------------------------------------------------------------
+//
+CAcpProviderField::TFieldTypes CAcpProviderField::FieldType() const
+    {
+    ACPLOG2( "CAcpProviderField::FieldType: %d", iType );
+    return iType; // Field type
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderField::SetFieldType
+// Sets type of the field.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderField::SetFieldType( CAcpProviderField::TFieldTypes aType )
+    {
+    iType = aType; // Set field type
+    }    
+
+// ---------------------------------------------------------------------------
+// CAcpProviderField::FieldData
+// Returns data of the field.
+// ---------------------------------------------------------------------------
+//
+TPtrC CAcpProviderField::FieldData() const
+    {
+    if( iFieldData ) return *iFieldData; // The field data
+    return KNullDesC(); // Unspecified
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderField::SetFieldDataL
+// Sets data of the field.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderField::SetFieldDataL( const TDesC& aFieldData )
+    {
+    // Check whether the requested field data definec or not
+    if( aFieldData.Length() > KErrNone )
+        {
+        // The field data descriptor should be deleted at first
+        delete iFieldData;
+        iFieldData = NULL;
+
+        // Allocate new descriptor for the field data with the requested
+        // maximum lenght
+        iFieldData = HBufC::NewL( aFieldData.Length() );
+        // Copy the field data into the descriptor
+        iFieldData->Des().Copy( aFieldData );
+        }
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/engine/src/acpxmlhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,509 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CAcpXmlHandler methods
+*
+*/
+
+
+#include <escapeutils.h>
+#include "acpprovider.h"
+#include "acpxmlhandler.h"
+#include "accountcreationpluginlogger.h"
+#include "macpxmlhandlerobserver.h"
+#include "accountcreationengineconstants.h"
+
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::CAcpXmlHandler
+// ---------------------------------------------------------------------------
+//
+CAcpXmlHandler::CAcpXmlHandler( MAcpXmlHandlerObserver& aObserver )
+    : CActive( EPriorityStandard ),
+    iObserver( aObserver )
+    {
+    // Add active scheduler.
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::ConstructL()
+    {
+    ACPLOG( "CAcpXmlHandler::ConstructL begin" );
+    // Create XML parser
+    iParser = CParser::NewL( KXmlMimeType, *this );
+    ACPLOG( "CAcpXmlHandler::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CAcpXmlHandler* CAcpXmlHandler::NewL( MAcpXmlHandlerObserver& aObserver )
+    {
+    CAcpXmlHandler* self = CAcpXmlHandler::NewLC( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::NewLC
+// ---------------------------------------------------------------------------
+//
+CAcpXmlHandler* CAcpXmlHandler::NewLC( MAcpXmlHandlerObserver& aObserver )
+    {
+    CAcpXmlHandler* self = new ( ELeave ) CAcpXmlHandler( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::~CAcpXmlHandler
+// ---------------------------------------------------------------------------
+//
+CAcpXmlHandler::~CAcpXmlHandler()
+    {
+    ACPLOG( "CAcpXmlHandler::~CAcpXmlHandler begin" );
+
+    Cancel(); // Ensures that the parsing is stopped
+    delete iParser;
+    delete iBuffer;
+    delete iOngoingAttr;
+    delete iProvider;
+
+    ACPLOG( "CAcpXmlHandler::~CAcpXmlHandler end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::StartParsingL
+// Starts parsing xml with given filename.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::StartParsingL( const TFileName& aFilename )
+    {
+    ACPLOG( "CAcpXmlHandler::StartParsingL begin" );
+
+    // Save the filename because of deleting file later on.
+    iFilename.Append( aFilename );
+
+    // Leave if parsing is active.
+    if ( IsActive() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    // Connect to fileserver and open xml file to be parsed.    
+    User::LeaveIfError( iFileServer.Connect() );
+    User::LeaveIfError( iFile.Open( iFileServer, aFilename, EFileRead ) );
+
+    delete iBuffer;
+    iBuffer = NULL;    
+
+    TEntry entry;
+
+    // Get size of file.
+    User::LeaveIfError( iFileServer.Entry( aFilename, entry ) );
+
+    TInt fileSize = entry.iSize;
+
+    // Create buffer for file reading and start process.
+    iBuffer = HBufC8::NewL( fileSize );
+
+    TPtr8 ptr( iBuffer->Des() );
+    ptr.Zero();
+
+    iFile.Read( ptr, fileSize, iStatus );
+    SetActive();
+
+    iParser->ParseBeginL();
+
+    ACPLOG( "CAcpXmlHandler::StartParsingL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::HandleFinishedProviderL
+// Handles finished provider and notifies observer.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::HandleFinishedProviderL()
+    {
+    ACPLOG( "CAcpXmlHandler::HandleFinishedProviderL" );
+
+    // Provider exists, save it by calling observer.
+    if ( iProvider )
+        {
+        iObserver.NotifyParsedProviderL( *iProvider );    
+        delete iProvider;
+        iProvider = NULL;
+        }
+
+    // Start new provider by creating instance from CAcpProvider.
+    iProvider = CAcpProvider::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::DoCancel
+// From CActive.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::DoCancel()
+    {
+    ACPLOG( "CAcpXmlHandler::DoCancel begin" );
+    
+    ACPLOG( "CAcpXmlHandler::DoCancel - ReadCancel" );
+    iFile.ReadCancel();
+    
+    TRAP_IGNORE( iParser->ParseEndL() );
+
+    iFileServer.Delete( iFilename ); // Delete old file
+
+    iFile.Close();
+    iFileServer.Close();
+
+    delete iBuffer;
+    iBuffer = NULL;
+
+    delete iOngoingAttr;
+    iOngoingAttr = NULL;
+
+    ACPLOG( "CAcpXmlHandler::DoCancel end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::RunL
+// From CActive.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::RunL()
+    {
+    ACPLOG( "CAcpXmlHandler::RunL begin" );
+
+    if ( KErrNone == iStatus.Int() )
+        {
+        // When buffer length is zero, we have reached end of the document.
+        if ( !iBuffer->Length() )
+            {
+            ACPLOG( " - end of XML document reached" );
+            DoCancel();
+            }
+        // Otherwise continue reading of Xml file.
+        else
+            {
+            iParser->ParseL( *iBuffer );
+            TPtr8 ptr( iBuffer->Des() );
+            iFile.Read( ptr, iStatus );
+            SetActive();
+            ACPLOG( " - continuing reading XML document" );
+            }
+        }
+    else
+        {
+        iObserver.NotifyParsingCompleted( iStatus.Int() );
+        }
+
+    ACPLOG( "CAcpXmlHandler::RunL end" );
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::OnStartDocumentL
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::OnStartDocumentL( 
+    const RDocumentParameters& /*aDocParam*/,
+    TInt aErrorCode )
+    {
+    if ( KErrNone != aErrorCode )
+        {
+        ACPLOG2( "CAcpXmlHandler::OnStartDocumentL: error=%d", aErrorCode );
+        iObserver.NotifyParsingCompleted( aErrorCode );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::OnEndDocumentL
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::OnEndDocumentL( TInt aErrorCode )
+    {
+    ACPLOG2( "CAcpXmlHandler::OnEndDocumentL begin: error=%d", aErrorCode );
+    
+    if ( KErrNone == aErrorCode )
+        {
+        // Save last one.
+        HandleFinishedProviderL();
+        delete iProvider;
+        iProvider = NULL;
+        }
+
+    iObserver.NotifyParsingCompleted( aErrorCode );
+    
+    ACPLOG( "CAcpXmlHandler::OnEndDocumentL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::OnStartElementL
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::OnStartElementL( 
+    const RTagInfo& aElement,
+    const RAttributeArray& , 
+    TInt aErrorCode )
+    {
+    TBuf<KMaxElementLength>element;
+    element.Copy(aElement.LocalName().DesC());
+
+    ACPLOG2( "CAcpXmlHandler::OnStartElementL: element=%S", &element );
+    ACPLOG2( "CAcpXmlHandler::OnStartElementL: error=%d", aErrorCode );
+
+    if ( KErrNone == aErrorCode )
+        {
+        // No need to go through attributes since they're not used.
+        // Parsing has reached to some of supported elements.
+        // Save element value to member data for further actions.
+        TPtrC8 ptr = aElement.LocalName().DesC();
+
+        if ( !ptr.Compare( KServiceProvider ) ||
+            !ptr.Compare( KProviderName ) ||
+            !ptr.Compare( KIconUrl ) ||
+            !ptr.Compare( KSisUrl ) ||
+            !ptr.Compare( KCreateUrl ) ||
+            !ptr.Compare( KActivateUrl ) ||
+            !ptr.Compare( KProviderDescription ) ||
+            !ptr.Compare( KProviderType ) ||
+            !ptr.Compare( KReportUrl ) )
+            {
+            iOngoingAttr = HBufC8::NewL( ptr.Length() );
+            iOngoingAttr->Des().Copy( ptr );
+            iGetContentNow = ETrue;
+            // just for creating provider
+            if ( !ptr.Compare( KServiceProvider ) )
+                {
+                iGetContentNow = EFalse;
+                }
+            }
+
+        if ( iOngoingAttr )
+            {
+            // Parsing of provider has been started.
+            // This means that old provider is ready for saving 
+            // if it's not first one. In that case, new provider is started.
+            if ( !iOngoingAttr->Compare( KServiceProvider ) )
+                {
+                HandleFinishedProviderL();
+                delete iOngoingAttr;
+                iOngoingAttr = NULL;
+               }
+            }
+        }
+    else
+        {
+        ACPLOG2( "CAcpXmlHandler::OnStartElementL: error=%d", aErrorCode );
+        iObserver.NotifyParsingCompleted( aErrorCode );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::OnEndElementL
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::OnEndElementL( const RTagInfo& /*aElement*/, 
+    TInt aErrorCode )
+    {
+    if ( KErrNone == aErrorCode )
+        {
+        // Reset member variables.
+        iGetContentNow = EFalse;
+
+        delete iOngoingAttr;
+        iOngoingAttr = NULL;
+        }
+    else
+        {
+        ACPLOG2( "CAcpXmlHandler::OnEndElementL: error=%d", aErrorCode );
+        iObserver.NotifyParsingCompleted( aErrorCode );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::OnContentL
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::OnContentL( const TDesC8& aBytes, TInt aErrorCode )
+    {
+    if ( KErrNone == aErrorCode )
+        {
+        ACPLOG( "CAcpXmlHandler::OnContentL" );
+        // We need to save content data if iGetContentNow is set.
+        if ( iGetContentNow )
+            {
+            // Convert unicode data to 16-bit descriptor.
+            HBufC* bytes = EscapeUtils::ConvertToUnicodeFromUtf8L( aBytes );
+
+            // On the cleanup stack
+            CleanupStack::PushL( bytes );
+
+            ACPLOG2( "CAcpXmlHandler::OnContentL: aBytes=%S", bytes );
+
+            // Provider name.
+            if ( !iOngoingAttr->Compare( KProviderName ) )
+                {
+                ACPLOG( "CAcpXmlHandler::SetProviderNameL" );
+                iProvider->SetProviderNameL( *bytes );
+                }
+            // Location of icons package.   
+            else if ( !iOngoingAttr->Compare( KIconUrl ) )
+                {
+                ACPLOG( "CAcpXmlHandler::SetIconUrlL" );
+                iProvider->SetIconUrlL( aBytes );
+                }
+            // Location of sis package.
+            else if ( !iOngoingAttr->Compare( KSisUrl ) )
+                {
+                ACPLOG( "CAcpXmlHandler::SetSisUrlL" );
+                iProvider->SetSisUrlL( aBytes );
+                }
+            // Location to create settings.    
+            else if ( !iOngoingAttr->Compare( KCreateUrl ) )
+                {
+                ACPLOG( "CAcpXmlHandler::SetCreationUrlL" );
+                iProvider->SetCreationUrlL( aBytes );
+                }
+            // Location to activate settings.    
+            else if ( !iOngoingAttr->Compare( KActivateUrl ) )
+                {
+                ACPLOG( "CAcpXmlHandler::SetActivationUrlL" );
+                iProvider->SetActivationUrlL( aBytes );
+                }
+            // Provider description.    
+            else if ( !iOngoingAttr->Compare( KProviderDescription ) )
+                {
+                ACPLOG( "CAcpXmlHandler::SetProviderDescription" );
+                iProvider->SetProviderDescriptionL( *bytes );
+                }            
+            // Provider type.    
+            else if ( !iOngoingAttr->Compare( KProviderType ) )
+                {
+                ACPLOG( "CAcpXmlHandler::SetProviderType" );
+                iProvider->SetProviderTypeL( *bytes );
+                }            
+            // Location to activate settings.    
+            else if ( !iOngoingAttr->Compare( KReportUrl ) )
+                {
+                ACPLOG( " - Provider report url ignored" );
+                }            
+            // Should never happen.    
+            else
+                {
+                User::Leave( KErrNotSupported );
+                }
+            CleanupStack::PopAndDestroy( bytes );
+            }
+        }
+    else
+        {
+        ACPLOG2( "CAcpXmlHandler::OnContentL: error=%d", aErrorCode );
+        iObserver.NotifyParsingCompleted( aErrorCode );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::OnStartPrefixMappingL
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::OnStartPrefixMappingL( 
+    const RString& /*aPrefix*/, 
+    const RString& /*aUri*/,
+    TInt /*aErrorCode*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::OnEndPrefixMappingL
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::OnEndPrefixMappingL( 
+    const RString& /*aPrefix*/, 
+    TInt /*aErrorCode*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::OnIgnorableWhiteSpaceL
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::OnIgnorableWhiteSpaceL( 
+    const TDesC8& /*aBytes*/, 
+    TInt /*aErrorCode*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::OnSkippedEntityL
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::OnSkippedEntityL( 
+    const RString& /*aName*/, 
+    TInt /*aErrorCode*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::OnProcessingInstructionL
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::OnProcessingInstructionL( 
+    const TDesC8& /*aTarget*/, 
+    const TDesC8& /*aData*/,
+    TInt /*aErrorCode*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::OnError
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+void CAcpXmlHandler::OnError( TInt aErrorCode )
+    {
+    ACPLOG2( "CAcpXmlHandler::OnError: error=%d", aErrorCode );
+
+    // Send a notification that the parsing stopped because of error.
+    iObserver.NotifyParsingCompleted( aErrorCode );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpXmlHandler::GetExtendedInterface
+// From MContentHandler.
+// ---------------------------------------------------------------------------
+//
+TAny* CAcpXmlHandler::GetExtendedInterface( const TInt32 /*aUid*/ )
+    {
+    return NULL;
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/group/accountcreationplugin.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2007-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 Account Creation Plugin
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../inc/accountcreationpluginuids.hrh"
+
+TARGET      accountcreationplugin.dll
+CAPABILITY  CAP_ECOM_PLUGIN
+TARGETTYPE  PLUGIN
+
+UID         0x10009D8D KAccountCreationPluginDllUid 
+VENDORID    VID_DEFAULT
+
+SOURCEPATH  ../src
+SOURCE      accountcreationplugin.cpp
+SOURCE      acpproviderlistview.cpp
+SOURCE      acpproviderlistcontainer.cpp
+SOURCE      acpproviderspecificview.cpp
+SOURCE      acpproviderspecificcontainer.cpp
+SOURCE      acpdialog.cpp
+SOURCE      acptimer.cpp
+SOURCE      accountcreationpluginGroupProxy.cpp
+
+START RESOURCE ../data/accountcreationplugin.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END // RESOURCE
+
+START RESOURCE ../data/2000bef1.rss
+TARGET accountcreationplugin.rsc                                                              
+END // RESOURCE
+
+USERINCLUDE ../inc
+USERINCLUDE ../engine/inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+
+LIBRARY     bafl.lib
+LIBRARY     cone.lib 
+LIBRARY     avkon.lib
+LIBRARY     euser.lib
+LIBRARY     efsrv.lib
+LIBRARY     eikcore.lib
+LIBRARY     eikcoctl.lib
+LIBRARY     aknskins.lib
+LIBRARY     aknnotify.lib
+LIBRARY     platformenv.lib 
+LIBRARY     commonengine.lib
+LIBRARY     servicehandler.lib
+LIBRARY     accountcreationengine.lib
+LIBRARY     browserlauncher.lib
+LIBRARY     apparc.lib
+LIBRARY     apgrfx.lib 
+LIBRARY     centralrepository.lib
+LIBRARY     fbscli.lib
+LIBRARY     egul.lib
+LIBRARY     aknicon.lib
+LIBRARY     eikctl.lib
+LIBRARY     inetprotutil.lib
+LIBRARY	    hlplch.lib 
+LIBRARY     xspviewservices.lib
+LIBRARY     serviceprovidersettings.lib 
+LIBRARY     cmmanager.lib 
+LIBRARY     connectionuiutilities.lib 
+LIBRARY     wepsecuritysettingsui.lib 
+LIBRARY     wpasecuritysettingsui.lib 
+LIBRARY     commsdat.lib
+LIBRARY     eikdlg.lib
+LIBRARY	    rcse.lib
+LIBRARY	    featmgr.lib
+LIBRARY	    etext.lib 
+LIBRARY     swinstcli.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/group/accountcreationplugin.xml	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,2105 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!DOCTYPE PROJECT [
+ <!ELEMENT PROJECT (TARGETLIST, TARGETORDER, GROUPLIST, DESIGNLIST?)>
+ <!ELEMENT TARGETLIST (TARGET+)>
+ <!ELEMENT TARGET (NAME, SETTINGLIST, FILELIST?, LINKORDER?, SEGMENTLIST?, OVERLAYGROUPLIST?, SUBTARGETLIST?, SUBPROJECTLIST?, FRAMEWORKLIST?, PACKAGEACTIONSLIST?)>
+ <!ELEMENT NAME (#PCDATA)>
+ <!ELEMENT USERSOURCETREETYPE (#PCDATA)>
+ <!ELEMENT PATH (#PCDATA)>
+ <!ELEMENT FILELIST (FILE*)>
+ <!ELEMENT FILE (PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?, ROOTFILEREF?, FILEKIND?, FILEFLAGS?)>
+ <!ELEMENT PATHTYPE (#PCDATA)>
+ <!ELEMENT PATHROOT (#PCDATA)>
+ <!ELEMENT ACCESSPATH (#PCDATA)>
+ <!ELEMENT PATHFORMAT (#PCDATA)>
+ <!ELEMENT ROOTFILEREF (PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?)>
+ <!ELEMENT FILEKIND (#PCDATA)>
+ <!ELEMENT FILEFLAGS (#PCDATA)>
+ <!ELEMENT FILEREF (TARGETNAME?, PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?)>
+ <!ELEMENT TARGETNAME (#PCDATA)>
+ <!ELEMENT SETTINGLIST ((SETTING|PANELDATA)+)>
+ <!ELEMENT SETTING (NAME?, (VALUE|(SETTING+)))>
+ <!ELEMENT PANELDATA (NAME, VALUE)>
+ <!ELEMENT VALUE (#PCDATA)>
+ <!ELEMENT LINKORDER (FILEREF*)>
+ <!ELEMENT SEGMENTLIST (SEGMENT+)>
+ <!ELEMENT SEGMENT (NAME, ATTRIBUTES?, FILEREF*)>
+ <!ELEMENT ATTRIBUTES (#PCDATA)>
+ <!ELEMENT OVERLAYGROUPLIST (OVERLAYGROUP+)>
+ <!ELEMENT OVERLAYGROUP (NAME, BASEADDRESS, OVERLAY*)>
+ <!ELEMENT BASEADDRESS (#PCDATA)>
+ <!ELEMENT OVERLAY (NAME, FILEREF*)>
+ <!ELEMENT SUBTARGETLIST (SUBTARGET+)>
+ <!ELEMENT SUBTARGET (TARGETNAME, ATTRIBUTES?, FILEREF?)>
+ <!ELEMENT SUBPROJECTLIST (SUBPROJECT+)>
+ <!ELEMENT SUBPROJECT (FILEREF, SUBPROJECTTARGETLIST)>
+ <!ELEMENT SUBPROJECTTARGETLIST (SUBPROJECTTARGET*)>
+ <!ELEMENT SUBPROJECTTARGET (TARGETNAME, ATTRIBUTES?, FILEREF?)>
+ <!ELEMENT FRAMEWORKLIST (FRAMEWORK+)>
+ <!ELEMENT FRAMEWORK (FILEREF, DYNAMICLIBRARY?, VERSION?)>
+ <!ELEMENT PACKAGEACTIONSLIST (PACKAGEACTION+)>
+ <!ELEMENT PACKAGEACTION (#PCDATA)>
+ <!ELEMENT LIBRARYFILE (FILEREF)>
+ <!ELEMENT VERSION (#PCDATA)>
+ <!ELEMENT TARGETORDER (ORDEREDTARGET|ORDEREDDESIGN)*>
+ <!ELEMENT ORDEREDTARGET (NAME)>
+ <!ELEMENT ORDEREDDESIGN (NAME, ORDEREDTARGET+)>
+ <!ELEMENT GROUPLIST (GROUP|FILEREF)*>
+ <!ELEMENT GROUP (NAME, (GROUP|FILEREF)*)>
+ <!ELEMENT DESIGNLIST (DESIGN+)>
+ <!ELEMENT DESIGN (NAME, DESIGNDATA)>
+ <!ELEMENT DESIGNDATA (#PCDATA)>
+]>
+<?codewarrior exportversion="1.0.1" ideversion="5.0" ?>
+<PROJECT>
+    <TARGETLIST>
+        <TARGET>
+            <NAME>ARMV5 UREL</NAME>
+            <SETTINGLIST>
+
+                <!-- Settings for "Source Trees" panel -->
+                <SETTING><NAME>UserSourceTrees</NAME></SETTING>
+
+                <!-- Settings for "Access Paths" panel -->
+                <SETTING><NAME>AlwaysSearchUserPaths</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>InterpretDOSAndUnixPaths</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>RequireFrameworkStyleIncludes</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SourceRelativeIncludes</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>UserSearchPaths</NAME>
+                    <SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\inc</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\inc</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\src</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING></SETTING>
+                <SETTING><NAME>SystemSearchPaths</NAME>
+                    <SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\oem</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\middleware</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\domain\middleware</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\osextensions</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\domain\osextensions</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\ecom</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UREL</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\LIB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\rvct2_2</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING></SETTING>
+
+                <!-- Settings for "Debugger Runtime" panel -->
+                <SETTING><NAME>MWRuntimeSettings_WorkingDirectory</NAME><VALUE/></SETTING>
+                <SETTING><NAME>MWRuntimeSettings_CommandLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>MWRuntimeSettings_HostApplication</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>MWRuntimeSettings_EnvVars</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Target Settings" panel -->
+                <SETTING><NAME>Linker</NAME><VALUE>Symbian Linker v2</VALUE></SETTING>
+                <SETTING><NAME>PreLinker</NAME><VALUE/></SETTING>
+                <SETTING><NAME>PostLinker</NAME><VALUE>Symbian Installer v2</VALUE></SETTING>
+                <SETTING><NAME>Targetname</NAME><VALUE>ARMV5 UREL</VALUE></SETTING>
+                <SETTING><NAME>OutputDirectory</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UREL</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SaveEntriesUsingRelativePaths</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "File Mappings" panel -->
+                <SETTING><NAME>FileMappings</NAME>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>._i</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>._ii</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.c</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cc</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cfg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cia</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ciacpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cwlink</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>XML</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cxx</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.def</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.h</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.hrh</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.i</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.iby</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ii</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.inf</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ini</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.inl</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.loc</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ciacpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.mmp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.mmpi</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.pkg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.policy</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ra</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.resources</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Resource v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>XML</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>true</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rh</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rls</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rss</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rsg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.s</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.script</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.txt</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.a</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.lib</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.dso</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.o</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                </SETTING>
+
+                <!-- Settings for "Build Extras" panel -->
+                <SETTING><NAME>CacheModDates</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>DumpBrowserInfo</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CacheSubprojects</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>UseThirdPartyDebugger</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>BrowserGenerator</NAME><VALUE>2</VALUE></SETTING>
+                <SETTING><NAME>DebuggerAppPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>DebuggerCmdLineArgs</NAME><VALUE/></SETTING>
+                <SETTING><NAME>DebuggerWorkingDir</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CodeCompletionPrefixFileName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CodeCompletionMacroFileName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Debugger Target" panel -->
+                <SETTING><NAME>ConsoleEncoding</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>LogSystemMessages</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>AutoTargetDLLsPopUp</NAME><VALUE>2</VALUE></SETTING>
+                <SETTING><NAME>StopAtWatchpoints</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>PauseWhileRunning</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>PauseInterval</NAME><VALUE>5</VALUE></SETTING>
+                <SETTING><NAME>PauseUIFlags</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>AltExePath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>StopAtTempBPOnLaunch</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CacheSymbolics</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>TempBPFunctionName</NAME><VALUE>main</VALUE></SETTING>
+                <SETTING><NAME>TempBPType</NAME><VALUE>0</VALUE></SETTING>
+
+                <!-- Settings for "Remote Debug" panel -->
+                <SETTING><NAME>Enabled</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>ConnectionName</NAME><VALUE>Symbian MetroTrk</VALUE></SETTING>
+                <SETTING><NAME>DownloadPath</NAME><VALUE>C:\sys\bin\</VALUE></SETTING>
+                <SETTING><NAME>LaunchRemoteApp</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>RemoteAppPath</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CoreID</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>JTAGClockSpeed</NAME><VALUE>8000</VALUE></SETTING>
+                <SETTING><NAME>IsMultiCore</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OSDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>UseGlobalOSDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OSDownloadConnectionName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>OSDownloadPath</NAME><VALUE/></SETTING>
+                <SETTING><NAME>AltDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>AltDownloadConnectionName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Auto-target" panel -->
+                <SETTING><NAME>OtherExecutables</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Analyzer Connections" panel -->
+                <SETTING><NAME>AnalyzerConnectionName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Custom Keywords" panel -->
+                <SETTING><NAME>CustomColor1</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor2</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor3</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor4</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "ARM Debugger" panel -->
+                <SETTING><NAME>Processor</NAME><VALUE>Generic</VALUE></SETTING>
+                <SETTING><NAME>BraekPoinType_II</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseInitFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseConfigFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>IDexecutable</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>IDinitialized</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>IDuninitialized</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>IDconstant</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDexecutable</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDinitialized</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDuninitialized</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>SDconstant</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>VerifyMemWrites</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>ShowMPC107regs</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>InitializationFile</NAME><VALUE/></SETTING>
+                <SETTING><NAME>ConfigurationFile</NAME><VALUE/></SETTING>
+                <SETTING><NAME>BreakpointType</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>WatchpointType</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>TargetOS</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>RTOSPluginName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>ByteOrderType</NAME><VALUE>0</VALUE></SETTING>
+                <PANELDATA><NAME>CodeTest SYMBIAN Instrumenter</NAME><VALUE>
+                    0200020000000100000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000433A5C0000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000637466696C657300000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000636F6465746573742E6964620000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000
+                </VALUE></PANELDATA>
+
+                <!-- Settings for "Symbian Installation" panel -->
+                <SETTING><NAME>SymbianInstallationOutputFilename</NAME><VALUE>Application.sis</VALUE></SETTING>
+                <SETTING><NAME>SymbianInstallationOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>SymbianInstallationContentSearchLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UREL</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianInstallationPassword</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianInstallationCreateStubFile</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Installer Panel v2" panel -->
+                <SETTING><NAME>SymbianInstallationOutputFilename</NAME><VALUE>Application.sis</VALUE></SETTING>
+                <SETTING><NAME>SymbianInstallationOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>SymbianInstallationContentSearchLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UREL</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianInstallationPassword</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianInstallationCreateStubFile</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Resource Panel" panel -->
+                <SETTING><NAME>SymbianResourcesMMPFileLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesBinaryOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\data</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesHeaderFileOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Symbian Resources Panel v2" panel -->
+                <SETTING><NAME>SymbianResourcesMMPFileLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesBinaryOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\data</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesHeaderFileOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Remote Download" panel -->
+                <SETTING><NAME>FileList</NAME><VALUE/><SETTING>
+<SETTING><NAME>HostFilePath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\data\z\resource\accountcreationplugin.RSC</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>TargetFilePath</NAME><VALUE>C:\resource\accountcreationplugin.RSC</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>HostFilePath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\data\Z\Resource\Plugins\2000BEF1.RSC</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>TargetFilePath</NAME><VALUE>C:\Resource\Plugins\2000BEF1.RSC</VALUE></SETTING>
+</SETTING></SETTING>
+
+                <!-- Settings for "Symbian ARM Debugger" panel -->
+                <SETTING><NAME>Processor</NAME><VALUE>Generic</VALUE></SETTING>
+                <SETTING><NAME>UseInitFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseConfigFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>ResetTarget</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>InitializationFile</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>ConfigurationFile</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>TargetOS</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>RTOSPluginName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Symbian Common Panel" panel -->
+                <SETTING><NAME>ShowCommandLine</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SymbianEpocToolsPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE></VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Symbian Compiler Panel" panel -->
+                <SETTING><NAME>PrefixFile</NAME><VALUE>rvct2_2.h</VALUE></SETTING>
+                <SETTING><NAME>CompilerXMLDescriptor</NAME><VALUE>ARM RVCT2_2</VALUE></SETTING>
+                <SETTING><NAME>Macros</NAME><VALUE>__SYMBIAN32__,__ARMCC__,__EPOC32__,__MARM__,__EABI__,__ARMCC_2__,__ARMCC_2_2__,__MARM_ARMV5__,__DLL__,NDEBUG,_UNICODE,__SUPPORT_CPP_EXCEPTIONS__,__PRODUCT_INCLUDE__=\"feature_settings.hrh\"</VALUE></SETTING>
+                <SETTING><NAME>CodeTEST</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>EnableSWIC</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Arguments</NAME><VALUE> -O2 --diag_suppress 66,161,611,654,997,1152,1300,1464,1488,6318,6331  --diag_error 1267 --thumb  --fpu softvfp --exceptions --exceptions_unwind -D__MARM_THUMB__ -D__MARM_INTERWORK__  --cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --export_all_vtbl --no_vfe --apcs /inter --dllimport_runtime</VALUE></SETTING>
+                <SETTING><NAME>CIAArgs</NAME><VALUE>-x c++ -D__CIA__</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Debugging" panel -->
+                <SETTING><NAME>Parse Log File</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Log File Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Symbian SDK Folder</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Log Unresolved Modules</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Log Unresolved Sym Files</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Debug Non-XIP Executables</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Kernel Debugging" panel -->
+                <SETTING><NAME>Start Address</NAME><VALUE>0x00000000</VALUE></SETTING>
+                <SETTING><NAME>Run From Start Address</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Download Image</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OS Image Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Download Address</NAME><VALUE>0x00000000</VALUE></SETTING>
+                <SETTING><NAME>Ask First</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Debug Bootrom</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Bootrom Sym File</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "Symbian Linker Panel" panel -->
+                <SETTING><NAME>LinkOutputFile</NAME><VALUE>accountcreationplugin.dll</VALUE></SETTING>
+                <SETTING><NAME>LinkCmdLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianImportLibrary</NAME><VALUE>accountcreationplugin{000a0000}.lib</VALUE></SETTING>
+                <SETTING><NAME>canDebug</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>canRun</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian RomBuild Panel" panel -->
+                <SETTING><NAME>CommandLine</NAME><VALUE>buildrom -D_DEBUG devkit lubbock techview -olubbock_gui.img</VALUE></SETTING>
+                <SETTING><NAME>OutputPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>DisplayMessages</NAME><VALUE>true</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Target" panel -->
+                <SETTING><NAME>TargetArchitecture</NAME><VALUE>WINSCW</VALUE></SETTING>
+                <SETTING><NAME>LogMessages</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SuppressWarnings</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>GenerateSymbolics</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CompilerPrefix</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CompilerCmdLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianImportLibraryPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "Symbian Tools" panel -->
+                <SETTING><NAME>Gnu Tools Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Epoc32 Tools Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+            </SETTINGLIST>
+            <FILELIST>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.mmp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginARMV5.resources</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistcontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificcontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpqueryview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpquerycontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpdialog.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>bafl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>cone.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>avkon.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>euser.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>efsrv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>eikcore.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>eikcoctl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>aknskins.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>aknnotify.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>platformenv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>commonengine.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>servicehandler.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengine.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>browserlauncher.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>apparc.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>apgrfx.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>centralrepository.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>fbscli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>egul.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>aknicon.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>eikctl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>inetprotutil.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>hlplch.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>xspviewservices.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>serviceprovidersettings.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineconstants.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.hrh</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginconstants.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginlogger.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginuids.hrh</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpcontroller.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpdialog.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistcontainer.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistview.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificcontainer.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificview.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpquerycontainer.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpqueryview.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>maccountcreationpluginobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>macpcontrollerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>macpdialogobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>macphttphandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>macpimagehandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>macpxmlhandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginARMV5UREL.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+</FILELIST>
+            <LINKORDER>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.mmp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginARMV5.resources</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistcontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificcontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpqueryview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpquerycontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpdialog.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>bafl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>cone.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>avkon.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>euser.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>efsrv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>eikcore.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>eikcoctl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>aknskins.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>aknnotify.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>platformenv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>commonengine.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>servicehandler.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengine.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>browserlauncher.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>apparc.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>apgrfx.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>centralrepository.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>fbscli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>egul.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>aknicon.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>eikctl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>inetprotutil.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>hlplch.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>xspviewservices.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>serviceprovidersettings.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineconstants.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.hrh</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginconstants.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginlogger.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginuids.hrh</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpcontroller.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpdialog.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistcontainer.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistview.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificcontainer.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificview.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpquerycontainer.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpqueryview.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>maccountcreationpluginobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>macpcontrollerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>macpdialogobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>macphttphandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>macpimagehandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>macpxmlhandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginARMV5UREL.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</LINKORDER>
+        </TARGET><TARGET>
+            <NAME>ARMV5 UDEB</NAME>
+            <SETTINGLIST>
+
+                <!-- Settings for "Source Trees" panel -->
+                <SETTING><NAME>UserSourceTrees</NAME></SETTING>
+
+                <!-- Settings for "Access Paths" panel -->
+                <SETTING><NAME>AlwaysSearchUserPaths</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>InterpretDOSAndUnixPaths</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>RequireFrameworkStyleIncludes</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SourceRelativeIncludes</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>UserSearchPaths</NAME>
+                    <SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\inc</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\engine\inc</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\src</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING></SETTING>
+                <SETTING><NAME>SystemSearchPaths</NAME>
+                    <SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\oem</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\middleware</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\domain\middleware</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\osextensions</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\domain\osextensions</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\ecom</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UDEB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\LIB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>SearchPath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\include\rvct2_2</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>Recursive</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>FrameworkPath</NAME><VALUE>false</VALUE></SETTING>
+<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>
+</SETTING></SETTING>
+
+                <!-- Settings for "Debugger Runtime" panel -->
+                <SETTING><NAME>MWRuntimeSettings_WorkingDirectory</NAME><VALUE/></SETTING>
+                <SETTING><NAME>MWRuntimeSettings_CommandLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>MWRuntimeSettings_HostApplication</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>MWRuntimeSettings_EnvVars</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Target Settings" panel -->
+                <SETTING><NAME>Linker</NAME><VALUE>Symbian Linker v2</VALUE></SETTING>
+                <SETTING><NAME>PreLinker</NAME><VALUE/></SETTING>
+                <SETTING><NAME>PostLinker</NAME><VALUE>Symbian Installer v2</VALUE></SETTING>
+                <SETTING><NAME>Targetname</NAME><VALUE>ARMV5 UDEB</VALUE></SETTING>
+                <SETTING><NAME>OutputDirectory</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UDEB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SaveEntriesUsingRelativePaths</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "File Mappings" panel -->
+                <SETTING><NAME>FileMappings</NAME>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>._i</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>._ii</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.c</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cc</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cfg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cia</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ciacpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cwlink</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>XML</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.cxx</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.def</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.h</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.hrh</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.i</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.iby</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ii</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.inf</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ini</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.inl</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.loc</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ciacpp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.mmp</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.mmpi</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.pkg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.policy</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.ra</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.resources</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Resource v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>XML</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>true</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rh</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rls</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rss</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.rsg</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.s</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Compiler v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.script</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileType</NAME><VALUE>TEXT</VALUE></SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.txt</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE>C/C++</VALUE></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>true</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.a</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.lib</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.dso</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                    <SETTING>
+                        <SETTING><NAME>FileExtension</NAME><VALUE>.o</VALUE></SETTING>
+                        <SETTING><NAME>Compiler</NAME><VALUE>Symbian Object Importer v2</VALUE></SETTING>
+                        <SETTING><NAME>EditLanguage</NAME><VALUE/></SETTING>
+                        <SETTING><NAME>Precompile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>Launchable</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>ResourceFile</NAME><VALUE>false</VALUE></SETTING>
+                        <SETTING><NAME>IgnoredByMake</NAME><VALUE>false</VALUE></SETTING>
+                    </SETTING>
+                </SETTING>
+
+                <!-- Settings for "Build Extras" panel -->
+                <SETTING><NAME>CacheModDates</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>DumpBrowserInfo</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CacheSubprojects</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>UseThirdPartyDebugger</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>BrowserGenerator</NAME><VALUE>2</VALUE></SETTING>
+                <SETTING><NAME>DebuggerAppPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>DebuggerCmdLineArgs</NAME><VALUE/></SETTING>
+                <SETTING><NAME>DebuggerWorkingDir</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CodeCompletionPrefixFileName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CodeCompletionMacroFileName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Debugger Target" panel -->
+                <SETTING><NAME>ConsoleEncoding</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>LogSystemMessages</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>AutoTargetDLLsPopUp</NAME><VALUE>2</VALUE></SETTING>
+                <SETTING><NAME>StopAtWatchpoints</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>PauseWhileRunning</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>PauseInterval</NAME><VALUE>5</VALUE></SETTING>
+                <SETTING><NAME>PauseUIFlags</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>AltExePath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>StopAtTempBPOnLaunch</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CacheSymbolics</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>TempBPFunctionName</NAME><VALUE>main</VALUE></SETTING>
+                <SETTING><NAME>TempBPType</NAME><VALUE>0</VALUE></SETTING>
+
+                <!-- Settings for "Remote Debug" panel -->
+                <SETTING><NAME>Enabled</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>ConnectionName</NAME><VALUE>Symbian MetroTrk</VALUE></SETTING>
+                <SETTING><NAME>DownloadPath</NAME><VALUE>C:\sys\bin\</VALUE></SETTING>
+                <SETTING><NAME>LaunchRemoteApp</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>RemoteAppPath</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CoreID</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>JTAGClockSpeed</NAME><VALUE>8000</VALUE></SETTING>
+                <SETTING><NAME>IsMultiCore</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OSDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>UseGlobalOSDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OSDownloadConnectionName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>OSDownloadPath</NAME><VALUE/></SETTING>
+                <SETTING><NAME>AltDownload</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>AltDownloadConnectionName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Auto-target" panel -->
+                <SETTING><NAME>OtherExecutables</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Analyzer Connections" panel -->
+                <SETTING><NAME>AnalyzerConnectionName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Custom Keywords" panel -->
+                <SETTING><NAME>CustomColor1</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor2</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor3</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>CustomColor4</NAME>
+                    <SETTING><NAME>Red</NAME><VALUE>0</VALUE></SETTING>
+                    <SETTING><NAME>Green</NAME><VALUE>32767</VALUE></SETTING>
+                    <SETTING><NAME>Blue</NAME><VALUE>0</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "ARM Debugger" panel -->
+                <SETTING><NAME>Processor</NAME><VALUE>Generic</VALUE></SETTING>
+                <SETTING><NAME>BraekPoinType_II</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseInitFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseConfigFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>IDexecutable</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>IDinitialized</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>IDuninitialized</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>IDconstant</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDexecutable</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDinitialized</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>SDuninitialized</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>SDconstant</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>VerifyMemWrites</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>ShowMPC107regs</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>InitializationFile</NAME><VALUE/></SETTING>
+                <SETTING><NAME>ConfigurationFile</NAME><VALUE/></SETTING>
+                <SETTING><NAME>BreakpointType</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>WatchpointType</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>TargetOS</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>RTOSPluginName</NAME><VALUE/></SETTING>
+                <SETTING><NAME>ByteOrderType</NAME><VALUE>0</VALUE></SETTING>
+                <PANELDATA><NAME>CodeTest SYMBIAN Instrumenter</NAME><VALUE>
+                    0200020000000100000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000433A5C0000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000637466696C657300000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000636F6465746573742E6964620000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    0000000000000000000000000000000000000000000000000000000000000000
+                    000000000000000000000000
+                </VALUE></PANELDATA>
+
+                <!-- Settings for "Symbian Installation" panel -->
+                <SETTING><NAME>SymbianInstallationOutputFilename</NAME><VALUE>Application.sis</VALUE></SETTING>
+                <SETTING><NAME>SymbianInstallationOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>SymbianInstallationContentSearchLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UDEB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianInstallationPassword</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianInstallationCreateStubFile</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Installer Panel v2" panel -->
+                <SETTING><NAME>SymbianInstallationOutputFilename</NAME><VALUE>Application.sis</VALUE></SETTING>
+                <SETTING><NAME>SymbianInstallationOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>SymbianInstallationContentSearchLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\release\ARMV5\UDEB</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianInstallationPassword</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianInstallationCreateStubFile</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Resource Panel" panel -->
+                <SETTING><NAME>SymbianResourcesMMPFileLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesBinaryOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\data</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesHeaderFileOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Symbian Resources Panel v2" panel -->
+                <SETTING><NAME>SymbianResourcesMMPFileLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>AccountCreationPlugin\group</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesBinaryOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\data</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+                <SETTING><NAME>SymbianResourcesHeaderFileOutputLocation</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>epoc32\include</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Remote Download" panel -->
+                <SETTING><NAME>FileList</NAME><VALUE/><SETTING>
+<SETTING><NAME>HostFilePath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\data\z\resource\accountcreationplugin.RSC</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>TargetFilePath</NAME><VALUE>C:\resource\accountcreationplugin.RSC</VALUE></SETTING>
+</SETTING><SETTING>
+<SETTING><NAME>HostFilePath</NAME>
+<SETTING><NAME>Path</NAME><VALUE>epoc32\data\Z\Resource\Plugins\2000BEF1.RSC</VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING><SETTING><NAME>TargetFilePath</NAME><VALUE>C:\Resource\Plugins\2000BEF1.RSC</VALUE></SETTING>
+</SETTING></SETTING>
+
+                <!-- Settings for "Symbian ARM Debugger" panel -->
+                <SETTING><NAME>Processor</NAME><VALUE>Generic</VALUE></SETTING>
+                <SETTING><NAME>UseInitFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>UseConfigFile</NAME><VALUE>0</VALUE></SETTING>
+                <SETTING><NAME>ResetTarget</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>InitializationFile</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>ConfigurationFile</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Generic</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>TargetOS</NAME><VALUE>1</VALUE></SETTING>
+                <SETTING><NAME>RTOSPluginName</NAME><VALUE/></SETTING>
+
+                <!-- Settings for "Symbian Common Panel" panel -->
+                <SETTING><NAME>ShowCommandLine</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SymbianEpocToolsPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE></VALUE></SETTING>
+<SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+<SETTING><NAME>PathRoot</NAME><VALUE>s60_323_24 Gadget wk24</VALUE></SETTING>
+</SETTING>
+
+                <!-- Settings for "Symbian Compiler Panel" panel -->
+                <SETTING><NAME>PrefixFile</NAME><VALUE>rvct2_2.h</VALUE></SETTING>
+                <SETTING><NAME>CompilerXMLDescriptor</NAME><VALUE>ARM RVCT2_2</VALUE></SETTING>
+                <SETTING><NAME>Macros</NAME><VALUE>__SYMBIAN32__,__ARMCC__,__EPOC32__,__MARM__,__EABI__,__ARMCC_2__,__ARMCC_2_2__,__MARM_ARMV5__,__DLL__,_DEBUG,_UNICODE,__SUPPORT_CPP_EXCEPTIONS__,__PRODUCT_INCLUDE__=\"feature_settings.hrh\"</VALUE></SETTING>
+                <SETTING><NAME>CodeTEST</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>EnableSWIC</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Arguments</NAME><VALUE> -O0 --diag_suppress 66,161,611,654,997,1152,1300,1464,1488,6318,6331  --diag_error 1267 --thumb  --fpu softvfp --exceptions --exceptions_unwind -D__MARM_THUMB__ -D__MARM_INTERWORK__  --cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --export_all_vtbl --no_vfe --apcs /inter --dllimport_runtime</VALUE></SETTING>
+                <SETTING><NAME>CIAArgs</NAME><VALUE>-x c++ -D__CIA__</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Debugging" panel -->
+                <SETTING><NAME>Parse Log File</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Log File Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Symbian SDK Folder</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Log Unresolved Modules</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Log Unresolved Sym Files</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Debug Non-XIP Executables</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Kernel Debugging" panel -->
+                <SETTING><NAME>Start Address</NAME><VALUE>0x00000000</VALUE></SETTING>
+                <SETTING><NAME>Run From Start Address</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Download Image</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>OS Image Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Download Address</NAME><VALUE>0x00000000</VALUE></SETTING>
+                <SETTING><NAME>Ask First</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Debug Bootrom</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>Bootrom Sym File</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE/></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "Symbian Linker Panel" panel -->
+                <SETTING><NAME>LinkOutputFile</NAME><VALUE>accountcreationplugin.dll</VALUE></SETTING>
+                <SETTING><NAME>LinkCmdLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianImportLibrary</NAME><VALUE>accountcreationplugin{000a0000}.lib</VALUE></SETTING>
+                <SETTING><NAME>canDebug</NAME><VALUE>true</VALUE></SETTING>
+                <SETTING><NAME>canRun</NAME><VALUE>false</VALUE></SETTING>
+
+                <!-- Settings for "Symbian RomBuild Panel" panel -->
+                <SETTING><NAME>CommandLine</NAME><VALUE>buildrom -D_DEBUG devkit lubbock techview -olubbock_gui.img</VALUE></SETTING>
+                <SETTING><NAME>OutputPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>DisplayMessages</NAME><VALUE>true</VALUE></SETTING>
+
+                <!-- Settings for "Symbian Target" panel -->
+                <SETTING><NAME>TargetArchitecture</NAME><VALUE>WINSCW</VALUE></SETTING>
+                <SETTING><NAME>LogMessages</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>SuppressWarnings</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>GenerateSymbolics</NAME><VALUE>false</VALUE></SETTING>
+                <SETTING><NAME>CompilerPrefix</NAME><VALUE/></SETTING>
+                <SETTING><NAME>CompilerCmdLine</NAME><VALUE/></SETTING>
+                <SETTING><NAME>SymbianImportLibraryPath</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+
+                <!-- Settings for "Symbian Tools" panel -->
+                <SETTING><NAME>Gnu Tools Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+                <SETTING><NAME>Epoc32 Tools Path</NAME>
+                    <SETTING><NAME>Path</NAME><VALUE>C:\</VALUE></SETTING>
+                    <SETTING><NAME>PathFormat</NAME><VALUE>Windows</VALUE></SETTING>
+                    <SETTING><NAME>PathRoot</NAME><VALUE>Absolute</VALUE></SETTING>
+                </SETTING>
+            </SETTINGLIST>
+            <FILELIST>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.mmp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginARMV5.resources</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistcontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificcontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpqueryview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpquerycontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>acpdialog.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>bafl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>cone.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>avkon.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>euser.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>efsrv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>eikcore.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>eikcoctl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>aknskins.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>aknnotify.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>platformenv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>commonengine.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>servicehandler.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengine.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>browserlauncher.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>apparc.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>apgrfx.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>centralrepository.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>fbscli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>egul.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>aknicon.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>eikctl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>inetprotutil.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>hlplch.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>xspviewservices.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>serviceprovidersettings.lib</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Library</FILEKIND><FILEFLAGS>Debug</FILEFLAGS></FILE>
+<FILE><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginARMV5UDEB.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT><FILEKIND>Text</FILEKIND></FILE>
+</FILELIST>
+            <LINKORDER>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.mmp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginARMV5.resources</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistcontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificcontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpqueryview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpquerycontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>acpdialog.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>bafl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>cone.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>avkon.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>euser.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>efsrv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>eikcore.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>eikcoctl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>aknskins.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>aknnotify.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>platformenv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>commonengine.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>servicehandler.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengine.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>browserlauncher.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>apparc.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>apgrfx.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>centralrepository.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>fbscli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>egul.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>aknicon.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>eikctl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>inetprotutil.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>hlplch.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>xspviewservices.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>serviceprovidersettings.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginARMV5UDEB.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</LINKORDER>
+        </TARGET><TARGET>
+<NAME>Build All</NAME><SETTINGLIST><SETTING><NAME>Linker</NAME><VALUE>None</VALUE></SETTING>
+<SETTING><NAME>Targetname</NAME><VALUE>Build All</VALUE></SETTING>
+</SETTINGLIST>
+<FILELIST></FILELIST>
+<LINKORDER></LINKORDER>
+<SUBTARGETLIST><SUBTARGET><TARGETNAME>ARMV5 UDEB</TARGETNAME></SUBTARGET>
+<SUBTARGET><TARGETNAME>ARMV5 UREL</TARGETNAME></SUBTARGET>
+</SUBTARGETLIST></TARGET></TARGETLIST>
+
+    <TARGETORDER>
+<ORDEREDTARGET><NAME>ARMV5 UDEB</NAME></ORDEREDTARGET>
+<ORDEREDTARGET><NAME>ARMV5 UREL</NAME></ORDEREDTARGET>
+<ORDEREDTARGET><NAME>Build All</NAME></ORDEREDTARGET>
+</TARGETORDER>
+
+    <GROUPLIST><FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.mmp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<GROUP><NAME>Source</NAME>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistcontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificcontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpqueryview.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpquerycontainer.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpdialog.cpp</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</GROUP>
+<GROUP><NAME>Headers</NAME>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengineconstants.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationplugin.hrh</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginconstants.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginlogger.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginuids.hrh</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpcontroller.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpdialog.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistcontainer.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpproviderlistview.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificcontainer.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpproviderspecificview.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpquerycontainer.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>acpqueryview.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>maccountcreationpluginobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>macpcontrollerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>macpdialogobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>macphttphandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>macpimagehandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>macpxmlhandlerobserver.h</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</GROUP>
+<GROUP><NAME>Resources</NAME>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginARMV5.resources</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</GROUP>
+<GROUP><NAME>Link</NAME>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginARMV5UREL.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UDEB</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationpluginARMV5UDEB.cwlink</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</GROUP>
+<GROUP><NAME>Libraries</NAME>
+<GROUP><NAME>ARMV5</NAME>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>bafl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>cone.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>avkon.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>euser.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>efsrv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>eikcore.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>eikcoctl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>aknskins.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>aknnotify.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>platformenv.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>commonengine.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>servicehandler.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>accountcreationengine.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>browserlauncher.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>apparc.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>apgrfx.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>centralrepository.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>fbscli.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>egul.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>aknicon.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>eikctl.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>inetprotutil.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>hlplch.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>xspviewservices.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UREL</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>serviceprovidersettings.lib</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+<FILEREF><TARGETNAME>ARMV5 UDEB</TARGETNAME><PATHTYPE>Name</PATHTYPE><PATH>EDLL.LIB</PATH><PATHFORMAT>Windows</PATHFORMAT></FILEREF>
+</GROUP>
+</GROUP>
+</GROUPLIST>
+
+</PROJECT>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/group/acpicons_dc.mk	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,70 @@
+#
+# Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: 
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+# ----------------------------------------------------------------------------
+# : Configure these
+# ----------------------------------------------------------------------------
+
+TARGETDIR=$(ZDIR)\resource\apps
+HEADERDIR=\epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\acpicons.mif
+HEADERFILENAME=$(HEADERDIR)\acpicons.mbg
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+# ----------------------------------------------------------------------------
+# : Configure these.
+#
+# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by
+# MifConv if the mask detph is defined.
+#
+# NOTE 2: Usually, source paths should not be included in the bitmap
+# definitions. MifConv searches for the icons in all icon directories in a
+# predefined order, which is currently \s60\icons, \s60\bitmaps2.
+# The directory \s60\icons is included in the search only if the feature flag
+# __SCALABLE_ICONS is defined.
+# ----------------------------------------------------------------------------
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME)  /h$(HEADERFILENAME) \
+	/c8,8 qgn_prop_set_conn_voip.svg
+   
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 accountcreationplugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+// PRJ_EXPORTS
+PRJ_EXPORTS
+
+../conf/accountcreationplugin.confml         APP_LAYER_CONFML(accountcreationplugin.confml)
+../conf/accountcreationplugin_2001e321.crml  APP_LAYER_CRML(accountcreationplugin_2001e321.crml)
+
+../rom/accountcreationplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH( accountcreationplugin.iby )
+../rom/accountcreationpluginresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH( accountcreationpluginresources.iby )
+../loc/accountcreationplugin.loc          APP_LAYER_LOC_EXPORT_PATH( accountcreationplugin.loc )
+
+
+// PRJ_MMPFILES
+PRJ_MMPFILES
+
+//gnumakefile acpicons_dc.mk
+
+../engine/group/accountcreationengine.mmp        
+accountcreationplugin.mmp
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE acpicons.mif
+OPTION HEADERFILE acpicons.mbg
+OPTION SOURCES -c8,8 qgn_prop_set_conn_voip.svg
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/accountcreationplugin.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2007-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:  Header file for CAccountCreationPlugin
+ *
+*/
+
+
+#ifndef ACCOUNTCREATIONPLUGIN_H
+#define ACCOUNTCREATIONPLUGIN_H
+
+#include <AiwServiceIfBase.h>
+#include <AiwServiceHandler.h>
+
+#include "accountcreationplugin.hrh"
+#include "maccountcreationpluginobserver.h"
+
+class MAiwNotifyCallback;
+class CAcpProviderListView;
+class MAccountCreationPluginObserver;
+class CEikonEnv;
+
+/**
+ *  CAccountCreationPlugin class
+ *  Declarition of CAccountCreationPlugin.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CAccountCreationPlugin ) : public CAiwServiceIfBase,
+    public MAccountCreationPluginObserver
+    {
+public:
+
+    static CAccountCreationPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    ~CAccountCreationPlugin();
+
+// from base class CAiwServiceIfBase
+
+    /**
+     * From CAiwServiceIfBase.
+     * Initialises provider with necessary information from the Service 
+     * Handler. This method is called when the consumer makes the attach 
+     * operation.
+     * Not used but here because of inheritance.
+     * 
+     * @since S60 v3.2
+     * @param aFrameworkCallback Framework provided callback for provider
+     *                           to send events to framework. Not used.
+     * @param aInterest List of criteria items which invoked the provider.
+     *                  Not used.
+     */
+    void InitialiseL( MAiwNotifyCallback& /*aFrameworkCallback*/,
+        const RCriteriaArray& /*aInterest*/ );
+
+    /**
+     * From CAiwServiceIfBase.
+     * Executes generic service commands included in criteria.
+     * 
+     * @since S60 v3.2
+     * @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 KAiwOpt* in 
+     *                    AiwCommon.hrh.
+     * @param aCallback Callback for asynchronous command handling, 
+     *                  parameter checking, etc.
+     * @leave KErrArgument Callback is missing when required.
+     * @leave KErrNotSupported No provider supports service.
+     */
+    void HandleServiceCmdL( 
+        const TInt& /*aCmdId*/, 
+        const CAiwGenericParamList& /*aInParamList*/,
+        CAiwGenericParamList& aOutParamList,
+        TUint aCmdOptions = 0,
+        const MAiwNotifyCallback* aCallback = NULL );
+
+// from base class MAccountCreationPluginObserver
+
+    /**
+     * From MAccountCreationPluginObserver.
+     * Informs that an AIW event has occurred.
+     * 
+     * @since S60 v3.2
+     * @param aError Error code.
+     */
+    void NotifyAiwEventL( TInt aError );
+    
+    /**
+     * From MAccountCreationPluginObserver.
+     * Informs that sis file is downloaded.
+     * 
+     * @since S60 v5.0
+     * @param aFileName sis file name
+     */
+    void NotifySISDownloaded( TDesC& aFileName );
+
+private:
+    
+    CAccountCreationPlugin();
+    void ConstructL();
+
+    /**
+     * Sends AIW service command when plugin initialization is completed. 
+     *
+     * @since S60 v3.2
+     */ 
+    void SendInitializedCallbackL() const;
+
+    /**
+     * Sends AIW service command when plugin is stopped its work. 
+     *
+     * @since S60 v3.2
+     */         
+    void SendCompletedCallbackL() const;
+
+    /**
+     * Sends AIW service command when plugin error is reached.
+     *
+     * @since S60 v3.2 
+     */ 
+    void SendErrorCallbackL() const;
+
+    /**
+     * Compares AIW service command connected uid to our plugin uid.
+     *
+     * @since S60 v3.2
+     * @param aOutParamList AIW service command parameters.
+     * @return ETrue if UID's matched, EFalse if not.
+     */
+    TBool CompareUids( const CAiwGenericParamList& aOutParamList ) const;
+
+    /**
+     * Launches ACP UI. 
+     *
+     * @since S60 v3.2
+     */ 
+    void LaunchPluginUiL();
+
+private: // data
+
+    /**
+     * Resource file offset.
+     */
+    TInt iResourceOffset;
+
+    /**
+     * Handle to AIW Service Handler.
+     * Own.
+     */
+    CAiwServiceHandler* iServiceHandler;
+
+    /**
+     * Handle to AIW callback notifier.
+     * Not own.
+     */
+    const MAiwNotifyCallback* iNotifyCallback;
+    
+    /**
+     * Handle to AIW callback notifier.
+     * Own.
+     */
+    CAiwGenericParamList* iCBEventParamList;
+
+    /**
+     * Handle to provider list view.
+     * Not own.
+     */
+    CAcpProviderListView* iProviderListView;
+
+    /**
+     * CEikonEnv.
+     * Own.
+     */
+    CEikonEnv* iEikEnv;
+
+    /**
+     * Boolean indicating if CSC has been started from active idle
+     */ 
+    TBool iLaunchedFromAI;    
+    };  
+
+#endif  // ACCOUNTCREATIONPLUGIN_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/accountcreationplugin.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 UIDs
+*
+*/
+
+#ifndef ACCOUNTCREATIONPLUGIN_HRH
+#define ACCOUNTCREATIONPLUGIN_HRH
+
+/**
+* AIW requests.
+*/
+enum TAcpAiwRequests
+    {
+    EInitialize = 1,
+    EExecute,
+    ELaunchedFromAI
+    };
+    
+enum TAcpCommands
+    {
+    EAcpDownload = 1,
+    EAcpRefresh,
+    EAcpHelp
+    };
+    
+enum TAcpAccountQueryResult
+    {
+    EAcpResultNotSet = 0,
+    EAcpResultYes,
+    EAcpResultNo,
+    EAcpUseExistingAccount,
+    EAcpCreateNewAccount
+    };
+
+#endif // ACCOUNTCREATIONPLUGIN_HRH
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/accountcreationpluginconstants.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 for accountcreationplugin
+*
+*/
+
+
+#ifndef ACCOUNTCREATIONPLUGINCONSTANTS_H
+#define ACCOUNTCREATIONPLUGINCONSTANTS_H
+
+#include "accountcreationpluginuids.hrh"
+
+// UID of this plugin.
+const TUid KAccountCreationPluginUid = { KAccountCreationPluginDllUid };
+// View IDs
+const TUid KProviderListViewId       = { 7520 };
+const TUid KProviderSpecificViewId   = { 1321 };
+const TInt KArrayGranuality          = 5;
+const TInt KMaxSettingLength         = 64;
+const TInt KMaxUrlLength             = 256;
+
+// Name of the resource file.
+_LIT( KResourceFilename, "accountcreationplugin.rsc" );
+_LIT( KListFormat,       "%d\t%S\t\t" ); // Format of setting item.
+_LIT( KIconFileName,     "acpicons.mif" ); // Filename for ACP icons.
+_LIT( KEmpty,            "" );
+_LIT( KAcpSettingItemTextFormat, "\t%S\t\t%S" ); // Setting item text format.
+
+const TUid KPhoneBookTabUid = { 0x20012423 };
+
+#endif  // ACCOUNTCREATIONPLUGINCONSTANTS_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/accountcreationpluginlogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* 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:  Provides macros for logging
+*
+*/
+
+
+#ifndef _ACCOUNTCREATIONPLUGINLOGGER_H
+#define _ACCOUNTCREATIONPLUGINLOGGER_H
+
+#include <e32def.h>
+#include <e32debug.h>
+
+//----------------------------------------------------------------------------
+//  USER LOGGING SETTINGS
+//----------------------------------------------------------------------------
+
+#ifndef _DEBUG
+
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = RDebug
+***************************/ 
+
+#define ACP_DEBUG             0   // UREL BUILD
+
+#else
+
+#define ACP_DEBUG             1   // UDEB BUILD
+
+#endif // _DEBUG
+
+//----------------------------------------------------------------------------
+//  LOGGING MACROs (DO NOT EDIT)
+//
+//  USE THESE MACROS IN YOUR CODE
+//----------------------------------------------------------------------------
+
+#if ACP_DEBUG == 1    // RDebug
+
+#define ACPLOG(AA)           { RDebug::Print(_L(AA)); }
+#define ACPLOG2(AA,BB)       { RDebug::Print(_L(AA),BB); }
+#define ACPLOG3(AA,BB,CC)    { RDebug::Print(_L(AA),BB,CC); }
+#define ACPLOG4(AA,BB,CC,DD) { RDebug::Print(_L(AA),BB,CC,DD); }
+
+#else   // ACP_DEBUG == 0 or invalid -> Disable loggings
+
+#define ACPLOG(AA)          
+#define ACPLOG2(AA,BB)     
+#define ACPLOG3(AA,BB,CC)    
+#define ACPLOG4(AA,BB,CC,DD) 
+
+#endif  // ACP_DEBUG
+
+#endif  // ACCOUNTCREATIONPLUGINLOGGER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/accountcreationpluginuids.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 UIDs
+*
+*/
+
+
+#ifndef ACCOUNTCREATIONPLUGINUIDS_HRH
+#define ACCOUNTCREATIONPLUGINUIDS_HRH
+
+#define KAccountCreationPluginDllUid       0x2000BEF1
+#define KAccountCreationPluginImplUid      0x2000BEF2
+#define KAccountCreationPluginInterfaceUid 0x101F8650
+
+#endif // ACCOUNTCREATIONPLUGINUIDS_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/acpdialog.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,186 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declarition of CAcpDialog
+*
+*/
+
+
+#ifndef ACPDIALOG_H
+#define ACPDIALOG_H
+
+#include <e32base.h>
+
+class CAknGlobalNote;
+class CAknGlobalMsgQuery;
+class MAcpDialogObserver;
+    
+/**
+ *  CAcpDialog class
+ *  Declarition of CAcpDialog.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CAcpDialog ) : public CActive
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver Dialog observer.
+     */
+    static CAcpDialog* NewL( MAcpDialogObserver& aObserver );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver Dialog observer.
+     */
+    static CAcpDialog* NewLC( MAcpDialogObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAcpDialog();
+
+    /**
+     * Launches a wait note.
+     *
+     * @since S60 v3.2
+     * @param aWaitNote Appropriate text.
+     */
+    void LaunchWaitNoteL( TInt aWaitNote );
+
+    /**
+     * Launches a wait note with a custom string.
+     *
+     * @since S60 v3.2
+     * @param aWaitNote Appropriate text.
+     * @param aString Custom string.
+     */
+    void LaunchWaitNoteL( TInt aWaitNote, const TDesC& aString );
+
+    /**
+     * Destroys a wait note.
+     *
+     * @since S60 v3.2
+     */
+    void DestroyWaitNote();
+
+    /**
+     * Shows query with the appropriate text.
+     *
+     * @since S60 v3.2
+     * @param aQuery Text to be displayed.
+     * @return Key pressed.
+     */
+    TInt ShowQueryL( TInt aQuery );
+    
+    /**
+     * Shows message query with the appropriate text.
+     *
+     * @since S60 v5.0
+     * @param aMessageQuery Text to be displayed.
+     */
+    void ShowMessageQueryL( TInt aMessageQuery, const TDesC& aString );
+
+    /**
+     * Shows note with the appropriate text.
+     *
+     * @since S60 v3.2
+     * @param aNote Text to be displayed.
+     * @param aString Text used in resource loading.
+     */
+    void ShowNoteL( TInt aNote, const TDesC& aString );    
+
+    /**
+     * Shows note with the appropriate text.
+     *
+     * @since S60 v3.2
+     * @param aNote Text to be displayed.
+     */
+    void ShowGlobalNoteL( TInt aNote );
+
+    /**
+     * Shows global note with the appropriate text.
+     *
+     * @since S60 v3.2
+     * @param aNote Resource id of the note.
+     * @param aString Text used in resource loading.
+     */
+    void ShowGlobalNoteL( TInt aNote, const TDesC& aString );
+    
+    /**
+     * Shows dialog with several lines for selection.
+     * 
+     * @since S60 v3.2
+     * @param aDialog Dialog resource to use.
+     * @param aArray Array of selections.
+     * @return Selected index.
+     */
+    TInt ShowSelectionDialogL( TInt aDialog, MDesC16Array* aArray );
+
+protected:
+
+// from base class CActive
+
+    /**
+     * From CActive.
+     * Handles request completion event.
+     * 
+     * @since S60 v3.2
+     */
+    void RunL();
+
+    /**
+     * From CActive.
+     * Cancels an outstanding request.
+     * 
+     * @since S60 v3.2
+     */
+    void DoCancel();
+
+private:
+
+    CAcpDialog( MAcpDialogObserver& aObserver );
+
+private: // data  
+
+    /**
+     * Reference for dialog observer.
+     */
+     MAcpDialogObserver& iObserver;
+
+    /**
+     * Global wait note.
+     * Own.
+     */
+    CAknGlobalNote* iWaitNote;
+    
+    /**
+     * Akn global message query 
+     * Own.
+     */
+    CAknGlobalMsgQuery* iGlobalMsgQuery;
+
+    /**
+     * Global note Id
+     */
+    TInt iNoteId;
+    };
+
+#endif // ACPDIALOG_H  
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/acpproviderlistcontainer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declarition of CAcpProviderListContainer
+*
+*/
+
+
+#ifndef ACPPROVIDERLISTCONTAINER_H
+#define ACPPROVIDERLISTCONTAINER_H
+
+#include <coecntrl.h>
+
+class CFbsBitmap;
+class CAcpController;
+class CAknSettingStyleListBox;
+
+/**
+ *  CAcpProviderListContainer class
+ *  Declarition of CAcpProviderListContainer.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CAcpProviderListContainer ) : public CCoeControl
+    {
+    public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aController Plugins controller
+     * @param aRect Rectangle
+     */
+    static CAcpProviderListContainer* NewL( CAcpController& aController,
+        const TRect& aRect );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aController Plugins controller
+     * @param aRect Rectangle
+     */
+    static CAcpProviderListContainer* NewLC( CAcpController& aController,
+        const TRect& aRect );
+
+    /**
+     * Destructor
+     */
+    virtual ~CAcpProviderListContainer();
+
+    /**
+     * Adds and updates listbox with providers.
+     *
+     * @since S60 v3.2
+     */
+    void AddProvidersToListboxL();
+
+    /**
+     * Returns handle to the listbox.
+     *
+     * @since S60 v3.2
+     * @return handle to the listbox
+     */        
+    CAknSingleLargeStyleListBox* ListBox();
+
+    /**
+     * Returns index of selected listbox item.
+     *
+     * @since S60 v3.2
+     * @return index of selected listbox item
+     */
+    TInt CurrentItemIndex() const;
+
+    /**
+     * Loads provider icons.
+     *
+     * @since S60 v3.2
+     * @param aCount amount of providers
+     */
+    void LoadProviderIconsL( TInt aCount );
+    
+    /**
+     * Resets listbox.
+     * 
+     * @since S60 v3.2
+     */
+    void ResetListBox();
+
+// from base class CCoeControl
+
+    /**
+     * From CCoeControl.
+     */ 
+    CCoeControl* ComponentControl( TInt aIndex ) const;
+
+    /**
+     * From CCoeControl.
+     */
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+        TEventCode aType );
+
+private:
+
+    CAcpProviderListContainer( CAcpController& aController );
+    void ConstructL( const TRect& aRect );
+
+    /**
+     * Creates listbox item for provider list items.
+     *
+     * @since S60 v3.2
+     */
+    void ConstructListBoxL();
+
+    /**
+     * Loads default icons.
+     *
+     * @since S60 v3.2
+     * @param aIconArray for icons
+     */
+    void LoadDefaultIconsL( CArrayPtr<CGulIcon>* aIconArray );
+
+// from base class CCoeControl
+
+    /**
+    * From CCoeControl.
+    * Returns number of component controls.
+    * 
+    * @since S60 v3.2
+    * @return Number of component controls.
+    */
+    virtual TInt CountComponentControls() const;
+
+    /**
+    * From CCoeControl.
+    * Informs that size has been changed.
+    * 
+    * @since S60 v3.2
+    */
+    virtual void SizeChanged();
+
+    /**
+    * From CoeControl.
+    * Notifies that focus has been changed.
+    * 
+    * @since S60 v3.2
+    * @param aDrawNow Tells if the window must be redrawn.
+    */        
+    virtual void FocusChanged( TDrawNow aDrawNow );        
+
+
+    /**
+     * From CoeControl.
+     * Handles resource change.
+     * Called by framework when the view layout is changed.
+     * 
+     * @since S60 v3.2
+     * @param aType Type of resource.
+     */
+    virtual void HandleResourceChange( TInt aType );
+
+private:  // data
+
+    /**
+     * Reference to plugins controller.
+     */
+    CAcpController& iController;
+
+    /**
+     * Listbox for main view setting page items.
+     * Own.
+     */
+    CAknSingleLargeStyleListBox* iListBox;
+    };
+
+#endif // ACPPROVIDERLISTCONTAINER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/acpproviderlistview.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,368 @@
+/*
+* Copyright (c) 2007-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:  Declatirion of CAcpProviderListView
+*
+*/
+
+
+#ifndef ACPPROVIDERLISTVIEW_H
+#define ACPPROVIDERLISTVIEW_H
+
+#include <eikclb.h>
+#include <aknview.h>
+#include <mspnotifychangeobserver.h>
+#include <wlanmgmtcommon.h>
+#include <xSPViewServices.h>
+
+#include "macpdialogobserver.h"
+#include "macpcontrollerobserver.h"
+#include "macptimerobserver.h"
+#include "accountcreationpluginconstants.h"
+#include "accountcreationplugin.hrh" // enums
+
+class CAcpTimer;
+class CAcpDialog;
+class CAcpProviderSpecificView;
+class CAcpProviderListContainer;
+class MAccountCreationPluginObserver;
+class CAcpQueryView;
+class CAcpController;
+class CFbsBitmap;
+class CSPNotifyChange;
+class CEikonEnv;
+class CSPSettings;
+
+/**
+ *  CAcpProviderListView class
+ *  Declarition of CAcpProviderListView.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CAcpProviderListView ) : public CAknView,
+                                            public MEikListBoxObserver,
+                                            public MAcpDialogObserver,
+                                            public MAcpControllerObserver,
+                                            public MAcpTimerObserver
+    {
+    public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver Observer for notifying readiness.
+     */
+    static CAcpProviderListView* NewL(
+        MAccountCreationPluginObserver& aObserver, TBool aLaunchedFromAI, CEikonEnv& aEikEnv );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aObserver Observer for notifying readiness.
+     */
+    static CAcpProviderListView* NewLC(
+        MAccountCreationPluginObserver& aObserver, TBool aLaunchedFromAI, CEikonEnv& aEikEnv );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAcpProviderListView();
+
+    /**
+     * Provisioning query.
+     * 
+     * @since S60 v3.2
+     */
+    void ProvisioningL();
+
+    /**
+     * Starts provider list download.
+     * 
+     * @since S60 v3.2
+     */
+    void DownloadProviderListL();
+    
+// from base class CAknView
+
+    /**
+     * From CAknView.
+     * Returns view UID.
+     * 
+     * @since S60 v3.2
+     * @return view UID.
+     */
+    TUid Id() const;
+
+// from base class MAcpDialogObserver
+
+    /**
+     * From MAcpDialogObserver.
+     * Informs that a dialog has been dismissed.
+     * 
+     * @since S60 v3.2
+     * @param aError Error code.
+     */ 
+    void DialogDismissedL( TInt aError );
+
+// from base class MAcpControllerObserver
+
+    /**
+     * From MAcpControllerObserver.
+     * Informs that provider list is ready.
+     * 
+     * @since S60 v3.2
+     * @param aError Error code.
+     */ 
+    void NotifyProviderListReady( TInt aError );
+ 
+    /**
+     * From MAcpControllerObserver.
+     * Informs that downloading has been completed.
+     * 
+     * @since S60 v3.2
+     * @param aError System wide error code.
+     */ 
+    void NotifyDownloadingCompleted( TInt aError );
+    
+    /**
+      * From MAcpControllerObserver.
+      * Informs that downloading sis file has been completed.
+      * 
+      * @since S60 v5.0
+      * @param aFileName sis file name
+      */ 
+    void NotifyDownloadingSISCompleted( TDesC& aFileName );
+
+    /**
+     * From MAcpControllerObserver.
+     * Informs that service settings have been saved.
+     * 
+     * @since S60 v3.2
+     */ 
+    void NotifyProvisioningCompleted();
+    
+    /**
+     * From MAcpControllerObserver.
+     * Notifies observer when settings have been completely saved.
+     * 
+     * @since S60 v3.2
+     */ 
+    void NotifySettingsSaved();
+    
+    /**
+     * From MAcpTimerObserver
+     * Notifies observer when timer expires.
+     * 
+     * @since S60 v5.0
+     */ 
+    void TimerExpired();
+
+
+private:
+
+    CAcpProviderListView( MAccountCreationPluginObserver& aObserver,
+                          TBool aLaunchedFromAI, CEikonEnv& aEikEnv );
+    
+    void ConstructL();
+
+    /**
+     * For changing text to the title pane.
+     * 
+     * @since S60 v3.2
+     */
+    void SetTitlePaneTextL() const;
+    
+    /**
+     * For saving account creation url to rcse
+     * 
+     * @since S60 v5.0
+     * @param aServiceId service id
+     */
+    void SaveAccountCreationUrlL( TUint aServiceId );
+
+// from base class CAknView
+
+    /**
+     * From CAknView.
+     * Activates the view.
+     * 
+     * @since S60 v3.2
+     * @param aPrevViewId ID of the previous view. Not used.
+     * @param aCustomMessageId ID of custom message. Not used.
+     * @param aCustomMessage Custom message. Not used.
+     */
+    void DoActivateL( const TVwsViewId& /*aPrevViewId*/, 
+        TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/ );
+
+    /**
+     * From CAknView.
+     * Deactivates the view.
+     * 
+     * @since S60 v3.2
+     */
+    void DoDeactivate();
+
+    /**
+     * From CAknView.
+     * Handles commands.
+     * 
+     * @since S60 v3.2
+     * @param aCommand Command ID.
+     */
+    void HandleCommandL( TInt aCommand );
+
+// from base class MEikListBoxObserver
+
+    /**
+     * From MEikListBoxObserver.
+     * Handles listbox events.
+     * 
+     * @since S60 v3.2
+     * @param aListBox Listbox. Not used.
+     * @param aEventType Event type.
+     */
+    void HandleListBoxEventL( CEikListBox* /*aListBox*/, 
+        TListBoxEvent aEventType );
+
+    /**
+     * From MEikListBoxObserver.
+     * Handles listbox selections.
+     * 
+     * @since S60 v3.2
+     */
+    void HandleListBoxSelectionL();
+
+    /**
+     * From MEikListBoxObserver.
+     * Dynamically initiates menu pane.
+     * 
+     * @since S60 v3.2
+     * @param aResourceId ID of resource.
+     * @param aMenuPane Menu pane to be initiated.
+     */
+    void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
+
+    /**
+     * Informs that service settings have been saved.
+     * 
+     * @since S60 v3.2
+     */
+    void DoNotifyProvisioningCompletedL();
+
+private: // data
+
+    /**
+     * Handle to plugins controller.
+     * Own
+     */
+    CAcpController* iController;
+
+    /**
+     * Reference to observer.
+     */
+    MAccountCreationPluginObserver& iObserver;
+
+    /**
+     * Handle to Avkon view application UI.
+     * Not own.
+     */
+    CAknViewAppUi* iUi;
+
+    /**
+     * Container class for provider list view.
+     * Own.
+     */
+    CAcpProviderListContainer* iContainer;
+
+    /**
+     * Handle to provider specific view.
+     * Not own.
+     */
+    CAcpProviderSpecificView* iProviderSpecificView;
+
+    /**
+     * Handle to query view.
+     * Not own.
+     */
+    CAcpQueryView* iQueryView;
+
+    /**
+     * Handle dialog utility to show global wait note.
+     * Own.
+     */
+    CAcpDialog* iDialog; 
+    
+    
+    /**
+     * Handle to acp timer.
+     * Own.
+     */
+    CAcpTimer* iTimer;
+    
+    /**
+     * Handle to serviec provider settings
+     * Own.
+     */
+    CSPSettings* iSpSettings;
+
+    /**
+     * For restoring browser's setting later on.
+     */
+     TInt iWarning;
+
+    /**
+     * For restoring browser's setting later on.
+     */
+     TInt iDataSaving;
+     
+    /** 
+     * Array of service ids.
+     */
+     RArray<TServiceId> iServiceIds;
+          
+    /**
+     * Name of the service being installed.
+     */
+     HBufC* iServiceName;
+     
+     /**
+      * Boolean indicating if CSC has been started from active idle
+      */ 
+     TBool iLaunchedFromAI;
+     
+     /**
+      * Reference to CEikonEnv.
+      */
+     CEikonEnv& iEikEnv;
+
+    /** 
+     * ETrue if connection to NSA server is being established.
+     */
+     TBool iConnectingToServer;
+     
+     /*
+      * Xsp view service
+      * Own.
+      */
+     RxSPViewServices iXspViewServices;
+     
+     /*
+      * Array of phonebook tab view ids
+      */
+     RArray<TInt32> iTabViewIds;
+    };
+
+#endif  // ACPPROVIDERLISTVIEW_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/acpproviderspecificcontainer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declarition of CAcpProviderSpecificContainer
+*
+*/
+
+
+#ifndef ACPPROVIDERSPECIFICCONTAINER_H
+#define ACPPROVIDERSPECIFICCONTAINER_H
+
+#include <coecntrl.h>
+#include <coecntrl.h>
+#include <barsread.h>
+#include <eiklabel.h>
+#include <eikedwin.h>
+
+#include "accountcreationpluginconstants.h"
+
+class CAcpController;
+class CAknsBasicBackgroundControlContext;
+
+/**
+ *  CAcpProviderSpecificContainer class
+ *  Declarition of CAcpProviderSpecificContainer.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CAcpProviderSpecificContainer ) : public CCoeControl
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aController for plugins controller
+     * @param aRect for rectangle
+     */
+    static CAcpProviderSpecificContainer* NewL( 
+        CAcpController& aController, const TRect& aRect );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aController for plugins controller
+     * @param aRect for rectangle
+     */
+    static CAcpProviderSpecificContainer* NewLC( 
+        CAcpController& aController, const TRect& aRect );
+
+    virtual ~CAcpProviderSpecificContainer();
+    
+private:
+
+    CAcpProviderSpecificContainer( CAcpController& aController );
+    void ConstructL( const TRect& aRect );
+    
+public: // New methods.
+    
+    /**
+     * Scrolls text up or down by the given amount of pixels.
+     * 
+     * @since S60 v3.2
+     * @param aDelta Amount of pixels to move the text. Positive is down.
+     */
+    void ScrollText( TInt aDelta );
+    
+    /**
+     * Repositions the labels.
+     * 
+     * @since S60 v3.2
+     */
+    void RepositionLabels();
+
+// from base class CCoeControl
+    
+    /**
+     * From CCoeControl.
+     */ 
+    CCoeControl* ComponentControl( TInt aIndex ) const;
+
+    /**
+     * From CCoeControl.
+     * Supplies context (object ID) to child controls.
+     *
+     * @since S60 v3.2
+     * @param aId UID.
+     * @return UID.
+     */
+    TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
+    /**
+     * From CCoeControl.
+     * Returns number of component controls.
+     * 
+     * @since S60 v3.2
+     * @return Number of component controls.
+     */
+    virtual TInt CountComponentControls() const;
+
+    /**
+     * From CCoeControl.
+     * Informs that draw must be committed.
+     * 
+     * @since S60 v3.2
+     * @param aRect Rectangle.
+     */
+    void Draw( const TRect& aRect ) const;
+
+    /**
+     * From CCoeControl.
+     * Informs that size has been changed.
+     * 
+     * @since S60 v3.2
+     */
+    virtual void SizeChanged();
+
+	/**
+     * From CoeControl.
+     * Handles resource change.
+     * Called by framework when the view layout is changed.
+     * 
+     * @since S60 v3.2
+     * @param aType Type of resource.
+     */
+    virtual void HandleResourceChange( TInt aType );
+    
+    /**
+     * From CoeControl.
+     * Handles keypresses.
+     * 
+     * @since S60 v3.2
+     * @param aKeyEvent Key event.
+     * @param aType Type of event.
+     */
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+private:  // data
+
+    /**
+     * Reference to plugins controller.
+     */
+    CAcpController& iController;
+
+    /**
+     * Localized "none" text from resources.
+     * Own.
+     */
+    HBufC* iNone;
+
+    /**
+     * Setting item: description.
+     * Own.
+     */ 
+    HBufC* iDescription;
+
+    /**
+     * Label for name.
+     * Own.
+     */
+    CEikLabel* iLabel;
+
+    /**
+     * Label for type.
+     * Own.
+     */
+    CEikLabel* iLabel2;
+
+    /**
+     * Label for description.
+     * Own.
+     */
+    CEikLabel* iLabel3;
+
+    /**
+     * Edwin for provider specific name text.
+     * Own.
+     */
+    CEikEdwin* iEdwin;
+
+    /**
+     * Edwin for provider specific type text.
+     * Own.
+     */
+    CEikEdwin* iEdwin2;
+
+    /**
+     * Edwin for provider specific description text.
+     * Own.
+     */
+    CEikEdwin* iEdwin3;
+
+    /**
+     * SKIN: the skin bitmap context for our control.
+     * Own.
+     */
+    CAknsBasicBackgroundControlContext* iBgContext;
+    
+    /**
+     * Y position for label scrolling.
+     */
+    TInt iScrollY;
+    };
+
+#endif // ACPPROVIDERSPECIFICCONTAINER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/acpproviderspecificview.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,161 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declatirion of CAcpProviderSpecificView
+*
+*/
+
+
+#ifndef ACPPROVIDERSPECIFICVIEW_H
+#define ACPPROVIDERSPECIFICVIEW_H
+
+#include <eikclb.h>
+#include <aknview.h>
+
+#include "acpproviderlistview.h"
+
+class CAcpController;
+class CAcpProviderSpecificContainer;
+class CAcpQueryView;
+class CAcpProviderListView;
+
+/**
+ *  CAcpProviderSpecificView class
+ *  Declarition of CAcpProviderSpecificView.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CAcpProviderSpecificView ) : public CAknView
+    {   
+public: 
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aController for plugins controller
+     */
+    static CAcpProviderSpecificView* NewL( CAcpController& aController,
+        CAcpProviderListView& aProviderListView );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aController for plugins controller
+     */
+    static CAcpProviderSpecificView* NewLC( CAcpController& aController,
+        CAcpProviderListView& aProviderListView );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAcpProviderSpecificView();
+
+// from base class CAknView
+
+    /**
+     * From CAknView.
+     * Returns ID of the view.
+     * 
+     * @since S60 v3.2
+     * @return ID of the view.
+     */
+    TUid Id() const;
+
+private:
+
+    CAcpProviderSpecificView( CAcpController& aController,
+        CAcpProviderListView& aProviderListView );
+    void ConstructL();
+
+    /**
+     * For changing text to the title pane.
+     *
+     * @since S60 v3.2
+     * @param aText for title pane text
+     */
+    void SetTitlePaneTextL( const TDesC& aText ) const;
+
+// from base class CEikAppUi
+
+    /**
+     * From CEikAppUi.
+     * Handles command.
+     * 
+     * @since S60 v3.2
+     * @param aCommand Command index.
+     */
+    void HandleCommandL( TInt aCommand );
+
+   // from base class CAknView
+
+    /**
+     * From CAknView.
+     * Activates the view.
+     * 
+     * @since S60 v3.2
+     * @param aPrevViewId ID of the previous view. Not used.
+     * @param aCustomMessageId ID of custom message. Not used.
+     * @param aCustomMessage Custom message. Not used.
+     */
+    void DoActivateL( const TVwsViewId& /*aPrevViewId*/, 
+        TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/ );
+
+    /**
+     * From CAknView.
+     * Deactivates the view.
+     * 
+     * @since S60 v3.2
+     */
+    void DoDeactivate();
+
+private: // data  
+
+    /**
+     * Handle to Avkon view application UI.
+     * Not own.
+     */
+    CAknViewAppUi* iUi;
+
+    /**
+     * Handle to plugins controller.
+     */
+    CAcpController& iController;
+
+    /**
+     * Handle to query view.
+     * Not own.
+     */
+    CAcpQueryView* iQueryView;
+
+    /**
+     * Handle to provider list view.
+     */
+    CAcpProviderListView& iProviderListView;
+
+    /**
+     * Container class for provider specific view.
+     * Own.
+     */
+    CAcpProviderSpecificContainer* iContainer;
+
+    /**
+     * Handle dialog utility to show global wait note.
+     * Own.
+     */
+    CAcpDialog* iDialog;
+    };
+
+#endif  // ACPPROVIDERSPECIFICVIEW_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/acpquerycontainer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declarition of CAcpQueryContainer
+*
+*/
+
+
+#ifndef ACPQUERYCONTAINER_H
+#define ACPQUERYCONTAINER_H
+
+#include <coecntrl.h>
+
+#include "accountcreationpluginconstants.h"
+
+class CAcpController;
+class CAknSettingStyleListBox;
+
+/**
+ *  CAcpQueryContainer class
+ *  Declarition of CAcpQueryContainer.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CAcpQueryContainer ) : public CCoeControl
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aRect Rectangle.
+     */
+    static CAcpQueryContainer* NewL( const TRect& aRect );
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aRect Rectangle.
+     */
+    static CAcpQueryContainer* NewLC( const TRect& aRect );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAcpQueryContainer();
+
+    /**
+     * Returns handle to the listbox.
+     *
+     * @since S60 v3.2
+     * @return Handle to the listbox.
+     */        
+    CAknSettingStyleListBox* ListBox();
+
+    /**
+     * Returns index of selected listbox item.
+     *
+     * @since S60 v3.2
+     * @return Index of selected listbox item.
+     */
+    TInt CurrentItemIndex() const;
+
+    /**
+     * Shows username setting page.
+     *
+     * @since S60 v3.2
+     */
+    void ShowUsernameSettingPageL();  
+
+    /**
+     * Shows password setting page.
+     *
+     * @since S60 v3.2
+     */
+    void ShowPwordSettingPageL();
+
+    /**
+     * Returns container data.
+     *
+     * @since S60 v3.2
+     * @param aUsername for username
+     * @param aPassword for password
+     */        
+    void GetContainerDataL( TDes& aUsername, TDes& aPassword );
+
+// from base class CCoeControl
+
+    /**
+     * From CCoeControl.
+     * Offers a key event.
+     * 
+     * @since S60 v3.2
+     * @param aKeyEvent Key event to be offered.
+     * @param aType Type of the key event.
+     * @return Key response.
+     */
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, 
+        TEventCode aType );
+
+    /**
+     * From CCoeControl.
+     * Returns component control.
+     * 
+     * @since S60 v3.2
+     * @param aIndex Index of the component control to be returned.
+     * @return Component control.
+     */ 
+    CCoeControl* ComponentControl( TInt aIndex ) const;
+
+private:
+
+    CAcpQueryContainer();
+    void ConstructL( const TRect& aRect );
+
+    /**
+     * Creates listbox item for provider list items.
+     *
+     * @since S60 v3.2
+     */
+    void ConstructListBoxL();
+
+    /**
+     * Fills listbox with items.
+     *
+     * @since S60 v3.2
+     */
+    void FillListboxWithItemsL();
+
+    /**
+     * Updates listbox list item.
+     *
+     * @since S60 v3.2
+     * @param aIndex for index item to be updated
+     */
+    void UpdateListboxItemL( const TInt aIndex );
+
+    /**
+     * Fills selected listbox item with member data.
+     *
+     * @since S60 v3.2
+     * @param aIndex Index of listbox item to be updated.
+     * @param aFirstLine Item caption text.
+     * @param aSecondLine Item member data text.
+     */
+    void FillListboxItemDataL( const TInt aIndex,
+        TDes& aFirstLine, TDes& aSecondLine );
+
+// from base class CCoeControl
+
+    /**
+     * From CCoeControl.
+     * Returns number of component controls.
+     * 
+     * @since S60 v3.2
+     * @return Number of component controls.
+     */
+    virtual TInt CountComponentControls() const;
+
+    /**
+     * From CCoeControl.
+     * Informs that size has been changed.
+     * 
+     * @since S60 v3.2
+     */
+    virtual void SizeChanged();
+
+    /**
+     * From CoeControl.
+     * Informs that focus has been changed.
+     * 
+     * @param aDrawNow Tells if the window must be redrawn.
+     * @since S60 v3.2
+     */        
+    virtual void FocusChanged( TDrawNow aDrawNow );        
+
+	/**
+     * From CoeControl.
+     * Called by framework when the view layout is changed.
+     * 
+     * @since S60 v3.2
+     * @param aType Type of resource change.
+     */
+    virtual void HandleResourceChange( TInt aType );
+
+private: // data
+
+    /**
+     * Listbox for main view setting page items.
+     * Own.
+     */
+    CAknSettingStyleListBox* iListBox;
+
+    /**
+     * Localized "none" text from resources.
+     * Own.
+     */
+    HBufC* iNone;
+
+    /**
+     * Setting item: Server username.
+     */ 
+    TBuf<KAcpSipUsername> iUsername;
+
+    /**
+     * Setting item: Server password.
+     */ 
+    TBuf<KAcpSipPassword> iPassword;
+
+    };
+
+#endif // ACPQUERYCONTAINER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/acpqueryview.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,220 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declatirion of CAcpQueryView
+*
+*/
+
+
+#ifndef ACPQUERYVIEW_H
+#define ACPQUERYVIEW_H
+
+#include <eikclb.h>
+#include <aknview.h>
+
+#include "macpdialogobserver.h"
+
+class CAcpController;
+class CAcpQueryContainer;
+class CAcpDialog;
+class CEikonEnv;
+
+/**
+ *  CAcpQueryView class
+ *  Declarition of CAcpQueryView class.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CAcpQueryView ) : public CAknView,
+                                     public MEikListBoxObserver,
+                                     public MAcpDialogObserver
+    {
+public:
+
+    /**
+     * Items to be shown in this view/container.
+     */
+    enum TAcpGenericItems
+        {
+        EAcpGenericUsername = 0,
+        EAcpGenericPassword
+        };
+
+    /**
+     * Two-phased constructor.
+     * @param aController ACP Controller
+     */
+    static CAcpQueryView* NewL( CAcpController& aController );
+
+    /**
+     * Two-phased constructor.
+     * @param aController ACP Controller
+     */
+    static CAcpQueryView* NewLC( CAcpController& aController );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAcpQueryView();
+
+// from base class CAknView
+
+    /**
+     * From CAknView.
+     * Returns UID of the view class.
+     * 
+     * @since S60 v3.2
+     * @return UID of the class.
+     */
+    TUid Id() const;
+
+private:
+
+    CAcpQueryView( CAcpController& aController );
+    void ConstructL();
+
+    /**
+     * For changing text to the title pane.
+     *
+     * @since S60 v3.2
+     * @param aText Text for title pane.
+     */
+    void SetTitlePaneTextL( const TDesC& aText ) const;
+
+// from base class CEikAppUi
+
+    /**
+     * From CEikAppUi.
+     * Handles command.
+     * 
+     * @since S60 v3.2
+     * @param aCommand Command ID.
+     */
+    void HandleCommandL( TInt aCommand );
+
+// from base class MEikListBoxObserver
+
+    /**
+     * From MEikListBoxObserver.
+     * Handles list box event.
+     * 
+     * @since S60 v3.2
+     * @param aListBox List box whose event is to be handled. Not used.
+     * @param aEventType Type of the event.
+     */
+    void HandleListBoxEventL( 
+        CEikListBox* /*aListBox*/, 
+        TListBoxEvent aEventType );
+
+    /**
+     * From MEikListBoxObserver.
+     * Handles list box selection.
+     * 
+     * @since S60 v3.2
+     */
+    void HandleListBoxSelectionL();
+
+    /**
+     * From MEikListBoxObserver.
+     * Dynamically initiates menu pane.
+     * Not used but here because of inheritance.
+     * 
+     * @since S60 v3.2
+     * @param aResourceId ID of the resource. Not used.
+     * @param aMenuPane Menu pane. Not used.
+     */
+    void DynInitMenuPaneL( TInt /*aResourceId*/, 
+        CEikMenuPane* /*aMenuPane*/ );
+
+// from base class MAcpDialogObserver
+    
+    /**
+     * From MAcpDialogObserver.
+     * Notifies that a dialog has been dismissed.
+     * 
+     * @since S60 v3.2
+     * @param aError Error code. Not used.
+     */ 
+    void DialogDismissed( TInt /*aError*/ );
+
+// from base class CAknView
+
+    /**
+     * From CAknView.
+     * Activates this view.
+     * 
+     * @since S60 v3.2
+     * @param aPrevViewId ID of previous view. Not used.
+     * @param aCustomMessageId ID of a custom message. Not used.
+     * @param aCustomMessage Custom message. Not used. 
+     */
+    void DoActivateL( 
+        const TVwsViewId& /*aPrevViewId*/, 
+        TUid /*aCustomMessageId*/, 
+        const TDesC8& /*aCustomMessage*/ );
+
+    /**
+     * From CAknView.
+     * Deactivates the view.
+     * 
+     * @since S60 v3.2
+     */
+    void DoDeactivate();
+
+private: // data
+
+    /**
+     * Handle to Avkon view application Ui.
+     * Not own.
+     */
+    CAknViewAppUi* iUi;
+
+    /**
+     * Container class for provider specific view.
+     * Own.
+     */
+    CAcpQueryContainer* iContainer;
+
+    /**
+     * Handle to plugins controller.
+     */
+    CAcpController& iController;
+
+    /**
+     * Handle dialog utility to show global wait note.
+     * Own.
+     */
+    CAcpDialog* iDialog;
+
+    /**
+     * For restoring browser's setting later on
+     */
+    TInt iWarning;
+
+    /**
+     * For restoring browser's setting later on
+     */
+    TInt iDataSaving;
+
+   /**
+    * An instance of CEikonEnv
+    * Not own.
+    */
+    CEikonEnv* iEikEnv;
+    };
+
+#endif  // ACPQUERYVIEW_H
+
+// End of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/acptimer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,108 @@
+/*
+* 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 for timer handling
+*
+*/
+
+
+#ifndef C_ACPTIMER_H
+#define C_ACPTIMER_H
+
+#include <e32base.h> 
+
+class MAcpTimerObserver;
+
+/**
+ * An instance of CAcpTimer
+ * For timer handling.
+ *
+ * @lib accountcreationplugin.lib
+ * @since Series 60 5.0
+ */
+NONSHARABLE_CLASS( CAcpTimer ) : public CTimer
+    {    
+    public:
+
+        /**
+         * Enumeration which indicates timer type
+         */
+        enum TTimerType
+            {
+            EPhonebookStartupDelayTimer = 0
+            };
+    
+        /**
+         * Two-phased constructor.
+         */ 
+        static CAcpTimer* NewL( 
+            MAcpTimerObserver& aObserver );
+
+
+        /**
+         * Destructor.
+         */
+        virtual ~CAcpTimer();
+
+        
+        /**
+         * Start timer.
+         *
+         * @since S60 v5.0
+         * @return KErrNone when timer started successfully
+         */
+        TInt StartTimer( TTimerType aType );
+        
+        
+        /**
+         * Stop timer.
+         *
+         * @since S60 v5.0
+         */
+        void StopTimer();
+        
+        /**
+         * Is timer active
+         *
+         * @since S60 v5.0
+         * @return ETrue if timer is active.
+         */
+        TBool IsActive();
+        
+
+    protected: 
+    
+        // from base class CTimer
+        
+        /**
+         * From CTimer. Called when timer expires.
+         */
+        void RunL();
+        
+               
+    private:
+
+        CAcpTimer( MAcpTimerObserver& aObserver );
+
+        void ConstructL();
+        
+        
+    private:  // data
+        
+        /**
+         * Reference for observer.
+         */
+        MAcpTimerObserver& iObserver;
+    };
+
+#endif // C_ACPTIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/maccountcreationpluginobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2007-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:  Header file for MAccountCreationPluginObserver
+ *
+*/
+
+
+#ifndef MACCOUNTCREATIONPLUGINOBSERVER_H
+#define MACCOUNTCREATIONPLUGINOBSERVER_H
+
+class MAccountCreationPluginObserver
+    {
+public:
+    /**
+     * Notifies observer about AIW events.
+     *
+     * @since S60 v3.2
+     * @param aError for system wide error code
+     */ 
+    virtual void NotifyAiwEventL( TInt aError ) = 0;
+    
+    
+    /**
+     * Notifies observer about downloaded sis file.
+     *
+     * @since S60 v5.0
+     * @param aFileName sis file name
+     */ 
+    virtual void NotifySISDownloaded( TDesC& aFileName ) = 0;
+
+    };
+
+#endif // MACCOUNTCREATIONPLUGINOBSERVER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/macpdialogobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MAcpDialogObserver
+*
+*/
+
+
+#ifndef MACPDIALOGOBSERVER_H
+#define MACPDIALOGOBSERVER_H
+
+/**
+ *  MAcpDialogObserver class
+ *  Declarition of MAcpDialogObserver.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v3.2
+ */
+class MAcpDialogObserver
+    {
+    public:
+        
+        /**
+         * Called when dialog is dismissed from screen.
+         *
+         * @since S60 v3.2
+         * @param aError for error id
+         */
+        virtual void DialogDismissedL( TInt aError ) = 0;
+         
+    };
+    
+#endif // MACPDIALOGOBSERVER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/inc/macptimerobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Header file for MAcpTimerObserver
+*
+*/
+
+
+#ifndef M_ACPTIMEROBSERVER_H
+#define M_ACPTIMEROBSERVER_H
+
+#include "acptimer.h"
+
+/**
+ *  MAcpTimerObserver class
+ *
+ *  Observer interface for notifying timer expiration.
+ *
+ *  @lib accountcreationplugin.lib
+ *  @since S60 v5.0
+ */
+class MAcpTimerObserver
+    {
+    public:
+    
+        /**
+         * Should be called when the timer expires
+         *
+         * @since S60 v5.0
+         */
+        virtual void TimerExpired() = 0;            
+    };
+    
+#endif // M_ACPTIMEROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/loc/accountcreationplugin.loc	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 file for Account Creation Plugin.
+*
+*/
+
+
+// d: Wait note text shown when service catalog is being downloaded.
+// l: popup_note_wait_window
+// r: 3.2
+#define qtn_servtab_updating_service_catalog "Downloading service catalog"
+
+// d: Account Creation Plugin name shown in Internet communication settings.
+// l: list_single_large_graphic_pane_t1
+// r: 3.2
+#define qtn_servtab_plugin_name "Install net communication services"
+
+// d: Error note text shown when connection to the server fails.
+// l: popup_note_window
+// r: 3.2
+#define qtn_servtab_creating_connection_failed_note "Establishing connection failed"
+
+// d: Error note text shown when downloading a service fails.
+// l: popup_note_window
+// r: 3.2
+#define qtn_servtab_downloading_service_failed_note "Downloading %U failed. Please try again"
+
+// d: Softkey text for details.
+// l: control_pane_t3/opt7
+// r: 3.2
+#define qtn_msk_service_details "Details"
+
+// d: Menu item to view details.
+// l: list_single_pane_t1_cp2
+// r: 3.2
+#define qtn_voip_option_service_details "View details"
+
+// d: Provider list view title.
+// l: title_pane_t2/opt9
+// r: 3.2
+#define qtn_servtab_catalog_view_title "Service catalog"
+
+// d: Text displayed when the provider list is empty.
+// l: main_list_empty_pane
+// r: 3.2
+#define qtn_service_catalog_empty_text "No services available"
+
+// d: Menu item for get.
+// l: list_single_pane_t1_cp2
+// r: 3.2
+#define qtn_voip_option_service_download_service "Get"
+
+// d: Menu item for refresh.
+// l: list_single_pane_t1_cp2
+// r: 3.2
+#define qtn_servtab_catalog_options_refresh "Refresh"
+
+// d: Service installation completion note text.
+// l: popup_note_window
+// r: 3.2
+#define qtn_servtab_installation_completed_note "%U installed in Phonebook"
+
+// d: Text for name detail.
+// l: msg_body_pane_t2/opt1
+// r: 3.2
+#define qtn_servtab_cd_detail_name "Name:"
+
+// d: Text for type detail.
+// l: msg_body_pane_t2/opt1
+// r: 3.2
+#define qtn_servtab_cd_detail_type "Type:"
+
+// d: Text for application type.
+// l: msg_body_pane_t3/opt2
+// r: 3.2
+#define qtn_servtab_cd_type_application "Application"
+
+// d: Text for settings file type.
+// l: msg_body_pane_t3/opt2
+// r: 3.2
+#define qtn_servtab_cd_type_settings "Settings file"
+
+// d: Text for file type.
+// l: msg_body_pane_t3/opt2
+// r: 3.2
+#define qtn_servtab_cd_type_file "File"
+
+// d: Text for description detail.
+// l: msg_body_pane_t2/opt1
+// r: 3.2
+#define qtn_servtab_cd_detail_description "Description:"
+
+// d: Text for size detail.
+// l: msg_body_pane_t2/opt1
+// r: 3.2
+#define qtn_servtab_cd_detail_size "Size:"
+
+// d: Text for vendor detail.
+// l: msg_body_pane_t2/opt1
+// r: 3.2
+#define qtn_servtab_cd_detail_vendor "Vendor:"
+
+// d: Text shown for undefined detail values.
+// l: msg_body_pane_t3/opt2
+// r: 3.2
+#define qtn_servtab_cd_value_undefined "Undefined"
+
+// d: Softkey text for get.
+// l: control_pane_t3/opt7
+// r: 3.2
+#define qtn_servtab_cd_softkey_get "Get"
+
+// d: Text for the wait note while downloading a service.
+// l: popup_note_wait_window
+// r: 3.2
+#define qtn_servtab_downloading_settings_wait_note "Downloading %U"
+
+//d: Message query about succesfull service installation when installation
+//d: was initiated from homescreen service widget.
+//l: popup_info_list_pane_t1
+//r: 5.0
+//
+#define qtn_servtab_installation_completed_msg_query "%U installed in Phonebook. To install more Net communication services, use installation widget located in the Home Screen menu."
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/rom/accountcreationplugin.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Account Creation Plugin
+*
+*/
+
+
+#ifndef ACCOUNTCREATIONPLUGIN_IBY
+#define ACCOUNTCREATIONPLUGIN_IBY
+
+file=ABI_DIR/BUILD_DIR/accountcreationengine.dll SHARED_LIB_DIR/accountcreationengine.dll
+ECOM_PLUGIN( accountcreationplugin.dll, 1020E56D.rsc )
+data=DATAZ_/APP_BITMAP_DIR/acpicons.mif APP_BITMAP_DIR/acpicons.mif
+
+#endif ACCOUNTCREATIONPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/rom/accountcreationpluginresources.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 iby file for Account Creation Plugin
+*
+*/
+
+#ifndef ACCOUNTCREATIONPLUGINRESOURCES_IBY
+#define ACCOUNTCREATIONPLUGINRESOURCES_IBY
+
+#include <bldvariant.hrh>
+
+data=DATAZ_/RESOURCE_FILES_DIR/accountcreationplugin.rsc RESOURCE_FILES_DIR/accountcreationplugin.rsc
+
+#endif // ACCOUNTCREATIONPLUGINRESOURCES_IBY
Binary file voipplugins/accountcreationplugin/sis/Accountcreationplugin.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/sis/Accountcreationplugin.pkg	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,56 @@
+;
+; 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:
+;
+; AccountCreator.pkg
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"Account Creator"},(0x1020E56D),0,0,1
+
+;Supports Series 60 v 3.1
+[0x102032BE], 0, 0, 0, {"S60ProductID"}
+;Supports Series 60 v 3.2
+
+;Localized Vendor Name
+%{"Vendor-EN"}
+
+;Unique Vendor name
+:"Nokia"
+
+; Files to copy
+;
+;	Account Creator
+;
+"\epoc32\release\armv5\urel\accountcreationplugin.dll"-"c:\sys\bin\accountcreationplugin.dll"
+"\epoc32\release\armv5\urel\accountcreationengine.dll"-"c:\sys\bin\accountcreationengine.dll"
+"\epoc32\data\z\resource\plugins\accountcreationplugin.Rsc"-"c:\resource\plugins\accountcreationplugin.Rsc"
+"\epoc32\data\Z\Resource\accountcreationplugin.rsc"         -"c:\resource\accountcreationplugin.rsc"
+"\epoc32\data\Z\Resource\apps\acpicons.mif"    -"c:\resource\apps\acpicons.mif"
+;"\epoc32\release\armv5\udeb\emskillbrowser.exe"     -"c:\sys\bin\emskillbrowser.exe"
+;"..\data\xmlfile.xml"- "c:\data\xmlfile.xml"
+;
+; pnpms install for N80 and N95
+;
+;"\Epoc32\release\armv5\udeb\PnpProvisioning.exe"				-"c:\sys\bin\PnpProvisioning.exe"
+;"\Epoc32\data\z\Resource\apps\pnpprovisioning.rsc"			-"c:\Resource\apps\pnpprovisioning.rsc"
+;"\Epoc32\data\Z\Private\10003A3F\APPS\PnpProvisioning_REG.rsc"			-"c:\Private\10003A3F\import\APPS\PnpProvisioning_REG.rsc"
+;"\epoc32\release\armv5\udeb\PnpPaosFilter.dll" - "c:\sys\bin\PnpPaosFilter.dll"
+;"\epoc32\data\Z\Resource\Plugins\PnPPaosFilter.RSC" - "c:\Resource\plugins\PnPPaosFilter.RSC"
+;"\epoc32\release\armv5\udeb\RECnhwr.dll" 								-"c:\sys\bin\RECnhwr.dll"
+;"\epoc32\data\Z\Resource\Plugins\RECnhwr.RSC" 					-"c:\Resource\Plugins\RECnhwr.RSC"
+;"\Epoc32\release\armv5\udeb\PnP.dll"										-"c:\sys\bin\PnP.dll"
+;"\Epoc32\release\armv5\udeb\NHwrParser.dll"							-"c:\sys\bin\NHwrParser.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/src/accountcreationplugin.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,397 @@
+/*
+* Copyright (c) 2007-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 CAccountCreationPlugin
+ *
+*/
+
+#include <eikenv.h>
+#include <bautils.h>
+#include <pathinfo.h>
+#include <SWInstApi.h>
+#include <SWInstDefs.h>
+#include <aknViewAppUi.h>
+#include <AknQueryDialog.h> 
+#include <StringLoader.h>
+#include <accountcreationplugin.rsg>
+#include <data_caging_path_literals.hrh>
+
+#include "accountcreationplugin.h"
+#include "accountcreationpluginlogger.h"
+#include "acpproviderlistview.h"
+#include "accountcreationpluginconstants.h"
+#include "accountcreationplugin.hrh"
+
+const TUid KAIAppUid = { 0x102750F0 }; // active idle application uid        
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::CAccountCreationPlugin
+// ---------------------------------------------------------------------------
+//
+CAccountCreationPlugin::CAccountCreationPlugin()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAccountCreationPlugin::ConstructL()
+    {
+    ACPLOG( "CAccountCreationPlugin::ConstructL begin" );
+
+    // Load resource file to the memory.
+    // This when going to ROM (PhoneMemoryRootPath is used only for testing).
+    TFileName resourceFile = 
+        TParsePtrC( PathInfo::RomRootPath() ).Drive();
+
+    resourceFile.Append( KDC_RESOURCE_FILES_DIR );
+    resourceFile.Append( KResourceFilename );
+    BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), 
+        resourceFile );
+    iResourceOffset = CCoeEnv::Static()->AddResourceFileL( resourceFile );
+
+    // Create handle to AIW Service Handler.
+    iServiceHandler = CAiwServiceHandler::NewL();
+
+    iEikEnv = CEikonEnv::Static();
+    
+    iCBEventParamList = CAiwGenericParamList::NewL();
+    iCBEventParamList->Reset();
+
+    ACPLOG( "CAccountCreationPlugin::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::NewL
+// ---------------------------------------------------------------------------
+//
+CAccountCreationPlugin* CAccountCreationPlugin::NewL()
+    {
+    CAccountCreationPlugin* self = new ( ELeave ) CAccountCreationPlugin;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::~CAccountCreationPlugin
+// ---------------------------------------------------------------------------
+//
+CAccountCreationPlugin::~CAccountCreationPlugin()
+    {
+    ACPLOG( "CAccountCreationPlugin::~CAccountCreationPlugin begin" );
+
+    delete iServiceHandler;
+
+    if ( iResourceOffset )
+        {
+        CCoeEnv::Static()->DeleteResourceFile( iResourceOffset );
+        }
+ 
+	iEikEnv = NULL;
+	delete iCBEventParamList;
+
+    ACPLOG( "CAccountCreationPlugin::~CAccountCreationPlugin end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::SendInitializedCallbackL
+// Sends AIW service command when plugin initialization is completed. 
+// ---------------------------------------------------------------------------
+//
+void CAccountCreationPlugin::SendInitializedCallbackL() const
+    {
+    ACPLOG( "CAccountCreationPlugin::SendInitializedCallbackL begin" );
+
+    MAiwNotifyCallback* callback = 
+        const_cast<MAiwNotifyCallback*>( iNotifyCallback );
+
+    // Uid of ACP.
+    TAiwVariant variant( KAccountCreationPluginUid );
+    TAiwGenericParam genericParamUid( EGenericParamError, variant );
+    CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+    paramList.AppendL( genericParamUid );
+    variant.Reset();
+
+    // Localized name of ACP.
+    HBufC* localizedName = StringLoader::LoadLC( R_ACP_NAME_IN_CUSTOMER_APP );     
+    variant.Set( localizedName->Des() );
+    TAiwGenericParam genericParamName( EGenericParamError, variant );
+    paramList.AppendL( genericParamName );
+    CleanupStack::PopAndDestroy( localizedName );
+    variant.Reset();
+
+    // Place of ACP in customer application.
+    TInt32 placing( 0 );
+    variant.Set( placing );
+    TAiwGenericParam genericParamPlace( EGenericParamError, variant );
+    paramList.AppendL( genericParamPlace );
+	
+    // Send callback to the customer application.
+    callback->HandleNotifyL( 
+        KAiwCmdCSCUiExtensionPlugins,
+        KAiwEventStarted,
+        *iCBEventParamList,
+        paramList );
+
+    ACPLOG( "CAccountCreationPlugin::SendInitializedCallbackL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::SendCompletedCallbackL
+// Sends AIW service command when plugin is stopped its work.
+// ---------------------------------------------------------------------------
+//
+void CAccountCreationPlugin::SendCompletedCallbackL() const
+    {
+    ACPLOG( "CAccountCreationPlugin::SendCompletedCallbackL begin" );
+
+    MAiwNotifyCallback* callback = 
+        const_cast<MAiwNotifyCallback*>( iNotifyCallback );
+
+    // Uid of ACP.
+    TAiwVariant variant( KAccountCreationPluginUid );
+    TAiwGenericParam genericParamUid( EGenericParamError, variant );
+    CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+    paramList.AppendL( genericParamUid );
+
+    // Send callback to the customer application.
+    callback->HandleNotifyL( 
+        KAiwCmdCSCUiExtensionPlugins,
+        KAiwEventStopped,
+        *iCBEventParamList,
+        paramList );
+
+    ACPLOG( "CAccountCreationPlugin::SendCompletedCallbackL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::SendErrorCallbackL
+// Sends AIW service command when plugin error is reached.
+// ---------------------------------------------------------------------------
+//
+void CAccountCreationPlugin::SendErrorCallbackL() const
+    {
+    ACPLOG( "CAccountCreationPlugin::SendErrorCallbackL begin" );
+
+    MAiwNotifyCallback* callback = 
+        const_cast<MAiwNotifyCallback*>( iNotifyCallback );
+
+    // UID of ACP.
+    TAiwVariant variant( KAccountCreationPluginUid );
+    TAiwGenericParam genericParamUid( EGenericParamError, variant );
+    CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+    paramList.AppendL( genericParamUid );
+
+    // Send callback to the customer application.
+    callback->HandleNotifyL( 
+        KAiwCmdCSCUiExtensionPlugins,
+        KAiwEventError,
+        *iCBEventParamList,
+        paramList );
+
+    ACPLOG( "CAccountCreationPlugin::SendErrorCallbackL end" );
+    }    
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::CompareUids
+// Compares AIW service command connected uid to our plugin uid.
+// ---------------------------------------------------------------------------
+//
+TBool CAccountCreationPlugin::CompareUids( 
+    const CAiwGenericParamList& aOutParamList ) const
+    {
+    TInt index = 0;
+    TBool commandForUs( EFalse );
+    if ( 0 < aOutParamList.Count() )
+        {
+        // Take out the first parameter which is uid of the target plugin.                   
+        const TAiwGenericParam* genericParam = NULL; 
+        genericParam = aOutParamList.FindFirst( index,
+                                                EGenericParamError,
+                                                EVariantTypeTUid );
+        if ( genericParam )
+            {
+            if ( KAccountCreationPluginUid == genericParam->Value().AsTUid() )
+                {
+                commandForUs = ETrue; // Request is for us.
+                }
+            }
+        }
+
+    ACPLOG2( "CAccountCreationPlugin::CompareUids: forUs=%d", commandForUs );
+    return commandForUs;  
+    }  
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::LaunchPluginUiL
+// Launches ACP UI.
+// ---------------------------------------------------------------------------
+//
+void CAccountCreationPlugin::LaunchPluginUiL()
+    {
+    ACPLOG( "CAccountCreationPlugin::LaunchPluginUiL begin" );
+ 
+        CAknViewAppUi* ui = 
+            static_cast<CAknViewAppUi*> ( static_cast<CAknAppUi*>
+                ( iEikEnv->EikAppUi() ) );
+
+
+    // Create provider list view and activate it.
+    if ( NULL == iProviderListView )
+        {
+            iProviderListView = CAcpProviderListView::NewL( *this,
+                                                            iLaunchedFromAI,
+															*iEikEnv );
+        
+        ui->AddViewL( iProviderListView ); // Ownership is transferred.
+        }
+    
+    if ( iLaunchedFromAI )
+        {
+        TVwsViewId tvwsViewId( KAIAppUid, TUid::Uid( 1 ) );
+        ui->ActivateViewL( tvwsViewId );
+        }
+    
+    iProviderListView->DownloadProviderListL();
+
+    ACPLOG( "CAccountCreationPlugin::LaunchPluginUiL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::HandleServiceCmdL
+// From class CAiwServiceIfBase.
+// Handles AIW service events from customer application.
+// ---------------------------------------------------------------------------
+//
+void CAccountCreationPlugin::HandleServiceCmdL( 
+    const TInt& /*aCmdId*/,
+    const CAiwGenericParamList& /*aInParamList*/,
+    CAiwGenericParamList& aOutParamList,
+    TUint aCmdOptions,
+    const MAiwNotifyCallback* aCallback )
+    {
+    ACPLOG2( 
+        "CAccountCreationPlugin::HandleServiceCmdL: cmd=%d", aCmdOptions );
+    
+      if ( aCallback )
+        {
+        iNotifyCallback = aCallback;
+        }
+    
+    if ( aCmdOptions == ELaunchedFromAI )
+        {
+        iLaunchedFromAI = ETrue;
+        aCmdOptions = EExecute; 
+        }
+    
+    switch ( aCmdOptions )
+        {
+        case EInitialize: // Initialization.
+            {
+            SendInitializedCallbackL();
+            break;
+            }
+        case EExecute: // Execution.
+            {
+            // Check that service event is meant to us and launch plugin.
+            if ( CompareUids( aOutParamList ) )
+                {
+                LaunchPluginUiL();
+                }
+            break;
+            }
+        default: // Not supported.
+            {
+            User::Leave( KErrNotSupported );
+            break;    
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::InitialiseL
+// From class MAccountCreationPluginObserver.
+// ---------------------------------------------------------------------------
+//
+void CAccountCreationPlugin::InitialiseL( 
+    MAiwNotifyCallback& /*aFrameworkCallback*/,
+    const RCriteriaArray& /*aInterest*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::NotifyAiwEventL
+// From class MAccountCreationPluginObserver.
+// ---------------------------------------------------------------------------
+//
+void CAccountCreationPlugin::NotifyAiwEventL( TInt aError )
+    {
+    ACPLOG2( "CAccountCreationPlugin::NotifyAiwEventL: error=%d", aError );
+
+    // In case of error, send error callback to customer application.
+    if ( aError )
+        {
+        SendErrorCallbackL();
+        }
+    // If successful event retrieved, send completed callback to customer.    
+    else
+        {
+        SendCompletedCallbackL();
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// CAccountCreationPlugin::NotifySISDownloaded
+// From class MAccountCreationPluginObserver.
+// ---------------------------------------------------------------------------
+//
+void CAccountCreationPlugin::NotifySISDownloaded( TDesC& aFileName )
+    {
+    ACPLOG( "CAccountCreationPlugin::NotifySISDownloaded IN" );
+    
+    // Create the installer.
+    SwiUI::RSWInstLauncher launcher; 
+    SwiUI::TInstallOptions options;
+    SwiUI::TInstallOptionsPckg optionsPckg;  
+
+    // Set necessary options.
+    options.iUpgrade = SwiUI::EPolicyNotAllowed;
+    options.iOCSP = SwiUI::EPolicyNotAllowed;
+    options.iUntrusted = SwiUI::EPolicyNotAllowed; 
+    options.iCapabilities = SwiUI::EPolicyNotAllowed;               
+    optionsPckg = options;  
+
+    TInt err = launcher.Connect();
+
+    // Check whether connected or not.
+    if ( err == KErrNone )
+        {           
+        ACPLOG( "CAccountCreationPlugin::NotifySISDownloaded INSTALL 1" );
+        
+        // Launch the installer and install requested file on phone.
+        launcher.Install( aFileName, optionsPckg );
+        
+        ACPLOG( "CAccountCreationPlugin::NotifySISDownloaded INSTALL 2" );
+        }
+    
+    TRAP_IGNORE( SendCompletedCallbackL() );
+    
+    launcher.Close();
+    
+    ACPLOG( "CAccountCreationPlugin::NotifySISDownloaded OUT" );
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/src/accountcreationpluginGroupProxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Group proxy file for AccountCreationPlugin
+ *
+*/
+
+
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+
+#include "accountcreationplugin.h"
+#include "accountcreationpluginconstants.h"
+#include "accountcreationplugin.hrh"
+
+
+// Map interface UIDs.
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KAccountCreationPluginImplUid, CAccountCreationPlugin::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Exported proxy for instantiation method resolution.
+// Returns: ImplementationTable
+// ---------------------------------------------------------------------------
+//
+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/voipplugins/accountcreationplugin/src/acpdialog.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,320 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CAcpDialog methods
+*
+*/
+
+
+#include <avkon.rsg>
+#include <StringLoader.h>
+#include <AknGlobalNote.h>
+#include <AknQueryDialog.h> 
+#include <aknnotewrappers.h>
+#include <AknGlobalMsgQuery.h> 
+#include <accountcreationplugin.rsg>
+
+#include "acpdialog.h"
+#include "accountcreationpluginlogger.h"
+#include "macpdialogobserver.h"
+
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::CAcpDialog
+// ---------------------------------------------------------------------------
+//
+CAcpDialog::CAcpDialog( MAcpDialogObserver& aObserver )
+    : CActive ( EPriorityStandard ),
+    iObserver( aObserver )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::NewL
+// ---------------------------------------------------------------------------
+//
+CAcpDialog* CAcpDialog::NewL( MAcpDialogObserver& aObserver )
+    {
+    CAcpDialog* self = CAcpDialog::NewLC( aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::NewLC
+// ---------------------------------------------------------------------------
+//
+CAcpDialog* CAcpDialog::NewLC( MAcpDialogObserver& aObserver )
+    {
+    CAcpDialog* self = new ( ELeave ) CAcpDialog( aObserver );
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::~CAcpDialog
+// ---------------------------------------------------------------------------
+//
+CAcpDialog::~CAcpDialog()
+    {
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::LaunchWaitNoteL
+// Launches a wait note.
+// ---------------------------------------------------------------------------
+//
+void CAcpDialog::LaunchWaitNoteL( TInt aWaitNote )
+    {
+    ACPLOG( "CAcpDialog::LaunchWaitNoteL begin" );
+
+    if ( !IsActive() )
+        {
+        // Show wait note with appropriate text.
+        HBufC* text = StringLoader::LoadLC( aWaitNote );
+        iWaitNote = CAknGlobalNote::NewL();
+        iWaitNote->SetSoftkeys( R_AVKON_SOFTKEYS_CANCEL );
+        iNoteId = iWaitNote->ShowNoteL( 
+            iStatus, 
+            EAknGlobalWaitNote, 
+            *text );
+        CleanupStack::PopAndDestroy( text );
+        ACPLOG( " - SetActive();" );
+        SetActive();
+        }
+     ACPLOG( "CAcpDialog::LaunchWaitNoteL end" );
+     }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::LaunchWaitNoteL
+// Launches a wait note with a custom string.
+// ---------------------------------------------------------------------------
+//
+void CAcpDialog::LaunchWaitNoteL( TInt aWaitNote, const TDesC& aString )
+    {
+    ACPLOG( "CAcpDialog::LaunchWaitNoteL begin" );
+
+    if ( !IsActive() )
+        {
+        // Show wait note with appropriate text.
+        HBufC* text = StringLoader::LoadLC( aWaitNote, aString );
+        iWaitNote = CAknGlobalNote::NewL();
+        iWaitNote->SetSoftkeys( R_AVKON_SOFTKEYS_CANCEL );
+        iNoteId = iWaitNote->ShowNoteL( 
+            iStatus, 
+            EAknGlobalWaitNote, 
+            *text );
+        CleanupStack::PopAndDestroy( text );
+        ACPLOG( " - SetActive();" );
+        SetActive();
+        }
+     ACPLOG( "CAcpDialog::LaunchWaitNoteL end" );
+     }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::DestroyWaitNote
+// Destroys a wait note.
+// ---------------------------------------------------------------------------
+//
+void CAcpDialog::DestroyWaitNote()
+    {
+    ACPLOG( "CAcpDialog::DestroyWaitNote begin" );
+    Cancel();
+    
+    // If dialog handler wasn't active anymore, DoCancel wasn't called and
+    // the wait note needs to be deleted separately.
+    if ( iWaitNote )
+        {
+        TRAP_IGNORE( iWaitNote->CancelNoteL( iNoteId ) );
+        delete iWaitNote;
+        iWaitNote = NULL;
+        }
+    
+    ACPLOG( "CAcpDialog::DestroyWaitNoteL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::ShowQueryL
+// ---------------------------------------------------------------------------
+//
+TInt CAcpDialog::ShowQueryL( TInt aQuery )
+    {
+    ACPLOG( "CAcpDialog::ShowQueryL begin" );
+    CAknQueryDialog* query = new ( ELeave ) 
+        CAknQueryDialog( CAknQueryDialog::ENoTone );
+    ACPLOG( " - return ( query->ExecuteLD( aQuery ) );" );
+    ACPLOG( "CAcpDialog::ShowQueryL end" );
+    return ( query->ExecuteLD( aQuery ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::ShowMessageQueryL
+// ---------------------------------------------------------------------------
+//
+void CAcpDialog::ShowMessageQueryL( TInt aMessageQuery, const TDesC& aString )
+    {
+    ACPLOG( "CAcpDialog::ShowMessageQueryL begin" );
+    
+    if ( !IsActive() )
+        {
+        HBufC* text = StringLoader::LoadLC( aMessageQuery, aString );
+        iGlobalMsgQuery = CAknGlobalMsgQuery::NewL();
+        
+        ACPLOG( "   --> show query" );
+ 
+        iGlobalMsgQuery->ShowMsgQueryL( 
+           iStatus, 
+           text->Des(), 
+           R_AVKON_SOFTKEYS_OK_EMPTY,
+           KNullDesC, 
+           KNullDesC ); 
+
+        CleanupStack::PopAndDestroy( text );
+        SetActive();
+        }
+    
+    ACPLOG( "CAcpDialog::ShowMessageQueryL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::ShowNoteL
+// ---------------------------------------------------------------------------
+//
+void CAcpDialog::ShowNoteL( TInt aNote, const TDesC& aString )
+    {
+    ACPLOG( "CAcpDialog::ShowNoteL(string) begin" );
+    HBufC* text = StringLoader::LoadLC( aNote, aString );
+    CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue );
+    note->ExecuteLD( *text );
+    CleanupStack::PopAndDestroy( text );
+    ACPLOG( "CAcpDialog::ShowNoteL(string) end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::ShowGlobalNoteL
+// ---------------------------------------------------------------------------
+//
+void CAcpDialog::ShowGlobalNoteL( TInt aNote )
+    {
+    ACPLOG( "CAcpDialog::ShowGlobalNoteL begin" );    
+    HBufC* text = StringLoader::LoadLC( aNote );
+    CAknGlobalNote* note = CAknGlobalNote::NewLC();
+    note->SetSoftkeys( R_AVKON_SOFTKEYS_OK_EMPTY );
+    note->ShowNoteL( EAknGlobalInformationNote, *text );
+    CleanupStack::PopAndDestroy( 2, text );    
+    ACPLOG( "CAcpDialog::ShowGlobalNoteL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::ShowGlobalNoteL
+// ---------------------------------------------------------------------------
+//
+void CAcpDialog::ShowGlobalNoteL( TInt aNote, const TDesC& aString )
+    {
+    ACPLOG( "CAcpDialog::ShowGlobalNoteL(string) begin" );
+    HBufC* text = StringLoader::LoadLC( aNote, aString );
+    CAknGlobalNote* note = CAknGlobalNote::NewLC();
+    note->SetSoftkeys( R_AVKON_SOFTKEYS_OK_EMPTY );
+    note->ShowNoteL( EAknGlobalInformationNote, *text );
+    CleanupStack::PopAndDestroy( 2, text );
+    ACPLOG( "CAcpDialog::ShowGlobalNoteL(string) end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::ShowSelectionDialogL
+// ---------------------------------------------------------------------------
+//
+TInt CAcpDialog::ShowSelectionDialogL( TInt aDialog, MDesC16Array* aArray )
+    {
+    ACPLOG( "CAcpDialog::ShowSelectionDialogL begin" );
+    TInt index( KErrNotFound );
+    CAknListQueryDialog* dialog = new (ELeave) CAknListQueryDialog( &index );
+    dialog->PrepareLC( aDialog );
+    dialog->SetItemTextArray( aArray );
+    dialog->SetOwnershipType( ELbmOwnsItemArray );
+    dialog->RunLD();
+    
+    ACPLOG( "CAcpDialog::ShowSelectionDialogL end" );
+    return index;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::RunL
+// From CActive.
+// ---------------------------------------------------------------------------
+//
+void CAcpDialog::RunL()
+    {
+    ACPLOG2( "CAcpDialog::RunL: iStatus=%d", iStatus.Int() );
+    
+    TInt status = iStatus.Int();
+    
+    if ( iWaitNote )
+        {
+        ACPLOG( "CAcpDialog::RunL --> wait note" );
+        
+        iObserver.DialogDismissedL( iStatus.Int() );
+        }
+    else if ( iGlobalMsgQuery && 
+        ( status == EAknSoftkeyYes || status == EAknSoftkeyOk ) )
+        {
+        ACPLOG( "CAcpDialog::RunL --> message query" );
+        
+        iGlobalMsgQuery->CancelMsgQuery();
+        iObserver.DialogDismissedL( iStatus.Int() );
+        }
+    else if ( iGlobalMsgQuery && 
+        ( status != EAknSoftkeyYes || status != EAknSoftkeyOk ) )
+        {
+        ACPLOG( "CAcpDialog::RunL --> waiting user to check message query" );
+        
+        // do nothing, wait user to press ok to message query.
+        }
+    else
+        {        
+        ACPLOG( "CAcpDialog::RunL --> cancel" );
+        
+        // in other cases cancel
+        Cancel();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpDialog::DoCancel
+// From CActive.
+// ---------------------------------------------------------------------------
+//
+void CAcpDialog::DoCancel()
+    {
+    ACPLOG( "CAcpDialog::DoCancel - begin" );
+
+    if ( iWaitNote )
+        {
+        TRAP_IGNORE( iWaitNote->CancelNoteL( iNoteId ) );
+        delete iWaitNote;
+        iWaitNote = NULL;
+        }
+    
+    if ( iGlobalMsgQuery )
+        {
+        iGlobalMsgQuery->CancelMsgQuery();
+        delete iGlobalMsgQuery;
+        iGlobalMsgQuery = NULL;
+        }
+      
+    ACPLOG( "CAcpDialog::DoCancel - end" );
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/src/acpproviderlistcontainer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,393 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CAcpProviderListContainer methods
+*
+*/
+
+
+#include <aknlists.h>
+#include <pathinfo.h>
+#include <AknsUtils.h>
+#include <acpicons.mbg>
+#include <AknIconArray.h>
+#include <StringLoader.h>
+#include <accountcreationplugin.rsg>
+#include <data_caging_path_literals.hrh>
+#include <imageconversion.h>
+#include <fbs.h>
+#include <gulicon.h>
+#include <AknIconUtils.h>
+#include <eikclbd.h>
+
+#include "acpcontroller.h"
+#include "acpproviderlistcontainer.h"
+#include "accountcreationpluginlogger.h"
+#include "accountcreationpluginconstants.h"
+
+
+const TInt KComponentControlCount = 1;
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::CAcpProviderListContainer
+// ---------------------------------------------------------------------------
+//
+CAcpProviderListContainer::CAcpProviderListContainer( 
+    CAcpController& aController )
+    : iController( aController )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListContainer::ConstructL( const TRect& aRect )
+    {
+    ACPLOG( "CAcpProviderListContainer::ConstructL begin" );
+    
+    CreateWindowL();
+    ConstructListBoxL();
+    SetRect( aRect );
+    ActivateL();
+    
+    ACPLOG( "CAcpProviderListContainer::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::NewL
+// ---------------------------------------------------------------------------
+//      
+CAcpProviderListContainer* CAcpProviderListContainer::NewL( 
+    CAcpController& aController,
+    const TRect& aRect )
+    {    
+    CAcpProviderListContainer* self = 
+        CAcpProviderListContainer::NewLC( aController, aRect );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::NewLC
+// ---------------------------------------------------------------------------
+//
+CAcpProviderListContainer* CAcpProviderListContainer::NewLC(
+    CAcpController& aController,
+    const TRect& aRect )
+    {    
+    CAcpProviderListContainer* self = 
+        new ( ELeave ) CAcpProviderListContainer( aController );
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::~CAcpProviderListContainer
+// ---------------------------------------------------------------------------
+//
+CAcpProviderListContainer::~CAcpProviderListContainer()
+    {
+    ACPLOG( "CAcpProviderListContainer::~CAcpProviderListContainer begin" );
+    delete iListBox;
+    ACPLOG( "CAcpProviderListContainer::~CAcpProviderListContainer end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::AddProvidersToListboxL
+// Adds and updates listbox with providers.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListContainer::AddProvidersToListboxL( )
+    {
+    ACPLOG( "CAcpProviderListContainer::AddProvidersToListboxL begin" );
+
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+    
+    if ( !listBoxItems->Count() )
+        {
+        TInt count = iController.CountOfProviders(); // Amount of provider.
+    
+        LoadProviderIconsL( count ); // Load icons of providers.
+    
+        for ( TInt i = 0; i < count; i++ )
+            {
+            // Entry for listbox.
+            TBuf<KMaxSettingLength> listBoxItemText( KNullDesC ); 
+            // Get provider name for adding it to the list later on.
+            TPtrC namePtr = iController.ProviderNameFromIndexL( i );
+            // Formats the listbox entry with the index and the provider name.  
+            listBoxItemText.Format( KListFormat, i,&namePtr );
+            // Add the entry to the list.
+            listBoxItems->AppendL( listBoxItemText );
+            }
+    
+        iListBox->HandleItemAdditionL();
+        iListBox->SetCurrentItemIndexAndDraw( 0 );
+        }
+
+    ACPLOG( "CAcpProviderListContainer::AddProvidersToListboxL end" );
+
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::ListBox
+// Returns handle to the listbox.
+// ---------------------------------------------------------------------------
+//    
+CAknSingleLargeStyleListBox* CAcpProviderListContainer::ListBox()
+    {
+    return iListBox;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::CurrentItemIndex
+// Returns index of selected listbox item. 
+// ---------------------------------------------------------------------------
+//
+TInt CAcpProviderListContainer::CurrentItemIndex() const
+    {
+    return iListBox->CurrentItemIndex();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::LoadDefaultIconsL
+// Loads default icons.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListContainer::LoadProviderIconsL( TInt aCount )
+    {
+    ACPLOG( "CAcpProviderListContainer::LoadProviderIconsL begin" );
+
+    if ( aCount > 0 )
+        {
+        // Delete previous icon array.
+        CArrayPtr<CGulIcon>* oldArray = iListBox->ItemDrawer()->ColumnData()->
+            IconArray();
+        if ( oldArray )
+            {
+            iListBox->ItemDrawer()->ColumnData()->SetIconArray( NULL );
+            delete oldArray;
+            }
+        
+        // Create a new icon array.
+        CAknIconArray* iconArray = new( ELeave ) CAknIconArray( aCount );
+
+        for ( TInt i = 0; i < aCount; i++ )
+            {
+            // Try to get bitmap and mask for provider.
+            CFbsBitmap* bitmap( NULL );
+            CFbsBitmap* mask( NULL );
+            
+            iController.ProviderBitmapsFromIndexL( i, bitmap, mask );
+ 
+            if ( !bitmap ) // Mask can be NULL.
+                {
+                // Default icon.
+                LoadDefaultIconsL( iconArray );
+                }
+            else
+                {
+                // Provider icon.
+                CGulIcon* providerIcon = CGulIcon::NewL( bitmap, mask );
+
+                // Owned by provider.
+                providerIcon->SetBitmapsOwnedExternally( ETrue );
+
+                CleanupStack::PushL( providerIcon );
+                // Insert into icon array.
+                iconArray->AppendL( providerIcon );
+                CleanupStack::Pop( providerIcon );
+                }
+            }
+
+        // Set an icon array to the listbox.
+        iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
+        }
+
+    ACPLOG( "CAcpProviderListContainer::LoadProviderIconsL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::ResetListBox
+// Resets the listbox.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListContainer::ResetListBox()
+    {
+    ACPLOG( "CAcpProviderListContainer::ResetListBox begin" );
+    
+    CDesCArrayFlat* array = static_cast<CDesCArrayFlat*>(
+        iListBox->Model()->ItemTextArray() );
+    
+    if ( array )
+        {
+        array->Reset();
+        }
+    
+    iListBox->SetCurrentItemIndexAndDraw( 0 );
+    
+    ACPLOG( "CAcpProviderListContainer::ResetListBox end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::ConstructListBoxL
+// Creates listbox item for provider list items.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListContainer::ConstructListBoxL()
+    {
+    ACPLOG( "CAcpProviderListContainer::ConstructListBoxL begin" );
+
+    // Create listbox and array for listbox items.
+    iListBox = new( ELeave ) CAknSingleLargeStyleListBox;
+    iListBox->SetContainerWindowL( *this );
+    iListBox->ConstructL( this, EAknGenericListBoxFlags );    
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+        CEikScrollBarFrame::EOff, 
+        CEikScrollBarFrame::EAuto );
+    iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+
+    CDesCArrayFlat* array = new ( ELeave ) CDesCArrayFlat( KArrayGranuality );
+    iListBox->Model()->SetItemTextArray( array );
+
+    // Set listbox background data when there are no providers available.
+    HBufC* empty = StringLoader::LoadLC( R_ACP_PROVIDER_LIST_NO_PROVIDERS );
+    iListBox->View()->SetListEmptyTextL( *empty );
+    CleanupStack::PopAndDestroy( empty );
+
+    ACPLOG( "CAcpProviderListContainer::ConstructListBoxL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::LoadDefaultIconsL
+// Loads default icons.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListContainer::LoadDefaultIconsL( 
+    CArrayPtr<CGulIcon>* aIconArray )
+    {
+    ACPLOG( "CAcpProviderListContainer::LoadDefaultIconsL begin" );
+
+    // This when going to ROM (PhoneMemoryRootPath is used only for testing).
+    TFileName fileName = 
+        TParsePtrC( PathInfo::RomRootPath() ).Drive();
+    fileName.Append( KDC_APP_BITMAP_DIR );
+    fileName.Append( KIconFileName );
+
+    // Just one icon for providers which does not have own icon.
+    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+
+    CGulIcon* defaultIcon( NULL );
+    TRAPD( err, defaultIcon = AknsUtils::CreateGulIconL( 
+        skinInstance, 
+        KAknsIIDDefault,
+        fileName, 
+        EMbmAcpiconsQgn_prop_set_conn_voip, 
+        EMbmAcpiconsQgn_prop_set_conn_voip ) );
+
+    if ( KErrNone != err )
+        {
+        ACPLOG2( "CreateGulIconL error: %d", err );
+        }
+
+    CleanupStack::PushL( defaultIcon );
+    aIconArray->AppendL( defaultIcon );
+    CleanupStack::Pop( defaultIcon );
+
+    ACPLOG( "CAcpProviderListContainer::LoadDefaultIconsL end");
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::ComponentControl
+// From class CoeControl
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CAcpProviderListContainer::ComponentControl( 
+    TInt /*aIndex*/ ) const
+    {
+    return iListBox;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CoeControl
+// CAcpProviderListContainer::OfferKeyEventL
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CAcpProviderListContainer::OfferKeyEventL( 
+    const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    return iListBox->OfferKeyEventL( aKeyEvent, aType );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::CountComponentControls
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+TInt CAcpProviderListContainer::CountComponentControls() const
+    {
+    return KComponentControlCount;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::SizeChanged
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListContainer::SizeChanged()
+    {
+    iListBox->SetRect( Rect() );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::FocusChanged
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListContainer::FocusChanged( TDrawNow aDrawNow )
+    {
+    CCoeControl::FocusChanged( aDrawNow );
+
+    if ( iListBox )
+        {
+        iListBox->SetFocus( IsFocused() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::HandleResourceChange
+// From class CCoeControl.
+// Called by framework when layout is changed.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListContainer::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange(aType);
+
+    // *****************************
+    // ADDED FOR SCALABLE UI SUPPORT
+    // *****************************
+    if ( KEikDynamicLayoutVariantSwitch == aType )
+        {
+        TRect rect;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
+        SetRect( rect );
+        }
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/src/acpproviderlistview.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,882 @@
+/*
+* Copyright (c) 2007-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:  Implements CAcpProviderListView methods
+*
+*/
+
+
+#include <eikenv.h>
+#include <aknlists.h>
+#include <akntitle.h>
+#include <aknViewAppUi.h>
+#include <StringLoader.h>
+#include <apgcli.h>
+#include <apgtask.h>
+#include <centralrepository.h>
+#include <accountcreationplugin.rsg>
+#include <spnotifychange.h>
+#include <spsettings.h>
+#include <spentry.h>
+#include <spproperty.h>
+#include <AknQueryDialog.h>
+#include <crcseprofileregistry.h>
+#include <crcseprofileentry.h>
+#include <CxSPViewData.h>
+#include <featmgr.h>
+#include <hlplch.h>
+
+#include "acptimer.h"
+#include "acpdialog.h"
+#include "acpproviderlistview.h"
+#include "acpproviderspecificview.h"
+#include "acpproviderlistcontainer.h"
+#include "accountcreationpluginlogger.h"
+#include "acpcontroller.h"
+#include "maccountcreationpluginobserver.h"
+#include "accountcreationpluginconstants.h"
+#include "accountcreationplugin.hrh"
+
+// Constants for launching Help.
+_LIT( KVOIP_HLP_SERVCATALOG, "VOIP_HLP_SERVCATALOG" );
+const TUid KHelpUid = { 0x1020E566 };
+
+// Cleanup function for RCSE arrays.
+void CleanupResetAndDestroy( TAny* aPtr )
+    {
+    RPointerArray<CRCSEProfileEntry>* entries =
+        static_cast<RPointerArray<CRCSEProfileEntry>*>( aPtr );
+        
+    entries->ResetAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::CAcpProviderListView
+// ---------------------------------------------------------------------------
+//
+CAcpProviderListView::CAcpProviderListView(
+    MAccountCreationPluginObserver& aObserver, TBool aLaunchedFromAI,
+            CEikonEnv& aEikEnv )
+    : iObserver( aObserver ), iLaunchedFromAI( aLaunchedFromAI ), 
+    iEikEnv( aEikEnv )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::ConstructL()
+    {
+    ACPLOG( "CAcpProviderListView::ConstructL begin" );
+ 
+    iUi = static_cast<CAknViewAppUi*> ( static_cast<CAknAppUi*> 
+        ( iEikEnv.EikAppUi() ) );
+
+    BaseConstructL( R_ACP_PROVIDER_LIST_VIEW );
+
+    iController = CAcpController::NewL( *this );
+    iDialog = CAcpDialog::NewL( *this );
+    iTimer = CAcpTimer::NewL( *this );
+    iServiceName = HBufC::NewL( 0 );
+    
+    // Get list of services.
+    iSpSettings = CSPSettings::NewL();
+    iSpSettings->FindServiceIdsL( iServiceIds );
+    
+    // Get tab view ids
+    User::LeaveIfError( iXspViewServices.Open() );
+    
+    TInt err( KErrNone );
+    TInt tabViewCount( 0 );
+    
+    err = iXspViewServices.GetViewCount( tabViewCount );
+    
+    for( TInt i( 0 ) ; i < tabViewCount && !err ; i++ )
+        {
+        TInt bufferLength( 0 );
+        err = iXspViewServices.GetPackedViewDataBufferLength(
+                i, bufferLength );
+        
+        ACPLOG( "CAcpProviderListView::ConstructL 6" );
+        
+        if( !err && bufferLength > 0 )
+            {
+            HBufC8* packed = HBufC8::NewLC( bufferLength );
+            TPtr8 packedPtr = packed->Des();
+            
+            err = iXspViewServices.GetPackedViewData( i, packedPtr );
+            
+            if( !err )
+                {     
+                CxSPViewData* viewData = CxSPViewData::NewL( *packed );
+                CleanupStack::PushL( viewData );
+                
+                ACPLOG2( "  --> VIEW ID: %d", viewData->OriginalViewId() );
+                
+                iTabViewIds.AppendL( viewData->OriginalViewId() );
+                CleanupStack::PopAndDestroy( viewData );    
+                }                                               
+            CleanupStack::PopAndDestroy( packed );
+            }
+        }
+    
+    iXspViewServices.Close();
+    
+    ACPLOG( "CAcpProviderListView::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::NewL
+// ---------------------------------------------------------------------------
+//      
+CAcpProviderListView* CAcpProviderListView::NewL( 
+    MAccountCreationPluginObserver& aObserver, TBool aLaunchedFromAI,
+	        CEikonEnv& aEikEnv )
+    {    
+    CAcpProviderListView* self = CAcpProviderListView::NewLC( aObserver,
+            aLaunchedFromAI, aEikEnv );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::NewLC
+// ---------------------------------------------------------------------------
+//
+CAcpProviderListView* CAcpProviderListView::NewLC(
+    MAccountCreationPluginObserver& aObserver, TBool aLaunchedFromAI,
+	        CEikonEnv& aEikEnv )
+    {    
+    CAcpProviderListView* self = 
+        new ( ELeave ) CAcpProviderListView( aObserver, aLaunchedFromAI,
+		                                     aEikEnv );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::~CAcpProviderListView
+// ---------------------------------------------------------------------------
+//
+CAcpProviderListView::~CAcpProviderListView()
+    {
+    ACPLOG( "CAcpProviderListView::~CAcpProviderListView begin" );
+
+    // Delete container.
+    if ( iContainer && iUi )
+        {
+        iUi->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+
+    delete iDialog;
+    delete iController;
+    delete iTimer;
+    delete iSpSettings;
+    iServiceIds.Close();    
+    delete iServiceName;
+    
+    iTabViewIds.Close();
+    iXspViewServices.Close();
+    
+    ACPLOG( "CAcpProviderListView::~CAcpProviderListView end" );
+    }         
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::ProvisioningL
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::ProvisioningL()
+    {
+    ACPLOG( "CAcpProviderListView::ProvisioningL begin" );
+    
+    TInt index = iController->ActiveIndex();
+    TPtrC8 sisUrl = iController->ProviderSisUrlFromIndexL( index );
+    
+    // Save service name.
+    delete iServiceName;
+    iServiceName = NULL;
+    iServiceName = iController->ProviderNameFromIndexL( index ).AllocL();
+
+	if ( sisUrl.Length() )
+        {
+        // Install sis package.
+        ACPLOG( " - Fetching sis file" );
+        
+        iDialog->LaunchWaitNoteL( R_ACP_DOWNLOADING_PROVIDER_TEXT,
+            *iServiceName );
+        
+        iController->FetchSisFileFromNetworkL( sisUrl );
+        }
+    // No sis url, get wbxml content instead.
+    else
+        {
+        ACPLOG( " - Fetching wbxml content" );
+
+        TBuf8<KMaxUrlLength> activationUrl;
+
+        // Get activation URL. Insert session id if needed.
+        if ( iController->SessionId().Length() )
+            {
+            // Change http://address?param=value to
+            //        http://adress;jsessionid=[sessionid]?param=value
+
+            TPtrC8 provActUrl = iController->
+                ProviderActivationUrlFromIndexL( index );
+            
+            if ( KErrNotFound == provActUrl.Find( KSessionId ) )
+                {
+                // Find ? and insert the session id part before it.
+                TInt qmIndex = provActUrl.Find( KQuestionMark8 );
+                if ( KErrNotFound != qmIndex )
+                    {
+                    activationUrl.Append( provActUrl.Mid( 0, qmIndex ) );
+                    activationUrl.Append( KSessionId );
+                    activationUrl.Append( iController->SessionId() );
+                    activationUrl.Append( provActUrl.Mid( qmIndex ) );
+                    }
+                }
+            else
+                {
+                activationUrl.Append( provActUrl );
+                }
+            }
+        else
+            {
+            // Error. Can't download settings without a session id.
+            TRAP_IGNORE( iDialog->ShowGlobalNoteL(
+                R_ACP_DOWNLOAD_FAILED, *iServiceName ) );
+            
+            iUi->ActivateLocalViewL( KProviderListViewId ); 
+            return;
+            }
+
+        iDialog->LaunchWaitNoteL( R_ACP_DOWNLOADING_PROVIDER_TEXT,
+            *iServiceName );
+        
+        iController->FetchActionFileL( activationUrl );
+        }
+
+    // Activate provider list view.
+    iUi->ActivateLocalViewL( KProviderListViewId ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::DownloadProviderListL
+// Starts provider list download.
+// ---------------------------------------------------------------------------
+// 
+void CAcpProviderListView::DownloadProviderListL()
+    {
+    iDialog->LaunchWaitNoteL( R_ACP_WAIT_NOTE_TEXT );
+    iConnectingToServer = ETrue;
+    iController->FetchProviderListFromNetworkL();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::SetTitlePaneTextL
+// For changing text to the title pane.
+// ---------------------------------------------------------------------------
+// 
+void CAcpProviderListView::SetTitlePaneTextL() const
+    {
+    // Get handle to title pane.
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    if ( statusPane )
+        {
+        CAknTitlePane* titlePane =
+            static_cast<CAknTitlePane*>( statusPane->ControlL(
+                TUid::Uid( EEikStatusPaneUidTitle ) ) );
+
+        // Set title pane text from resouces.   
+        HBufC* titleText = StringLoader::LoadLC( R_ACP_PROVIDER_LIST_TITLE );
+        titlePane->SetTextL( titleText->Des() );
+
+        CleanupStack::PopAndDestroy( titleText );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::Id
+// From class CAknView.
+// ---------------------------------------------------------------------------
+//
+TUid CAcpProviderListView::Id() const
+    {
+    return KProviderListViewId;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::DoActivateL
+// From class CAknView.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::DoActivateL( 
+    const TVwsViewId& /*aPrevViewId*/, 
+    TUid /*aCustomMessageId*/,
+    const TDesC8& /*aCustomMessage*/ )
+    {
+    ACPLOG( "CAcpProviderListView::DoActivateL begin" );
+
+    // Create container when view is activated.
+    if ( !iContainer )
+        {
+        iContainer = CAcpProviderListContainer::NewL(
+            *iController, ClientRect() );
+        iContainer->SetMopParent( this );
+        iUi->AddToStackL( *this, iContainer );
+        iContainer->ListBox()->SetListBoxObserver( this );
+        }
+
+    SetTitlePaneTextL();
+    
+    iContainer->AddProvidersToListboxL();
+
+    ACPLOG( "CAcpProviderListView::DoActivateL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::DoDeactivate()
+// From class CAknView.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::DoDeactivate()
+    {
+    ACPLOG( "CAcpProviderListView::DoDeactivate begin" );
+    
+    // Delete container when view is deactivated.
+    if ( iContainer )
+        {
+        iUi->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+
+    ACPLOG( "CAcpProviderListView::DoDeactivate" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::HandleCommandL
+// From class CAknView.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::HandleCommandL( TInt aCommand )
+    {
+    ACPLOG2( "CAcpProviderListView::HandleCommandL: cmd=%d", aCommand );
+
+    TInt index = iContainer->CurrentItemIndex();
+
+    ACPLOG2( " - index=%d", index );
+
+    iController->SaveActiveIndex( index );
+
+    switch ( aCommand )
+        {
+        case EAknSoftkeySelect:
+            {
+            ACPLOG( " - View details" );
+            if ( KErrNotFound != index )
+                {
+                HandleListBoxSelectionL();
+                }
+            }
+            break;
+
+        case EAcpDownload:
+            {
+            ACPLOG( " - Download" );          
+            ProvisioningL();
+            }
+            break;
+
+        case EAcpRefresh:
+            {
+            ACPLOG( " - Refresh" );
+            iContainer->ResetListBox();
+            iDialog->LaunchWaitNoteL( R_ACP_WAIT_NOTE_TEXT );
+            iController->FetchProviderListFromNetworkL();
+            }
+            break;
+            
+        case EAcpHelp:
+            {
+            ACPLOG( " - Help" );
+            FeatureManager::InitializeLibL();
+            if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+                {
+                // Launch help.
+                CArrayFixFlat<TCoeHelpContext>* array = 
+                    new (ELeave) CArrayFixFlat<TCoeHelpContext>( 1 );  
+                CleanupStack::PushL( array ); 
+
+                array->AppendL( TCoeHelpContext( KHelpUid,
+                    KVOIP_HLP_SERVCATALOG ) );
+                
+                HlpLauncher::LaunchHelpApplicationL(
+                    iEikonEnv->WsSession(), array );
+                
+                CleanupStack::Pop( array ); // Ownership passed.
+                }
+            FeatureManager::UnInitializeLib();
+            }
+            break;
+
+        case EAknSoftkeyBack:
+        case EEikCmdExit:
+        case EAknSoftkeyExit:
+            {
+            ACPLOG( " - Exit" );
+            if ( iLaunchedFromAI )
+                {
+                AppUi()->HandleCommandL( EEikCmdExit );
+                }
+            else
+                {
+                iObserver.NotifyAiwEventL( KErrNone );
+                }
+            }
+            break;
+
+        default:
+            break;
+        }
+
+    ACPLOG( "CAcpProviderListView::HandleCommandL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::HandleListBoxEventL
+// From MEikListBoxObserver
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::HandleListBoxEventL( 
+    CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
+    {
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemSingleClicked:
+            HandleCommandL( EAknSoftkeySelect );
+            break;
+        default:
+           break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::HandleListBoxSelectionL
+// From MEikListBoxObserver
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::HandleListBoxSelectionL() 
+    {
+    // Set active list index to controller before activating next view.
+    ACPLOG( "CAcpProviderListView::HandleListBoxSelectionL" );
+
+    // Create provider specific view and activate it.
+    if ( NULL == iProviderSpecificView )
+        {
+        iProviderSpecificView = 
+            CAcpProviderSpecificView::NewL( *iController, *this );
+        iUi->AddViewL( iProviderSpecificView ); // Ownership is transferred.
+        }
+    iUi->ActivateLocalViewL( iProviderSpecificView->Id() );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::DynInitMenuPaneL
+// From MEikListBoxObserver
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::DynInitMenuPaneL( 
+    TInt aResourceId, CEikMenuPane* aMenuPane )
+    {
+    ACPLOG( "CAcpProviderListView::DynInitMenuPaneL begin" );
+
+    if ( R_ACP_PROVIDER_LIST_MENU == aResourceId &&
+        iController->CountOfProviders() == 0 )  
+        {
+        aMenuPane->SetItemDimmed( EAknSoftkeySelect, ETrue );
+        aMenuPane->SetItemDimmed( EAcpDownload, ETrue );
+        }
+
+    ACPLOG( "CAcpProviderListView::DynInitMenuPaneL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::DialogDismissed
+// From MAcpDialogObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::DialogDismissedL( TInt aError )
+    {
+    ACPLOG2( "CAcpProviderListView::DialogDismissed (%d)", aError );
+
+    iDialog->DestroyWaitNote();
+
+    if ( KErrNotFound == aError ) // Canceled.
+        {
+        iController->CancelHttpRequest();
+        }
+    
+    // If launched from active idle.
+    if ( iLaunchedFromAI )
+        {
+        ACPLOG( "CAcpProviderListView::DialogDismissed - EXIT" );
+        
+        AppUi()->HandleCommandL( EEikCmdExit );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListContainer::NotifyProviderListReady
+// From MAcpControllerObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::NotifyProviderListReady( TInt aError )
+    {
+    ACPLOG2( 
+        "CAcpProviderListView::NotifyProviderListReady: err=%d", aError );
+
+    // Always remove wait dialog from screen.
+    iDialog->DestroyWaitNote();
+
+    if ( KErrNone == aError )
+        {
+        // List loaded, it's ok to activate the view now.
+        TRAP_IGNORE( iUi->ActivateLocalViewL( Id() ) );
+        
+        if ( iContainer )
+            {
+            TRAP_IGNORE( iContainer->AddProvidersToListboxL() );
+            }
+        }
+    else if ( KErrCancel == aError )
+        {
+        // No action needed.
+        }
+    else
+        {
+        if ( iConnectingToServer )
+            {
+            // Failed connecting to NSA server.
+            TRAP_IGNORE( iDialog->ShowGlobalNoteL( R_ACP_CONNECTION_FAILED ) );
+            }
+        else
+            {
+            // Failed downloading SIS/wbxml file.
+            TRAP_IGNORE( iDialog->ShowGlobalNoteL( R_ACP_DOWNLOAD_FAILED,
+                *iServiceName ) );
+            }
+        }
+    
+    // Launched from active idle.
+    if ( KErrNone != aError && iLaunchedFromAI )
+        {
+        ACPLOG( " - Launched from AI, exit." );
+        TRAP_IGNORE( AppUi()->ProcessCommandL( EAknCmdExit ) );
+        }
+    
+    iConnectingToServer = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::NotifyDownloadingCompleted
+// From MAcpControllerObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::NotifyDownloadingCompleted( TInt aError )
+    {
+    ACPLOG( "CAcpProviderListView::NotifyDownloadingCompleted - IN" );
+    
+    // Destroy wait note if timer is not active
+    if ( !iTimer->IsActive() )
+        {
+        iDialog->DestroyWaitNote();
+        }
+    
+    // Show error note if needed.
+    if ( KErrNone != aError )
+        {
+        TRAP_IGNORE( iDialog->ShowGlobalNoteL( R_ACP_DOWNLOAD_FAILED,
+            *iServiceName ) );
+        } 
+    
+    ACPLOG( "CAcpProviderListView::NotifyDownloadingCompleted - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::NotifyDownloadingSISCompleted
+// From MAcpControllerObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::NotifyDownloadingSISCompleted( TDesC& aFileName )
+    {
+    ACPLOG( "CAcpProviderListView::NotifyDownloadingSISCompleted - IN" );
+    
+    iTimer->StopTimer();
+    iDialog->DestroyWaitNote();
+    iObserver.NotifySISDownloaded( aFileName );
+    
+    ACPLOG( "CAcpProviderListView::NotifyDownloadingSISCompleted - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::NotifyProvisioningCompleted
+// From MAcpControllerObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::NotifyProvisioningCompleted()
+    {
+    ACPLOG( "CAcpProviderListView::NotifyProvisioningCompleted" );
+
+    // Keep dialog in screen for additional time to give tab time
+    // to shut down phonebook before attempting to open it again.
+    iTimer->StartTimer(  CAcpTimer::EPhonebookStartupDelayTimer );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::DoNotifyProvisioningCompletedL
+// Informs that service settings have been saved.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::DoNotifyProvisioningCompletedL()
+    {
+    ACPLOG( "CAcpProviderListView::DoNotifyProvisioningCompletedL begin" );
+            
+    ACPLOG( "   --> get new service id" );
+    
+    // Get service id of the newly provisioned service.
+    RArray<TServiceId> newServiceIds;
+    CleanupClosePushL( newServiceIds );
+    iSpSettings->FindServiceIdsL( newServiceIds );
+    
+    TServiceId serviceId( 0 );
+    for ( TInt i = 0; i < newServiceIds.Count(); i++ )
+        {
+        if ( KErrNotFound == iServiceIds.Find( newServiceIds[i] ) )
+            {
+            ACPLOG( "   --> new service id found" );
+            
+            serviceId = newServiceIds[i];
+            break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &newServiceIds );
+    
+    if ( !serviceId )
+        {
+        ACPLOG( " - no new service id found" );
+        // Remove wait note and leave
+        iDialog->DestroyWaitNote();
+        User::Leave( KErrNotFound );
+        }
+    
+    // Get new view id
+    TInt err( KErrNone );
+    TInt tabViewCount( 0 );
+    TInt newTabViewId( 0 );
+    RArray<TInt32> tabViewIds;
+    CleanupClosePushL( tabViewIds );
+    
+    ACPLOG( " - open view services" );
+    
+    err = iXspViewServices.Open();
+    
+    ACPLOG2( " - open view services ERR=%d", err );
+         
+    err = iXspViewServices.GetViewCount( tabViewCount );
+    
+    ACPLOG2( " - get view count: %d", tabViewCount );
+        
+    for( TInt i( 0 ) ; i < tabViewCount && !err ; i++ )
+        {
+        TInt bufferLength( 0 );
+        err = iXspViewServices.GetPackedViewDataBufferLength(
+                i, bufferLength );
+            
+        if( !err && bufferLength > 0 )
+            {
+            HBufC8* packed = HBufC8::NewLC( bufferLength );
+            TPtr8 packedPtr = packed->Des();
+                
+            err = iXspViewServices.GetPackedViewData( i, packedPtr );
+                
+            if( !err )
+                {     
+                CxSPViewData* viewData = CxSPViewData::NewL( *packed );
+                CleanupStack::PushL( viewData );
+                    
+                ACPLOG2( "  --> VIEW ID: %d", viewData->OriginalViewId() );
+                    
+                tabViewIds.AppendL( viewData->OriginalViewId() );
+                CleanupStack::PopAndDestroy( viewData );    
+                }                                               
+            CleanupStack::PopAndDestroy( packed );
+            }
+        }
+    
+    for ( TInt i = 0; i < tabViewIds.Count(); i++ )
+        {
+        if ( KErrNotFound == iTabViewIds.Find( tabViewIds[ i ] ) )
+            {
+            ACPLOG( "   --> new tab view id found" );
+                
+            newTabViewId = tabViewIds[ i ];
+            break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &tabViewIds );
+    
+    if ( !newTabViewId )
+        {
+        ACPLOG( " - no new tab view id found" );
+        // Remove wait note and leave
+        iDialog->DestroyWaitNote();
+        User::Leave( KErrNotFound );
+        }
+     
+    // Save account creation URL for the service.
+    SaveAccountCreationUrlL( serviceId );
+               
+    // Remove wait note
+    iDialog->DestroyWaitNote();
+    
+    // Show message query that informs service is installed
+    if ( iLaunchedFromAI )
+        {
+        // If service installation was started from service widget
+        // in homescreen.       
+        iDialog->ShowMessageQueryL( 
+            R_ACP_SERVICE_INSTALLED_FROM_WIDGET_NOTE,
+            *iServiceName );
+        }
+    else
+        {
+        iDialog->ShowGlobalNoteL( 
+            R_ACP_SERVICE_INSTALLED_NOTE,
+            *iServiceName );
+        }
+         
+    err = iXspViewServices.Activate( KPhoneBookTabUid.iUid, newTabViewId );
+    
+    ACPLOG2( " - activate phonebook tab ERR=%d", err );
+    User::LeaveIfError( err );
+    
+    iXspViewServices.Close();
+    
+    ACPLOG( "CAcpProviderListView::DoNotifyProvisioningCompletedL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::SaveAccountCreationUrlL
+// For saving account creation url to rcse.
+// ---------------------------------------------------------------------------
+// 
+void CAcpProviderListView::SaveAccountCreationUrlL( TUint aServiceId )
+    {
+    TBuf8<KMaxUrlLength> creationUrl;
+       
+    // Get activation URL. Insert session id if needed.
+    if ( iController->SessionId().Length() )
+        {
+        // Change http://address?param=value to
+        //        http://adress;jsessionid=[sessionid]?param=value
+
+        TPtrC8 provCreUrl = iController->
+            ProviderCreationUrlFromIndexL( iController->ActiveIndex() );
+           
+        if ( KErrNotFound == provCreUrl.Find( KSessionId ) )
+            {
+            // Find ? and insert the session id part before it.
+            TInt qmIndex = provCreUrl.Find( KQuestionMark8 );
+            if ( KErrNotFound != qmIndex )
+                {
+                creationUrl.Append( provCreUrl.Mid( 0, qmIndex ) );
+                creationUrl.Append( KSessionId );
+                creationUrl.Append( iController->SessionId() );
+                creationUrl.Append( provCreUrl.Mid( qmIndex ) );
+                }
+            }
+        else
+            {
+            creationUrl.Copy( provCreUrl );
+            }
+        }
+       
+    CRCSEProfileRegistry* rcseRegistry = CRCSEProfileRegistry::NewLC();
+    RPointerArray<CRCSEProfileEntry> entries;
+    CleanupStack::PushL( TCleanupItem( CleanupResetAndDestroy, &entries ) );
+       
+    rcseRegistry->FindByServiceIdL( aServiceId, entries );
+    if ( entries.Count() )
+        {
+        CRCSEProfileEntry* entry = entries[0];
+        entry->iAccountCreationUrl.Copy( creationUrl );
+           
+        rcseRegistry->UpdateL( entry->iId, *entry );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+       
+    CleanupStack::PopAndDestroy( 2, rcseRegistry );
+    }
+    
+// ---------------------------------------------------------------------------
+// From MAcpControllerObserver.
+// NotifySettingsSaved
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::NotifySettingsSaved()
+    {
+    ACPLOG( "CAcpProviderListView::NotifySettingsSaved" );
+
+    if ( !iTimer->IsActive() || !iDialog->IsActive() )
+        {
+        // Close only if timer is not active, if active
+        // message query is being shown. Closing will be done when user
+        // dismissed query.
+        
+        ACPLOG( "CAcpProviderListView::NotifySettingsSaved - EXIT" );
+        
+        TRAP_IGNORE( AppUi()->ProcessCommandL( EAknCmdExit ) )
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MAcpTimerObserver.
+// TimerExpired
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderListView::TimerExpired()
+    {
+    ACPLOG( "CAcpProviderListView::TimerExpired" );
+        
+    // Handle provisioning completed
+    TRAPD( err, DoNotifyProvisioningCompletedL() )
+    
+    if ( err )
+        {
+        ACPLOG2( "CAcpProviderListView::TimerExpired - ERR=%d", err );
+        
+        TRAP_IGNORE( AppUi()->ProcessCommandL( EAknCmdExit ) )
+        }
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/src/acpproviderspecificcontainer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,447 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CAcpProviderSpecificContainer methods
+*
+*/
+
+
+#include <aknlists.h>
+#include <StringLoader.h>
+#include <accountcreationplugin.rsg>
+// SKIN: includes
+#include <AknsDrawUtils.h>
+#include <AknsBasicBackgroundControlContext.h>
+#include <gdi.h>
+
+#include "acpproviderspecificcontainer.h"
+#include "accountcreationpluginlogger.h"
+#include "accountcreationpluginconstants.h"
+#include "acpcontroller.h"
+
+const TInt KComponentControlCount = 6;
+const TInt KScrollMin = -200;
+const TInt KScrollMax = 10;
+const TInt KEight = 8;
+const TInt KPositionX = 10;
+const TInt KScrollSpeed = 10;
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::CAcpProviderSpecificContainer
+// ---------------------------------------------------------------------------
+//
+CAcpProviderSpecificContainer::CAcpProviderSpecificContainer( 
+    CAcpController& aController )
+    : iController( aController ), iScrollY( KScrollMax )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderSpecificContainer::ConstructL( const TRect& aRect )
+    {
+    ACPLOG( "CAcpProviderSpecificContainer::ConstructL begin" );
+
+    CreateWindowL();
+
+    // Skin background.
+    //SKIN: create the skin context for our control
+    iBgContext = CAknsBasicBackgroundControlContext::NewL( 
+        KAknsIIDQsnBgAreaMain, aRect, ETrue );
+
+    // Provider.
+    TInt index = iController.ActiveIndex();
+    TPtrC providerName = iController.ProviderNameFromIndexL( index );
+    TPtrC providerType = iController.ProviderTypeFromIndexL( index );
+    TPtrC providerDescription = 
+        iController.ProviderDescriptionFromIndexL( index );
+    
+    // Name label.
+    iLabel = new (ELeave) CEikLabel;
+    iLabel->SetContainerWindowL( *this );
+    HBufC* typeText;
+    typeText = StringLoader::LoadLC( R_SERVTAB_CD_DETAIL_NAME );
+    iLabel->SetTextL( *typeText );
+    CleanupStack::PopAndDestroy( typeText );
+
+    // Type label.
+    iLabel2 = new (ELeave) CEikLabel;
+    iLabel2->SetContainerWindowL( *this );
+    HBufC* typeText2;
+    typeText2 = StringLoader::LoadLC( R_SERVTAB_CD_DETAIL_TYPE );
+    iLabel2->SetTextL( *typeText2 );
+    CleanupStack::PopAndDestroy( typeText2 );
+
+    // Description label
+    iLabel3 = new (ELeave) CEikLabel;
+    iLabel3->SetContainerWindowL( *this );
+    HBufC* typeText3;
+    typeText3 = StringLoader::LoadLC( R_SERVTAB_CD_DETAIL_DESCRIPTION );
+    iLabel3->SetTextL( *typeText3 );
+    CleanupStack::PopAndDestroy( typeText3 ); 
+
+    // Edwin for name.
+    TResourceReader reader; 
+    iCoeEnv->CreateResourceReaderLC( reader, R_ACP_TYPE );
+    iEdwin = new (ELeave) CEikEdwin;
+    iEdwin->SetContainerWindowL( *this );
+    iEdwin->ConstructFromResourceL( reader );       
+    CleanupStack::PopAndDestroy();
+    if ( !providerName.Length() )
+    	{
+    	HBufC* typeText6;
+        typeText6 = StringLoader::LoadLC( R_SERVTAB_CD_VALUE_UNDEFINED );
+        iEdwin->SetTextL( typeText6 );
+        CleanupStack::PopAndDestroy( typeText6 );
+    	}
+    else
+        {
+    	iEdwin->SetTextL( &providerName );
+        }
+
+    // Edwin for type.
+    TResourceReader reader2; 
+    iCoeEnv->CreateResourceReaderLC( reader2, R_ACP_TYPE );
+    iEdwin2 = new (ELeave) CEikEdwin;
+    iEdwin2->SetContainerWindowL( *this );
+    iEdwin2->ConstructFromResourceL( reader2 );       
+    CleanupStack::PopAndDestroy();
+    if ( !providerType.Length() )
+    	{
+    	HBufC* typeText7;
+        typeText7 = StringLoader::LoadLC( R_SERVTAB_CD_VALUE_UNDEFINED );
+        iEdwin2->SetTextL( typeText7 );
+        CleanupStack::PopAndDestroy( typeText7 );
+    	}
+    else
+        {
+    	iEdwin2->SetTextL( &providerType );
+        }
+
+    // Edwin for description.
+    TResourceReader reader3; 
+    iCoeEnv->CreateResourceReaderLC( reader3, R_ACP_TYPE );
+    iEdwin3 = new (ELeave) CEikEdwin;
+    iEdwin3->SetContainerWindowL( *this );
+    iEdwin3->ConstructFromResourceL( reader3 );       
+    CleanupStack::PopAndDestroy();
+    if ( !providerDescription.Length() )
+    	{
+    	HBufC* typeText8;
+        typeText8 = StringLoader::LoadLC( R_SERVTAB_CD_VALUE_UNDEFINED );
+        iEdwin3->SetTextL( typeText8 );
+        CleanupStack::PopAndDestroy( typeText8 );
+    	}
+    else
+        {
+    	iEdwin3->SetTextL( &providerDescription );
+        }
+    
+    // Get label colours from skin.
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TRgb color( 0, 0, 0 );
+    
+    AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors,
+        EAknsCIQsnTextColorsCG6 );
+    iLabel->OverrideColorL( EColorLabelText, color );
+    iLabel->SetEmphasis( CEikLabel::ENoEmphasis );
+    iLabel2->OverrideColorL(EColorLabelText, color );
+    iLabel2->SetEmphasis( CEikLabel::ENoEmphasis );
+    iLabel3->OverrideColorL(EColorLabelText, color );
+    iLabel3->SetEmphasis( CEikLabel::ENoEmphasis );
+    
+    CCharFormatLayer* formatLayer = CEikonEnv::NewDefaultCharFormatLayerL();
+    CleanupStack::PushL( formatLayer );
+    
+    TCharFormat format;
+    TCharFormatMask formatMask;
+    formatLayer->Sense( format, formatMask );
+    format.iFontPresentation.iTextColor = color;
+    formatMask.SetAttrib( EAttColor );
+    formatLayer->SetL( format, formatMask );
+    
+    iEdwin->SetCharFormatLayer( formatLayer->CloneL() );
+    iEdwin2->SetCharFormatLayer( formatLayer->CloneL() );
+    
+    CleanupStack::Pop( formatLayer );
+    iEdwin3->SetCharFormatLayer( formatLayer );
+        
+    SetRect( aRect );
+    ActivateL();
+
+    ACPLOG( "CAcpProviderSpecificContainer::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::NewL
+// ---------------------------------------------------------------------------
+//      
+CAcpProviderSpecificContainer* CAcpProviderSpecificContainer::NewL( 
+    CAcpController& aController,
+    const TRect& aRect )
+    {    
+    CAcpProviderSpecificContainer* self = 
+        CAcpProviderSpecificContainer::NewLC( aController, aRect );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::NewLC
+// ---------------------------------------------------------------------------
+//
+CAcpProviderSpecificContainer* CAcpProviderSpecificContainer::NewLC(
+    CAcpController& aController,
+    const TRect& aRect )
+    {    
+    CAcpProviderSpecificContainer* self = 
+        new ( ELeave ) CAcpProviderSpecificContainer( aController );
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::~CAcpProviderSpecificContainer
+// ---------------------------------------------------------------------------
+//
+CAcpProviderSpecificContainer::~CAcpProviderSpecificContainer()
+    {
+    ACPLOG( 
+      "CAcpProviderSpecificContainer::~CAcpProviderSpecificContainer begin" );
+
+    delete iLabel;
+    delete iLabel2;
+    delete iLabel3;
+    delete iEdwin;
+    delete iEdwin2;    
+    delete iEdwin3;
+    delete iBgContext;
+
+    ACPLOG( 
+        "CAcpProviderSpecificContainer::~CAcpProviderSpecificContainer end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::ComponentControl
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CAcpProviderSpecificContainer::ComponentControl( 
+    TInt aIndex ) const
+    {
+    const TInt KZeroCase  = 0;
+    const TInt KOneCase   = 1;
+    const TInt KTwoCase   = 2;
+    const TInt KThreeCase = 3;
+    const TInt KFourCase  = 4;
+    const TInt KFiveCase  = 5;
+
+    switch ( aIndex )
+        {
+            case KZeroCase:
+                return iLabel;
+            case KOneCase:
+                return iLabel2;
+    		case KTwoCase:
+    			return iLabel3;
+    		case KThreeCase:
+    			return iEdwin;
+    		case KFourCase:
+    			return iEdwin2;	
+    		case KFiveCase: 
+    			return iEdwin3;
+            default:
+                return NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::MopSupplyObject
+// From class CCoeControl.
+// SKIN: pass context to child controls.
+// ---------------------------------------------------------------------------
+//
+TTypeUid::Ptr CAcpProviderSpecificContainer::MopSupplyObject( TTypeUid aId )
+    {
+    if ( iBgContext )
+        {
+        return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+        }
+    return CCoeControl::MopSupplyObject( aId );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::Draw
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderSpecificContainer::Draw( const TRect& aRect ) const
+    {
+    // Get the standard graphics context.
+    CWindowGc& gc = SystemGc();
+
+    // Draw skin backgound.
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+  	MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+    AknsDrawUtils::Background( skin, cc, this, gc, aRect );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::CountComponentControls
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+TInt CAcpProviderSpecificContainer::CountComponentControls() const
+    {
+    return KComponentControlCount;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::SizeChanged
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderSpecificContainer::SizeChanged()
+    {
+    RepositionLabels();
+
+    // Redraw the control.
+    DrawDeferred();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::HandleResourceChange
+// From class CCoeControl.
+// Called by framework when layout is changed.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderSpecificContainer::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType );
+
+    // *****************************
+    // ADDED FOR SCALABLE UI SUPPORT
+    // *****************************
+    if ( KEikDynamicLayoutVariantSwitch == aType )
+        {
+        TRect rect;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
+        SetRect( rect );
+        iBgContext->SetRect( rect );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::ScrollText
+// Scrolls text labels up or down.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderSpecificContainer::ScrollText( TInt aDelta )
+    {
+    ACPLOG( "CAcpProviderSpecificContainer::ScrollText begin" );
+    
+    iScrollY += aDelta;
+    if ( iScrollY > KScrollMax ) 
+        {
+        iScrollY = KScrollMax;
+        }
+    else if ( iScrollY < KScrollMin )
+        {
+        iScrollY = KScrollMin;
+        }
+    
+    RepositionLabels();
+    
+    // Redraw the control.
+    DrawDeferred();
+    
+    ACPLOG( "CAcpProviderSpecificContainer::ScrollText end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::RepositionLabels
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderSpecificContainer::RepositionLabels()
+    {
+    const TInt KWidthX = Rect().Width() - KPositionX;
+    const TInt KDeltaY = Rect().Height() / KEight;
+    
+    TInt yPos = iScrollY;
+    iLabel->SetExtent( TPoint( KPositionX, yPos ), 
+        TSize( KWidthX, KDeltaY ) );
+    yPos += KDeltaY;
+
+    iEdwin->SetExtent( TPoint( KPositionX, yPos ), 
+        TSize( KWidthX, KDeltaY ) );
+    yPos += KDeltaY;
+
+    iLabel2->SetExtent( TPoint( KPositionX, yPos ), 
+        TSize( KWidthX, KDeltaY ) );
+    yPos += KDeltaY;
+
+    iEdwin2->SetExtent( TPoint( KPositionX, yPos ), 
+        TSize( KWidthX, KDeltaY ) );
+    yPos += KDeltaY;
+
+    iLabel3->SetExtent( TPoint( KPositionX, yPos ), 
+        TSize( KWidthX, KDeltaY ) );
+    yPos += KDeltaY;
+
+    iEdwin3->SetExtent( TPoint( KPositionX, yPos ), 
+        TSize( KWidthX, Rect().Height() ) );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificContainer::OfferKeyEventL
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CAcpProviderSpecificContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    ACPLOG( "CAcpProviderSpecificContainer::OfferKeyEventL begin" );
+    
+    TKeyResponse ret = EKeyWasNotConsumed;
+    
+    switch ( aKeyEvent.iScanCode )
+        {
+        case EStdKeyUpArrow:
+            if ( aType != EEventKeyUp )
+                {
+                ScrollText( KScrollSpeed );
+                ret = EKeyWasConsumed;
+                }
+            break;
+            
+        case EStdKeyDownArrow:
+            if ( aType != EEventKeyUp )
+                {
+                ScrollText( -KScrollSpeed );
+                ret = EKeyWasConsumed;
+                }
+            break;
+            
+        default:
+            break;
+        }
+    
+    ACPLOG( "CAcpProviderSpecificContainer::OfferKeyEventL end" );
+    return ret;
+    }
+
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/src/acpproviderspecificview.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CAcpProviderSpecificView methods
+*
+*/
+
+
+#include <aknlists.h>
+#include <akntitle.h>
+#include <akncontext.h> 
+#include <aknViewAppUi.h>
+#include <StringLoader.h>
+#include <accountcreationplugin.rsg>
+// Help launcher
+#include <hlplch.h> 
+
+#include "acpdialog.h"
+#include "acpcontroller.h"
+#include "acpproviderlistview.h"
+#include "acpproviderspecificview.h"
+#include "acpproviderspecificcontainer.h"
+#include "accountcreationpluginlogger.h"
+#include "accountcreationplugin.hrh"
+
+// ---------------------------------------------------------------------------
+// AcpProviderSpecificView::CAcpProviderSpecificView
+// ---------------------------------------------------------------------------
+//
+CAcpProviderSpecificView::CAcpProviderSpecificView(
+    CAcpController& aController, CAcpProviderListView& aProviderListView )
+    : iController( aController ), iProviderListView( aProviderListView )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificView::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderSpecificView::ConstructL()
+    {
+    ACPLOG( "CAcpProviderSpecificView::ConstructL begin" );
+
+    iUi = static_cast<CAknViewAppUi*>( static_cast<CAknAppUi*> 
+        ( iCoeEnv->AppUi() ) );
+
+    BaseConstructL( R_ACP_PROVIDER_SPECIFIC_VIEW );
+
+    ACPLOG( "CAcpProviderSpecificView::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificView::NewL
+// ---------------------------------------------------------------------------
+//      
+CAcpProviderSpecificView* CAcpProviderSpecificView::NewL(
+    CAcpController& aController, CAcpProviderListView& aProviderListView )
+    {    
+    CAcpProviderSpecificView* self = 
+        CAcpProviderSpecificView::NewLC( aController, aProviderListView );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificView::NewLC
+// ---------------------------------------------------------------------------
+//
+CAcpProviderSpecificView* CAcpProviderSpecificView::NewLC(
+    CAcpController& aController, CAcpProviderListView& aProviderListView )
+    {    
+    CAcpProviderSpecificView* self = 
+        new ( ELeave ) CAcpProviderSpecificView( 
+        aController, aProviderListView );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificView::~CAcpProviderSpecificView
+// ---------------------------------------------------------------------------
+//
+CAcpProviderSpecificView::~CAcpProviderSpecificView()
+    {
+    ACPLOG( "CAcpProviderSpecificView::~CAcpProviderSpecificView begin" );
+
+    // Delete container when view is deactivated.
+    if ( iContainer && iUi )
+        {
+        iUi->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+
+    ACPLOG( "CAcpProviderSpecificView::~CAcpProviderSpecificView end" );
+    }         
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificView::SetTitlePaneTextL
+// For changing text to the title pane.
+// ---------------------------------------------------------------------------
+// 
+void CAcpProviderSpecificView::SetTitlePaneTextL( const TDesC& aText ) const
+    {
+    // Get handle to title pane.
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+
+    if ( statusPane )
+        {
+        CAknTitlePane* titlePane =
+            static_cast<CAknTitlePane*> ( statusPane->ControlL(
+                TUid::Uid( EEikStatusPaneUidTitle ) ) );
+
+            titlePane->SetTextL( aText ); // Set text. 
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificView::Id
+// From CAknView.
+// ---------------------------------------------------------------------------
+//
+TUid CAcpProviderSpecificView::Id() const
+    {
+    return KProviderSpecificViewId;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificView::HandleCommandL
+// From CEikAppUi.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderSpecificView::HandleCommandL( TInt aCommand )
+    {
+    ACPLOG2( "CAcpProviderSpecificView::HandleCommandL: cmd=%d", aCommand );
+
+    switch ( aCommand )
+        {
+        case EAknSoftkeySelect:
+            { 
+            iProviderListView.ProvisioningL();         
+            }
+            break;
+        case EAcpDownload:
+            {
+            iProviderListView.ProvisioningL();  
+            }
+            break;
+        case EAknSoftkeyCancel:
+            iUi->ActivateLocalViewL( KProviderListViewId );
+            break;
+        case EEikCmdExit:
+        case EAknSoftkeyExit:
+            iUi->HandleCommandL( aCommand );
+            break;
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificView::DoActivateL
+// From CAknView.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderSpecificView::DoActivateL( 
+    const TVwsViewId& /*aPrevViewId*/, 
+    TUid /*aCustomMessageId*/,
+    const TDesC8& /*aCustomMessage*/ )
+    {
+    ACPLOG( "CAcpProviderSpecificView::DoActivateL begin" );
+
+    // Create container when view is activated.
+    if ( !iContainer )
+        {
+        iContainer = CAcpProviderSpecificContainer::NewL(
+            iController, ClientRect() );
+        iContainer->SetMopParent( this );
+        iUi->AddToStackL( *this, iContainer );
+        }
+
+    // Set provider specific name to title pane.
+    TInt index = iController.ActiveIndex();
+    SetTitlePaneTextL( iController.ProviderNameFromIndexL( index ) );
+
+    ACPLOG( "CAcpProviderSpecificView::DoActivateL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificView::DoDeactivate()
+// From CAknView.
+// ---------------------------------------------------------------------------
+//
+void CAcpProviderSpecificView::DoDeactivate()
+    {
+    ACPLOG( "CAcpProviderSpecificView::DoDeactivate begin" );
+
+    // Delete container when view is deactivated.
+    if ( iContainer )
+        {
+        iUi->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+
+    ACPLOG( "CAcpProviderSpecificView::DoDeactivate end" );
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/src/acpquerycontainer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,424 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CAcpProviderSpecificContainer methods
+*
+*/
+
+
+#include <aknlists.h>
+#include <stringloader.h>
+#include <accountcreationplugin.rsg>
+#include <AknTextSettingPage.h>
+#include <AknPasswordSettingPage.h>
+
+#include "acpqueryview.h"
+#include "acpquerycontainer.h"
+#include "accountcreationpluginlogger.h"
+#include "accountcreationpluginconstants.h"
+
+const TInt KComponentControlCount = 1;
+_LIT( KAsterisks, "****" );
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::CAcpQueryContainer
+// ---------------------------------------------------------------------------
+//
+CAcpQueryContainer::CAcpQueryContainer()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryContainer::ConstructL( const TRect& aRect )
+    {
+    ACPLOG( "CAcpQueryContainer::ConstructL begin" );
+
+    // Load "none" from resources to further use.
+    iNone = StringLoader::LoadL( R_ACP_SETTING_PAGE_EMPTY_TEXT );
+
+    // Default values for setting item texts.
+    iUsername.Copy( *iNone );
+    iPassword.Copy( *iNone );
+
+    CreateWindowL();
+    ConstructListBoxL();
+    SetRect( aRect );
+    ActivateL();
+
+    ACPLOG( "CAcpQueryContainer::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::NewL
+// ---------------------------------------------------------------------------
+//      
+CAcpQueryContainer* CAcpQueryContainer::NewL( const TRect& aRect )
+    {    
+    CAcpQueryContainer* self = CAcpQueryContainer::NewLC( aRect );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::NewLC
+// ---------------------------------------------------------------------------
+//
+CAcpQueryContainer* CAcpQueryContainer::NewLC( const TRect& aRect )
+    {    
+    CAcpQueryContainer* self = new ( ELeave ) CAcpQueryContainer();
+    CleanupStack::PushL( self );
+    self->ConstructL( aRect );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::~CAcpQueryContainer
+// ---------------------------------------------------------------------------
+//
+CAcpQueryContainer::~CAcpQueryContainer()
+    {
+    ACPLOG( "CAcpQueryContainer::~CAcpQueryContainer begin" );
+    delete iNone;
+    delete iListBox;
+    ACPLOG( "CAcpQueryContainer::~CAcpQueryContainer end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::ListBox
+// Returns handle to the listbox.
+// ---------------------------------------------------------------------------
+//    
+CAknSettingStyleListBox* CAcpQueryContainer::ListBox()
+    {
+    return iListBox;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::CurrentItemIndex
+// Returns index of selected listbox item. 
+// ---------------------------------------------------------------------------
+//
+TInt CAcpQueryContainer::CurrentItemIndex() const
+    {
+    return iListBox->CurrentItemIndex();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::ShowUsernameSettingPageL
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryContainer::ShowUsernameSettingPageL()
+    {
+    ACPLOG( "CAcpQueryContainer::ShowUsernameSettingPageL" );
+
+    // Show text setting page.
+    TBuf<KAcpTextPageLength> temporaryText ( iUsername );
+    CAknTextSettingPage* dlg = new(ELeave) CAknTextSettingPage(
+        R_ACP_USERNAME_SETTING_PAGE, temporaryText );
+    if ( dlg->ExecuteLD(CAknSettingPage::EUpdateWhenAccepted ) )
+        {
+        iUsername.Copy( temporaryText );
+        }
+    // Update currently selected list item.
+    UpdateListboxItemL( CurrentItemIndex() );     
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::ShowPwordSettingPageL
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryContainer::ShowPwordSettingPageL()
+    {
+    ACPLOG( "CAcpQueryContainer::ShowPwordSettingPageL" );
+
+    // Show password setting page.
+    TBuf<KAcpPasswordPageLength> temporaryPassword ( KNullDesC );
+    temporaryPassword.Copy( iPassword );
+    TBuf<KAcpPasswordPageLength> oldPassword ( KNullDesC );
+    temporaryPassword.Copy( iPassword );
+    
+    CAknSettingPage* dlg = new (ELeave) CAknAlphaPasswordSettingPage(
+        R_ACP_PASSWORD_SETTING_PAGE, temporaryPassword, oldPassword );
+    if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted ) )
+        {
+        iPassword.Copy( temporaryPassword );
+        } 
+    // Update currently selected list item.
+    UpdateListboxItemL( CurrentItemIndex() );     
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::GetContainerDataL
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryContainer::GetContainerDataL( TDes& aUsername, TDes& aPassword )
+    {
+    // Setting item: Server username.
+    if ( aUsername.Length() > iUsername.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+    aUsername.Copy( iUsername );
+
+    // Setting item: Server password.
+    if ( aPassword.Length() > iPassword.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+    if ( iPassword.Compare( *iNone ) )
+        {
+        aPassword.Copy( iPassword );
+        }
+
+    ACPLOG( "GetContainerDataL, Items appended" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::ConstructListBoxL
+// Creates listbox item for provider list items.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryContainer::ConstructListBoxL()
+    {
+    ACPLOG( "CAcpQueryContainer::ConstructListBoxL begin" );
+
+    // Create listbox and array for listbox items.
+    iListBox = new( ELeave ) CAknSettingStyleListBox;
+    iListBox->ConstructL( this, EAknListBoxSelectionList );    
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+        CEikScrollBarFrame::EOff, 
+        CEikScrollBarFrame::EAuto );
+    iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray );
+
+    CDesCArrayFlat* array = new ( ELeave ) CDesCArrayFlat( KArrayGranuality );  
+    iListBox->Model()->SetItemTextArray( array );
+
+    // Fill container listbox with setting items.
+    FillListboxWithItemsL();
+
+    // Set listbox index to first item and draw.
+    iListBox->HandleItemAdditionL();
+    iListBox->SetCurrentItemIndexAndDraw( 0 );
+
+    ACPLOG( "CAcpQueryContainer::ConstructListBoxL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::FillListboxWithItemsL
+// Fills listbox with items.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryContainer::FillListboxWithItemsL()
+    {
+    ACPLOG("CAcpQueryContainer::FillListboxWithItemsL");
+
+    // Get listbox items from model.
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+    TBuf<KAcpSettingItemLength> listBoxItemText ( KNullDesC );          
+
+    // Setting item: Server username.
+    HBufC* caption = StringLoader::LoadLC( R_ACP_USERNAME_SETTING_PAGE_TEXT );
+    listBoxItemText.Format(
+        KAcpSettingItemTextFormat,
+        caption,
+        &iUsername );          
+    listBoxItems->AppendL( listBoxItemText );
+    CleanupStack::PopAndDestroy( caption );    
+    ACPLOG( "FillListboxWithItemsL: Server username appended." );
+
+    // Setting item: Server password.
+    caption = StringLoader::LoadLC( R_ACP_PASSWORD_SETTING_PAGE_TEXT );
+    listBoxItemText.Format(
+        KAcpSettingItemTextFormat,
+        caption,
+        &iPassword );          
+    listBoxItems->AppendL( listBoxItemText );
+    CleanupStack::PopAndDestroy( caption );    
+    ACPLOG( 
+        "CAcpQueryContainer::FillListboxWithItemsL: Server password appended." 
+        );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::UpdateListboxItemL
+// Updates setting page items.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryContainer::UpdateListboxItemL( const TInt aIndex )
+    {
+    ACPLOG("CAcpQueryContainer::UpdateListboxItemL begin");
+
+    // Get listbox items from model.
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>( textArray );
+
+    // Remove edited item from the list.
+    listBoxItems->Delete( aIndex );
+
+    // Fill line variables with correct data.
+    TBuf<KAcpSettingItemLength> firstLine( KNullDesC );
+    TBuf<KAcpSettingItemLength> secondLine( KNullDesC );
+    TBuf<KAcpSettingItemLength> listBoxItemText( KNullDesC );          
+    FillListboxItemDataL( aIndex, firstLine, secondLine );
+
+    // Create new lisbox item data and insert it to correct place.
+    listBoxItemText.Format(
+        KAcpSettingItemTextFormat,
+        &firstLine,
+        &secondLine );
+    listBoxItems->InsertL( aIndex, listBoxItemText );
+
+    // Update listbox.
+    iListBox->HandleItemAdditionL(); 
+
+    ACPLOG( "CAcpQueryContainer::UpdateListboxItemL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::FillListboxItemDataL
+// Sets selected listbox item with member data.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryContainer::FillListboxItemDataL( const TInt aIndex,
+    TDes& aFirstLine, TDes& aSecondLine )
+    {
+    HBufC* caption = NULL;
+    switch ( aIndex )
+        {
+        // Setting item: Server username.
+        case CAcpQueryView::EAcpGenericUsername:
+            caption = StringLoader::LoadL( R_ACP_USERNAME_SETTING_PAGE_TEXT );
+            aFirstLine.Copy( caption->Des() );
+            delete caption;
+            aSecondLine.Copy( iUsername );
+            break;
+        // Setting item: Server password.
+        case CAcpQueryView::EAcpGenericPassword:
+            caption = StringLoader::LoadL( R_ACP_PASSWORD_SETTING_PAGE_TEXT );
+            aFirstLine.Copy( caption->Des() );
+            delete caption;
+            // Show asterisks instead of the password.
+            if ( iPassword.Length() )
+                {
+                aSecondLine.Copy( KAsterisks );
+                }
+            else
+                {
+                aSecondLine.Copy( *iNone );
+                }
+            break;
+        default:
+            User::Leave( KErrNotSupported );
+            break;
+        }
+
+    ACPLOG( "CAcpQueryContainer::FillListboxItemDataL" );
+    ACPLOG2( "FillListboxItemDataL: List item filled: %d", aIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::OfferKeyEventL
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CAcpQueryContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    TKeyResponse response = EKeyWasNotConsumed;
+    if ( aType == EEventKey )
+        {
+        response = iListBox->OfferKeyEventL( aKeyEvent, aType );
+        }
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::ComponentControl
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CAcpQueryContainer::ComponentControl( TInt aIndex ) const
+    {
+    switch ( aIndex )
+        {
+        case 0 :
+            return iListBox;
+        default:
+            return 0;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::CountComponentControls
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+TInt CAcpQueryContainer::CountComponentControls() const
+    {
+    return KComponentControlCount;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::SizeChanged
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryContainer::SizeChanged()
+    {
+    iListBox->SetRect( Rect() );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::FocusChanged
+// From class CoeControl.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryContainer::FocusChanged( TDrawNow aDrawNow )
+    {
+    CCoeControl::FocusChanged( aDrawNow );
+
+    if ( iListBox )
+        {
+        iListBox->SetFocus( IsFocused() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryContainer::HandleResourceChange
+// From class CoeControl.
+// Called by framework when layout is changed.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryContainer::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType );
+
+    // *****************************
+    // ADDED FOR SCALABLE UI SUPPORT
+    // *****************************
+    if ( KEikDynamicLayoutVariantSwitch == aType )
+        {
+        TRect rect;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
+        SetRect( rect );
+        }
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/src/acpqueryview.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,419 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 CAcpQueryView methods
+*
+*/
+
+
+#include <eikenv.h>
+#include <aknlists.h>
+#include <akntitle.h>
+#include <aknviewappui.h>
+#include <stringloader.h>
+#include <accountcreationplugin.rsg>
+#include <BrowserUiSDKCRKeys.h>
+#include <apgcli.h>
+#include <apgtask.h>
+#include <centralrepository.h>
+
+#include "acpcontroller.h"
+#include "acpqueryview.h"
+#include "acpdialog.h"
+#include "acpquerycontainer.h"
+#include "acpproviderlistview.h"
+#include "accountcreationpluginlogger.h"
+
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::CAcpQueryView
+// ---------------------------------------------------------------------------
+//
+CAcpQueryView::CAcpQueryView( CAcpController& aController ) 
+    : iController( aController )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryView::ConstructL()
+    {
+    ACPLOG( "CAcpQueryView::ConstructL begin" );
+
+    iEikEnv = CEikonEnv::Static();
+    iUi = static_cast<CAknViewAppUi*> ( static_cast<CAknAppUi*> 
+        ( iEikEnv->EikAppUi() ) );
+    
+    BaseConstructL( R_ACP_QUERY_VIEW );
+
+    iDialog = CAcpDialog::NewL( *this ); 
+
+    ACPLOG( "CAcpQueryView::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::NewL
+// ---------------------------------------------------------------------------
+//      
+CAcpQueryView* CAcpQueryView::NewL( CAcpController& aController )
+    {    
+    CAcpQueryView* self = CAcpQueryView::NewLC( aController );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::NewLC
+// ---------------------------------------------------------------------------
+//
+CAcpQueryView* CAcpQueryView::NewLC( CAcpController& aController )
+    {    
+    CAcpQueryView* self = new ( ELeave ) CAcpQueryView( aController );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::~CAcpQueryView
+// ---------------------------------------------------------------------------
+//
+CAcpQueryView::~CAcpQueryView()
+    {
+    ACPLOG( "CAcpQueryView::~CAcpQueryView begin" );
+
+    // Delete container when view is deactivated.
+    if ( iContainer && iUi )
+        {
+        iUi->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        }
+
+    delete iDialog;
+
+    iEikEnv = NULL;
+
+    ACPLOG( "CAcpQueryView::~CAcpQueryView end" );
+    }         
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::SetTitlePaneTextL
+// For changing text to the title pane.
+// ---------------------------------------------------------------------------
+// 
+void CAcpQueryView::SetTitlePaneTextL( const TDesC& aText ) const
+    {
+    // Get handle to title pane.
+    CEikStatusPane* statusPane = iEikonEnv->AppUiFactory()->StatusPane();
+    if ( statusPane )
+        {
+        CAknTitlePane* titlePane =
+            static_cast<CAknTitlePane*> ( statusPane->ControlL(
+                TUid::Uid( EEikStatusPaneUidTitle ) ) );
+        if ( titlePane )
+            {
+            titlePane->SetTextL( aText ); // Set text.
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::Id
+// From CAknView.
+// ---------------------------------------------------------------------------
+//
+TUid CAcpQueryView::Id() const
+    {
+    return KQueryViewId;
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::HandleCommandL
+// From CEikAppUi.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryView::HandleCommandL( TInt aCommand )
+    {
+    ACPLOG2( "CAcpQueryView::HandleCommandL: cmd=%d", aCommand );
+
+    switch ( aCommand )
+        {
+        case EAknSoftkeyOk:
+            {
+            TInt index; // Indicates which provider to be activated
+
+            TBuf<KSipUsername> username; // SIP username. 
+            TBuf<KSipPassword> password; // SIP password.
+            // URL for activating current provider.
+            TBuf8<KMaxUrlLength> activationUrl;
+
+            // Get current provider.
+            index = iController.ActiveIndex();
+
+            // Get username and password.
+            iContainer->GetContainerDataL( username, password );
+
+            // Get activation URL.
+            activationUrl.Copy( 
+                iController.ProviderActivationUrlFromIndexL( index ) );
+
+            // Set username.
+            activationUrl.Append( KAmperSand );
+            activationUrl.Append( KUsername );
+            activationUrl.Append( KPlacing );
+            activationUrl.Append( username );
+
+            // Set password.
+            activationUrl.Append( KAmperSand );
+            activationUrl.Append( KPassword );
+            activationUrl.Append( KPlacing );
+            activationUrl.Append( password );
+
+            ACPLOG( "Launching browser");
+            
+            // Instantiate the repository for disabling 
+            // all security warnings and data saving form of the browser.
+            // Remember to restore the settings later on!!
+            CRepository* brRepository = CRepository::NewLC( KCRUidBrowser );
+
+            // Get original security warning setting.
+            brRepository->Get( KBrowserNGShowSecurityWarnings, iWarning ); 
+
+            // Get original data saving form setting.
+            brRepository->Get( KBrowserFormDataSaving, iDataSaving );         
+
+            // Set security warning off.
+            brRepository->Set( KBrowserNGShowSecurityWarnings, 0 ); 
+
+            // Set data saving form off.
+            brRepository->Set( KBrowserFormDataSaving, 0 );         
+
+            // Creates the application architecture server instance for 
+            // getting new browser session.
+            // Remember to close the session before going out of scope.
+            RApaLsSession apaLsSession;
+            CleanupClosePushL( apaLsSession );
+
+            // Get current application list.
+            TApaTaskList taskList( iEikEnv->WsSession() );
+            
+            // Get the browser session.
+            TApaTask browserTask = taskList.FindApp( KCRUidBrowser );
+
+            // Checks whether browser session exist or not.    
+            if ( browserTask.Exists() )
+                {
+                // Brings the session to the foreground.
+                browserTask.BringToForeground();
+                // Get new buffer for sending the
+                // activation request to server.
+                HBufC8* param8 = HBufC8::NewLC( activationUrl.Length() );
+                // Copy the activation URL.
+                param8->Des().Append( activationUrl );
+                // Try to activate provider earlier selected
+                // by using the browser session.
+                // UID not used.
+                browserTask.SendMessage( TUid::Uid(0), *param8 );
+                // Destroy the activation buffer.
+                CleanupStack::PopAndDestroy( param8 );
+                }
+            else
+                {
+                // Browser instance does not exist but instance is needed
+                // for activating provider via OTA.
+                // Next connecting to the application architecture server
+                // and try to start a new browser instance with the 
+                // activation address.
+
+                TBuf<KMaxUrlLength> activationUrl16; // The activation URL.
+                activationUrl16.Copy( activationUrl );
+
+                TThreadId threadId; // Browser instance's thread.
+
+                // Check whether a handle number exist for the server.
+                if ( !apaLsSession.Handle() )
+                    {
+                    // Connect to the server
+                    User::LeaveIfError( apaLsSession.Connect() );
+                    }
+
+                // Launch browser and send the activation request to the server.
+                User::LeaveIfError( 
+                    apaLsSession.StartDocument( activationUrl16, 
+                                                KCRUidBrowser, threadId ));
+                }
+            
+            CleanupStack::PopAndDestroy( &apaLsSession );
+
+            // Activate provider list view.
+            iUi->ActivateLocalViewL( KProviderListViewId ); 
+            }
+            break;
+        case EAknSoftkeySelect:
+            {
+            // Provisioning started.
+            HandleListBoxSelectionL();
+            }
+            break;
+        case EAknSoftkeyCancel:
+            // Going back to the provider list view.
+            iUi->ActivateLocalViewL( KProviderListViewId );
+            break;
+        case EEikCmdExit:
+        case EAknSoftkeyExit:
+            {
+            // Creates a repository to restore the settings earlier
+            // configured for browser.
+            CRepository* repository = CRepository::NewLC( KCRUidBrowser );
+            // Restore the security warnings.
+            repository->Set( KBrowserNGShowSecurityWarnings, iWarning ); 
+            // Restore the data saving form.
+            repository->Set( KBrowserFormDataSaving, iDataSaving );         
+            // Destroys the repository.
+            CleanupStack::PopAndDestroy( repository );
+            // Exit the application.
+            iUi->HandleCommandL( aCommand );
+            }
+            break;
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::HandleListBoxEventL
+// From MEikListBoxObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryView::HandleListBoxEventL( CEikListBox* /*aListBox*/, 
+    TListBoxEvent aEventType )
+    {
+    switch ( aEventType )
+        {
+        case EEventEnterKeyPressed:
+        case EEventItemDoubleClicked:
+            HandleListBoxSelectionL();
+            break;
+        default:
+           break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::HandleListBoxSelectionL
+// From MEikListBoxObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryView::HandleListBoxSelectionL() 
+    {
+    ACPLOG2( "CAcpQueryView::HandleListBoxSelectionL: %d",
+        iContainer->CurrentItemIndex() );
+
+    switch ( iContainer->CurrentItemIndex() )
+        {
+        // Setting page item: Server username
+        case EAcpGenericUsername:
+            iContainer->ShowUsernameSettingPageL();
+            break;
+        // Setting page item: Server password
+        case EAcpGenericPassword:
+            iContainer->ShowPwordSettingPageL();
+            break;
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderSpecificView::DynInitMenuPaneL
+// From MEikListBoxObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryView::DynInitMenuPaneL( 
+    TInt /*aResourceId*/, CEikMenuPane* /*aMenuPane*/ )
+    {
+    ACPLOG( "CAcpQueryView::DynInitMenuPaneL begin" );
+    ACPLOG( "CAcpQueryView::DynInitMenuPaneL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpProviderListView::DialogDismissed
+// From MAcpDialogObserver.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryView::DialogDismissed( TInt /*aError*/ )
+    {
+    iDialog->DestroyWaitNote();
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::DoActivateL
+// From CAknView.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryView::DoActivateL( 
+    const TVwsViewId& /*aPrevViewId*/, 
+    TUid /*aCustomMessageId*/,
+    const TDesC8& /*aCustomMessage*/ )
+    {
+    ACPLOG( "CAcpQueryView::DoActivateL begin" );
+
+    // Create container when view is activated.
+    if ( !iContainer )
+        {
+        iContainer = CAcpQueryContainer::NewL( ClientRect() );
+        iContainer->SetMopParent( this );
+        iUi->AddToStackL( *this, iContainer );
+        iContainer->ListBox()->SetListBoxObserver( this );
+        }
+
+    // Set provider specific name to title pane.
+    TInt index = iController.ActiveIndex();
+    TBuf<KAcpTitlePaneTextLength> name = 
+        iController.ProviderNameFromIndexL( index );
+
+    HBufC* caption = StringLoader::LoadLC( R_ACP_QUERY_TITLE_PANE_TEXT );
+    name.Append( caption->Des() );
+
+    SetTitlePaneTextL( name );
+
+    ACPLOG( "set title pane" );
+
+    CleanupStack::PopAndDestroy( caption );    
+
+    ACPLOG( "CAcpQueryView::DoActivateL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CAcpQueryView::DoDeactivate()
+// From CAknView.
+// ---------------------------------------------------------------------------
+//
+void CAcpQueryView::DoDeactivate()
+    {
+    ACPLOG( "CAcpQueryView::DoDeactivate begin" );
+
+    // Delete container when view is deactivated.
+    if ( iContainer )
+        {
+        iUi->RemoveFromViewStack( *this, iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+
+    ACPLOG( "CAcpQueryView::DoDeactivate end" );
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/accountcreationplugin/src/acptimer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,122 @@
+/*
+* 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 for timer handling
+*
+*/
+
+
+#include "acptimer.h"
+#include "macptimerobserver.h"
+
+const TInt KPhonebookStartupDelay = 5000000; // 5 seconds
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CAcpTimer::CAcpTimer( MAcpTimerObserver& aObserver ) 
+    : CTimer( EPriorityStandard ), iObserver( aObserver )
+    {    
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CAcpTimer::ConstructL()
+    {    
+    CActiveScheduler::Add( this );
+    CTimer::ConstructL();
+    }   
+    
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CAcpTimer* CAcpTimer::NewL( MAcpTimerObserver& aObserver )
+    {    
+    CAcpTimer* self = new ( ELeave ) CAcpTimer( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CAcpTimer::~CAcpTimer()
+    {    
+    CTimer::Cancel();
+    }
+   
+
+// ---------------------------------------------------------------------------
+// Start timer.
+// ---------------------------------------------------------------------------
+//
+TInt CAcpTimer::StartTimer( TTimerType aTimerType )
+    {    
+    TInt error ( KErrNone );
+    
+    if ( CTimer::IsActive() )
+        {
+        CTimer::Cancel();
+        }
+    
+    if ( EPhonebookStartupDelayTimer == aTimerType )
+        {
+        CTimer::After( KPhonebookStartupDelay );
+        }
+    else
+        {
+        error = KErrArgument;
+        }
+    
+    return error;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Stop timer.
+// ---------------------------------------------------------------------------
+//
+void CAcpTimer::StopTimer()
+    {
+    if ( CTimer::IsActive() )
+        {
+        CTimer::Cancel();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// IsActive
+// ---------------------------------------------------------------------------
+//
+TBool CAcpTimer::IsActive()
+    {
+    return CTimer::IsActive();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CAcpTimer::RunL
+// ---------------------------------------------------------------------------
+//
+void CAcpTimer::RunL()
+    {    
+    iObserver.TimerExpired();
+    }
Binary file voipplugins/dhcppositionprovider/cenrep/10283114.txt has changed
Binary file voipplugins/dhcppositionprovider/cenrep/keys_dhcppsy.xls has changed
Binary file voipplugins/dhcppositionprovider/conf/dhcppsy.confml has changed
Binary file voipplugins/dhcppositionprovider/conf/dhcppsy_10283114.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/data/dhcppositionprovider.rls	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Resource headers for project dhcppositionprovider
+*
+*/
+
+
+//  LOCALISATION STRINGS
+
+//d:Caption string for location framework.
+rls_string r_dhcp_psy_display_name_string 	"DHCP PSY"
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/data/dhcppositionprovider.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  ECom registry information file.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME dhcp
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "dhcppsy.hrh"
+#include "dhcppositionprovider.rls"
+
+//  RESOURCE DEFINITIONS
+RESOURCE REGISTRY_INFO r_dhcppsy_reginfo
+    {
+    dll_uid = 0x10283113;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x101f7a7c;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KDhcpPsyImplUid;
+                    version_no = 1;
+                    display_name = r_dhcp_psy_display_name_string;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,38 @@
+/*
+* 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 info file
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+#if defined (__LOCATIONFRAMEWORKCORE) && defined (__NP_PROXY)
+../inc/dhcppsy.h                |../../../inc/dhcppsy.h
+../conf/dhcppsy.confml          APP_LAYER_CONFML(dhcppsy.confml)
+../conf/dhcppsy_10283114.crml   APP_LAYER_CRML(dhcppsy_10283114.crml)
+../rom/dhcppositionproviderpsy.iby CORE_APP_LAYER_IBY_EXPORT_PATH( dhcppositionproviderpsy.iby )
+#endif
+
+PRJ_MMPFILES
+#if defined (__LOCATIONFRAMEWORKCORE) && defined (__NP_PROXY)
+dhcppositionprovider.mmp
+// gnumakefile blddhcppppsysignx.mk
+#endif
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/group/blddhcppppsysignx.mk	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Sign a SIS file for dhcppositionprovider
+#
+
+#
+# Build	a stub SIS file	to go into ROM.
+#
+SOURCEDIR=..\install
+CERTKEYDIR=..\internal
+TARGETDIR=..\install
+
+SISNAME=dhcppppsy_udeb
+PKGNAME=dhcppppsy_udeb
+
+$(TARGETDIR) :
+	@perl -S emkdir.pl "$(TARGETDIR)"
+
+do_nothing :
+	rem do_nothing
+
+SISFILE=$(SOURCEDIR)\$(PKGNAME).pkg
+SISFILEX=$(TARGETDIR)\$(SISNAME).sisx
+
+$(SISFILEX) : $(SOURCEDIR)\$(PKGNAME).pkg
+	createsis create -cert $(CERTKEYDIR)\rd.cer -key $(CERTKEYDIR)\rd-key.pem  $(SISFILE)
+#
+# The targets invoked by bld...
+#
+
+MAKMAKE	: do_nothing
+
+RESOURCE : do_nothing
+
+SAVESPACE :	do_nothing
+
+BLD	: do_nothing
+
+FREEZE : do_nothing
+
+LIB	: do_nothing
+
+CLEANLIB : do_nothing
+
+FINAL :$(TARGETDIR) $(SISFILEX)
+	
+
+CLEAN :	
+	-erase $(SISFILEX)
+
+RELEASABLES	: 
+	@echo $(SISFILE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/group/dhcppositionprovider.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* 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:  Defines the DHCP Position Provider PSY project.
+*
+*/
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+TARGET      dhcppositionprovider.dll
+TARGETTYPE  PLUGIN
+UID         0x10009D8D 0x10283113
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN NETWORKCONTROL
+
+START RESOURCE  ../data/dhcppositionprovider.rss
+TARGET          dhcppositionprovider.rsc
+END
+
+SOURCEPATH  ../src
+SOURCE      dhcppsypositioner.cpp
+SOURCE      dhcppsyrequester.cpp
+SOURCE      dhcppsysingletonhandler.cpp
+SOURCE      dhcpwlanqueryhandler.cpp
+SOURCE      dhcpserveripaddressresolver.cpp
+SOURCE      dhcpsocketlistener.cpp
+SOURCE      dhcpdatasender.cpp
+SOURCE      dhcpdatapacket.cpp
+SOURCE      dhcpdataresponsepacket.cpp
+SOURCE      dhcpocationinformationparser.cpp
+SOURCE      dhcpdatalocationrequest.cpp
+SOURCE      dhcpconnectionengine.cpp
+SOURCE      dhcpconnectionprogressnotifier.cpp
+SOURCE      proxy.cpp
+
+USERINCLUDE     ../inc
+
+// Default system include paths for middleware layer modules.
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE     ../../../inc
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+LIBRARY     euser.lib
+LIBRARY     lbs.lib
+LIBRARY     ipapputils.lib
+LIBRARY     epospluginfw.lib
+LIBRARY     esock.lib
+LIBRARY     insock.lib
+LIBRARY     commdb.lib
+
+DEBUGLIBRARY flogger.lib
+
+// end of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcpconnectionengine.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Class description file for CDhcpConnectionEngine
+*
+*/
+
+
+#ifndef DHCPCONNECTIONENGINE_H
+#define DHCPCONNECTIONENGINE_H
+
+#include <e32base.h>
+#include <es_sock.h>
+#include <commdbconnpref.h> // For starting AP
+#include "dhcpconnectionstateobserver.h"
+
+class CDhcpConnectionProgressNotifier;
+
+/**
+ *  Locate and activate proper connection method wlan
+ * internet usage
+ *
+ *  @lib
+ *  @since S60 3.2
+ */
+class CDhcpConnectionEngine : public CActive,
+    public MDhcpConnectionStateObserver
+    {
+    public:
+
+        /**
+         * Two-phased constructor.
+         * @since S60 3.2
+         *
+         */
+        static CDhcpConnectionEngine* NewL (RConnection& aConnection);
+
+        /**
+         * C++ destructor
+         * @since S60 3.2
+        */
+        virtual ~CDhcpConnectionEngine ();
+
+    public:
+
+        /**
+         * Check is we are already connected to the specified IAP or not.
+         *
+         * @since S60 3.2
+         *
+         * @param aIAPconnection An id to the connection which
+         *                       will be activated.
+         *
+         */
+
+        TBool IsConnectedL(TUint32 aIAPConnection);
+
+        /**
+        * Connects to the specified WLAN IAP.
+        * @since S60 3.2
+        * @param aIAPconnection An id to the connection which
+        *                       will be activated.
+        * @param aStatus        TRequestStatus to be signaled.
+        *
+        */
+        void ConnectL (TUint aIAPConnection, TRequestStatus& aStatus);
+
+    protected:
+
+        /**
+         * Cancellation of an outstanding request.
+         */
+        void DoCancel();
+
+        /**
+        * Handles an active object's request completion event.
+        */
+        void RunL();
+
+    protected:
+
+        /**
+        * Handles a progress notifier state changing.
+        */
+        void StateChangedL ();
+
+    private:    // methods
+
+        /**
+         * Finalise Symbian Os style construction.
+         *
+         * @since S60 3.2
+         */
+        void    ConstructL();
+
+        /**
+         * C++ constructor
+         * @since S60 3.2
+         *
+         */
+        CDhcpConnectionEngine (RConnection& aConnection);
+
+        /**
+         * SelfCall
+         *
+         * @since S60 3.2
+         */
+        void SelfCall ();
+
+    private:    // Declarations.
+
+        enum TConnectionStates
+            {
+            EIdle,
+            ETurnConnectionOn,
+            EConnectionStartup,
+            };
+
+    private:
+        // Connection which we are used to.
+        RConnection& iConnection;
+
+        MDhcpConnectionStateObserver* iObserver;
+
+        CDhcpConnectionProgressNotifier* iProgressNotifier;
+
+        // Must be member varible since other wise confirmation
+        // shown on the screen.
+        TCommDbConnPref iPreferences;
+
+        // State of this active object
+        TConnectionStates  iStates;
+
+        TRequestStatus* iClientStatus;
+
+        // Used connection id
+        TUint32 iIapProfileId;
+    };
+
+#endif // DHCPCONNECTIONENGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcpconnectionprogressnotifier.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,103 @@
+/*
+* 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 connection progress notifier
+*
+*/
+
+
+#ifndef DHCPCONNECTIONPROGRESSNOTIFIER_H_
+#define DHCPCONNECTIONPROGRESSNOTIFIER_H_
+
+#include <es_sock.h>
+#include "dhcpconnectionstateobserver.h"
+
+/**
+*  This class keep track connection progress.
+*
+*  @lib dhcppositionprovider.dll
+*  @since 3.2
+*/
+class CDhcpConnectionProgressNotifier : public CActive
+    {
+    public:
+
+        /**
+         * Two-phased constructor
+         *
+         * @param aConnection   Reference to RConnection object, which hold information about
+         *                      ongoing connection to the wlan access point
+         * @since 3.2
+         */
+        static CDhcpConnectionProgressNotifier* NewL (RConnection& aConnection,
+                MDhcpConnectionStateObserver* aObserver);
+
+        /*
+        * Destructor
+        *
+        * @since S60 3.2
+        */
+        virtual ~CDhcpConnectionProgressNotifier();
+
+    public:
+
+        /*
+         * Get current connection status
+         *
+         * @since S60 3.2
+         */
+        TInt    GetState();
+
+    protected:
+
+         /**
+         * Cancellation of an outstanding request.
+         *
+         * @since S60 3.2
+         */
+         void DoCancel ();
+
+         /**
+         * Handles an active object's request completion event.
+         *
+         * @since S60 3.2
+         */
+         void RunL ();
+
+    private:
+
+        /**
+         * C++ constructor
+         *
+         * @since S60 3.2
+         */
+        CDhcpConnectionProgressNotifier (RConnection& aConnection,
+                MDhcpConnectionStateObserver* aObserver);
+
+        /**
+         * Contructor which can leave
+         *
+         * @since S60 3.2
+         */
+         void ConstructL ();
+
+    private:
+        // Member variables
+        RConnection& iConnection;
+        MDhcpConnectionStateObserver* iObserver;
+        TNifProgressBuf iProgress;
+        TInt iState;
+
+    };
+
+#endif  // DHCPCONNECTIONPROGRESSNOTIFIER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcpconnectionstateobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* 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 description file for CDhcpConnectionEngine
+*
+*/
+
+
+#ifndef DHCPCONNECTIONSTATEOBSERVER1_H
+#define DHCPCONNECTIONSTATEOBSERVER1_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CLASS DECLARATION
+
+/**
+* MDhcpConnectionStateObserver  State Observer interface
+*/
+class MDhcpConnectionStateObserver
+    {
+    public:
+
+        /*
+         * StateChangedL()
+         *
+         * Notify state change
+         */
+        virtual void StateChangedL() = 0;
+    };
+
+#endif // DHCPCONNECTIONSTATEOBSERVER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcpconstants.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* 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:  Hold common definations for dhcppositionprovider psy
+*
+*/
+
+
+#ifndef DHCPCONSTANTS_H
+#define DHCPCONSTANTS_H
+
+#include <e32base.h>
+
+const   TInt    KDhcpMaxAddrLength = 0x100;     // 256dec
+const   TInt    KDhcpMaxDhcpCivicAddressLength = 0x100;     // 256dec
+
+const   TInt    KDhcpDefaultSrvPort = 0x43;
+const   TInt    KDhcpDefaultCliPort = 0x44;                 // 68dec
+const   TInt    KDhcpMessageGeoSpatialCoordinates = 0x7B;   // 123dec
+const   TInt    KDhcpMessageCivicAddress = 0x63;            // 99dec
+const   TInt    KDhcpMaxResponseDhcpGeoConfLength = 0x10;   // 16dec
+
+const   TUint8  KDhcpMagicCookie[]  = {0x63, 0x82, 0x53, 0x63} ;
+const   TUint8  KDhcpDhcpMsgInform[] =  {0x35, 0x01, 0x08};
+const   TUint8  KDhcpDhcpParameterRequestList[] = {0x37, 0x02};
+const   TUint8  KDhcpGeoOptionParams[] =  {0x7B, 0x63};
+const   TUint8  KDhcpMessageSize[] = {0x39, 0x02, 0x02, 0x40};
+const   TUint8  KDhcpEndOfMessage[] =  {0xFF};
+
+const   TInt    KDhcpMaxLocInfoLength = 0x800;      // 2048dec
+const   TInt    KDhcpMaxOverheadLength = 0x4b0;     // 1200dec
+
+const TInt KDhcpMacByteSeparatorChr = '-';
+
+_LIT( KDhcpUdp, "udp");
+
+_LIT8( KDhcpIpv4AddressFrmt, "%d.%d.%d.%d");
+
+const TInt KDhcpIPAddressLength = 0x27; // Max chars what ipv6 can contain without
+                                        // compacting it.
+#endif  // DHCPCONSTANTS_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcpdatalocationrequest.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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: 
+*
+*/
+
+
+#ifndef DHCPDATALOCATIONREQUEST_H
+#define DHCPDATALOCATIONREQUEST_H
+
+#include <e32base.h>
+#include <in_sock.h>
+
+#include "dhcpdatapacket.h"
+
+/**
+*  This class wraps the DHCP location request message.
+*
+*  @lib sspcontroller
+*  @since S60 4.0
+*/
+class TDhcpLocationRequestPacket : public TDhcpBasePacket
+    {
+    public:
+
+        /**
+         * Default constructor.
+         * @since  S60 3.2
+         */
+        TDhcpLocationRequestPacket();
+
+        /**
+         * Constructs DHCP location request message.
+         * @since S60 3.2
+         * @param aLocalIp local IP address
+         * @param aMacAddr local hardware address
+         * @return
+         */
+        void MakeDhcpInformMsg ( TUint32 aLocalIp, const TDesC8& aMacAddr  );
+
+    public: // data
+
+        /*
+        * Return used transaction id in this dhcp message.
+        * @since S60 3.2
+        *
+        * @return   Transaction id to follow.
+        */
+        TUint32 TransactionId ();
+
+    private:
+
+        /*
+        *
+        * Generate random transaction identifier for the DHCPInform-message.
+        *
+        * @since S60 3.2
+        *
+        * @return   Transaction id to follow.
+        */
+        void    RandomiseXid ();
+
+    private:
+        /**
+         * Transaction identifier for Dhcp inform message.
+        */
+        TUint32 iXid;
+
+    };
+
+#endif // DHCPDATALOCATIONREQUEST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcpdatapacket.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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: 
+*
+*/
+
+
+#ifndef DHCPDATAPACKET_H
+#define DHCPDATAPACKET_H
+
+#include <e32base.h>
+#include <in_sock.h>
+
+const TInt KDhcpPacketLength = 0x240; // RFC2131
+
+/**
+*  This class wraps send and received DHCP message.
+*
+*  @lib dhcppositionprovider
+*  @since S60 3.2
+*/
+class TDhcpBasePacket : public TPtr8
+    {
+    public:
+        /**
+         * Default constructor.
+         * @since  S60 3.2
+         */
+        TDhcpBasePacket ();
+
+    protected: // data
+
+        /**
+         * Buffer holding the DHCP message
+         */
+        TUint8 iBuffer[KDhcpPacketLength];
+
+    #ifdef  _DEBUG
+    public:
+
+        /**
+         * Method to print trace log about data.
+         */
+        void PrintTraceLog ();
+
+    #endif
+    };
+
+#endif // DHCPDATAPACKET_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcpdataresponsepacket.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef DHCPDATARESPONSEPACKET_H
+#define DHCPDATARESPONSEPACKET_H
+
+#include <e32base.h>
+#include <in_sock.h>
+#include "dhcpdatapacket.h"
+#include "dhcpconstants.h"
+
+/**
+*  This class wraps the DHCP response message for location
+*  query request
+*
+*  @lib
+*  @since S60 3.2
+*/
+class TDhcpDataResponsePacket : public TDhcpBasePacket
+    {
+    public:
+
+        /**
+         * Default constructor.
+         * @since  S60 3.2
+         */
+        TDhcpDataResponsePacket ();
+
+        /**
+         * Parses the DHCP ack message
+         * @since  S60 3.2
+         * @returns     KErrNone        If both or other option found.
+         *              KErrNotFound    If magic cookie can't located or no support
+         *                              options found from entered buffer.
+         */
+        TInt    ParseDHCPAck();
+
+    public: // data
+
+        /**
+         * DHCP message identifier
+         */
+        TInt iXid;
+
+        /**
+         * Parsed geoConf data, length fixed to 16 bytes
+         */
+        TBuf8<KDhcpMaxResponseDhcpGeoConfLength> iGeoConf;
+
+        /**
+         * Parsed civic address data
+         */
+        TBuf8<KDhcpMaxDhcpCivicAddressLength> iCivicAddress;
+
+    };
+
+#endif // DHCPDATARESPONSEPACKET_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcpdatasender.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,132 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef DHCPDATASENDER_H
+#define DHCPDATASENDER_H
+
+#include <e32base.h>
+#include <in_sock.h>
+#include <es_sock.h>
+
+#include "dhcpdatalocationrequest.h"
+
+class CIPAppUtilsAddressResolver;
+
+/**
+ *  Sends a DHCP inform message to the network
+ *
+ *  @lib dhcppositionprovider.lib
+ *  @since S60 3.2
+ */
+class CDhcpDataRequestor : public CActive
+    {
+    public:
+
+        /**
+         * Two-phased constructor.
+         * @since S60 3.2
+         * @param aSocket       Socket port where to send data
+         */
+        static CDhcpDataRequestor* NewL(RSocket& aSocket );
+
+        /**
+         * C++ destructor
+         * @since S60 3.2
+         */
+        virtual ~CDhcpDataRequestor();
+
+    public:
+
+        /**
+         * Make inform message for sendid purpose.
+         * @param aSocket Socket port where to send data
+         *
+         */
+        void MakeDhcpInformMsg (TInetAddr aLocalIpAddress);
+
+        /**
+         * Return  transaction to follow. Note:
+         * Have to call after make dhcp inform message.
+         * @since S60 3.2
+         * @return      Transaction id to follow.
+         */
+        TUint32     TransActionIdToFollow ();
+
+        /**
+         * Set this active object to send the DHCP message
+         * @since S60 3.2
+         * @param aInetAddr
+         * @param aStatus       Status to be notify after message
+         *                      has been sent.
+         * @param aIapAddress   Used
+         * @return None
+         */
+        void SendDHCPMessageL ( TInetAddr aInetAddr, TUint32 aIpAddress,
+                TRequestStatus& aStatus  );
+
+    private:    // Methods
+
+        /**
+         * Finalize active object cancelation
+         * @since S60 3.2
+         */
+        void DoCancel();
+
+        /**
+         * Finalize active object cancelation
+         * @since S60 3.2
+         */
+        void RunL();
+
+    private:
+
+        /**
+         * Symbian Os construtor which can leave
+         *
+         * @since S60 3.2
+         */
+        void  ConstructL();
+
+        /**
+         * C++ constructor
+         * @since S60 3.2
+         * @param aSocket Socket port where to send data
+         *
+         */
+        CDhcpDataRequestor(RSocket& aSocket);
+
+    private: // data
+        CIPAppUtilsAddressResolver*     iIpAppUtilsResolver;
+
+        // Used when make a query to the wlan subnet.
+        RSocket& iSocket;
+
+        /**
+         * Filled in with amount of data sent before
+         * completion.
+         */
+        TSockXfrLength          iLen;
+        TRequestStatus* iClientStatus;
+
+        //
+        TDhcpLocationRequestPacket  iLocationRequestMsg;
+        TInetAddr   iInetLclIpAddress;
+        TUint32 iIapProfileId;
+    };
+
+#endif // DHCPDATASENDER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcplocationinformationparser.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,143 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef DHCPLOCATIONINFORMATIONPARSER_H
+#define DHCPLOCATIONINFORMATIONPARSER_H
+
+#include <e32base.h>
+
+/**
+ *  Parses location information from DHCP message to LCI
+ *
+ *  @lib sspcontroller
+ *  @since S60 3,0
+ */
+class TDhcpLocationInformationParser
+    {
+    public:
+
+        /** Location information parsing type */
+        enum TParsingType
+            {
+            EDHCPCoordinates,
+            EDHCPCivicAddress
+            };
+
+    public:
+
+        /**
+         * Constructor
+        */
+        TDhcpLocationInformationParser();
+
+        /**
+         * Parses location information
+         *
+         * @since S60 3.2
+         * @param aInput Input data
+         * @param aParsingType Parsing type
+         * @param aOutput Result
+         * @return None
+         */
+        void ParseLocationInformation( const TDesC8& aInput,
+                const TParsingType aParsingType, TDes8& aOutput );
+
+    private:
+
+        /**
+         * Parses coordinate parameters from the input data
+         *
+         * @since S60 3.2
+         * @param aInput Input data
+         * @param aOutput Result
+         * @return None
+         */
+        void ParseLCI( const TDesC8& aInput, TDes8& aOutput );
+
+        /**
+         * Parses datum from the input data
+         *
+         * @since S60 3.2
+         * @param aInput Input data
+         * @param aOutput Result
+         * @return Error code
+         */
+        TInt ParseDatum(const TDesC8& aInput, TDes8& aOutput );
+
+        /**
+         * Parses the input to the DMS coordinate form
+         *
+         * @since S60 3.2
+         * @param aIsLatitude latitude if ETrue, otherwise longitude
+         * @param aResolution Resolution, i.e. the amount of significant bits
+         * @param aInteger Integer part of coordinate, or degree
+         * @param aFraction Fraction part of coordinate
+         * @param aOutput Result
+         * @return None
+         */
+        void ParseDMS(TBool aIsLatitude, TUint8 aResolution,
+            TUint16 aInteger, TUint32 aFraction, TDes8& aOutput  );
+
+        /**
+         * Parses the civic address elements into the XML description
+         *
+         * @since S60 3.2
+         * @param aInput Input data
+         * @param aOutput Result
+         * @return None
+         */
+        void ParseCivicAddressElements( const TDesC8& aInput, TDes8& aOutput );
+
+        /**
+         * Extract a single civic address element from the input
+         *
+         * @since S60 3.2
+         * @param aInput Input data
+         * @param aOutput Result
+         * @return None
+         */
+        void ExtractCivicAddressElement( TLex8& aInput, TDes8& aOutput );
+
+        /**
+         * Parses the timestamp
+         *
+         * @since S60 3.2
+         * @param aTimeStamp Resulting timestamp
+         * @return None
+         */
+        void ParseTimeStamp( TDes8& aTimeStamp );
+
+        /**
+         * Parses the retenrion-expiry
+         *
+         * @since S60 3.2
+         * @param aTimeStamp Resulting timestamp
+         * @return None
+         */
+        void ParseRetentionExpiry( TDes8& aTimeStamp );
+
+    private: // data
+
+        /**
+         * Timestamp
+         */
+        TTime iTimeStamp;
+
+    };
+
+#endif // DHCPLOCATIONINFORMATIONPARSER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcppsy.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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: 
+*
+*/
+
+
+#ifndef DHCPPSY_H
+#define DHCPPSY_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <lbs.h>
+
+// CONSTANTS
+
+// MACROS
+
+// FUNCTION PROTOTYPES
+
+// DATA TYPES
+enum TDhcpPsyProfileFieldsId
+    {
+    EDhcpPsyIAPProfileIdField=EPositionFieldProprietaryFieldsBegin,
+    EDhcpPsyLocationResultDataField=+0x64
+    };
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+#endif      // DHCPPSY_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcppsy.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,37 @@
+/*
+* 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:  Constants defination file for DHCP psy module.
+*
+*/
+
+
+#ifndef DHCPPSY_HRH
+#define DHCPPSY_HRH
+
+//DHCP PSY implementation UID
+#define KDhcpPsyImplUid 0x10283114
+
+enum TDhcpConnectEngineStates // Engine states
+    {
+    EDhcpConnectStateNotConnected,
+    EDhcpConnectStateConnecting,
+    EDhcpConnectStateConnected,
+    EDhcpConnectStateDisconnecting,
+    EDhcpConnectStateUnknown
+    };
+
+#endif // DHCPPSY_HRH
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcppsylogging.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,115 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef DHCPPSYLOGGING_H
+#define DHCPPSYLOGGING_H
+
+//  INCLUDES
+
+// CONSTANTS
+
+// MACROS
+#ifndef _DEBUG
+
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = Flogger
+*   2 = RDebug
+***************************/
+
+#define DPP_LOGGING_METHOD  0   // UREL BUILD
+
+#else
+
+#ifdef __WINS__
+#define DPP_LOGGING_METHOD  2   // UDEB BUILD, WINS
+#else
+#define DPP_LOGGING_METHOD  2   // UDEB BUILD, HW
+#endif // __WINS__
+
+#endif // _DEBUG
+
+#if DPP_LOGGING_METHOD == 1      // Flogger
+
+#include <flogger.h>
+
+_LIT( KLoggingFolder, "dhcppsy" );
+_LIT( KLoggingFile, "dhcppsylog.txt" );
+_LIT( KLoggingFullName, "c:\\logs\\dhcppsy\\dhcppsylog.txt" );
+
+#define CLEARTRACELOG \
+    {RFs fs;fs.Connect();CFileMan* fileMan = CFileMan::NewL( fs ); \
+    fileMan->Delete( KLoggingFullName ); delete fileMan; fs.Close();\
+    }
+
+#define TRACETEXT( S1 )         { RFileLogger::Write( KLoggingFolder(),\
+KLoggingFile(), EFileLoggingModeAppend, S1 ); }
+
+#define TRACESTRING( S1 )       { \
+    _LIT( tempLogDes, S1 ); \
+    RFileLogger::Write( KLoggingFolder(), KLoggingFile(), \
+    EFileLoggingModeAppend, tempLogDes() ); \
+    }
+
+#define TRACESTRING2( S1, S2 )  { \
+    _LIT( tempLogDes, S1 ); \
+    RFileLogger::WriteFormat( KLoggingFolder(), KLoggingFile(), \
+    EFileLoggingModeAppend, TRefByValue < const TDesC>( tempLogDes() ), S2 ); \
+    }
+
+#define TRACERAWPRINT (S1)
+#define TRACERAWPRINT8(S1)
+
+#define TRACEHEXDUMP(S1, S1LEN) { RFileLogger::HexDump(KLoggingFolder, \
+    KLoggingFile, EFileLoggingModeAppend, 0, 0,S1, S1LEN);\
+    }
+
+#elif DPP_LOGGING_METHOD == 2    // RDebug
+
+#include <e32svr.h>
+
+#define CLEARTRACELOG
+#define TRACETEXT (S1)             { RDebug::Print(S1); }
+#define TRACESTRING(S1)            { RDebug::Print(_L(S1)); }
+#define TRACESTRING2(S1,S2)        { RDebug::Print(_L(S1),S2); }
+#define TRACERAWPRINT(S1)          { RDebug::RawPrint(S1); }
+#define TRACERAWPRINT8(S1)         { RDebug::RawPrint(S1); }
+#define TRACEHEXDUMP(S1, S1LEN)
+#else
+
+#define CLEARTRACELOG
+#define TRACETEXT( S1 )
+#define TRACESTRING( S1 )
+#define TRACESTRING2( S1, S2 )
+#define TRACERAWPRINT (S1)
+#define TRACERAWPRINT8(S1)
+#define TRACEHEXDUMP(S1, S1LEN)
+
+#endif  // _DEBUG
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+#endif  // DHCPPSYLOGGING_H
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcppsypanic.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef DHCPPSYPANIC_H
+#define DHCPPSYPANIC_H
+
+
+//  INCLUDES
+#include <e32std.h>
+
+// CONSTANTS
+_LIT( KDhcpPanicGategory, "DHCP PSY" );
+
+// DATA TYPES
+enum TDhcpPsyPanicReason
+    {
+    EPanicPositionRequestOngoing       //There is already position request ongoing
+    };
+
+// FUNCTION PROTOTYPES
+inline void Panic( TInt aPanicCode )
+    {
+    User::Panic( KDhcpPanicGategory, aPanicCode );
+    }
+
+
+#endif // DHCPPSYPANIC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcppsypositioner.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,101 @@
+/*
+* 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: 
+*
+*/
+
+
+
+#ifndef DHCPPSYPOSITIONER_H
+#define DHCPPSYPOSITIONER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <lbs/epos_cpositioner.h> // CPositioner
+
+// FORWARD DECLARATIONS
+class CDhcpPsySingletonHandler;
+class MPositionerStatus;
+
+// CLASS DECLARATION
+
+/**
+*  This class implements Positioning Plug-in API for DHCP PSY
+*
+*  This class provides the interface to Location Framework as specified by
+*  Positioning Plug-in API. Each client connection to DHCP PSY makes an
+*  instance of this class.
+*
+*  This class owns a instance of CNppPsyRequester if there is location
+*  request received.
+*
+*  @lib dhcppositionprovider.dll
+*  @since 3.2
+*/
+class CDhcpPsyPositioner : public CPositioner
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two - phased constructor.
+        */
+        static CDhcpPsyPositioner* NewL( TAny* aConstructionParameters );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CDhcpPsyPositioner();
+
+        /**
+        * Get status report interface
+        * @return Reference to status report interface
+        */
+        MPositionerStatus& StatusReportInterface();
+
+    public: // Functions from base classes
+
+        /**
+        * From CPositioner See Positioning Plug-in API
+        * @since 3.2
+        */
+        void NotifyPositionUpdate  ( TPositionInfoBase& aPosInfo,
+            TRequestStatus&    aStatus );
+
+        /**
+        * From CPositioner See Positioning Plug-in API.
+        * @since 3.2
+        */
+        void CancelNotifyPositionUpdate();
+
+    private:
+
+        /**
+        * C++default constructor.
+        */
+        CDhcpPsyPositioner();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( TAny* aConstructionParameters );
+
+    private:    // Data
+
+        CDhcpPsySingletonHandler* iDhcpRequestManager;
+
+    };
+
+#endif      // DHCPPSYPOSITIONER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcppsyrequester.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,165 @@
+/*
+* 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 DHCP PSY requester class.
+*
+*/
+
+
+
+#ifndef DHCPPSYREQUESTER_H
+#define DHCPPSYREQUESTER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <lbspositioninfo.h>
+
+#include "dhcppsyrequesterprogressobserver.h"
+
+// FORWARD DECLARATIONS
+class CDhcpPsyPositioner;
+class CPositioner;
+class CDhcpWlanQueryHandler;
+
+// CLASS DECLARATION
+
+
+/**
+*  This class implements the position requester.
+*
+*  Position requester is responsible for loading appropriate PSY vi ECom Plug-in
+*  and forward location request to the loaded PSY.
+*
+*  This class may owns an instance of CPositioner.
+*
+*  @lib dhcppositionprovider.dll
+*  @since 3.2
+*/
+class CDhcpPsyRequester : public CBase, MDhcpPsyRequesterProgressObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two - phased constructor.
+        *
+        */
+        static CDhcpPsyRequester* NewL ();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CDhcpPsyRequester();
+
+    public:
+
+        /**
+        * Notify position update
+        * @param aPosInfo Reference to TPositionerInfoBase, used to store
+        *                 fix information.
+        * @param aStatus  Reference to TRequestStatus, used to complete location
+        *                 request.
+        * @since 3.2
+        */
+        void NotifyPositionUpdate ( TPositionInfoBase& aPosInfo,
+            TRequestStatus& aStatus );
+
+        /**
+         * Cancel ongoing location query.
+         */
+        void CancelRequest ();
+
+    protected:
+
+        void  ProgressPsyRequestNotificationL (TRequestProgressPhases aPhase,
+            TInt aPhaseValue);
+
+    private:
+
+        enum TDhcpRequesterStates
+            {
+            EDhpWlanIdle,
+            EDchpQueryInitalising,
+            EDhcpLocationQueryInProgress
+            };
+
+    private:
+
+        /**
+        * C++default constructor.
+        */
+        CDhcpPsyRequester ();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Make location request to the first PSY
+        */
+        void MakeLocationRequest();
+
+        /**
+        * Complete location request
+        */
+        void CompleteRequest( TInt aErr );
+
+        /**
+        * Free all reserved memory
+        */
+        void Flush();
+
+    private:    // Methods
+
+        /**
+        *
+        * Fetch position generic data from input to make location query
+        * to the wlan network.
+        *
+        * @param aPosInfo Reference to TPositionerInfoBase, used to store
+        *                 fix information.
+        *
+        * @return TInt  Status code.
+        *
+        * @since 3.2
+        */
+        TInt FetchPositioningGenericData  ( TPositionInfoBase& aPosInfo );
+
+    private:    // Data
+        // States
+        TDhcpRequesterStates    iQueryState;
+
+        // Internet access point id
+        TUint32 iIAPProfileId;
+
+        //
+        CDhcpWlanQueryHandler* iWlanDhcpQuery;
+
+        // Pointer to position info
+        TPositionInfoBase* iPositionInfo;
+
+        // Status to notify the LF
+        TRequestStatus* iRequestStatus;
+
+        // To hold location data until module deleted or
+        // new request is made.
+        HBufC8* iLocationData;
+
+        //
+        TBool iCancelled;
+
+    };
+
+#endif      // DHCPPSYREQUESTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcppsyrequesterprogressobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Header file of psy progress notifier observer
+*
+*/
+
+
+#ifndef DHCPSYPROGRESSREQUESTERNOTIFYOBSERVER_H_
+#define DHCPSYPROGRESSREQUESTERNOTIFYOBSERVER_H_
+
+#include <e32base.h>
+
+class MDhcpPsyRequesterProgressObserver
+    {
+    public:
+
+        enum TRequestProgressPhases
+            {
+            EConnectionInitiated,
+            ELocationQueryStarted,
+            ELocationQueryFinished,
+            ECancelled
+            };
+
+    public:
+
+        /**
+        * Notify progress phase of location query
+        *
+        * @param aPhase         Current location query phase.
+        * @aPhaseValue          Additional information from current phase. (Status value)
+        *
+        * @since 3.2
+        */
+        virtual void  ProgressPsyRequestNotificationL (TRequestProgressPhases aPhase,
+            TInt aPhaseValue)=0;
+    };
+
+#endif // DHCPSYPROGRESSREQUESTERNOTIFYOBSERVER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcppsysingletonhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef DHCPPSYSINGLETONHANDLER_H
+#define DHCPPSYSINGLETONHANDLER_H
+
+#include <e32base.h>
+
+class CDhcpPsyRequester;
+
+// Implements the singleton handler for the dhcpositionprovider module
+class CDhcpPsySingletonHandler : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Singleton can be only created through GetInstanceL.
+        */
+        static CDhcpPsySingletonHandler* GetInstanceL();
+
+        /**
+        * Destructor
+        */
+        virtual ~CDhcpPsySingletonHandler ();
+
+        /**
+         * Release the reference to singleton handler. If there is no ojbect
+         * has the reference of this object, it will delete itself.
+         */
+         void ReleaseInstance();
+
+    public:
+
+        /**
+         * Requester for positionar usage.
+         *
+         */
+         CDhcpPsyRequester* Requester ();
+
+    private:
+
+        /**
+        * Second - phase constructor
+        */
+        void ConstructL ();
+
+    private:
+        // Reference count
+        TInt iRefCount;
+
+        //
+        CDhcpPsyRequester*  iPsyRequester;
+
+    };
+
+#endif /* DHCPPSYSINGLETONHANDLER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcpserveripaddressresolver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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: 
+*
+*/
+
+
+#ifndef DHCPSERVERIPADDRESSRESOLVER_H
+#define DHCPSERVERIPADDRESSRESOLVER_H
+
+#include <e32base.h>
+#include <in_sock.h>
+#include <comms-infras/netcfgextndhcpmsg.h> // TDhcp4RawOptionDataPckg
+
+#include "dhcpconstants.h"
+
+/**
+*  Resolve ip address of DHCP server from WLAN network.
+*
+*  @lib dhcppositionprovider
+*  @since S60 3.2
+*/
+class CDhcpPsyDhcpServerIPResolver : public CActive
+    {
+    public:
+
+        /**
+         * Two-phased statical constructor which can leave
+         *
+         * @since S60 3.2
+         */
+        static CDhcpPsyDhcpServerIPResolver* NewL( RConnection& aConnection, TRequestStatus& aStatus );
+
+        /**
+         * Default destructor.
+         *
+         * @since S60 3.2
+         */
+        virtual ~CDhcpPsyDhcpServerIPResolver();
+
+    public:
+
+        /**
+         *
+         * Returns ip address of the dhcp server at WLAN network.
+         *
+         * @since S60 3.2
+         * @return const TDesC8&
+         */
+        TInetAddr&  DhcpServerInetAddress ();
+
+    public:
+
+        /**
+        * Called by static periodic timer callback
+        */
+        void CancelOutstandigRequest ();
+
+    private:
+
+        /**
+         * C++ constructor
+         *
+         * @since S60 3.2
+         */
+        CDhcpPsyDhcpServerIPResolver( RConnection& aConnection, TRequestStatus& aStatus );
+
+        /**
+         * Finalize construction and launches the adddress to the WLAN network
+         */
+         void ConstructL();
+
+    protected:
+
+        /**
+        * Cancellation of an outstanding request.
+        */
+        void DoCancel();
+
+        /**
+        * Handles an active object's request completion event.
+        */
+        void RunL();
+
+    private:        // Methods
+
+        /*
+        * The callback function.
+        * param aAny A pointer to this class.
+        */
+        static TInt PeriodicTimerCallBack(TAny* aAny);
+
+        /*
+        * Complete client request.
+        */
+        void  CompleteRequest(TInt aStatusCode);
+
+    private: // data
+
+        //
+        RConnection& iConnection;
+
+        // To cancel outstanding request if needed.
+        CPeriodic*  iPeriodicTimer;
+
+        // If true, we have received response from network
+        TBool   iDhcpResponseReceived;
+
+        // Client TRequestStatus to be notify after request
+        //  has been completed.
+        TRequestStatus& iClientStatus;
+
+        //
+        TConnectionAddrBuf iPckg;
+
+        // Container for ip addres of the dhcp server.
+        TInetAddr   iInetAddress;
+
+    };
+
+#endif // DHCPSERVERIPADDRESSRESOLVER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcpsocketlistener.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,188 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef DHCPSOCKETLISTENER_H
+#define DHCPSOCKETLISTENER_H
+
+#include <e32base.h>
+#include <in_sock.h>
+
+#include "dhcpdataresponsepacket.h"
+
+/**
+*  Listen receiving DHCP socket messages
+*
+*  @lib dhcppositionprovider
+*  @since S60 3.2
+*/
+class CDhcpPsySocketListener : public CActive
+    {
+    public:
+        /**
+         * Two-phased statical constructor which can leave
+         *
+         * @since S60 3.2
+         */
+        static CDhcpPsySocketListener* NewL( RSocket* aSocket );
+
+        /**
+         * Default destructor.
+         *
+         * @since S60 3.2
+         */
+        virtual ~CDhcpPsySocketListener();
+
+    public:
+
+        /**
+         * Set this active object to waiting for UDP messages
+         *
+         * @since S60 3.0
+         * @return None
+         */
+        void RcvDHCPMessage (TRequestStatus& aStatus);
+
+        /**
+         * Set this active object to waiting for UDP messages from
+         * connectionless socket
+         *
+         * @since S60 3.0
+         * @return None
+         */
+        void RcvDHCPMessageConnectionlessL (TRequestStatus& aStatus);
+
+        /*
+        * Set transaction to follow.
+        *
+        */
+        void SetTransActionIdToFollow (TUint32 aXid);
+
+    public:
+
+        /*
+        * Return location civic data for caller.
+        *
+        */
+        const TDesC8&   LocationCivicInformation ();
+
+        /*
+        * Return location geographical information for caller
+        *
+        */
+        const TDesC8&   GeoConfigDhcpInformation ();
+
+    protected:
+
+        /**
+         * Cancellation of an outstanding request.
+         */
+         void DoCancel();
+
+         /**
+         * Handles an active object's request completion event.
+         */
+         void RunL();
+
+    private:
+
+        /*
+         * 2nd phase Symbian style constructor which can leave.
+        */
+        void ConstructL();
+
+        /**
+         * C++ constructor
+         *
+         * @since S60 3.2
+         */
+        CDhcpPsySocketListener (RSocket* aSocket);
+
+        /**
+        * Check received message that was the message to request.
+        * Checking is made by transaction id.
+        */
+        TBool CheckAckXid ();
+
+    public:     // for timeout control
+
+        /**
+        * Called by static periodic timer callback
+        */
+        void CancelOutstandigRequest ();
+
+    private:    // for timeout control
+
+        /**
+         * Activete timeout control for this object
+         */
+        void StartTimer ();
+
+        /*
+         * The callback function for CPeriodic.
+         * param aAny A pointer to this object.
+         */
+         static TInt PeriodicTimerCallBack(TAny* aAny);
+
+    private: // data
+
+        /**
+         * Received DHCP ACK package
+         */
+        TDhcpDataResponsePacket iAckPckg;
+
+        /**
+         * Socket
+         * Not own.
+         */
+        RSocket* iSocket;
+
+        /**
+         * Filled in with amount of data sent before completion
+         */
+        TSockXfrLength iLen;
+
+        /**
+         * Address used if using connectionless socket
+         */
+        TInetAddr iAddress;
+
+        /**
+         * Flag indicating connectionlessness
+         */
+        TBool iIsConnectionless;
+
+        // Received data buffer
+        TPtr8 iRcvdDataBuffer;
+
+        // Received data buffer.
+        HBufC8* iRcvdDataHeapBufferPtr;
+
+        // Transaction to be follow.
+        TUint32 iXid;
+
+        //
+        TRequestStatus* iClientStatus;
+
+        // To cancel outstanding request if needed.
+        CPeriodic*  iPeriodicTimer;
+
+    };
+
+#endif // DHCPSOCKETLISTENER_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/inc/dhcpwlanqueryhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,176 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef DHCPWLANQUERYHANDLER_H
+#define DHCPWLANQUERYHANDLER_H
+
+#include <e32base.h>
+#include <es_sock.h>
+#include <in_sock.h>
+
+#include "dhcppsyrequesterprogressobserver.h"
+#include "dhcpconstants.h"
+
+class CDhcpPsySocketListener;
+class CDhcpDataRequestor;
+class CDhcpConnectionEngine;
+class CDhcpPsyDhcpServerIPResolver;
+
+/**
+*  Class for handling the DHCP Messages sending and receiving.
+*
+*  @lib dhcppositionprovider
+*  @since S60 3.2
+*/
+class CDhcpWlanQueryHandler : public CActive
+    {
+    public:
+
+        /**
+         * Two-phased statical constructor which can leave
+         *
+         * @since S60 3.2
+         */
+        static CDhcpWlanQueryHandler* NewL(MDhcpPsyRequesterProgressObserver *aObserver);
+
+        /**
+         * C++ destructor
+         *
+         * @since S60 3.2
+         */
+        virtual ~CDhcpWlanQueryHandler();
+
+    public:
+
+        /**
+         * Make DHCP location query to WLAN network
+         * @param aIAPProfileId     Id to used IAP profile
+         *
+         */
+        void MakeLocationQueryL (TUint32 aIAPProfileId );
+
+        /**
+        * Return location data for requestor.
+         *
+         * @returns   Address to location data object
+         */
+        HBufC8* LocationData ();
+
+    protected:  // From CActive
+
+        /**
+        * Handles an active object's request completion event.
+        */
+        void RunL();
+
+        /**
+        * Cancellation of an outstanding request.
+        */
+        void DoCancel();
+
+        /**
+        * Handles a leave occurring in the RunL()
+        */
+        TInt RunError( TInt aErr );
+
+
+    private:
+
+        /**
+         * C++ constructor
+         *
+         * @since S60 3.2
+         */
+        CDhcpWlanQueryHandler(MDhcpPsyRequesterProgressObserver *aObserver);
+
+        /**
+         * Symbian Os construtor which can leave
+         *
+         * @since S60 3.2
+         */
+        void ConstructL();
+
+        /**
+         * Release location based reserved resources
+         *
+         * @since S60 3.2
+         */
+        void Flush ();
+
+    private:
+
+        enum TDhcpWLanQueryStates
+            {
+            EDhpWlanIdle,
+            EAttachToConnection,
+            EDhcpIpAddressQuery,
+            ESendDhcpLocatinQuery,
+            EReceiveDhcpLocationAck,
+            EWlanMakeQueryToConnectionIoctl,
+            EStopExecution
+            };
+
+    private: // data
+
+        // Address of psy progress observer object.
+        MDhcpPsyRequesterProgressObserver *iPsyProgressObserver;
+
+        /**
+        * Socket server
+        */
+        RSocketServ iSocketServer;
+
+        /**
+        * Connection
+        */
+        RConnection iConnection;
+
+        /**
+        * Sockets
+        */
+        RSocket iSocket;
+
+        //
+        TDhcpWLanQueryStates iState;
+
+        //
+        CDhcpDataRequestor* iLctnDataRequestor;
+
+        //
+        CDhcpPsySocketListener* iLctnDataListener;
+
+        //
+        CDhcpPsyDhcpServerIPResolver* iDhcpResolver;
+
+        //
+        CDhcpConnectionEngine*    iConnectionEngine;
+
+
+        // Owned
+        HBufC8*     iLocationBufferData;
+
+        //
+        TInetAddr   iInetLclIpAddress;
+
+        // Used IAP
+        TUint32 iIapProfileId;
+
+    };
+
+#endif // DHCPWLANQUERYHANDLER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/install/dhcppppsy.pkg	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Package file for project DHCP Position Provider PSY
+;
+&EN
+; UID is the app's UID
+;
+#{"dhcppositioningprovider PSY"},(0x10283113),1,0,0
+;
+;Supports Series 60 v 3.0
+(0x10283113), 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;
+"\Epoc32\data\z\resource\plugins\dhcppositionprovider.rsc" -"!:\resource\plugins\dhcppositionprovider.rsc"
+"\Epoc32\release\armv5\urel\dhcppositionprovider.dll" -"!:\sys\bin\dhcppositionprovider.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/install/dhcppppsy_cenrep.pkg	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,31 @@
+;
+; 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:  Package file for project DHCP Position Provider PSY
+;
+&EN
+; UID is the app's UID
+;
+#{"Dhcp psy cenrep file"},(0x10283114),1,0,0
+;
+;Supports Series 60 v 3.0
+(0x10283114), 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;
+"..\cenrep\10283114.txt"-"!:\private\10202be9\import\10283114.txt"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/install/dhcppppsy_udeb.pkg	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Package file for project DHCP Position Provider PSY
+;
+&EN
+; UID is the app's UID
+;
+#{"dhcppositioningprovider PSY"},(0x10283113),1,0,0
+;
+;Supports Series 60 v 3.0
+(0x10283113), 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;
+"\Epoc32\data\z\resource\plugins\dhcppositionprovider.rsc" -"!:\resource\plugins\dhcppositionprovider.rsc"
+"\Epoc32\release\armv5\udeb\dhcppositionprovider.dll" -"!:\sys\bin\dhcppositionprovider.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/rom/dhcppositionproviderpsy.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Image description file for project dhcppositionprovider
+*
+*/
+
+
+#ifndef __DHCPPSY_IBY__
+#define __DHCPPSY_IBY__
+
+#include <bldvariant.hrh>
+
+// Feature flags
+#ifdef __LOCATIONFRAMEWORKCORE
+// DHCP PSY
+ECOM_PLUGIN(dhcppositionprovider.dll, dhcppositionprovider.rsc)
+
+#endif // __LOCATIONFRAMEWORKCORE
+#endif // __DHCPPSY_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcpconnectionengine.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Browse and activate proper connection method.
+*
+*/
+
+
+#include <es_sock.h>
+#include <es_enum.h>
+#include "dhcppsylogging.h"
+#include "dhcppsy.hrh"
+#include "dhcpconnectionprogressnotifier.h"
+#include "dhcpconnectionstateobserver.h"
+#include "dhcpconnectionengine.h"
+
+// ---------------------------------------------------------------------------
+// CDhcpConnectionEngine::NewL
+// ---------------------------------------------------------------------------
+//
+CDhcpConnectionEngine* CDhcpConnectionEngine::NewL (RConnection& aConnection)
+    {
+    CDhcpConnectionEngine* self = new (ELeave) CDhcpConnectionEngine (aConnection);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// Member methods
+// ---------------------------------------------------------------------------
+// CDhcpConnectionEngine::CDhcpConnectionEngine
+// ---------------------------------------------------------------------------
+//
+CDhcpConnectionEngine::CDhcpConnectionEngine (RConnection& aConnection) :  CActive ( EPriorityStandard ),
+        iConnection (aConnection)
+    {
+    TRACESTRING( "CDhcpConnectionEngine::CDhcpConnectionEngine" );
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpConnectionEngine::~CDhcpConnectionEngine
+// ---------------------------------------------------------------------------
+//
+CDhcpConnectionEngine::~CDhcpConnectionEngine()
+    {
+    TRACESTRING( "CDhcpConnectionEngine::~CDhcpConnectionEngine" );
+    Cancel();
+    delete iProgressNotifier;
+    }
+// ---------------------------------------------------------------------------
+// CDhcpConnectionEngine::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CDhcpConnectionEngine::ConstructL()
+    {
+    TRACESTRING( "CDhcpConnectionEngine::ContructL" );
+    iProgressNotifier = CDhcpConnectionProgressNotifier::NewL(iConnection, this);
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpConnectionEngine::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CDhcpConnectionEngine::DoCancel()
+    {
+    TRACESTRING2 ( "CDhcpConnectionEngine::DoCancel, state %d", iStates);
+    // Is this really needed ? Most cases SVP will continue with same IAP connection so
+    // it's not good to drop a connection beforehand ...
+    iProgressNotifier->Cancel ();
+    iConnection.Close ();
+    TRACESTRING( "CDhcpConnectionEngine::DoCancel, end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CDhcpConnectionEngine::ActiveWlanConnection
+// ---------------------------------------------------------------------------
+//
+TBool CDhcpConnectionEngine::IsConnectedL (TUint32 aIAPId )
+    {
+    TUint connectionCount = 0;
+    TBool isConnected = EFalse;
+    if (iProgressNotifier->GetState () == EDhcpConnectStateConnected)
+        {
+        isConnected = ETrue;
+        return isConnected;
+        }
+
+    User::LeaveIfError( iConnection.EnumerateConnections(connectionCount));
+    TRACESTRING2 ("CDhcpConnectionEngine::IsConnectedL, connCount, %d", connectionCount )
+    // Loop shall start from second item, otherwise this will not work.
+    for ( TUint i = 1; i <= connectionCount; i++ )
+        {
+        TPckgBuf<TConnectionInfo> connInfo;
+        User::LeaveIfError( iConnection.GetConnectionInfo( i, connInfo ) );
+        if ( connInfo().iIapId == aIAPId )
+            {
+            User::LeaveIfError( iConnection.Attach(
+                connInfo, RConnection::EAttachTypeNormal ) );
+            isConnected = ETrue;
+            break;
+            }
+        }
+    return isConnected;
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpConnectionEngine::StateChangedL
+// ---------------------------------------------------------------------------
+//
+void CDhcpConnectionEngine::StateChangedL ()
+    {
+    switch(iProgressNotifier->GetState ())
+        {
+        case EDhcpConnectStateConnected:
+            {
+            if (iStates==EConnectionStartup)
+                {
+                TRequestStatus *status = iClientStatus;
+                User::RequestComplete ( status, KErrNone );
+                iStates = EIdle;
+                }
+            }
+            break;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CDhcpConnectionEngine::ConnectL
+// ---------------------------------------------------------------------------
+//
+void CDhcpConnectionEngine::ConnectL (TUint aIAPConnectionId, TRequestStatus& aStatus)
+    {
+    TRACESTRING( "CDhcpConnectionEngine::ConnectL" );
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iIapProfileId = aIAPConnectionId;
+    iPreferences.SetIapId( iIapProfileId );
+    iPreferences.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
+    iConnection.Start( iPreferences, iStatus );
+    iStates = ETurnConnectionOn;
+    SetActive ();
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpConnectionEngine::RunL
+// ---------------------------------------------------------------------------
+//
+void CDhcpConnectionEngine::RunL()
+    {
+    TRACESTRING2( "CDhcpConnectionEngine::RunL, %d ", iStates);
+    TRACESTRING2( "CDhcpConnectionEngine::RunL, %d ", iStatus.Int() );
+    TInt retValue = iStatus.Int();
+    if(retValue!=KErrNone)
+        {
+        //
+        // Even we failed to connect specified wlan network, we should continue with
+        // location query progress until the DHCPInform message has been send to someone.
+        // This is reason for that we complete with KErrNone in here.
+        //
+        TRequestStatus *status = iClientStatus;
+        User::RequestComplete ( status, KErrNone );
+        iStates = EIdle;
+        }
+    else
+        {
+        switch (iStates)
+            {
+            case ETurnConnectionOn:
+                {
+                // Ok we just flag on until progress notification tells to us that
+                iStates = EConnectionStartup;
+                }
+                break;
+            }
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcpconnectionprogressnotifier.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,206 @@
+/*
+* 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:  Connection progress notifier
+*
+*/
+
+
+#include <es_sock.h>
+#include <in_iface.h>
+#include "dhcppsy.hrh"
+#include "dhcppsylogging.h"
+#include "dhcpconnectionstateobserver.h"
+#include "dhcpconnectionprogressnotifier.h"
+
+// ---------------------------------------------------------------------------
+// Statical constructor
+// ---------------------------------------------------------------------------
+//
+CDhcpConnectionProgressNotifier*   CDhcpConnectionProgressNotifier::NewL(RConnection& aConnection,
+        MDhcpConnectionStateObserver*   aObserver)
+    {
+    CDhcpConnectionProgressNotifier* self = new (ELeave)
+        CDhcpConnectionProgressNotifier (aConnection, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop (self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CDhcpConnectionProgressNotifier::~CDhcpConnectionProgressNotifier ()
+    {
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// Second-phase constructor which can leave.
+// ---------------------------------------------------------------------------
+//
+void CDhcpConnectionProgressNotifier::ConstructL()
+    {
+    iConnection.ProgressNotification(iProgress, iStatus);
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CDhcpConnectionProgressNotifier::RunL()
+    {
+    TRACESTRING2( "CDhcpConnectionProgressNotifier::RunL, %d", iProgress().iStage);
+    switch (iProgress().iStage)
+        {
+        case KConnectionUninitialised:
+            {
+            // Connection unitialised
+            iState = EDhcpConnectStateNotConnected;
+            }
+            break;
+        case KStartingSelection:
+            {
+            // Starting connetion selection
+            iState = EDhcpConnectStateConnecting;
+            }
+            break;
+        case KFinishedSelection:
+            {
+            // Selection finished
+            if (iProgress().iError == KErrNone)
+                {
+                // The user successfully selected an IAP to be used
+                iState = EDhcpConnectStateConnecting;
+                }
+            else
+                {
+                iState = EDhcpConnectStateNotConnected;
+                }
+            }
+            break;
+        case KConnectionFailure:
+            {
+            // Connection failure
+            iState = EDhcpConnectStateNotConnected;
+            }
+            break;
+        case KPsdStartingConfiguration:
+        case KPsdFinishedConfiguration:
+        case KCsdFinishedDialling:
+        case KCsdScanningScript:
+        case KCsdGettingLoginInfo:
+        case KCsdGotLoginInfo:
+            {
+            // Prepearing connection (e.g. dialing)
+            iState = EDhcpConnectStateConnecting;
+            }
+            break;
+         case KCsdStartingConnect:
+         case KCsdFinishedConnect:
+            {
+            // Creating connection (e.g. GPRS activation)
+            iState = EDhcpConnectStateConnecting;
+            }
+            break;
+        case KCsdStartingLogIn:
+            {
+            // Starting log in
+            iState = EDhcpConnectStateConnecting;
+            }
+            break;
+        case KCsdFinishedLogIn:
+            {
+            // Finished login
+            iState = EDhcpConnectStateConnecting;
+            }
+            break;
+        case KConnectionOpen:
+            {
+            iState = EDhcpConnectStateConnecting;
+            }
+            break;
+        case KLinkLayerOpen:
+            {
+            // Connection open
+            iState = EDhcpConnectStateConnected;
+            }
+            break;
+        case KDataTransferTemporarilyBlocked:
+            {
+            // Connection blocked or suspended
+            iState = EDhcpConnectStateConnected;
+            }
+            break;
+
+        case KConnectionStartingClose:
+            {
+            // Hangup or GRPS deactivation
+            iState = EDhcpConnectStateDisconnecting;
+            }
+            break;
+
+        case KConnectionClosed:
+        case KLinkLayerClosed:
+            {
+            // Connection closed
+            iState = EDhcpConnectStateNotConnected;
+            }
+            break;
+        default:
+            {
+            // Unhandled state
+            iState = EDhcpConnectStateUnknown;
+            }
+            break;
+        }
+    iObserver->StateChangedL();
+    iConnection.ProgressNotification(iProgress, iStatus);
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// GetState
+// ---------------------------------------------------------------------------
+//
+TInt CDhcpConnectionProgressNotifier::GetState ()
+    {
+    return iState;
+    }
+
+// ---------------------------------------------------------------------------
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void CDhcpConnectionProgressNotifier::DoCancel ()
+    {
+    TRACESTRING( "CDhcpConnectionProgressNotifier::DoCancel");
+    iConnection.CancelProgressNotification();
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpConnectionProgressNotifier
+// ---------------------------------------------------------------------------
+//
+CDhcpConnectionProgressNotifier::CDhcpConnectionProgressNotifier (RConnection& aConnection,
+    MDhcpConnectionStateObserver* aObserver) :
+    CActive ( EPriorityStandard ), iConnection (aConnection),
+    iObserver (aObserver)
+    {
+    CActiveScheduler::Add (this);
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcpdatalocationrequest.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,176 @@
+/*
+* 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:  Builds the dhcp location information request buffer
+*
+*/
+
+
+#include <e32math.h>
+#include "dhcppsylogging.h"             // For logging
+#include "dhcpconstants.h"
+#include "dhcpdatalocationrequest.h"
+
+const TInt KDhcpFileBufferLength = 0x80;        // 128dec
+const TInt KDhcpSnameLength = 0x40;
+
+const TInt KDhcpChAddressLength = 0x10;   // 16dec
+
+// Data positions constants.
+const TInt KDhcpMessageOpCodePos = 0x00;
+const TInt KDhcpHardwareAddressTypePos = 0x01;
+const TInt KDhcpHardwareAddressLengthPos = 0x02;
+const TInt KDhcpHopsRelayPos = 0x03;
+const TInt KDhcpTransActionIdPos = 0x04;     // 4 byte
+
+const TInt KDhcpSecsPos = 0x08;
+const TInt KDhcpFlagsPos = 0x0A;
+const TInt KDhcpCiAddrPos = 0x0C;
+const TInt KDhcpYiAddrPos = 0x10;
+const TInt KDhcpSiAddrPos = 0x14;
+const TInt KDhcpGiAddrPos = 0x18;
+
+// Operation code constans.
+const TUint8    KDhcpMessageOperationCode = 0x01;       // 1 = BOOTREQUEST
+const TUint8    KDhcpHardwareAddressType = 0x01;        // HType 1 = 10 mb ethernet
+const TUint8    KDhcpHardwareAddressLength = 0x06;      // Hardware address length,
+                                                        // 6 bytes 10 mb ethernet
+const TUint8    KDhcpHopsRelayInform = 0x00;            // Hops 0 in DHCPINFORM
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// TDhcpLocationRequestPacket
+// ---------------------------------------------------------------------------
+//
+TDhcpLocationRequestPacket::TDhcpLocationRequestPacket()
+    {
+    iXid = 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Return used transaction id.
+// ---------------------------------------------------------------------------
+//
+TUint32 TDhcpLocationRequestPacket::TransactionId ()
+    {
+    return iXid;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructs a DHCP Inform message
+// ---------------------------------------------------------------------------
+//
+void TDhcpLocationRequestPacket::MakeDhcpInformMsg ( TUint32 aLocalIp,
+    const TDesC8& aMacAddr )
+    {
+    TRACESTRING( "TDhcpLocationRequestPacket::MakeDhcpInform" );
+    RandomiseXid ();
+
+    // Inital part, we do byte work at here.
+    SetLength (0x1C);
+    FillZ();
+
+    iBuffer[KDhcpMessageOpCodePos] = KDhcpMessageOperationCode;
+    iBuffer[KDhcpHardwareAddressTypePos] = KDhcpHardwareAddressType;
+    // We could also get value in here from actual length of
+    // mac address buffer.
+    iBuffer[KDhcpHardwareAddressLengthPos] = KDhcpHardwareAddressLength;
+    iBuffer[KDhcpHopsRelayPos] = KDhcpHopsRelayInform;
+
+    BigEndian::Put32(&(iBuffer[KDhcpTransActionIdPos]), TUint32 (iXid));
+
+    // Set secs and flags fields to the buffer.
+    TUint16 secsAndFlagsValue = 0;      // 0 in flags = no broadcast
+    BigEndian::Put16(&(iBuffer[KDhcpSecsPos]), TUint16 (secsAndFlagsValue));
+    BigEndian::Put16(&(iBuffer[KDhcpFlagsPos]), TUint16 (secsAndFlagsValue));
+
+    // Local ip address
+    BigEndian::Put32(&(iBuffer[KDhcpCiAddrPos]), TUint32 (aLocalIp));
+    TUint32 xiAddrValue = 0x00;
+    BigEndian::Put32(&(iBuffer[KDhcpYiAddrPos]), TUint32 (xiAddrValue));
+    BigEndian::Put32(&(iBuffer[KDhcpSiAddrPos]), TUint32 (xiAddrValue));
+    BigEndian::Put32(&(iBuffer[KDhcpGiAddrPos]), TUint32 (xiAddrValue));
+
+    // wlan mac address
+    TBuf8<KDhcpChAddressLength>  chAddress (KNullDesC8);
+    chAddress.Copy (aMacAddr.Left(KDhcpChAddressLength));
+    if (chAddress.Length()<KDhcpChAddressLength)
+        {
+        // If given mac address is less max of field,
+        // we have make sure that rest of bytes
+        // are filled as zero-byte.
+        TInt oldLength = chAddress.Length();
+        chAddress.SetLength(KDhcpChAddressLength);
+        for (TInt ii = oldLength; ii<KDhcpChAddressLength;ii++)
+            {
+            chAddress[ii] = 0x00;
+            }
+        }
+
+    Append(chAddress);
+
+    TBuf8<KDhcpFileBufferLength> fileBuffer(KNullDesC8);
+    // sname
+    fileBuffer.SetLength(KDhcpSnameLength);
+    fileBuffer.FillZ();
+    Append(fileBuffer);
+
+    // file
+    fileBuffer.SetLength(KDhcpFileBufferLength);
+    fileBuffer.FillZ();
+    Append(fileBuffer);
+
+    // magic cookie
+    TPtrC8 ptr (KDhcpMagicCookie, sizeof(KDhcpMagicCookie));
+    Append(ptr);
+
+    // And add all rest parts to the request message
+    TPtrC8 ptrInform (KDhcpDhcpMsgInform, sizeof(KDhcpDhcpMsgInform));
+    Append(ptrInform);
+
+    TPtrC8 ptrRequestList (KDhcpDhcpParameterRequestList, sizeof(KDhcpDhcpParameterRequestList));
+    Append(ptrRequestList);
+
+    TPtrC8 ptrGeoOptionParams (KDhcpGeoOptionParams, sizeof(KDhcpGeoOptionParams));
+    Append(ptrGeoOptionParams);
+
+    TPtrC8 ptrMessageSize (KDhcpMessageSize, sizeof(KDhcpMessageSize));
+    Append(ptrMessageSize);
+
+    TPtrC8 ptrMsgSize (KDhcpEndOfMessage, sizeof(KDhcpEndOfMessage));
+    Append(ptrMsgSize);
+
+    TInt length = Length();
+    SetLength(KDhcpPacketLength);
+
+    // Ok, rest of bytes shall be zero.
+    TPtr8 ptrMakeZeroBytes(&iBuffer[length],KDhcpPacketLength - length);
+    ptrMakeZeroBytes.FillZ();
+    }
+
+// ---------------------------------------------------------------------------
+// Generate a random transaction id
+// ---------------------------------------------------------------------------
+//
+void TDhcpLocationRequestPacket::RandomiseXid ()
+    {
+    TRACESTRING( "TDhcpLocationRequestPacket::RandomiseXid" );
+    TTime time;
+    time.HomeTime();
+    TInt64 seed = time.Int64();
+    TUint random = Math::Rand( seed );
+    iXid = random % KMaxTUint;
+    TRACESTRING2( "TDhcpLocationRequestPacket::RandomiseXid, iXid %u" ,iXid );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcpdatapacket.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* 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:  Base class for DHCP packet message.
+*
+*/
+
+#include "dhcppsylogging.h"          // For logging
+#include "dhcpdatapacket.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// TDhcpBasePacket
+// ---------------------------------------------------------------------------
+//
+TDhcpBasePacket::TDhcpBasePacket() :
+        TPtr8( iBuffer, 0, KDhcpPacketLength )
+    {
+    }
+
+#ifdef  _DEBUG
+// ---------------------------------------------------------------------------
+// TDhcpBasePacket::PrintTraceLog
+// ---------------------------------------------------------------------------
+//
+void TDhcpBasePacket::PrintTraceLog ()
+    {
+    TRACEHEXDUMP(iBuffer, Length());
+    }
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcpdataresponsepacket.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Handle and parse dhcp server response message.
+*
+*/
+
+#include "dhcppsylogging.h"          // For logging
+#include "dhcpconstants.h"
+#include "dhcpdataresponsepacket.h"
+
+const TInt KLengthOverMCookie = 236;
+const TInt KDhcpMessageEndOption = 255;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// TDhcpDataResponsePacket
+// ---------------------------------------------------------------------------
+//
+TDhcpDataResponsePacket::TDhcpDataResponsePacket()
+    {
+    iXid = 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Parses the location information part from the DHCPv4 Inform message,
+// Currently supported Options 123 and 99.
+// ---------------------------------------------------------------------------
+//
+TInt TDhcpDataResponsePacket::ParseDHCPAck ()
+    {
+    TRACESTRING( "TDhcpDataResponsePacket::ParseDHCPAck" );
+    TInt dataFound = KErrNotFound;
+    if (Length() > KLengthOverMCookie)
+        {
+        TPtrC8 magicCookie (KDhcpMagicCookie, sizeof(KDhcpMagicCookie));
+        //Locate the 'magic cookie' after which the option field begins
+        TInt offset = Find( magicCookie );
+        if (offset!=KErrNotFound)
+            {
+            offset += 4; // Skip the cookie
+            while (iBuffer[offset] != KDhcpMessageEndOption )
+                {
+                TInt messageOption = iBuffer[offset];
+                switch (messageOption)
+                    {
+                    case KDhcpMessageGeoSpatialCoordinates:
+                        {
+                        // Parse Option 123
+                        TUint8 dataLength = iBuffer[offset+1];
+                        iGeoConf = Mid( ( offset + 2 ), dataLength );
+                        offset++;
+                        offset += dataLength + 1;
+                        dataFound = KErrNone;
+                        }
+                        break;
+                    case KDhcpMessageCivicAddress:
+                        {
+                        // Parse Option 99
+                        // GeoConfCivic can be of variable length
+                        TUint8 dataLength = iBuffer[offset+1];
+                        iCivicAddress = Mid( ( offset + 2 ), dataLength );
+                        offset++;
+                        offset += dataLength + 1;
+                        dataFound = KErrNone;
+                        }
+                        break;
+                    default:
+                        {
+                        offset++;
+                        offset = offset + (iBuffer[offset]+1) ;
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+    return dataFound;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcpdatasender.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,142 @@
+/*
+* 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:  Send request data packets to the connected wlan network.
+*
+*/
+
+
+#include <e32std.h>
+#include <e32svr.h>
+
+#include "cipapputilsaddressresolver.h"
+#include "dhcpconstants.h"
+#include "dhcpdatasender.h"
+#include "dhcppsylogging.h"
+
+_LIT8 (KDhcpWlanMacAddressFrmt, "" );
+const TInt KDhcpWlanMacAddressLength = 0x20;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CDhcpDataRequestor* CDhcpDataRequestor::NewL(RSocket& aSocket)
+    {
+    CDhcpDataRequestor* self = new( ELeave ) CDhcpDataRequestor(aSocket);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CDhcpDataRequestor::~CDhcpDataRequestor()
+    {
+    TRACESTRING( "CDhcpDataRequestor::~CDhcpDataRequestor" );
+    Cancel();
+    delete iIpAppUtilsResolver;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CDhcpDataRequestor::CDhcpDataRequestor(RSocket& aSocket):
+    CActive ( EPriorityStandard ), iSocket ( aSocket )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// For sending a DHCP message. If a DHCP server address has been found then we
+// use that, but if it has not been found then we try broadcasting.
+// ---------------------------------------------------------------------------
+//
+void CDhcpDataRequestor::SendDHCPMessageL(TInetAddr aDhcpSrvAddr, TUint32 aIapProfileId,
+        TRequestStatus& aStatus )
+    {
+    TRACESTRING2( "CDhcpDataRequestor::SendDHCPMessageL, dhcp server address: %u",
+            aDhcpSrvAddr.Address() );
+
+    // Make location request message.
+    iIapProfileId = aIapProfileId;
+
+    TBuf8<KDhcpWlanMacAddressLength> wlanMacAddress (KNullDesC8);
+
+    User::LeaveIfError(
+        iIpAppUtilsResolver->GetWlanMACAddress(wlanMacAddress,
+            KDhcpWlanMacAddressFrmt)
+        );
+
+    User::LeaveIfError (
+        iIpAppUtilsResolver->GetLocalIpAddressFromIap(iInetLclIpAddress, aIapProfileId)
+        );
+
+    TRACESTRING2( "CDhcpDataRequestor::SendDHCPMessage, local Ipaddres address: %u",
+            iInetLclIpAddress.Address() );
+
+    iLocationRequestMsg.MakeDhcpInformMsg (iInetLclIpAddress.Address(),
+            wlanMacAddress );
+
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    TInetAddr inetAddr (aDhcpSrvAddr) ;
+    inetAddr.SetPort( KDhcpDefaultSrvPort );
+    iSocket.SendTo( iLocationRequestMsg, inetAddr, 0, iStatus, iLen );
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// TransActionIdToFollow
+// ---------------------------------------------------------------------------
+//
+TUint32 CDhcpDataRequestor::TransActionIdToFollow ()
+    {
+    return iLocationRequestMsg.TransactionId();
+    }
+
+// ---------------------------------------------------------------------------
+// ContructL
+// ---------------------------------------------------------------------------
+//
+void CDhcpDataRequestor::ConstructL ()
+    {
+    iIpAppUtilsResolver = CIPAppUtilsAddressResolver::NewL ();
+    }
+
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CDhcpDataRequestor::RunL ()
+    {
+    TRACESTRING2( "CDhcpDataRequestor::RunL %d", iStatus.Int());
+    TRequestStatus *status = iClientStatus;
+    User::RequestComplete (status, iStatus.Int());
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpDataRequestor::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CDhcpDataRequestor::DoCancel ()
+    {
+    TRACESTRING( "CDhcpDataRequestor::DoCancel" );
+    iSocket.CancelSend();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcpocationinformationparser.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,885 @@
+/*
+* 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:  Parses location information from DHCP message to LCI
+*
+*/
+
+
+#include <e32math.h>
+#include "dhcplocationinformationparser.h"
+#include "dhcppsylogging.h"
+
+// Dynamic Host Configuration Protocol (DHCPv4 and DHCPv6) Option for Civic
+// Addresses Configuration Information
+// draft-ietf-geopriv-dhcp-civil-09
+
+// Civic Address CAtypes
+const TUint8 KDhcpState = 1;
+const TUint8 KDhcpCounty = 2;
+const TUint8 KDhcpCity = 3;
+const TUint8 KDhcpBorough = 4;
+const TUint8 KDhcpBlock = 5;
+const TUint8 KDhcpGroupOfStreets = 6;
+
+// Civic Address Additional CAtypes
+// const TUint8 KLanguage = 0;
+const TUint8 KDhcpLeadingStreetDirection = 16;
+const TUint8 KDhcpTrailingStreetDirection = 17;
+const TUint8 KDhcpStreetSuffix = 18;
+const TUint8 KDhcpHouseNumber = 19;
+const TUint8 KDhcpHouseNumberSuffix = 20;
+const TUint8 KDhcpVanityAddress = 21;
+const TUint8 KDhcpAdditionalLocationInformation = 22;
+const TUint8 KDhcpName = 23;
+const TUint8 KDhcpPostalCode = 24;
+const TUint8 KDhcpFloor = 27;
+const TUint8 KDchpCASeat = 33;
+
+// XML civilLoc elements
+_LIT8( KDhcpCountry, "country" );
+_LIT8( KDhcpA1, "A1" );     // state
+_LIT8( KDhcpA2, "A2" );     // county
+_LIT8( KDhcpA3, "A3" );     // city
+_LIT8( KDhcpA4, "A4" );     // borough
+_LIT8( KDhcpA5, "A5" );     // block
+_LIT8( KDhcpA6, "A6" );     // street
+_LIT8( KDhcpPRD, "PRD" );   // leading street direction
+_LIT8( KDhcpPOD, "POD" );   // trailing street direction
+_LIT8( KDhcpSTS, "STS" );   // street suffix
+_LIT8( KDhcpHNO, "HNO" );   // house number
+_LIT8( KDhcpHNS, "HNS" );   // house number suffix
+_LIT8( KDhcpLMK, "LMK" );   // landmark or vanity address
+_LIT8( KDhcpLOC, "LOC" );   // additional location information
+_LIT8( KDhcpNAM, "NAM" );   // name
+_LIT8( KDhcpPC, "PC" );     // postal code
+_LIT8( KDhcpFLR, "FLR" );   // floor
+_LIT8( KDhcpSEAT, "SEAT" ); // seat
+
+
+// XML message parsing
+
+// General
+_LIT8( KOpenBracket, "<" );
+_LIT8( KCloseBracket, ">" );
+_LIT8( KForwardSlash, "/" );
+_LIT8( KQuotationMark, "\"" );
+_LIT8( KColon, ":" );
+_LIT8( KSpaceChar, " " );
+_LIT8( KHyphen, "-" );
+
+// XML (RFC 4119)
+_LIT8( KXMLBegin, "?xml version=\"1.0\" encoding=\"UTF-8\"?" );
+_LIT8( KPresence, "presence" );
+_LIT8( KTuple, "tuple" );
+_LIT8( KStatus, "status" );
+_LIT8( KTimeStamp, "<timestamp>" );
+_LIT8( KTimeStampEnd, "</timestamp>" );
+_LIT8( KXmlnsNamespace, " xmlns=\"urn:ietf:params:xml:ns:pidf\"" );
+_LIT8( KId, " id=\"" );
+_LIT8( KTupleId1, "tuple1" );
+_LIT8( KT, "T" );
+_LIT8( KZ, "Z" );
+
+// gp namespace (RFC 4119)
+_LIT8( KGpNamespace, " xmlns:gp=\"urn:ietf:params:xml:ns:pidf:geopriv10\"" );
+_LIT8( KGp, "<gp:" );
+_LIT8( KGpEnd, "</gp:" );
+_LIT8( KGeopriv, "geopriv" );
+_LIT8( KLocationInfo, "location-info" );
+_LIT8( KUsageRules, "usage-rules" );
+_LIT8( KRetransmissionAllowed, "retransmission-allowed" );
+_LIT8( KRetentionExpiry, "retention-expiry" );
+_LIT8( KMethod, "method" );
+_LIT8( KNo, "no" );
+_LIT8( KDhcp, "DHCP" );
+
+// gml namespace (RFC 4119)
+_LIT8( KGmlNamespace,
+    " xmlns:gml=\"urn:opengis:specification:gml:schema-xsd:feature:v3.0\"" );
+_LIT8( KGml, "<gml:" );
+_LIT8( KGmlEnd, "</gml:" );
+_LIT8( KGmlId, " gml:id=\"" );
+_LIT8( KLocation, "location" );
+_LIT8( KPoint, "Point" );
+_LIT8( KCoordinates, "coordinates" );
+_LIT8( KPointId1, "point1" );
+_LIT8( KSrsName, " srsName=\"" );
+_LIT8( KNorth, "N" );
+_LIT8( KEast, "E" );
+_LIT8( KSouth, "S" );
+_LIT8( KWest, "W" );
+
+// Datum related (RFC 3825)
+_LIT8( KEpsg4269, "epsg:4269" ); // NAD83 (North American Datum 1983)
+_LIT8( KEpsg4326, "epsg:4326" ); // EPSG:4326 - WGS84 (World Geodesic Datum)
+
+// cl namespace (RFC 4119)
+_LIT8( KClNamespace,
+    " xmlns:cl=\" urn:ietf:params:xml:ns:pidf:geopriv10:civicLoc\"" );
+_LIT8( KCl, "<cl:" );
+_LIT8( KClEnd, "</cl:" );
+_LIT8( KCivicAddress, "civicAddress" );
+
+// Other constants
+const TUint8 KDhcpMinAsciiValue = 0x1f;
+const TUint8 KDhcpMaxAsciiValue = 0x7f;
+const TReal KDhcp25BitDivisor = 0x2000000;          // 33554432dec;
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+TDhcpLocationInformationParser::TDhcpLocationInformationParser()
+    {
+    iTimeStamp.HomeTime();
+    }
+
+// ---------------------------------------------------------------------------
+// Parse XML description, geoConf or civic address, of the location
+// information. RFC 4119
+// ---------------------------------------------------------------------------
+//
+void TDhcpLocationInformationParser::ParseLocationInformation(
+    const TDesC8& aInput, const TParsingType aParsingType, TDes8& aOutput )
+    {
+    TRACESTRING( "TLocationInformationParser::ParseLocationInformation" );
+
+    // XML
+    aOutput.Append( KOpenBracket );
+    aOutput.Append( KXMLBegin );
+    aOutput.Append( KCloseBracket );
+
+    // presence
+    aOutput.Append( KOpenBracket );
+    aOutput.Append( KPresence );
+    aOutput.Append( KXmlnsNamespace );
+    aOutput.Append( KGpNamespace );
+    if ( EDHCPCoordinates == aParsingType )
+        {
+        aOutput.Append( KGmlNamespace );
+        }
+    else // EDHCPCivicAddress
+        {
+        aOutput.Append( KClNamespace );
+        }
+
+    aOutput.Append( KCloseBracket );
+
+    // tuple
+    aOutput.Append( KOpenBracket );
+    aOutput.Append( KTuple );
+    aOutput.Append( KId );
+    aOutput.Append( KTupleId1 );
+    aOutput.Append( KQuotationMark );
+    aOutput.Append( KCloseBracket );
+
+    // timestamp
+    aOutput.Append( KTimeStamp );
+    ParseTimeStamp( aOutput );
+    aOutput.Append( KTimeStampEnd );
+
+    // status
+    aOutput.Append( KOpenBracket );
+    aOutput.Append( KStatus );
+    aOutput.Append( KCloseBracket );
+
+    // geopriv
+    aOutput.Append( KGp );
+    aOutput.Append( KGeopriv );
+    aOutput.Append( KCloseBracket );
+
+    // location-info
+    aOutput.Append( KGp );
+    aOutput.Append( KLocationInfo );
+    aOutput.Append( KCloseBracket );
+
+    if (aParsingType == EDHCPCoordinates)
+        {
+        // GML
+        aOutput.Append( KGml );
+        aOutput.Append( KLocation );
+        aOutput.Append( KCloseBracket );
+
+        // Point
+        aOutput.Append( KGml );
+        aOutput.Append( KPoint );
+        aOutput.Append( KGmlId );
+        aOutput.Append( KPointId1 );
+        aOutput.Append( KQuotationMark );
+        // srsName, i.e. datum
+        ParseDatum( aInput, aOutput ); // Ignore error
+        aOutput.Append( KCloseBracket );
+
+        // coordinates
+        aOutput.Append( KGml );
+        aOutput.Append( KCoordinates );
+        aOutput.Append( KCloseBracket );
+
+        // Parse coordinates
+        ParseLCI( aInput, aOutput );
+
+        // coordinates end
+        aOutput.Append( KGmlEnd );
+        aOutput.Append( KCoordinates );
+        aOutput.Append( KCloseBracket );
+
+        // Point end
+        aOutput.Append( KGmlEnd );
+        aOutput.Append( KPoint );
+        aOutput.Append( KCloseBracket );
+
+        // GML end
+        aOutput.Append( KGmlEnd );
+        aOutput.Append( KLocation );
+        aOutput.Append( KCloseBracket );
+        }
+    else // EDHCPCivicAddress
+        {
+        // civicAddress
+        aOutput.Append( KCl );
+        aOutput.Append( KCivicAddress );
+        aOutput.Append( KCloseBracket );
+
+        // Parse civic address elements
+        ParseCivicAddressElements( aInput, aOutput );
+
+        // civicAddress end
+        aOutput.Append( KClEnd );
+        aOutput.Append( KCivicAddress );
+        aOutput.Append( KCloseBracket );
+        }
+
+    // location-info end
+    aOutput.Append( KGpEnd );
+    aOutput.Append( KLocationInfo );
+    aOutput.Append( KCloseBracket );
+
+    // usage-rules
+    aOutput.Append( KGp );
+    aOutput.Append( KUsageRules );
+    aOutput.Append( KCloseBracket );
+    // retransmission-allowed
+    aOutput.Append( KGp );
+    aOutput.Append( KRetransmissionAllowed );
+    aOutput.Append( KCloseBracket );
+    aOutput.Append( KNo );
+    aOutput.Append( KGpEnd );
+    aOutput.Append( KRetransmissionAllowed );
+    aOutput.Append( KCloseBracket );
+    // retention-expiry
+    aOutput.Append( KGp );
+    aOutput.Append( KRetentionExpiry );
+    aOutput.Append( KCloseBracket );
+    ParseRetentionExpiry( aOutput );
+    aOutput.Append( KGpEnd );
+    aOutput.Append( KRetentionExpiry );
+    aOutput.Append( KCloseBracket );
+    // method
+    aOutput.Append( KGp );
+    aOutput.Append( KMethod );
+    aOutput.Append( KCloseBracket );
+    aOutput.Append( KDhcp );
+    aOutput.Append( KGpEnd );
+    aOutput.Append( KMethod );
+    aOutput.Append( KCloseBracket );
+
+    // : provided-by
+
+    // usage-rules end
+    aOutput.Append( KGpEnd );
+    aOutput.Append( KUsageRules );
+    aOutput.Append( KCloseBracket );
+
+    // geopriv end
+    aOutput.Append( KGpEnd );
+    aOutput.Append( KGeopriv );
+    aOutput.Append( KCloseBracket );
+
+    // status end
+    aOutput.Append( KOpenBracket );
+    aOutput.Append( KForwardSlash );
+    aOutput.Append( KStatus );
+    aOutput.Append( KCloseBracket );
+
+    // tuple end
+    aOutput.Append( KOpenBracket );
+    aOutput.Append( KForwardSlash );
+    aOutput.Append( KTuple );
+    aOutput.Append( KCloseBracket );
+
+    // presence end
+    aOutput.Append( KOpenBracket );
+    aOutput.Append( KForwardSlash );
+    aOutput.Append( KPresence );
+    aOutput.Append( KCloseBracket );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Parses datum from the input
+// Datum usage: RFC 3825.
+// ---------------------------------------------------------------------------
+//
+TInt TDhcpLocationInformationParser::ParseDatum (const TDesC8& aInput, TDes8& aOutput )
+    {
+    TRACESTRING( "TLocationInformationParser::ParseDatum" );
+
+    if ( 16 > aInput.Length() )
+        {
+        return KErrNotFound;
+        }
+
+    // The LCI form is of fixed length (16 bytes). The last byte of the input
+    // contains the datum value.
+    switch ( ( TUint8 )aInput[ 15 ] )
+        {
+        case 1:
+            {
+            // WGS 84, 2D only (For 3D: WGS84 (Geographical 3D))
+            aOutput.Append( KSrsName );
+            aOutput.Append( KEpsg4326 );
+            aOutput.Append( KQuotationMark );
+            return KErrNone;
+            }
+        case 2:
+            {
+            // NAD83, 2D only (For 3D: NAD83 & NAVD88)
+            aOutput.Append( KSrsName );
+            aOutput.Append( KEpsg4269 );
+            aOutput.Append( KQuotationMark );
+            return KErrNone;
+            }
+        case 3:
+            {
+            // NAD83, 2D only (For 3D: NAD83 & MLLW)
+            aOutput.Append( KSrsName );
+            aOutput.Append( KEpsg4269 );
+            aOutput.Append( KQuotationMark );
+            return KErrNone;
+            }
+        default:
+            {
+            return KErrNotSupported;
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Parses the input to the LCI form
+// ---------------------------------------------------------------------------
+//
+void TDhcpLocationInformationParser::ParseLCI(
+    const TDesC8& aInput, TDes8& aOutput )
+    {
+    TRACESTRING( "TLocationInformationParser::ParseLCI" );
+
+    TLex8 input( aInput );
+
+    // Latitude
+
+    // Latitude resolution (6 bits)
+    TUint8 laRes = ( TUint8 )input.Peek();
+    laRes >>= 2;
+
+    // Latitude (9 bits integer, 25 bits fraction)
+    TUint16 laInt = ( TUint16 )input.Get();
+    laInt <<= 14;
+    laInt >>= 6;
+    laInt += ( TUint8 )input.Peek();
+    laInt >>= 1;
+
+    TUint32 laFra = ( TUint32 )input.Get();
+    laFra <<= 8;
+    laFra += ( TUint8 )input.Get();
+    laFra <<= 8;
+    laFra += ( TUint8 )input.Get();
+    laFra <<= 8;
+    laFra += ( TUint8 )input.Get();
+    laFra <<= 7;
+    laFra >>= 7;
+
+    ParseDMS( ETrue, laRes, laInt, laFra, aOutput );
+
+    aOutput.Append( KSpaceChar );
+
+    // Longitude
+
+    // Longitude resolution (6 bits)
+    TUint8 loRes = ( TUint8 )input.Peek();
+    loRes >>= 2;
+
+    // Longitude (9 bits integer, 25 bits fraction)
+    TUint16 loInt = ( TUint16 )input.Get();
+    loInt <<= 14;
+    loInt >>= 6;
+    loInt += ( TUint8 )input.Peek();
+    loInt >>= 1;
+
+    TUint32 loFra = ( TUint32 )input.Get();
+    loFra <<= 8;
+    loFra += ( TUint8 )input.Get();
+    loFra <<= 8;
+    loFra += ( TUint8 )input.Get();
+    loFra <<= 8;
+    loFra += ( TUint8 )input.Get();
+    loFra <<= 7;
+    loFra >>= 7;
+
+    ParseDMS( EFalse, loRes, loInt, loFra, aOutput );
+
+    // Altitude
+    if ( 15 <= aInput.Length() )
+        {
+        // AT (4 bits)
+        // 1 for meters, 2 for floors
+        TUint8 AT = ( TUint8 )input.Peek();
+        AT >>= 4;
+
+        // Altitude resolution (6 bits)
+        TUint16 altRes = ( TUint16 )input.Get();
+        altRes <<= 8;
+        altRes += ( TUint8 )input.Peek();
+        altRes >>= 6;
+
+        // Altitude (30 bits)
+        TUint32 alt = ( TUint32 )input.Get();
+        alt <<= 26;
+        alt >>= 18;
+        alt += ( TUint8 )input.Get();
+        alt <<= 8;
+        alt += ( TUint8 )input.Get();
+        alt <<= 8;
+        alt += ( TUint8 )input.Get();
+        alt <<= 8;
+
+        TRACESTRING2( "AT: %d", AT );
+        TRACESTRING2( "altRes: %d", altRes );
+        TRACESTRING2( "alt: %d", alt );
+        }
+
+    // No support for parsing altitude to XML yet
+    }
+
+
+// ---------------------------------------------------------------------------
+// Parses the input to the DMS coordinate form
+// ---------------------------------------------------------------------------
+//
+void TDhcpLocationInformationParser::ParseDMS(
+    TBool aIsLatitude,
+    TUint8 aResolution,
+    TUint16 aInteger,
+    TUint32 aFraction,
+    TDes8& aOutput )
+    {
+    TRACESTRING( "TLocationInformationParser::ParseDMS" );
+
+    TRACESTRING2( "aResolution: %d", aResolution );
+    TRACESTRING2( "aInteger: %d", aInteger );
+    TRACESTRING2( "aFraction: %d", aFraction );
+
+    // Check the first bit for sign
+    TUint16 sign = aInteger; // 9 bits
+    sign >>= 8;
+
+    // 2s complement
+    if ( sign )
+        {
+        aInteger = ~aInteger;
+        aInteger <<= 7;
+        aInteger >>= 7;
+        aFraction = ~aFraction;
+        aFraction <<= 7;
+        aFraction >>= 7;
+        }
+
+    // Apply resolution
+    if ( 9 < aResolution )
+        {
+        // Fractional part
+        aFraction >>= ( 34 - aResolution );
+        aFraction <<= ( 34 - aResolution );
+        }
+    else
+        {
+        // No fractional part
+        aFraction = 0;
+        // Integer part
+        aInteger >>= ( 9 - aResolution );
+        aInteger <<= ( 9 - aResolution );
+        }
+
+    // Fractional part
+    TReal minutes( 0.0 );
+    TReal seconds( 0.0 );
+    if ( aFraction )
+        {
+        TReal frac = ( TReal )aFraction / KDhcp25BitDivisor;
+        Math::Int( minutes, 60.0 * frac );
+        frac = 60.0 * frac - minutes;
+        Math::Int( seconds, 60.0 * frac );
+        }
+
+    // Parse the result
+    aOutput.AppendNum( aInteger );
+    aOutput.Append( KColon );
+    aOutput.AppendNum( ( TUint8 )minutes );
+    aOutput.Append( KColon );
+    aOutput.AppendNum( ( TUint8 )seconds );
+    if ( aIsLatitude )
+        {
+        if ( sign )
+            {
+            aOutput.Append( KSouth );
+            }
+        else
+            {
+            aOutput.Append( KNorth );
+            }
+        }
+    else
+        {
+        if ( sign )
+            {
+            aOutput.Append( KWest );
+            }
+        else
+            {
+            aOutput.Append( KEast );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Parse XML description of civic address elements
+// Correspondence of tags can be found in Ch.3.4 Civic Address Components in
+// http://www.ietf.org/internet-drafts/draft-ietf-geopriv-dhcp-civil-09.txt
+// ---------------------------------------------------------------------------
+//
+void TDhcpLocationInformationParser::ParseCivicAddressElements(
+    const TDesC8& aInput, TDes8& aOutput )
+    {
+    TRACESTRING( "TLocationInformationParser::ParseCivicAddressElements" );
+
+    TLex8 input( aInput );
+
+    // Skip what
+    input.Inc();
+
+    // country code, two letters long
+    aOutput.Append( KCl );
+    aOutput.Append( KDhcpCountry );
+    aOutput.Append( KCloseBracket );
+    aOutput.Append( input.Get() );
+    aOutput.Append( input.Get() );
+    aOutput.Append( KClEnd );
+    aOutput.Append( KDhcpCountry );
+    aOutput.Append( KCloseBracket );
+
+    // civicAddress elements
+    while ( !input.Eos() )
+        {
+        TInt type = ( TUint8 )input.Get();
+        switch ( type )
+            {
+            case KDhcpState:
+                {
+                TRACESTRING( "KDhcpState" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpA1 );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpA1 );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpCounty:
+                {
+                TRACESTRING( "KDhcpCounty" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpA2 );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpA2 );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpCity:
+                {
+                TRACESTRING( "KDhcpCity" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpA3 );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpA3 );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpBorough:
+                {
+                TRACESTRING( "KDhcpBorough" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpA4 );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpA4 );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpBlock:
+                {
+                TRACESTRING( "KBlock" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpA5 );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpA5 );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpGroupOfStreets:
+                {
+                TRACESTRING( "KGroupOfStreets" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpA6 );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpA6 );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpLeadingStreetDirection:
+                {
+                TRACESTRING( "KLeadingStreetDirection" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpPRD );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpPRD );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpTrailingStreetDirection:
+                {
+                TRACESTRING( "KTrailingStreetDirection" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpPOD );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpPOD );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpStreetSuffix:
+                {
+                TRACESTRING( "KStreetSuffix" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpSTS );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpSTS );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpHouseNumber:
+                {
+                TRACESTRING( "KHouseNumber" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpHNO );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpHNO );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpHouseNumberSuffix:
+                {
+                TRACESTRING( "KHouseNumberSuffix" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpHNS );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpHNS );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpVanityAddress:
+                {
+                TRACESTRING( "KVanityAddress" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpLMK );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpLMK );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpAdditionalLocationInformation:
+                {
+                TRACESTRING( "KAdditionalLocationInformation" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpLOC );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpLOC );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpName:
+                {
+                TRACESTRING( "KName" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpNAM );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpNAM );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpPostalCode:
+                {
+                TRACESTRING( "KPostalCode" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpPC );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpPC );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDchpCASeat:
+                {
+                TRACESTRING( "KCASeat" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpSEAT );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpSEAT );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            case KDhcpFloor:
+                {
+                TRACESTRING( "KFloor" );
+                aOutput.Append( KCl );
+                aOutput.Append( KDhcpFLR );
+                aOutput.Append( KCloseBracket );
+                ExtractCivicAddressElement( input, aOutput );
+                aOutput.Append( KClEnd );
+                aOutput.Append( KDhcpFLR );
+                aOutput.Append( KCloseBracket );
+                break;
+                }
+            default:
+                {
+                TRACESTRING2( "Not a supported CAtype: %d", type );
+                input.Inc( ( TInt )input.Get() ); // Skip value
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Extract a single civic address element from the input
+// ---------------------------------------------------------------------------
+//
+void TDhcpLocationInformationParser::ExtractCivicAddressElement(
+    TLex8& aInput, TDes8& aOutput )
+    {
+    TRACESTRING( "TLocationInformationParser::ExtractCivicAddressElement" );
+
+    // Extract data length
+    TInt length = ( TInt )aInput.Get();
+    // Extract data
+    while ( length )
+        {
+        if ( KDhcpMinAsciiValue < ( TUint8 )aInput.Peek() &&
+             KDhcpMaxAsciiValue > ( TUint8 )aInput.Peek() )
+            {
+            aOutput.Append( aInput.Get() );
+            }
+        length--;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Parses the timestamp
+// ---------------------------------------------------------------------------
+//
+void TDhcpLocationInformationParser::ParseTimeStamp( TDes8& aTimeStamp )
+    {
+    TRACESTRING( "TLocationInformationParser::ParseTimeStamp" );
+
+    TDateTime timeStamp = iTimeStamp.DateTime();
+    aTimeStamp.AppendNum( timeStamp.Year() );
+    aTimeStamp.Append( KHyphen );
+    aTimeStamp.AppendNum( timeStamp.Month() + 1 );
+    aTimeStamp.Append( KHyphen );
+    aTimeStamp.AppendNum( timeStamp.Day() + 1 );
+    aTimeStamp.Append( KT );
+    aTimeStamp.AppendNum( timeStamp.Hour() );
+    aTimeStamp.Append( KColon );
+    aTimeStamp.AppendNum( timeStamp.Minute() );
+    aTimeStamp.Append( KColon );
+    aTimeStamp.AppendNum( timeStamp.Second() );
+    aTimeStamp.Append( KZ );
+    }
+
+// ---------------------------------------------------------------------------
+// Parses the retention expiry. It is the timestamp value plus one day
+// ---------------------------------------------------------------------------
+//
+void TDhcpLocationInformationParser::ParseRetentionExpiry( TDes8& aTargetBfr )
+    {
+    TRACESTRING( "TLocationInformationParser::ParseRetentionExpiry" );
+    // Define the retention-expiry
+    TTime expiryTime( iTimeStamp );
+    TTimeIntervalDays day( 1 );
+    expiryTime += day;
+    TDateTime retentionExpiry = expiryTime.DateTime();
+
+    // Parse the retention-expiry
+    aTargetBfr.AppendNum( retentionExpiry.Year() );
+    aTargetBfr.Append( KHyphen );
+    aTargetBfr.AppendNum( retentionExpiry.Month() + 1 );
+    aTargetBfr.Append( KHyphen );
+    aTargetBfr.AppendNum( retentionExpiry.Day() + 1 );
+    aTargetBfr.Append( KT );
+    aTargetBfr.AppendNum( retentionExpiry.Hour() );
+    aTargetBfr.Append( KColon );
+    aTargetBfr.AppendNum( retentionExpiry.Minute() );
+    aTargetBfr.Append( KColon );
+    aTargetBfr.AppendNum( retentionExpiry.Second() );
+    aTargetBfr.Append( KZ );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcppsypositioner.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,129 @@
+/*
+* 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: 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <lbspositioninfo.h>      // TPositionInfoBase
+#include "dhcppsypositioner.h"
+#include "dhcppsylogging.h"
+#include "dhcppsypanic.h"
+#include "dhcppsysingletonhandler.h"
+#include "dhcppsyrequester.h"
+#include "dhcppsy.hrh"
+
+// LOCAL CONSTANTS AND MACROS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyPositioner::CDhcpPsyPositioner
+// C++default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CDhcpPsyPositioner::CDhcpPsyPositioner()
+    {
+    // Nothing to do here
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyPositioner::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CDhcpPsyPositioner::ConstructL( TAny* aConstructionParameters )
+    {
+    TRACESTRING( "CDhcpPsyPositioner::ConstructL start" )
+    // Calling BaseConstructL is required by Positioning Plug-in API.
+    BaseConstructL( aConstructionParameters );
+    // Construct requester
+    iDhcpRequestManager = CDhcpPsySingletonHandler::GetInstanceL();
+    TRACESTRING( "CDhcpPsyPositioner::ConstructL end" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyPositioner::NewL
+// Two - phased constructor.
+// -----------------------------------------------------------------------------
+//
+CDhcpPsyPositioner* CDhcpPsyPositioner::NewL( TAny* aConstructionParameters )
+    {
+    CDhcpPsyPositioner* self = new( ELeave ) CDhcpPsyPositioner;
+    CleanupStack::PushL( self );
+    self->ConstructL( aConstructionParameters );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyPositioner::~CDhcpPsyPositioner
+//
+// -----------------------------------------------------------------------------
+//
+CDhcpPsyPositioner::~CDhcpPsyPositioner()
+    {
+    TRACESTRING( "CDhcpPsyPositioner:: destructed, psy shutdown lauched")
+    if (iDhcpRequestManager)
+        {
+        iDhcpRequestManager->ReleaseInstance();
+        }
+    TRACESTRING( "CDhcpPsyPositioner:: destructed" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyPositioner::StatusReportInterface
+//
+// -----------------------------------------------------------------------------
+//
+MPositionerStatus& CDhcpPsyPositioner::StatusReportInterface()
+    {
+    TRACESTRING( "CDhcpPsyPositioner::StatusReportInterface" )
+    return *PositionerStatus();
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyPositioner::NotifyPositionUpdate
+//
+// -----------------------------------------------------------------------------
+//
+void CDhcpPsyPositioner::NotifyPositionUpdate (TPositionInfoBase& aPosInfo,
+    TRequestStatus&    aStatus )
+    {
+    TRACESTRING( "CDhcpPsyPositioner::NotifyPositionUpdate" )
+    iDhcpRequestManager->Requester()->NotifyPositionUpdate (aPosInfo,
+            aStatus);
+    TRACESTRING( "CDhcpPsyPositioner::NotifyPositionUpdate" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyPositioner::CancelNotifyPositionUpdate
+//
+// -----------------------------------------------------------------------------
+//
+void CDhcpPsyPositioner::CancelNotifyPositionUpdate ()
+    {
+    TRACESTRING( "CDhcpPsyPositioner::CancelNotifyPositionUpdate start" )
+    //
+    // This doens't actually cancel request, it will make sure that requester will not
+    // complete actual request to client since it will not listen anymore
+    iDhcpRequestManager->Requester()->CancelRequest();
+    TRACESTRING( "CDhcpPsyPositioner::CancelNotifyPositionUpdate end" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcppsyrequester.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,240 @@
+/*
+* 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: 
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <lbspositioninfo.h>        // TPositionInfoBase
+#include <lbs/epos_cpositioner.h>       // CPositioner
+
+#include <dhcppsy.h>
+#include "dhcpwlanqueryhandler.h"
+#include "dhcppsylogging.h"
+#include "dhcppsypanic.h"
+#include "dhcppsy.hrh"
+#include "dhcppsypositioner.h"
+#include "dhcppsyrequester.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyRequester::CDhcpPsyRequester
+// C++default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CDhcpPsyRequester::CDhcpPsyRequester ()
+    {
+    TRACESTRING( "CDhcpPsyRequester::CDhcpPsyRequester" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyRequester::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CDhcpPsyRequester::ConstructL()
+    {
+    TRACESTRING( "CDhcpPsyRequester::ConstructL start" )
+    iWlanDhcpQuery = CDhcpWlanQueryHandler::NewL(this);
+    TRACESTRING( "CDhcpPsyRequester::ConstructL end" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyRequester::NewL
+// Two - phased constructor.
+// -----------------------------------------------------------------------------
+//
+CDhcpPsyRequester* CDhcpPsyRequester::NewL()
+    {
+    TRACESTRING( "CDhcpPsyRequester::NewL" )
+    CDhcpPsyRequester* self = new(ELeave) CDhcpPsyRequester ();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyRequester::~CDhcpPsyRequester
+//
+// -----------------------------------------------------------------------------
+//
+CDhcpPsyRequester::~CDhcpPsyRequester()
+    {
+    TRACESTRING( "CDhcpPsyRequester::~CDhcpPsyRequester" )
+    Flush();
+    delete iLocationData;
+    TRACESTRING( "CDhcpPsyRequester::~CDhcpPsyRequester,destructed" )
+    }
+
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyRequester::NotifyPositionUpdate
+//
+// -----------------------------------------------------------------------------
+//
+void CDhcpPsyRequester::NotifyPositionUpdate (TPositionInfoBase& aPosInfo,
+    TRequestStatus& aStatus )
+    {
+    TRACESTRING( "CDhcpPsyRequester::NotifyPositionUpdate start" )
+    aStatus = KRequestPending;
+    iRequestStatus = &aStatus;
+    TInt result=FetchPositioningGenericData (aPosInfo);
+    if (result==KErrNone)
+        {
+        // Start the location query
+        TRAPD (err, iWlanDhcpQuery->MakeLocationQueryL (iIAPProfileId)) ;
+        result = err;
+        }
+    if (result!=KErrNone)
+        {
+        CompleteRequest (result);
+        }
+    TRACESTRING( "CDhcpPsyRequester::NotifyPositionUpdate" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyRequester::FetchPositioningGenericData
+//
+// -----------------------------------------------------------------------------
+//
+TInt CDhcpPsyRequester::FetchPositioningGenericData (TPositionInfoBase& aPosInfo)
+    {
+    TInt result=KErrArgument;
+    TRACESTRING( "CDhcpPsyRequester::FetchPositioningGenericData" )
+    iPositionInfo = &aPosInfo;
+    if (aPosInfo.PositionClassType () & EPositionGenericInfoClass)
+        {
+        HPositionGenericInfo* posInfo =
+            static_cast<HPositionGenericInfo*>(iPositionInfo);
+        if ( posInfo->IsRequestedField(EDhcpPsyIAPProfileIdField))
+            {
+            result = posInfo->GetValue (EDhcpPsyIAPProfileIdField, iIAPProfileId);
+            TRACESTRING2( "CDhcpPsyRequester::FetchPositioningGenericData, IAP id : %d ", iIAPProfileId );
+            }
+        }
+    TRACESTRING2( "CDhcpPsyRequester::FetchPositioningGenericData, result : %d ", result );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyRequester::ProgressPsyRequestNotificationL
+// -----------------------------------------------------------------------------
+//
+void CDhcpPsyRequester::ProgressPsyRequestNotificationL(TRequestProgressPhases aPhase,
+    TInt aPhaseValue)
+    {
+    TRACESTRING2( "CDhcpPsyRequester::ProgressPsyRequestNotificationL, %d",aPhase);
+    TRACESTRING2( "CDhcpPsyRequester::ProgressPsyRequestNotificationL, %d",aPhaseValue);
+    switch ( aPhase )
+        {
+        case MDhcpPsyRequesterProgressObserver::EConnectionInitiated:
+            {
+            // Nothing yet
+            }
+            break;
+        case MDhcpPsyRequesterProgressObserver::ELocationQueryStarted:
+            {
+            // Location query started
+            }
+            break;
+        case MDhcpPsyRequesterProgressObserver::ELocationQueryFinished:
+            {
+            // Location query finished, without problem or not.
+            if(aPhaseValue==KErrNone&&!iCancelled)
+                {
+                HPositionGenericInfo* posInfo =
+                    static_cast<HPositionGenericInfo*>(iPositionInfo);
+                posInfo->SetRequestedField(EDhcpPsyLocationResultDataField);
+                if(iLocationData)
+                    {
+                    delete iLocationData;
+                    iLocationData = NULL;
+                    }
+
+                TPtrC8 ptr(*iWlanDhcpQuery->LocationData());
+                iLocationData = ptr.AllocL();
+                ptr.Set(*iLocationData);
+                posInfo->SetValue (EDhcpPsyLocationResultDataField, ptr );
+                }
+            CompleteRequest (aPhaseValue);
+            }
+            break;
+        case MDhcpPsyRequesterProgressObserver::ECancelled:
+            {
+            // Nothing yet
+            }
+            break;
+       default:
+            {
+            TRACESTRING( "CDhcpPsyRequester::ProgressPsyRequestNotificationL, Not supported" )
+            User::Leave(KErrNotSupported);
+            }
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyRequester::CancelRequest
+// -----------------------------------------------------------------------------
+//
+void CDhcpPsyRequester::CancelRequest ()
+    {
+    TRACESTRING( "CDhcpPsyRequester::CancelRequest" )    //
+    if (iWlanDhcpQuery)
+        {
+        iWlanDhcpQuery->Cancel();
+        }
+
+    if (iRequestStatus)
+        {
+        User::RequestComplete ( iRequestStatus, KErrNone );
+        }
+
+    iCancelled = ETrue;
+    TRACESTRING( "CDhcpPsyRequester::CancelRequest" )    //
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyRequester::Flush
+// -----------------------------------------------------------------------------
+//
+void CDhcpPsyRequester::Flush()
+    {
+    TRACESTRING( "CDhcpPsyRequester::Flush" )
+    delete iWlanDhcpQuery;
+    iWlanDhcpQuery = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsyRequester::CompleteRequest
+// -----------------------------------------------------------------------------
+//
+void CDhcpPsyRequester::CompleteRequest(TInt aStatusCode)
+    {
+    TRACESTRING( "CDhcpPsyRequester::CompleteRequest" )    //
+    //Set UID before complete the request
+    iPositionInfo->SetModuleId( TUid::Uid( KDhcpPsyImplUid ) );
+    User::RequestComplete( iRequestStatus, aStatusCode );
+    TRACESTRING( "CDhcpPsyRequester::CompleteRequest, request complete" )
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcppsysingletonhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,89 @@
+/*
+* 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:  Implement the singleton handler for dhcppositionprovider.
+*
+*/
+
+#include "dhcppsylogging.h"
+#include "dhcppsyrequester.h"
+#include "dhcppsysingletonhandler.h"
+
+// ---------------------------------------------------------------------------
+// CDhcpPsySingletonHandler::GetInstanceL
+// ---------------------------------------------------------------------------
+//
+CDhcpPsySingletonHandler* CDhcpPsySingletonHandler::GetInstanceL ()
+    {
+    TRACESTRING( "CDhcpPsySingletonHandler:: GetInstanceL" )
+    CDhcpPsySingletonHandler* self =
+        reinterpret_cast < CDhcpPsySingletonHandler*>( Dll::Tls() );
+
+    if ( !self )
+        {
+        self = new( ELeave ) CDhcpPsySingletonHandler;
+        CleanupStack::PushL( self );
+        self->ConstructL ();
+        CleanupStack::Pop( self );
+        Dll::SetTls( self );
+        }
+
+    self->iRefCount++;
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CDhcpPsySingletonHandler::~CDhcpPsySingletonHandler ()
+    {
+    TRACESTRING( "CDhcpPsySingletonHandler:: ~CDhcpPsySingletonHandler" )
+    delete iPsyRequester;
+    iPsyRequester = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsySingletonHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CDhcpPsySingletonHandler::ConstructL ()
+    {
+    TRACESTRING( "CDhcpPsySingletonHandler::ConstructL" )
+    iPsyRequester = CDhcpPsyRequester::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsySingletonHandler::ReleaseInstance
+// -----------------------------------------------------------------------------
+//
+void CDhcpPsySingletonHandler::ReleaseInstance()
+    {
+    TRACESTRING( "CDhcpPsySingletonHandler::ReleaseInstance" )
+    iRefCount--;
+    if ( iRefCount == 0 )
+        {
+        delete this;
+        Dll::SetTls( NULL );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpPsySingletonHandler::Requester
+// -----------------------------------------------------------------------------
+//
+CDhcpPsyRequester* CDhcpPsySingletonHandler::Requester ()
+    {
+    TRACESTRING( "CDhcpPsySingletonHandler::Requester" )
+    return iPsyRequester;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcpserveripaddressresolver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,179 @@
+/*
+* 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:  Resolve ip address of the DHCP server at the WLAN network
+*
+*/
+
+
+#include <e32std.h>
+#include <es_sock.h>
+#include "dhcppsylogging.h"
+#include "dhcpconstants.h"
+#include "dhcpserveripaddressresolver.h"
+
+const TInt KDhcpPeriodicTimerInterval05Sec(500000);
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CDhcpPsyDhcpServerIPResolver* CDhcpPsyDhcpServerIPResolver::NewL( RConnection& aConnection,
+        TRequestStatus& aStatus )
+    {
+    TRACESTRING ( "CDhcpPsyDhcpServerIPResolver::NewL" );
+    CDhcpPsyDhcpServerIPResolver* self = new( ELeave ) CDhcpPsyDhcpServerIPResolver(
+        aConnection, aStatus );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CDhcpPsyDhcpServerIPResolver::~CDhcpPsyDhcpServerIPResolver()
+    {
+    TRACESTRING( "CDhcpPsyDhcpServerIPResolver::~CDhcpPsyDhcpServerIPResolver" );
+    Cancel();
+    delete iPeriodicTimer;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ onstructor
+// ---------------------------------------------------------------------------
+//
+CDhcpPsyDhcpServerIPResolver::CDhcpPsyDhcpServerIPResolver( RConnection& aConnection,
+        TRequestStatus& aStatus) : CActive ( EPriorityStandard ), iConnection(aConnection),
+        iClientStatus (aStatus)
+    {
+    TRACESTRING( "CDhcpPsyDhcpServerIPResolver::CDhcpPsyDhcpServerIPResolver" );
+    CActiveScheduler::Add( this );
+    iInetAddress.Init (KAfInet6);
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CDhcpPsyDhcpServerIPResolver::ConstructL()
+    {
+    TRACESTRING( "CDhcpPsyDhcpServerIPResolver::ConstructL" );
+    iClientStatus = KRequestPending;
+    iPckg().iAddr.SetFamily( KAfInet6 );    // Ipv 6, contains support both
+                                            // ipv4 and ipv6 versions
+                                            //
+    iConnection.Ioctl( KCOLConfiguration, KConnGetServerAddr,
+        iStatus, &iPckg );
+
+    SetActive ();
+
+    // Initialize the periodic timer.
+    iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityIdle);
+    // Start the periodic timer, when ever the time elapsed
+    // the PeriodicTimerCallBack() will get called.
+    iPeriodicTimer->Start(KDhcpPeriodicTimerInterval05Sec,
+            KDhcpPeriodicTimerInterval05Sec, TCallBack(PeriodicTimerCallBack,
+            this));
+
+    }
+
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CDhcpPsyDhcpServerIPResolver::RunL()
+    {
+    TRACESTRING( "CDhcpPsyDhcpServerIPResolver::RunL");
+    iDhcpResponseReceived = ETrue;
+    TInt result = iStatus.Int();
+    TRACESTRING2( "CDhcpPsyDhcpServerIPResolver::RunL, result %d",result);
+    if (result==KErrNone)
+        {
+        iInetAddress = TInetAddr::Cast(iPckg().iAddr);
+        }
+    iPeriodicTimer->Cancel();
+    CompleteRequest (result);
+    }
+
+// ---------------------------------------------------------------------------
+// DhcpServerAddress
+// ---------------------------------------------------------------------------
+//
+TInetAddr& CDhcpPsyDhcpServerIPResolver::DhcpServerInetAddress ()
+    {
+    TRACESTRING2 ( "CDhcpPsyDhcpServerIPResolver::DhcpServerInetAddress, %u ",
+            iInetAddress.Address());
+    return iInetAddress;
+    }
+
+// ---------------------------------------------------------------------------
+// DoCancel
+// ---------------------------------------------------------------------------
+//
+void CDhcpPsyDhcpServerIPResolver::DoCancel()
+    {
+    TRACESTRING( "CDhcpPsyDhcpServerIPResolver::DoCancel" );
+    iConnection.CancelIoctl();
+    if (iPeriodicTimer)
+        {
+        iPeriodicTimer->Cancel();
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CDhcpPsyDhcpServerIPResolver::CancelOutstandigRequest
+// ----------------------------------------------------------------------------
+//
+void CDhcpPsyDhcpServerIPResolver::CancelOutstandigRequest ()
+    {
+    TRACESTRING ( "CDhcpPsyDhcpServerIPResolver::CancelOutstandigRequest ");
+    iConnection.CancelIoctl();
+    if (!iDhcpResponseReceived)
+        {
+        // If real dhcp server can't found, we have to use the broadcast address
+        // Most probaply, device is behind of wlan subnet which has not own dhcp server.
+        iInetAddress.SetAddress(KInetAddrBroadcast);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CDhcpPsyDhcpServerIPResolver::CompleteRequest
+// ----------------------------------------------------------------------------
+//
+void CDhcpPsyDhcpServerIPResolver::CompleteRequest (TInt aStatusCode)
+    {
+    TRACESTRING2 ( "CDhcpPsyDhcpServerIPResolver::CompleteRequest, status %d ",
+            aStatusCode);
+    TRequestStatus* status = &iClientStatus;
+    User::RequestComplete(status, aStatusCode);
+    }
+
+// ----------------------------------------------------------------------------
+// CDhcpPsyDhcpServerIPResolver::PeriodicTimerCallBack
+// ----------------------------------------------------------------------------
+//
+TInt CDhcpPsyDhcpServerIPResolver::PeriodicTimerCallBack(TAny* aAny)
+    {
+    TRACESTRING ( "CDhcpPsyDhcpServerIPResolver::PeriodicTimerCallBack ");
+    CDhcpPsyDhcpServerIPResolver* self = STATIC_CAST(CDhcpPsyDhcpServerIPResolver*, aAny);
+    // Cancel outstanding requests
+    self->CancelOutstandigRequest();
+    return KErrNone;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcpsocketlistener.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Receives incoming DHCPInform messages
+*
+*/
+
+
+#include <e32std.h>
+#include <es_sock.h>
+#include "dhcpconstants.h"
+#include "dhcppsylogging.h"
+#include "dhcpsocketlistener.h"
+
+const TInt KDhcpSizeOfMinXIDPacket = 0x08;
+const TInt KDhcpLocationOfXIDField = 0x04;
+const TInt KDhcpLengthOfXIDField = 0x04;
+const TInt KDhcpPeriodicTimerIntervalOneAndHalfSec(1500000);
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CDhcpPsySocketListener* CDhcpPsySocketListener::NewL(RSocket* aSocket)
+    {
+    TRACESTRING ( "CDhcpPsySocketListener::NewL" );
+    CDhcpPsySocketListener* self = new( ELeave ) CDhcpPsySocketListener(aSocket);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CDhcpPsySocketListener::~CDhcpPsySocketListener()
+    {
+    TRACESTRING( "CDhcpPsySocketListener::~CDhcpPsySocketListener" );
+    Cancel();
+    delete iRcvdDataHeapBufferPtr;
+    delete iPeriodicTimer;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CDhcpPsySocketListener::CDhcpPsySocketListener( RSocket* aSocket) :
+    CActive ( EPriorityStandard ), iSocket (aSocket),  iRcvdDataBuffer ( 0, 0, KDhcpPacketLength )
+    {
+    TRACESTRING( "CDhcpPsySocketListener::CDhcpPsySocketListener" );
+    CActiveScheduler::Add( this );
+    iAckPckg = TDhcpDataResponsePacket ();
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpPsySocketListener::RcvDHCPMessage
+//
+// For receiving the message with a connectionless socket.
+// This is done if no DHCP Server address was found with the Symbian way.
+// Then we try it with Broadcast messages.
+// ---------------------------------------------------------------------------
+//
+void CDhcpPsySocketListener::RcvDHCPMessageConnectionlessL(TRequestStatus& aStatus)
+    {
+    TRACESTRING( "CDhcpPsySocketListener::RcvDHCPMessageConnectionlessL" );
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iIsConnectionless = ETrue;
+    iRcvdDataHeapBufferPtr = HBufC8::NewL( KDhcpPacketLength );
+    iRcvdDataBuffer.Set( iRcvdDataHeapBufferPtr->Des() );
+    iRcvdDataBuffer.FillZ();
+    iAddress.SetPort( KDhcpDefaultCliPort );
+    iSocket->RecvFrom( iRcvdDataBuffer,
+                       iAddress,
+                       NULL,
+                       iStatus,
+                       iLen );
+    StartTimer ();
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpPsySocketListener::RcvDHCPMessage
+//
+// For receiving DHCP message with a connected socket. If a DHCP server was
+// found and a bind could be done.
+// ---------------------------------------------------------------------------
+//
+void CDhcpPsySocketListener::RcvDHCPMessage(TRequestStatus& aStatus)
+    {
+    TRACESTRING( "CDhcpPsySocketListener::RcvDHCPMessage" );
+    aStatus = KRequestPending;
+    iClientStatus = &aStatus;
+    iIsConnectionless = EFalse;
+    iSocket->Recv( iAckPckg, 0 , iStatus, iLen );
+    StartTimer ();
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpPsySocketListener::StartTimer
+//
+// Start timeout control for making sure that used client thread doesn't halt
+// ---------------------------------------------------------------------------
+//
+void CDhcpPsySocketListener::StartTimer ()
+    {
+    TRACESTRING( "CDhcpPsySocketListener::StartTimer" );
+    // Start the periodic timer, when ever the time elapsed
+    // the PeriodicTimerCallBack() will get called.
+    iPeriodicTimer->Start(KDhcpPeriodicTimerIntervalOneAndHalfSec,
+            KDhcpPeriodicTimerIntervalOneAndHalfSec,
+            TCallBack(PeriodicTimerCallBack, this));
+    }
+
+// ---------------------------------------------------------------------------
+// RunL
+// ---------------------------------------------------------------------------
+//
+void CDhcpPsySocketListener::RunL()
+    {
+    TRACESTRING2( "CDhcpPsySocketListener::RunL, %d", iStatus.Int() );
+    TInt result = iStatus.Int();
+    iPeriodicTimer->Cancel();
+    if (result==KErrNone)
+        {
+        if ( iIsConnectionless )
+            {
+            iAckPckg.Copy( iRcvdDataHeapBufferPtr->Des() );
+            }
+        if (CheckAckXid ())
+            {
+            // Checks also that content is valid for location parsing.
+            result = iAckPckg.ParseDHCPAck();
+            }
+        }
+    TRequestStatus *status = iClientStatus;
+    User::RequestComplete (status, result);
+    }
+
+// ---------------------------------------------------------------------------
+// Return location civic information for caller
+// ---------------------------------------------------------------------------
+//
+const TDesC8&   CDhcpPsySocketListener::LocationCivicInformation ()
+    {
+    TRACESTRING( "CDhcpPsySocketListener::LocationCivicInformation" );
+    return iAckPckg.iCivicAddress;
+    }
+
+// ---------------------------------------------------------------------------
+// Return geoConfig information for caller
+// ---------------------------------------------------------------------------
+//
+const TDesC8&    CDhcpPsySocketListener::GeoConfigDhcpInformation ()
+    {
+    TRACESTRING( "CDhcpPsySocketListener::GeoConfigDhcpInformation" );
+    return iAckPckg.iGeoConf;
+    }
+
+// ---------------------------------------------------------------------------
+// Set transaction action id to follow
+// ---------------------------------------------------------------------------
+//
+void CDhcpPsySocketListener::SetTransActionIdToFollow (TUint32 aXid)
+    {
+    TRACESTRING( "CDhcpPsySocketListener::SetTransActionIdToFollow" );
+    iXid = aXid;
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpPsySocketListener::CheckAckXid
+//
+// For checking if the XID (identifier of the DHCP message) of the received
+// ACK - message matches the XID of the INFORM that was sent.
+// ---------------------------------------------------------------------------
+//
+TBool CDhcpPsySocketListener::CheckAckXid()
+    {
+    TRACESTRING( "CDhcpPsySocketListener::CheckAckXID" );
+    TBool retValue = EFalse;
+    // Check if the message is the DHCP Ack that we wanted.
+    // the length of the packet needs to be over 8 because otherwise
+    // this leaves with error code.
+    TRACESTRING2( "CDhcpPsySocketListener::CheckAckXID, ack length %d", iAckPckg.Length() );
+    if ( iAckPckg.Length() > KDhcpSizeOfMinXIDPacket )
+        {
+        TUint32 ackXid = 0;
+        // Copy the XID field from the message (4 octets from the 4:th octet)
+        TPtrC8 xidPtr ( iAckPckg.Mid( KDhcpLocationOfXIDField, KDhcpLengthOfXIDField ) );
+        ackXid = BigEndian::Get32(xidPtr.Ptr());
+        // Compare the XID values
+        if (ackXid == iXid)
+            {
+            TRACESTRING( "CDhcpPsySocketListener::CheckAckXID, true" );
+            retValue = ETrue;
+            }
+        }
+    return retValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpPsySocketListener::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CDhcpPsySocketListener::DoCancel()
+    {
+    TRACESTRING( "CDhcpPsySocketListener::DoCancel" );
+    iPeriodicTimer->Cancel();
+    iSocket->CancelRecv();
+    }
+
+// ---------------------------------------------------------------------------
+// CDhcpPsySocketListener::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CDhcpPsySocketListener::ConstructL()
+    {
+    TRACESTRING ( "CDhcpPsySocketListener::ConstructL ");
+    // Initialize the periodic timer.
+    iPeriodicTimer = CPeriodic::NewL(CActive::EPriorityIdle);
+    }
+
+// ----------------------------------------------------------------------------
+// CDhcpPsySocketListener::PeriodicTimerCallBack
+// ----------------------------------------------------------------------------
+//
+TInt CDhcpPsySocketListener::PeriodicTimerCallBack(TAny* aAny)
+    {
+    TRACESTRING ( "CDhcpPsySocketListener::PeriodicTimerCallBack ");
+    CDhcpPsySocketListener* self = STATIC_CAST(CDhcpPsySocketListener*, aAny);
+    // Cancel outstanding requests
+    self->CancelOutstandigRequest();
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// CDhcpPsySocketListener::CancelOutstandigRequest
+// ----------------------------------------------------------------------------
+//
+void CDhcpPsySocketListener::CancelOutstandigRequest ()
+    {
+    TRACESTRING ( "CDhcpPsySocketListener::CancelOutstandigRequest ");
+    // Will cause outstanding request to complete prematurely
+    iSocket->CancelRecv();
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/dhcpwlanqueryhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,334 @@
+/*
+* 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: 
+*
+*/
+
+#include <sip.h>
+#include <sipprofileregistry.h>
+#include <sipprofile.h>
+#include <comms-infras/es_config.h>
+#include <in_sock.h>
+
+#include "dhcppsylogging.h"
+#include "dhcppsyrequesterprogressobserver.h"
+#include "dhcppsypanic.h"
+#include "dhcpsocketlistener.h"
+#include "dhcpwlanqueryhandler.h"
+#include "dhcplocationinformationparser.h"
+#include "dhcpdatasender.h"
+#include "dhcpdatalocationrequest.h"
+#include "dhcpconstants.h"
+#include "dhcpconnectionengine.h"
+#include "dhcpserveripaddressresolver.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CDhcpWlanQueryHandler* CDhcpWlanQueryHandler::NewL(MDhcpPsyRequesterProgressObserver *aObserver)
+    {
+    TRACESTRING( "CDhcpWlanQueryHandler::NewL" );
+    CDhcpWlanQueryHandler* self = new(ELeave) CDhcpWlanQueryHandler (aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CDhcpWlanQueryHandler::~CDhcpWlanQueryHandler()
+    {
+    TRACESTRING( "CDhcpWlanQueryHandler::~CDhcpWlanQueryHandler" );
+
+    // Close opened resources and delete reserved memory
+    Cancel();
+
+    Flush ();
+
+    delete iLctnDataRequestor;
+    delete iLctnDataListener;
+
+    iSocket.Close ();
+
+    iConnection.Close();
+    iSocketServer.Close();
+
+    TRACESTRING( "CDhcpWlanQueryHandler::~CDhcpWlanQueryHandler -- end" );
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CDhcpWlanQueryHandler::CDhcpWlanQueryHandler (MDhcpPsyRequesterProgressObserver *aObserver)
+    : CActive (CActive::EPriorityStandard), iPsyProgressObserver (aObserver)
+    {
+    TRACESTRING( "CDhcpWlanQueryHandler::CDhcpWlanQueryHandler" );
+    CActiveScheduler::Add(this);
+    }
+
+// ---------------------------------------------------------------------------
+// LocationData
+// ---------------------------------------------------------------------------
+//
+HBufC8*  CDhcpWlanQueryHandler::LocationData ()
+    {
+    return iLocationBufferData;
+    }
+
+// ---------------------------------------------------------------------------
+// MakeLocationQueryL
+// ---------------------------------------------------------------------------
+//
+void CDhcpWlanQueryHandler::MakeLocationQueryL (TUint32 aIapProfileId)
+    {
+    TRACESTRING( "CDhcpWlanQueryHandler::MakeLocationQueryL" )
+    iIapProfileId = aIapProfileId;
+
+    // Check is the device already connected to the wlan accessoint.
+    TBool connectionAttached = iConnectionEngine->IsConnectedL(iIapProfileId);
+    if (connectionAttached)
+        {
+        TRACESTRING("CDhcpWlanQueryHandler::MakeLocationQueryL, Attached" )
+        iDhcpResolver = CDhcpPsyDhcpServerIPResolver::NewL(iConnection, iStatus);
+        iState = EDhcpIpAddressQuery;
+        }
+    else
+        {
+        TRACESTRING("CDhcpWlanQueryHandler::MakeLocationQueryL, Not attached" )
+        iConnectionEngine->ConnectL (aIapProfileId, iStatus);
+        iState = EAttachToConnection;
+        }
+
+    iPsyProgressObserver->ProgressPsyRequestNotificationL (MDhcpPsyRequesterProgressObserver::ELocationQueryStarted,
+         KErrNone);
+
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CDhcpWlanQueryHandler::ConstructL()
+    {
+    TRACESTRING( "CDhcpWlanQueryHandler::ConstructL" );
+    User::LeaveIfError( iSocketServer.Connect() );
+    User::LeaveIfError( iConnection.Open( iSocketServer ) );
+
+    iConnectionEngine = CDhcpConnectionEngine::NewL(iConnection);
+    // Add socket listener and requestor classes up. Rest parameters will be
+    // provided later on.
+    iLctnDataRequestor = CDhcpDataRequestor::NewL(iSocket);
+    iLctnDataListener = CDhcpPsySocketListener::NewL(&iSocket);
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpWlanQueryHandler::RunL
+// -----------------------------------------------------------------------------
+//
+void CDhcpWlanQueryHandler::RunL()
+    {
+    TRACESTRING2( "CDhcpWlanQueryHandler::RunL, %d ", iStatus.Int());
+    TRACESTRING2( "CDhcpWlanQueryHandler::RunL, state %d ", iState);
+    TInt result = iStatus.Int();
+    if (result != KErrNone && iState!=EDhcpIpAddressQuery)
+        {
+        iState=EDhpWlanIdle;
+        iPsyProgressObserver->ProgressPsyRequestNotificationL (MDhcpPsyRequesterProgressObserver::ELocationQueryFinished,
+             iStatus.Int());
+        return;
+        }
+    switch (iState)
+        {
+        case EAttachToConnection:
+            {
+            TRACESTRING( "CDhcpWlanQueryHandler::RunL, AttachToConnection, start");
+
+            iState=EDhcpIpAddressQuery;
+
+            // Get ip address of the dhcp server.
+            iDhcpResolver = CDhcpPsyDhcpServerIPResolver::NewL(iConnection, iStatus);
+            SetActive ();
+            }
+            break;
+        case EDhcpIpAddressQuery:
+            {
+            TRACESTRING( "CDhcpWlanQueryHandler::RunL, create and send the dhcp inform message to the wlan net, start");
+
+            User::LeaveIfError( iSocket.Open( iSocketServer,
+                    KAfInet,
+                    KSockDatagram,
+                    KProtocolInetUdp,
+                    iConnection ) );
+
+            TInetAddr addr( KInetAddrAny, KDhcpDefaultCliPort );
+            iSocket.Bind( addr );
+
+            // Create a dhcp inform message and send it.
+            iLctnDataRequestor->SendDHCPMessageL(iDhcpResolver->DhcpServerInetAddress(),
+                iIapProfileId, iStatus);
+
+            iState = ESendDhcpLocatinQuery;
+            SetActive ();
+            }
+            break;
+
+        case ESendDhcpLocatinQuery:
+            {
+            TRACESTRING( "CDhcpWlanQueryHandler::RunL, send complete" );
+            // Store transaction id to the listener object
+            iLctnDataListener->SetTransActionIdToFollow (iLctnDataRequestor->TransActionIdToFollow());
+            // And start to listen the dhcp ack message from the subnet.
+            iLctnDataListener->RcvDHCPMessage (iStatus);
+            iState = EReceiveDhcpLocationAck;
+            SetActive ();
+            }
+            break;
+        case EReceiveDhcpLocationAck:
+            {
+            TRACESTRING( "CDhcpWlanQueryHandler::RunL, response received." );
+            TInt statusCode = iStatus.Int();
+
+            // Make final XML buffer if possible.
+            TPtrC8 geoConfigInformation (iLctnDataListener->GeoConfigDhcpInformation());
+            TPtrC8 civicInformation (iLctnDataListener->LocationCivicInformation ());
+
+            TRACESTRING2( "CDhcpWlanQueryHandler::RunL, Response, geoConfig length %d",
+                    geoConfigInformation.Length()
+                    );
+
+            TRACESTRING2 ( "CDhcpWlanQueryHandler::RunL, Response, civicInformation length %d",
+                    civicInformation.Length()
+                    );
+
+            if(iLocationBufferData)
+                {
+                delete iLocationBufferData;
+                iLocationBufferData = NULL;
+                }
+
+            // We should able to calculate maximun length of target buffer
+            iLocationBufferData = HBufC8::NewL(KDhcpMaxLocInfoLength);
+            TDhcpLocationInformationParser informationParser;
+            TPtr8 ptr (iLocationBufferData->Des());
+
+            // Parse at next preferred order option 123 and if doesn't found then option 99 if
+            // possible ...
+            if (geoConfigInformation.Length())          // option 123, GeoSpatial location information
+                {
+                informationParser.ParseLocationInformation(
+                    geoConfigInformation,
+                    TDhcpLocationInformationParser::EDHCPCoordinates, ptr);
+                }
+            else if (civicInformation.Length())        // option 99, civic address location information
+                {
+                informationParser.ParseLocationInformation(
+                    civicInformation,
+                    TDhcpLocationInformationParser::EDHCPCivicAddress, ptr);
+                }
+            else
+                {
+                // No valid information from the dhcp server,  notify caller for that.
+                statusCode = KErrNotFound;
+                }
+
+            iState=EDhpWlanIdle;
+            iPsyProgressObserver->ProgressPsyRequestNotificationL (MDhcpPsyRequesterProgressObserver::ELocationQueryFinished,
+                 statusCode );
+            }
+            break;
+        default:
+            {
+            TRACESTRING( "CDhcpWlanQueryHandler::RunL, invalid switch-case" );
+            User::Leave (KErrGeneral);
+            }
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpWlanQueryHandler::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CDhcpWlanQueryHandler::DoCancel()
+    {
+    TRACESTRING( "CDhcpWlanQueryHandler::DoCancel" )
+    if (iConnectionEngine)
+        {
+        iConnectionEngine->Cancel();
+        }
+    // Cancel onqoing request if needed.
+    if (iDhcpResolver)
+        {
+        iDhcpResolver->Cancel();
+        }
+
+    if (iLctnDataRequestor)
+        {
+        iLctnDataRequestor->Cancel();
+        }
+
+    if (iLctnDataListener)
+        {
+        iLctnDataListener->Cancel();
+        }
+
+    TRAPD (err,
+        iPsyProgressObserver->ProgressPsyRequestNotificationL (MDhcpPsyRequesterProgressObserver::ECancelled,
+             KErrNone ) ) ;
+
+    TRequestStatus *status = &iStatus;
+    User::RequestComplete ( status, err );
+
+    TRACESTRING( "CDhcpWlanQueryHandler::DoCancel finished" )
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpWlanQueryHandler::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CDhcpWlanQueryHandler::RunError (TInt aErrorCode)
+    {
+    TRACESTRING2( "CDhcpWlanQueryHandler::RunError %d", aErrorCode )
+    TRACESTRING2( "CDhcpWlanQueryHandler::RunError, state, %d", iState )
+    iState=EDhpWlanIdle;
+    TRAPD (err,
+        iPsyProgressObserver->ProgressPsyRequestNotificationL (MDhcpPsyRequesterProgressObserver::ELocationQueryFinished,
+            aErrorCode ) );
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CDhcpWlanQueryHandler::Flush
+// -----------------------------------------------------------------------------
+//
+void CDhcpWlanQueryHandler::Flush ()
+    {
+    TRACESTRING( "CDhcpWlanQueryHandler::Flush" )
+    delete iConnectionEngine;
+    iConnectionEngine = NULL;
+    delete iDhcpResolver;
+    iDhcpResolver = NULL;
+    delete iLocationBufferData;
+    iLocationBufferData=NULL;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/dhcppositionprovider/src/proxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* 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: 
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "dhcppsy.hrh"
+#include "dhcppsypositioner.h"
+
+// LOCAL CONSTANTS AND MACROS
+const TImplementationProxy KFactoryPtr =
+    IMPLEMENTATION_PROXY_ENTRY( KDhcpPsyImplUid, CDhcpPsyPositioner::NewL );
+
+// ========================= ==  == LOCAL FUNCTIONS ===============================
+
+// Following function is required by Positioning Plug-in API at ordinal 1.
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 1;
+    return &KFactoryPtr;
+    }
+
+//
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* 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:  
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+#include "../sipmxresolver/group/bld.inf"
+#include "../sipconnectionprovider/group/bld.inf"
+#include "../ipapputils/group/bld.inf"
+#include "../sipconnectionprovider/ipvoicemailengine/group/bld.inf"
+#include "../voipadapters/group/bld.inf"
+#include "../accountcreationplugin/group/bld.inf"
+#include "../dhcppositionprovider/group/bld.inf"
+#include "../svtmatching/group/bld.inf"
+#include "../svtlogging/group/bld.inf"
+#include "../svtcallmenu/group/bld.inf"
+#include "../sipimresolver/group/bld.inf"
+
+PRJ_TESTMMPFILES
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/EABI/ipapputilsU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,22 @@
+EXPORTS
+	_ZN23CSipClientResolverUtils4NewLEv @ 1 NONAME
+	_ZN23CSipClientResolverUtils5NewLCEv @ 2 NONAME
+	_ZN23CSipClientResolverUtilsD0Ev @ 3 NONAME
+	_ZN23CSipClientResolverUtilsD1Ev @ 4 NONAME
+	_ZN23CSipClientResolverUtilsD2Ev @ 5 NONAME
+	_ZNK23CSipClientResolverUtils23RegisterClientWithUserLERK4TUidRK6TDesC8S2_ @ 6 NONAME
+	_ZNK23CSipClientResolverUtils25UnRegisterClientWithUserLERK4TUidRK6TDesC8 @ 7 NONAME
+	_ZN26CIPAppUtilsAddressResolver17GetWlanMACAddressER5TDes8RK6TDesC8 @ 8 NONAME
+	_ZN26CIPAppUtilsAddressResolver24GetLocalIpAddressFromIapER9TInetAddrm @ 9 NONAME
+	_ZN26CIPAppUtilsAddressResolver4NewLEv @ 10 NONAME
+	_ZN26CIPAppUtilsAddressResolver5NewLCEv @ 11 NONAME
+	_ZN16CIpAppPhoneUtils4NewLEv @ 12 NONAME
+	_ZN16CIpAppPhoneUtils5NewLCEv @ 13 NONAME
+	_ZN26CIPAppUtilsAddressResolver9WlanSsidLEmR6TDes16 @ 14 NONAME
+	_ZNK16CIpAppPhoneUtils14GetPhoneModelLER6TDes16 @ 15 NONAME
+	_ZNK16CIpAppPhoneUtils16GetTerminalTypeLER6TDes16 @ 16 NONAME
+	_ZNK16CIpAppPhoneUtils14GetPhoneModelLER6TDes16R3RFs @ 17 NONAME
+	_ZNK16CIpAppPhoneUtils16GetTerminalTypeLER6TDes16R3RFs @ 18 NONAME
+	_ZNK23CSipClientResolverUtils29GetImplementationUidWithUserLERK6TDesC8R4TUid @ 19 NONAME
+	_ZNK23CSipClientResolverUtils33GetAllImplementationUidsWithUserLERK6TDesC8R6RArrayI4TUidE @ 20 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/bwins/ipapputilsu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,21 @@
+EXPORTS
+	??1CIpAppPhoneUtils@@UAE@XZ @ 1 NONAME ; CIpAppPhoneUtils::~CIpAppPhoneUtils(void)
+	??1CSipClientResolverUtils@@UAE@XZ @ 2 NONAME ; CSipClientResolverUtils::~CSipClientResolverUtils(void)
+	?GetLocalIpAddressFromIap@CIPAppUtilsAddressResolver@@QAEHAAVTInetAddr@@K@Z @ 3 NONAME ; int CIPAppUtilsAddressResolver::GetLocalIpAddressFromIap(class TInetAddr &, unsigned long)
+	?GetPhoneModelL@CIpAppPhoneUtils@@QBEXAAVTDes16@@@Z @ 4 NONAME ; void CIpAppPhoneUtils::GetPhoneModelL(class TDes16 &) const
+	?GetTerminalTypeL@CIpAppPhoneUtils@@QBEXAAVTDes16@@@Z @ 5 NONAME ; void CIpAppPhoneUtils::GetTerminalTypeL(class TDes16 &) const
+	?GetWlanMACAddress@CIPAppUtilsAddressResolver@@QAEHAAVTDes8@@ABVTDesC8@@@Z @ 6 NONAME ; int CIPAppUtilsAddressResolver::GetWlanMACAddress(class TDes8 &, class TDesC8 const &)
+	?NewL@CIPAppUtilsAddressResolver@@SAPAV1@XZ @ 7 NONAME ; class CIPAppUtilsAddressResolver * CIPAppUtilsAddressResolver::NewL(void)
+	?NewL@CIpAppPhoneUtils@@SAPAV1@XZ @ 8 NONAME ; class CIpAppPhoneUtils * CIpAppPhoneUtils::NewL(void)
+	?NewL@CSipClientResolverUtils@@SAPAV1@XZ @ 9 NONAME ; class CSipClientResolverUtils * CSipClientResolverUtils::NewL(void)
+	?NewLC@CIPAppUtilsAddressResolver@@SAPAV1@XZ @ 10 NONAME ; class CIPAppUtilsAddressResolver * CIPAppUtilsAddressResolver::NewLC(void)
+	?NewLC@CIpAppPhoneUtils@@SAPAV1@XZ @ 11 NONAME ; class CIpAppPhoneUtils * CIpAppPhoneUtils::NewLC(void)
+	?NewLC@CSipClientResolverUtils@@SAPAV1@XZ @ 12 NONAME ; class CSipClientResolverUtils * CSipClientResolverUtils::NewLC(void)
+	?RegisterClientWithUserL@CSipClientResolverUtils@@QBEXABVTUid@@ABVTDesC8@@0@Z @ 13 NONAME ; void CSipClientResolverUtils::RegisterClientWithUserL(class TUid const &, class TDesC8 const &, class TUid const &) const
+	?UnRegisterClientWithUserL@CSipClientResolverUtils@@QBEXABVTUid@@ABVTDesC8@@@Z @ 14 NONAME ; void CSipClientResolverUtils::UnRegisterClientWithUserL(class TUid const &, class TDesC8 const &) const
+	?WlanSsidL@CIPAppUtilsAddressResolver@@QAEXKAAVTDes16@@@Z @ 15 NONAME ; void CIPAppUtilsAddressResolver::WlanSsidL(unsigned long, class TDes16 &)
+	?GetPhoneModelL@CIpAppPhoneUtils@@QBEXAAVTDes16@@AAVRFs@@@Z @ 16 NONAME ; void CIpAppPhoneUtils::GetPhoneModelL(class TDes16 &, class RFs &) const
+	?GetTerminalTypeL@CIpAppPhoneUtils@@QBEXAAVTDes16@@AAVRFs@@@Z @ 17 NONAME ; void CIpAppPhoneUtils::GetTerminalTypeL(class TDes16 &, class RFs &) const
+	?GetImplementationUidWithUserL@CSipClientResolverUtils@@QBEXABVTDesC8@@AAVTUid@@@Z @ 18 NONAME ; void CSipClientResolverUtils::GetImplementationUidWithUserL(class TDesC8 const &, class TUid &) const
+	?GetAllImplementationUidsWithUserL@CSipClientResolverUtils@@QBEXABVTDesC8@@AAV?$RArray@VTUid@@@@@Z @ 19 NONAME ; void CSipClientResolverUtils::GetAllImplementationUidsWithUserL(class TDesC8 const &, class RArray<class TUid> &) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/csipclientresolverutils.h            |../../../inc/csipclientresolverutils.h
+../inc/cipapputilsaddressresolver.h         |../../../inc/cipapputilsaddressresolver.h
+../inc/cipappphoneutils.h                   |../../../inc/cipappphoneutils.h
+
+../rom/ipapputils.iby CORE_APP_LAYER_IBY_EXPORT_PATH( ipapputils.iby )
+
+PRJ_MMPFILES
+ipapputils.mmp
+
+PRJ_TESTMMPFILES
+//../internal/t_ipapputils/group/t_ipapputils.mmp
+
+#include "../voipeventlog/group/bld.inf"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/group/ipapputils.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Project definition file for project ?myapp
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET                  ipapputils.dll
+TARGETTYPE              dll
+UID                     0x1000008d 0x2000E57B
+                        
+CAPABILITY              CAP_CLIENT_DLL
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  csipclientresolverutils.cpp
+SOURCE                  cipapputilsaddressresolver.cpp
+SOURCE                  cipappphoneutils.cpp
+
+USERINCLUDE             ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY                 euser.lib 
+LIBRARY                 centralrepository.lib
+LIBRARY                 sysutil.lib             // for SW version
+LIBRARY                 efsrv.lib
+LIBRARY                 platformenv.lib         // for phonemodel
+LIBRARY                 esock.lib               // for RSocket class
+LIBRARY                 insock.lib              // for TInetAddr class
+LIBRARY                 cmmanager.lib
+LIBRARY                 serviceprovidersettings.lib // for Uid
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/inc/cipappphoneutils.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,103 @@
+/*
+* 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 class to phone functionality.
+*
+*/
+
+
+#ifndef C_IPAPPPHONEUTILS_H
+#define C_IPAPPPHONEUTILS_H
+
+#include <e32base.h>
+
+const TUint KSVPMaxTerminalTypeLength = 64;
+const TUint KSVPPhoneModelLength = 20;
+
+class RFs;
+
+/**
+ *  Utility class to phone functionality.
+ *
+ *  @code
+ *        TBuf<KSVPMaxTerminalTypeLength> terminalType;
+ *      CIpAppPhoneUtils* phoneUtils = CIpAppPhoneUtils::NewL();
+ *      phoneUtils->GetTerminalTypeL( terminalType );
+ *      delete phoneUtils;
+ *  @endcode
+ *
+ *  @lib ipapputils.lib
+ *  @since S60 v3.2 
+ */
+NONSHARABLE_CLASS( CIpAppPhoneUtils ) : public CBase
+    {
+    public:
+
+        /**
+         * Two-phased constructor.
+         */
+        IMPORT_C static CIpAppPhoneUtils* NewL();
+        /**
+         * Two-phased constructor.
+         */
+        IMPORT_C static CIpAppPhoneUtils* NewLC();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CIpAppPhoneUtils();
+        
+        /**
+        * Get the terminal type.
+        * @since Series60 5.0
+        * @param aTerminalType terminal type
+        */
+        IMPORT_C void GetTerminalTypeL( TDes& aTerminalType ) const;
+
+        /**
+        * Get the terminal type.
+        * @since Series60 5.0
+        * @param aTerminalType terminal type
+        * @param aFs file session
+        */
+        IMPORT_C void GetTerminalTypeL( TDes& aTerminalType, RFs& aFs ) const;
+        
+        
+        /**
+        * Get the phone model.
+        * @since Series 60 3.2
+        * @param aPhoneModel phone model.
+        */
+        IMPORT_C void GetPhoneModelL( TDes& aPhoneModel ) const;
+
+        /**
+        * Get the phone model.
+        * @since Series 60 3.2
+        * @param aPhoneModel phone model.
+        * @param aFs file session
+        */
+        IMPORT_C void GetPhoneModelL( TDes& aPhoneModel, RFs& aFs ) const;
+        
+
+    private:
+
+        /**
+         * C++ default constructor.
+         */
+        CIpAppPhoneUtils();
+        
+    private: // data
+
+    };
+
+#endif // C_IPAPPPHONEUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/inc/cipapputilsaddressresolver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Address resolver utility class
+*
+*/
+
+
+#ifndef C_IPAPPUTILSADDRESSRESOLVER_H
+#define C_IPAPPUTILSADDRESSRESOLVER_H
+
+#include <e32base.h>
+#include <es_sock.h>
+#include <in_sock.h>
+
+/**
+ *  Utility class for querying local ip address and wlan mac address
+ *
+ *  @code
+ *      TInetAddr localAddr;
+ *      TUint32 iapId = 1;
+ *      iAddressResolver = CIPAppUtilsAddressResolver::NewL();
+ *      iAddressResolver->GetLocalAddressFromIapL( 
+ *              localAddr, iapId );
+ *      delete iAddressResolver;
+ *  @endcode
+ *
+ *  @lib ipapputils.lib
+ *  @since S60 v3.2 
+ */
+NONSHARABLE_CLASS( CIPAppUtilsAddressResolver ) : public CBase
+    {
+public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CIPAppUtilsAddressResolver* NewL();
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CIPAppUtilsAddressResolver* NewLC();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CIPAppUtilsAddressResolver();
+
+
+public: // New functions
+
+    /**
+     * Get Wlan MAC address from the device. If WLAN interface couldn't found,
+     * return error code.
+     *
+     * @param aWlanMacAddress on return, this descriptor will contain the 
+     *     WLAN mac address. Client must see that the descriptor is long enough
+     *   to hold the address in given format.
+     * @param aByteFormat defines the format for WLAN MAC bytes, e.g. "%02X:"
+     *   if aByteFormat == KNullDesC(), function will return raw hwaddress data 
+     *   (six bytes long descriptor, no formatting whatsoever)
+     * @return error code. KErrNone if successful, KErrNotFound if WLAN IF is 
+     *   not found from the system or other system error code
+     * @since S60 5.0
+     */
+    IMPORT_C TInt GetWlanMACAddress (
+        TDes8& aWlanMacAddress, const TDesC8& aByteFormat );
+
+    /**
+     * Retrieve local ip address
+     *
+     * @param aLocalIpAddr on return, this parameter will contain the local ip address.
+     * @param aIapId specifies the IAP from which the ip address is queried from
+     * @return error code. KErrNone if successful, KErrNotFound if cannot fetch the
+     *   addr from given iap, or other system error code
+     * @since S60 5.0
+     */
+    IMPORT_C TInt GetLocalIpAddressFromIap( 
+        TInetAddr& aLocalIpAddr, TUint32 aIapId );
+
+    /**
+     * Returns WLAN SSID based on given IAP id.
+     *
+     * @since S60 v5.0
+     * @param aIapId for IAP id 
+     * @param aWlanSsid for WLAN SSID
+     */
+    IMPORT_C void WlanSsidL( TUint32 aIapId, TDes& aWlanSsid );
+
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CIPAppUtilsAddressResolver();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Helper function used from GetLocalIPAddressFromIap.
+     * Checks the validity of the fetched local ip addr and sets it to target
+     * @param aTarget will contain the local ip addr on return
+     * @param aCandidate proposed ip address
+     * @param aCandidateIap IAP of the proposed IP address
+     * @param aSpecifiedIap reference IAP ID. Must match with aCandidateIap.
+     * @return Status Code. KErrNotFound if cannot set the target.
+     */
+    TInt CheckAndSetAddr( TInetAddr& aTarget, TInetAddr& aCandidate,
+        TUint32 aCandidateIap, TUint32 aSpecifiedIap ) const;
+
+
+private: // data
+    /**
+     * Handle to Socket's server.
+     * Own.
+     */
+    RSocketServ iSocketServer; 
+
+    /**
+     * Handle to Socket.
+     * Own.
+     */
+    RSocket iSocket; 
+
+
+#ifdef _DEBUG        
+        friend class T_CIPAppUtilsAddressResolver;
+#endif
+    };
+
+#endif // C_IPAPPUTILSADDRESSRESOLVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/inc/csipclientresolverutils.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Utility class to handle SIP client resolver cenrep table.
+*
+*/
+
+
+#ifndef C_SIPCLIENTRESOLVERUTILS_H
+#define C_SIPCLIENTRESOLVERUTILS_H
+
+#include <e32base.h>
+#include <spdefinitions.h>
+
+class CRepository;
+
+/**
+ *  Utility class to handle SIP client resolver cenrep table.
+ *
+ *  @code
+ *      iSipClientResolver = CSipClientResolverUtils::NewL();
+ *      iSipClientResolver->RegisterClientWithUserL( 
+ *              KImplementation, iContactHeaderUser, KResolver );
+ *      delete iSipClientResolver;
+ *  @endcode
+ *
+ *  @lib ipapputils.lib
+ *  @since S60 v3.2 
+ */
+NONSHARABLE_CLASS( CSipClientResolverUtils ) : public CBase
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CSipClientResolverUtils* NewL();
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CSipClientResolverUtils* NewLC();
+
+    /**
+    * Destructor.
+    */
+    IMPORT_C virtual ~CSipClientResolverUtils();
+
+    /**
+     * Register to SIP client resolver to be able to receive incoming sessions.
+     *
+     * @since S60 3.2
+     * @param aImplementation UID of client who handles incoming session
+     * @param aProfileContactHeaderUser Globally unique identifier of SIP profile
+     * @param aResolver UID of client resolver plug-in
+     * @return 
+     */
+    IMPORT_C void RegisterClientWithUserL( 
+                const TUid& aImplementation,
+                const TDesC8& aProfileContactHeaderUser, 
+                const TUid& aResolver ) const;
+
+    /**
+     * Un-register from SIP client resolver to deny accepting incoming sessions.
+     *
+     * @since S60 3.2
+     * @param aImplementation UID of client who handles incoming session
+     * @param aProfileContactHeaderUser Globally unique identifier of SIP profile
+     * @return 
+     */
+    IMPORT_C void UnRegisterClientWithUserL( 
+                const TUid& aImplementation,
+                const TDesC8& aProfileContactHeaderUser ) const;
+
+    /**
+     * Resolve implementation Uid for incoming session.
+     *
+     * @since S60 3.2
+     * @param aImplementation UID of client who handles incoming session
+     * @param aProfileContactHeaderUser Globally unique identifier of SIP profile
+     * @return 
+     */
+    IMPORT_C void GetImplementationUidWithUserL( 
+        const TDesC8& aProfileContactHeaderUser,
+        TUid& aImplementation ) const;
+    
+    /**
+     * Return all implementation Uids bases on contact header
+     *
+     * @since S60 5.0
+     * @param aProfileContactHeaderUser Globally unique identifier of SIP profile
+     * @param aImplementationUids UIDs of clients which handle incoming session
+     * @return 
+     */
+    IMPORT_C void GetAllImplementationUidsWithUserL( 
+        const TDesC8& aProfileContactHeaderUser,
+        RArray<TUid>& aImplementationUids ) const;
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CSipClientResolverUtils();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Finds all rows that match given search criterias.
+     *
+     * @since S60 3.2
+     * @param aProfileContactHeaderUser Globally unique identifier of SIP profile
+     * @param aFoundKeys On return contains keys that matched requested rows
+     * @return 
+     */
+    void GetClientWithUserL(
+                const TDesC8& aProfileContactHeaderUser, 
+                RArray<TUint32>& aFoundKeys ) const;
+                    
+    /**
+     * Creates unique key
+     *
+     * @since S60 3.2
+     * @param aNewKey New unique key to be used when inserting row to table
+     * @return 
+     */
+    void CreateNewKeyL( TUint32& aNewKey ) const;
+    
+    /**
+     * Gets call provider Uids.
+     * @param aUidArray Array containing all call provider Uids.
+     */
+    void CallProviderUidsL( RArray<TUint>& aUidArray ) const;   
+     
+    /**
+     * Checks if implementation uid found by key in repository
+     * matches given uid.
+     *
+     * @since S60 5.0
+     * @param aKey unique key identifieng row in repository
+     * @param aImplementation implementation uid
+     * @return ETrue if uid matches
+     */
+    TBool CheckImplementationUidL( 
+        const TUint32& aKey, const TUid& aImplementation ) const;
+
+private: // data
+
+    /**
+     * Instance of central repository
+     * Own.
+     */
+    CRepository* iRepository;
+
+#ifdef _DEBUG
+        friend class T_CSipClientResolverUtils;
+#endif
+    };
+
+#endif // C_SIPCLIENTRESOLVERUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/rom/ipapputils.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* 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:  IP Application Utilities ROM definition file
+*
+*/
+
+
+#ifndef IPAPPUTILS_IBY
+#define IPAPPUTILS_IBY
+
+file=ABI_DIR/BUILD_DIR/ipapputils.dll  SHARED_LIB_DIR/ipapputils.dll
+
+
+#endif // IPAPPUTILS_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/src/cipappphoneutils.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 phone functionality
+*
+*/
+
+
+#include <sysutil.h>
+#include <f32file.h>
+#include <pathinfo.h>
+
+#include "cipappphoneutils.h"
+
+const TUint8 KSVPLineFeed2 = '\n';
+const TInt KHwVersionIn3rdRow = 4;
+_LIT8( KSVPSpaceMark, " " );
+_LIT8( KSVPLineFeed, "\n" );
+_LIT( KSVPSalesModelFileName, "\\resource\\versions\\model.txt" );
+_LIT( KSVPCopyright, "©" );
+_LIT( KSVPCopyright2, "(C)" );
+_LIT( KSVPCopyright3, "(c)" );
+_LIT( KSVPSpace2, " " );
+_LIT( KSVPS60,"S60" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CIpAppPhoneUtils::CIpAppPhoneUtils()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CIpAppPhoneUtils* CIpAppPhoneUtils::NewL()
+    {
+    CIpAppPhoneUtils* self = CIpAppPhoneUtils::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CIpAppPhoneUtils* CIpAppPhoneUtils::NewLC()
+    {
+    CIpAppPhoneUtils* self = new( ELeave ) CIpAppPhoneUtils;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CIpAppPhoneUtils::~CIpAppPhoneUtils()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CIpAppPhoneUtils::GetTerminalTypeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CIpAppPhoneUtils::GetTerminalTypeL( TDes& aTerminalType ) const
+    {
+    RFs fsSession;
+    User::LeaveIfError( fsSession.Connect() );
+    CleanupClosePushL( fsSession );
+    
+    GetTerminalTypeL( aTerminalType, fsSession );
+    
+    CleanupStack::PopAndDestroy( &fsSession );
+    }
+
+// ---------------------------------------------------------------------------
+// CIpAppPhoneUtils::GetTerminalTypeL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CIpAppPhoneUtils::GetTerminalTypeL(
+        TDes& aTerminalType, RFs& aFs ) const
+    {
+    RBuf swVersion;
+    CleanupClosePushL( swVersion );
+    TInt lineFeedCount = 0;
+    TBuf8< KSVPMaxTerminalTypeLength > terminalType;
+
+    TBuf< KSVPMaxTerminalTypeLength > firstRow;
+    TBuf< KSVPPhoneModelLength > phoneModel;
+    TRAP_IGNORE( GetPhoneModelL( phoneModel, aFs ) );
+
+    swVersion.CreateL( KSysUtilVersionTextLength );
+    User::LeaveIfError( SysUtil::GetSWVersion( swVersion ) );
+
+    const TInt swVersionLength( swVersion.Length() );
+    for ( TInt i = 0; i < swVersionLength ; i++ )
+        {
+        if ( !lineFeedCount && ( KSVPLineFeed2 != swVersion[i] ) )
+            {
+            firstRow.Append( swVersion[i] );  // this is 1st row a.k.a SW-version
+            }
+        if ( KSVPLineFeed2 == swVersion[i] )
+            {
+            lineFeedCount++;
+            if( lineFeedCount == 2 )
+                {
+                // Delete 1st and 2nd row.
+                swVersion.Delete( 0, i );
+                const TInt swVersionLength2( swVersion.Length() );
+
+                for ( TInt k = 0; k < swVersionLength2 ; k++ )
+                    {
+                    if ( KSVPLineFeed2 == swVersion[k] )
+                        {
+                        lineFeedCount++;
+                        }
+                    if ( lineFeedCount == KHwVersionIn3rdRow  )
+                        {
+                        // HW version is in 3rd row, delete rest of SWversion
+                        const TInt charsToDelete( swVersionLength2 - k );
+                        swVersion.Delete( k, charsToDelete );
+                        break;
+                        }
+                    }
+                break;
+                }
+            }
+        }
+
+    terminalType.Append( phoneModel );     // Add HW manufacturer, e.g. our company
+    terminalType.Append( swVersion );       // Add HW version
+    terminalType.Append( KSVPSpaceMark );
+    terminalType.Append( firstRow );        // Add SW version
+
+    // Replace linefeeds with space marks
+    TInt linefeedIndex = 0;
+    for ( ; KErrNotFound != linefeedIndex ; )
+        {
+        linefeedIndex = terminalType.Find( KSVPLineFeed );
+        if ( KErrNotFound != linefeedIndex )
+            {
+            // 1 is the length of KSpaceMark
+            terminalType.Replace( linefeedIndex, 1, KSVPSpaceMark );
+            }
+        }
+    aTerminalType.Copy( terminalType );
+    CleanupStack::PopAndDestroy( &swVersion );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CIpAppPhoneUtils::GetPhoneModelL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CIpAppPhoneUtils::GetPhoneModelL( TDes& aPhoneModel ) const
+    {
+    RFs fsSession;
+    User::LeaveIfError( fsSession.Connect() );
+    CleanupClosePushL( fsSession );
+    
+    GetPhoneModelL( aPhoneModel, fsSession );
+    
+    CleanupStack::PopAndDestroy( &fsSession );
+    }
+
+// ---------------------------------------------------------------------------
+// CIpAppPhoneUtils::GetPhoneModelL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CIpAppPhoneUtils::GetPhoneModelL( TDes& aPhoneModel,
+    RFs& aFs ) const
+    {
+    RFile file;
+    TParse parse;
+    parse.Set( PathInfo::RomRootPath(), NULL, NULL);
+    TFileName myfile( parse.Drive() );
+    myfile.Append( KSVPSalesModelFileName ); 
+    User::LeaveIfError( file.Open( aFs,
+        myfile, EFileShareReadersOnly | EFileRead ) );
+
+    CleanupClosePushL( file );
+
+    HBufC* phoneModel = HBufC::NewLC( KSVPPhoneModelLength );
+    TPtr ptr = phoneModel->Des();
+
+    // Read the data from file.
+    TFileText reader;
+    reader.Set( file );
+    User::LeaveIfError( reader.Read( ptr ) );
+
+    // Phone model to aPhoneModel
+    aPhoneModel.Append( *phoneModel );
+
+    TInt copyrightPosition = aPhoneModel.Find( KSVPCopyright );
+    if ( KErrNotFound != copyrightPosition ) 
+        {
+        // Delete copyright mark.
+        aPhoneModel.Delete( copyrightPosition, 1 );
+        }
+
+    copyrightPosition = aPhoneModel.Find( KSVPCopyright2 );
+    if ( KErrNotFound != copyrightPosition )
+        {
+        // Delete copyright mark.
+        aPhoneModel.Delete( copyrightPosition, KSVPCopyright2().Length() );
+        }
+    copyrightPosition = aPhoneModel.Find( KSVPCopyright3 );
+    if ( KErrNotFound != copyrightPosition )
+        {
+        // Delete copyright mark.
+        aPhoneModel.Delete( copyrightPosition, KSVPCopyright3().Length() );
+        }
+
+    TInt spacePosition = aPhoneModel.Find( KSVPSpace2 );
+    TInt modelLength = aPhoneModel.Length();
+
+    while ( 0 == spacePosition )
+        {
+        // Delete leading space character.
+        aPhoneModel.Delete( 0, 1 );
+        modelLength = aPhoneModel.Length();
+        spacePosition = aPhoneModel.Find( KSVPSpace2 );
+        }
+
+    if ( ( KErrNotFound != spacePosition ) && ( 0 != spacePosition ) )
+        {
+        // We don't need the whole HW version, just 1st word
+        aPhoneModel.Delete( spacePosition, modelLength - spacePosition );
+        }
+
+    if ( !modelLength )
+        {
+        // If manufacturer name wasn't found add platform name
+        aPhoneModel.Append( KSVPS60 );
+        }
+
+    CleanupStack::PopAndDestroy( 2, &file ); // phoneModel, file
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/src/cipapputilsaddressresolver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Address resolver utility class
+*
+*/
+
+
+#include <wlaninternalpskeys.h>
+#include <cmmanagerext.h>
+#include <cmpluginwlandef.h>
+
+#include "cipapputilsaddressresolver.h"
+
+const TInt KWlanMacAddressPos = 2;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CIPAppUtilsAddressResolver::CIPAppUtilsAddressResolver()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CIPAppUtilsAddressResolver::ConstructL()
+    {
+    // Connect to Socket server.
+    User::LeaveIfError( iSocketServer.Connect() );
+    
+    // Connect to Socket.
+    User::LeaveIfError( iSocket.Open( iSocketServer,
+                                      KAfInet,
+                                      KSockStream,
+                                      KProtocolInetTcp ) );
+
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CIPAppUtilsAddressResolver* CIPAppUtilsAddressResolver::NewL()
+    {
+    CIPAppUtilsAddressResolver* self = CIPAppUtilsAddressResolver::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CIPAppUtilsAddressResolver* CIPAppUtilsAddressResolver::NewLC()
+    {
+    CIPAppUtilsAddressResolver* self = new( ELeave ) CIPAppUtilsAddressResolver;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CIPAppUtilsAddressResolver::~CIPAppUtilsAddressResolver()
+    {
+    iSocket.Close();
+    iSocketServer.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CIPAppUtilsAddressResolver::GetWlanMACAddress
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CIPAppUtilsAddressResolver::GetWlanMACAddress (
+    TDes8& aWlanMacAddress,
+    const TDesC8& aByteFormat )
+    {
+    TBuf8<KPSWlanMacAddressLength> address;
+    TInt retval = KErrNone;
+
+    retval = RProperty::Get( 
+        KPSUidWlan, 
+        KPSWlanMacAddress, 
+        address );
+    
+    if ( retval == KErrNone )
+        {
+        if ( aByteFormat.Length() == 0 )
+            {
+            //client wants raw data
+            aWlanMacAddress.Copy( address );
+            }
+        else
+            {
+            for ( TInt counter = 0; counter < address.Length(); counter++ )
+                {
+                TUint16 a = (TUint16)address[ counter ];
+                aWlanMacAddress.AppendNumFixedWidthUC( a, EHex, KWlanMacAddressPos );
+                aWlanMacAddress.Append( aByteFormat );
+                aWlanMacAddress.UpperCase();
+                }
+
+            // Delete the last format
+            if ( aWlanMacAddress.Length() )
+                {
+                aWlanMacAddress.Delete( aWlanMacAddress.Length() - aByteFormat.Length(), aByteFormat.Length() );
+                }
+            }
+        
+        if ( aWlanMacAddress.Length() == 0 ) 
+            {
+            retval = KErrNotFound;
+            }
+        }
+   
+    return retval;
+    }
+
+// -----------------------------------------------------------------------------
+// CIPAppUtilsAddressResolver::GetLocalIpAddressFromIap
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CIPAppUtilsAddressResolver::GetLocalIpAddressFromIap( 
+    TInetAddr& aLocalIpAddr,
+    TUint32 aIapId )
+    {
+    TInt retval( KErrNotFound );
+    
+    TInt err = iSocket.SetOpt( KSoInetEnumInterfaces, KSolInetIfCtrl );
+    
+    if ( KErrNone == err )
+        {
+        TPckgBuf<TSoInetInterfaceInfo> info;
+        
+        err = iSocket.GetOpt( KSoInetNextInterface,
+                KSolInetIfCtrl,info );
+        
+        while ( KErrNone == err && KErrNone != retval )
+            {
+            TPckgBuf<TSoInetIfQuery> query;
+            query().iName = info().iName;
+            
+            err = iSocket.GetOpt( KSoInetIfQueryByName,
+                    KSolInetIfQuery,query );
+            
+            if ( KErrNone == err )
+                {
+                retval = CheckAndSetAddr( 
+                        aLocalIpAddr, (TInetAddr&)info().iAddress,
+                        query().iZone[1], aIapId );
+                
+                err = iSocket.GetOpt( KSoInetNextInterface,
+                        KSolInetIfCtrl,info );
+                }
+            }
+        }
+
+    if ( KErrNoMemory == err )
+        {
+        retval = err;
+        }
+    
+    return retval;
+    }
+
+// -----------------------------------------------------------------------------
+// CLocalAddrResolver::CheckAndSetAddr
+// -----------------------------------------------------------------------------
+//
+TInt CIPAppUtilsAddressResolver::CheckAndSetAddr( 
+    TInetAddr& aTarget,
+    TInetAddr& aCandidate,
+    TUint32 aCandidateIap,
+    TUint32 aSpecifiedIap ) const
+    {
+    TInt retval = KErrNotFound;
+    if ( !aCandidate.IsLinkLocal() &&
+         !aCandidate.IsUnspecified() && 
+         !aCandidate.IsLoopback() )
+        {
+        if ( aCandidate.IsV4Mapped())
+            {
+            aCandidate.ConvertToV4();
+            }
+        if ( aCandidateIap == aSpecifiedIap )
+            {
+            aTarget = aCandidate;
+            aTarget.SetScope(0);
+            retval = KErrNone;
+            }
+        }
+    return retval;
+    }                                         
+
+// ---------------------------------------------------------------------------
+// CIPAppUtilsAddressResolver::WlanSsidL
+// Returns WLAN SSID based on given IAP id.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CIPAppUtilsAddressResolver::WlanSsidL(
+    TUint32 aIapId, TDes& aWlanSsid )
+    {
+    RCmManagerExt cmManager;
+    cmManager.OpenL();
+    CleanupClosePushL( cmManager );
+    // Check that bearer is WLAN.
+    if ( KUidWlanBearerType == 
+        cmManager.GetConnectionMethodInfoIntL( 
+            aIapId, CMManager::ECmBearerType ) )
+        {
+        RCmConnectionMethodExt connMethod = 
+            cmManager.ConnectionMethodL( aIapId );
+        CleanupClosePushL( connMethod );
+        
+        // Get SSID for WLAN.
+        HBufC* wlanSsid = connMethod.GetStringAttributeL( 
+            CMManager::EWlanSSID );
+        aWlanSsid.Copy( *wlanSsid );
+        delete wlanSsid;
+        
+        CleanupStack::PopAndDestroy( &connMethod );    
+        }
+    else
+        {
+        User::Leave( KErrNotFound ); // leave if bearer is not WLAN
+        }
+    
+    CleanupStack::PopAndDestroy( &cmManager );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/src/csipclientresolverutils.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,358 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  SIP client resolver utility class
+*
+*/
+
+
+#include <centralrepository.h>
+#include <sipclientresolverconfigcrkeys.h>
+#include <spsettings.h>
+#include <spentry.h>
+#include <spproperty.h>
+
+#include "csipclientresolverutils.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CSipClientResolverUtils::CSipClientResolverUtils()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CSipClientResolverUtils::ConstructL()
+    {
+    iRepository = CRepository::NewL( KCRUidSIPClientResolverConfig );
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSipClientResolverUtils* CSipClientResolverUtils::NewL()
+    {
+    CSipClientResolverUtils* self = CSipClientResolverUtils::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSipClientResolverUtils* CSipClientResolverUtils::NewLC()
+    {
+    CSipClientResolverUtils* self = new( ELeave ) CSipClientResolverUtils;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CSipClientResolverUtils::~CSipClientResolverUtils()
+    {
+    delete iRepository;
+    }
+
+// ---------------------------------------------------------------------------
+// Add line to client resolver cenrep table
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CSipClientResolverUtils::RegisterClientWithUserL(
+    const TUid& aImplementation,
+    const TDesC8& aProfileContactHeaderUser, 
+    const TUid& aResolver ) const
+    {
+    __ASSERT_ALWAYS( aImplementation.iUid > 0, User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( aProfileContactHeaderUser.Length() > 0,
+            User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( aResolver.iUid > 0, User::Leave( KErrArgument ));
+
+    // Remove all earlier instances of client&user combination
+    UnRegisterClientWithUserL( aImplementation, aProfileContactHeaderUser );
+
+    User::LeaveIfError( 
+        iRepository->StartTransaction( CRepository::EConcurrentReadWriteTransaction ) );
+    TUint32 newKey = 0;
+    CreateNewKeyL( newKey );
+    // Add the new row
+    TInt uid = aImplementation.iUid;
+    User::LeaveIfError( 
+        iRepository->Create(newKey|KSIPClientResolverClientUIDMask, uid ) );    
+    User::LeaveIfError( 
+        iRepository->Create(newKey|KSIPClientResolverUserNameMask, aProfileContactHeaderUser ) );
+    uid = aResolver.iUid;    
+    User::LeaveIfError( 
+        iRepository->Create(newKey|KSIPClientResolverPluginUIDMask, uid ) ); 
+
+    // Commit the transaction
+    User::LeaveIfError( iRepository->CommitTransaction( newKey ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Remove line from client resolver cenrep table
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CSipClientResolverUtils::UnRegisterClientWithUserL(
+    const TUid& aImplementation, 
+    const TDesC8& aProfileContactHeaderUser ) const
+    {
+    __ASSERT_ALWAYS( aImplementation.iUid > 0, User::Leave( KErrArgument ) );
+    __ASSERT_ALWAYS( aProfileContactHeaderUser.Length() > 0,
+            User::Leave( KErrArgument ) );  
+
+    RArray<TUint32> keys;
+    CleanupClosePushL( keys );
+    GetClientWithUserL( aProfileContactHeaderUser, keys );
+    for ( TInt i = 0; i < keys.Count(); i++ )
+        {        
+        if ( CheckImplementationUidL( keys[ i ], aImplementation ) )
+            {
+            TUint32 errorKey;
+            User::LeaveIfError( 
+                iRepository->StartTransaction( 
+                    CRepository::EConcurrentReadWriteTransaction ) );
+            iRepository->Delete( keys[i], KSIPClientResolverKeyMask, errorKey );
+            // Commit the transaction
+            User::LeaveIfError( iRepository->CommitTransaction( errorKey ) );            
+            }
+        }
+    CleanupStack::PopAndDestroy( &keys );
+    }
+
+// ---------------------------------------------------------------------------
+// Resolve correct implementation UID for contact header
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CSipClientResolverUtils::GetImplementationUidWithUserL( 
+    const TDesC8& aProfileContactHeaderUser,
+    TUid& aImplementation ) const
+    {
+    RArray<TUint32> keys;    
+    CleanupClosePushL( keys );
+    // Find all rows where KSIPClientResolverUserNameMask is aProfileContactHeaderUser
+    iRepository->FindEqL( KSIPClientResolverUserNameMask, 
+                    KSIPClientResolverFieldTypeMask,
+                    aProfileContactHeaderUser, keys );
+    
+    TInt implementationValue = KErrNotFound;
+    TInt count( keys.Count() );
+    if ( count > 1 )
+        {
+        // Call provider UIDs should be read from spsettings table and if some
+        // UID found from spsettings match one uid in client resolver cenrep,
+        // that should be returned to caller.
+        RArray<TUint> uidArray;
+        CleanupClosePushL( uidArray );
+        CallProviderUidsL( uidArray );
+        __ASSERT_ALWAYS( uidArray.Count() > 0, User::Leave( KErrNotFound ) );
+        TInt i( 0 );
+        for( ; i < count; i++ )
+            {
+            // Get implementation uid of found user name
+            iRepository->Get( ( keys[i]^KSIPClientResolverUserNameMask ) |
+                    KSIPClientResolverClientUIDMask, implementationValue );
+            
+            User::LeaveIfError( implementationValue );
+            if ( KErrNotFound != uidArray.Find( implementationValue ) )
+                {
+                aImplementation.iUid = implementationValue;
+                break;
+                }
+            }
+        CleanupStack::PopAndDestroy( &uidArray );
+        if ( i == count && aImplementation.iUid != implementationValue )
+            {
+            // No matching Uid found
+            User::Leave( KErrNotFound );            
+            }
+        }
+        
+    else if ( count == 1 )
+        {        
+        // Get implementation uid of found user name
+        iRepository->Get( ( keys[0]^KSIPClientResolverUserNameMask ) |
+        KSIPClientResolverClientUIDMask, implementationValue );
+
+        User::LeaveIfError( implementationValue );
+        aImplementation.iUid = implementationValue;
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    CleanupStack::PopAndDestroy( &keys );    
+    }
+
+// ---------------------------------------------------------------------------
+// Return all implementation Uids bases on contact header
+// ---------------------------------------------------------------------------
+//    
+EXPORT_C void CSipClientResolverUtils::GetAllImplementationUidsWithUserL( 
+    const TDesC8& aProfileContactHeaderUser,
+    RArray<TUid>& aImplementationUids ) const
+    {
+    RArray<TUint32> keys;    
+    CleanupClosePushL( keys );
+    
+    // Find all rows where KSIPClientResolverUserNameMask
+    // is aProfileContactHeaderUser
+    User::LeaveIfError( iRepository->FindEqL( KSIPClientResolverUserNameMask, 
+        KSIPClientResolverFieldTypeMask,
+        aProfileContactHeaderUser, keys ) );
+    
+    for( TInt i( 0 ) ; i < keys.Count() ; i++ )
+        {
+        TInt implementationValue = KErrNotFound;
+        
+        // Get implementation uid of found user name
+        User::LeaveIfError( iRepository->Get( 
+            ( keys[i]^KSIPClientResolverUserNameMask ) |
+            KSIPClientResolverClientUIDMask, implementationValue ) );
+        
+        if ( implementationValue )
+            { 
+            TUid implementationUid;
+            implementationUid.iUid = implementationValue;
+            aImplementationUids.AppendL( implementationUid );
+            }
+        }
+    CleanupStack::PopAndDestroy( &keys );
+    }
+
+// ---------------------------------------------------------------------------
+// Find clients from resolver cenrep table
+// ---------------------------------------------------------------------------
+//
+void CSipClientResolverUtils::GetClientWithUserL(
+    const TDesC8& aProfileContactHeaderUser, 
+    RArray<TUint32>& aFoundKeys ) const
+    {
+    RArray<TUint32> keys;
+    
+    CleanupClosePushL( keys );
+    // Find all rows where KSIPClientResolverUserNameMask is aProfileUserName
+    iRepository->FindEqL( KSIPClientResolverUserNameMask, 
+                            KSIPClientResolverFieldTypeMask,
+                            aProfileContactHeaderUser, keys );
+    for ( TInt i = 0; i < keys.Count(); i++ )
+        {
+        // Identification is now done only by aProfileContactHeaderUser
+        aFoundKeys.AppendL( keys[i]^KSIPClientResolverUserNameMask );
+        }
+    CleanupStack::PopAndDestroy( &keys );
+    }
+
+// ---------------------------------------------------------------------------
+// Create a new key for the new row
+// ---------------------------------------------------------------------------
+//
+void CSipClientResolverUtils::CreateNewKeyL(
+    TUint32& aNewKey ) const
+    {
+    RArray<TUint32> keys;
+    CleanupClosePushL( keys );
+    TInt err = KErrNone;
+    
+    TRAPD( leaveCode, err = iRepository->FindL( KSIPClientResolverUserNameMask, 
+                                  KSIPClientResolverFieldTypeMask, 
+                                  keys ) );
+    if ( KErrNotFound == leaveCode )
+        {
+        err = KErrNotFound;
+        leaveCode = KErrNone;
+        }
+    User::LeaveIfError( leaveCode );
+    if ( ( KErrNotFound == err ) || ( keys.Count() == 0 ) )
+        {
+        aNewKey = 1;
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        // Find the biggest key and increment it by one
+        keys.SortUnsigned();
+        aNewKey = KSIPClientResolverUserNameMask^keys[ keys.Count() - 1 ] + 1;       
+        }
+    CleanupStack::PopAndDestroy( &keys );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSipClientResolverUtils::CallProviderUidsL
+// -----------------------------------------------------------------------------
+//    
+ void CSipClientResolverUtils::CallProviderUidsL( RArray<TUint>& aUidArray ) const
+    {
+    CSPSettings* spSettings = CSPSettings::NewLC();
+    CSPProperty* property = CSPProperty::NewLC();
+    
+    RArray<TUint> idArray;
+    CleanupClosePushL( idArray );
+    User::LeaveIfError( spSettings->FindServiceIdsL( idArray ) );
+    TInt count = idArray.Count();
+    TInt result( KErrNotFound );
+    
+    for( TInt i( 0 ); i < count; i++ )
+        {
+        result =  spSettings->FindPropertyL(
+                idArray[i], EPropertyCallProviderPluginId, *property );
+        
+        if ( result == KErrNone && property )
+            {
+            TInt value( 0 );
+            property->GetValue( value );
+            aUidArray.Append( value );
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &idArray );
+    CleanupStack::PopAndDestroy( property );
+    CleanupStack::PopAndDestroy( spSettings );
+    }
+ 
+ // -----------------------------------------------------------------------------
+ // CSipClientResolverUtils::CheckImplementationUidL
+ // -----------------------------------------------------------------------------
+ // 
+ TBool CSipClientResolverUtils::CheckImplementationUidL( 
+     const TUint32& aKey, const TUid& aImplementation ) const
+     {     
+     TBool match( EFalse );
+     TInt implementationValue( KErrNotFound );
+     
+     iRepository->Get( ( aKey^KSIPClientResolverUserNameMask )  |
+                         KSIPClientResolverClientUIDMask,
+                         implementationValue );
+      
+     if ( implementationValue == aImplementation.iUid )
+         { 
+         match = ETrue;
+         }
+     
+     return match;
+     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/bwins/voipeventlogu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,19 @@
+EXPORTS
+	??1CVoipErrorEntry@@UAE@XZ @ 1 NONAME ; CVoipErrorEntry::~CVoipErrorEntry(void)
+	??1CVoipEventLog@@UAE@XZ @ 2 NONAME ; CVoipEventLog::~CVoipEventLog(void)
+	?ErrorCode@CVoipErrorEntry@@QBEHXZ @ 3 NONAME ; int CVoipErrorEntry::ErrorCode(void) const
+	?ErrorCount@CVoipEventLog@@QBEHXZ @ 4 NONAME ; int CVoipEventLog::ErrorCount(void) const
+	?ErrorText@CVoipErrorEntry@@QBEABVTDesC16@@XZ @ 5 NONAME ; class TDesC16 const & CVoipErrorEntry::ErrorText(void) const
+	?NewL@CVoipErrorEntry@@SAPAV1@XZ @ 6 NONAME ; class CVoipErrorEntry * CVoipErrorEntry::NewL(void)
+	?NewL@CVoipEventLog@@SAPAV1@XZ @ 7 NONAME ; class CVoipEventLog * CVoipEventLog::NewL(void)
+	?NewLC@CVoipErrorEntry@@SAPAV1@XZ @ 8 NONAME ; class CVoipErrorEntry * CVoipErrorEntry::NewLC(void)
+	?NewLC@CVoipEventLog@@SAPAV1@XZ @ 9 NONAME ; class CVoipEventLog * CVoipEventLog::NewLC(void)
+	?ReadError@CVoipEventLog@@QBEHHAAVCVoipErrorEntry@@@Z @ 10 NONAME ; int CVoipEventLog::ReadError(int, class CVoipErrorEntry &) const
+	?SetErrorCode@CVoipErrorEntry@@QAEXH@Z @ 11 NONAME ; void CVoipErrorEntry::SetErrorCode(int)
+	?SetErrorText@CVoipErrorEntry@@QAEHABVTDesC16@@@Z @ 12 NONAME ; int CVoipErrorEntry::SetErrorText(class TDesC16 const &)
+	?TimeStamp@CVoipErrorEntry@@QBEABVTDesC16@@XZ @ 13 NONAME ; class TDesC16 const & CVoipErrorEntry::TimeStamp(void) const
+	?WriteError@CVoipEventLog@@QAEHABVCVoipErrorEntry@@@Z @ 14 NONAME ; int CVoipEventLog::WriteError(class CVoipErrorEntry const &)
+	?WriteError@CVoipEventLog@@QAEHH@Z @ 15 NONAME ; int CVoipEventLog::WriteError(int)
+	?NewLC@CVoipErrorEntry@@SAPAV1@HABVTDesC16@@@Z @ 16 NONAME ; class CVoipErrorEntry * CVoipErrorEntry::NewLC(int, class TDesC16 const &)
+	?ResetLog@CVoipEventLog@@QAEHXZ @ 17 NONAME ; int CVoipEventLog::ResetLog(void)
+
Binary file voipplugins/ipapputils/voipeventlog/cenrep/keys_voipeventlog.xls has changed
Binary file voipplugins/ipapputils/voipeventlog/conf/voipeventlog.confml has changed
Binary file voipplugins/ipapputils/voipeventlog/conf/voipeventlog_2000b608.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/eabi/voipeventlogU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,23 @@
+EXPORTS
+	_ZN13CVoipEventLog10WriteErrorERK15CVoipErrorEntry @ 1 NONAME
+	_ZN13CVoipEventLog10WriteErrorEi @ 2 NONAME
+	_ZN13CVoipEventLog4NewLEv @ 3 NONAME
+	_ZN13CVoipEventLog5NewLCEv @ 4 NONAME
+	_ZN13CVoipEventLogD0Ev @ 5 NONAME
+	_ZN13CVoipEventLogD1Ev @ 6 NONAME
+	_ZN13CVoipEventLogD2Ev @ 7 NONAME
+	_ZN15CVoipErrorEntry12SetErrorCodeEi @ 8 NONAME
+	_ZN15CVoipErrorEntry12SetErrorTextERK7TDesC16 @ 9 NONAME
+	_ZN15CVoipErrorEntry4NewLEv @ 10 NONAME
+	_ZN15CVoipErrorEntry5NewLCEv @ 11 NONAME
+	_ZN15CVoipErrorEntryD0Ev @ 12 NONAME
+	_ZN15CVoipErrorEntryD1Ev @ 13 NONAME
+	_ZN15CVoipErrorEntryD2Ev @ 14 NONAME
+	_ZNK13CVoipEventLog10ErrorCountEv @ 15 NONAME
+	_ZNK13CVoipEventLog9ReadErrorEiR15CVoipErrorEntry @ 16 NONAME
+	_ZNK15CVoipErrorEntry9ErrorCodeEv @ 17 NONAME
+	_ZNK15CVoipErrorEntry9ErrorTextEv @ 18 NONAME
+	_ZNK15CVoipErrorEntry9TimeStampEv @ 19 NONAME
+	_ZN15CVoipErrorEntry5NewLCEiRK7TDesC16 @ 20 NONAME
+	_ZN13CVoipEventLog8ResetLogEv @ 21 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,37 @@
+/*
+* 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:  
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+// Public headers
+../inc/voipeventlog.h	|../../../../inc/voipeventlog.h
+../inc/voiperrorentry.h	|../../../../inc/voiperrorentry.h
+
+../rom/voipeventlog.iby	CORE_APP_LAYER_IBY_EXPORT_PATH(voipeventlog.iby)
+
+../conf/voipeventlog.confml                 APP_LAYER_CONFML(voipeventlog.confml)
+../conf/voipeventlog_2000b608.crml 	        APP_LAYER_CRML(voipeventlog_2000b608.crml)
+
+PRJ_MMPFILES
+voipeventlog.mmp
+PRJ_TESTMMPFILES
+//../internal/moduletests/group/mt_voipeventlog.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/group/voipeventlog.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET                  voipeventlog.dll
+TARGETTYPE              DLL
+UID                     0x1000008d 0x2000B607
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  voipeventlog.cpp
+SOURCE                  voipeventlogengine.cpp
+SOURCE                  voiperrorentry.cpp
+
+USERINCLUDE             ../inc
+
+APP_LAYER_SYSTEMINCLUDE 
+
+LIBRARY                 euser.lib
+LIBRARY                 centralrepository.lib
+LIBRARY                 bafl.lib // CDesCArray
+
+LIBRARY                 flogger.lib     // for logging
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/inc/voiperrorentry.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,140 @@
+/*
+* 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:  
+*
+*/
+
+
+
+#ifndef C_VOIPERRORENTRY_H
+#define C_VOIPERRORENTRY_H
+
+#include <e32base.h>
+
+/**
+ *  VoIP error entry. 
+ *  Container class for VoIP error information
+ *
+ *  @lib voipeventlog.lib
+ *  @since S60 V3.2
+ */
+NONSHARABLE_CLASS( CVoipErrorEntry ): public CBase
+    {
+
+	public: // Constructors and destructor
+	    /**
+	    * Two-phased constructor.
+	    */
+	    IMPORT_C static CVoipErrorEntry* NewL();
+
+	    /**
+	    * Two-phased constructor.
+	    */
+	    IMPORT_C static CVoipErrorEntry* NewLC();
+
+	    /**
+	    * Two-phased constructor.
+	    */
+	    IMPORT_C static CVoipErrorEntry* NewLC( TInt aErrorCode, const TDesC& aErrorText );
+
+	    /**
+	    * Destructors.
+	    */
+	    IMPORT_C virtual ~CVoipErrorEntry();
+
+	public: // Member functions
+
+	    /**
+	     * Returns error VoIP code.
+	     *
+	     * @since S60 V3.2
+	     * @return error code of VoIP
+	     */
+	    IMPORT_C TInt ErrorCode() const;
+
+	    /**
+	     * Sets VoIP error code.
+	     *
+	     * @since S60 V3.2
+	     * @param aErrorCode VoIP error code
+	     */
+	    IMPORT_C void SetErrorCode( TInt aErrorCode ); 
+
+	    /**
+	     * Returns error text
+	     *
+	     * @since S60 V3.2
+	     * @return error text
+	     */
+	    IMPORT_C const TDesC& ErrorText() const;
+
+	    /**
+	     * Sets error text
+	     *
+	     * @since S60 V3.2
+	     * @param aErrorText error text to be set
+	     */
+	    IMPORT_C TInt SetErrorText( const TDesC& aErrorText );
+
+	    /**
+	     * Returns time stamp
+	     *
+	     * @since S60 V3.2
+	     * @return time stamp
+	     */
+	    IMPORT_C const TDesC& TimeStamp() const;
+
+	    /**
+	     * Sets time stamp
+	     * this function is not exported, time stamp is set inside of 
+	     * voipeventlog component
+	     *
+	     * @since S60 V3.2
+	     * @param aTimeStamp time stamp to be set
+	     */
+	    TInt SetTimeStamp( const TDesC& aTimeStamp );
+	    
+
+	private:
+
+	    /**
+	    * C++ default constructor.
+	    */
+	    CVoipErrorEntry();
+
+	    /**
+	    * By default Symbian 2nd phase constructor is private.
+	    */
+	    void ConstructL();
+
+	private: // data
+
+	    /**
+	     * VoIP error code
+	     */
+	    TInt iErrorCode;
+
+	    /**
+	     * VoIP error text
+	     */
+	    RBuf iErrorText;
+
+	    /**
+	     * VoIP error stamp
+	     */
+		RBuf iTimeStamp;
+    };
+
+
+#endif // C_VOIPERRORENTRY_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/inc/voipeventlog.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,148 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef C_VOIPEVENTLOG_H
+#define C_VOIPEVENTLOG_H
+
+
+#include <e32base.h>
+
+class CVoipEventLogEngine;
+class CVoipErrorEntry;
+
+/**
+ *  VoIP event log API class
+ *  CVoipEventLog is responsible for writing and reading error information
+ *  from central repository
+ *  The maximu error count is saved in cenrep ini file, if there are more errors
+ *  than maximum count, old error is overwritten.
+ *
+ *  @code
+ *  _LIT( KErrorText, "something wrong, man!" );
+ *  CVoipEventLog* eventLog = CVoipEventLog::NewLC();
+ *  CVoipErrorEntry* entry = CVoipErrorEntry::NewLC();
+ *  entry->SetErrorCode( -1 );
+ *  User::LeaveIfError( entry->SetErrorText( KErrorText ));
+ *  TInt err = eventLog->WriteError( *entry );
+ *  User::LeaveIfError( err );
+ *  CleanupStack::PopAndDestroy( entry );
+ *  CleanupStack::PopAndDestroy( eventLog );
+ *  @endcode
+ *
+ *  @lib voipeventlog.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(CVoipEventLog) : public CBase
+  {
+  public:
+
+        /**
+         * Two-phased constructor.
+         */
+        IMPORT_C static CVoipEventLog* NewL();
+        IMPORT_C static CVoipEventLog* NewLC();
+
+        /**
+         * Destructor.
+         */
+        IMPORT_C ~CVoipEventLog();
+
+        /**
+         * Writes an error data to event log
+         *
+         * @since S60 v3.2
+         * @param aErrorEntry Error information
+         * @return error code
+         */
+        IMPORT_C TInt WriteError( const CVoipErrorEntry& aErrorEntry );
+
+        /**
+         * Writes an error code to event log
+         * this function only writes the error code, no other infomration
+         * @since S60 v3.2
+         * @param aErrorCode VoIP error identification
+         * @return error code
+         */
+        IMPORT_C TInt WriteError( TInt aErrorCode );
+
+        /**
+         * Reads error count from the log
+         *
+         * @since S60 v3.2
+         * @return if it is positive, it means error count, if it is negative, it means error code
+         */
+        IMPORT_C TInt ErrorCount() const;
+
+        /**
+         * Reads an error information from the log
+         *
+         * @since S60 v3.2
+         * @param aIndex the index of error to be read, 0 means latest error index
+         * @param aErrorEntry in return, error information corresponding to aIndex
+         * @return error code
+         */
+        IMPORT_C TInt ReadError( TInt aIndex, CVoipErrorEntry& aErrorEntry ) const;
+
+        /**
+         * Clear all voip error entries from the log
+         *
+         * @since S60 v3.2
+         * @return error code
+         */
+        IMPORT_C TInt ResetLog ();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVoipEventLog();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+         * Writes an error data to event log
+         * this is leave function
+         *
+         * @since S60 v3.2
+         * @param aErrorEntry Error information
+         */
+        void DoWriteErrorL( const CVoipErrorEntry& aErrorEntry );
+
+        /**
+         * Writes an error code to event log
+         * this is leave function
+         * @since S60 v3.2
+         * @param aErrorCode VoIP error identification
+         */
+        void DoWriteErrorL( TInt aErrorCode );
+
+
+    private: // data
+
+        /**
+         * CVoipEventLogEngine instance
+         */
+        CVoipEventLogEngine* iEngine;
+
+  };
+
+#endif  // C_VOIPEVENTLOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/inc/voipeventlogconstants.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef VOIPEVENTLOGCONSTANTS_H
+#define VOIPEVENTLOGCONSTANTS_H
+
+const TUid KCRUidVoIPEventLog = { 0x2000B608 };
+
+_LIT( KVoIPEventLogSemaphore, "VoIPEventLogSemaphore" );
+_LIT(KVoIPTimeStampFormat,"%F%D/%M/%Y %H:%T:%S");
+
+const TInt KVELErrorCountKey = 0x00000000;
+const TInt KVELLatestErrorIndexKey = 0x00000001;
+const TInt KVELMaxErrorCountKey = 0x00000002;
+
+const TInt KTimeStampStrLen = 19;
+const TUint32 KColumnIncrement = 0x00010000;
+const TUint32 KColumnMask = 0xFFFF0000;
+
+/** First key in column of error code. */
+const TUint32 KSPColumnErrorCode = 0x00010001;            // --> 0x00020000
+
+/** First key in column of error text. */
+const TUint32 KSPColumnErrorText = 0x00020001;          // --> 0x00030000
+
+/** First key in column of time stamp. */
+const TUint32 KSPColumnTimeStamp = 0x00030001;          // --> 0x00040000
+
+#endif  // VOIPEVENTLOGCONSTANTS_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/inc/voipeventlogengine.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,173 @@
+/*
+* 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: 
+*
+*/
+
+
+#ifndef C_VOIPEVENTLOGENGINE_H
+#define C_VOIPEVENTLOGENGINE_H
+
+#include <e32base.h>
+
+class CRepository;
+class CVoipErrorEntry;
+
+/**
+ *  Engine class for VoIP event log API.
+ *  CVoipEventLogEngine do the real work for reading and
+ *  writing error from/to central repository
+ *
+ *  @lib voipeventlog.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS(CVoipEventLogEngine) : public CBase
+  {
+  public:
+
+        /**
+         * Two-phased constructor.
+         */
+        static CVoipEventLogEngine* NewL();
+        static CVoipEventLogEngine* NewLC();
+
+        /**
+         * Destructor.
+         */
+        ~CVoipEventLogEngine();
+
+        /**
+         * Writes an error data to event log
+         *
+         * @since S60 v3.2
+         * @param aErrorEntry Error information
+         */
+        void WriteErrorL( const CVoipErrorEntry& aErrorEntry );
+
+        /**
+         * Reads an error informaiton from the log
+         *
+         * @since S60 v3.2
+         * @param aIndex the index of error to be read
+         * @param aErrorEntry in return, error information corresponding to aIndex
+         */
+        void ReadErrorL( TInt aIndex, CVoipErrorEntry& aErrorEntry );
+
+        /**
+         * Reads error count from the log
+         *
+         * @since S60 v3.2
+         * @param on return, error count
+         */
+        void ErrorCountL( TInt& aCount );
+
+        /**
+         * Reset all erros from the central repository.
+         *
+         * @since S60 v3.2
+         * @return  Operation code.
+         */
+        TInt ResetLogHistory ();
+
+        /**
+         * Starts transaction in central repository
+         *
+         * @since S60 v3.2
+         */
+        void BeginTransactionLC();
+
+        /**
+         * Commits changes in repository
+         *
+         * @since S60 v3.2
+         */
+        void CommitTransactionL();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CVoipEventLogEngine();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+         * Generate time stamp with current time
+         *
+         * @since S60 v3.2
+         * @param on return, current time stamp, e.g. 11/09/2007 14:19:40
+         */
+        void GenerateTimeStampL( TDes& aTimeStamp ) const;
+
+        /**
+         * Get latest index number
+         *
+         * @since S60 v3.2
+         * @return latest index number
+         */
+        TInt GetLatestIndexL();
+
+        /**
+         * Get new index number
+         *
+         * @since S60 v3.2
+         * @return new index number
+         */
+        TInt GetNewIndexL();
+
+        /**
+         * Get maximum error count
+         *
+         * @since S60 v3.2
+         * @return maximu error count
+         */
+        TInt GetMaxErrorCountL();
+
+        /**
+         * release semaphore, this function is used in custom cleanup
+         *
+         * @since S60 v3.2
+         * @param aEngine pointer to an object which is the target of the cleanup operation
+         */
+        static void ReleaseSemaphore( TAny* aEngine );
+
+        /**
+         * release semaphore
+         *
+         * @since S60 v3.2
+         */
+        void DoReleaseSemaphore();
+
+    private: // data
+        /**
+         * Central Repository object.
+         * Own.
+         */
+        CRepository* iRepository;
+
+        /**
+         * RSemaphore object.
+         * Own.
+         */
+        RSemaphore iSemaphore;
+
+  };
+
+#endif  // C_VOIPEVENTLOGENGINE_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/inc/voipeventloglogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,99 @@
+/*
+* 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:  
+*
+*/
+
+
+
+#ifndef VOIPEVENTLOGGER_H
+#define VOIPEVENTLOGGER_H
+
+//  INCLUDES
+#include <e32def.h>
+
+
+//-----------------------------------------------------------------------------
+//  USER LOGGING SETTINGS
+//-----------------------------------------------------------------------------
+
+#ifndef _DEBUG
+
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = Flogger
+*   2 = RDebug
+***************************/ 
+
+#define VELAPI_LOGGING_METHOD  0   // UREL BUILD
+
+#else
+
+#ifdef __WINS__
+#define VELAPI_LOGGING_METHOD  2   // UDEB BUILD, WINS
+#else
+#define VELAPI_LOGGING_METHOD  2   // UDEB BUILD, HW
+#endif // __WINS__
+
+#endif // _DEBUG
+
+
+//-----------------------------------------------------------------------------
+//  LOGGING SETTINGS (DO NOT EDIT)
+//-----------------------------------------------------------------------------
+
+#if VELAPI_LOGGING_METHOD == 1      // Flogger
+
+#include <flogger.h>
+_LIT(KVELAPILogFolder,"VELAPI");
+_LIT(KVELAPIAPILogFile,"VELAPI.TXT");
+
+#elif VELAPI_LOGGING_METHOD == 2    // RDebug
+
+#include <e32svr.h>
+
+#endif
+
+
+//-----------------------------------------------------------------------------
+//  LOGGING MACROs (DO NOT EDIT)
+//
+//  USE THESE MACROS IN YOUR CODE
+//-----------------------------------------------------------------------------
+
+#if VELAPI_LOGGING_METHOD == 1      // Flogger
+
+#define VELLOGSTRING(AA)           { RFileLogger::Write(KXSPSAPILogFolder(),KXSPSAPILogFile(),EFileLoggingModeAppend, _L(AA) ); }
+#define VELLOGSTRING2(AA,BB)       { RFileLogger::WriteFormat(KXSPSAPILogFolder(),KXSPSAPILogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB); }
+#define VELLOGSTRING3(AA,BB,CC)    { RFileLogger::WriteFormat(KXSPSAPILogFolder(),KXSPSAPILogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB,CC); }
+#define VELLOGSTRING4(AA,BB,CC,DD) { RFileLogger::WriteFormat(KXSPSAPILogFolder(),KXSPSAPILogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(_L(AA)),BB,CC,DD); }
+
+#elif VELAPI_LOGGING_METHOD == 2    // RDebug
+
+#define VELLOGSTRING(AA)           { RDebug::Print(_L(AA)); }
+#define VELLOGSTRING2(AA,BB)       { RDebug::Print(_L(AA),BB); }
+#define VELLOGSTRING3(AA,BB,CC)    { RDebug::Print(_L(AA),BB,CC); }
+#define VELLOGSTRING4(AA,BB,CC,DD) { RDebug::Print(_L(AA),BB,CC,DD); }
+
+#else   // XSPSAPI_LOGGING_METHOD == 0 or invalid -> Disable loggings
+
+#define VELLOGSTRING(AA)           // Example: XSPSLOGSTRING("Test");
+#define VELLOGSTRING2(AA,BB)       // Example: XSPSLOGSTRING("Test %d", aValue);
+#define VELLOGSTRING3(AA,BB,CC)    // Example: XSPSLOGSTRING("Test %d %d", aValue1, aValue2);
+#define VELLOGSTRING4(AA,BB,CC,DD) // Example: XSPSLOGSTRING("Test %d %d %d", aValue1, aValue2, aValue3);
+
+#endif  // VELAPI_LOGGING_METHOD
+
+#endif  // VELAPILOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/rom/voipeventlog.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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:  VoIPEventLog ROM definition file
+*
+*/
+
+
+#ifndef VOIPEVENTLOG_IBY
+#define VOIPEVENTLOG_IBY
+
+file=ABI_DIR/BUILD_DIR/voipeventlog.dll  SHARED_LIB_DIR/voipeventlog.dll
+
+#endif // VOIPEVENTLOG_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/src/voiperrorentry.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,174 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <centralrepository.h>
+#include "voiperrorentry.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CVoipErrorEntry::CVoipErrorEntry()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+void CVoipErrorEntry::ConstructL()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVoipErrorEntry* CVoipErrorEntry::NewL()
+    {
+    CVoipErrorEntry* self = CVoipErrorEntry::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVoipErrorEntry* CVoipErrorEntry::NewLC()
+    {
+    CVoipErrorEntry* self = new( ELeave ) CVoipErrorEntry;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVoipErrorEntry* CVoipErrorEntry::NewLC( TInt aErrorCode, const TDesC& aErrorText )
+    {
+    CVoipErrorEntry* self = new( ELeave ) CVoipErrorEntry;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    self->SetErrorCode( aErrorCode );
+    self->SetErrorText( aErrorText );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVoipErrorEntry::~CVoipErrorEntry()
+    {
+    iErrorText.Close();
+    iTimeStamp.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Returns error VoIP code.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVoipErrorEntry::ErrorCode() const
+	{
+	return iErrorCode;
+	}
+
+// ---------------------------------------------------------------------------
+// Sets VoIP error code.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CVoipErrorEntry::SetErrorCode( TInt aErrorCode )
+	{
+	iErrorCode = aErrorCode;
+	}
+
+// ---------------------------------------------------------------------------
+// Returns error text
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CVoipErrorEntry::ErrorText() const
+	{
+	return iErrorText;
+	}
+
+// ---------------------------------------------------------------------------
+// Sets error text
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVoipErrorEntry::SetErrorText( const TDesC& aErrorText )
+	{
+    TInt err( KErrNone );
+    TInt length( aErrorText.Length() );
+
+    if ( NCentralRepositoryConstants::KMaxBinaryLength < length )
+        {
+        err = KErrArgument;
+        }
+    else
+        {
+        iErrorText.Close();
+        err = iErrorText.Create( aErrorText );
+        }
+
+    return err;
+	
+	}
+
+// ---------------------------------------------------------------------------
+// Returns time stamp
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TDesC& CVoipErrorEntry::TimeStamp() const
+	{
+	return iTimeStamp;
+	}
+	
+
+// ---------------------------------------------------------------------------
+// Sets time stamp
+// ---------------------------------------------------------------------------
+//
+TInt CVoipErrorEntry::SetTimeStamp( const TDesC& aTimeStamp )
+	{
+    TInt err( KErrNone );
+    TInt length( aTimeStamp.Length() );
+
+    if ( NCentralRepositoryConstants::KMaxBinaryLength < length )
+        {
+        err = KErrArgument;
+        }
+    else
+        {
+        iTimeStamp.Close();
+        err = iTimeStamp.Create( aTimeStamp );
+        }
+
+    return err;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/src/voipeventlog.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,180 @@
+/*
+* 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: 
+*
+*/
+
+#include "voipeventlogengine.h"
+#include "voipeventlogconstants.h"
+#include "voiperrorentry.h"
+#include "voipeventloglogger.h" // For logging
+#include "voipeventlog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CVoipEventLog::CVoipEventLog()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLog::ConstructL()
+    {
+    VELLOGSTRING( "CVoipEventLog::ConstructL() - IN" );
+
+    iEngine = CVoipEventLogEngine::NewL();
+
+    VELLOGSTRING( "CVoipEventLog::ConstructL() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVoipEventLog* CVoipEventLog::NewL()
+    {
+    CVoipEventLog* self = CVoipEventLog::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVoipEventLog* CVoipEventLog::NewLC()
+    {
+    CVoipEventLog* self = new( ELeave ) CVoipEventLog;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVoipEventLog::~CVoipEventLog()
+    {
+    VELLOGSTRING( "CVoipEventLog::~CVoipEventLog() - IN" );
+
+    delete iEngine;
+
+    VELLOGSTRING( "CVoipEventLog::~CVoipEventLog() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Writes an error data to event log
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVoipEventLog::WriteError( const CVoipErrorEntry& aErrorEntry )
+    {
+    TRAPD( err, DoWriteErrorL( aErrorEntry ) );
+
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Writes an error code to event log
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVoipEventLog::WriteError( TInt aErrorCode )
+    {
+    TRAPD( err, DoWriteErrorL( aErrorCode ) );
+
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Reads error count from the log
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVoipEventLog::ErrorCount() const
+    {
+    TInt count( 0 );
+    TRAPD( err, iEngine->ErrorCountL( count ) );
+
+    if( err == KErrNone )
+        {
+        return count;
+        }
+    else
+        {
+        return err;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Reads an error informaiton from the log
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVoipEventLog::ReadError( TInt aIndex, CVoipErrorEntry& aErrorEntry ) const
+    {
+    TRAPD( err, iEngine->ReadErrorL( aIndex, aErrorEntry); );
+
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Reset log history. After this method has called, all voip errors are cleared
+// from central repository.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVoipEventLog::ResetLog ()
+    {
+    VELLOGSTRING( "CVoipEventLog::ResetLog - IN" );
+    TInt err = iEngine->ResetLogHistory ();
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Writes an error data to event log
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLog::DoWriteErrorL( const CVoipErrorEntry& aErrorEntry )
+    {
+    iEngine->BeginTransactionLC();
+
+    iEngine->WriteErrorL( aErrorEntry );
+
+    iEngine->CommitTransactionL();
+    }
+
+// ---------------------------------------------------------------------------
+// Writes an error code to event log
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLog::DoWriteErrorL( TInt aErrorCode )
+    {
+    CVoipErrorEntry* entry = CVoipErrorEntry::NewLC();
+    entry->SetErrorCode( aErrorCode );
+
+    DoWriteErrorL( *entry );
+
+    CleanupStack::PopAndDestroy( entry );
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/ipapputils/voipeventlog/src/voipeventlogengine.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,318 @@
+/*
+* 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: 
+*
+*/
+
+
+#include <centralrepository.h>
+
+#include "voipeventlogengine.h"
+#include "voipeventlogconstants.h"
+#include "voiperrorentry.h"
+#include "voipeventloglogger.h" // For logging
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CVoipEventLogEngine::CVoipEventLogEngine()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLogEngine::ConstructL()
+    {
+    VELLOGSTRING( "CVoipEventLogEngine::ConstructL() - IN" );
+    iRepository = CRepository::NewL( KCRUidVoIPEventLog );
+
+    TInt err = iSemaphore.OpenGlobal( KVoIPEventLogSemaphore );
+    if ( err != KErrNone )
+        {
+        User::LeaveIfError( iSemaphore.CreateGlobal( KVoIPEventLogSemaphore, 1 ) );
+        }
+
+
+    VELLOGSTRING( "CVoipEventLogEngine::ConstructL() - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CVoipEventLogEngine* CVoipEventLogEngine::NewL()
+    {
+    CVoipEventLogEngine* self = CVoipEventLogEngine::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CVoipEventLogEngine* CVoipEventLogEngine::NewLC()
+    {
+    CVoipEventLogEngine* self = new( ELeave ) CVoipEventLogEngine;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CVoipEventLogEngine::~CVoipEventLogEngine()
+    {
+    VELLOGSTRING( "CVoipEventLogEngine::~CVoipEventLogEngine() - IN" );
+
+    delete iRepository;
+
+    iSemaphore.Close();
+
+    VELLOGSTRING( "CVoipEventLogEngine::~CVoipEventLogEngine() - OUT" );
+    }
+
+// ---------------------------------------------------------------------------
+// release semaphore, this function is used in custom cleanup
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLogEngine::ReleaseSemaphore( TAny* aEngine )
+    {
+    ASSERT ( aEngine );
+    CVoipEventLogEngine* engine = static_cast<CVoipEventLogEngine*>( aEngine );
+    engine->DoReleaseSemaphore();
+    }
+
+// ---------------------------------------------------------------------------
+// release semaphore
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLogEngine::DoReleaseSemaphore()
+    {
+    iSemaphore.Signal();
+    }
+
+// ---------------------------------------------------------------------------
+// Begins transaction in repository.
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLogEngine::BeginTransactionLC()
+    {
+    VELLOGSTRING( "CVoipEventLogEngine::BeginTransaction() - IN" );
+
+    iSemaphore.Wait();
+    TCleanupItem cleanup( CVoipEventLogEngine::ReleaseSemaphore, this );
+    CleanupStack::PushL( cleanup );
+
+    User::LeaveIfError( iRepository->StartTransaction( CRepository::EReadWriteTransaction ) );
+
+    iRepository->CleanupRollbackTransactionPushL(); // if leave happens, only roll back, no delete
+
+    VELLOGSTRING( "CVoipEventLogEngine::BeginTransaction() - OUT" );
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// Commits changes in repository.
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLogEngine::CommitTransactionL()
+    {
+    VELLOGSTRING(
+        "CVoipEventLogEngine::CommitTransactionL() - IN" );
+
+    TUint32 temp;
+    User::LeaveIfError( iRepository->CommitTransaction( temp ) );
+
+    iSemaphore.Signal();
+
+    CleanupStack::Pop( 2 ); // semaphore and repository
+
+    VELLOGSTRING( "CVoipEventLogEngine::CommitTransaction() - OUT" );
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// Generate time stamp with current time
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLogEngine::GenerateTimeStampL( TDes& aTimeStamp) const
+    {
+    TTime now;
+    now.HomeTime();
+    now.FormatL( aTimeStamp, KVoIPTimeStampFormat );
+    }
+
+// ---------------------------------------------------------------------------
+// Get latest index number
+// ---------------------------------------------------------------------------
+//
+TInt CVoipEventLogEngine::GetLatestIndexL()
+    {
+    TInt latestIndex( 0 );
+    User::LeaveIfError( iRepository->Get( KVELLatestErrorIndexKey, latestIndex ) );
+
+    return latestIndex;
+    }
+
+// ---------------------------------------------------------------------------
+// Get new index number
+// ---------------------------------------------------------------------------
+//
+TInt CVoipEventLogEngine::GetNewIndexL()
+    {
+    TInt latestIndex = GetLatestIndexL();
+    TInt maxCount = GetMaxErrorCountL();
+    TInt newIndex = latestIndex + 1;
+    if( newIndex >= maxCount )
+        {
+        newIndex = newIndex - maxCount;
+        }
+
+    return newIndex;
+    }
+
+// ---------------------------------------------------------------------------
+// Get maximum error count
+// ---------------------------------------------------------------------------
+//
+TInt CVoipEventLogEngine::GetMaxErrorCountL()
+    {
+    TInt count( 0 );
+    User::LeaveIfError( iRepository->Get( KVELMaxErrorCountKey, count ) );
+
+    return count;
+    }
+
+// ---------------------------------------------------------------------------
+// Writes an error data to event log
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLogEngine::WriteErrorL( const CVoipErrorEntry& aErrorEntry )
+    {
+    if( aErrorEntry.ErrorText().Length() > NCentralRepositoryConstants::KMaxBinaryLength )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TInt newIndex = GetNewIndexL();
+    TBuf<KTimeStampStrLen> timeStamp;
+    GenerateTimeStampL( timeStamp );
+
+    // error code
+    TUint32 key = newIndex + KSPColumnErrorCode;
+    User::LeaveIfError( iRepository->Set( key, aErrorEntry.ErrorCode() ) );
+
+    // error text
+    key += KColumnIncrement;
+    User::LeaveIfError( iRepository->Set( key, aErrorEntry.ErrorText() ) );
+
+    // time stamp
+    key += KColumnIncrement;
+    User::LeaveIfError( iRepository->Set( key, timeStamp ) );
+
+    // save newIndex to latest index
+    User::LeaveIfError( iRepository->Set( KVELLatestErrorIndexKey, newIndex ) );
+
+    // save new count to cenrep
+    TInt count( 0 );
+
+    User::LeaveIfError( iRepository->Get( KVELErrorCountKey, count ) );
+    if( count < GetMaxErrorCountL() )
+        {
+        count++;
+        User::LeaveIfError( iRepository->Set( KVELErrorCountKey, count ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Reads error count from the log
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLogEngine::ErrorCountL( TInt& aCount )
+    {
+    User::LeaveIfError( iRepository->Get( KVELErrorCountKey, aCount ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Reset voip errors log history.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipEventLogEngine::ResetLogHistory()
+    {
+    TInt retValue = iRepository->Reset();
+    return retValue;
+    }
+
+// ---------------------------------------------------------------------------
+// Reads an error informaiton from the log
+// ---------------------------------------------------------------------------
+//
+void CVoipEventLogEngine::ReadErrorL( TInt aIndex, CVoipErrorEntry& aErrorEntry )
+    {
+    TInt count( 0 );
+    ErrorCountL( count );
+
+    if( aIndex > count - 1 )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    TInt latestIndex = GetLatestIndexL();
+    TInt index = latestIndex - aIndex;
+    if( index < 0 )
+        {
+        index += count;
+        }
+
+    // error code
+    TUint32 key = index + KSPColumnErrorCode;
+    TInt errorCode;
+    User::LeaveIfError( iRepository->Get( key, errorCode ) );
+    aErrorEntry.SetErrorCode( errorCode );
+
+    // error text
+    HBufC* errorText = HBufC::NewLC( NCentralRepositoryConstants::KMaxBinaryLength );
+    TPtr ptrErrorText = errorText->Des();
+    key += KColumnIncrement;
+    User::LeaveIfError( iRepository->Get( key, ptrErrorText ) );
+
+    // error timestamp
+    HBufC* timeStamp = HBufC::NewLC( KTimeStampStrLen );
+    TPtr ptrTimeStamp = timeStamp->Des();
+    key += KColumnIncrement;
+    User::LeaveIfError( iRepository->Get( key, ptrTimeStamp ) );
+
+    // set new data to aErrorEntry
+    User::LeaveIfError( aErrorEntry.SetErrorText( *errorText ) );
+    User::LeaveIfError( aErrorEntry.SetTimeStamp( *timeStamp ) );
+
+    CleanupStack::PopAndDestroy( 2, errorText );
+
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/data/1027545B.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,58 @@
+/*
+* 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:  
+*
+*/
+
+
+
+
+#include <eikon.rh>
+#include "registryinfov2.rh" 
+#include "sipconnectionprovideruids.hrh"
+
+//  RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+//   
+// theInfo
+// REGISTRY_INFO for ECom
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2; 
+    dll_uid = KSIPConnectivityPluginUid;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x10275457;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KSIPConnectivityPluginImplUid;
+                    version_no = 1;
+                    display_name = " ";
+                    default_data = "*";
+                    opaque_data = " ";
+                    }             
+                };
+            }
+        };
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 sipconnectionprovider
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_EXPORTS
+../rom/sipconnectionprovider.iby CORE_APP_LAYER_IBY_EXPORT_PATH( sipconnectionprovider.iby )
+
+PRJ_MMPFILES
+
+PRJ_MMPFILES
+sipconnectionprovider.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/group/sipconnectionprovider.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2007-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 sipconnectionprovider
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../inc/sipconnectionprovideruids.hrh"
+
+TARGET		sipconnectionprovider.dll
+TARGETTYPE	PLUGIN
+UID	        0x10009D8D KSIPConnectivityPluginUid
+VENDORID    VID_DEFAULT
+CAPABILITY  CAP_ECOM_PLUGIN
+
+// SOURCE
+SOURCEPATH	../src
+SOURCE	    scpplugin.cpp
+SOURCE      scpservicemanager.cpp
+SOURCE      scpservicehandlerbase.cpp
+SOURCE      scpprofilehandler.cpp
+SOURCE      scpsipconnection.cpp
+SOURCE      scputility.cpp
+SOURCE      scpsettinghandler.cpp
+SOURCE      scpvoiphandler.cpp
+SOURCE      scpvmbxhandler.cpp
+SOURCE      scppresencehandler.cpp
+SOURCE      scpservicestorage.cpp
+SOURCE      scpservice.cpp
+SOURCE      scpsubservice.cpp
+SOURCE      scpsubservicestate.cpp
+SOURCE      scpdisabled.cpp
+SOURCE      scpconnectingservice.cpp
+SOURCE      scpenabled.cpp
+SOURCE      scpdisconnecting.cpp
+SOURCE      scpstatecontainer.cpp
+SOURCE      scppropertynotifier.cpp
+SOURCE      scpimhandler.cpp
+
+START RESOURCE  ../data/1027545B.rss
+#ifdef SYMBIAN_SECURE_ECOM 
+TARGET      sipconnectionprovider.rsc                                                              
+#endif
+END
+
+// INCLUDE
+USERINCLUDE	../inc
+USERINCLUDE ../../inc
+USERINCLUDE ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /epoc32/include/ecom
+
+// LIBRARY
+LIBRARY     euser.lib	
+LIBRARY     sipclient.lib
+LIBRARY     sipprofilecli.lib
+LIBRARY     connmon.lib
+LIBRARY     ecom.lib
+LIBRARY     rcse.lib  
+LIBRARY     serviceprovidersettings.lib
+LIBRARY     flogger.lib
+LIBRARY     commdb.lib
+LIBRARY     presencesettingsapi.lib 
+LIBRARY     voipeventlog.lib
+LIBRARY     ipapputils.lib 
+LIBRARY     xdmsettingsapi.lib 
+LIBRARY     ipvoicemailengine.lib
+LIBRARY     bafl.lib
+LIBRARY     inetprotutil.lib
+LIBRARY     cmmanager.lib
+
+// access to uiservicetabsettings
+LIBRARY         vimpstsettings.lib
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = UDEB RDebug
+*   2 = UDEB Flogger
+*   3 = UDEB RDebug & Flogger
+*
+* For file logging make sure that directory C:/logs/scp exists
+***************************/ 
+
+MACRO SCP_LOGGING_1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpalrobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,74 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef M_SCPALROBSERVER_H
+#define M_SCPALROBSERVER_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+/**
+ *  MScpSipAlrObserver declaration.
+ *  @lib sipconnectionprovider.dll
+ */
+class MScpSipAlrObserver
+    {
+public:
+
+    /** 
+     * Enumeration for ALR events 
+     */
+    enum TScpAlrEvent
+        {
+        /** 
+         * A new IAP became available.
+         * When receiving this event the client must call 
+         * CSipProfileAlrController::AllowMigrationL or DisallowMigrationL.
+         */           
+        EScpIapAvailable = 0,
+        /** 
+         * All the clients have allowed the migration to the new IAP and
+         * the migration to the new IAP for the SIP profile has started. 
+         */
+        EScpMigrationStarted,
+        /** 
+         * Migration to a new IAP for a SIP profile has been completed and
+         * the related SIP profile has been registered via the new IAP.
+         */
+        EScpMigrationCompleted
+        };
+            
+    /** 
+     * ALR event occured.
+     * @param aEvent New ALR event.
+     * @param aProfileId SIP profile id
+     * @param aSnapId Snap id
+     * @param aIapId Iap id
+     */             
+    virtual void HandleAlrEvent( TScpAlrEvent aEvent,
+                                 TUint32 aProfileId,
+                                 TUint32 aSnapId,
+                                 TUint32 aIapId ) = 0;
+
+private:
+    
+    };
+
+#endif // M_SCPALROBSERVER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpconnectingservice.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,121 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef T_SCPCONNECTINSERVICE_H
+#define T_SCPCONNECTINSERVICE_H
+
+#include <e32base.h>
+
+#include "scpsubservicestate.h"
+
+/**
+*  Connecting Service state
+*
+*  @lib sipconnectionprovider.dll
+*/
+class TScpConnectingService : public TScpSubServiceState
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     */
+    TScpConnectingService();
+
+    /**
+     * Returns state
+     * @return State
+     */
+    TCCHSubserviceState State() const;
+
+    /**
+     * Enable
+     * @param aSubService Sub service
+     */
+    void EnableL( CScpSubService& aSubService ) const;
+
+    /**
+     * Disable
+     * @param aSubService Sub service
+     */
+    TInt Disable( CScpSubService& aSubService ) const;
+
+    /**
+     * Network lost
+     * @param aSubService Sub service
+     */
+    void NetworkLost( CScpSubService& aSubService ) const;
+
+    /**
+     * Network not found
+     * @param aSubService Sub service
+     */
+    void NetworkNotFound( CScpSubService& aSubService ) const;
+
+    /**
+     * Service connection failed
+     * @param aSubService Sub service
+     */
+    void ServiceConnectionFailed( CScpSubService& aSubService ) const;
+
+    /**
+     * Service connected
+     * @param aSubService Sub service
+     */
+    void ServiceConnected( CScpSubService& aSubService ) const;
+
+    /**
+     * Service disconnected
+     * @param aSubService Sub service
+     */
+    void ServiceDisconnected( CScpSubService& aSubService ) const;
+
+    /**
+     * Bandwidth limited
+     * @param aSubService Sub service
+     */
+    void BandwidthLimited( CScpSubService& aSubService ) const;
+
+    /**
+     * Bandwidth limited
+     * @param aSubService Sub service
+     */
+    void AuthenticationFailed( CScpSubService& aSubService ) const;
+
+    /**
+     * Service connection failed
+     * @param aSubService Sub service
+     */
+    void ServiceInvalidSettings( CScpSubService& aSubService ) const;
+    
+    /**
+     * Service connection canceled
+     * @param aSubService Sub service
+     */
+    void ServiceConnectionCanceled( CScpSubService& aSubService ) const;
+    
+    /**
+     * Bearer is not supported
+     * @param aSubService Sub service
+     */
+    void BearerNotSupported( CScpSubService& aSubService ) const;
+    };
+
+#endif      // T_SCPCONNECTINSERVICE_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpdefs.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef T_SCPDEFS_H
+#define T_SCPDEFS_H
+
+#include <e32std.h>
+
+enum TScpConnectionEvent
+    {
+    EScpUnknown = 0,
+    EScpNetworkFound,           // = CSIPConnection::ConnectionEvent(EActive)
+    EScpNetworkLost,            // = CSIPConnection::ConnectionEvent(EInactive)
+    EScpNetworkNotFound,        // = CSIPConnection::ConnectionEvent(EUnavailable)
+    EScpRegistered,             // = CSIPProfileRegistry::EventOccurred(ERegistered)
+    EScpDeregistered,           // = CSIPProfileRegistry::EventOccurred(EDeregistered)
+    EScpRegistrationFailed,     // = CSIPProfileRegistry::ErrorOccurred(-34)
+    EScpInvalidSettings,        // = CSIPProfileRegistry::ErrorOccurred(-6)
+    EScpAuthenticationFailed,   // = KErrSIPForbidden
+    EScpRoaming,                // = MSipProfileAlrObserver::EMigrationStarted
+    EScpRegistrationCanceled,   // = CSIPProfileRegistry::ErrorOccurred(-3)
+    EScpRegistrationPending     // = XIMP Bind / VMBX Subscribe(-11)
+    };
+
+enum TScpIapType
+    {
+    EScpUnknownType = 0,
+    EScpGprs,
+    EScpWlan
+    };
+
+enum TScpAccessPointType
+    {
+    EScpUnknownAccessPointType = 0,
+    EScpIap,
+    EScpSnap
+    };
+
+#endif // T_SCPDEFS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpdisabled.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef T_SCPDISABLED_H
+#define T_SCPDISABLED_H
+
+#include <e32base.h>
+
+#include "scpsubservicestate.h"
+
+/**
+*  Disabled state
+*
+*  @lib sipconnectionprovider.dll
+*/
+class TScpDisabled : public TScpSubServiceState
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     */
+    TScpDisabled();
+
+    /**
+     * Returns state
+     * @return State
+     */
+    TCCHSubserviceState State() const;
+
+    /**
+     * Enable
+     * @param aSubService Sub service
+     */
+    void EnableL( CScpSubService& aSubService ) const;
+
+    /**
+     * Enable
+     * @param aSubService Sub service
+     */
+    void NetworkFound( CScpSubService& aSubService ) const;
+
+    /**
+     * Network not found
+     * @param aSubService Sub service
+     */
+    void NetworkNotFound( CScpSubService& aSubService ) const;
+
+    /**
+     * Network lost
+     * @param aSubService Sub service
+     */
+    void NetworkLost( CScpSubService& aSubService ) const;
+
+    /**
+     * Service connected
+     * @param aSubService Sub service
+     */
+    void ServiceConnected( CScpSubService& aSubService ) const;
+    };
+
+#endif      // T_SCPDISABLED_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpdisconnecting.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,66 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef T_SCPDISCONNECTING_H
+#define T_SCPDISCONNECTING_H
+
+#include <e32base.h>
+
+#include "scpsubservicestate.h"
+
+/**
+*  Disconnecting state
+*
+*  @lib sipconnectionprovider.dll
+*/
+class TScpDisconnecting : public TScpSubServiceState
+    {
+public:
+    /**
+     * C++ default constructor.
+     */
+    TScpDisconnecting();
+
+    /**
+     * Returns state
+     * @return State
+     */
+    TCCHSubserviceState State() const;
+
+    /**
+     * Disable
+     * @param aSubService Sub service
+     */
+    TInt Disable( CScpSubService& aSubService ) const;
+
+    /**
+     * Service disconnected
+     * @param aSubService Sub service
+     */
+    void ServiceDisconnected( CScpSubService& aSubService ) const;
+
+    /**
+     * Network lost
+     * @param aSubService Sub service
+     */
+    void NetworkLost( CScpSubService& aSubService ) const;
+    };
+
+#endif      // T_SCPDISCONNECTING_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpenabled.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,90 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef T_SCPENABLED_H
+#define T_SCPENABLED_H
+
+#include <e32base.h>
+
+#include "scpsubservicestate.h"
+
+/**
+*  Enabled state
+*
+*  @lib sipconnectionprovider.dll
+*/
+class TScpEnabled : public TScpSubServiceState
+    {
+public:
+    /**
+     * C++ default constructor.
+     */
+    TScpEnabled();
+
+    /**
+     * Returns state
+     * @return State
+     */
+    TCCHSubserviceState State() const;
+
+    /**
+     * Disable
+     * @param aSubService Sub service
+     */
+    TInt Disable( CScpSubService& aSubService ) const;
+
+    /**
+     * Network lost
+     * @param aSubService Sub service
+     */
+    void NetworkLost( CScpSubService& aSubService ) const;
+
+    /**
+     * Service connected
+     * @param aSubService Sub service
+     */
+    void ServiceConnected( CScpSubService& aSubService ) const;
+
+    /**
+     * Service connection failed
+     * @param aSubService Sub service
+     */
+    void ServiceConnectionFailed( CScpSubService& aSubService ) const;
+
+    /**
+     * Service disconnected
+     * @param aSubService Sub service
+     */
+    void ServiceDisconnected( CScpSubService& aSubService ) const;
+
+    /**
+     * Bandwidth limited
+     * @param aSubService Sub service
+     */
+    void BandwidthLimited( CScpSubService& aSubService ) const;
+    
+    /**
+     * Roaming ongoing
+     * @param aSubService Sub service
+     */
+    void Roaming( CScpSubService& aSubService ) const;
+    };
+
+#endif      // T_SCPENABLED_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpimhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,130 @@
+/*
+* 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: SCP IM Handler
+*
+*/
+
+
+#ifndef C_SCPIMHANDLER_H
+#define C_SCPIMHANDLER_H
+
+
+#include "scpservicehandlerbase.h"
+
+class CSipClientResolverUtils;
+
+
+/**
+ *  Class for handling IM sub service.
+ *
+ *  @code
+ *   CScpSubService* imSubService = CScpSubService::NewL( newId,
+ *       ServiceId(), ECCHIMSub, *service );
+ *   CScpServiceHandlerBase* imSubServiceHandler = CScpImHandler::NewL(
+ *       *imSubService );
+ *   imSubServiceHandler->EnableSubServiceL();
+ *  @endcode
+ *
+ *  @lib sipconnectionprovider.dll
+ *  @since S60 v5.1
+ */
+class CScpImHandler : public CScpServiceHandlerBase
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aSubService sub service
+     */
+    static CScpImHandler* NewL( CScpSubService& aSubService );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CScpImHandler();
+
+// from base class CScpServiceHandlerBase
+
+    /**
+     * From CScpServiceHandlerBase
+     * Defined in a base class
+     */
+    void EnableSubServiceL();
+
+    /**
+     * From CScpServiceHandlerBase
+     * Defined in a base class
+     */
+    TInt DisableSubService();
+            
+    /**
+     * From CScpServiceHandlerBase
+     * Defined in a base class
+     */
+    TCCHSubserviceType SubServiceType() const;
+    
+    /**
+     * From CScpServiceHandlerBase
+     * Defined in a base class
+     */
+    void HandleSipConnectionEvent( const TUint32 aProfileId,
+        TScpConnectionEvent aSipEvent );
+
+private:
+
+    CScpImHandler( CScpSubService& aSubService );
+
+    void ConstructL();
+
+    /**
+     * Handle SIP connection event.
+     *
+     * @since S60 v5.1
+     * @param aProfileId SIP profile ID
+     * @param aSipEvent  connection event
+     */
+    void HandleSipConnectionEventL( const TUint32 aProfileId,
+        TScpConnectionEvent aSipEvent );
+
+    /**
+     * Find SIP profile contact header user name for the given sub service.
+     * 
+     * @since S60 v5.1
+     * @param aContactHeader found user name is inserted here
+     */
+    void GetSipProfileContactHeaderUserL( RBuf8& aContactHeader ) const;
+
+    /**
+     * Remove the the routing used for SIP profile's contact header 
+     * from SIP Client routing table.
+     *
+     * @since S60 v5.1
+     */
+    void DeregisterContactHeaderL();
+
+private: // data
+
+    /**
+     * SIP Client Resolver
+     * Own.
+     */
+    CSipClientResolverUtils* iSipClientResolver;
+
+#ifdef _DEBUG
+    friend class T_CScpImHandler;
+#endif
+    };
+
+#endif // C_SCPIMHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scplogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,115 @@
+/*
+* 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 macros for logging
+*
+*/
+
+
+#ifndef __SCPLOGGER_H__
+#define __SCPLOGGER_H__
+
+#define SCP_TP_PRINT(s) L##s
+#define SCP_STRA_PRINT(s) SCP_TP_PRINT(s)
+#define SCP_STR_PRINT(t) SCP_STRA_PRINT("[SCP]") L##t
+#define SCP_LIT_PRINT(s) TPtrC((const TText *) SCP_STR_PRINT(s))
+#define SCP_LIT_CONVERT(s) TPtrC((const TText *)(s))
+
+//-----------------------------------------------------------------------------
+//  LOGGING MACROs 
+//-----------------------------------------------------------------------------
+
+// Logging method is defined in the mmp file
+
+#ifdef SCP_LOGGING_0
+
+    #define SCPLOGSTRING(a)           
+    #define SCPLOGSTRING2(a,b)     
+    #define SCPLOGSTRING3(a,b,c)    
+    #define SCPLOGSTRING4(a,b,c,d)
+    #define SCPLOGSTRING5(a,b,c,d,e) 
+
+#endif
+
+#ifdef SCP_LOGGING_1
+    #ifdef _DEBUG
+        #include <e32def.h> 
+        #include <e32svr.h>   
+        #define SCPLOGSTRING(a)          { RDebug::Print(SCP_LIT_PRINT(a)); } 
+        #define SCPLOGSTRING2(a,b)       { RDebug::Print(SCP_LIT_PRINT(a),b); } 
+        #define SCPLOGSTRING3(a,b,c)     { RDebug::Print(SCP_LIT_PRINT(a),b,c); } 
+        #define SCPLOGSTRING4(a,b,c,d)   { RDebug::Print(SCP_LIT_PRINT(a),b,c,d); }  
+        #define SCPLOGSTRING5(a,b,c,d,e) { RDebug::Print(SCP_LIT_PRINT(a),b,c,d,e); }     
+    #else
+        #define SCPLOGSTRING(a)           
+        #define SCPLOGSTRING2(a,b)     
+        #define SCPLOGSTRING3(a,b,c)    
+        #define SCPLOGSTRING4(a,b,c,d) 
+        #define SCPLOGSTRING5(a,b,c,d,e) 
+    #endif
+#endif
+
+#ifdef SCP_LOGGING_2
+    #ifdef _DEBUG
+        #define SCPLOGSTRING(a) { ScpDebugWriteFormat(SCP_LIT_PRINT(a)); } 
+        #define SCPLOGSTRING2(a,b) { ScpDebugWriteFormat(SCP_LIT_PRINT(a),b); } 
+        #define SCPLOGSTRING3(a,b,c) { ScpDebugWriteFormat(SCP_LIT_PRINT(a),b,c); }    
+        #define SCPLOGSTRING4(a,b,c,d) { ScpDebugWriteFormat(SCP_LIT_PRINT(a),b,c,d); };
+        #define SCPLOGSTRING5(a,b,c,d,e) { ScpDebugWriteFormat(SCP_LIT_PRINT(a),b,c,d,e); };     
+    #else
+        #define SCPLOGSTRING(a)           
+        #define SCPLOGSTRING2(a,b)     
+        #define SCPLOGSTRING3(a,b,c)    
+        #define SCPLOGSTRING4(a,b,c,d) 
+        #define SCPLOGSTRING5(a,b,c,d,e) 
+    #endif
+#endif
+
+#ifdef SCP_LOGGING_3 
+    #ifdef _DEBUG   
+        #include <e32def.h> 
+        #include <e32svr.h>   
+        #define SCPLOGSTRING(a)          { RDebug::Print(SCP_LIT_PRINT(a));\
+                                           ScpDebugWriteFormat(SCP_LIT_PRINT(a)); } 
+        #define SCPLOGSTRING2(a,b)       { RDebug::Print(SCP_LIT_PRINT(a),b);\
+                                           ScpDebugWriteFormat(SCP_LIT_PRINT(a),b); } 
+        #define SCPLOGSTRING3(a,b,c)     { RDebug::Print(SCP_LIT_PRINT(a),b,c);\
+                                           ScpDebugWriteFormat(SCP_LIT_PRINT(a),b,c); } 
+        #define SCPLOGSTRING4(a,b,c,d)   { RDebug::Print(SCP_LIT_PRINT(a),b,c,d);\
+                                           ScpDebugWriteFormat(SCP_LIT_PRINT(a),b,c,d); }  
+        #define SCPLOGSTRING5(a,b,c,d,e) { RDebug::Print(SCP_LIT_PRINT(a),b,c,d,e);\
+                                           ScpDebugWriteFormat(SCP_LIT_PRINT(a),b,c,d,e); }     
+    #else
+        #define SCPLOGSTRING(a)           
+        #define SCPLOGSTRING2(a,b)     
+        #define SCPLOGSTRING3(a,b,c)    
+        #define SCPLOGSTRING4(a,b,c,d)
+        #define SCPLOGSTRING5(a,b,c,d,e) 
+    #endif     
+#endif
+
+#include <flogger.h>
+
+inline void ScpDebugWriteFormat(TRefByValue<const TDesC> aFmt,...) //lint !e960
+    {
+    _LIT(KDir, "scp"); //lint !e1534
+    _LIT(KName, "scp.log"); //lint !e1534
+
+    // take the ellipsis parameters
+    VA_LIST args;
+    VA_START(args,aFmt); //lint !e960
+    RFileLogger::WriteFormat(KDir, KName, EFileLoggingModeAppend, aFmt, args);
+    VA_END(args); //lint !e960
+    }
+
+#endif  // __SCPLOGGER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpplugin.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,223 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_SCPPLUGIN_H
+#define C_SCPPLUGIN_H
+
+#include <cchservice.h>
+
+class CScpServiceManager;
+
+/**
+*  CScpPlugin class
+*  @lib sipconnectionprovider.dll
+*/
+class CScpPlugin : public CCchService
+    {
+    
+public:	// Constructors and destructor
+
+    /**
+    * Two-phased constructor
+    */
+    static CScpPlugin* NewL( TAny* aParam );  
+
+    /**
+    * Destructor.
+    */
+    virtual ~CScpPlugin();
+    
+// from base class CCHService
+    
+    /**
+     * Client enables service. CCHService implementation
+     * should use MCCHServiceObserver for service state notifications.
+     * @see MCCHServiceObserver
+     * @param aServiceSelection Service selection
+     */
+    void EnableServiceL( const TServiceSelection& aServiceSelection );
+                                 
+    /**
+     * Client enables service. CCHService implementation
+     * should use MCCHServiceObserver for service state notifications.
+     * @see MCCHServiceObserver
+     * @param aServiceSelection Service selection
+     * @param aIapId Iap id
+     */
+    void EnableServiceL( const TServiceSelection& aServiceSelection,
+                         TUint aIapId );
+    
+    /**
+     * Client disables service. 
+     * @param aServiceId
+     */
+    void DisableServiceL( const TServiceSelection& aServiceSelection );
+    
+    /**
+     * Client checks is the service available by the IAP id array.
+     * CCHService implementation should return ETrue if service is
+     * registrable by the (some) IAP, array contains. 
+     * @param aServiceSelection Service selection
+     * @param aIapIdArray Id array of the currently available iaps.
+     * @return ETrue if service is available.
+     */
+    TBool IsAvailableL( const TServiceSelection& aServiceSelection,
+                        const RArray<TUint32>& aIapIdArray ) const;
+    
+    /**
+     * Get service state information.
+     * @param aServiceSelection Service selection
+     * @param aState Current service state.
+     * @return General symbian error code.
+     */
+    TInt GetServiceState( const TServiceSelection& aServiceSelection, 
+                          TCCHSubserviceState& aState ) const;
+    
+    /**
+     * Get service network information.
+     * @param aConnectionInfo Connection info
+     * @return General symbian error code.
+     */
+    TInt GetServiceNetworkInfo( TServiceConnectionInfo& aConnectionInfo ) const;
+                                        
+    /**
+     * Set Snap id for service.
+     * @param aServiceSelection Service selection
+     * @return General symbian error code.
+     */
+    TInt SetSnapId( const TServiceSelection& aServiceSelection,
+                    TUint aSnapId );
+                    
+    /**
+     * Set IAP id for service.
+     * @param aServiceSelection Service selection
+     * @param aIapId 
+     * @return General symbian error code.
+     */
+    TInt SetIapId( const TServiceSelection& aServiceSelection,
+                   TUint aIapId );                               
+    
+    /**
+     * Get service specifics information about service and protocol
+     * @param aServiceSelection Service selection
+     * @param aBuffer Info will be inserted to this buffer  
+     */
+    void  GetServiceInfoL( const TServiceSelection& aServiceSelection,
+                           RBuf& aBuffer ) const;
+
+    /**
+     * Reserves the service for exclusive use
+     * @param aServiceSelection Selected service, ID and type
+     * @return General symbian error code.
+     */
+    TInt ReserveService( const TServiceSelection& aServiceSelection );
+
+    /**
+     * Frees the exclusive service reservation
+     * @param aServiceSelection Selected service, ID and type
+     * @return General symbian error code.
+     */
+    TInt FreeService( const TServiceSelection& aServiceSelection );
+    
+    /**
+     * Is the service reserved
+     * @param aServiceSelection Selected service, ID and type
+     * @return TBool 
+     */
+    TBool IsReserved( const TServiceSelection& aServiceSelection ) const;
+
+    /**
+     * Returns the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    TInt GetConnectionParameter( const TServiceSelection& aServiceSelection,
+                                 TCchConnectionParameter aParameter,
+                                 TInt& aValue ) const;
+    
+    /**
+     * Returns the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    TInt GetConnectionParameter( const TServiceSelection& aServiceSelection, 
+                                 TCchConnectionParameter aParameter,
+                                 RBuf& aValue ) const;
+    
+    /**
+     * Sets the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    TInt SetConnectionParameter( const TServiceSelection& aServiceSelection, 
+                                 TCchConnectionParameter aParameter,
+                                 TInt aValue );
+    
+    /**
+     * Sets the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @return Symbian error code
+     */
+    virtual TInt SetConnectionParameter( 
+                         const TServiceSelection& aServiceSelection, 
+                         TCchConnectionParameter aParameter,
+                         const TDesC& aValue );
+    
+    
+private:
+
+    /**
+     * Constructor is hidden
+     */
+    CScpPlugin( MCchServiceObserver& aServiceObserver );
+
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+
+private:
+
+    /**
+     * Service manager. Own
+     */
+    CScpServiceManager* iServiceManager;
+    
+    /**
+     * CCH service observer.
+     */ 
+    MCchServiceObserver& iServiceObserver;
+   
+	};	
+
+#endif  // C_SCPPLUGIN_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scppresencehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,300 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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_CSCPPRESENCEHANDLER_H
+#define C_CSCPPRESENCEHANDLER_H
+
+#include <e32base.h>
+#include <ximpbase.h>
+#include <ximpcontextobserver.h>
+#include <ximpcontextstate.h>
+#include <spdefinitions.h>
+
+#include "scpservicehandlerbase.h"
+#include "scpsubserviceobserver.h"
+
+class CScpSubService;
+class CScpSubService;
+class CScpServiceStorage;
+class MPresenceInfo; 
+class MXIMPContext;
+class MXIMPClient;
+class MPresenceFeatures;
+class TScpReqId;
+
+/**
+*  Presence sub service handler.
+*
+*  @lib sipconnectionprovider.dll
+*/
+class CScpPresenceHandler : public CScpServiceHandlerBase,
+                            public MXIMPContextObserver,
+                            public MScpSubServiceObserver
+                            
+    {
+    
+public:
+    /**
+     * Enumeration for presence states
+     */
+    enum TScpPresenceState
+        {
+        EBinding = 0,
+        EBindComplete,      /* Bind complete, publish not yet requested */
+        EPublishing,        
+        ESubscribing,       
+        EPresenceOnline,    /* Bind, publish and subscribe complete -> presence online */
+        EPresenceOffline,   /* Bind complete, presence offline */
+        EUnBinding,
+        ENoBind
+        };
+
+public:
+     
+    /**
+     * Two-phased constructor
+     * @param aSubService The presence subservice
+     */
+    static CScpPresenceHandler* NewL( CScpSubService& aSubService );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CScpPresenceHandler();
+    
+    /**
+     * Update XDM settings access point.
+     * XDM AP should be the same as SIP profile.
+     */    
+    void UpdateXdmSettingsL();
+    
+public: // From CScpServiceHandlerBase
+    
+    /**
+     * Enables service.
+     */
+    void EnableSubServiceL();
+
+    /**
+     * Disables service.
+     * @return Symbian error code
+     */
+    TInt DisableSubService();
+            
+    /**
+     * Returns type of sub service (VoIP, Vmbx, Presence).
+     * @return Type of the sub service.
+     */
+    TCCHSubserviceType SubServiceType() const;
+    
+    /**
+     * Handles sip connection event
+     * @param aProfileId Sip profile id
+     * @param aSipEvent Connection event
+     */
+    void HandleSipConnectionEvent( const TUint32 aProfileId,
+                                   TScpConnectionEvent aSipEvent );
+    
+    /**
+     * Query is starting to ALR allowed.
+     * Client can start ALR later if needed to do something first
+     * 
+     * @return ETrue if allowed.
+     */
+    TBool IsSipProfileAllowedToStartAlr();
+    
+public: // From MScpSubServiceObserver
+    /**
+     * Handle SubService state change.
+     * This function is for observing VoIP subservice.
+     * If VoIP subservice connection is not OK, 
+     * set presence state to offline.
+     * @param aState subservice connection state
+     * @param aError is the error of the service
+     */    
+    void HandleSubServiceChange( TCCHSubserviceState aState, TInt aError );    
+
+
+public: // From MXIMPContextObserver                        
+
+    /**
+     * Handles presence context events.
+     * @param aContext
+     * @param aEvent Event
+     */                             
+    void HandlePresenceContextEvent( const MXIMPContext& aContext,
+                                     const MXIMPBase& aEvent );
+
+private:
+    
+    /**
+     * C++ default constructor.
+     * @param aSubService The presence subservice
+     */
+    CScpPresenceHandler( CScpSubService& aSubService );
+    
+    /**
+     * Symbian second phase constructor.
+     */
+    void ConstructL();
+    
+    /**
+     * Binds SCP's presence context.
+     */                                 
+    void ServerBindL();
+    
+    /**
+     * Unbinds SCP's presence context.
+     */
+    void ServerUnBindL();
+    
+    /**
+     * Stops publishing according to parameter and unbinds the presence
+     * context. Leaves, if there are ongoing requests and publish offline
+     * is not called.
+     * @param aDoStopPublish if ETrue, users own presence status is 
+     *  removed from presence server before unbinding the context
+     */                             
+    void HandleDeregistrationL( TBool aDoStopPublish );
+    
+    /**
+     * Publishes presence according to given parameter.
+     * @param aPublishOnline If ETrue, publish Online, if EFalse,
+     *  publish Offline
+     */
+    void PublishPresenceL( TBool aPublishOnline );
+    
+    /**
+     * Creates presence info item
+     * @param aState presence state
+     * @return The created presence info pointer
+     */      
+    MPresenceInfo* CreateInfoLC( TBool aState );
+
+    /**
+     * Changes service state to deregistered. If user requested
+     * disabling the service, also profile deregistration is done.
+     */                             
+    void DeregisterNow();
+
+    /**
+     * Get property id.
+     * @param aProperty, presence service property name
+     * @param aValue, the id as a result of the query
+     */
+    void GetPresencePropertyIdL( TServicePropertyName aProperty, TInt& aValue ) const;
+
+    /**
+     * Force service disable
+     * @param aSelf This object
+     * @return 1
+     */    
+    static TInt ForcePresenceServiceDisable( TAny* aSelf );
+    
+    /**
+     * Find VoIP subservice pointer
+     * @return VoIP subservice pointer
+     */
+    CScpSubService* GetVoipSubService();
+    
+    /**
+     * Handles the XIMP context state events.
+     * @param   aEvent The XIMP event to handle
+     */
+    void HandleContextStateEvent( const MXIMPBase& aEvent );
+    
+    /**
+     * Handles the XIMP request complete events
+     * @param   aEvent The XIMP event to handle
+     */
+    void HandleRequestCompleteEvent( const MXIMPBase& aEvent );
+    
+    /**
+     * Handles the Bind complete event
+     */
+    void HandleBindCompleteEvent();
+    
+    /**
+     * Subscribe presentity group
+     */
+    void SubscribePresentityGroupL();
+    
+    /**
+     * Unsubscribe presentity group
+     */
+    void UnsubscribePresentityGroupL();
+     
+    /**
+     * Gets stored presence values if available
+     * @param aAvailabilityEnum Holds stored availability value
+     * @param aCustomMessage Holds stored custom message 
+     */
+    void GetStoredPresenceValuesL( TInt& aAvailabilityEnum, RBuf& aCustomMessage );
+    
+private: // data
+    
+    MXIMPClient* iPresClient;
+    MXIMPContext* iPresenceCtx;
+    MPresenceFeatures* iFeature;
+    
+    /**
+     * Id for presence settings
+     */
+    TInt iPresenceSettingsId;
+
+    /**
+     * Tells the state of presence handler
+     */
+    TScpPresenceState iPresenceState;
+    
+    /**
+     * Array for storing requests
+     */
+    RArray< TScpReqId > iReqIdArray;
+    
+    /**
+     * Indicates do we have to make rebind
+     */
+    TBool iRebind;
+
+    /**
+     * Holds the last ximp error
+     */
+    TInt iLastXimpError;
+    
+    /**
+     * Flag for indicating if service disabling should be done
+     * after all Ximp requests are completed.
+     */
+    TBool iDisableAfterXimpRequestsCompleted;
+    
+    /**
+     * Flag for indicating if network is lost and roaming is
+     * concluded to be ongoing
+     */
+    TBool iNetworkLostRoamingOngoing;
+    
+#ifdef _DEBUG
+    friend class T_CScpPresenceHandler;
+#endif
+
+    };
+
+#endif      // C_CSCPPRESENCEHANDLER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scppresencehandlerrequest.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,60 @@
+/*
+* 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:  Defines presencehandler's request ids and types
+*
+*/
+
+
+#ifndef SCPPRESENCEHANDLERREQUEST_H_
+#define SCPPRESENCEHANDLERREQUEST_H_
+
+// INCLUDES
+#include <ximpbase.h>
+
+/**
+ * Enumeration for request types.
+ */
+enum TScpReqType
+        {
+        EUnknownReq = 0,
+        EBindReq ,
+        EUnBindReq,
+        EPublishOfflineReq,
+        EPublishOnlineReq,
+        ESubscribeReq
+        };
+
+        
+/**
+ * Class for defining presence handler request id and type
+ */
+class TScpReqId
+    {
+public:
+    inline TScpReqId();
+    inline TScpReqId( const TXIMPRequestId& aId,
+                   TScpReqType aType );
+    inline void SetId( const TXIMPRequestId& aId );
+    inline void SetType( TScpReqType aType );
+    inline const TXIMPRequestId& ReqId() const;
+    inline TScpReqType Type() const;
+private:
+    TXIMPRequestId iReqId;
+    TScpReqType iType;
+    };
+    
+#include "scppresencehandlerrequest.inl"
+    
+
+#endif /*SCPPRESENCEHANDLERREQUEST_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scppresencehandlerrequest.inl	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,75 @@
+/*
+* 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:  Inline functions
+*
+*/
+
+
+// --------------------------------------------------------------------------
+// TScpReqId::TScpReqId
+// --------------------------------------------------------------------------
+//
+inline TScpReqId::TScpReqId() :
+    iType( EUnknownReq )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// TScpReqId::TScpReqId
+// --------------------------------------------------------------------------
+//
+inline TScpReqId::TScpReqId( const TXIMPRequestId& aId, TScpReqType aType ) :
+    iReqId( aId ),
+    iType( aType )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// TScpReqId::SetId
+// --------------------------------------------------------------------------
+//
+inline void TScpReqId::SetId( const TXIMPRequestId& aId )
+    {
+    iReqId = aId;
+    }
+
+// --------------------------------------------------------------------------
+// TScpReqId::SetType
+// --------------------------------------------------------------------------
+//
+inline void TScpReqId::SetType( TScpReqType aType )
+    {
+    iType = aType;
+    }
+
+
+// --------------------------------------------------------------------------
+// TScpReqId::ReqId
+// --------------------------------------------------------------------------
+//
+inline const TXIMPRequestId& TScpReqId::ReqId()const
+    {
+    return iReqId;
+    }
+
+// --------------------------------------------------------------------------
+// TScpReqId::Type
+// --------------------------------------------------------------------------
+//
+inline TScpReqType TScpReqId::Type() const
+    {
+    return iType;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpprofilehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,393 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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_SCPPPROFILEHANDLER_H
+#define C_SCPPPROFILEHANDLER_H
+
+#include <sipprofileregistryobserver.h>
+#include <sipconnectionobserver.h>
+#include <sipobserver.h>
+#include <sipprofilealrobserver.h>
+
+#include "scpsipconnectionobserver.h"
+#include "scpalrobserver.h"
+#include "scpdefs.h"
+#include "scpsipconnection.h"
+#include "scpalrobserver.h"
+
+class CSIP;
+class CSIPProfileRegistry;
+class CSIPManagedProfileRegistry;
+class CSIPManagedProfile;
+class CSipProfileAlrController;
+class CScpSipConnection;
+class MIpVmbxObserver;
+class CIpVmbxInterface;
+
+/**
+ *  Register/unregister protocol profiles.
+ *
+ *  @lib sipconnectionprovider.dll
+ *  @since Series 60 3.2
+ */
+class CScpProfileHandler : public CBase,
+                           public MSIPProfileRegistryObserver,
+                           public MSIPObserver,
+                           public MSipProfileAlrObserver,
+                           public MScpSipConnectionObserver
+    {
+public:
+
+    /**
+     * Enumeration for ALR events.
+     */
+    enum TAlrEvent
+        {
+        EScpAlrAllowMigration,
+        EScpAlrDisallowMigration,
+        EScpAlrRefresh
+        };
+    
+public:  // Constructors and destructor
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CScpProfileHandler* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CScpProfileHandler();
+
+public: 
+
+    /**
+     * Adds Sip profile observer.
+     * @param aObserver SIP profile observer.
+     */
+    void AddObserverL( MScpSipConnectionObserver& aObserver );   
+            
+    /**
+     * Remove observer from the array.
+     * @param aObserver SIP profile observer.
+     * @return KErrNone If succeed.
+     */
+    TInt RemoveObserver( MScpSipConnectionObserver& aObserver );   
+    
+    /**
+     * Get current state of scp connection having given sip profile id
+     * @param aProfileId SIP profile id.
+     * @param aState Current state.
+     * @return KErrNone if succeed.
+     */
+    TInt GetCurrentState( TUint32 aProfileId, 
+        CScpSipConnection::TConnectionState& aState,
+        TInt& aError ) const;    
+    
+    /**
+     * Register profile to SIP.
+     * @param aProfileId SIP Profile id to register.
+     * @return Symbian error codes.
+     */
+    void RegisterProfileL( TUint32 aProfileId );
+
+    /**
+     * UnRegister profile to SIP.
+     * @param aProfileId SIP Profile id to unregister.
+     * @return Symbian error codes.
+     */
+    TInt UnregisterProfile( TUint32 aProfileId );
+
+     /**
+     * Cancels any ongoing registration
+     * @param aProfileId SIP Profile id to unregister.
+     * @return Symbian error codes.
+     */
+    TInt CancelRegistration( TUint32 aProfileId );
+                                       
+    /**
+     * Return existence info of profile id.
+     * @param aProfileId Protocol profile id.
+     * @return ETrue if profile exist.
+     */
+    TBool ProfileExists( TUint32 aProfileId ) const;  
+    
+    /**
+     * Uses SIP ALR controller for ALR events.
+     * @param aProfileId  Profile id.
+     * @param aEvent      New ALR event.
+     * @param aIapId      IAP id.
+     */
+    void DoAlrEventL( TUint32 aProfileId,                      
+                      TAlrEvent aEvent,
+                      TUint32 aIapId = NULL );
+
+    /**
+     * Checks if sip connection for give profile id exists
+     * @param aProfileId Profile id.
+     * @return ETrue if exists
+     */
+    TBool SipConnectionExists( TUint32 aProfileId ) const;
+
+    /**
+     * Gets a asip connection for given profile id
+     * @param aProfileId Profile id.
+     * @return Sip connection. Ownership is not transferred.
+     */
+    CScpSipConnection* GetSipConnection( TUint32 aProfileId ) const;
+       
+    /**
+     * Creates a sip connection for given profile id
+     * @param aProfileId Profile id.
+     * @return Sip connection. Ownership is transferred.
+     */
+    CScpSipConnection* CreateSipConnectionL( TUint32 aProfileId ) const;  
+
+    /**
+     * Sets a sip profile reserved state
+     * @param aProfileId Sip profile id
+     * @param aReserved Reserved
+     */
+    void SetSipProfileReserved( TUint32 aProfileId, TBool aReserved );
+
+    /**
+     * Return VMBX service provider interface
+     * @param aObserver VMBX service provider observer
+     * @return Interface
+     */
+    CIpVmbxInterface& VmbxInterfaceL( MIpVmbxObserver& aObserver );
+    
+    /**
+     * Delete VMBX service provider interface, there is no other way to remove 
+     * MIpVmbxObserver. Observer has to remove when deleting vmbx subservice.
+     */
+    void DeleteVmbxInterface();
+    
+    /**
+     * Checks if a sip profile requires update
+     * @param aProfileId SIP profile ID
+     * @param aTerminalType indicates is terminal type defined
+     * @param aWlanMac indicates is wlan mac defined
+     * @param aStringLength length of free string
+     */    
+    void UpdateSipProfileL( TUint32 aProfileId, TBool aTerminalType,
+        TBool aWlanMac, TInt astringLength );
+ 
+    /**
+     * Set username and/or passowrd.
+     * @param aProfileId Profile id to use.
+     * @param aUsername to set
+     * @param aSetUsername If true, set username.
+     * @param aPassword Password to set.
+     * @param aSetPassword If true, set password.
+     * @@return none 
+     * @leave KErrArgument if passed values are incorrect, or other 
+     * symbian error code. 
+     */
+    void SetUsernameAndPasswordL( TUint32 aProfileId,
+                                  const TDesC8& aUsername,
+                                  TBool aSetUsername,
+                                  const TDesC8& aPassword,
+                                  TBool aSetPassword );
+    
+    /**
+     * Informs SIP to allow ALR migration
+	 *
+     * @param aProfileId SIP profile ID
+     */    
+    void StartAlrMigration( TUint32 aProfileId );
+    
+#ifdef _DEBUG
+    void GetDebugInfo( TDes& aInfo ) const;
+#endif                                          
+
+        
+private: // Functions from base classes
+
+    /**
+     * From MSIPObserver
+     * A SIP request has been received from the network.        
+     * @pre aTransaction != 0
+     * @param aIapId The IapId from which the SIP request was received.
+     * @param aTransaction contains local address, remote address of a SIP
+     *        message, as well as optional SIP message method, headers and
+     *        body. The ownership is transferred.
+     */
+    void IncomingRequest( TUint32 aIapId, CSIPServerTransaction* aTransaction );
+
+    /**
+     * From MSIPObserver
+     * The received SIP request time-outed and it is invalid i.e. cannot be used
+     * anymore.
+     * This will be called if the user fails to create a SIP connection
+     * and does not send an appropriate SIP response.
+     * @param aTransaction The time-outed transaction.
+     */
+    void TimedOut( CSIPServerTransaction& aTransaction );
+
+
+    /** 
+     * From MSIPProfileRegistryObserver
+     * An event related to SIP Profile has accorred
+     * @param aProfileId a profile Id
+     * @param aEvent an occurred event
+     */
+    void ProfileRegistryEventOccurred( TUint32 aProfileId,
+                                       MSIPProfileRegistryObserver::TEvent aEvent );
+
+    /**
+     * From MSIPProfileRegistryObserver
+     * An asynchronous error has occurred related to SIP profile
+     * Event is send to those observers, who have the
+     * corresponding profile instantiated.
+     * @param aProfileId the id of failed profile 
+     * @param aError an occurred error
+     */
+    void ProfileRegistryErrorOccurred( TUint32 aProfileId,
+                                       TInt aError );
+                                   
+    /**
+     * ALR related event occurred. See MSipProfileAlrObserver.
+     * @param aEvent the event that occurred
+     * @param aProfileId identifies the SIP profile related to the event
+     * @param aSnapId the SNAP related to the event
+     * @param aIapId the IAP related to the event
+     */
+    void AlrEvent( MSipProfileAlrObserver::TEvent aEvent,
+                   TUint32 aProfileId,
+                   TUint32 aSnapId,
+                   TUint32 aIapId );
+                           
+    /**
+     * ALR related error occurred. See MSipProfileAlrObserver.
+     * @param aError the error that occurred
+     * @param aProfileId identifies the SIP profile related to the error
+     * @param aSnapId the SNAP related to the event
+     * @param aIapId the IAP related to the error
+     */
+    void AlrError( TInt aError,
+                   TUint32 aProfileId,
+                   TUint32 aSnapId,
+                   TUint32 aIapId );
+
+    /**
+     * Sip profile state changed
+     * @param aProfileId Profile id.
+     * @param aSipEvent A new event of profile.
+     */  
+    void HandleSipConnectionEvent( TUint32 aProfileId,
+                                   TScpConnectionEvent aSipEvent );
+    
+    /**
+     * Query is starting to ALR allowed.
+     * Client can start ALR later if needed to do something first
+     * 
+     * @return ETrue if allowed.
+     */
+    TBool IsSipProfileAllowedToStartAlr();
+   
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CScpProfileHandler();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Removes a sip connection from iSipConnections
+     * @param aProfilId Sip profile id
+     * @return Symbian error codes
+     */
+    TInt RemoveSipConnection( TUint32 aProfileId );
+
+    /**
+     * Checks if sip profile is reserved by some service
+     * @param aProfileId Sip profile id
+     * @return ETrue if reserved
+     */
+    TBool IsSipProfileReserved( TUint32 aProfileId ) const;
+
+private:
+    
+    /**
+     * SIP instance. Own.
+     */
+    CSIP* iSip;
+    
+    /**
+     * SIP profile registry. Own.
+     */
+    CSIPProfileRegistry* iProfileRegistry;
+    
+    /**
+     * SIP managed profile registry. Own.
+     */
+    CSIPManagedProfileRegistry* iManagedProfileRegistry;
+    
+    /**
+     * SIP ALR controller. Own.
+     */
+    CSipProfileAlrController* iAlrController;
+
+    /**
+     * Sip connections.
+     */
+    RPointerArray< CScpSipConnection > iSipConnections;
+        
+    /**
+     * SIP profile observers.
+     */
+    RPointerArray< MScpSipConnectionObserver > iObservers;
+
+    /**
+     * VMBx service provider interface. Created once, when needed.
+     */
+    CIpVmbxInterface* iVmbxInterface;
+
+    /**
+	 * New IapId received in ALR event
+	 */
+    TUint iNewAlrIapId;
+    
+    /**
+     * Is ALR Migration Allowed To Start Immediately
+     */
+    TBool iAlrAllowedToStartImmediately;
+    
+// This need to be cleaned to separate macro/header
+#ifdef _DEBUG
+    friend class T_CScpServiceManager;
+    friend class T_CScpProfileHandler;
+    friend class T_CScpSipHelper;
+    friend class T_CScpVmbxHandler;
+    friend class T_CScpVoipHandler;
+    friend class T_CScpPresenceHandler;
+    friend class T_CScpSettingHandler;
+    friend class T_CScpImHandler;
+#endif
+    };
+
+#endif      // CSCPPPROFILEHANDLER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scppropertynotifier.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,126 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_CSCPPROPERTYNOTIFIER_H
+#define C_CSCPPROPERTYNOTIFIER_H
+
+#include <e32base.h>
+#include <e32property.h>
+
+class MScpPropertyObserver;
+
+/**
+*  Property notifier
+*
+*/
+class CScpPropertyNotifier : public CActive
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CScpPropertyNotifier* NewL( TUid aUid, 
+                                       TInt aType,
+                                       MScpPropertyObserver& aObserver  );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CScpPropertyNotifier();
+
+    /**
+     * Returns the property's value
+     * @param aValue Value
+     * @return Symbian error codes
+     */
+    TInt GetValue( TInt& aValue ) const;
+       
+// From CActive         
+private:
+
+    /**
+     * RunL
+     */
+    void RunL();
+    
+    /**
+     * Catches errors if RunL leaves
+     * @param aError error code
+     * @return error code
+     */
+    TInt RunError( TInt aError );
+    
+    /**
+     * Cancels the monitor
+     */
+    void DoCancel();  
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CScpPropertyNotifier( TUid aUid, 
+                          TInt aType, 
+                          MScpPropertyObserver& aObserver );
+    
+    /**
+     * ConstructL
+     */
+    void ConstructL();
+
+    /**
+     * Subscribes to property's notifications
+     */
+    void Subscribe();
+
+private:
+
+    /**
+     * UID of the property
+     */
+    TUid iUid;
+    
+    /**
+     * Property type
+     */
+    TInt iType; 
+
+    /**
+     * Property observer
+     */
+    MScpPropertyObserver& iObserver;
+
+    /**
+     * Property
+     */
+    RProperty iProperty;
+
+#ifdef _DEBUG
+
+friend class T_CScpPropertyNotifier;
+
+#endif
+
+    };
+
+
+#endif      // C_CSCPPROPERTYNOTIFIER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scppropertyobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef M_MSCPPROPERTYOBSERVER_H
+#define M_MSCPPROPERTYOBSERVER_H
+
+/**
+* MScpPropertyObserver
+*/
+class MScpPropertyObserver 
+    {
+public:
+ 
+    /**
+     * Reports about changed property
+     * @param aPropertyValue Value of the property 
+     */
+    virtual void HandlePropertyChanged( TInt aPropertyValue ) = 0; 
+
+    };
+
+#endif      // C_MSCPPROPERTYOBSERVER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpservice.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,267 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_SCPSERVICE_H
+#define C_SCPSERVICE_H
+
+#include <e32base.h>
+#include <cchservice.h>
+
+#include "scpdefs.h"
+
+/**
+ *  SCP service info.
+ *  @lib sipconnectionprovider.dll
+ */
+class CScpSubService;
+class CScpServiceStorage;
+class CScpProfileHandler;
+class CScpSipConnection;
+
+class CScpService : public CBase
+    {
+public:
+
+    /**
+     * Constructor
+     * @param aId Internal id
+     * @param aServiceId Service Id
+     */ 
+    static CScpService* NewL( TInt aId, 
+                              TInt aServiceId,
+                              CScpProfileHandler& aProfileHandler,
+                              CScpServiceStorage& aServiceStorage,
+                              MCchServiceObserver& aServiceObserver );
+    
+    /**
+     * Destructor
+     */ 
+    ~CScpService();
+
+    /**
+     * Returns internal id of this service
+     * @return Id
+     */ 
+    TInt Id() const;
+
+    /**
+     * Returns profile handler
+     */
+    CScpProfileHandler& ProfileHandler() const;
+
+    /**
+     * Returns service storage
+     */
+    CScpServiceStorage& ServiceStorage() const;
+
+    /**
+     * Returns service observer
+     */
+    MCchServiceObserver& ServiceObserver() const;
+
+    /**
+     * Adds a new subservice to the service and returns it
+     * @return New subservice
+     */ 
+    CScpSubService& AddSubServiceL( TCCHSubserviceType aSubServiceType );
+
+    /**
+     * Returns count of subservices for this service
+     * @returns Count of subservices
+     */ 
+    TInt SubServiceCount() const;
+
+    /**
+     * Fills all internal ids of the subservices within this service 
+     * to the given aray
+     * @param aIds Id array to be filled
+     */ 
+    void GetSubServiceIds( RArray<TInt>& aIds ) const;
+
+    /**
+     * Returns a subservice with the given id
+     * @param aId Internal id of the subservice 
+     */ 
+    CScpSubService* GetSubService( TInt aId ) const;
+
+    /**
+     * Removes a subservice from this service with given id
+     * @param aId Internal id of the subservice
+     * @return KErrNone if successfull
+     */ 
+    TInt RemoveSubService( TInt aId );
+
+    /**
+     * Returns service id of this service
+     * @return service id
+     */ 
+    TInt ServiceId() const;
+
+    /**
+     * Sets service id for this service
+     * @param aServiceId Service Id
+     */ 
+    void SetServiceId( TInt aServiceId );
+
+    /**
+     * Returns state of the service by sub service type
+     * @param aSubServiceType Sub service type
+     * @param aState Result state
+     * @return Symbian error codes
+     */ 
+    TInt State( TCCHSubserviceType aSubServiceType, 
+                TCCHSubserviceState& aState ) const;
+
+    /**
+     * Queries if this service contains a subservice with the given type
+     * @return ETrue if sub service with given type exists
+     */ 
+    TBool ContainsSubServiceType( TCCHSubserviceType aSubServiceType ) const;
+
+    /**
+     * Returns a sub service from this service based on a type
+     * @param a Type
+     * @return Sub service
+     */
+    CScpSubService* GetSubServiceByType( TCCHSubserviceType aSubServiceType ) const;
+
+    /**
+     * Checks if sub services of this service contain same sip profile
+     * @return ETrue if they contain the same profile
+     */
+    TBool SubServicesContainSameSipProfile() const;
+
+    /**
+     * Sets reservation status for the service based on type
+     * @param aReserved Reserved
+     * @param aSubServiceType Sub service type
+     * @return Error code
+     */
+    TInt SetReserved( TBool aReserved, TCCHSubserviceType aSubServiceType );
+
+    /**
+     * Returns reservation status for the service based on type
+     * @param aSubServiceType Sub service type
+     * @return ETrue if reserved
+     */
+    TBool IsReserved( TCCHSubserviceType aSubServiceType ) const;
+
+    /**
+     * Set access point for the service
+     * @param aSubServiceType Sub service type
+     * @param aAccessPointType Access point type
+     * @param aAccessPointId Id
+     * @return Error code
+     */ 
+    TInt SetAccessPointId( TCCHSubserviceType aSubServiceType, 
+                           TScpAccessPointType aAccessPointType, 
+                           TInt aAccessPointId );
+    
+    /**
+     * Checks is all subservices in disabled state
+     * @return TBool ETrue if all service's subservices are in disabled state
+     */
+    TBool IsAllSubservicesDisabled() const;
+    
+    /**
+     * Change all service's subservices last error to given error
+     * @param aError error which to be set
+     */
+    void ChangeLastReportedErrors( const TInt aError );
+
+private:
+
+    /**
+     * Default constructor hidden
+     * @param aId Internal id
+     * @param aServiceId Service Id
+     */ 
+    CScpService( TInt aId, 
+                 TInt aServiceId,
+                 CScpProfileHandler& aProfileHandler, 
+                 CScpServiceStorage& aServiceStorage,
+                 MCchServiceObserver& aServiceObserver );
+    
+    /**
+     * Generates new internal sub service id
+     * @return New id
+     */ 
+    TInt GenerateNewSubServiceId();
+
+    /**
+     * Checks if the service's access point can be modified
+     * @param aSubServiceType Sub service type
+     * @return ETrue if modifiable
+     */ 
+    TBool IsAccessPointModifiable( TCCHSubserviceType aSubServiceType ) const;
+
+    /**
+     * Gets sip connection that the service is using
+     * @param aSubServiceType Sub service type
+     * @param aSipConnectionCreated ETrue if the connection was created
+     * @return Sip connection.
+     */ 
+    CScpSipConnection* GetSipConnection( TCCHSubserviceType aSubServiceType,
+                                         TBool& aSipConnectionCreated );
+
+private:
+
+    /**
+     * Internal sub service id
+     */ 
+    TInt iId;
+    
+    /**
+     * Service id.
+     */     
+    TInt iServiceId;
+
+    /**
+     * Profile handler.
+     */
+    CScpProfileHandler& iProfileHandler;
+
+    /**
+     * Service storage
+     */
+    CScpServiceStorage& iServiceStorage; 
+
+    /**
+     * Service Observer
+     */
+    MCchServiceObserver& iServiceObserver;
+    
+    /**
+     * Default sip profile.
+     */     
+    TInt iDefaultSipProfileId;
+    
+    /**
+     * Sub services of this service
+     */
+    RPointerArray< CScpSubService > iSubServices; 
+
+    /**
+     * Counter for creating unique internal sub service ids
+     */     
+    TInt iSubServiceIdCounter;
+    };
+
+
+
+#endif // C_SCPSERVICE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpservicehandlerbase.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 of sub service handlers.
+*
+*/
+
+
+#ifndef C_CSCSERVICEHANDLERBASE_H
+#define C_CSCSERVICEHANDLERBASE_H
+
+#include <e32base.h>
+#include <cchclientserver.h>
+
+#include "scpsipconnectionobserver.h"
+#include "scpdefs.h"
+#include "scpsipconnection.h"
+
+class CScpSubService;
+
+/**
+*  Base class of sub service handlers.
+*
+*  @lib sipconnectionprovider.dll
+*/
+class CScpServiceHandlerBase : public CBase,
+                               public MScpSipConnectionObserver
+                               
+    {
+public:  // Constructors and destructor
+
+    /**
+     * Enables service.
+     */
+    virtual void EnableSubServiceL() = 0;
+
+    /**
+     * Disables service.
+     */
+    virtual TInt DisableSubService() = 0;
+                   
+    /**
+     * Returns type of sub service (VoIP, Vmbx, Presence).
+     * @return Type of the sub service.
+     */
+    virtual TCCHSubserviceType SubServiceType() const = 0;
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CScpServiceHandlerBase();
+
+protected:
+                                  
+    /**
+    * C++ default constructor.
+    */
+    CScpServiceHandlerBase( CScpSubService& aSubService );
+
+    /**
+     * Base construction
+     */
+    void BaseConstructL();
+
+    /**
+     * Registers the sub service's profile
+     * @param aSubService Registered sub service
+     * @return State of the registration
+     */
+    void RegisterProfileL();
+
+    /**
+     * Deregisters the sub service's profile
+     * @param aSubService Deregistered sub service
+     */
+    void DeregisterProfile();
+    
+    /**
+     * Instantly force disables sip profile
+     */
+    void PerformInstantForceSipProfileDisable();
+
+    /**
+     * Starts force disable timer
+     * @param aFunction The function to call after the time out
+     */
+    void StartForcedDisableTimer( TInt (*aFunction)(TAny* aPtr) );
+
+    /**
+     * Cancels the disable timer
+     */
+    void CancelDisableTimer();
+
+private:
+
+    /**
+     * Handle sip connection event
+     * @param aProfileId Sip profile id
+     * @param aSipEvent Sip event
+     */
+    virtual void HandleSipConnectionEvent( const TUint32 aProfileId,
+                                           TScpConnectionEvent aSipEvent ) = 0;
+    
+    /**
+     * From base class MScpSipConnectionObserver
+     * Query is starting to ALR allowed.
+     * Client can start ALR later if needed to do something first
+     * 
+     * @return ETrue if allowed.
+     */
+    virtual TBool IsSipProfileAllowedToStartAlr();
+    
+    /**
+     * Forced sip profile disable call back
+     * @param aSelf this object
+     */
+    static TInt ForceSipProfileDisable( TAny* aSelf );
+
+    /**
+     * Handles sip profile forced disable timeout
+     * Sends Deregistered event for the subservice
+     * @param aForceDisableSipProfile ETrue when wanted to really
+     *        force disable actual sip profile (not just generate event).
+     */
+    void HandleSipProfileForcedDisable( TBool aForceDisableSipProfile );
+
+protected:
+
+    /**
+     * Sub service
+     */
+    CScpSubService& iSubService;
+
+private:
+
+    /**
+     * Disable timer. Owned.
+     */
+    CPeriodic* iDisableTimer;
+
+#ifdef _DEBUG
+    friend class T_CScpServiceManager;
+    friend class T_CScpVmbxHandler;
+#endif
+    };
+
+#endif      // C_CSCSERVICEHANDLERBASE_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpservicemanager.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,377 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_CSCPSERVICEMANAGER_H
+#define C_CSCPSERVICEMANAGER_H
+
+#include <cchservice.h>
+
+#include "scpdefs.h"
+#include "scpstatecontainer.h"
+
+class CScpSettingHandler;
+class CScpProfileHandler;
+class CScpServiceStorage;
+class CScpService;
+class CScpSubService;
+class CScpSipConnection;
+
+/**
+*  CScpServiceManager class
+*  @lib sipconnectionprovider.dll
+*/
+class CScpServiceManager : public CBase
+    {
+public:    
+
+    /**
+    * Two-phased constructor
+    */
+    static CScpServiceManager* NewL( MCchServiceObserver& aServiceObserver );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CScpServiceManager();
+
+public: // New functions
+   
+    /**
+     * Client enables service. CCHService implementation
+     * should use MCCHServiceObserver for service state notifications.
+     * @see MCCHServiceObserver
+     * @param aServiceId
+     */
+    void EnableServiceL( TUint aServiceId,
+                         TCCHSubserviceType aSubServiceType );
+                                 
+    /**
+     * Client enables service. CCHService implementation
+     * should use MCCHServiceObserver for service state notifications.
+     * @see MCCHServiceObserver
+     * @param aServiceId
+     * @param aIapId
+     */
+    void EnableServiceL( TUint aServiceId,
+                         TCCHSubserviceType aSubServiceType,
+                         TUint aIapId );
+    
+    /**
+     * Client disables service. 
+     * @param aServiceId
+     */
+    void DisableServiceL( TUint aServiceId,
+                          TCCHSubserviceType aSubServiceType );
+    
+    /**
+     * Client checks is the service available by the IAP id array.
+     * CCHService implementation should return ETrue if service is
+     * registrable by the (some) IAP, array contains. 
+     * @param aServiceId
+     * @param aIapIdArray Id array of the currently available iaps.
+     * @return ETrue if service is available.
+     */
+    TBool IsAvailableL( TUint aServiceId,
+                        TCCHSubserviceType aSubServiceType,
+                        const RArray<TUint32>& aIapIdArray ) const;
+    
+    /**
+     * Get service state information.
+     * @param aServiceId
+     * @param aState Current service state.
+     * @return General symbian error code.
+     */
+    TInt GetServiceState( TUint aServiceId,
+                          TCCHSubserviceType aSubServiceType, 
+                          TCCHSubserviceState& aState ) const;
+    
+    /**
+     * Get service network information.
+     * @param aServiceId
+     * @param aSnapId Used Snap id (should be set as null if
+     *               not in use)
+     * @param aIapId Used IAP id (should be set as null if
+     *               not in use)
+     * @param aSnapLocked Is snap locked or not.
+     * @param aPasswordSet Is password set or not.
+     * @return General symbian error code.
+     */
+    TInt GetServiceNetworkInfo( TUint aServiceId,
+                                TCCHSubserviceType aSubServiceType,
+                                TUint32& aSnapId, 
+                                TUint32& aIapId,
+                                TBool& aSnapLocked,
+                                TBool& aPasswordSet ) const;
+                                        
+    /**
+     * Set Snap id for service.
+     * @param aServiceId
+     * @param aSnapId 
+     * @return General symbian error code.
+     */
+    TInt SetSnapId( TUint aServiceId,
+                    TCCHSubserviceType aSubServiceType,
+                    TUint aSnapId );
+                    
+    /**
+     * Set IAP id for service.
+     * @param aServiceId
+     * @param aSnapId 
+     * @return General symbian error code.
+     */
+    TInt SetIapId( TUint aServiceId,
+                   TCCHSubserviceType aSubServiceType,
+                   TUint aIapId );                               
+    
+    /**
+     * Get service specifics information about service and protocol
+     * @param aServiceId
+     * @param aSubservice
+     * @param aBuffer  
+     */
+    void GetServiceInfoL( TUint aServiceId,
+                          TCCHSubserviceType aSubServiceType,
+                          RBuf& aBuffer ) const;
+
+    /**
+     * Sets service reserved or unreserved
+     * @param aReserved Reserved
+     * @param aServiceId
+     * @param aSubServiceType Sub service type
+     * @return Symbian error codes
+     */
+    TInt SetServiceReserved( TBool aReserved,
+                             TUint aServiceId,
+                             TCCHSubserviceType aSubServiceType );
+
+    /**
+     * Returns service reserved info
+     * @param aServiceId
+     * @param aSubServiceType Sub service type
+     * @return ETrue if reserved
+     */
+    TBool IsReserved( TUint aServiceId,
+                      TCCHSubserviceType aSubServiceType ) const;                              
+
+
+    /**
+     * Returns the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @leave Symbian error code
+     */
+    void GetConnectionParameterL( const TServiceSelection& aServiceSelection,
+                                  TCchConnectionParameter aParameter,
+                                  TInt& aValue ) const;
+    
+    /**
+     * Returns the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @leave Symbian error code
+     */
+    void GetConnectionParameterL( const TServiceSelection& aServiceSelection, 
+                                  TCchConnectionParameter aParameter,
+                                  RBuf& aValue ) const;
+    
+    /**
+     * Sets the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @leave Symbian error code
+     */
+    void SetConnectionParameterL( const TServiceSelection& aServiceSelection, 
+                                 TCchConnectionParameter aParameter,
+                                 TInt aValue );
+    
+    /**
+     * Sets the connection parameters
+     * @since S60 3.2.3
+     * @param aServiceSelection Selected service, ID and type
+     * @param aParameter Connection parameter of the service
+     * @param aValue Value of the parameter
+     * @leave Symbian error code
+     */
+    void SetConnectionParameterL( const TServiceSelection& aServiceSelection, 
+                                  TCchConnectionParameter aParameter,
+                                  const TDesC& aValue );
+
+    
+    
+private:
+
+    /**
+     * Default constructor
+     * @param aStateObserver State Observer
+     */
+    CScpServiceManager( MCchServiceObserver& aServiceObserver );
+    
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+                           
+    /**
+     * Get service network information. Leaves on failure.
+     * @param aServiceId
+     * @param a Sub service type
+     * @param aSnapId Used Snap id (should be set as null if
+     *               not in use)
+     * @param aIapId Used IAP id (should be set as null if
+     *               not in use)
+     * @param aSnapLocked Snap locked
+     */
+    void GetServiceNetworkInfoL( TUint aServiceId,
+                                 TCCHSubserviceType aSubServiceType,
+                                 TUint32& aSnapId, 
+                                 TUint32& aIapId,
+                                 TBool& aSnapLocked,
+                                 TBool& aPasswordSet ) const;
+                                                                
+    /** 
+     * Handles ALR events.
+     * @param aServiceId Service Id
+     * @param a Sub service type
+     * @param aConnectionCreated ETrue if connection was created
+     * @return SipConnection if exists
+     */   
+    CScpSipConnection* GetSipConnectionL( TUint aServiceId,
+                                          TCCHSubserviceType aSubServiceType,
+                                          TBool& aConnectionCreated ) const;
+
+    /**
+     * Gets and updates a service
+     * @param aServiceId Service Id
+     * @param a Sub service type
+     * @return Service, NULL if failed
+     */
+    CScpService* GetServiceL( TUint aServiceId,
+                              TCCHSubserviceType aSubServiceType );
+
+    /**
+     * Creates and updates a service. The service is saved to
+     * service storage.
+     * @param aServiceId Service Id
+     * @param a Sub service type
+     * @return Service
+     */
+    CScpService* CreateServiceL( TUint aServiceId,
+                                 TCCHSubserviceType aSubServiceType );
+
+    /**
+     * Creates and updates a temporary service. The service is not
+     * saved to service storage. These use cases are due to network
+     * info queries.
+     * @param aServiceId Service Id
+     * @param a Sub service type
+     * @return Service
+     */
+    CScpService* CreateTemporaryServiceL( TInt aServiceId,
+                                          TCCHSubserviceType aSubServiceType ) const;
+
+    /**
+     * Set access point for a service
+     * @param aServiceId Service Id
+     * @param aSubServiceType Sub service type
+     * @param aAccessPointType Access point type
+     * @param aAccessPointId Id
+     * @return Error code
+     */ 
+    TInt SetAccessPointId( TUint aServiceId,
+                           TCCHSubserviceType aSubServiceType, 
+                           TScpAccessPointType aAccessPointType, 
+                           TInt aAccessPointId );
+    
+    /**
+     * Updates the prfile handler's user agent header. Use before.
+     * @param aServiceId Service Id
+     * @param a SubServiceType sub service type
+     */
+    void UpdateProfileValuesL( TUint aServiceId, TCCHSubserviceType aSubServiceType ) const;
+     
+    /**
+     * Updates username/password to XDM-setting
+     * @param aServiceId Service Id
+     * @param aUsername username
+     * @param aSetUsername ETrue if username wish to be set
+     * @param aPassword password
+     * @param aSetPassword ETrue if username wish to be set
+     */
+    void SetUsernameAndPasswordToXdmL( 
+        TUint aServiceId,
+        const TDesC8& aUsername,
+        TBool aSetUsername,
+        const TDesC8& aPassword,
+        TBool aSetPassword );
+    
+    /**
+     * Checks restricted connections. In case where voip is not 
+     * allowed via 3g and 3g ap is first ap, leave with error 
+     * KCCHErrorAccessPointNotDefined so user can select another ap.
+     * @param aServiceId Service Id
+     */
+    void CheckRestrictedConnectionsL( TUint aServiceId );
+    
+private:  
+
+    /**
+     * Observer for state changes
+     */
+    MCchServiceObserver& iServiceObserver; 
+    
+    /**
+     * Setting handler. Own.
+     */ 
+    CScpSettingHandler* iSettingHandler;
+
+    /**
+     * Setting handler. Own.
+     */     
+    CScpProfileHandler* iProfileHandler;
+
+    /**
+     * Service settings storage. Own.
+     */    
+    CScpServiceStorage* iServiceStorage;
+    
+    /**
+     * Service state container. Singleton.
+     */
+    TScpStateContainer iStateContainer;
+
+private:
+
+#ifdef _DEBUG
+    friend class T_CScpServiceManager;
+    friend class T_CScpSipHelper;
+    friend class T_CScpService;
+    friend class T_CScpSettingHandler;
+#endif
+    
+    };    
+
+#endif  // C_CSCPSERVICEMANAGER_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpservicestorage.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,179 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_CSCSERVICESTORAGE_H
+#define C_CSCSERVICESTORAGE_H
+
+#include <e32base.h>
+#include <cchclientserver.h>
+
+#include "scpdefs.h"
+
+class CScpService;
+class CScpSubService;
+class CScpProfileHandler;
+class CScpSettingHandler;
+class MCchServiceObserver;
+
+/**
+*  Service storage class.
+*
+*  @lib sipconnectionprovider.dll
+*/
+class CScpServiceStorage : public CBase
+    {
+public:  // Constructors and destructor
+
+    /**
+     * Two-phased constructor
+     */
+    static CScpServiceStorage* NewL(CScpSettingHandler& iScpSettingHandler);  
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CScpServiceStorage();
+
+    /**
+     * Creates a service to the storage.
+     * @param aService Service settings.
+     */
+    CScpService& CreateServiceL( TInt aServiceId, 
+                                 CScpProfileHandler& aProfileHandler,
+                                 MCchServiceObserver& aServiceObserver );
+
+    /**
+     * Removes a service from the storage by internal id.
+     * @param aId Id of the service.
+     */
+    TInt RemoveService( TInt aId );
+
+    /**
+     * Removes services with disabled or no subservices from the storage.
+     * @since Series 60 3.0
+     */
+    void RemoveDisabledServices();
+
+    /**
+     * Returns a service from the storage by id.
+     * @param aId Id of the service.
+     * @return Service if found (ownership not transferred) - otherwise NULL
+     */
+    CScpService* GetService( TInt aId ) const;
+            
+    /**
+     * Fills all internal ids of the services to the given array.
+     * @param aIds Internal ids of the services.
+     */
+    void GetServiceIds( RArray<TInt>& aIds ) const;
+
+    /**
+     * Returns a service from the storage by service id.
+     * @param aId Service id of the service.
+     * @return Service if found (ownership not transferred) - otherwise NULL
+     */
+    CScpService* GetServiceByServiceId( TUint aServiceId ) const;               
+
+    /**
+     * Returns a sub service from the storage by sub service internal id.
+     * @param aId Internal id of the sub service.
+     * @return Sub service if found (ownership not transferred) - otherwise NULL
+     */
+    CScpSubService* GetSubService( TInt aId ) const;
+
+    /**
+     * Fills all internal sub service ids to the given array.
+     * @param aIds Array of sub service internal ids.
+     */
+    void GetSubServiceIds( RArray<TInt>& aIds ) const;
+
+    /**
+     * Fills all internal sub service ids by type to the given array.
+     * @param aIds Array of sub service internal ids.
+     */
+    void GetSubServiceIds( TCCHSubserviceType aSubServiceType,
+                           RArray<TInt>& aIds ) const;
+
+    /**
+     * Fills sub service ids to the given array that match profile id and type
+     * @param aProfileId Sip profile id
+     * @param a Sub service type
+     * @param aIds Array of sub service internal ids.
+     */
+    void GetSubServiceIds( TUint32 aProfileId,
+                           TCCHSubserviceType aSubServiceType, 
+                           RArray<TInt>& aIds ) const;
+
+    /**
+     * Queries if a sub service with given profile id is enabled
+     * @param aProfileId Sip profile id
+     * @return ETrue if enabled
+     */
+    TBool IsSubServiceEnabled( TUint32 aProfileId ) const;
+
+    /**
+     * Queries if all sub service with given profile ids are
+     * disconnected from service. 
+     * @param aProfileId Sip profile id
+     * @return ETrue if all are disconnected
+     */
+    TBool AreAllSubServicesDisconnected( TUint32 aProfileId ) const;
+   
+   /**
+     * Returns CScpSettingHandler 
+     * @return CScpSettingHandler reference
+     */
+    CScpSettingHandler& SettingsHandler();
+
+#ifdef _DEBUG
+    void GetDebugInfo( TDes& aInfo ) const;
+#endif
+
+private:  // Constructors
+
+    /**
+     * C++ default constructor.
+     */
+    CScpServiceStorage(CScpSettingHandler& aScpSettingHandler);
+    
+    /**
+     * Generates a new internal id for a service
+     * @return Ner internal id
+     */
+    TInt GenerateNewInternalIdForService();
+
+private:
+
+    // Settings handler
+    CScpSettingHandler& iSettingHandler;
+
+    // Services
+    RPointerArray<CScpService> iServiceItems;
+
+    // Counter for generating unique internal service ids
+    TInt iServiceIdCounter;
+
+    /**
+     *
+     */
+    CPeriodic* iRemoveTimer;
+    };
+
+#endif      // C_CSCSERVICESTORAGE_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpsettinghandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,298 @@
+/*
+* Copyright (c) 2002-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 C_SCPSETTINGHANDLER_H
+#define C_SCPSETTINGHANDLER_H
+
+#include <e32base.h>
+#include <cchclientserver.h>
+#include <spdefinitions.h>
+
+class CRCSEProfileRegistry;
+class CRCSEProfileEntry;
+class CSPSettings;
+class CSPEntry;
+class CSPSettingsVoIPUtils;
+class CScpService;
+class CScpServiceHandlerBase;
+class CScpProfileHandler;
+class CScpServiceStorage;
+
+/**
+*  Settings handler.
+*  @lib sipconnectionprovider.dll
+*/
+class CScpSettingHandler : public CBase
+    {
+public:
+    
+    /**
+     * Two-phased constructor.
+     */
+    static CScpSettingHandler* NewL( CScpProfileHandler& iProfileHandler );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CScpSettingHandler();
+
+    /**
+     * Get SIP Profile Id by Service Id.
+     * @param aServiceId Service Id.
+     * @param aSubService Sub service type.
+     * @param aSipId SIP Profile Id.
+     */
+    void GetSipProfileIdByTypeL( TUint32 aServiceId,
+                                 TCCHSubserviceType aSubServiceType, 
+                                 TUint32& aSipId ) const;
+                                 
+    /**
+     * Get SPSetting TInt property by Service Id and property name.
+     * @param aServiceId Service Id.
+     * @param aPropertyName Settings property name.
+     * @param aProperty a property value.
+     */
+    void GetSPSettingsIntPropertyL( TUint32 aServiceId,
+                                    TServicePropertyName aPropertyName, 
+                                    TInt& aProperty ) const;
+     /**
+     * Get settings for service by Service Id.
+     * @param aServiceId Service Id.
+     * @param aSetting Service Settings.
+     */
+    void UpdateSettingsL( CScpService& aSetting,
+                          TCCHSubserviceType aSubServiceType ) const;
+       
+     /**
+     * Updates xdm settings username
+     * @param aService Service handle.
+     * @param aSubServiceType sub service type
+     * @param aUsername username to set
+     */                          
+    void UpdateXdmUsernameL( CScpService& aService, 
+        TCCHSubserviceType aSubServiceType,
+        const TDesC8& aUsername );
+
+     /**
+     * Updates xdm settings password
+     * @param aService Service handle.
+     * @param aSubServiceType sub service type
+     * @param aPassword password to set
+     */                          
+    void UpdateXdmPasswordL( CScpService& aService, 
+        TCCHSubserviceType aSubServiceType,
+        const TDesC8& aPassword );
+
+    /**
+     * Get Service Id by SIP Profile Id.
+     * @param aSipId SIP Profile Id.
+     * @param aServiceId Service id array.
+     */
+    TInt GetServiceIds( TUint32 aSipId, 
+                        RArray<TUint32>& aServiceId ) const;
+
+    /**
+     * Checks if service exists in service table
+     * @param aServiceId Service id array.
+     * @return ETrue if the service exists
+     */
+    TBool ServiceExistsL( TUint32 aServiceId ) const;
+    
+    /**
+     * Checks is VoIP supported.
+     * @return ETrue if Common VoIP and Dynamic VoIP are ON
+     */
+    TBool IsVoIPSupported() const;
+    
+    /**
+     * Checks is VoIP's user agent header terminal type defined.
+     * @param aServiceId service id
+     * @return ETrue if terminal type is defined.
+     */
+    TBool IsUahTerminalTypeDefinedL( TUint32 aServiceId ) const;
+    
+    /**
+     * Checks is VoIP's user agent header WLAN mac address defined.
+     * @param v
+     * @return ETrue if WLAN mac address is defined.
+     */
+    TBool IsUahWLANMacDefinedL( TUint32 aServiceId ) const;
+    
+    /**
+     * VoIP's user agent header free string length getter.
+     * @param aServiceId service id
+     * @return TInt length of free string.
+     */
+    TInt UahStringLengthL( TUint32 aServiceId ) const;
+         
+private: 
+
+    /**
+     * C++ default constructor.
+     */
+    CScpSettingHandler( CScpProfileHandler& iProfileHandler );
+
+    /**
+     * 2nd phase destructor
+     */
+    void ConstructL();
+
+    /**
+     * Get Service Id by SIP Profile Id.
+     * @param aSipId SIP Profile Id.
+     * @param aServiceId Service id array.
+     */
+    void GetServiceIdsL( TUint32 aSipId, 
+                         RArray<TUint32>& aServiceId ) const;
+
+     /**
+     * Updates Presence settings to the given service
+     * @param aService Service
+     */
+    void UpdatePresenceSettingsL( CScpService& aService ) const;
+
+    /**
+     * Check if presence settings are valid
+     * @param aEntry  Entry
+     * @return ETrue if valid
+     */
+    TBool ArePresenceSettingsValid( const CSPEntry& aEntry ) const;
+       
+    /**
+     * Determines presence settings id from the given entry
+     * @param aEntry Entry
+     * @return ETrue if valid
+     */ 
+    TInt GetPresenceSettingsId( const CSPEntry& aEntry ) const;
+
+    /**
+     * Updates VoIP settings to the given service
+     * @param aService Service
+     */
+    void UpdateVoIPSettingsL( CScpService& aService ) const;
+
+    /**
+     * Check if VoIP settings are valid in the given entry
+     * @param aEntry Entry
+     * @return ETrue if valid
+     */
+    TBool AreVoipSettingsValid( const CSPEntry& aEntry ) const;
+
+    /**
+     * Updates voice mail box settings to the given service
+     * @param aService Service
+     */
+    void UpdateVmbxSettingsL( CScpService& aService ) const;
+
+    /**
+     * Check if voice mail box settings are valid
+     * @param aEntry  Entry
+     * @return ETrue if valid
+     */
+    TBool AreVmbxSettingsValid( const CSPEntry& aEntry ) const;
+
+    /**
+     * Gets sip profile id for VoIP sub service
+     * @param aServiceId Service id
+     * @param aSipId
+     */
+    void GetVoipSipProfileIdL( TUint32 aServiceId, TUint32& aSipId ) const;
+
+    /**
+     * Gets sip profile id for VMBx sub service
+     * @param aServiceId Service id
+     * @param aSipId
+     */
+    void GetVmbxSipProfileIdL( TUint32 aServiceId, 
+                               TUint32& aSipId ) const;
+
+    /**
+     * Gets sip profile id for Presence sub service
+     * @param aServiceId Service id
+     * @param aSipId
+     */
+    void GetPresenceSipProfileIdL( TUint32 aServiceId, 
+                                   TUint32& aSipId ) const;
+
+    /**
+     * Gets sip profile id for all sub services within the service.
+     * If subservices contain different sip profile ids, will leave with
+     * KErrArgument.
+     * @param aServiceId Service id
+     * @param aSipId
+     */
+    void GetUnknownSipProfileIdL( TUint32 aServiceId, 
+                                  TUint32& aSipId ) const;
+
+    /**
+     * Update IM settings to the given service.
+     *
+     * @since S60 v5.1
+     * @param aService service
+     */
+    void UpdateImSettingsL( CScpService& aService ) const;
+
+    /**
+     * Check if IM settings are valid in the given entry.
+     *
+     * @since S60 v5.1
+     * @param aEntry Entry
+     * @return ETrue if valid
+     */
+    TBool AreImSettingsValid( const CSPEntry& aEntry ) const;
+
+private:
+
+    /**
+     * Profile registry. Own.
+     */
+    CRCSEProfileRegistry* iRcseProfileRegistry;
+
+    /**
+     * Profile entry. Own.
+     */
+    CRCSEProfileEntry* iRcseProfileEntry;
+
+    /**
+     * SPSettings. Own.
+     */
+    CSPSettings* iSpSettings;
+
+    /**
+     * Profile handler
+     */
+    CScpProfileHandler& iProfileHandler;
+    
+    /**
+     * SPSettings VoIP utils. Own.
+     */
+    CSPSettingsVoIPUtils* iSpsVoIPUtils;
+    
+private:
+
+#ifdef _DEBUG
+    friend class T_CScpSettingHandler;
+    friend class T_CScpServiceManager;
+    friend class T_CScpSipHelper;
+#endif
+
+    };
+
+#endif      // C_SCPSETTINGHANDLER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpsipconnection.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,469 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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_SCPSIPCONNECTION_H
+#define C_SCPSIPCONNECTION_H
+
+#include <e32base.h>
+#include <rconnmon.h>
+#include <sipconnectionobserver.h>
+#include <sipprofileregistryobserver.h>
+
+#include "scpdefs.h"
+
+class CSIPProfileRegistry;
+class CSIPProfile;
+class CSIPManagedProfileRegistry;
+class MScpSipConnectionObserver;
+
+/**
+ *  Register/unregister protocol profiles.
+ *
+ *  @lib sipconnectionprovider.dll
+ *  @since Series 60 3.2
+ */
+class CScpSipConnection : public CBase,
+                          public MSIPConnectionObserver  
+    {
+public:
+
+    enum TConnectionState
+        {
+        EUnknown = 0,
+        ERegistering,
+        ERegistered,
+        EDeregistering,
+        EDeregistered,
+        };
+
+    enum TRegistrationRequestState
+        {
+        ENoRequest = 0,
+        ERegistrationRequested,
+        EDeregistrationRequested
+        };
+
+    /**
+     * Two-phased constructor.
+     */
+    static CScpSipConnection* NewL( TInt aProfileId, 
+                                    CSIPProfileRegistry& aProfileRegistry,
+                                    CSIPManagedProfileRegistry& aManagedProfileRegistry,
+                                    CSIP& aSip );
+    /**
+     * Destructor.
+     */
+    virtual ~CScpSipConnection();
+
+    /**
+     * Return sip profile id of this connection
+     * @return Profile id
+     */  
+    TInt ProfileId() const;
+
+    /**
+     * Enables the connection
+     */  
+    void EnableL();
+
+    /**
+     * Disables the connection.
+     * @return Symbian error codes
+     */  
+    TInt Disable();
+    
+    /**
+     * Disables the connection ungracefully.
+     * @return Symbian error codes
+     */  
+    TInt ForceDisable();
+
+    /**
+     * Returns state of deregistration request
+     * @return Registration state
+     */
+    TRegistrationRequestState RegistrationRequestState() const;
+
+    /**
+     * Get sip connection state
+     * @return State
+     */
+    void GetState( TConnectionState& aState, TInt& aError ) const;
+
+    /**
+     * Adds observer for the connection
+     * @param aObserver Observer
+     */
+    void AddObserver( MScpSipConnectionObserver& aObserver );
+
+    /**
+     * Removes observer from this connection
+     * @param aObserver Observer
+     * @return Symbian error codes
+     */
+    TInt RemoveObserver( MScpSipConnectionObserver& aObserver );
+
+    /**
+     * Gets Protocol Profile's IAP Id.
+     * @return Iap id
+     */                                     
+    TInt GetIap( TUint32& aIapId ) const;
+
+    /**
+     * Gets Protocol Profile's SNAP Id.
+     * @return Snap id.
+     */                                     
+    TInt GetSnap( TUint32& aSnapId ) const;
+
+    /**
+     * Gets Protocol Profile's Username..
+     * @param aUsername  Username of profile.
+     * @return KErrNone if succeed.
+     */                                     
+    TInt GetUsername( TDes8& aUsername ) const;
+
+    /**
+     * Gets Protocol Profile's domain.
+     * @param aDomain  Domain of profile.
+     * @return KErrNone if succeed.
+     */                                     
+    TInt GetDomain( TDes8& aDomain ) const;
+                          
+    /**
+     * Gets Protocol Profile's User name from Contact header
+     * @param aDomain  Domain of profile.
+     * @return KErrNone if succeed.
+     */                                     
+    TInt GetContactHeaderUser( RBuf8& aContactHeaderUser ) const;
+
+    /**
+     * Get CSIPProfile
+     * @return CSIPProfile
+     */
+    CSIPProfile& SipProfile() const;
+
+    /**
+     * Set Protocol Profile use this IAP.
+     * @since Series 60 3.2
+     * @param aIapId Iap Id.
+     * @return KErrNone if succeed.
+     */                                     
+    TInt SetIap( TUint32 aIapId );   
+                         
+    /**
+     * Set Protocol Profile use this SNAP.
+     * @param aSnapId  Profile new SNAP Id.
+     * @return KErrNone if succeed.
+     */                                     
+    TInt SetSnap( TUint32 aSnapId );  
+
+    /**
+     * Returns the type of the iap this connection's profile is using
+     * @return Iap type
+     */
+    TScpIapType GetIapTypeL() const;
+
+    /**
+     * Profile registry error occurred
+     * @param aProfileId Profile id
+     * @param aError error code
+     */ 
+    void ProfileRegistryErrorOccurred( TInt aError );
+
+    /**
+     * Updates the sip connection for the used sip profile
+     * @param aProfileId Profile id
+     * @param aEvent Event
+     */ 
+    void ProfileRegistryEventOccurred( MSIPProfileRegistryObserver::TEvent aEvent );
+
+    /**
+     * Reserve/Free the used connection for a service's use.
+     * For example a VoIP service might reserve the profile for a
+     * duration of a VoIP call
+     * @param aReserved Reserved
+     */
+    void SetReserved( TBool aReserved );
+
+    /**
+     * Returns information about if a connection is reserved or not
+     * @return ETrue if reserved
+     */
+    TBool Reserved() const;
+
+    /**
+     * Raises the flag fot iap availability offered. Iap availability
+     * offers may come from SIP during ALR. If the connection is reserved,
+     * the ARL is not allowed and iap available offered is raised.
+     * When the connection is freed the ALR can occur.
+     */
+    void SetIapAvailableOffered( TBool aIapAvailableOffered );
+
+    /**
+     * Returns the iap available offered flag
+     * @return ETrue if iap available was offered
+     */
+    TBool IapAvailableOffered() const;
+
+    /**
+     * Sets flag that currenlty the profile is romaing
+     */
+    void SetProfileCurrentlyRoaming();
+    
+    /**
+     * Handle ongoing alr
+     */
+    void HandleMigrationStarted();
+    
+    /**
+     * Handle alr error
+     * @param aError the error that occurred
+     * @param aProfileId identifies the SIP profile related to the error
+     * @param aSnapId the SNAP related to the event
+     * @param aIapId the IAP related to the error
+     */
+    void HandleMigrationError( TInt aError,
+        TUint32 aProfileId, TUint32 aSnapId, TUint32 aIapId ); 
+
+    /**
+     * Password check.
+     * @return returns always ETrue because information cannot
+     *         be checked from sip
+     */
+    TBool IsPasswordSet() const;
+    
+    /**
+     * Username check.
+     * Checks if digest username is set and username is in aor.
+     * @return ETrue when username exists
+     */
+    TBool IsUsernameSetL() const;
+    
+    /**
+     * Checks if SNAP connection method used by the SIP profile is
+     * available
+     * @return ETrue if available
+     */
+    TBool IsSnapConnectionAvailable( TInt aSnapId ) const;
+    
+    /**
+     * Checks if IAP connection method used by sip profile is
+     * available
+     * @return ETrue if available
+     */
+    TBool IsIapConnectionAvailable( TInt aIapId ) const;
+    
+    /**
+     * Gets bearer filttering setting used by sip profile.
+     * 0 --> Not Specified.
+     * 1 --> WLAN Bearer Only.
+     * 2 --> Cellular Data Bearer Only.
+     * @param aBearerFilttering bearer filttering setting
+     * 
+     * @return KErrNone if succeed.
+     */
+    TInt BearerFiltteringSetting( TUint32& aBearerFilttering ) const;
+
+#ifdef _DEBUG
+    void GetInfo( TDes& aInfo ) const;
+#endif
+
+private:
+
+    // From MSIPConnectionObserver
+    void IncomingRequest( CSIPServerTransaction* /*aTransaction*/ ) {};
+
+    void IncomingRequest( CSIPServerTransaction* /*aTransaction*/,
+                          CSIPDialog& /*aDialog*/ ) {};
+
+    void IncomingResponse( CSIPClientTransaction& /*aTransaction*/ ) {};
+    
+    void IncomingResponse( CSIPClientTransaction& /*aTransaction*/,
+                            CSIPDialogAssocBase& /*aDialogAssoc*/ ) {};
+
+    void IncomingResponse( CSIPClientTransaction& /*aTransaction*/,
+                            CSIPInviteDialogAssoc* /*aDialogAssoc*/ ) {};
+
+    void IncomingResponse( CSIPClientTransaction& /*aTransaction*/,
+                           CSIPRegistrationBinding& /*aRegistration*/ ) {};
+
+    void ErrorOccured( TInt /*aError*/, CSIPTransactionBase& /*aTransaction*/ ) {};
+
+    void ErrorOccured( TInt /*aError*/,
+                       CSIPClientTransaction& /*aTransaction*/,
+                       CSIPRegistrationBinding& /*aRegistration*/ ) {};
+
+    void ErrorOccured( TInt /*aError*/,
+                       CSIPTransactionBase& /*aTransaction*/,
+                       CSIPDialogAssocBase& /*aDialogAssoc*/ ) {};
+
+    void ErrorOccured( TInt /*aError*/, CSIPRefresh& /*aSIPRefresh*/ ) {};
+
+
+    void ErrorOccured( TInt /*aError*/,                    
+                       CSIPRegistrationBinding& /*aRegistration*/ ) {};
+
+    void ErrorOccured( TInt /*aError*/,            
+                       CSIPDialogAssocBase& /*aDialogAssoc*/) {};
+
+    void InviteCompleted( CSIPClientTransaction& /*aTransaction*/ ) {};
+
+    void InviteCanceled( CSIPServerTransaction& /*aTransaction*/ ) {};        
+
+    void ConnectionStateChanged( CSIPConnection::TState aState );
+
+    /**
+     * Checks if connection method used by the sip profile is
+     * available
+     * @return ETrue if available
+     */
+    TBool IsNetworkConnectionAvailable() const;
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CScpSipConnection( TInt aProfileId, 
+                       CSIPProfileRegistry& aProfileRegistry,
+                       CSIPManagedProfileRegistry& aManagedProfileRegistry,
+                       CSIP& aSip );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    
+    /**
+     * Starts timeout timer
+     * @param aFunction The function to call after the time out
+     */
+    void StartEnableTimeoutTimer( TInt (*aFunction)(TAny* aPtr) );
+
+    /**
+     * Cancels the disable timer
+     */
+    void CancelEnableTimeoutTimer();
+    
+    /**
+     * Profile register timeout callback
+     * @param aSelf this object
+     */
+    static TInt EnableTimeout( TAny* aSelf );
+    
+    /**
+     * Handles sip profile register timeout
+     */
+    void HandleEnableTimeout();
+    
+    /**
+     * Changes SIP profile from "Always on" to "When needed" if
+     * the profile was originally set to "Always on"
+     */
+    void DisableAlwaysOnModeL();
+    
+    /**
+     * Checks if Sip profile type is IMS
+     */
+    TBool SipProfileIMS() const;
+    
+private:
+
+    /**
+     * Sip profile id
+     */
+    TInt iProfileId;
+
+    /**
+     * Sip profile registry
+     */
+    CSIPProfileRegistry& iProfileRegistry;
+
+    /**
+     * Managed sip profile registry
+     */
+    CSIPManagedProfileRegistry& iManagedProfileRegistry;
+  
+    /**
+     * SIP instance
+     */  
+    CSIP& iSip;
+    
+    /**
+     * Sip profile. May change. Own
+     */    
+    CSIPProfile* iSipProfile;
+
+    /**
+     * Observer
+     */
+    MScpSipConnectionObserver* iObserver;
+
+    /**
+     * Registration request state
+     */
+    TRegistrationRequestState iRegistrationRequestState;
+
+    /**
+     * Registration faile flag
+     */
+    TInt iConnectionStateError;
+
+    /**
+     * Timeout timer. Owned.
+     */
+    CPeriodic* iEnableTimeoutTimer;
+
+    /**
+     * Connection reserved for services' usage
+     */
+    TBool iReserved;
+
+    /**
+     * Iap available offered
+     */
+    TBool iIapAvailableOffered;
+
+    /**
+     * Profile is currently roaming
+     */
+    TBool iProfileCurrentlyRoaming;
+
+    /**
+     * Connection monitor
+     */
+    RConnectionMonitor iConnectionMonitor;
+
+    /**
+     * SIP connection
+     * Own.
+     */
+    CSIPConnection* iSipConnection;
+
+// This need to be cleaned to separate macro/header
+#ifdef _DEBUG
+    friend class T_CScpSipConnection; 
+    friend class T_CScpProfileHandler;
+    friend class T_CScpServiceManager;
+    friend class T_CScpVmbxHandler;
+    friend class T_CScpVoipHandler;
+#endif
+    };
+
+#endif      // C_SCPSIPCONNECTION_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpsipconnectionobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+#ifndef M_SCPSIPCONNECTIONOBSERVER_H
+#define M_SCPSIPCONNECTIONOBSERVER_H
+
+#include <e32std.h>
+#include <e32base.h>
+
+#include "scpdefs.h"
+
+/**
+ *  MScpSipConnectionObserver declaration.
+ *  @lib sipconnectionprovider.dll
+ */
+class MScpSipConnectionObserver
+    {
+public:
+
+    /**
+     * SIP profile state observer.
+     * @param aProfileId SIP profile id
+     * @param aSipEvent A new event of SIP profile.
+     */
+    virtual void HandleSipConnectionEvent( TUint32 aProfileId,
+                                           TScpConnectionEvent aEvent ) = 0;
+      
+    /**
+     * Query is starting to ALR allowed.
+     * Client can start ALR later if needed to do something first
+     * 
+     * @return ETrue if allowed.
+     */
+    virtual TBool IsSipProfileAllowedToStartAlr() = 0;
+    
+    };
+
+/**
+ *  MScpConnectionObserver declaration.
+ *  @lib sipconnectionprovider.dll
+ */
+class MScpConnectionObserver
+    {
+public:
+
+    /**
+     * SIP profile state observer.
+     * @param aProfileId SIP profile id
+     * @param aSipEvent A new event of SIP profile.
+     */
+    virtual void HandleConnectionEvent( TScpConnectionEvent aEvent ) = 0;
+        
+    };
+
+
+#endif // M_SCPSIPCONNECTIONOBSERVER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpstatecontainer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef T_SCPSTATECONTAINER_H
+#define T_SCPSTATECONTAINER_H
+
+#include <cchclientserver.h>
+
+#include "scpdisabled.h"
+#include "scpconnectingservice.h"
+#include "scpenabled.h"
+#include "scpdisconnecting.h"
+
+class TScpSubServiceState;
+
+/**
+*  Service state container. Singleton.
+*
+*  @lib sipconnectionprovider.dll
+*/
+class TScpStateContainer
+    {
+public:
+
+    /**
+     * Constructor
+     */
+    TScpStateContainer();
+
+    /**
+     * Initializes the singleton. Should be called only once
+     * during the lifetime of the dll.
+     */
+    void InitializeL();
+
+    /**
+     * Returns singleton instances of the service states
+     * @param aState State type
+     * @return State object
+     */
+    static TScpSubServiceState* Instance( TCCHSubserviceState aState );
+
+private:
+
+    /**
+     * Disabled state
+     */
+    TScpDisabled iDisabled;
+
+    /**
+     * Connecting service state
+     */
+    TScpConnectingService iConnectingService;
+
+    /**
+     * Enabled state
+     */
+    TScpEnabled iEnabled;
+
+    /**
+     * Disconnecting state
+     */
+    TScpDisconnecting iDisconnecting;
+    };
+
+#endif      // T_SCPSTATECONTAINER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpsubservice.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,369 @@
+/*
+* Copyright (c) 2007-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 T_SCPSUBSERVICE_H
+#define T_SCPSUBSERVICE_H
+
+#include <e32std.h>
+#include <cchservice.h>
+
+#include "scpdefs.h"
+#include "scpsipconnectionobserver.h"
+
+class MCchServiceObserver;
+class MScpSubServiceObserver;
+class CScpServiceHandlerBase;
+class TScpSubServiceState;
+class CScpServiceStorage;
+class CScpProfileHandler;
+class CScpService;
+
+/**
+ *  SCP sub service.
+ *  @lib sipconnectionprovider.dll
+ */
+class CScpSubService : public CBase,
+                       public MScpConnectionObserver
+    {    
+public:
+
+    enum TEnableState
+        {
+        EScpNoRequest,
+        EScpEnabled,
+        EScpDisabled,
+        EScpRefreshed
+        };
+
+    static CScpSubService* NewL( TInt aId, 
+                                 TInt aSubServiceId,
+                                 TCCHSubserviceType aSubServiceType,
+                                 CScpService& aService );
+
+        
+    /**
+     * Destructor
+     */ 
+    ~CScpSubService();
+
+    /**
+     * Enables this sub service
+     */ 
+    void EnableL();
+
+    /**
+     * Disables this sub service
+     * @return Symbian error codes
+     */ 
+    TInt Disable();
+
+    /**
+     * Returns internal id of this subservice
+     * @return Internal id
+     */ 
+    TInt Id() const;
+
+    /**
+     * Returns service id of this subservice
+     * @return Sub service id
+     */ 
+    TInt SubServiceId() const;
+
+    /**
+     * Return state of the subservice
+     * @return State
+     */ 
+    TCCHSubserviceState State() const;
+
+    /**
+     * Returns sub service type of the subservice
+     * @return Sub service type
+     */ 
+    TCCHSubserviceType SubServiceType() const;
+
+    /**
+     * Returns service storage
+     * @return Service storage
+     */
+    CScpServiceStorage& ServiceStorage() const;
+
+    /**
+     * Returns profile handler
+     * @return Service storage
+     */
+    CScpProfileHandler& ProfileHandler() const;
+
+    /**
+     * Sets sip profile id for the subservice
+     * @param aSipProfileId Sip profile id
+     */ 
+    void SetSipProfileId( TInt aSipProfileId );
+    
+    /**
+     * Returns sip profile id of the subservice
+     * @return sip profile id
+     */ 
+    TInt SipProfileId() const;
+
+    /**
+     * Sets enable requested state
+     * @param aEnableRequestedState State
+     */ 
+    void SetEnableRequestedState( TEnableState aEnableRequestedState );  
+
+    /**
+     * Return info about if enable or disable is requested
+     * @return Enable requested state
+     */ 
+    TEnableState EnableRequestedState() const;  
+
+    /**
+     * Raises the flag that sub service is succesfully disconnected
+     * its service (e.g. unsubscribed message received from network).
+     * When disconnected it's ok for this sub service to disable SIP 
+     * profile
+     * @param aSubServiceDisconnected Sub service disconnected
+     */ 
+    void SetSubServiceDisconnected( TBool aSubServiceDisconnected );
+
+    /**
+     * Return Sub service disconnceted flag
+     * @return Sub service disconnected
+     */ 
+    TBool SubServiceDisconnected() const; 
+
+    /**
+     * Sets access point for the sub service
+     * @param aApId Access point
+     */ 
+    void SetApId( TUint32 aApId );
+
+    /**
+     * Returns access point id of the subservice
+     * @return Access point id
+     */    
+    TUint32 ApId() const;
+
+    /**
+     * Sets snap id or the subservice
+     * @param aSnapId Snap id
+     */ 
+    void SetSnapId( TUint32 aSnapId );
+
+    /**
+     * Returns the iap type the subservice is using
+     * @return Iap type
+     */ 
+    TScpIapType GetIapType() const;
+
+    /**
+     * Returns snap id id of the subservice
+     * @return Snap id
+     */ 
+    TUint32 SnapId() const;
+
+    /**
+     * Returns service handler
+     */
+    CScpServiceHandlerBase& ServiceHandler() const;
+
+    /**
+     * Handle connection event. Based on event a corresponging 
+     * method from current state is called.
+     * @param aEvent Connection event
+     */
+    void HandleConnectionEvent( TScpConnectionEvent aEvent );
+
+    /**
+     * Returns last reported error from a state change
+     * @return Last error
+     */
+    TInt LastReportedError() const;
+    
+    /**
+     * Last reported error setter
+     * @param aError error which to be set
+     */
+    void SetLastReportedError( const TInt aError );
+
+    /**
+     * Sets the sub service as reserved
+     * @param aReserved Reserved
+     */
+    void SetReserved( TBool aReserved );
+
+    /**
+     * Returns reserved info of the sub service
+     * @return ETrue if reserved
+     */
+    TBool IsReserved() const;
+    
+    /**
+     * Returns roaming info of the sub service
+     * @return ETrue if roaming
+     */
+    TBool IsRoaming() const;
+    
+    /**
+     * Set subservice observer
+     */
+    void SetSubServiceObserver( MScpSubServiceObserver* aSubServiceObserver );
+    
+    /**
+     * Enable counter getter.
+     */
+    TInt EnableCounter();
+    
+    /**
+     * Reset enable counter.
+     */
+    void ResetEnableCounter();
+
+private:
+
+    /**
+     * Constructor
+     */ 
+    CScpSubService( TInt aId, 
+                    TInt aSubServiceId,
+                    TCCHSubserviceType aType,
+                    CScpService& aService );
+
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+   
+    /**
+     * TScpStates use this function to change the state
+     * of the subservice.
+     * @param aState New state
+     * @param aError CCH errors
+     */ 
+    void ChangeState( TCCHSubserviceState aState, TInt aError );
+    
+    /**
+     * Adds presencehandler to voip's subserviceobserver if 
+     * presencesubservice exists.
+     */
+    void SetPresenceToObserveVoIP();
+
+    /**
+     * Enable occured.
+     */
+    void EnableOccured();
+
+private:
+
+    /**
+     * Internal id.
+     */       
+    TInt iId;
+
+    /**
+     * Service id.
+     */     
+    TInt iSubServiceId;
+
+    /**
+     * Subservice type.
+     */     
+    TCCHSubserviceType iSubServiceType;
+
+    /**
+     * Service that contains this sub service
+     */
+    CScpService& iService;
+
+    /**
+     * Service handler. Owned.
+     */ 
+    CScpServiceHandlerBase* iServiceHandler;
+    
+    /**
+     * Protocol profile id.
+     */     
+    TInt iSipProfileId;
+
+    /**
+     * Enable requested state
+     */     
+    TEnableState iEnableRequestedState;
+
+    /**
+     * Sub service disconnected
+     */
+    TBool iSubServiceDisconnected;
+            
+    /**
+     * IAP id.
+     */     
+    TUint32 iApId;
+    
+    /**
+     * Snap id.
+     */     
+    TUint32 iSnapId;
+
+    /**
+     * Last reported error
+     */
+    TInt iLastReportedError;
+
+    /**
+     * Reserved
+     */
+    TBool iReserved;
+    
+    /**
+     * Indicates is roaming ongoing
+     */
+    TBool iRoaming;
+
+    /**
+     * Points to current sub service state.
+     */
+    TScpSubServiceState* iSubServiceState;
+    
+    /**
+     * Sub service observer
+     */
+     MScpSubServiceObserver* iSubServiceObserver;
+     
+     /**
+      * Counting enable requests, max count is sub service specific
+      */
+     TInt iEnableCounter;
+
+private:
+
+    // Needs access to call the private ChangeState
+    friend class TScpSubServiceState;
+
+#ifdef _DEBUG
+    friend class T_CScpService;
+    friend class T_CScpServiceStorage;
+    friend class T_CScpServiceManager;
+    friend class T_CScpVmbxHandler;
+    friend class T_CScpVoipHandler;
+    friend class T_CScpPresenceHandler;
+    friend class T_CScpImHandler;
+#endif
+    };    
+
+#endif // T_SCPDEFS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpsubserviceobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef M_SCPSUBSERVICEOBSERVER_H
+#define M_SCPSUBSERVICEOBSERVER_H
+
+#include <e32std.h>
+#include <e32base.h>
+#include <cchclientserver.h>
+
+/**
+ *  MScpSipConnectionObserver declaration.
+ *  @lib sipconnectionprovider.dll
+ */
+class MScpSubServiceObserver
+    {
+public:
+
+    /**
+     * Handle SubService state change.
+     * @param 
+     */
+    virtual void HandleSubServiceChange( TCCHSubserviceState aState, TInt aError ) = 0;
+        
+    };
+#endif // M_SCPSUBSERVICEOBSERVER_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpsubservicestate.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef T_SCPSUBSERVICESTATE_H
+#define T_SCPSUBSERVICESTATE_H
+
+#include <e32base.h>
+#include <cchclientserver.h>
+
+class CScpSubService;
+
+/**
+*  TScpSubServiceState
+*
+*  @lib sipconnectionprovider.dll
+*/
+class TScpSubServiceState
+    {
+public:
+
+    /**
+     * Constructor
+     */
+    TScpSubServiceState();
+
+    /**
+     * Returns state
+     * @return State
+     */
+    virtual TCCHSubserviceState State() const = 0;
+
+    /**
+     * Returns state
+     * @return State
+     */
+    virtual void EnableL( CScpSubService& aSubService ) const;
+
+    /**
+     * Disable
+     * @param aSubService Sub service
+     */
+    virtual TInt Disable( CScpSubService& aSubService ) const;
+
+    /**
+     * Network found
+     * @param aSubService Sub service
+     */
+    virtual void NetworkFound( CScpSubService& aSubService ) const;
+
+    /**
+     * Network lost
+     * @param aSubService Sub service
+     */
+    virtual void NetworkLost( CScpSubService& aSubService ) const;
+
+    /**
+     * Network not found
+     * @param aSubService Sub service
+     */
+    virtual void NetworkNotFound( CScpSubService& aSubService ) const;
+
+    /**
+     * Service connection failed
+     * @param aSubService Sub service
+     */
+    virtual void ServiceConnectionFailed( CScpSubService& aSubService ) const;
+
+    /**
+     * Service connection failed
+     * @param aSubService Sub service
+     */
+    virtual void ServiceInvalidSettings( CScpSubService& aSubService ) const;
+        
+    /**
+     * Service connected
+     * @param aSubService Sub service
+     */
+    virtual void ServiceConnected( CScpSubService& aSubService ) const;
+
+    /**
+     * Service disconnected
+     * @param aSubService Sub service
+     */
+    virtual void ServiceDisconnected( CScpSubService& aSubService ) const;
+
+    /**
+     * Authentication failed
+     * @param aSubService Sub service
+     */
+    virtual void AuthenticationFailed( CScpSubService& aSubService ) const;
+    
+    /**
+     * Roaming ongoing
+     * @param aSubService Sub service
+     */
+    virtual void Roaming( CScpSubService& aSubService ) const;
+    
+    /**
+     * Service connection canceled
+     * @param aSubService Sub service
+     */
+    virtual void ServiceConnectionCanceled( CScpSubService& aSubService ) const;
+    
+    /**
+     * Registration pending
+     * @param aSubService Sub service
+     */
+    virtual void RegistrationPending( CScpSubService& aSubService ) const;
+    
+    
+protected:
+
+
+    void ChangeState( CScpSubService& aSubService, 
+                      TCCHSubserviceState aState,
+                      TInt aError ) const;
+    };
+
+#endif      // T_SCPSUBSERVICESTATE_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scputility.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2007-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 SCPUTILITY_H
+#define SCPUTILITY_H
+
+#include <cchservice.h>
+#include <cchclientserver.h>
+
+#include "scpdefs.h"
+#include "scpsipconnection.h"
+
+_LIT8( KSipScheme,  "sip:" );
+_LIT8( KSipsScheme, "sips:" );
+_LIT8( KAt, "@" );
+_LIT8( KColon, ":" );
+
+const TInt KSipSchemeMaxLength = 5;
+
+/**
+*  Static utility function for SCP usage.
+*
+*  @lib sipconnectionprovider.dll
+*/
+class TScpUtility
+    {
+public:
+                              
+   /**
+    * Converts a sip connection state to connection event
+    * @param aState sip connection state
+    * @return CCH state
+    */
+    static TScpConnectionEvent ConvertToConnectionEvent( 
+        CScpSipConnection::TConnectionState aState,
+        TInt aError );
+
+   /**
+    * Converts a CCH state to conection event
+    * @param aState sip connection state
+    * @return CCH state
+    */
+    static TScpConnectionEvent ConvertToConnectionEvent( 
+        TCCHSubserviceState aState );
+    
+   /**
+    * Implementation for cleanup item.
+    * Resets and destroys array of the RCSE
+    * entries. 
+    * @param anArray RPointerArray pointer.
+    */
+    static void ResetAndDestroyEntries( TAny* anArray );
+    
+   /**
+    * Converts a sip error to CCH error
+    * @param aState sip error
+    * @return CCH error
+    */
+    static TInt ConvertToCchError( TInt aErrorCode );
+
+    /**
+     * Parse prefix and/or domain from username.
+     * @param aUsername Username with prefix/domain
+     * @param aFormattedUsername parsed username without prefix/domain is stored to this
+     * @return Symbian error code
+     */
+    static TInt RemovePrefixAndDomain( 
+        const TDesC8& aUsername, 
+        RBuf8& aFormattedUsername );
+    
+    /**
+     * Check if passed username is valid.
+     * @param aUsername Username to check
+     * @return True if valid, false if no.
+     */
+    static TBool CheckSipUsername( const TDesC8& aUsername );
+
+    /**
+     * Check if passed password is valid.
+     * @param aPassweord Password to check
+     * @return True if valid, false if no.
+     */
+    static TBool CheckSipPassword( const TDesC8& aPassword );
+    
+    /**
+     * Prefix getter.
+     * @param aUsername used username
+     * @param aPrefix valid prefix
+     */
+    static void GetValidPrefix( const TDesC8& aUsername, TDes8& aPrefix );
+    
+private:
+
+    // Structure that maps protocol specific errors to generic CCH errors
+    struct SCchErrorMapping 
+        {
+        TInt iServiceError;
+        TInt iProtocolError;
+        };
+    
+    // Collection of mapped error codes
+    static const SCchErrorMapping iErrorTable[];
+
+    };
+
+#endif      // SCPUTILITY_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpvmbxhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,130 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_CSCPVMBXHANDLER_H
+#define C_CSCPVMBXHANDLER_H
+
+#include <e32base.h>
+
+#include "scpservicehandlerbase.h"
+#include "ipvmbxobserver.h"
+
+class CScpSubService;
+class CScpServiceStorage;
+
+/**
+*  Vmbx sub service handler.
+*
+*  @lib sipconnectionprovider.dll
+*  @since Series 60 3.2
+*/
+class CScpVmbxHandler : public CScpServiceHandlerBase,
+                        public MIpVmbxObserver 
+    {
+public:  // Constructors and destructor
+ 
+    static CScpVmbxHandler* NewL( CScpSubService& aSubService );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CScpVmbxHandler();
+
+private: // From base class
+    
+    /**
+     * Enables service.
+     */
+    void EnableSubServiceL();
+
+    /**
+     * Checks if another vmbx sub service is already enabled
+     * @return ETrue if enabled
+     */
+    TBool IsAnotherVmbxSubServiceAlreadyEnabled() const;
+
+    /**
+     * Disables service.
+     */
+    TInt DisableSubService();
+
+     /**
+     * Handles messages from Vmbx interface
+     * @param aServiceId Message concers the given service id
+     * @param aMessage Message
+     */
+    void HandleMessage( TUint32 aServiceId, TVmbxMessage aMessage );
+
+    /**
+     * Handlers sip connection event
+     * @param aProfileId Sip profile id
+     * @param aEvent Connection event
+     */
+    void HandleSipConnectionEvent( TUint32 aProfileId,
+                                   TScpConnectionEvent aEvent );
+
+    /**
+     * Returns type of sub service (VoIP, Vmbx, Presence).
+     * @return Type of the sub service.
+     */
+    TCCHSubserviceType SubServiceType() const;
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CScpVmbxHandler( CScpSubService& aSubService );
+
+    /**
+     * 2nd phase constructor.
+     */    
+    void ConstructL();
+
+    /**
+     * Disable sub service.
+     */    
+    void UnsubscribeL();
+
+    /**
+     * SubscribeL
+     */  
+    void SubscribeL();
+
+    /**
+     * Force Vmbx service disable
+     * @param aSelf This object
+     */    
+    static TInt ForceVmbxServiceDisable( TAny* aSelf );
+    
+private: // data
+    
+    /**
+     * Indicates do we have to make resubscribe
+     */
+    TBool iResubscribe;
+    
+#ifdef _DEBUG
+    friend class T_CScpVmbxHandler;
+    friend class T_CScpServiceManager;
+#endif
+    };
+
+#endif      // C_CSCPVMBXHANDLER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/scpvoiphandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef C_CSCPVOIPHANDLER_H
+#define C_CSCPVOIPHANDLER_H
+
+#include <e32base.h>
+
+#include "scpservicehandlerbase.h"
+#include "scppropertyobserver.h"
+
+class CScpProfileHandler;
+class CRepository;
+class CScpPropertyNotifier;
+class CSipClientResolverUtils;
+
+/**
+*  Voip sub service handler.
+*
+*  @lib sipconnectionprovider.dll
+*  @since Series 60 3.2
+*/
+class CScpVoipHandler : public CScpServiceHandlerBase,
+                        public MScpPropertyObserver
+    {
+public:  // Constructors and destructor
+ 
+    static CScpVoipHandler* NewL( CScpSubService& aSubService );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CScpVoipHandler();
+
+public: // From base class
+    /**
+     * Reports about changed property
+     * @param aPropertyValue Value of the property 
+     */
+    void HandlePropertyChanged( TInt aPropertyValue ); 
+
+private: // From base class
+    
+    /**
+     * Enables service.
+     */
+    void EnableSubServiceL();
+
+    /**
+     * Disables service.
+     */
+    TInt DisableSubService();
+            
+    /**
+     * Returns type of sub service (VoIP, Vmbx, Presence).
+     * @return Type of the sub service.
+     */
+    TCCHSubserviceType SubServiceType() const;
+
+    /**
+     * Handlers sip connection event
+     * @param aProfileId Sip profile id
+     * @param aEvent Connection event
+     */
+    void HandleSipConnectionEvent( TUint32 aProfileId,
+                                   TScpConnectionEvent aEvent );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CScpVoipHandler( CScpSubService& aSubService );
+    
+    /**
+     * 2nd phase constructor
+     */
+    void ConstructL();
+    
+    /**
+     * Removes the the routing used for Sip profiles contact header 
+     * from Sip Client routing table
+     */
+    void DeregisterContactHeaderL();
+
+    /**
+     * Finds Sip profile contact header user name for the given sub service
+     * @param aUserName The found user name is inserted to here
+     */
+    void GetSipProfileContactHeaderUserL( RBuf8& aContactHeader ) const;
+
+    /**
+     * Handlers sip connection event
+     * @param aProfileId Sip profile id
+     * @param aEvent Connection event
+     */
+    void HandleSipConnectionEventL( TUint32 aProfileId,
+                                   TScpConnectionEvent aEvent );
+    
+    // Get CallProvider uid from SPSettings
+    TUid GetCallProviderImplementationUidL();
+                                   
+private:
+
+    // Monitors network mode P&S variable, owned.
+    CScpPropertyNotifier* iNetworkMode;
+    
+    // Updates VoIP availibility status to SIP client resolver cenrep-table, owned.
+    CSipClientResolverUtils* iSipClientResolver;
+
+    
+#ifdef _DEBUG
+    CScpPropertyNotifier* iNetworkModeDebug;
+    friend class T_CScpServiceManager;
+    friend class T_CScpVoipHandler;
+#endif
+    };
+
+#endif      // C_CSCPVOIPHANDLER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/inc/sipconnectionprovideruids.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Resource headers for project SCP
+*
+*/
+
+
+#ifndef _SIPCONNECTIONPROVIDER_HRH
+#define _SIPCONNECTIONPROVIDER_HRH
+
+#define KSIPConnectivityPluginUid   0x1027545B
+#define KSIPConnectivityPluginImplUid 0x1027545A
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/bwins/ipvoicemailengineu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,6 @@
+EXPORTS	
+	?IsSubscribed@CIpVmbxInterface@@QBEHKAAH@Z @ 1 NONAME ; int CIpVmbxInterface::IsSubscribed(unsigned long, int &) const
+	?NewL@CIpVmbxEngine@@SAPAV1@AAVCIpVmbxInterface@@@Z @ 2 NONAME ; class CIpVmbxEngine * CIpVmbxEngine::NewL(class CIpVmbxInterface &)
+	?NewL@CIpVmbxInterface@@SAPAV1@AAVMIpVmbxObserver@@@Z @ 3 NONAME ; class CIpVmbxInterface * CIpVmbxInterface::NewL(class MIpVmbxObserver &)
+	?SubscribeL@CIpVmbxInterface@@QAEXKAAVCSIPProfile@@@Z @ 4 NONAME ; void CIpVmbxInterface::SubscribeL(unsigned long, class CSIPProfile &)
+	?UnsubscribeL@CIpVmbxInterface@@QAEXK@Z @ 5 NONAME ; void CIpVmbxInterface::UnsubscribeL(unsigned long)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/eabi/ipvoicemailengineu.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,8 @@
+EXPORTS
+	_ZN13CIpVmbxEngine4NewLER16CIpVmbxInterface @ 1 NONAME
+	_ZN16CIpVmbxInterface10SubscribeLEmR11CSIPProfile @ 2 NONAME
+	_ZN16CIpVmbxInterface12UnsubscribeLEm @ 3 NONAME
+	_ZN16CIpVmbxInterface4NewLER15MIpVmbxObserver @ 4 NONAME
+	_ZNK16CIpVmbxInterface12IsSubscribedEm @ 5 NONAME ABSENT
+	_ZNK16CIpVmbxInterface12IsSubscribedEmRi @ 6 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+// To get the APP_LAYER_PLATFORM_EXPORT_PATH-definition
+#include <platform_paths.hrh>
+
+
+PRJ_PLATFORMS
+default armv5
+
+PRJ_EXPORTS
+../inc/ipvmbxobserver.h             |../../../inc/ipvmbxobserver.h
+../inc/ipvmbxinterface.h            |../../../inc/ipvmbxinterface.h
+../inc/ipvmbxconstants.h            |../../../inc/ipvmbxconstants.h
+
+../rom/ipvoicemailengine.iby CORE_APP_LAYER_IBY_EXPORT_PATH( ipvoicemailengine.iby )
+
+../rom/ipvoicemailengine_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH( ipvoicemailengine_resources.iby )
+
+../loc/ipvoicemailengine.loc APP_LAYER_LOC_EXPORT_PATH( ipvoicemailengine.loc )
+
+
+PRJ_MMPFILES
+ipvoicemailengine.mmp
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/group/ipvoicemailengine.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  mmp-file
+*
+*/
+
+
+// To get the APP_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+
+#include <data_caging_paths.hrh>
+
+TARGET             ipvoicemailengine.dll
+TARGETTYPE         DLL
+UID                0x1000008D     0x1020596F
+
+VENDORID           VID_DEFAULT
+CAPABILITY         CAP_GENERAL_DLL
+
+
+
+SOURCEPATH         ../src
+SOURCE             ipvmbxengine.cpp
+SOURCE             ipvmbxeventmonitor.cpp 
+SOURCE             ipvmbxbase.cpp
+SOURCE             ipvmbxinterface.cpp
+SOURCE             ipvmbxparsetype.cpp
+
+START RESOURCE ipvoicemailengine.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END //RESOURCE
+
+USERINCLUDE        ../inc
+
+// Default system include paths for application layer modules.
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY            euser.lib
+LIBRARY            etext.lib           // for CParaFormatLayer, CCharFormatLayer, CRichText
+LIBRARY            msgs.lib efsrv.lib gsmu.lib smcm.lib //Messaging SMS
+LIBRARY            mceclient.lib
+LIBRARY            serviceprovidersettings.lib
+LIBRARY            sipprofilecli.lib
+LIBRARY            charconv.lib 
+LIBRARY            commonengine.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxbase.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,220 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Creates SMS message if Event in MailBox has occurred
+*
+*/
+
+
+
+#ifndef IPVMBXBASE_H
+#define IPVMBXBASE_H
+
+#include <e32base.h>
+#include <sipprofile.h>
+
+#include "ipvmbxconstants.h"
+
+
+class CMceOutEvent;
+class CMceManager;
+class CSIPProfile;
+class CIpVmbxEngine;
+
+
+/**
+ *  Creates SMS message if Event in MailBox has occurred.
+ *
+ *  @lib ipvmbxengine.dll
+ */
+NONSHARABLE_CLASS( CIpVmbxBase ) : public CBase
+    {
+
+public:
+
+    /** States for base class */
+    enum TIpVmbxBaseStates
+        {
+        ESubscribing,
+        ERegistered,
+        ETerminating,
+        EDisabled
+        };
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aVmbxEngine Instance to engine
+     * @param aVoiceMailUri Address of voice mail account
+     * @param aMceManager Manager instance of IPVME
+     * @return Created base class
+     */
+    static CIpVmbxBase* NewL(
+        CIpVmbxEngine& aVmbxEngine,
+        TDesC8& aVoiceMailUri8,
+        CMceManager& aMceManager );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CIpVmbxBase();
+
+    /**
+     * Set changing parameters for spescfic voice mail account.
+     *
+     * @param aServiceProviderId Service provider id
+     * @param aSipProfile Sip profile
+     */
+    void Initialize(
+        TUint32 aServiceProviderId,
+        CSIPProfile& aSipProfile );
+
+    /**
+     * Subscribes to mail server. If refresh value is not entered,
+     * defaults to KReSubscribe.
+     *
+     * @param aReSubscribe Parameter for refresh initiated by IPVME
+     */
+    void SubscribeL( TInt aReSubscribe );
+
+    /**
+     * Unsubscribes from mail server.
+     */
+    void TerminateEventL();
+
+    /**
+     * Cleans MceEvent instance.
+     */
+    void DeleteEvent();
+
+    /**
+     * Cancel resubscribe timer
+     */
+    void Cancel();
+
+    /**
+     * Get service provider data
+     *
+     * @return Service id
+     */
+    TUint32 ServiceProviderId() const;
+
+    /**
+     * Account uri to which app base has connected
+     *
+     * @return MBX account
+     */
+    const TDesC8& VmbxUrl() const;
+
+    /**
+     * Sets base state to connected state and starts
+     * resubscription process.
+     */
+    void SetStateRegistered();
+
+    /**
+     * State of base class
+     *
+     * @return State of base class
+     */
+    CIpVmbxBase::TIpVmbxBaseStates State() const;
+
+    /**
+     * Save current message state of mailbox
+     *
+     * @param Total messages
+     * @param New messages
+     */
+    void SetAccountMessageCount( TInt aTotalCount, TInt aNewCount );
+
+    /**
+     * Get previous message state of mailbox
+     *
+     * @param Total messages
+     * @param New messages
+     */
+    void AccountMessageCount( TInt& aTotalCount, TInt& aNewCount);
+
+private:
+
+    void ConstructL( TDesC8& aVoiceMailUri8 );
+
+    /**
+     * C++ default constructor.
+     *
+     * @param aVmbxEngine Engine instance to send status messages
+     * @param aVoiceMailUri Uri which this base class will subscribe
+     * @param aMceManager Required manager instance for outbound connections
+     */
+    CIpVmbxBase(
+        CIpVmbxEngine& aVmbxEngine,
+        CMceManager& aMceManager );
+
+private:    // Data
+
+    /**
+     * SIP profile information
+     * Not own.
+     */
+    CSIPProfile* iSipProfile;
+
+    /**
+     * MO events
+     * Own.
+     */
+    CMceOutEvent* iMceOutEvent;
+
+    /**
+     * MCE server connection
+     */
+    CMceManager& iMceManager;
+
+    /**
+     * State of base class
+     */
+    TIpVmbxBaseStates iState;
+
+    /**
+     * Id of service this base class is using
+     */
+    TUint32 iServiceProviderId;
+
+    /**
+     * Uri this base class is monitoring
+     */
+    TBuf8< KMaxIpVoiceMailBoxUriLength > iVmbxUri8;
+
+    /**
+     * Server total messages
+     */
+    TInt iTotalMessageCount;
+
+    /**
+     * Server new messages
+     */
+    TInt iNewMessageCount;
+
+    /**
+     * Amount of pending resubscribes
+     */
+    TInt iPendingResubscribeCount;
+
+    /**
+     * Message sender
+     */
+    CIpVmbxEngine& iVmbxEngine;
+
+    EUNIT_IMPLEMENTATION
+    };
+
+#endif // IPVMBXBASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxconstants.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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
+*
+*/
+
+
+
+
+#ifndef IPVMBXCONSTANTS_H
+#define IPVMBXCONSTANTS_H
+
+#include <spdefinitions.h>
+
+const TInt KMaxIpVoiceMailBoxUriLength = KSPMaxDesLength;
+
+
+
+#ifdef EUNIT_TEST_IMPLEMENTATION
+    
+    #define EUNIT_IMPLEMENTATION \
+        friend class UT_CIpVmbxTimer;\
+        friend class UT_CIpVmbxInterface;\
+        friend class UT_CIpVmbxEngine;\
+        friend class UT_CIpVmbxBase;\
+        friend class UT_TIpVmbxEventMonitor;\
+        friend class CIpVmbxBaseStub;\
+        friend class CIpVmbxEngineStub;
+        
+#else
+        
+    #define EUNIT_IMPLEMENTATION
+        
+#endif
+
+#endif // IPVMBXCONSTANTS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxengine.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,338 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Creates SMS message if Event in MailBox has occurred
+*
+*/
+
+
+
+#ifndef IPVMBXENGINE_H
+#define IPVMBXENGINE_H
+
+#include <msvapi.h>
+#include <mcetransactiondatacontainer.h>
+#include <stringresourcereader.h>
+
+#include "ipvmbxinterface.h"
+#include "ipvmbxbase.h"
+#include "ipvmbxparsetype.h"
+
+
+class CSIPProfile;
+class CSPSettings;
+class CIpVmbxBase;
+class TIpVmbxEventMonitor;
+
+
+/**
+ *  Creates SMS message if Event in MailBox has occurred.
+ *
+ *  @lib IpVmbxAppEngine.lib
+ */
+NONSHARABLE_CLASS( CIpVmbxEngine ) :
+    public CBase,
+    public MMsvSessionObserver
+    {
+
+public:  // Constructors and destructor
+
+    /** Internal state messages */
+    enum TIpVmbxMessages
+        {
+        EEngineUndefined,
+        EEngineSubscribed,
+        EEngineTerminated,
+        EEngineSubscribeRejected,
+        EEngineIncorrectAccount,
+        EEngineSmsError,
+        EEngineSmsOom,
+        EEngineNetworkLost,
+        EEngineNetworkError,
+        EEngineFatalNetworkError
+        };
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aInterface Instance to interface for status message sending
+     */
+    IMPORT_C static CIpVmbxEngine* NewL( CIpVmbxInterface& aInterface );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CIpVmbxEngine();
+
+
+public: // New functions
+
+    /**
+     * Starts subscription to MailBox when SIP profile has registered. Only
+     * one of these parameters can be used at same time.
+     *
+     * @param aServiceProviderId Service provider id of mail settings
+     * @param aSipProfileId Connected SIP profile id
+     */
+    void SubscribeProfileL(
+        TUint32 aServiceProviderId,
+        CSIPProfile& aSipProfile );
+
+    /**
+     * Registration status of profile.
+     *
+     * @param aServiceProviderId Provider id which status is queried
+     * @param aProfileSubscribe Status of subscription
+     * @return KErrNotFound if profile does not exist
+     */
+    TInt ProfileSubscribed(
+        TUint32 aServiceProviderId,
+        TBool& aProfileSubscribed );
+
+    /**
+     * Resolve address of base class using recipient address
+     *
+     * @param aId Recipient
+     * @return Address of base class
+     */
+    CIpVmbxBase* SubscriptionByRecipient( const TDesC8& aRecipient8 );
+
+    /**
+     * EventMonitor has received event and the event
+     * will be gained and checked if it requires any action
+     *
+     * @param aRecipient Recipient of event
+     */
+#ifdef EUNIT_TEST_IMPLEMENTATION
+    virtual void EventReceivedL( const TDesC8& aRecipient8 );
+#else
+    void EventReceivedL( const TDesC8& aRecipient8 );
+#endif
+
+    /**
+     * Disconnects IPVME from voice mail -server
+     *
+     * @param aServiceProviderId Provider id to be unregistered
+     */
+    void UnsubscribeProfileL( TUint32 aServiceProviderId );
+
+    /**
+     * Cleanup base class and free resources
+     *
+     * @pre Unsubscribe has been sent to voice mail -server
+     */
+    void CleanVmbxBase();
+
+    /**
+     * Send status messages to observers
+     *
+     * @param aServiceProviderId Service provider id
+     * @param aMessage MIpVmbxObserver status messages
+     */
+#ifdef EUNIT_TEST_IMPLEMENTATION
+
+    virtual void HandleMessage(
+        TUint32 aServiceProviderId,
+        CIpVmbxEngine::TIpVmbxMessages aMessage );
+
+#else
+
+    void HandleMessage(
+        TUint32 aServiceProviderId,
+        CIpVmbxEngine::TIpVmbxMessages aMessage );
+
+#endif
+
+    /**
+     * Fetch instance to base class using service id
+     *
+     * @param aServiceProviderId Service id to indentify base class
+     * @return Instance to base
+     */
+    CIpVmbxBase* SubscriptionByProvider( TUint32 aServiceProviderId );
+
+
+protected:
+
+// from base class MMsvSessionObserver
+
+    /**
+     * From base class MMsvSessionObserver
+     * For notification of events from a Message Server session
+     *
+     * @since Series 60 3.0
+     * @param aEvent Indicates the event type,
+     * @param*aArg1 Event type-specific argument value
+     * @param*aArg2 Event type-specific argument value
+     * @param*aArg3 Event type-specific argument value
+     */
+    virtual void HandleSessionEventL( TMsvSessionEvent aEvent, TAny *aArg1,
+        TAny *aArg2, TAny *aArg3 );
+
+
+private:
+
+    void ConstructL();
+
+    /**
+     * C++ default constructor.
+     *
+     * @param aInterface Instance to interface for status message sending
+     */
+    CIpVmbxEngine( CIpVmbxInterface& aInterface );
+
+    /**
+     * For parsing the content of NOTIFY and some optional messages.
+     * If function completes without errors, supplied content is cut so that
+     * only possible optional header data is left.
+     *
+     * @param aCreateSms ETrue if user has to be informed (SMS).
+     * @param aContent Notify content to be parsed
+     * @param aTotalMessages Total messages
+     * @param aNewMessages New messages
+     * @param aFrom Voice mail account
+     */
+    void ParseNotifyContentL(
+        TBool& aCreateSms,
+        TDes8& aContent8,
+        TDes8& aTotalMessages8,
+        TDes8& aNewMessages8,
+        TDes8& aFrom8 ) const;
+
+    /**
+     * Creates SMS message and sends it
+     *
+     * @param aFrom MBX uri
+     * @param aMessageBody Generated message
+     */
+    void CreateSMSMessageL( const TDesC8& aFrom8, const TDesC8& aMessageBody8 );
+
+    /**
+     * For parsing optional headers from content of NOTIFY.
+     *
+     * @param aContent Notify content
+     * @param aMessageBody Message body for optional parameters
+     */
+    void ParseOptionalHeadersL(
+        const TDesC8& aContent8,
+        TDes8& aMessageBody8 ) const;
+
+    /**
+     * Read localized content to message body
+     *
+     * @param aTotalMessages Total messages
+     * @param aNewMessages New messages
+     * @param aMessagesBody Message body
+     */
+    void ReadResourcesL(
+            const TDesC8& aTotalMessages8,
+            const TDesC8& aNewMessages8,
+            TDes8& aMessagesBody8 );
+
+    /**
+     * Creates and verifies message body
+     *
+     * @param aContent Notify content
+     * @param aTotal Total messages
+     * @param aNew New messages
+     * @param aFrom MBX uri
+     * @param aMessageBody Message body
+     */
+    void CreateMessageBodyL(
+        const TDesC8& aContent8,
+        const TDesC8& aTotal8,
+        const TDesC8& aNew8,
+        TDes8& aFrom8,
+        TDes8& aMessageBody8 );
+
+    /**
+     * General optional parameter parser
+     *
+     * @param aTagPtr8 Source text
+     * @param aResourceReader Instance to resource reader( to prevent
+     *        double instantiation )
+     * @return Translation, NULL if not found.
+     */
+    HBufC* TranslateTagL(
+        const TDesC8& aTagPtr8,
+        CStringResourceReader& aResourceReader ) const;
+
+    /**
+     * Fetch message part from whole message. It gets first part from
+     * provided string and checks validity of message part.
+     *
+     * @param aContent8 Source text
+     * @return Message part, empty if content was not valid.
+     */
+    TPtrC8 FetchMessagePartL( const TDesC8& aContent8 ) const;
+
+    /**
+     * Check name header from message part.
+     *
+     * @param aNameHeader8 Source text
+     */
+    void TestNamePartL( const TDesC8& aNameHeader8 ) const;
+
+    /**
+     * Check value header from message part.
+     *
+     * @param aValueHeader8 Source text
+     */
+    void TestValuePartL( const TDesC8& aValueHeader8 ) const;
+
+
+private: // data
+
+    /**
+     * MCE server connection
+     * Own.
+     */
+    CMceManager* iMceManager;
+
+    /**
+     * Event content
+     */
+    TMceTransactionDataContainer iEventData;
+
+    /**
+     * MCE Event observer
+     * Own.
+     */
+    TIpVmbxEventMonitor* iIpVmbxEventMonitor;
+
+    /**
+     * Interface
+     */
+    CIpVmbxInterface& iInterface;
+
+    /**
+     * Vmbx parameters
+     * Own.
+     */
+    CSPSettings* iServiceSettings;
+
+    /**
+     *  Array of current Base classes
+     */
+    RPointerArray< CIpVmbxBase > iVmbxBaseArray;
+
+    /**
+     *  Indicates if VME is already running
+     */
+    TBool iBasicServicesRunning;
+
+
+    EUNIT_IMPLEMENTATION
+    };
+
+#endif      // IPVMBXENGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxeventmonitor.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Events from VoiceMailBox -server
+*
+*/
+
+
+
+#ifndef IPVMBXEVENTMONITOR_H
+#define IPVMBXEVENTMONITOR_H
+
+
+#include <mceeventobserver.h>
+
+
+class CIpVmbxEngine;
+
+
+/**
+ *  Handles and processes events from VoiceMailBox -server
+ *
+ *  @lib IPVoiceMailAppEngine.lib
+ */
+NONSHARABLE_CLASS( TIpVmbxEventMonitor ) : public MMceEventObserver
+    {
+    
+public:  // Constructors and destructor
+    
+    /**
+     * C++ default constructor.
+     * 
+     * @param Instance to engine for message sending.
+     */
+    TIpVmbxEventMonitor( CIpVmbxEngine& aEngine );
+    
+    
+public:
+
+// From base class MMceEventObserver
+
+    /**
+     * From base class MMceEventObserver
+     * The state of the event has changed
+     * 
+     * @param aEvent, the event that has changed
+     * @param aContainer, if present, holds details of
+     *        transaction causing state change
+     */
+    void EventStateChanged(
+        CMceEvent& aEvent,
+        TMceTransactionDataContainer* aContainer );
+            
+    /**
+     * From base class MMceEventObserver
+     * The state of the event has changed
+     * 
+     * @param aEvent, event received notification
+     * @param aContainer, if present, holds details of
+     *        transaction causing state change
+     */
+    void NotifyReceived(
+        CMceEvent& aEvent,
+        TMceTransactionDataContainer* aContainer );
+                                
+    /**
+     * From base class MMceEventObserver
+     * The state of the event used by the refer has changed
+     * 
+     * @param aEvent, the event that has changed
+     * @param aActive, ETrue if connection active, EFalse if connection 
+     *        inactive
+     */
+    void EventConnectionStateChanged( CMceEvent& aEvent, TBool aActive );
+                    
+    /**
+     * From base class MMceEventObserver
+     * An error has occurred concerning a specific SIP event
+     * Note, that each error causes the event state to be ETerminated
+     * 
+     * @param aEvent, The event raising the error
+     * @param aError, Error code
+     */
+    void Failed( CMceEvent& aEvent, TInt aError );
+        
+    
+private:    // Data
+
+    /**
+     * Instance to engine
+     */
+    CIpVmbxEngine& iEngine;
+    
+    };
+
+#endif      // IPVMBXEVENTMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxinterface.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 to control voice mail engine
+*
+*/
+
+
+
+
+#ifndef C_IPVMBXINTERFACE_H
+#define C_IPVMBXINTERFACE_H
+
+#include <e32base.h>
+
+#include "ipvmbxobserver.h"
+#include "ipvmbxconstants.h"
+
+
+class CIpVmbxEngine;
+class CSIPProfile;
+
+
+/**
+ *  Interface class for IPVoiceMailEngine
+ *
+ *  This class is used to instantiate
+ *  IPVoiceMailEngine. It offers functions to to control
+ *  subscription state to Voice mail servers.
+ *
+ *  @lib IPVoiceMailAppEnginedll.lib
+ */
+
+NONSHARABLE_CLASS( CIpVmbxInterface ) : public CBase
+    {
+    
+public:
+
+    /**
+     * Two-phased constructor.
+     * 
+     * @param aEngineObserver Observer instance for status messages (SCP)
+     * @return Interface to IPVME
+     */
+    IMPORT_C static CIpVmbxInterface* NewL( 
+        MIpVmbxObserver& aEngineObserver );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CIpVmbxInterface();
+
+    /**
+     * Subscribes service to ip voice mail server
+     *
+     * @param aServiceProviderId Service to be subscribed
+     * @param aSipProfile Sip profile used for subscription
+     */
+    IMPORT_C void SubscribeL( 
+        TUint32 aServiceProviderId, 
+        CSIPProfile& aSipProfile );
+
+    /**
+     * Un-subscribes service from ip voice mail server
+     *
+     * @param aServiceProviderId Service to be un-subscribed
+     */
+    IMPORT_C void UnsubscribeL( TUint32 aServiceProviderId );
+
+    /**
+     * Check if service is subscribed to ip voice mail server
+     *
+     * @param aServiceProviderId Service which connection status will be 
+     *        checked
+     * @param aProfileSubscribed Is subscribed
+     * @return KErrNotFound if instance does not exist
+     */
+    IMPORT_C TInt IsSubscribed( 
+        TUint32 aServiceProviderId, 
+        TBool& aProfileSubscribed ) const;
+    
+    /**
+     * Send messages through observer when subscribe status of service 
+     * is changed
+     *
+     * @param aServiceProviderId Service which state has changed
+     * @param aMessage Service subscription state
+     */
+    void SendMessage( 
+        TUint32 aServiceProviderId, 
+        MIpVmbxObserver::TVmbxMessage aMessage );
+
+
+private:
+
+    /**
+     * Constructor.
+     * 
+     * @param aEngineObserver Observer for messages (SCP).
+     */
+    CIpVmbxInterface( MIpVmbxObserver& aEngineObserver );
+
+    void ConstructL();
+
+
+private: // data
+
+    /**
+     * Engine class
+     * Own.
+     */
+    CIpVmbxEngine* iIpVmbxEngine;
+    
+    /**
+     * Observer instance (to SCP)
+     */
+    MIpVmbxObserver& iEngineObserver;
+
+    
+    EUNIT_IMPLEMENTATION
+    };
+
+#endif // C_IPVMBXINTERFACE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxlogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* 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:  Logging macros
+*
+*/
+
+
+#ifndef IPVMBXLOGGER_H
+#define IPVMBXLOGGER_H
+
+
+#ifdef _DEBUG
+
+    #include <e32debug.h>
+    #define DPRINT_ON
+
+#endif // _DEBUG
+
+
+#ifdef DPRINT_ON // RDebug
+
+    #define IPVME( A )                 L##A
+    #define IPVMESTUPID( A )           IPVME( A )
+    #define IPVMESTR( A )              IPVMESTUPID( "[IPVME]" ) L##A
+    #define IPVMESTRCAST( A )          TPtrC((const TText *) IPVMESTR( A ))
+    
+    #define IPVMEPRINT( D )            { RDebug::Print( IPVMESTRCAST( D ) ); }
+    #define IPVMEPRINT2( A, B )        { RDebug::Print( IPVMESTRCAST( A ), B ); }
+    #define IPVMEPRINT3( A, B, C )     { RDebug::Print( IPVMESTRCAST( A ), B, C ); }
+    #define IPVMEPRINT4( A, B, C, D )  { RDebug::Print( IPVMESTRCAST( A ), B, C, D ); }
+
+#else // No debug prints
+
+    #define IPVMEPRINT( A )
+    #define IPVMEPRINT2( A, B )
+    #define IPVMEPRINT3( A, B, C )
+    #define IPVMEPRINT4( A, B, C, D )
+
+#endif
+
+
+#endif // IPVMBXLOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxobserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 for IPVoiceMailEngine. Used to deliver
+*                subscription status.
+*
+*/
+
+
+
+#ifndef M_IPVMBXOBSERVER_H
+#define M_IPVMBXOBSERVER_H
+
+#include <e32def.h>
+
+/**
+ *  Observer class for IPVoiceMailEngine
+ *
+ *  This class must be herited to receive IPVoiceMailEngine's
+ *  subscription status messages.
+ *
+ *  @lib IPVoiceMailAppEnginedll.lib
+ */
+class MIpVmbxObserver
+    {
+
+public:
+
+    /** Subscribtion states */
+    enum TVmbxMessage
+        {
+        ESubscribed,
+        EUnsubscribed,
+        ENoMemory,
+        ESmsError,
+        ENetworkError,
+        EIncorrectSettings,
+        EFatalNetworkError
+        };
+
+    /**
+     * This function is called to inform status of subscribe and un-subscribe
+     *
+     * @param aSipProfileId Sip profile conserning about delivered message
+     * @param aMessage Subscribtion status
+     */
+    virtual void HandleMessage( 
+        TUint32 aServiceProviderId, 
+        TVmbxMessage aMessage ) = 0;
+
+    };
+
+
+#endif // M_IPVMBXOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxpanic.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,38 @@
+/*
+* 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:  Panic procedure
+*
+*/
+
+
+
+
+#ifndef IPVMBXPANIC_H
+#define IPVMBXPANIC_H
+
+#include <e32base.h>
+
+_LIT( KIpVmePanic, "IpVmePanic" );
+
+/**
+ * Provides panic message with id and value
+ *
+ * @param Error value
+ */
+inline void Panic( TInt aErr )
+    {
+    User::Panic( KIpVmePanic, aErr );
+    }
+
+#endif // IPVMBXPANIC_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxparsetype.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,98 @@
+/*
+* 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:  Parsing options for optional data
+*
+*/
+
+
+
+#ifndef TIPVMBXPARSETYPE_H
+#define TIPVMBXPARSETYPE_H
+
+#include <e32base.h>
+
+
+/**
+ *  Parsing options for content
+ *
+ *  @lib ipvoicemailengine.dll
+ */
+class TIpVmbxParseType
+    {
+
+public:
+
+    /**  Supported parse types */
+    enum TParseTypes
+        {
+        EDetailTo,
+        EDetailToShort,
+        EDetailFrom,
+        EDetailFromShort,
+        EDetailSubject,
+        EDetailSubjectShort,
+        EDetailDate,
+        EDetailPriority,
+        EDetailId
+        };
+
+
+    /**
+     * Constructor.
+     *
+     * @param aType Type to be parsed
+     */
+    TIpVmbxParseType( const TParseTypes aType );
+
+    TIpVmbxParseType();
+
+    /**
+     * Tag this instance is presenting
+     *
+     * @return Tag
+     */
+    const TDesC8& Tag() const;
+
+    /**
+     * Tag this instance is presenting
+     *
+     * @return Tag
+     */
+    TInt32 ResourceId() const;
+
+    /**
+     * Set new tag
+     *
+     * @param aType Set different parse type
+     */
+    void Set( const TParseTypes aType );
+
+
+private: // data
+
+    /**
+     * Tag
+     */
+    const TDesC8* iTag;
+
+    /**
+     * Resource matching to tag
+     */
+    TInt32 iResourceId;
+
+    };
+
+#include "ipvmbxparsetype.inl"
+
+#endif // TIPVMBXPARSETYPE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/inc/ipvmbxparsetype.inl	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Operator implementation
+*
+*/
+
+
+
+
+// -----------------------------------------------------------------------------
+// Postfix increment implementation
+// -----------------------------------------------------------------------------
+//
+inline TIpVmbxParseType::TParseTypes operator++(
+    TIpVmbxParseType::TParseTypes &aValue,
+    TInt )
+    {
+    return aValue = ( TIpVmbxParseType::TParseTypes )( aValue + 1 );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/loc/ipvoicemailengine.loc	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,82 @@
+/*
+* 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:  This file contains the localised strings for IPVoiceMailAppEngine.dll
+*
+*/
+
+
+//  LOCALISATION STRINGS
+
+
+// d: there is only 1 new message and no old messages
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_new_voice_message "1 new voice message waiting in total 1 message "
+
+// d: there is 1 new message and one or more old messages
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_new_and_old_voice_msg "1 new voice message waiting in total %N messages "
+
+// d: there are several new messages waiting
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_new_voice_messages "%0N new messages waiting, in total %1N messages"
+
+// d: message account the new voice message
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_vm_msg_account "Message account:\n"
+
+// d: there are several headers received at the same time
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_vm_header_count "Message %N"
+
+// d: to address received in the message header
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_vm_to "To:\n"
+
+// d: from address received in the message header
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_vm_from "From:\n"
+
+// d: subject received in the message header
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_vm_subject "Subject:\n"
+
+// d: date received in the message header
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_vm_date "Date:\n"
+
+// d: priority received in the message header
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_vm_priority "Priority:\n"
+
+// d: message-id received in the message header
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_vm_msg_id "Message-ID:\n"
+
+// d: message amount is unknown.
+// l:set_text_pane_t1
+// r:VoIP Rel3.0
+#define qtn_voip_new_voice_messages_sum_unknown "New voice messages waiting"
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/rom/ipvoicemailengine.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Notifies user about messages left into ip voice mail box
+*
+*/
+
+
+#ifndef IPVOICEMAILENGINE_IBY
+#define IPVOICEMAILENGINE_IBY
+    
+#include <data_caging_paths_for_iby.hrh>
+    
+file=ABI_DIR/BUILD_DIR/ipvoicemailengine.dll          SHARED_LIB_DIR/ipvoicemailengine.dll
+
+#endif // IPVOICEMAILENGINE_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/rom/ipvoicemailengine_resources.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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:  
+*
+*/
+
+
+#ifndef IPVOICEMAILENGINE_RESOURCES_IBY
+#define IPVOICEMAILENGINE_RESOURCES_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+    
+data=DATAZ_/RESOURCE_FILES_DIR/ipvoicemailengine.rsc     RESOURCE_FILES_DIR/ipvoicemailengine.rsc
+
+#endif // IPVOICEMAILENGINE_RESOURCES_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvmbxbase.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,273 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Creates SMS message if Event in MailBox has occurred.
+*
+*/
+
+
+
+#include <mceoutevent.h>
+#include <mcemanager.h>
+
+#include "ipvmbxbase.h"
+#include "ipvmbxlogger.h"
+#include "ipvmbxpanic.h"
+#include "ipvmbxengine.h"
+
+
+const TInt KMinReSubscribeDelta = 600; // 10 min
+const TInt KMaxReSubscribeDelta = 86400; // 24 h
+
+_LIT8( KEventHeader8, "message-summary" );
+
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CIpVmbxBase::CIpVmbxBase(
+    CIpVmbxEngine& aVmbxEngine,
+    CMceManager& aMceManager ) :
+        iSipProfile( NULL ),
+        iMceOutEvent( NULL ),
+        iMceManager( aMceManager ),
+        iVmbxEngine( aVmbxEngine )
+    {
+    }
+
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxBase::ConstructL( TDesC8& aVoiceMailUri8 )
+    {
+    if ( iVmbxUri8.MaxLength() >= aVoiceMailUri8.Length() )
+        {
+        iVmbxUri8.Copy( aVoiceMailUri8 );
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CIpVmbxBase* CIpVmbxBase::NewL(
+    CIpVmbxEngine& aVmbxEngine,
+    TDesC8& aVoiceMailUri8,
+    CMceManager& aMceManager )
+    {
+    IPVMEPRINT( "CIpVmbxBase::NewL" );
+
+    CIpVmbxBase* self = new( ELeave ) CIpVmbxBase(
+        aVmbxEngine,
+        aMceManager );
+    CleanupStack::PushL( self );
+    self->ConstructL( aVoiceMailUri8 );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+CIpVmbxBase::~CIpVmbxBase()
+    {
+    IPVMEPRINT( "CIpVmbxBase::~CIpVmbxBase - IN" );
+
+    delete iMceOutEvent;
+
+    IPVMEPRINT( "CIpVmbxBase::~CIpVmbxBase - OUT" );
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxBase::Initialize(
+    TUint32 aServiceProviderId,
+    CSIPProfile& aSipProfile )
+    {
+    iServiceProviderId = aServiceProviderId;
+    iSipProfile = &aSipProfile;
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxBase::SubscribeL( TInt aReSubscribe  )
+    {
+    IPVMEPRINT( "CIpVmbxAppBase::SubscribeL - IN" );
+
+    if ( aReSubscribe < KMinReSubscribeDelta )
+        {
+        // Resubscribe shouldn't occur too often
+        aReSubscribe = KMinReSubscribeDelta;
+        }
+    else
+        if ( aReSubscribe > KMaxReSubscribeDelta )
+            {
+            // Resubscribe shouldn't occur too infrequently
+            aReSubscribe = KMaxReSubscribeDelta;
+            }
+
+    TUint32 resubscribeInterval = ( TUint32 ) aReSubscribe;
+        
+    IPVMEPRINT2( "CIpVmbxAppBase::SubscribeL - resubscribe interval=%d",
+        resubscribeInterval );
+    
+    __ASSERT_DEBUG( !iMceOutEvent, Panic( KErrAlreadyExists ) );
+
+    if ( !iMceOutEvent )
+        {
+        iMceOutEvent = CMceOutEvent::NewL(
+            iMceManager,
+            *iSipProfile,
+            iVmbxUri8,
+            KEventHeader8,
+            resubscribeInterval );
+        }
+    else
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    if ( CMceEvent::EIdle == iMceOutEvent->State() )
+        {
+        iMceOutEvent->SubscribeL();
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    iState = ESubscribing;
+
+    IPVMEPRINT( "CIpVmbxAppBase::SubscribeL - OUT" );
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxBase::TerminateEventL()
+    {
+    IPVMEPRINT( "CIpVmbxAppBase::TerminateEventL - IN" );
+
+    if ( iMceOutEvent && CMceEvent::EActive == iMceOutEvent->State() )
+        {
+        iMceOutEvent->TerminateL();
+        iState = ETerminating;
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+
+    IPVMEPRINT( "CIpVmbxAppBase::TerminateEventL - OUT" );
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxBase::DeleteEvent()
+    {
+    delete iMceOutEvent;
+    iMceOutEvent = NULL;
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxBase::Cancel()
+    {
+    iState = EDisabled;
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TUint32 CIpVmbxBase::ServiceProviderId() const
+    {
+    return iServiceProviderId;
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+const TDesC8& CIpVmbxBase::VmbxUrl() const
+    {
+    return iVmbxUri8;
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxBase::SetStateRegistered()
+    {
+    iState = ERegistered;
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+CIpVmbxBase::TIpVmbxBaseStates CIpVmbxBase::State() const
+    {
+    return iState;
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxBase::SetAccountMessageCount( TInt aTotalCount, TInt aNewCount )
+    {
+    iTotalMessageCount = aTotalCount;
+    iNewMessageCount = aNewCount;
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxBase::AccountMessageCount( TInt& aTotalCount, TInt& aNewCount )
+    {
+    aTotalCount = iTotalMessageCount;
+    aNewCount = iNewMessageCount;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvmbxengine.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1258 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Creates SMS message if Event in MailBox has occurred.
+*
+*/
+
+
+
+// Include hierarchy change can't be done. Smuthdr.h uses
+// other files from messaging/sms (smsstd.h and smutset.h). It doesn't seem
+// to find them without old way to declare include folder using SYSTEMINCLUDE.
+//
+#include <smuthdr.h>/*messaging/\sms/\*/
+#include <msvuids.h>
+#include <txtrich.h>
+#include <spsettings.h>
+#include <spproperty.h>
+#include <utf.h>
+#include <mcemanager.h>
+#include <ipvoicemailengine.rsg>
+
+#include "ipvmbxengine.h"
+#include "ipvmbxeventmonitor.h"
+#include "ipvmbxbase.h"
+#include "ipvmbxlogger.h"
+#include "ipvmbxconstants.h"
+#include "ipvmbxpanic.h"
+
+
+const TUid KAppUID = { 0x1020596F };
+const TInt KMaxMessageDigits = 10;
+const TInt KAccountTextLength = 21;
+const TInt KOneChar = 1;
+const TInt KTwoChars = 2;
+const TInt KSmsLength = 160;
+const TInt KTotalLength = 2;
+const TInt KTotalOldLength = 3;
+const TInt KMinIpVoiceMailBoxUriLength = 3;
+const TInt KSpecialNameCharsCount = 10;
+const TInt KMaxMsgDescriptions = 99;
+
+_LIT( KEndLine, "\n" );
+_LIT( KTotal, "%N" );
+_LIT( KTotalNew, "%0N" );
+_LIT( KIpVmbxAppEngineResourceFileDirectory, "\\resource\\" );
+_LIT( KIpVmbxAppEngineResourceFileName, "ipvoicemailengine.rsc" );
+_LIT( KSipString, "sip:");
+_LIT( KOptionalSeparator, "\n\n" );
+_LIT8( KTotalOld, "%1N" );
+_LIT8( KOneMessage, "1" );
+_LIT8( KNoMessages, "0" );
+_LIT8( KMessagesWaiting8, "messages-waiting" );
+_LIT8( KNewMessages8, "yes" );
+_LIT8( KMessageAccount8, "message-account" );
+_LIT8( KVoiceMessage8, "voice-message" );
+_LIT8( KSlash8, "/" );
+_LIT8( KColon8, ":" );
+_LIT8( KCrlf8, "\r\n" );
+_LIT8( KEndLine8, "\n" );
+_LIT8( KHTab8, "\t");
+_LIT8( KSpace8, " ");
+
+const TText KNameDigitLowest = '\x30';
+const TText KNameDigitHighest = '\x39';
+const TText KNameCharUpLowest = '\x41';
+const TText KNameCharUpHighest = '\x5a';
+const TText KNameCharLowLowest = '\x61';
+const TText KNameCharLowHighest = '\x7a';
+// Legal characters in name header
+// 2d, 2e, 21, 25, 2a, 5f, 2b, 60, 27, 7e
+const TText8 KSpecialNameChars[KSpecialNameCharsCount] =
+    {
+    '-',
+    '.',
+    '!',
+    '%',
+    '*',
+    '_',
+    '+',
+    '`',
+    '\'',
+    '~'
+    };
+const TText KSpace = '\x20';
+const TText KValueLowestChar = KSpace;
+const TText KValueHighestChar = '\xfd';
+const TText KCr = '\x0d';
+const TText KLf = '\x0a';
+const TText KHTab = '\x09';
+
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CIpVmbxEngine::CIpVmbxEngine( CIpVmbxInterface& aInterface ):
+    iEventData(),
+    iInterface( aInterface )
+    {
+    }
+
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::ConstructL()
+    {
+    // One manager = one event observer (restricted)
+    iIpVmbxEventMonitor = new ( ELeave ) TIpVmbxEventMonitor( *this );
+    }
+
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CIpVmbxEngine* CIpVmbxEngine::NewL( CIpVmbxInterface& aInterface )
+    {
+    IPVMEPRINT( "CIpVmbxEngine::NewL" );
+
+    CIpVmbxEngine* self = new( ELeave ) CIpVmbxEngine( aInterface );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CIpVmbxEngine::~CIpVmbxEngine()
+    {
+    IPVMEPRINT( "CIpVmbxEngine::~CIpVmbxEngine - IN" );
+
+    iVmbxBaseArray.ResetAndDestroy();
+    iVmbxBaseArray.Close();
+
+    delete iMceManager;
+    delete iServiceSettings;
+    delete iIpVmbxEventMonitor;
+
+    IPVMEPRINT( "CIpVmbxEngine::~CIpVmbxEngine - OUT" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// Starts subscription to VoiceMailBox -server
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::SubscribeProfileL(
+    TUint32 aServiceProviderId,
+    CSIPProfile& aSipProfile )
+    {
+    IPVMEPRINT( "CIpVmbxEngine::SubscribeProfileL - IN" );
+
+    if ( !iBasicServicesRunning )
+        {
+        iServiceSettings = CSPSettings::NewL();
+        // one manager recommended for one component
+        iMceManager = CMceManager::NewL( KAppUID, &iEventData );
+        iMceManager->SetEventObserver( iIpVmbxEventMonitor );
+        iBasicServicesRunning = ETrue;
+        }
+
+    HBufC16* voiceMailUri16 = HBufC16::NewLC( KMaxIpVoiceMailBoxUriLength );
+    TPtr16 ptrvoiceMailUri16( voiceMailUri16->Des() );
+    TInt reSubscribe = 0;
+
+    // Fetch MWI address
+    CSPProperty* mwiAddress = CSPProperty::NewLC();
+    User::LeaveIfError( iServiceSettings->FindPropertyL(
+        aServiceProviderId,
+        ESubPropertyVMBXMWIAddress,
+        *mwiAddress ) );
+    User::LeaveIfError( mwiAddress->GetValue( ptrvoiceMailUri16 ) );
+    if ( ptrvoiceMailUri16.Length() < KMinIpVoiceMailBoxUriLength )
+        {
+        IPVMEPRINT( "CIpVmbxEngine::SubscribeProfileL - MWI not found, Leaving..." );
+        User::Leave( KErrNotFound );
+        }
+    IPVMEPRINT( "CIpVmbxEngine::SubscribeProfileL - MWI found" );
+    if ( KErrNotFound == ptrvoiceMailUri16.Find( KSipString ) )
+        {
+        ptrvoiceMailUri16.Insert( 0, KSipString );
+        }
+    CleanupStack::PopAndDestroy( mwiAddress );
+
+    // Fetch also subscribe interval
+    CSPProperty* mwiInterval = CSPProperty::NewLC();
+    User::LeaveIfError( iServiceSettings->FindPropertyL(
+        aServiceProviderId,
+        ESubPropertyVMBXMWISubscribeInterval,
+        *mwiInterval) );
+    User::LeaveIfError( mwiInterval->GetValue( reSubscribe ) );
+    CleanupStack::PopAndDestroy( mwiInterval );
+
+    HBufC8* voiceMailUri8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(
+        ptrvoiceMailUri16 );
+    CleanupStack::PopAndDestroy( voiceMailUri16 );
+    CleanupStack::PushL( voiceMailUri8 );
+
+    TInt index = iVmbxBaseArray.Count();
+    TBool newProfile = ETrue;
+    if ( index )
+        {
+        // Might be second subscription or pending operation.
+        // Though IPVME and SCP supports currently only one VMBX connection
+        for ( TInt i = 0; i < index; i++ )
+            {
+            CIpVmbxBase* const subscription( iVmbxBaseArray[i] );
+            if ( *voiceMailUri8 == subscription->VmbxUrl() )
+                {
+                // Subscription already exists
+                if ( CIpVmbxBase::EDisabled == subscription->State() )
+                    {
+                    // Subscription was disabled, enable
+                    newProfile = EFalse;
+                    subscription->Initialize(
+                        aServiceProviderId,
+                        aSipProfile );
+
+                    subscription->SubscribeL( reSubscribe );
+                    }
+                else
+                    {
+                    User::Leave( KErrAlreadyExists );
+                    }
+                }
+            }
+        }
+    if ( newProfile )
+        {
+        // Subscription to new VMBX account
+        IPVMEPRINT( "CIpVmbxEngine::New AppBase" );
+        CIpVmbxBase* app = CIpVmbxBase::NewL(
+            *this,
+            *voiceMailUri8,
+            *iMceManager );
+        CleanupStack::PushL( app );
+        iVmbxBaseArray.AppendL( app );
+        CleanupStack::Pop( app );
+
+        app->Initialize( aServiceProviderId, aSipProfile );
+        app->SubscribeL( reSubscribe );
+        }
+
+    CleanupStack::PopAndDestroy( voiceMailUri8 );
+
+    IPVMEPRINT( "CIpVmbxEngine::SubscribeProfileL - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TInt CIpVmbxEngine::ProfileSubscribed(
+    TUint32 aServiceProviderId,
+    TBool& aProfileSubscribed )
+    {
+    CIpVmbxBase* subscription( SubscriptionByProvider( aServiceProviderId ) );
+    TInt err = KErrNotFound;
+
+    if ( subscription )
+        {
+        err = KErrNone;
+        if ( CIpVmbxBase::ERegistered == subscription->State() )
+            {
+            aProfileSubscribed = ETrue;
+            }
+        else
+            {
+            aProfileSubscribed = EFalse;
+            }
+        }
+
+    return err;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Resolve base class matching to recipient
+// ---------------------------------------------------------------------------
+//
+CIpVmbxBase* CIpVmbxEngine::SubscriptionByRecipient(
+    const TDesC8& aRecipient8 )
+    {
+    CIpVmbxBase* base( NULL );
+
+    for ( TInt i = 0; i < iVmbxBaseArray.Count(); i++ )
+        {
+        if ( iVmbxBaseArray[i]->VmbxUrl() == aRecipient8 )
+            {
+            base = iVmbxBaseArray[i];
+            }
+        }
+
+    return base;
+    }
+
+
+// ----------------------------------------------------------------------------
+// EventMonitor has received event and the event will be gained and checked
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::EventReceivedL( const TDesC8& aRecipient8 )
+    {
+    IPVMEPRINT( "CIpVmbxEngine::EventReceivedL - IN" );
+
+    CIpVmbxBase* subscription( SubscriptionByRecipient( aRecipient8 ) );
+    if ( !subscription )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    HBufC8* content8( iEventData.GetContent() );
+    CleanupStack::PushL( content8 );
+
+    HBufC8* totalMessages8 = HBufC8::NewLC( KMaxMessageDigits );
+    HBufC8* newMessages8 = HBufC8::NewLC( KMaxMessageDigits );
+    HBufC8* from8 = HBufC8::NewLC(
+        KMaxIpVoiceMailBoxUriLength + KAccountTextLength );
+    TPtr8 ptrTotalMessages8( totalMessages8->Des() );
+    TPtr8 ptrNewMessages8( newMessages8->Des() );
+    TPtr8 ptrFrom8( from8->Des() );
+    TPtr8 ptrContent8( content8->Des() );
+
+    TBool createSMS = EFalse;
+    // no need to handle errors, returned parameters can still
+    // be interpreted correctly
+    //
+    TRAP_IGNORE(
+        ParseNotifyContentL(
+            createSMS,
+            ptrContent8,
+            ptrTotalMessages8,
+            ptrNewMessages8,
+            ptrFrom8 ) );
+
+    if ( ptrNewMessages8 == KNoMessages )
+        {
+        // protocol test fix, new message should not be created
+        // if new message count is 0
+        IPVMEPRINT( "CIpVmbxEngine::EventReceivedL - No new messages" );
+        createSMS = EFalse;
+        }
+    if ( 0 == ptrFrom8.Length() )
+        {
+        ptrFrom8 = subscription->VmbxUrl();
+        }
+
+    TInt totalMsgs = 0;
+    TInt newMsgs = 0;
+    TLex8 msgsConvert;
+    msgsConvert.Assign( *totalMessages8 );
+    if ( KErrNone == msgsConvert.Val( totalMsgs ) )
+        {
+        msgsConvert.Assign( *newMessages8 );
+        if ( KErrNone != msgsConvert.Val( newMsgs ) )
+            {
+            totalMsgs = 0;
+            }
+        }
+
+    TInt curTotal = 0;
+    TInt curNew = 0;
+    subscription->AccountMessageCount( curTotal, curNew );
+
+    TBool statusChanged = EFalse;
+    if ( totalMsgs != curTotal || newMsgs != curNew )
+        {
+        statusChanged = ETrue;
+        IPVMEPRINT( "CIpVmbxEngine::EventReceivedL - Status changed" );
+        subscription->SetAccountMessageCount( totalMsgs, newMsgs );
+        }
+
+    if ( createSMS && statusChanged )
+        {
+        IPVMEPRINT( "CIpVmbxEngine::EventReceivedL - Create message body" );
+        TBuf8< KSmsLength > messageBody8;
+        CreateMessageBodyL(
+            *content8,
+            ptrTotalMessages8,
+            ptrNewMessages8,
+            ptrFrom8,
+            messageBody8 );
+        CreateSMSMessageL( ptrFrom8, messageBody8 );
+        }
+
+    CleanupStack::PopAndDestroy( from8 );
+    CleanupStack::PopAndDestroy( newMessages8 );
+    CleanupStack::PopAndDestroy( totalMessages8 );
+    CleanupStack::PopAndDestroy( content8 );
+
+    IPVMEPRINT( "CIpVmbxEngine::EventReceivedL - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CIpVmbxEngine::UnsubscribeProfileL( TUint32 aServiceProviderId )
+    {
+    IPVMEPRINT2( "CIpVmbxEngine::UnsubscribeProfileL: %d - IN", 
+	    aServiceProviderId );
+    
+    CIpVmbxBase* subscription( SubscriptionByProvider( aServiceProviderId ) );
+    if ( !subscription )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    IPVMEPRINT2( "CIpVmbxEngine::UnsubscribeProfileL: state=%d",
+	    subscription->State() );
+
+    switch( subscription->State() )
+        {
+        case CIpVmbxBase::ERegistered:
+            {
+            subscription->TerminateEventL();
+            break;
+            }
+        case CIpVmbxBase::EDisabled:
+            {
+            CleanVmbxBase();
+            break;
+            }
+        case CIpVmbxBase::ESubscribing:
+            {
+            subscription->Cancel();
+            CleanVmbxBase();
+            break;
+            }
+        case CIpVmbxBase::ETerminating:
+            {
+            User::Leave( KErrCancel );
+            break;
+            }
+        default:
+            {
+            IPVMEPRINT( "No implementation" );
+            }
+        }
+
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::CleanVmbxBase()
+    {
+    for ( TInt i = 0; i < iVmbxBaseArray.Count(); i++ )
+        {
+        if ( CIpVmbxBase::ETerminating == iVmbxBaseArray[i]->State() ||
+            CIpVmbxBase::EDisabled == iVmbxBaseArray[i]->State() )
+            {
+            delete iVmbxBaseArray[i];
+            iVmbxBaseArray.Remove( i );
+            }
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::HandleMessage(
+    TUint32 aServiceProviderId,
+    CIpVmbxEngine::TIpVmbxMessages aMessage )
+    {
+    IPVMEPRINT2( "CIpVmbxEngine::HandleMessage: %d - IN", aMessage );
+
+    CIpVmbxBase* subscription( SubscriptionByProvider( aServiceProviderId ) );
+    // Save current state because some functions modify states
+    CIpVmbxBase::TIpVmbxBaseStates baseState = subscription->State();
+    MIpVmbxObserver::TVmbxMessage message =
+        MIpVmbxObserver::EIncorrectSettings;
+    TBool send = ETrue;
+
+    switch ( aMessage )
+        {
+        case CIpVmbxEngine::EEngineSubscribed:
+            message = MIpVmbxObserver::ESubscribed;
+            break;
+        case CIpVmbxEngine::EEngineTerminated:
+            {
+            if ( CIpVmbxBase::EDisabled != baseState )
+                {
+                CleanVmbxBase();
+                message = MIpVmbxObserver::EUnsubscribed;
+                }
+            else
+                {
+                send = EFalse;
+                }
+            break;
+            }
+        case CIpVmbxEngine::EEngineUndefined:
+            {
+            send = EFalse;
+            break;
+            }
+        case CIpVmbxEngine::EEngineSubscribeRejected:
+        case CIpVmbxEngine::EEngineIncorrectAccount:
+            {
+            subscription->Cancel();
+            CleanVmbxBase();
+            message = MIpVmbxObserver::EIncorrectSettings;
+            break;
+            }
+        case CIpVmbxEngine::EEngineSmsError:
+            {
+            subscription->Cancel();
+            message = MIpVmbxObserver::ESmsError;
+            break;
+            }
+        case CIpVmbxEngine::EEngineSmsOom:
+            message = MIpVmbxObserver::ENoMemory;
+            break;
+        case CIpVmbxEngine::EEngineNetworkLost:
+            {
+            subscription->Cancel();
+            subscription->DeleteEvent();
+            send = EFalse;
+            break;
+            }
+        case CIpVmbxEngine::EEngineNetworkError:
+            {
+            subscription->Cancel();
+            subscription->DeleteEvent();
+            message = MIpVmbxObserver::ENetworkError;
+            break;
+            }
+        case CIpVmbxEngine::EEngineFatalNetworkError:
+            {
+            subscription->Cancel();
+            subscription->DeleteEvent();
+            message = MIpVmbxObserver::EFatalNetworkError;
+            break;
+            }
+        default:
+            IPVMEPRINT( "Unhandled message!" );
+        }
+
+    if ( send )
+        {
+        iInterface.SendMessage( aServiceProviderId, message );
+        }
+
+    IPVMEPRINT( "CIpVmbxEngine::HandleMessage - OUT" );
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+CIpVmbxBase* CIpVmbxEngine::SubscriptionByProvider(
+    TUint32 aServiceProviderId )
+    {
+    CIpVmbxBase* base( NULL );
+    for ( TInt i = 0; i < iVmbxBaseArray.Count(); i++ )
+        {
+        if ( iVmbxBaseArray[i]->ServiceProviderId() == aServiceProviderId )
+            {
+            base = iVmbxBaseArray[i];
+            }
+        }
+    return base;
+    }
+
+
+// ----------------------------------------------------------------------------
+// From class MMsvSessionObserver.
+// Indicates an event has occurred from a Message Server session.
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::HandleSessionEventL(
+    TMsvSessionEvent /*aEvent*/,
+    TAny* /*aArg1*/,
+    TAny* /*aArg2*/,
+    TAny* /*aArg3*/ )
+    {
+    IPVMEPRINT( "CIpVmbxEngine::HandleSessionEventL - Dummy implementation" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// Parses critical and important optional parts of content. Already
+// processed data is cut from content.
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::ParseNotifyContentL(
+    TBool& aCreateSms,
+    TDes8& aContent8,
+    TDes8& aTotalMessages8,
+    TDes8& aNewMessages8,
+    TDes8& aFrom8 ) const
+    {
+#ifdef _DEBUG
+    HBufC* print = HBufC::NewLC( aContent8.Length() );
+    print->Des().Copy( aContent8 );
+    IPVMEPRINT2( "CIpVmbxEngine::ParseNotifyContentL - aContent8:%S", &print->Des() )
+    CleanupStack::PopAndDestroy( print );
+#endif // _DEBUG
+    aCreateSms = EFalse;
+
+    // check required content
+    TLex8 analyzer8;
+    TPtrC8 posPtr8;
+    TPtrC8 dataPtr8;
+    TPtrC8 messagePtr8;
+
+    TInt atPosWaiting = aContent8.FindF( KMessagesWaiting8 );
+    // check important OPTIONAL fields
+    TInt atPosAccount = aContent8.FindF( KMessageAccount8 );
+    TInt atPosMessage = aContent8.FindF( KVoiceMessage8 );
+
+    if ( 0 == atPosWaiting )
+        {
+        // data field found from correct place
+        messagePtr8.Set( FetchMessagePartL( aContent8 ) );
+        analyzer8.Assign(
+            messagePtr8.Mid( messagePtr8.Find( KColon8 ) + KOneChar ) );
+        dataPtr8.Set( analyzer8.NextToken() );
+        if ( 0 == dataPtr8.CompareF( KNewMessages8 ) )
+            {
+            // message(s) waiting
+            aCreateSms = ETrue;
+            }
+        // cut processed data
+        posPtr8.Set( aContent8.Mid( messagePtr8.Length() ) );
+        analyzer8.Assign( posPtr8 );
+        }
+    else
+        {
+        IPVMEPRINT( "CIpVmbxEngine::ParseNotifyContentL - leave with KErrCorrupt" );
+        // malformed critical part of message
+        User::Leave( KErrCorrupt );
+        }
+
+    if ( KErrNotFound != atPosAccount && KErrNotFound != atPosMessage )
+        {
+        // both optionals found
+        if ( !( atPosAccount < atPosMessage ) )
+            {
+            IPVMEPRINT( "CIpVmbxEngine::ParseNotifyContentL - leave with KErrCorrupt 2" );
+            // incorrect format
+            User::Leave( KErrCorrupt );
+            }
+        }
+
+    if ( KErrNotFound != atPosAccount && aCreateSms )
+        {
+        // get account
+        IPVMEPRINT( "CIpVmbxEngine::ParseNotifyContentL - get account" );
+        messagePtr8.Set( FetchMessagePartL( posPtr8 ) );
+        analyzer8.Assign(
+            messagePtr8.Mid( messagePtr8.Find( KColon8 ) + KOneChar ) );
+        dataPtr8.Set( analyzer8.NextToken() );
+        posPtr8.Set( posPtr8.Mid( messagePtr8.Length() ) );
+        analyzer8.Assign( posPtr8 );
+
+
+        aFrom8.Copy( dataPtr8.Left( aFrom8.MaxLength() ) );
+        }
+
+    if ( KErrNotFound != atPosMessage )
+        {
+        messagePtr8.Set( FetchMessagePartL( posPtr8 ) );
+        analyzer8.Assign(
+            messagePtr8.Mid( messagePtr8.Find( KColon8 ) + KOneChar ) );
+
+        // can hold value required by specification
+        TUint oldMessageCount = 0;
+        TUint newMessageCount = 0;
+        TLex8 value;
+
+        analyzer8.SkipSpace();
+        User::LeaveIfError( analyzer8.Val( newMessageCount ) );
+        analyzer8.SkipSpace();
+        User::LeaveIfError( KSlash8().Locate( analyzer8.Get() ) );
+
+        analyzer8.SkipSpace();
+        User::LeaveIfError( analyzer8.Val( oldMessageCount ) );
+
+        aNewMessages8.Num( newMessageCount );
+        aTotalMessages8.Num( ( TInt64 ) oldMessageCount + ( TInt64 ) newMessageCount );
+
+        posPtr8.Set( posPtr8.Mid( messagePtr8.Length() ) );
+        }
+
+    // Clean string off processed data
+    aContent8.Delete( 0, aContent8.Length() - posPtr8.Length() );
+
+    IPVMEPRINT( "CIpVmbxEngine::ParseNotifyContentL - OUT" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// Creates SMS message and sends it
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::CreateSMSMessageL(
+    const TDesC8& aFrom8,
+    const TDesC8& aMessageBody8 )
+    {
+    IPVMEPRINT( "CIpVmbxEngine::CreateSMSMessageL - IN" );
+
+    // Create the SMS header object...
+    CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL();
+    CleanupStack::PushL( paraFormatLayer );
+    CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
+    CleanupStack::PushL( charFormatLayer );
+
+    CRichText* bodyText = CRichText::NewL( paraFormatLayer, charFormatLayer );
+    CleanupStack::PushL( bodyText );
+    TInt position = 0;
+    TBuf< KSmsLength > messageBody;
+    messageBody.Copy( aMessageBody8.Left( messageBody.MaxLength() ) );
+    bodyText->InsertL( position, messageBody );
+
+    CSmsHeader* header = CSmsHeader::NewL( CSmsPDU::ESmsDeliver, *bodyText );
+    CleanupStack::PushL( header );
+    TBuf< KMaxIpVoiceMailBoxUriLength > from;
+    from.Copy( aFrom8 );
+    header->SetFromAddressL( from );
+
+    TMsvEntry entry;
+    entry.SetVisible(ETrue );
+    entry.SetUnread( ETrue );
+    entry.SetNew( ETrue );
+    entry.iServiceId = KMsvRootIndexEntryId;
+    entry.iType = KUidMsvMessageEntry;
+    entry.iMtm = KUidMsgTypeSMS;
+    entry.iDate.UniversalTime();
+    entry.iSize = 0;
+    entry.iDescription.Set( KNullDesC );
+    entry.iDetails.Set( KNullDesC );
+
+    header->Deliver().SetServiceCenterTimeStamp( entry.iDate );
+
+    CSmsSettings* smsSettings = CSmsSettings::NewL();
+    CleanupStack::PushL( smsSettings );
+    smsSettings->SetDelivery( ESmsDeliveryImmediately );
+    smsSettings->SetValidityPeriod( ESmsVPWeek );
+    smsSettings->SetValidityPeriodFormat( TSmsFirstOctet::ESmsVPFInteger );
+    smsSettings->SetReplyQuoted( EFalse );
+    smsSettings->SetRejectDuplicate( ETrue );
+    smsSettings->SetDelivery( ESmsDeliveryImmediately );
+    smsSettings->SetDeliveryReport( ETrue );
+    smsSettings->SetReplyPath( EFalse );
+    smsSettings->SetMessageConversion( ESmsConvPIDNone );
+    smsSettings->SetCanConcatenate( ETrue );
+    smsSettings->SetUseServiceCenterTimeStampForDate( ETrue );
+
+    header->SetSmsSettingsL(*smsSettings );
+
+    CSmsNumber* rcpt = CSmsNumber::NewL();
+    CleanupStack::PushL( rcpt );
+    rcpt->SetAddressL( from.Left( KSmcmSmsNumberMaxNumberLength ) );
+    header->Recipients().AppendL( rcpt );
+    CleanupStack::Pop( rcpt );
+
+    // Update entry description and details...
+    CArrayPtrFlat< CSmsNumber >& recipient = header->Recipients();
+    entry.iDetails.Set( recipient[0]->Address() );
+    entry.iDescription.Set( bodyText->Read(
+        0, smsSettings->DescriptionLength() ));
+    entry.SetInPreparation( EFalse );
+
+    // Create the entry - set context to the global outbox.
+    TMsvSelectionOrdering ordering = TMsvSelectionOrdering(
+        KMsvNoGrouping,
+        EMsvSortByDescription,
+        ETrue );
+        CMsvSession* session = CMsvSession::OpenSyncL( *this );
+        CleanupStack::PushL( session );
+    CMsvEntry* centry = CMsvEntry::NewL(
+        *session, KMsvRootIndexEntryId, ordering );
+    CleanupStack::PushL( centry );
+    centry->SetEntryL( KMsvGlobalInBoxIndexEntryId );
+    centry->CreateL( entry );
+
+    // Create new store and save header information
+    centry->SetEntryL( entry.Id() );
+    CMsvStore* store = centry->EditStoreL();
+    CleanupStack::PushL(store);
+    header->StoreL( *store );
+    store->StoreBodyTextL( *bodyText );
+    store->CommitL();
+
+    CleanupStack::PopAndDestroy( store );
+    CleanupStack::PopAndDestroy( centry );
+    CleanupStack::PopAndDestroy( session );
+    CleanupStack::PopAndDestroy( smsSettings );
+    CleanupStack::PopAndDestroy( header );
+    CleanupStack::PopAndDestroy( bodyText );
+    CleanupStack::PopAndDestroy( charFormatLayer );
+    CleanupStack::PopAndDestroy( paraFormatLayer );
+
+    IPVMEPRINT( "CIpVmbxEngine::CreateSMSMessageL - OUT" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// Parse optional headers. Parser must take account various optional
+// characters in headers. String lengths are monitored every round to prevent
+// panics when setting data.
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::ParseOptionalHeadersL(
+    const TDesC8& aContent8,
+    TDes8& aMessageBody8 ) const
+    {
+    IPVMEPRINT( "CIpVmbxEngine::ParseOptionalHeadersL - IN" );
+
+    if ( aContent8.Left( KCrlf8().Length() ).Compare( KCrlf8  ) ||
+        aContent8.Length() == KTwoChars )
+        {
+        // Checking if optional message does not exist or its too short.
+        // Will also fix parsing of non standard basic Pingtel message.
+        //
+        User::Leave( KErrNotFound );
+        }
+
+    TFileName dll;
+    Dll::FileName( dll );
+    TFileName fileName( TParsePtrC( dll ).Drive() );
+    fileName += KIpVmbxAppEngineResourceFileDirectory;
+    fileName += KIpVmbxAppEngineResourceFileName;
+    CStringResourceReader* resourceReader =
+        CStringResourceReader::NewL( fileName );
+    CleanupStack::PushL( resourceReader );
+
+    if ( aMessageBody8.MaxLength() == aMessageBody8.Length() )
+        {
+        User::Leave( KErrOverflow );
+        }
+    else
+        {
+        // Add another separator before optional messages
+        aMessageBody8.Append( KEndLine8 );
+        }
+
+    TPtrC8 messagePtr8;
+    TPtrC8 tagPtr8;
+    TPtrC8 dataPtr8;
+    TPtrC8 posPtr8( aContent8 );
+    TPtrC8 colon8;
+    TInt messages = 0;
+    HBufC* locTemp( HBufC::NewLC( KSmsLength ) );
+    TPtr locPtr( locTemp->Des() );
+    TPtrC resourcePtr( resourceReader->ReadResourceString( R_VOIP_VM_HEADER_COUNT ) );
+    HBufC* variant( NULL );
+    TLex8 analyzer8;
+    HBufC8* partTemp( HBufC8::NewLC( KSmsLength ) );
+    TPtr8 partPtr( partTemp->Des() );
+    TBool messageEmpty = EFalse; // prevents creation of empty optional message part
+    TBool appendMsgChange = EFalse;
+    // Start sorting through message
+    do
+        {
+        if ( ( KErrNotFound !=
+            posPtr8.Left( KCrlf8().Length() ).FindF( KCrlf8 ) ||
+            0 == messages ) && !messageEmpty )
+            {
+            // beginning of optional messages or another optional message
+            if ( messages <= KMaxMsgDescriptions )
+                {
+                // add message count for first/next optional message
+                // count is limited to two numbers = 99 (prevents also overflow when
+                // KTotal is replaced)
+                TBuf< KTwoChars > appendNum;
+                appendNum.AppendNum( ++messages );
+                locPtr.Zero();
+                locPtr.Append( KOptionalSeparator );
+                locPtr.Append( resourcePtr );
+                locPtr.Replace( locPtr.Find( KTotal ), KTotal().Length(), appendNum );
+                locPtr.Append( KEndLine );
+                posPtr8.Set( posPtr8.Mid( KCrlf8().Length() ) );
+                messageEmpty = ETrue;
+                appendMsgChange = ETrue;
+                }
+            else
+                {
+                User::Leave( KErrOverflow );
+                }
+            }
+        messagePtr8.Set( FetchMessagePartL( posPtr8 ) );
+        analyzer8.Assign(
+            messagePtr8.Left( messagePtr8.Find( KColon8 ) + KOneChar ) );
+        tagPtr8.Set( analyzer8.NextToken() );
+        if ( KErrNotFound == tagPtr8.Find( KColon8 ) )
+            {
+            // colon required
+            colon8.Set( analyzer8.NextToken() );
+            }
+        analyzer8.Assign(
+            messagePtr8.Mid( messagePtr8.Find( KColon8 ) + KOneChar ) );
+        analyzer8.SkipSpace(); // skipping ws's since one newline is added later
+        if ( analyzer8.Eos() )
+            {
+            // data contained only ws's we must decrease counter by length of CRLF
+            analyzer8.UnGet();
+            analyzer8.UnGet();
+            }
+        dataPtr8.Set(
+            messagePtr8.Mid(
+                messagePtr8.Find( KColon8 ) + KOneChar + analyzer8.Offset(),
+                analyzer8.Remainder().Length() - KCrlf8().Length() ) );
+        posPtr8.Set( posPtr8.Mid( messagePtr8.Length() ) );
+        analyzer8.Assign( posPtr8 );
+
+        variant = TranslateTagL( tagPtr8, *resourceReader );
+
+        if ( variant &&
+            variant->Length() + dataPtr8.Length() + KOneChar <
+            partPtr.MaxLength() - partPtr.Length() )
+            {
+            // Resource translated to users phone variant language.
+            // Optional message headers other than these aren't supported
+            // because language cannot be verified and might differ from phone
+            // variant language.
+            partPtr.Append( *variant );
+            partPtr.Append(  dataPtr8 );
+            partPtr.Append( KEndLine8 );
+            messageEmpty = EFalse;
+            }
+        delete variant;
+        variant = NULL;
+
+        if ( !appendMsgChange && !messageEmpty && aMessageBody8.MaxLength() - aMessageBody8.Length() >= partPtr.Length() )
+            {
+            aMessageBody8.Append( partPtr );
+            partPtr.Zero();
+            }
+        else
+            if ( !messageEmpty && aMessageBody8.MaxLength() - aMessageBody8.Length() >= partPtr.Length() + locPtr.Length() )
+                {
+                // Content OK, append to actual actual message
+                aMessageBody8.Append( locPtr );
+                aMessageBody8.Append( partPtr );
+                partPtr.Zero();
+                messageEmpty = EFalse;
+                appendMsgChange = EFalse;
+                }
+            else
+                {
+                // partial ptr was too long for message, reset and try next part from content
+                partPtr.Zero();
+                messageEmpty = ETrue;
+                }
+
+        }while( !analyzer8.Eos() );
+
+    CleanupStack::PopAndDestroy( partTemp );
+    CleanupStack::PopAndDestroy( locTemp );
+    CleanupStack::PopAndDestroy( resourceReader );
+
+    IPVMEPRINT( "CIpVmbxEngine::ParseOptionalHeadersL - OUT" );
+    }
+
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::ReadResourcesL(
+    const TDesC8& aTotalMessages8,
+    const TDesC8& aNewMessages8,
+    TDes8& aMessagesBody8 )
+    {
+    IPVMEPRINT( "CIpVmbxEngine::ReadResourcesL - IN" );
+    __ASSERT_DEBUG( KSmsLength == aMessagesBody8.MaxLength(), Panic( KErrArgument ) );
+
+    TFileName dll;
+    Dll::FileName( dll );
+    TFileName fileName( TParsePtrC( dll ).Drive() );
+    fileName += KIpVmbxAppEngineResourceFileDirectory;
+    fileName += KIpVmbxAppEngineResourceFileName;
+    CStringResourceReader* resourceReader =
+        CStringResourceReader::NewL( fileName );
+    CleanupStack::PushL( resourceReader );
+    TPtrC messageText;
+
+    if( !aTotalMessages8.Length() )
+        {
+        messageText.Set(
+            resourceReader->ReadResourceString( R_VOIP_VM_MSG_SUM_UNKNOWN ) );
+        aMessagesBody8.Copy( messageText );
+        }
+    else if( !aNewMessages8.Compare( KOneMessage ) &&
+        !aTotalMessages8.Compare( KOneMessage ) )
+        {
+        messageText.Set(
+            resourceReader->ReadResourceString( R_VOIP_NEW_VOICE_MESSAGE ) );
+        aMessagesBody8.Copy( messageText );
+        }
+    else if( !aNewMessages8.Compare( KOneMessage ) &&
+        aTotalMessages8.Compare( KOneMessage ) )
+        {
+        TBuf< KSmsLength > tempText;
+        messageText.Set(
+            resourceReader->ReadResourceString(
+                R_VOIP_NEW_AND_OLD_VOICE_MSG ) );
+        tempText.Copy( messageText );
+        TInt atPosFirst = tempText.Find( KTotal );
+        TInt messageLength = tempText.Length();
+        TPtrC messagePart1 = tempText.Mid( 0 , atPosFirst );
+        aMessagesBody8.Copy( messagePart1 );
+        aMessagesBody8.Append( aTotalMessages8.Left( KMaxMessageDigits ) );
+        TPtrC messagePart2 = tempText.Mid(
+            atPosFirst + KTotalLength,
+            messageLength - atPosFirst - KTotalLength );
+        aMessagesBody8.Append( messagePart2 );
+        }
+    else if( aNewMessages8.Compare( KOneMessage ) &&
+        aTotalMessages8.Compare( KOneMessage ) )
+        {
+        messageText.Set(
+            resourceReader->ReadResourceString( R_VOIP_NEW_VOICE_MESSAGES ) );
+
+        // Search new messages location and replace with real value
+        TBuf8< KSmsLength > messagePart1;
+        TInt pos = messageText.Find( KTotalNew );
+        messagePart1.Copy( messageText.Left( pos ) );
+        messagePart1.Append( aNewMessages8.Left( KMaxMessageDigits ) );
+        messagePart1.Append( messageText.Mid( pos + KTotalOldLength ) );
+
+        // Search total messages location and replace with real value
+        TBuf8< KSmsLength > messagePart2;
+        pos = messagePart1.Find( KTotalOld );
+        messagePart2.Copy( messagePart1.Left( pos ) );
+        messagePart2.Append( aTotalMessages8.Left( KMaxMessageDigits ) );
+        messagePart2.Append( messagePart1.Mid( pos + KTotalOldLength ) );
+
+        aMessagesBody8.Append( messagePart2 );
+        }
+
+    aMessagesBody8.Append( KEndLine );
+    aMessagesBody8.Append( KEndLine );
+    aMessagesBody8.Append(
+        resourceReader->ReadResourceString( R_VOIP_VM_MSG_ACCOUNT ) );
+
+    CleanupStack::PopAndDestroy( resourceReader );
+
+    IPVMEPRINT( "CIpVmbxEngine::ReadResourcesL - OUT" );
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::CreateMessageBodyL(
+    const TDesC8& aContent8,
+    const TDesC8& aTotal8,
+    const TDesC8& aNew8,
+    TDes8& aFrom8,
+    TDes8& aMessageBody8 )
+    {
+    aFrom8.TrimRight();
+    if ( 0 == aFrom8.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    ReadResourcesL(
+        aTotal8,
+        aNew8,
+        aMessageBody8 );
+
+    if( aFrom8.Length() &&
+        aMessageBody8.Length() + aFrom8.Length() < KSmsLength )
+        {
+        aMessageBody8.Append( aFrom8 );
+        }
+
+    TRAP_IGNORE( ParseOptionalHeadersL( aContent8, aMessageBody8 ) );
+    }
+
+// ----------------------------------------------------------------------------
+// Creates translated tag from resources
+// ----------------------------------------------------------------------------
+//
+HBufC* CIpVmbxEngine::TranslateTagL(
+    const TDesC8& aTagPtr8,
+    CStringResourceReader& aResourceReader ) const
+    {
+    HBufC* locTemp( NULL );
+    TLex8 analyzer8( aTagPtr8 );
+    TPtrC8 tag( analyzer8.NextToken() );
+    if ( KErrNotFound != tag.Find( KColon8 ) )
+        {
+        // remove possible colon char to make tag matching easier
+        tag.Set( tag.Left( tag.Length() - KOneChar ) );
+        }
+    TIpVmbxParseType::TParseTypes i = TIpVmbxParseType::EDetailTo;
+    TIpVmbxParseType parseType;
+    for ( ;i <= TIpVmbxParseType::EDetailId; i++ )
+        {
+        parseType.Set( i );
+        if ( 0 == tag.MatchF( parseType.Tag() ) )
+            {
+            i = TIpVmbxParseType::EDetailId;
+            locTemp =
+                aResourceReader.ReadResourceString(
+                    parseType.ResourceId() ).AllocL();
+            }
+        };
+
+    return locTemp;
+    }
+
+// ----------------------------------------------------------------------------
+// Gets and validates part of message.
+// ----------------------------------------------------------------------------
+//
+TPtrC8 CIpVmbxEngine::FetchMessagePartL( const TDesC8& aContent8 ) const
+    {
+    IPVMEPRINT( "CIpVmbxEngine::FetchMessagePartL - IN" );
+
+    TInt crlf = User::LeaveIfError( aContent8.FindF( KCrlf8 ) ) + KCrlf8().Length();
+    // check for optional CRLF
+    while( crlf < aContent8.Length() &&
+        ( KErrNotFound != KHTab8().Locate( aContent8[crlf] ) ||
+        KErrNotFound != KSpace8().Locate( aContent8[crlf] ) ) )
+        {
+        // This was optional CRLF, try next one
+        crlf += User::LeaveIfError( aContent8.Mid( crlf ).FindF( KCrlf8 ) ) + KTwoChars;
+        }
+    // now we should have correct partial data
+    TPtrC8 part8( aContent8.Left( crlf ) );
+    TLex8 analyzer8( part8 );
+
+    TPtrC8 tagPtr8(
+        part8.Left( User::LeaveIfError( part8.Find( KColon8 ) ) ) );
+    if ( !tagPtr8.Length() )
+        {
+        // At least one character required
+        User::Leave( KErrCorrupt );
+        }
+    TestNamePartL( tagPtr8 );
+
+    TPtrC8 dataPtr8( part8.Mid( tagPtr8.Length() ) );
+    TestValuePartL( dataPtr8 );
+
+    IPVMEPRINT( "CIpVmbxEngine::FetchMessagePartL - OUT" );
+    return aContent8.Left( part8.Length() );
+    }
+
+// ----------------------------------------------------------------------------
+// Validates name part of message.
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::TestNamePartL( const TDesC8& aNameHeader8 ) const
+    {
+    // Check legal chars %x41-5A / %x61-7A %x30-39 ( 2d, 2e, 21, 25, 2a, 5f, 2b, 60, 27, 7e)
+    // from name header
+    const TFixedArray< TText8, KSpecialNameCharsCount > legalCharsArray(
+        &KSpecialNameChars[0], KSpecialNameCharsCount );
+    TChar curChar;
+    TLex8 analyzer8( aNameHeader8 );
+    curChar = analyzer8.Get();
+    TBool valid = ETrue;
+    while ( !curChar.Eos() && valid )
+        {
+        valid = EFalse;
+        if ( KNameDigitLowest <= curChar && KNameDigitHighest >= curChar ||
+            KNameCharUpLowest <= curChar && KNameCharUpHighest >= curChar ||
+            KNameCharLowLowest <= curChar && KNameCharLowHighest >= curChar )
+            {
+            valid = ETrue;
+            }
+        for ( TInt i = 0; legalCharsArray.Count() > i && !valid; i++ )
+            {
+            if ( curChar == legalCharsArray.At( i ) )
+                {
+                valid = ETrue;
+                }
+            }
+        if ( valid )
+            {
+            curChar = analyzer8.Get();
+            }
+        }
+    if ( !valid )
+        {
+        valid = ETrue;
+        while ( !curChar.Eos() && valid )
+            {
+            valid = EFalse;
+            if ( KSpace == curChar || KHTab == curChar )
+                {
+                valid = ETrue;
+                }
+            curChar = analyzer8.Get();
+            }
+        }
+    if ( !valid )
+        {
+        User::Leave( KErrCorrupt );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Validates value part of message.
+// ----------------------------------------------------------------------------
+//
+void CIpVmbxEngine::TestValuePartL( const TDesC8& aValueHeader8 ) const
+    {
+    TBool valid = ETrue;
+    TChar curChar;
+    TLex8 analyzer8( aValueHeader8 );
+    curChar = analyzer8.Get();
+
+    while ( !curChar.Eos() && valid  )
+        {
+        valid = EFalse;
+        if ( KValueLowestChar <= curChar && KValueHighestChar >= curChar )
+            {
+            valid = ETrue;
+            }
+        else
+            if ( KCr == curChar || KLf == curChar || KHTab == curChar )
+                {
+                valid = ETrue;
+                }
+        curChar = analyzer8.Get();
+        }
+    if ( !valid )
+        {
+        User::Leave( KErrCorrupt );
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvmbxeventmonitor.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Events from VoiceMailBox -server
+*
+*/
+
+
+
+#include <mcetransactiondatacontainer.h>
+#include <mceevent.h>
+#include <siperr.h>
+
+#include "ipvmbxeventmonitor.h"
+#include "ipvmbxengine.h"
+#include "ipvmbxlogger.h"
+#include "ipvmbxpanic.h"
+#include "ipvmbxbase.h"
+#include "ipvmbxconstants.h"
+
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+TIpVmbxEventMonitor::TIpVmbxEventMonitor( CIpVmbxEngine& aEngine ) :
+    iEngine( aEngine )
+    {
+    }
+
+
+// ----------------------------------------------------------------------------
+// 
+// ----------------------------------------------------------------------------
+//
+void TIpVmbxEventMonitor::EventStateChanged(
+    CMceEvent& aEvent,
+    TMceTransactionDataContainer* /*aContainer*/ )
+    {
+    IPVMEPRINT2( 
+        "CIpVmbxEventMonitor::EventStateChanged: %d", 
+        aEvent.State() );
+    
+    CIpVmbxBase* subscription( 
+        iEngine.SubscriptionByRecipient( aEvent.Recipient() ) );
+    if ( subscription )
+        {
+        CIpVmbxEngine::TIpVmbxMessages message = 
+            CIpVmbxEngine::EEngineUndefined;
+        
+        switch ( aEvent.State() )
+            {
+            case CMceEvent::ETerminated:
+                {
+                if ( CIpVmbxBase::ETerminating == subscription->State() )
+                    {
+                    IPVMEPRINT( 
+                        "CIpVmbxEventMonitor state: CMceEvent::ETerminated" );
+                    // Normal unsubscription case
+                    message = CIpVmbxEngine::EEngineTerminated;
+                    }
+                else 
+                    if ( CIpVmbxBase::ERegistered == subscription->State() )
+                        {
+                        // Network stops responding
+                        message = CIpVmbxEngine::EEngineNetworkLost;
+                        }
+                    else
+                        {
+                        // Network does not accept subscription
+                        message = CIpVmbxEngine::EEngineSubscribeRejected;
+                        }
+                break;
+                }
+            case CMceEvent::EPending:
+                // Occures on rare 
+                message = CIpVmbxEngine::EEngineSubscribeRejected;
+                break;
+            case CMceEvent::EActive:
+            case CMceEvent::EIdle:
+                {
+                // This should never happen
+                message = CIpVmbxEngine::EEngineUndefined;
+                break;
+                }                
+            default:
+                IPVMEPRINT( "Unhandled message!" );
+            }
+    
+        iEngine.HandleMessage( subscription->ServiceProviderId(), message );
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// 
+// ----------------------------------------------------------------------------
+//
+void TIpVmbxEventMonitor::NotifyReceived(
+    CMceEvent& aEvent,
+    TMceTransactionDataContainer* /*aContainer*/ )
+    {
+    IPVMEPRINT( "CIpVmbxEventMonitor::NotifyReceived - IN" );
+    CMceEvent::TState eventState( CMceEvent::EIdle );
+    eventState = aEvent.State();
+    TBool firstNotify = EFalse;
+
+    CIpVmbxBase* subscription( 
+        iEngine.SubscriptionByRecipient( aEvent.Recipient() ) );
+    if ( subscription )
+        {
+        CIpVmbxEngine::TIpVmbxMessages message = 
+            CIpVmbxEngine::EEngineUndefined;
+        
+        switch ( eventState )
+            {
+            case CMceEvent::EActive:
+                {
+                IPVMEPRINT( 
+                    "CIpVmbxEventMonitor state: CMceEvent::EActive" );
+                if ( CIpVmbxBase::ETerminating != subscription->State() && 
+                    CIpVmbxBase::ERegistered != subscription->State() )
+                    {
+                    
+                    subscription->SetStateRegistered();
+                    IPVMEPRINT( "CIpVmbxEventMonitor::NotifyReceived - firstNotify" );
+                    firstNotify = ETrue;
+                    }
+    
+                TRAPD( err, iEngine.EventReceivedL( aEvent.Recipient() ) );
+                if ( err )
+                    {
+                    if ( KErrNoMemory == err )
+                        {
+                        message = CIpVmbxEngine::EEngineSmsOom;
+                        }
+                    else
+                        {
+                        message = CIpVmbxEngine::EEngineSmsError;
+                        }
+                    }
+                else if ( firstNotify )
+                    {
+                    message = CIpVmbxEngine::EEngineSubscribed;
+                    }
+                else
+                    {
+                    message = CIpVmbxEngine::EEngineUndefined;
+                    }
+                }
+                break;
+            case CMceEvent::ETerminated:
+            // flow through
+            case CMceEvent::EIdle:
+            // flow through
+            case CMceEvent::EPending:
+            // flow through
+            default:
+                IPVMEPRINT( "Unhandled message!" );
+            }
+        
+        iEngine.HandleMessage( subscription->ServiceProviderId(), message );
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// 
+// ----------------------------------------------------------------------------
+//
+void TIpVmbxEventMonitor::EventConnectionStateChanged( 
+                    CMceEvent& /*aEvent*/, 
+                    TBool /*aActive*/ )
+    {
+    IPVMEPRINT( "CIpVmbxEventMonitor::EventConnectionStateChanged" );
+    }
+
+
+// ----------------------------------------------------------------------------
+// 
+// ----------------------------------------------------------------------------
+//
+void TIpVmbxEventMonitor::Failed( CMceEvent& aEvent, TInt aError )
+    {
+    IPVMEPRINT2( "CIpVmbxEventMonitor::Failed: %d", aError );
+    CIpVmbxBase* subscription( 
+        iEngine.SubscriptionByRecipient( aEvent.Recipient() ) );
+    if ( subscription )
+        {
+        CIpVmbxEngine::TIpVmbxMessages message = 
+            CIpVmbxEngine::EEngineUndefined;
+        
+        switch ( aError )
+            {
+            case KErrSIPTransportFailure:
+                message = CIpVmbxEngine::EEngineIncorrectAccount;
+                break;
+            case KErrTimedOut:
+                message = CIpVmbxEngine::EEngineSubscribeRejected;
+                break;
+            case KErrSIPResolvingFailure:
+                message = CIpVmbxEngine::EEngineFatalNetworkError;
+                break;              
+            default:
+                message = CIpVmbxEngine::EEngineNetworkError;
+            }
+    
+        iEngine.HandleMessage( subscription->ServiceProviderId(), message );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvmbxinterface.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* 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:  Interface class to control voice mail engine
+*
+*/
+
+
+
+#include "ipvmbxinterface.h"
+#include "ipvmbxengine.h"
+#include "ipvmbxlogger.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CIpVmbxInterface::CIpVmbxInterface( MIpVmbxObserver& aEngineObserver ) : 
+    iEngineObserver( aEngineObserver )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CIpVmbxInterface::ConstructL()
+    {
+    iIpVmbxEngine = CIpVmbxEngine::NewL( *this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CIpVmbxInterface* CIpVmbxInterface::NewL( 
+    MIpVmbxObserver& aEngineObserver )
+    {
+    IPVMEPRINT( "CIpVmbxInterface::NewL - IN" );
+    
+    CIpVmbxInterface* self = new( ELeave ) CIpVmbxInterface( aEngineObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    
+    IPVMEPRINT( "CIpVmbxInterface::NewL - OUT" );
+    return self;
+    }
+    
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+CIpVmbxInterface::~CIpVmbxInterface()
+    {
+    IPVMEPRINT( "CIpVmbxInterface::~CIpVmbxInterface - IN" );
+    
+    delete iIpVmbxEngine;
+    
+    IPVMEPRINT( "CIpVmbxInterface::~CIpVmbxInterface - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Subscribes profile to ip voice mail server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CIpVmbxInterface::SubscribeL( 
+    TUint32 aServiceProviderId, 
+    CSIPProfile& aSipProfile )
+    {
+    IPVMEPRINT( "CIpVmbxInterface::SubscribeL - IN" );
+    
+    iIpVmbxEngine->SubscribeProfileL( aServiceProviderId, aSipProfile );
+    
+    IPVMEPRINT( "CIpVmbxInterface::SubscribeL - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Un-subscribes profile from ip voice mail server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CIpVmbxInterface::UnsubscribeL( TUint32 aServiceProviderId )
+    {
+    IPVMEPRINT( "CIpVmbxInterface::UnsubscribeL - IN" );
+    
+    iIpVmbxEngine->UnsubscribeProfileL( aServiceProviderId );
+    
+    IPVMEPRINT( "CIpVmbxInterface::UnsubscribeL - OUT" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Check if profile is registered to ip voice mail server
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CIpVmbxInterface::IsSubscribed( 
+    TUint32 aServiceProviderId, 
+    TBool& aProfileSubscribed ) const
+    {
+    
+    return iIpVmbxEngine->ProfileSubscribed( aServiceProviderId, aProfileSubscribed );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Send messages through observer
+// ---------------------------------------------------------------------------
+//
+void CIpVmbxInterface::SendMessage( 
+    TUint32 aServiceProviderId, 
+    MIpVmbxObserver::TVmbxMessage aMessage )
+    {
+    IPVMEPRINT( "CIpVmbxInterface::SendMessage - IN" );
+    
+    iEngineObserver.HandleMessage( aServiceProviderId, aMessage );
+    
+    IPVMEPRINT( "CIpVmbxInterface::SendMessage - OUT" );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvmbxparsetype.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,147 @@
+/*
+* 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:  Parsing options for optional data
+*
+*/
+
+
+
+#include <ipvoicemailengine.rsg>
+
+#include "ipvmbxparsetype.h"
+
+
+_LIT8( KTo8, "To" );
+_LIT8( KToShort8, "t" );
+_LIT8( KFrom8, "From" );
+_LIT8( KFromShort8, "f" );
+_LIT8( KSubject8, "Subject" );
+_LIT8( KSubjectShort8, "s" );
+_LIT8( KDate8, "Date" );
+_LIT8( KPriority8, "Priority" );
+_LIT8( KId8, "Message-ID" );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// Set type of tag this instance presents
+// ---------------------------------------------------------------------------
+//
+TIpVmbxParseType::TIpVmbxParseType( const TParseTypes aType )
+    {
+    Set( aType );
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TIpVmbxParseType::TIpVmbxParseType() :
+    iTag( &KNullDesC8 ), iResourceId( KErrNotFound )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC8& TIpVmbxParseType::Tag() const
+    {
+    return *iTag;
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TInt32 TIpVmbxParseType::ResourceId() const
+    {
+    return iResourceId;
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void TIpVmbxParseType::Set( const TParseTypes aType )
+    {
+    // Set instance content
+    switch ( aType )
+        {
+        case EDetailTo:
+            {
+            iTag = &KTo8;
+            iResourceId = R_VOIP_VM_TO;
+            break;
+            }
+        case EDetailToShort:
+            {
+            iTag = &KToShort8;
+            iResourceId = R_VOIP_VM_TO;
+            break;
+            }
+        case EDetailFrom:
+            {
+            iTag = &KFrom8;
+            iResourceId = R_VOIP_VM_FROM;
+            break;
+            }
+        case EDetailFromShort:
+            {
+            iTag = &KFromShort8;
+            iResourceId = R_VOIP_VM_FROM;
+            break;
+            }
+        case EDetailSubject:
+            {
+            iTag = &KSubject8;
+            iResourceId = R_VOIP_VM_SUBJECT;
+            break;
+            }
+        case EDetailSubjectShort:
+            {
+            iTag = &KSubjectShort8;
+            iResourceId = R_VOIP_VM_SUBJECT;
+            break;
+            }
+        case EDetailDate:
+            {
+            iTag = &KDate8;
+            iResourceId = R_VOIP_VM_DATE;
+            break;
+            }
+        case EDetailPriority:
+            {
+            iTag = &KPriority8;
+            iResourceId = R_VOIP_VM_PRIORITY;
+            break;
+            }
+        case EDetailId:
+            {
+            iTag = &KId8;
+            iResourceId = R_VOIP_VM_MSG_ID;
+            break;
+            }
+        default:
+            iTag = &KNullDesC8;
+            iResourceId = KErrNotFound;
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/ipvoicemailengine/src/ipvoicemailengine.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2002 - 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:  This file contains all the resources for vmbx.dll.
+ *
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME    IPVM // 4 letter ID
+
+#include <bldvariant.hrh>
+#include "ipvoicemailengine.loc"
+#include <eikon.rh>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <eikon.rsg>
+#include <eikcore.rsg>
+
+#include <uikon.rh>
+
+//  RESOURCE DEFINITIONS 
+RESOURCE RSS_SIGNATURE {}
+
+RESOURCE TBUF { buf=""; }
+
+RESOURCE TBUF r_voip_new_voice_message
+    { 
+    buf = qtn_voip_new_voice_message;
+    }
+
+RESOURCE TBUF r_voip_new_and_old_voice_msg 
+    { 
+    buf = qtn_voip_new_and_old_voice_msg;
+    }
+
+RESOURCE TBUF r_voip_new_voice_messages 
+    { 
+    buf = qtn_voip_new_voice_messages;
+    }
+
+RESOURCE TBUF r_voip_vm_msg_account 
+    { 
+    buf = qtn_voip_vm_msg_account;
+    }
+
+RESOURCE TBUF r_voip_vm_header_count 
+    { 
+    buf = qtn_voip_vm_header_count;
+    }
+
+RESOURCE TBUF r_voip_vm_to 
+    { 
+    buf = qtn_voip_vm_to;
+    }
+
+RESOURCE TBUF r_voip_vm_from 
+    { 
+    buf = qtn_voip_vm_from;
+    }
+
+RESOURCE TBUF r_voip_vm_subject 
+    { 
+    buf = qtn_voip_vm_subject;
+    }
+
+RESOURCE TBUF r_voip_vm_date 
+    { 
+    buf = qtn_voip_vm_date;
+    }
+
+RESOURCE TBUF r_voip_vm_priority 
+    { 
+    buf = qtn_voip_vm_priority;
+    }
+
+RESOURCE TBUF r_voip_vm_msg_id 
+    { 
+    buf = qtn_voip_vm_msg_id;
+    }
+
+RESOURCE TBUF r_voip_vm_msg_sum_unknown 
+    {
+    buf = qtn_voip_new_voice_messages_sum_unknown;
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/rom/sipconnectionprovider.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* 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: 
+*       IBY file for sipconnectionprovider
+*
+*
+*/
+
+
+#ifndef __SIPCONNECTIONPROVIDER_IBY__
+#define __SIPCONNECTIONPROVIDER_IBY__
+
+ECOM_PLUGIN( sipconnectionprovider.dll, 1027545B.rsc )
+//data=ZSYSTEM/install/sipconnectionprovider_stub.sis System/Install/sipconnectionprovider_stub.sis
+
+#endif // __SIPCONNECTIONPROVIDER_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpconnectingservice.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,194 @@
+/*
+* 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:  
+*
+*/
+
+
+#include "scpconnectingservice.h"
+#include "scpservicehandlerbase.h"
+#include "scpsubservice.h"
+#include "scplogger.h"
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::TScpConnectingService
+// -----------------------------------------------------------------------------
+//
+TScpConnectingService::TScpConnectingService()
+    {
+    SCPLOGSTRING( "TScpConnectingService::TScpConnectingService" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::State
+// -----------------------------------------------------------------------------
+//
+TCCHSubserviceState TScpConnectingService::State() const
+    {
+    SCPLOGSTRING( "TScpConnectingService::State" );
+
+    return ECCHConnecting;
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::EnableL
+// -----------------------------------------------------------------------------
+//
+void TScpConnectingService::EnableL( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::EnableL" );
+
+    // Launch refresh only if the sub service is in error condition
+    // no need to launch refresh if connected iap is not supported -> 
+    // just wait until valid iap is available
+    if( aSubService.LastReportedError() != KErrNone && 
+        aSubService.LastReportedError() != KErrNotSupported )
+        {
+        aSubService.SetEnableRequestedState( CScpSubService::EScpRefreshed );
+        User::LeaveIfError( aSubService.Disable() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::Disable
+// -----------------------------------------------------------------------------
+//
+TInt TScpConnectingService::Disable( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::Disable" );
+
+    if( aSubService.EnableRequestedState() != CScpSubService::EScpRefreshed )
+        { 
+        aSubService.SetEnableRequestedState( CScpSubService::EScpDisabled );
+        }
+        
+    CScpServiceHandlerBase& handler = aSubService.ServiceHandler();
+    TInt result = handler.DisableSubService();
+
+    ChangeState( aSubService, ECCHDisconnecting, KErrNone );
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::NetworkNotFound
+// -----------------------------------------------------------------------------
+//
+void TScpConnectingService::NetworkNotFound( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::NetworkNotFound" );
+    
+    ChangeState( aSubService, ECCHConnecting, KCCHErrorNetworkLost );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::NetworkLost
+// -----------------------------------------------------------------------------
+//
+void TScpConnectingService::NetworkLost( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::NetworkLost" );
+    
+    ChangeState( aSubService, ECCHConnecting, KCCHErrorNetworkLost );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::ServiceConnectionFailed
+// -----------------------------------------------------------------------------
+//
+void TScpConnectingService::ServiceConnectionFailed( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::ServiceConnectionFailed" );
+
+    ChangeState( aSubService, ECCHConnecting, KCCHErrorLoginFailed );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::ServiceInvalidSettings
+// -----------------------------------------------------------------------------
+//
+void TScpConnectingService::ServiceInvalidSettings( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::ServiceInvalidSettings" );
+
+    ChangeState( aSubService, ECCHConnecting, KCCHErrorInvalidSettings );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::ServiceConnected
+// -----------------------------------------------------------------------------
+//
+void TScpConnectingService::ServiceConnected( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::ServiceConnected" );
+
+    ChangeState( aSubService, ECCHEnabled, KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::ServiceDisconnected
+// -----------------------------------------------------------------------------
+//
+void TScpConnectingService::ServiceDisconnected( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::ServiceDisconnected" );
+
+    ChangeState( aSubService, ECCHConnecting, KCCHErrorServiceNotResponding );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::BandwidthLimited
+// -----------------------------------------------------------------------------
+//
+void TScpConnectingService::BandwidthLimited( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::BandwidthLimited" );
+    
+    ChangeState( aSubService, ECCHEnabled, KCCHErrorBandwidthInsufficient ); 
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::AuthenticationFailed
+// -----------------------------------------------------------------------------
+//
+void TScpConnectingService::AuthenticationFailed( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::AuthenticationFailed" );
+    
+    ChangeState( aSubService, ECCHConnecting, KCCHErrorAuthenticationFailed ); 
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::ServiceConnectionCanceled
+// -----------------------------------------------------------------------------
+//
+void TScpConnectingService::ServiceConnectionCanceled( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::ServiceConnectionCanceled" );
+    
+    ChangeState( aSubService, ECCHDisabled, KErrCancel ); 
+    }
+
+// -----------------------------------------------------------------------------
+// TScpConnectingService::BearerNotSupported
+// -----------------------------------------------------------------------------
+//
+void TScpConnectingService::BearerNotSupported( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpConnectingService::BearerNotSupported" );
+    
+    ChangeState( aSubService, ECCHConnecting, KErrNotSupported ); 
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpdisabled.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,131 @@
+/*
+* 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:  
+*
+*/
+
+
+#include "scpdisabled.h"
+#include "scpsubservice.h"
+#include "scpservicehandlerbase.h"
+#include "scplogger.h"
+#include "scputility.h"
+
+// -----------------------------------------------------------------------------
+// TScpDisabled::CTScpDisabled
+// -----------------------------------------------------------------------------
+//
+TScpDisabled::TScpDisabled()
+    {
+    SCPLOGSTRING( "TScpDisabled::TScpDisabled" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpDisabled::State
+// -----------------------------------------------------------------------------
+//
+TCCHSubserviceState TScpDisabled::State() const
+    {
+    SCPLOGSTRING( "TScpDisabled::State" );
+
+    return ECCHDisabled;
+    }
+
+// -----------------------------------------------------------------------------
+// TScpDisabled::EnableL
+// -----------------------------------------------------------------------------
+//
+void TScpDisabled::EnableL( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpDisabled::EnableL" );
+
+    aSubService.SetSubServiceDisconnected( EFalse );
+    aSubService.SetEnableRequestedState( CScpSubService::EScpEnabled );
+
+    CScpServiceHandlerBase& handler = aSubService.ServiceHandler();
+    TRAPD( error, handler.EnableSubServiceL() );
+
+    if ( KErrNoMemory == error )
+        {
+        User::Leave( error );
+        }
+    
+    if( error != KErrNone )
+        {
+        TInt cchError = TScpUtility::ConvertToCchError( error );
+        if( cchError != KErrUnknown ) 
+            {
+            ChangeState( aSubService, ECCHConnecting, cchError );
+            }
+        else
+            {
+            // If another sub service is already in use, no need to
+            // leave
+            if( error != KErrInUse )
+                {
+                User::LeaveIfError( error );
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// TScpDisabled::NetworkFound
+// -----------------------------------------------------------------------------
+//
+void TScpDisabled::NetworkFound( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpDisabled::NetworkFound" );
+
+    ChangeState( aSubService, ECCHConnecting, KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpDisabled::NetworkNotFound
+// -----------------------------------------------------------------------------
+//
+void TScpDisabled::NetworkNotFound( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpDisabled::NetworkNotFound" );
+
+    // This is because some other app has enabled sip profile
+    // and we move from disabled to connecting. But should the update
+    // be done at all? See ServiceManager::UpdateService
+
+    ChangeState( aSubService, ECCHConnecting, KCCHErrorNetworkLost );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpDisabled::NetworkLost
+// -----------------------------------------------------------------------------
+//
+void TScpDisabled::NetworkLost( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpDisabled::NetworkLost" );
+
+    ChangeState( aSubService, ECCHConnecting, KCCHErrorNetworkLost );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpDisabled::ServiceConnected
+// -----------------------------------------------------------------------------
+//
+void TScpDisabled::ServiceConnected( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpDisabled::ServiceConnected" );
+
+    ChangeState( aSubService, ECCHEnabled, KErrNone );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpdisconnecting.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,77 @@
+/*
+* 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:  
+*
+*/
+
+
+#include "scpdisconnecting.h"
+#include "scplogger.h"
+
+// -----------------------------------------------------------------------------
+// TScpDisconnecting::TScpDisconnecting
+// -----------------------------------------------------------------------------
+//
+TScpDisconnecting::TScpDisconnecting()
+    {
+    SCPLOGSTRING( "TScpDisconnecting::TScpDisconnecting" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpDisconnecting::State
+// -----------------------------------------------------------------------------
+//
+TCCHSubserviceState TScpDisconnecting::State() const
+    {
+    SCPLOGSTRING( "TScpDisconnecting::State" );
+
+    return ECCHDisconnecting;
+    }
+
+// -----------------------------------------------------------------------------
+// TScpDisconnecting::Disable
+// -----------------------------------------------------------------------------
+//
+TInt TScpDisconnecting::Disable( CScpSubService& /*aSubService*/ ) const
+    {
+    SCPLOGSTRING( "TScpDisconnecting::Disable" );
+
+    // Already disconnecting
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// TScpDisconnecting::ServiceDisconnected
+// -----------------------------------------------------------------------------
+//
+void TScpDisconnecting::ServiceDisconnected( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpDisconnecting::ServiceDisconnected" );
+
+    ChangeState( aSubService, ECCHDisabled, KErrNone );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpDisconnecting::NetworkLost
+// -----------------------------------------------------------------------------
+//
+void TScpDisconnecting::NetworkLost( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpDisconnecting::NetworkLost" );
+
+    ChangeState( aSubService, ECCHDisabled, KErrNone );
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpenabled.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,128 @@
+/*
+* 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:  
+*
+*/
+
+
+#include "scpenabled.h"
+#include "scpservicehandlerbase.h"
+#include "scpsubservice.h"
+#include "scplogger.h"
+
+// -----------------------------------------------------------------------------
+// TScpEnabled::TScpEnabled
+// -----------------------------------------------------------------------------
+//
+TScpEnabled::TScpEnabled()
+    {
+    SCPLOGSTRING( "TScpEnabled::TScpEnabled" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpEnabled::State
+// -----------------------------------------------------------------------------
+//
+TCCHSubserviceState TScpEnabled::State() const
+    {
+    SCPLOGSTRING( "TScpEnabled::State" );
+
+    return ECCHEnabled;
+    }
+
+// -----------------------------------------------------------------------------
+// TScpEnabled::Disable
+// -----------------------------------------------------------------------------
+//
+TInt TScpEnabled::Disable( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpEnabled::Disable" );
+
+    aSubService.SetEnableRequestedState( CScpSubService::EScpDisabled );
+
+    CScpServiceHandlerBase& handler = aSubService.ServiceHandler();
+    TInt result = handler.DisableSubService();
+
+    ChangeState( aSubService, ECCHDisconnecting, KErrNone );
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// TScpEnabled::NetworkLost
+// -----------------------------------------------------------------------------
+//
+void TScpEnabled::NetworkLost( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpEnabled::NetworkLost" );
+
+    ChangeState( aSubService, ECCHConnecting, KCCHErrorNetworkLost ); 
+    }  
+
+// -----------------------------------------------------------------------------
+// TScpEnabled::ServiceConnected
+// -----------------------------------------------------------------------------
+//
+void TScpEnabled::ServiceConnected( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpEnabled::ServiceConnected" );
+
+    ChangeState( aSubService, ECCHEnabled, KErrNone );        
+    }
+
+// -----------------------------------------------------------------------------
+// TScpEnabled::ServiceConnectionFailed
+// -----------------------------------------------------------------------------
+//
+void TScpEnabled::ServiceConnectionFailed( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpEnabled::ServiceConnectionFailed" );
+
+    ChangeState( aSubService, ECCHConnecting, KCCHErrorLoginFailed );        
+    }
+
+// -----------------------------------------------------------------------------
+// TScpEnabled::ServiceDisconnected
+// -----------------------------------------------------------------------------
+//
+void TScpEnabled::ServiceDisconnected( CScpSubService& aSubService ) const
+    {
+    SCPLOGSTRING( "TScpEnabled::ServiceDisconnected" );
+
+    ChangeState( aSubService, ECCHConnecting, KCCHErrorServiceNotResponding );        
+    }
+
+// -----------------------------------------------------------------------------
+// TScpEnabled::BandwidthLimited
+// -----------------------------------------------------------------------------
+//
+void TScpEnabled::BandwidthLimited( CScpSubService& aSubService ) const 
+    {
+    SCPLOGSTRING( "TScpEnabled::BandwidthLimited" );
+    
+    ChangeState( aSubService, ECCHEnabled, KCCHErrorBandwidthInsufficient ); 
+    }
+
+// -----------------------------------------------------------------------------
+// TScpEnabled::Roaming
+// -----------------------------------------------------------------------------
+//
+void TScpEnabled::Roaming( CScpSubService& aSubService ) const 
+    {
+    SCPLOGSTRING( "TScpEnabled::Roaming" );
+    
+    ChangeState( aSubService, ECCHConnecting, KErrNone ); 
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpimhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,239 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: SCP IM Handler
+*
+*/
+
+
+#include "scpimhandler.h"
+#include "scpsubservice.h"
+#include "scplogger.h"
+#include "scpprofilehandler.h"
+#include "csipclientresolverutils.h"
+
+// Implementation UID of IM Resolver plugin
+const TUid KResolver = { 0x2002133D };
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// CScpImHandler::CCScpImHandler
+// ---------------------------------------------------------------------------
+//
+CScpImHandler::CScpImHandler( CScpSubService& aSubService ) :
+    CScpServiceHandlerBase( aSubService )
+    {
+    SCPLOGSTRING2( "CScpImHandler[0x%x]::CScpImHandler", this )
+    }
+
+// ---------------------------------------------------------------------------
+// CScpImHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CScpImHandler::ConstructL()
+    {
+    SCPLOGSTRING2( "CScpImHandler[0x%x]::ConstructL", this )
+    BaseConstructL();
+    iSipClientResolver = CSipClientResolverUtils::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// CScpPresenceHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CScpImHandler* CScpImHandler::NewL( CScpSubService& aSubService )
+    {
+    SCPLOGSTRING( "CScpImHandler::NewL" )
+    CScpImHandler* self = new ( ELeave ) CScpImHandler( aSubService );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CScpImHandler::~CScpImHandler
+// ---------------------------------------------------------------------------
+//
+CScpImHandler::~CScpImHandler()
+    {
+    SCPLOGSTRING2( "CScpImHandler[0x%x]::~CScpImHandler", this )
+    delete iSipClientResolver;
+    SCPLOGSTRING( "CScpImHandler[0x%x]::~CScpImHandler - Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// From class CScpServiceHandlerBase
+// CScpImHandler::EnableSubServiceL
+// ---------------------------------------------------------------------------
+//
+void CScpImHandler::EnableSubServiceL()
+    {
+    SCPLOGSTRING4( "CScpImHandler[0x%x]::EnableSubServiceL: 0x%x type: %i", 
+                   this, &iSubService, iSubService.SubServiceType() )
+    
+    __ASSERT_DEBUG( ECCHIMSub == iSubService.SubServiceType(), User::Panic(
+        KNullDesC, KErrGeneral ) );
+    
+    CScpServiceHandlerBase::RegisterProfileL();
+    }
+
+// ---------------------------------------------------------------------------
+// From class CScpServiceHandlerBase
+// CScpImHandler::DisableSubService
+// ---------------------------------------------------------------------------
+//
+TInt CScpImHandler::DisableSubService()
+    {
+    SCPLOGSTRING4( "CScpImHandler[0x%x]::DisableSubService: 0x%x type: %i", 
+                   this, &iSubService, iSubService.SubServiceType() )
+    __ASSERT_DEBUG( ECCHIMSub == iSubService.SubServiceType(), User::Panic(
+        KNullDesC, KErrGeneral ) );
+    
+    TInt result( KErrNone );
+
+    TCCHSubserviceState subServiceState = iSubService.State();
+
+    if( ECCHDisabled != subServiceState )
+        {
+        TRAP( result, DeregisterContactHeaderL() );      
+
+        DeregisterProfile();
+        }
+    else
+        {
+        result = KErrNotSupported;
+        }
+
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CScpServiceHandlerBase
+// CScpImHandler::SubServiceType
+// ---------------------------------------------------------------------------
+//
+TCCHSubserviceType CScpImHandler::SubServiceType() const
+    {
+    SCPLOGSTRING2( "CScpImHandler[0x%x]::SubServiceType", this )
+    return ECCHIMSub;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CScpServiceHandlerBase
+// CScpImHandler::HandleSipConnectionEvent
+// ---------------------------------------------------------------------------
+//
+void CScpImHandler::HandleSipConnectionEvent( TUint32 aProfileId,
+    TScpConnectionEvent aEvent )
+    {
+    SCPLOGSTRING2( "CScpImHandler[0x%x]::HandleSipConnectionEvent", this )
+    TRAP_IGNORE( HandleSipConnectionEventL( aProfileId, aEvent ) )
+    SCPLOGSTRING( "CScpImHandler::HandleSipConnectionEvent - Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// Handle SIP connection event
+// ---------------------------------------------------------------------------
+//
+void CScpImHandler::HandleSipConnectionEventL( const TUint32 aProfileId,
+    TScpConnectionEvent aEvent )
+    {
+    SCPLOGSTRING4(
+    "CScpImHandler[0x%x]::HandleSipConnectionEventL, profileID: %d event: %d",
+        this, aProfileId, aEvent )
+    
+    if ( iSubService.SipProfileId() == aProfileId &&
+        CScpSubService::EScpNoRequest != iSubService.EnableRequestedState() )
+        {
+        if ( EScpRegistered == aEvent && CScpSubService::EScpEnabled ==
+            iSubService.EnableRequestedState() )
+            {
+            RBuf8 contactHeaderUser;
+            contactHeaderUser.CleanupClosePushL();
+            GetSipProfileContactHeaderUserL( contactHeaderUser );
+            
+            TInt32 uniqueId = iSubService.SipProfileId();
+            TUid uniqueUid;
+            uniqueUid.iUid = uniqueId;
+            
+            iSipClientResolver->RegisterClientWithUserL(
+                uniqueUid, contactHeaderUser, KResolver );
+            
+            CleanupStack::PopAndDestroy( &contactHeaderUser );
+            }
+        
+        iSubService.HandleConnectionEvent( aEvent );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get SIP profile contact header user
+// ---------------------------------------------------------------------------
+//
+void CScpImHandler::GetSipProfileContactHeaderUserL(
+    RBuf8& aContactHeaderUser ) const
+    {
+    SCPLOGSTRING2( "CScpImHandler[0x%x]::GetSipProfileContactHeaderUserL",
+        this )
+    
+    TUint32 sipProfileId = iSubService.SipProfileId();
+    CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+    CScpSipConnection* sipConnection = profileHandler.CreateSipConnectionL(
+        sipProfileId );
+    CleanupStack::PushL( sipConnection );
+    
+    if( sipConnection )
+        {
+        User::LeaveIfError( sipConnection->GetContactHeaderUser(
+            aContactHeaderUser ) );
+        __ASSERT_DEBUG( aContactHeaderUser.Length() > 0, User::Panic(
+            KNullDesC, KErrGeneral ) );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    CleanupStack::PopAndDestroy( sipConnection );
+    
+    SCPLOGSTRING( "CScpImHandler::GetSipProfileContactHeaderUserL - Out" )
+    }
+
+// ---------------------------------------------------------------------------
+// Deregister contact header
+// ---------------------------------------------------------------------------
+//
+void CScpImHandler::DeregisterContactHeaderL()
+    {
+    SCPLOGSTRING2( "CScpImHandler[0x%x]::DeregisterContactHeaderL", this )
+
+    RBuf8 contactHeaderUser;
+    contactHeaderUser.CleanupClosePushL();
+
+    GetSipProfileContactHeaderUserL( contactHeaderUser );
+    
+    TInt32 uniqueId = iSubService.SipProfileId();
+    TUid uniqueUid;
+    uniqueUid.iUid = uniqueId;
+    
+    iSipClientResolver->UnRegisterClientWithUserL( 
+        uniqueUid,
+        contactHeaderUser );
+    
+    CleanupStack::PopAndDestroy( &contactHeaderUser );
+    
+    SCPLOGSTRING( "CScpImHandler::DeregisterContactHeaderL - Out" )
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpplugin.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,336 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <ecom.h>
+#include <implementationproxy.h>
+#include <e32debug.h>
+
+#include "scpplugin.h"
+#include "scpservicemanager.h"
+#include "scplogger.h"
+#include "sipconnectionprovideruids.hrh"
+
+// -----------------------------------------------------------------------------
+// CScpPlugin::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CScpPlugin::ConstructL()
+    {
+    SCPLOGSTRING( "CScpPlugin::ConstructL" );
+
+    iServiceManager = CScpServiceManager::NewL( iServiceObserver );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CScpPlugin::CScpPlugin()
+// -----------------------------------------------------------------------------
+//
+CScpPlugin::CScpPlugin( MCchServiceObserver& serviceObserver ) :
+    iServiceObserver( serviceObserver )
+    {
+	}
+
+	
+// -----------------------------------------------------------------------------
+// CScpPlugin::NewL
+// -----------------------------------------------------------------------------
+//
+CScpPlugin* CScpPlugin::NewL( TAny* aParam )
+	{
+    SCPLOGSTRING2( "CScpPlugin::NewL aParam: 0x%x", aParam );
+    __ASSERT_DEBUG( aParam, User::Panic( KNullDesC, KErrGeneral ) );
+
+    MCchServiceObserver& serviceObserver = *((MCchServiceObserver*)(aParam)); 
+
+    CScpPlugin* self = new ( ELeave ) CScpPlugin( serviceObserver );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CScpPlugin::~CScpPlugin
+// -----------------------------------------------------------------------------
+//
+CScpPlugin::~CScpPlugin()
+	{
+	delete iServiceManager;
+	}
+  
+// -----------------------------------------------------------------------------
+// CScpPlugin::EnableServiceL
+// -----------------------------------------------------------------------------
+//
+void CScpPlugin::EnableServiceL( const TServiceSelection& aServiceSelection )
+    {
+    SCPLOGSTRING3( "CScpPlugin::EnableServiceL service id: %d type: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType );
+
+    iServiceManager->EnableServiceL( aServiceSelection.iServiceId, 
+                                     aServiceSelection.iType );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPlugin::EnableServiceL
+// -----------------------------------------------------------------------------
+//
+void CScpPlugin::EnableServiceL( const TServiceSelection& aServiceSelection,
+                                 TUint aIapId )
+    {
+    SCPLOGSTRING4( "CScpPlugin::EnableServiceL service id: %d type: %d iap id: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType, aIapId );
+
+    iServiceManager->EnableServiceL( aServiceSelection.iServiceId, 
+                                     aServiceSelection.iType, 
+                                     aIapId );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPlugin::DisableServiceL
+// -----------------------------------------------------------------------------
+//
+void CScpPlugin::DisableServiceL( const TServiceSelection& aServiceSelection )
+    {
+    SCPLOGSTRING3( "CScpPlugin::DisableServiceL service id: %d type: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType );
+
+    iServiceManager->DisableServiceL( aServiceSelection.iServiceId, 
+                                      aServiceSelection.iType );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPlugin::IsAvailableL
+// -----------------------------------------------------------------------------
+//
+TBool CScpPlugin::IsAvailableL( const TServiceSelection& aServiceSelection,
+                                const RArray<TUint32>& aIapIdArray ) const
+    {
+    SCPLOGSTRING3( "CScpPlugin::IsAvailableL service id: %d type: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType );
+
+    return iServiceManager->IsAvailableL( aServiceSelection.iServiceId, 
+                                          aServiceSelection.iType, aIapIdArray );
+    }
+ 
+// -----------------------------------------------------------------------------
+// CScpPlugin::GetServiceState
+// -----------------------------------------------------------------------------
+//
+TInt CScpPlugin::GetServiceState( const TServiceSelection& aServiceSelection, 
+                                  TCCHSubserviceState& aState ) const
+    {
+    SCPLOGSTRING3( "CScpPlugin::GetServiceState service id: %d type: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType );
+
+    return iServiceManager->GetServiceState( aServiceSelection.iServiceId, 
+                                             aServiceSelection.iType, aState );
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpPlugin::GetServiceNetworkInfo
+// -----------------------------------------------------------------------------
+//
+TInt CScpPlugin::GetServiceNetworkInfo( TServiceConnectionInfo& aConnectionInfo ) const
+    {
+    TServiceSelection& selection = aConnectionInfo.iServiceSelection;
+
+    SCPLOGSTRING3( "CScpPlugin::GetServiceNetworkInfo service id: %d type: %d",
+                   selection.iServiceId, selection.iType );
+
+    // this should be changed to accept TServiceConnectionInfo 
+    return iServiceManager->GetServiceNetworkInfo( selection.iServiceId,
+                                                   selection.iType,
+                                                   aConnectionInfo.iSNAPId,
+                                                   aConnectionInfo.iIapId,
+                                                   aConnectionInfo.iSNAPLocked,
+                                                   aConnectionInfo.iPasswordSet );
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpPlugin::SetSnapId
+// -----------------------------------------------------------------------------
+//
+TInt CScpPlugin::SetSnapId( const TServiceSelection& aServiceSelection,
+                            TUint aSnapId )
+    {
+    SCPLOGSTRING4( "CScpPlugin::SetSnapId service id: %d type: %d Snap %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType, aSnapId );
+
+    return iServiceManager->SetSnapId( aServiceSelection.iServiceId, 
+                                       aServiceSelection.iType, 
+                                       aSnapId );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPlugin::SetIapId
+// -----------------------------------------------------------------------------
+//
+TInt CScpPlugin::SetIapId( const TServiceSelection& aServiceSelection,
+                           TUint aIapId )
+    {
+    SCPLOGSTRING4( "CScpPlugin::SetIapId service id: %d type: %d iap id %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType, aIapId );
+
+    return iServiceManager->SetIapId( aServiceSelection.iServiceId, 
+                                      aServiceSelection.iType, 
+                                      aIapId );
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpPlugin::GetServiceInfo
+// -----------------------------------------------------------------------------
+//
+void CScpPlugin::GetServiceInfoL( const TServiceSelection& aServiceSelection,
+                                  RBuf& aBuffer ) const
+    {
+    SCPLOGSTRING3( "CScpPlugin::GetServiceInfoL service id: %d type: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType );
+
+    iServiceManager->GetServiceInfoL( aServiceSelection.iServiceId, 
+                                      aServiceSelection.iType, 
+                                      aBuffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPlugin::ReserveService
+// -----------------------------------------------------------------------------
+//
+TInt CScpPlugin::ReserveService( const TServiceSelection& aServiceSelection )
+    {
+    return iServiceManager->SetServiceReserved( ETrue,
+                                                aServiceSelection.iServiceId, 
+                                                aServiceSelection.iType );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPlugin::FreeService
+// -----------------------------------------------------------------------------
+//
+TInt CScpPlugin::FreeService( const TServiceSelection& aServiceSelection )
+    {
+    return iServiceManager->SetServiceReserved( EFalse,
+                                                aServiceSelection.iServiceId, 
+                                                aServiceSelection.iType );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPlugin::IsReserved
+// -----------------------------------------------------------------------------
+//
+TBool CScpPlugin::IsReserved( const TServiceSelection& aServiceSelection ) const
+    {
+    return iServiceManager->IsReserved( aServiceSelection.iServiceId, 
+                                        aServiceSelection.iType );
+    }
+
+// -----------------------------------------------------------------------------
+// GetConnectionParameter
+// -----------------------------------------------------------------------------
+//
+TInt CScpPlugin::GetConnectionParameter( 
+                             const TServiceSelection& aServiceSelection,
+                             TCchConnectionParameter aParameter,
+                             TInt& aValue ) const
+    {
+    SCPLOGSTRING3( "CScpPlugin::GetConnectionParameter (TInt return) service id: %d type: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType );
+
+    TRAPD( error, iServiceManager->GetConnectionParameterL( aServiceSelection, aParameter, aValue ) );
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// GetConnectionParameter
+// -----------------------------------------------------------------------------
+//
+TInt CScpPlugin::GetConnectionParameter( 
+                             const TServiceSelection& aServiceSelection, 
+                             TCchConnectionParameter aParameter,
+                             RBuf& aValue ) const
+    {
+    SCPLOGSTRING3( "CScpPlugin::GetConnectionParameter (TBuf return) service id: %d type: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType );
+
+    TRAPD( error, iServiceManager->GetConnectionParameterL( aServiceSelection, aParameter, aValue ) );
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// SetConnectionParameter
+// -----------------------------------------------------------------------------
+//
+TInt CScpPlugin::SetConnectionParameter( 
+                             const TServiceSelection& aServiceSelection, 
+                             TCchConnectionParameter aParameter,
+                             TInt aValue )
+    {
+    SCPLOGSTRING3( "CScpPlugin::SetConnectionParameter(TInt) service id: %d type: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType );
+    
+    TRAPD( error, iServiceManager->SetConnectionParameterL( aServiceSelection, aParameter, aValue ) );
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// SetConnectionParameter
+// -----------------------------------------------------------------------------
+//
+TInt CScpPlugin::SetConnectionParameter( 
+                     const TServiceSelection& aServiceSelection, 
+                     TCchConnectionParameter aParameter,
+                     const TDesC& aValue )
+    {
+    SCPLOGSTRING3( "CScpPlugin::SetConnectionParameter(TDesC) service id: %d type: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType );
+
+    TRAPD( error, iServiceManager->SetConnectionParameterL( aServiceSelection, aParameter, aValue ); )  
+    return error;
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//
+// Rest of the file is for ECom initialization. 
+//
+
+// Map the interface UIDs
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KSIPConnectivityPluginImplUid, CScpPlugin::NewL )
+    };
+
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy implements for ECom
+// Exported proxy for instantiation method resolution
+// Returns: ImplementationTable
+// -----------------------------------------------------------------------------
+//
+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/voipplugins/sipconnectionprovider/src/scppresencehandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1124 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Presence handler.
+*
+*/
+#include <ximperrors.hrh>
+#include <ximpcontext.h>
+#include <presenceinfo.h> //MximpPresenceInfo
+#include <presenceinfofilter.h> //info filtter
+#include <presenceinfofield.h> //MximpPresenceInfoField
+#include <ximpobjectfactory.h>
+#include <presenceobjectfactory.h>
+#include <servicepresenceinfo.h> //MximpServicePresenceInfo
+#include <presenceinfofieldvalueenum.h> //MximpPresenceInfoFieldValueEnum
+#include <presenceinfofieldcollection.h> //MximpPresenceInfoFieldCollection
+#include <presenceinfofieldvaluetext.h> //MximpPresenceInfoFieldValueText
+#include <personpresenceinfo.h> // MximpPersonPresenceInfo
+#include <presencepublishing.h>//MPresencePublishing
+#include <ximpfeatureinfo.h>
+#include <presencefeatures.h>
+#include <ximpidentity.h> //for MXIMPIdentity
+#include <presentitygroups.h>
+
+#include <ximprequestcompleteevent.h>
+#include <ximpcontextstateevent.h>
+#include <ownpresenceevent.h>
+#include <ximpclient.h>
+#include <ximpcontext.h>
+#include <ximpstatus.h>
+#include <pressettingsapi.h> //presence settings
+#include <XdmSettingsApi.h>
+#include <cvimpstsettingsstore.h>
+
+#include "scppresencehandler.h"
+#include "scpsubservice.h"
+#include "scpservicestorage.h"
+#include "scplogger.h"
+#include "scputility.h"
+#include "scpservice.h"
+#include "scpprofilehandler.h"
+#include "scpsettinghandler.h"
+#include "scppresencehandlerrequest.h"
+
+const TInt KXdmDmMaxIntLength      = 10;   // max length of 32bit integer
+const TInt KMaxPresenceEnableCount = 5;
+const TInt KCustomMessageMaxLength = 75;
+const TInt KBufSize255 = 255;
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::NewL
+// -----------------------------------------------------------------------------
+//
+CScpPresenceHandler* CScpPresenceHandler::NewL( CScpSubService& aSubService )
+    {
+    SCPLOGSTRING( "CScpPresenceHandler::NewL" );
+    CScpPresenceHandler* self = new ( ELeave ) CScpPresenceHandler( aSubService );
+    CleanupStack::PushL( self );    
+    self->ConstructL();    
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::CCScpPresenceHandler
+// -----------------------------------------------------------------------------
+//
+CScpPresenceHandler::CScpPresenceHandler( CScpSubService& aSubService ) :
+    CScpServiceHandlerBase( aSubService ),
+    iPresenceState( ENoBind ),
+    iDisableAfterXimpRequestsCompleted( EFalse ),
+    iNetworkLostRoamingOngoing( EFalse )
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::CScpPresenceHandler", this );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::ConstructL()
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::ConstructL", this );
+
+    BaseConstructL();
+    GetPresencePropertyIdL( ESubPropertyPresenceSettingsId, iPresenceSettingsId );
+    
+    iPresClient = MXIMPClient::NewClientL();
+    SCPLOGSTRING2( "CScpPresenceHandler::ConstructL, iPresClient [0x%x]", iPresClient );
+
+    if ( iPresClient )
+        {
+        // Set presence handler as observer of Voip subservice
+        CScpSubService* voipSubService = GetVoipSubService();
+        if ( voipSubService )
+            {
+            voipSubService->SetSubServiceObserver( this );
+            }
+        
+        MXIMPContext* tmp = iPresClient->NewPresenceContextLC();        
+        iFeature = MPresenceFeatures::NewL( tmp );
+        
+        RArray<TInt32> eventFilter;   
+        CleanupClosePushL( eventFilter );
+
+        eventFilter.Append( XIMP_IF_ID_REQUEST_COMPLETE_EVENT );     
+        eventFilter.Append( XIMP_IF_ID_CONTEXT_STATE_EVENT );
+        
+        TArray<TInt32> eventFilterArray = eventFilter.Array();
+        tmp->RegisterObserverL( *this, &eventFilterArray );
+        
+        CleanupStack::PopAndDestroy( &eventFilter );
+
+        CleanupStack::Pop(); // tmp
+        iPresenceCtx = tmp;
+        tmp = NULL; 
+        }
+    else
+        {
+        User::Leave( KErrGeneral );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::~CScpPresenceHandler
+// -----------------------------------------------------------------------------
+//
+CScpPresenceHandler::~CScpPresenceHandler()
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::~CScpPresenceHandler", this );
+
+    CancelDisableTimer();
+    
+    iReqIdArray.Close();
+    
+    delete iFeature;
+    delete iPresenceCtx;
+    
+    // Set observer of Voip subservice to NULL
+    CScpSubService* voipSubService = GetVoipSubService();
+    if ( voipSubService )
+        {
+        voipSubService->SetSubServiceObserver( NULL );
+        }
+    
+    delete iPresClient;
+    }
+
+
+// ====================== From CScpServiceHandlerBase ==========================
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::EnableSubServiceL
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::EnableSubServiceL()
+    {
+    SCPLOGSTRING4( "CScpPresenceHandler[0x%x]::EnableSubServiceL: 0x%x type: %i", 
+                   this, &iSubService, iSubService.SubServiceType() );
+       
+    __ASSERT_DEBUG( iSubService.SubServiceType() == ECCHPresenceSub,
+                    User::Panic( KNullDesC, KErrGeneral ) );     
+
+    CScpServiceHandlerBase::RegisterProfileL();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::DisableSubService
+// -----------------------------------------------------------------------------
+//
+TInt CScpPresenceHandler::DisableSubService()
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::DisableSubService", this );
+    __ASSERT_DEBUG( iSubService.SubServiceType() == ECCHPresenceSub,
+                    User::Panic( KNullDesC, KErrGeneral ) );  
+
+    TInt result = KErrNone;
+    // Publish offline and unbind presence context
+    TRAP( result, HandleDeregistrationL( ETrue ) );
+    
+    if ( KErrNone == result  )
+        {
+        // Deregister if still connecting
+        if ( iSubService.State() == ECCHConnecting )
+            {
+            DeregisterNow();            
+            }
+        else
+            {
+            StartForcedDisableTimer( CScpPresenceHandler::ForcePresenceServiceDisable );
+            }
+        }
+    else
+        {
+        
+        // Wait for XIMP request to be completed and handle 
+        // de-registration after that or after force disable timer expires
+        if ( iReqIdArray.Count() )
+            {
+            iDisableAfterXimpRequestsCompleted = ETrue;
+            StartForcedDisableTimer( CScpPresenceHandler::ForcePresenceServiceDisable );
+            }
+        else
+            {
+            DeregisterNow();
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::SubServiceType
+// -----------------------------------------------------------------------------
+//
+TCCHSubserviceType CScpPresenceHandler::SubServiceType() const
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::SubServiceType", this );
+    return ECCHPresenceSub;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::HandleSipConnectionEvent
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::HandleSipConnectionEvent( const TUint32 aProfileId,
+                                                    TScpConnectionEvent aEvent )
+    {
+    SCPLOGSTRING4( "CScpPresenceHandler[0x%x]::HandleSipConnectionEvent id: %d event: %d",
+                   this, aProfileId, aEvent );
+    
+    iNetworkLostRoamingOngoing = EFalse;
+    
+    if ( iSubService.SipProfileId() == aProfileId &&
+        iSubService.EnableRequestedState() != CScpSubService::EScpNoRequest )
+        {
+        if ( EScpDeregistered == aEvent && 
+             iSubService.EnableRequestedState() == CScpSubService::EScpEnabled )
+            {
+            SCPLOGSTRING( "CScpPresenceHandler - EScpDeregistered -> unbind" );
+            TRAPD( err, HandleDeregistrationL( EFalse ) ); 
+            if ( KErrNotReady == err )
+                {
+                SCPLOGSTRING( "CScpPresenceHandler - EScpDeregistered -> not ready: unbind" );
+                TRAP_IGNORE( ServerUnBindL() );
+                }
+            }
+        //if network lost, unbind context
+        if ( EScpNetworkLost == aEvent )
+            {
+            SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> unbind" );
+            TRAPD( err, HandleDeregistrationL( EFalse ) );
+            
+            if ( KErrNotReady == err )
+                {
+                SCPLOGSTRING( "CScpPresenceHandler - EScpNetworkLost -> not ready: unbind" );
+                TRAP_IGNORE( ServerUnBindL() );
+                }
+            
+            TUint32 snapId;
+            CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+            CScpSipConnection* sipConnection = profileHandler.GetSipConnection( iSubService.SipProfileId() );
+            
+            if ( sipConnection )
+                {
+                TInt error = sipConnection->GetSnap( snapId );
+                
+                if ( !error && sipConnection->IsSnapConnectionAvailable( snapId ) )
+                    {
+                    iNetworkLostRoamingOngoing = ETrue;
+                    }
+                }
+            }
+        
+        if ( EScpRoaming == aEvent )
+            {
+            SCPLOGSTRING( "CScpPresenceHandler - EScpRoaming -> unbind" );
+            TRAP_IGNORE( ServerUnBindL() );
+            }
+        
+        //if registered, time to bind context
+        if ( EScpRegistered == aEvent &&
+             CScpSubService::EScpEnabled == iSubService.EnableRequestedState() )
+            {
+            SCPLOGSTRING( "CScpPresenceHandler - EScpRegistered -> update iap and bind" );
+            // update xmd settings 
+            TRAPD( err, UpdateXdmSettingsL() );
+            
+            if ( KErrNone == err )
+                {
+                // Subscribe
+                TRAP( err, ServerBindL() );
+                iRebind = EFalse;
+                
+                if( KErrNone == err )
+                    {
+                    // Still connecting the service
+                    aEvent = EScpNetworkFound;    
+                    }
+                else
+                    {
+                    SCPLOGSTRING2( "ServerBindL failed: %d", err );
+                    aEvent = EScpRegistrationPending;
+                    if ( KErrAlreadyExists == err )
+                        {
+                        // Ximp does not set request to queue, so we have to do rebind later
+                        SCPLOGSTRING( "CScpPresenceHandler - rebind later" ); 
+                        iRebind = ETrue;
+                        }
+                    }
+                }
+            else
+                {
+                SCPLOGSTRING2( "UpdateXdmSettingsL: %d", err );
+                aEvent = EScpRegistrationFailed;
+                }
+            }
+        else if ( EScpDeregistered == aEvent &&
+                 iSubService.EnableRequestedState() == CScpSubService::EScpDisabled ||
+                 iSubService.EnableRequestedState() == CScpSubService::EScpRefreshed )
+            {
+            if ( EScpRegistered != aEvent && ECCHDisconnecting != iSubService.State() )
+                {
+                CancelDisableTimer();
+                }
+            
+            // If this flag is still true, it could be that presence server
+            // has not given answer -> ximp requests cannot be completed.
+            // But still have to unbind from ximp context
+            if ( iDisableAfterXimpRequestsCompleted )
+                {
+                TRAP_IGNORE( ServerUnBindL() );
+                }
+            
+            // When SIP is deregistered, change presence state to no bind
+            iPresenceState = ENoBind;
+            }
+        iSubService.HandleConnectionEvent( aEvent );
+        }
+    SCPLOGSTRING( "CScpPresenceHandler::HandleSipConnectionEvent OUT" );
+    }    
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::HandleSipConnectionEvent
+// -----------------------------------------------------------------------------
+//
+TBool CScpPresenceHandler::IsSipProfileAllowedToStartAlr()
+    {
+    return EFalse;
+    }
+
+// ======================= From MXIMPContextObserver ===========================
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::HandlePresenceContextEvent
+// -----------------------------------------------------------------------------
+//   
+void CScpPresenceHandler::HandlePresenceContextEvent(
+    const MXIMPContext& /*aContext*/,
+    const MXIMPBase& aEvent )
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::HandlePresenceContextEvent", this );
+
+    const TInt32 eventType = aEvent.GetInterfaceId();
+    
+    switch ( eventType )
+        {
+        case MXIMPContextStateEvent::KInterfaceId:
+            {
+            HandleContextStateEvent( aEvent );
+            break;
+            }
+
+        case MXIMPRequestCompleteEvent::KInterfaceId:
+            {
+            HandleRequestCompleteEvent( aEvent );
+            break;
+            }
+              
+        default:
+            {
+            break;
+            }
+        }
+    SCPLOGSTRING( "CScpPresenceHandler::HandlePresenceContextEvent end" ); 
+    }
+
+
+
+// ===================== From MScpSubServiceObserver ===========================
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::HandleSubServiceChange
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::HandleSubServiceChange( TCCHSubserviceState aState, TInt aError )
+    {
+    SCPLOGSTRING4( "CScpPresenceHandler::HandleSubServiceChange presence subservice state: %d, aState: %d, aError: %d", 
+                    iSubService.State(), aState, aError );
+                    
+    if ( iSubService.State() == ECCHEnabled && ( aError == KCCHErrorBandwidthInsufficient || aError == KErrNone ) )
+        {
+        if( aState == ECCHEnabled && aError == KErrNone )
+            {
+            if ( EPresenceOffline == iPresenceState )
+                {
+                SCPLOGSTRING( "CScpPresenceHandler::HandleSubServiceChange PublishOnline" );
+                TRAP_IGNORE( PublishPresenceL( ETrue ) );
+                }
+            }
+        else
+            {
+            if ( EPresenceOnline == iPresenceState && aState != ECCHConnecting )
+                {
+                SCPLOGSTRING( "CScpPresenceHandler::HandleSubServiceChange PublishOffline" );
+                // Unsubscribe from the list first
+                TRAP_IGNORE( UnsubscribePresentityGroupL() );
+                TRAP_IGNORE( PublishPresenceL( EFalse ) );
+                }
+            }
+        }
+    }
+ 
+// ========================= Other member funcions =============================
+
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::GetVoipSubService
+// -----------------------------------------------------------------------------
+//
+CScpSubService* CScpPresenceHandler::GetVoipSubService()
+    {
+    CScpSubService* voipSubService = NULL;
+    CScpServiceStorage& serviceStorage = iSubService.ServiceStorage();
+    CScpService* service = serviceStorage.GetServiceByServiceId( iSubService.SubServiceId() );
+
+    if ( service )
+        {
+        voipSubService = service->GetSubServiceByType( ECCHVoIPSub );
+        }
+    
+    return voipSubService;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::DeregisterNow
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::DeregisterNow()
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::DeregisterNow",
+                   this );
+    
+    CancelDisableTimer();
+  
+    iReqIdArray.Reset();
+    iPresenceState = ENoBind;
+
+    // Check if disable was not requested
+    if ( iSubService.EnableRequestedState() == CScpSubService::EScpEnabled )
+        {
+        // Check the last ximp error
+        if ( KErrNoMemory == iLastXimpError && 
+            KMaxPresenceEnableCount < iSubService.EnableCounter() )
+            {
+            // No memory means 401 Unauthorized, we are trying to enable  
+            // KMaxPresenceEnableCount times -> no more, this is truly
+            // autentication failed.
+            iSubService.HandleConnectionEvent( EScpAuthenticationFailed );
+            }
+        else
+            {
+            iSubService.HandleConnectionEvent( EScpDeregistered );
+            }
+        }
+    else
+        {
+        DeregisterProfile();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::ForcePresenceServiceDisable
+// -----------------------------------------------------------------------------
+//
+TInt CScpPresenceHandler::ForcePresenceServiceDisable( TAny* aSelf )
+    {
+    SCPLOGSTRING( "CScpPresenceHandler::ForcePresenceServiceDisable" );
+
+    CScpPresenceHandler* self = static_cast<CScpPresenceHandler*>( aSelf );
+
+    self->DeregisterNow();
+
+    return 1;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::UpdateXdmSettingsL
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::UpdateXdmSettingsL()
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::UpdateXdmSettingsL", this );
+    
+    // Get IAP id of sip profile
+    CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+    CScpSipConnection* sipConnection = profileHandler.GetSipConnection( iSubService.SipProfileId() );
+    if ( !sipConnection )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    TUint32 apId = 0;
+    User::LeaveIfError( sipConnection->GetIap( apId ) );
+    
+    SCPLOGSTRING2( "CScpPresenceHandler::UpdateXdmSettingsL apId is %d", apId );
+    
+    TPresSettingsSet mySet;
+    User::LeaveIfError( PresSettingsApi::SettingsSetL( iPresenceSettingsId, mySet ));
+        
+    // set iap id to xdm settings
+    HBufC* idBuf = HBufC::NewLC( KXdmDmMaxIntLength );
+    TPtr ptrBuf = idBuf->Des();
+    ptrBuf.AppendNum( apId );
+        
+    TXdmSettingsApi::UpdatePropertyL( mySet.iXDMSetting, *idBuf, EXdmPropToNapId );
+    CleanupStack::PopAndDestroy( idBuf );
+
+    SCPLOGSTRING( "CScpPresenceHandler::UpdateXdmSettingsL status online end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::GetPresencePropertyIdL
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::GetPresencePropertyIdL( TServicePropertyName aProperty,
+                                                    TInt& aValue ) const
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::GetPresenceSettingsId", this );
+    
+    CScpServiceStorage& serviceStorage = iSubService.ServiceStorage();
+    CScpSettingHandler& settingHandler = serviceStorage.SettingsHandler();
+    
+    settingHandler.GetSPSettingsIntPropertyL( iSubService.SubServiceId(),
+        aProperty, 
+        aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::PublishPresenceL
+// Publishes presence according to given parameter.
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::PublishPresenceL( TBool aPublishOnline )
+    {
+    SCPLOGSTRING3( "CScpPresenceHandler[0x%x]::PublishPresenceL, aPublishOnline = %d",
+        this, aPublishOnline );
+
+    // Get the management interface
+    MPresencePublishing* presPub = &( iFeature->PresencePublishing() );
+    // publish own presence in here
+    MPresenceInfo* info = CreateInfoLC( aPublishOnline );
+    TScpReqId reqId;
+    
+    if ( aPublishOnline )
+        {
+        reqId.SetType( EPublishOnlineReq );
+        iPresenceState = EPublishing;
+        }
+    else
+        {
+        reqId.SetType( EPublishOfflineReq );
+        iPresenceState = EPresenceOffline;
+        }
+        
+    reqId.SetId( presPub->PublishOwnPresenceL( *info ) ); 
+    iReqIdArray.Append( reqId );
+    
+    CleanupStack::PopAndDestroy( 1 );
+    
+    SCPLOGSTRING( "CScpPresenceHandler::PublishPresenceL end" ); 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::ServerBindL
+// Binds the presence context
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::ServerBindL()
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::ServerBindL", this );
+    SCPLOGSTRING2( "CScpPresenceHandler::ServerBindL -> bind service: %d", 
+        iSubService.SubServiceId() );
+    
+    //Bind context to desired presence service
+    TInt propertyId = 0;
+    GetPresencePropertyIdL( EPropertyPCSPluginId, propertyId );
+    TUid protocolUid = TUid::Uid( propertyId );
+    
+    TScpReqId reqId;
+    reqId.SetType( EBindReq );
+    reqId.SetId( iPresenceCtx->BindToL( protocolUid, iSubService.SubServiceId() ) );
+    iReqIdArray.Append( reqId );
+    iPresenceState = EBinding;
+    SCPLOGSTRING( "CScpPresenceHandler::ServerBindL end" );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::ServerUnBindL
+// Unbinds the presence context
+// -----------------------------------------------------------------------------
+//
+void  CScpPresenceHandler::ServerUnBindL()
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::ServerUnBindL", this );
+    TScpReqId reqId;
+    reqId.SetType( EUnBindReq );
+    reqId.SetId( iPresenceCtx->UnbindL() );
+    iReqIdArray.Append( reqId ); 
+    iPresenceState = EUnBinding;
+    SCPLOGSTRING( "CScpPresenceHandler::ServerUnBindL end" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::HandleDeregistrationL
+// Handles the deregistration of presence.
+// -----------------------------------------------------------------------------
+//    
+void CScpPresenceHandler::HandleDeregistrationL( TBool aDoStopPublish )
+    {
+     SCPLOGSTRING4( "CScpPresenceHandler[0x%x]::HandleDeregistrationL, aDoStopPublish: %d, iPresenceState: %d",
+             this, aDoStopPublish, iPresenceState );
+
+    if ( EPresenceOnline == iPresenceState 
+        && aDoStopPublish && 
+        iSubService.LastReportedError() == KErrNone )
+        {
+        // Get the management interface
+        MPresencePublishing* presPub = &( iFeature->PresencePublishing() );
+        // publish own presence in here
+        MPresenceInfo* info = CreateInfoLC( EFalse );
+        TScpReqId reqId;
+        // After publishing offline, we need to unbind because we are
+        // deregistering, so offline request id needs to be saved and handled
+        reqId.SetType( EPublishOfflineReq );
+        reqId.SetId( presPub->PublishOwnPresenceL( *info ) );
+        iPresenceState = EPresenceOffline;
+        iReqIdArray.Append( reqId );
+        CleanupStack::PopAndDestroy( 1 );  // info
+        }
+    else
+        {
+        //unbind if there are no other requests going on. 
+        //in case of ongoing unprocessed requests, 
+        //reset array (further events ignored) and
+        //leave here to deregister properly
+        if ( iReqIdArray.Count() > 0 )
+            {
+            User::Leave( KErrNotReady );
+            }
+        else
+            {
+            ServerUnBindL();
+            }
+        }
+
+    SCPLOGSTRING( "CScpPresenceHandler::HandleDeregistrationL end" );
+    } 
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::CreateInfoLC
+// Creates presence info item
+// -----------------------------------------------------------------------------
+//  
+MPresenceInfo* CScpPresenceHandler::CreateInfoLC( TBool aState )
+    {
+    SCPLOGSTRING2( "CScpPresenceHandler[0x%x]::CreateInfoLC", this );
+    
+    MPresenceInfo* info = 
+        iFeature->PresenceObjectFactory().NewPresenceInfoLC();
+    // fill service info
+    MServicePresenceInfo* srvInfo = 
+        iFeature->PresenceObjectFactory().NewServicePresenceInfoLC();
+    srvInfo->SetServiceTypeL( 
+        NPresenceInfo::NServiceType::KVoip );  // voip
+
+    MPresenceInfoField* infoField = 
+        iFeature->PresenceObjectFactory().NewInfoFieldLC();
+    
+    MPresenceInfoFieldValueEnum* enumField = 
+       iFeature->PresenceObjectFactory().NewEnumInfoFieldLC();
+       
+    // Set the textfield's value according to aState    
+    if ( aState )
+        {  
+        enumField->SetValueL( NPresenceInfo::EAvailable );
+        }
+     else
+        {
+        enumField->SetValueL( NPresenceInfo::ENotAvailable );
+        }
+    
+    infoField->SetFieldTypeL( 
+        NPresenceInfo::NFieldType::KAvailabilityEnum ); // "availability"
+    infoField->SetFieldValue( enumField );
+    CleanupStack::Pop(); // enumField
+    
+    srvInfo->Fields().AddOrReplaceFieldL( infoField );
+    CleanupStack::Pop(); // infoField 
+
+    info->AddServicePresenceL( srvInfo );
+    CleanupStack::Pop(); // srvInfo 
+
+    // fill person info
+    MPersonPresenceInfo* persInfo = 
+        iFeature->PresenceObjectFactory().NewPersonPresenceInfoLC();
+    
+    MPresenceInfoField* infoField2 = 
+        iFeature->PresenceObjectFactory().NewInfoFieldLC();
+    
+    MPresenceInfoFieldValueEnum* enumField2 = 
+        iFeature->PresenceObjectFactory().NewEnumInfoFieldLC();
+    TInt availabilityEnum(0);
+    RBuf customMessage;
+    CleanupClosePushL( customMessage );
+    customMessage.Create( KCustomMessageMaxLength );
+    GetStoredPresenceValuesL( availabilityEnum, customMessage );
+    
+    switch( availabilityEnum )
+        {
+        case NPresenceInfo::EAvailable:
+            {
+            enumField2->SetValueL( NPresenceInfo::EAvailable );
+            break;
+            }
+
+        case NPresenceInfo::ENotAvailable:
+            {
+            enumField2->SetValueL( NPresenceInfo::ENotAvailable );
+            break;
+            }
+            
+        case NPresenceInfo::EBusy:
+            {
+            enumField2->SetValueL( NPresenceInfo::EBusy );
+            break;
+            }
+            
+        case NPresenceInfo::EDoNotDisturb:
+            {
+            enumField2->SetValueL( NPresenceInfo::EDoNotDisturb );
+            break;
+            }
+                
+        case NPresenceInfo::EAway:
+            {
+            enumField2->SetValueL( NPresenceInfo::EAway );
+            break;
+            }
+            
+        // if presence availability is not stored     
+        default:
+            {
+            if ( aState )
+                {  
+                enumField2->SetValueL( NPresenceInfo::EAvailable );
+                }
+            else
+                {
+                enumField2->SetValueL( NPresenceInfo::ENotAvailable );
+                }
+            break;
+            }
+        }
+    
+    // set custom message if available
+    if( customMessage.Length() ) 
+        {
+        MPresenceInfoField* customMessageinfoField = 
+            iFeature->PresenceObjectFactory().NewInfoFieldLC();
+                
+        MPresenceInfoFieldValueText* textField = 
+            iFeature->PresenceObjectFactory().NewTextInfoFieldLC();
+        textField->SetTextValueL( customMessage );
+        customMessageinfoField->SetFieldTypeL( 
+        NPresenceInfo::NFieldType::KStatusMessage );
+        customMessageinfoField->SetFieldValue( textField );
+        CleanupStack::Pop(); //textField
+        persInfo->Fields().AddOrReplaceFieldL( customMessageinfoField );
+        CleanupStack::Pop(); //customMessageinfoField
+        }
+    
+    CleanupStack::PopAndDestroy( &customMessage );
+   
+    infoField2->SetFieldTypeL( 
+        NPresenceInfo::NFieldType::KAvailabilityEnum );
+    infoField2->SetFieldValue( enumField2 );
+    CleanupStack::Pop(); // enumField2
+
+    persInfo->Fields().AddOrReplaceFieldL( infoField2 );
+    CleanupStack::Pop(); // infoField2
+
+    info->SetPersonPresenceL( persInfo );
+    CleanupStack::Pop(); // persInfo
+
+    return info;
+    } 
+
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::HandleContextStateEvent
+// Handles the XIMP context state events
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::HandleContextStateEvent( const MXIMPBase& aEvent )
+    {
+    const MXIMPContextStateEvent* event =
+    TXIMPGetInterface< const MXIMPContextStateEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown );
+
+    MXIMPContextState::TState ctxState = event->ContextState().ContextState();
+    SCPLOGSTRING2( "CScpPresenceHandler: MXIMPContextStateEvent: %d", (TInt)ctxState );
+    
+    const MXIMPStatus* status = event->StateChangeReason();
+    if ( status )
+        {
+        iLastXimpError = status->ResultCode();
+        }
+    SCPLOGSTRING2( "CScpPresenceHandler -> context ximp error: %d", iLastXimpError );
+        
+    // Go through the reqid array to see, if unbind has been requested
+    TBool unBindRequested( EFalse );
+    for ( TInt i = 0; i < iReqIdArray.Count(); i++ )
+        {
+        if ( iReqIdArray[i].Type() == EUnBindReq )
+            {
+            unBindRequested = ETrue;
+            }
+        }
+    
+    if ( ctxState == MXIMPContextState::EInactive && 
+        iReqIdArray.Count() > 0 &&
+        !unBindRequested )
+        {
+        //Unbind was not requested, but EInactive state event received => try forced unbind
+        TRAPD( binderr, HandleDeregistrationL( EFalse ) );
+        SCPLOGSTRING2( "CScpPresenceHandler::HandleContextStateEvent: Unbind err:%d", binderr );
+        if ( KErrNone != binderr )
+            {
+            DeregisterNow();
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::HandleRequestCompleteEvent
+// Handles the XIMP request complete events
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::HandleRequestCompleteEvent( const MXIMPBase& aEvent )
+    {
+    SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent event MximpRequestCompleteEvent" );
+    const MXIMPRequestCompleteEvent* event =
+        TXIMPGetInterface< const MXIMPRequestCompleteEvent >::From( aEvent, MXIMPBase::EPanicIfUnknown );
+
+    const TXIMPRequestId& reqId = event->RequestId();
+    const MXIMPStatus& status = event->CompletionResult();
+    if ( &status )
+        {
+        iLastXimpError = status.ResultCode();
+        }
+    SCPLOGSTRING2( "CScpPresenceHandler -> request ximp error: %d", iLastXimpError );
+       
+    if ( iLastXimpError == KXIMPErrServicRequestTimeouted )
+        {
+        iSubService.HandleConnectionEvent( EScpRegistrationFailed );
+        }
+    
+    // Find the reqId from the reqid array and store it's type
+    TInt index( KErrNotFound );
+    TScpReqType reqType( EUnknownReq );
+    for ( TInt i = 0; i < iReqIdArray.Count(); i++ )
+        {
+        if ( iReqIdArray[i].ReqId() == reqId )
+            {
+            index = i;
+            reqType = iReqIdArray[i].Type();
+            }
+        }
+    
+    if ( index != KErrNotFound )
+        {
+        iReqIdArray.Remove( index );             
+        }
+    
+    SCPLOGSTRING2( "CScpPresenceHandler -> request type: %d", reqType );
+
+    // Bind complete event
+    if ( ( reqType == EBindReq ) &&
+        ( EBinding == iPresenceState ) &&
+        ( iLastXimpError == KErrNone ) )
+        {
+        HandleBindCompleteEvent();
+        }
+    // Published online request complete
+    else if ( ( reqType == EPublishOnlineReq ) && 
+        ( iLastXimpError == KErrNone ) )
+        {
+        TRAP_IGNORE( SubscribePresentityGroupL() );
+        iPresenceState = ESubscribing;
+        }
+    
+    else if ( ( reqType == ESubscribeReq ) &&
+        ( iLastXimpError == KErrNone ) )
+        {
+        // Set subservice enabled after subscribe is successfully done
+        iPresenceState = EPresenceOnline;
+        iSubService.HandleConnectionEvent( EScpRegistered );
+        }
+    
+    // Published offline request complete
+    else if ( reqType == EPublishOfflineReq )
+        {
+        SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent status offline Unbind now" );
+        TRAPD( err, ServerUnBindL() );
+        // Deregistration ongoing, so if unbind fails, deregisterNow is called
+        if ( err )
+            {
+            DeregisterNow();
+            SCPLOGSTRING2( "CScpPresenceHandler::HandleRequestCompleteEvent status offline Unbind now end, err %d", err );
+            }
+        }
+    
+    // Unbind request complete
+    else if ( reqType == EUnBindReq && EUnBinding == iPresenceState )
+        {
+        SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent status offline" );
+        // Do not send info to our client if roaming is ongoing 
+        if ( !iNetworkLostRoamingOngoing )
+            {
+            if ( !iSubService.IsRoaming() )
+                {
+                DeregisterNow();
+                }
+            else
+                {
+                // Inform SIP to start ALR migration
+                iSubService.ProfileHandler().StartAlrMigration(
+                    iSubService.SipProfileId() );
+                }
+            }
+        SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent status offline end" );
+        }
+    
+    if ( iRebind )
+        {
+         TRAPD( err, ServerBindL() );
+         iRebind = EFalse;
+         SCPLOGSTRING2( "CScpPresenceHandler - ServerBindL failed: %d", err );
+         
+         if ( KErrAlreadyExists == err )
+             {
+             iRebind = ETrue;
+             }
+        }
+    
+    if ( iDisableAfterXimpRequestsCompleted && !iReqIdArray.Count() )
+        {
+        iDisableAfterXimpRequestsCompleted = EFalse;
+        DeregisterNow();
+        }
+    
+    SCPLOGSTRING( "CScpPresenceHandler::HandleRequestCompleteEvent OUT" ); 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::HandleBindCompleteEvent
+// Handles the bind complete event
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::HandleBindCompleteEvent()
+    {
+    SCPLOGSTRING( "CScpPresenceHandler::HandleBindCompleteEvent" );
+    
+    iPresenceState = EBindComplete;
+    
+    TInt err( KErrNone );
+    CScpSubService* voipSubService = GetVoipSubService();
+    if ( voipSubService )
+        {
+        if ( voipSubService->State() == ECCHEnabled &&
+            voipSubService->LastReportedError() == KErrNone )
+            {
+            SCPLOGSTRING( "CScpPresenceHandler::HandleBindCompleteEvent PublishOnline");
+            TRAP( err, PublishPresenceL( ETrue ) );
+            }
+        else
+            {
+            SCPLOGSTRING( "CScpPresenceHandler::HandleBindCompleteEvent PublishOffline");
+            TRAP( err, PublishPresenceL( EFalse ) );
+            }
+        }
+    else
+        {
+        SCPLOGSTRING( "CScpPresenceHandler::HandleBindCompleteEvent PublishOffline, no VoIP");
+        TRAP( err, PublishPresenceL( EFalse ) );
+        err = KErrNotFound;
+        }
+     
+    if ( err )
+        {
+        SCPLOGSTRING2( "CScpPresenceHandler::HandleBindCompleteEvent err %d", err );
+        }   
+    }
+
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::SubscribePresentityGroupL
+// 
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::SubscribePresentityGroupL()
+    {
+    SCPLOGSTRING( "CScpPresenceHandler::SubscribePresentityGroupL subsribe buddies" );
+    MXIMPObjectFactory& objFactoryFromXIMP = iPresenceCtx->ObjectFactory();
+    
+    //First we have to make identity
+    SCPLOGSTRING( "CScpPresenceHandler::SubscribePresentityGroupL create buddy list identity" );
+    MXIMPIdentity* groupIdentity = objFactoryFromXIMP.NewIdentityLC();
+    groupIdentity->SetIdentityL( _L("buddylist") ); // NEEDS TO BE DEFINED IN XIMP API
+    
+    SCPLOGSTRING( "CScpPresenceHandler::SubscribePresentityGroupL subsribe group content" );
+    TScpReqId reqId;
+
+    reqId.SetType( ESubscribeReq );
+    reqId.SetId( iFeature->PresentityGroups().SubscribePresentityGroupContentL(
+        *groupIdentity ) );
+    SCPLOGSTRING( "CScpPresenceHandler::SubscribePresentityGroupL append req to array" );
+    iReqIdArray.Append( reqId );
+
+    SCPLOGSTRING( "CScpPresenceHandler::SubscribePresentityGroupL subsribe group content ok" );
+    CleanupStack::PopAndDestroy( 1 ); // groupIdentity
+    }
+
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::UnsubscribePresentityGroupL
+// 
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::UnsubscribePresentityGroupL()
+    {
+    MXIMPObjectFactory& objFactoryFromXIMP = iPresenceCtx->ObjectFactory();
+    
+    //First we have to make identity
+    MXIMPIdentity* groupIdentity = objFactoryFromXIMP.NewIdentityLC();
+    groupIdentity->SetIdentityL( _L("buddylist") ); // NEEDS TO BE DEFINED IN XIMP API
+    
+    TScpReqId reqId;
+    // Set type to Unknown, because we don't need to handle the
+    // request complete event
+    reqId.SetType( EUnknownReq );
+    reqId.SetId( iFeature->PresentityGroups().UnsubscribePresentityGroupContentL(
+        *groupIdentity ) );
+    iReqIdArray.Append( reqId );
+    
+    CleanupStack::PopAndDestroy( 1 );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPresenceHandler::GetStoredPresenceValuesL
+// 
+// -----------------------------------------------------------------------------
+//
+void CScpPresenceHandler::GetStoredPresenceValuesL( TInt& aAvailabilityEnum, RBuf& aCustomMessage )
+    {
+    MVIMPSTSettingsStore* settings = CVIMPSTSettingsStore::NewLC();
+        
+    TInt serviceId = iSubService.SubServiceId();
+    RBuf8 documentId;
+    CleanupClosePushL( documentId );
+    documentId.CreateL( KBufSize255 );
+    TInt error = settings->GetL( 
+        serviceId, EServicePresenceSessionIdentifier, documentId );
+    TInt i = documentId.Length();
+    TInt err1(0);
+    TInt err2(0);
+    
+    if( documentId.Length() )
+        {
+        err1 = settings->GetL( 
+            serviceId, EServicePresenceAvailablilityValue, aAvailabilityEnum );
+        err2 = settings->GetL( 
+            serviceId, EServiceCustomStatusMessage, aCustomMessage );
+        
+        // if other GetL fails -> clear both
+        if( err1 || err2 )
+            {
+            aAvailabilityEnum = KErrNotFound;
+            aCustomMessage.Zero();
+            }
+        }   
+    else 
+        {
+        aAvailabilityEnum = KErrNotFound;
+        }
+
+    CleanupStack::PopAndDestroy( &documentId );
+    CleanupStack::PopAndDestroy(); //settings
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpprofilehandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1010 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <sip.h>
+#include <sipprofileregistry.h>
+#include <sipprofilealrcontroller.h>
+#include <sipprofile.h>
+#include <sipmanagedprofile.h>
+#include <sipmanagedprofileregistry.h>
+#include <ctsydomainpskeys.h>
+#include <bamdesca.h>
+#include <sipprofileregistryobserver.h> 
+#include "ipvmbxinterface.h"
+#include "scpprofilehandler.h"
+#include "scplogger.h"
+#include "scpsipconnection.h"
+#include "cipappphoneutils.h"
+#include "cipapputilsaddressresolver.h"
+
+#include "scputility.h"
+
+const TInt KTempStringlength = 200;
+const TUint KSCPUserAgentStringLength = 12;
+const TUint KSCPWlanMacAddressLength = 50;
+const TUint KSCPMaxTerminalTypeLength = 64;
+_LIT( KScpUserAgentString, "User-Agent: " );
+_LIT8 ( KSCPWlanMacAddressFrmt, "-" );
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::CScpProfileHandler
+// -----------------------------------------------------------------------------
+//
+CScpProfileHandler::CScpProfileHandler()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::ConstructL()
+    {
+    SCPLOGSTRING( "CScpProfileHandler::ConstructL" );
+
+    iSip = CSIP::NewL( TUid::Null(), *this );
+    iProfileRegistry = CSIPProfileRegistry::NewL( *iSip, *this );
+    iManagedProfileRegistry = CSIPManagedProfileRegistry::NewL( *this );
+    iAlrController = CSipProfileAlrController::NewL( *iProfileRegistry,
+                                                     *this );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::NewL
+// -----------------------------------------------------------------------------
+//
+CScpProfileHandler* CScpProfileHandler::NewL()
+    {
+    CScpProfileHandler* self =  new ( ELeave ) CScpProfileHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::~CScpProfileHandler
+// -----------------------------------------------------------------------------
+//
+CScpProfileHandler::~CScpProfileHandler()
+    {  
+    SCPLOGSTRING( "CScpProfileHandler::~CScpProfileHandler" );
+
+    iObservers.Close();
+    iSipConnections.ResetAndDestroy();
+    iSipConnections.Close();
+
+    delete iVmbxInterface;
+    delete iAlrController;
+    delete iManagedProfileRegistry;
+    delete iProfileRegistry;    
+    delete iSip;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::AddObserverL
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::AddObserverL( MScpSipConnectionObserver& aObserver )
+    {
+    SCPLOGSTRING2( "CScpProfileHandler::AddObserverL: 0x%x", &aObserver );
+
+    TInt result = iObservers.Find( &aObserver );
+
+    if ( result == KErrNotFound )
+        {
+        iObservers.AppendL( &aObserver );
+        }
+    else
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::RemoveObserver
+// -----------------------------------------------------------------------------
+//
+TInt CScpProfileHandler::RemoveObserver( MScpSipConnectionObserver& aObserver )
+    {
+    SCPLOGSTRING2( "CScpProfileHandler::RemoveObserver: 0x%x", &aObserver );
+
+    TInt result = iObservers.Find( &aObserver );
+    
+    if ( result != KErrNotFound )
+        {
+        iObservers.Remove( result );
+        return KErrNone;
+        }
+
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::GetCurrentState
+// -----------------------------------------------------------------------------
+//
+TInt CScpProfileHandler::GetCurrentState( TUint32 aProfileId, 
+    CScpSipConnection::TConnectionState& aState,
+    TInt& aError ) const
+    {
+    SCPLOGSTRING( "CScpProfileHandler::GetCurrentState" );
+
+    TInt result( KErrNone );
+
+    // Go through own sip profiles and check state
+    // If not found, create SipConnection and check state
+    CScpSipConnection* sipConnection = GetSipConnection( aProfileId );
+
+    TBool sipConnectionCreated = EFalse;
+
+    if( !sipConnection )
+        {
+        sipConnectionCreated = ETrue;
+        TRAP( result, sipConnection = CreateSipConnectionL( aProfileId ) );
+        }
+
+    if( result == KErrNone && sipConnection )
+        {
+        sipConnection->GetState( aState, aError );
+        }
+
+    if( sipConnectionCreated )
+        {
+        delete sipConnection;
+        }
+       
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::RegisterProfileL
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::RegisterProfileL( TUint32 aProfileId )
+    {
+    SCPLOGSTRING2("CScpProfileHandler::RegisterProfileL profile id: %d", aProfileId );
+
+    // Check if sip connection already exists
+    TBool found( EFalse );
+    CScpSipConnection* sipConnection( NULL );
+    
+    for( TInt i=0; i<iSipConnections.Count(); i++ )
+        {
+        sipConnection = iSipConnections[ i ];
+
+        if( sipConnection->ProfileId() == aProfileId )
+            {
+            found = ETrue;
+            sipConnection->EnableL();
+            break;
+            }    
+        }
+
+    // Otherwise create it
+    if( !found )
+        {
+        sipConnection = CreateSipConnectionL( aProfileId );
+        CleanupStack::PushL( sipConnection );        
+        // try enabling
+        sipConnection->AddObserver( *this );
+        sipConnection->EnableL();
+        // add to array
+        iSipConnections.AppendL( sipConnection );
+        CleanupStack::Pop( sipConnection );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::SipConnectionExists
+// -----------------------------------------------------------------------------
+//
+TBool CScpProfileHandler::SipConnectionExists( TUint32 aProfileId ) const
+    {
+    SCPLOGSTRING2("CScpProfileHandler::SipConnectionExists profile id: %d", aProfileId );
+
+    return ( GetSipConnection( aProfileId ) != NULL );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::GetSipConnection
+// -----------------------------------------------------------------------------
+//
+CScpSipConnection* CScpProfileHandler::GetSipConnection( TUint32 aProfileId ) const
+    {
+    SCPLOGSTRING2("CScpProfileHandler::GetSipConnection profile id: %d", aProfileId );
+
+    CScpSipConnection* sipConnection( NULL );
+    
+    for( TInt i=0; i<iSipConnections.Count(); i++ )
+        {
+        sipConnection = iSipConnections[ i ];
+
+        if( sipConnection->ProfileId() == aProfileId )
+            {
+            return sipConnection;
+            }    
+        }
+
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::CreateSipConnectionL
+// -----------------------------------------------------------------------------
+//
+CScpSipConnection* CScpProfileHandler::CreateSipConnectionL( TUint32 aProfileId ) const
+    {
+    SCPLOGSTRING2("CScpProfileHandler::CreateSipConnectionL profile: %d", aProfileId);
+
+    return CScpSipConnection::NewL( aProfileId,
+                                    *iProfileRegistry,
+                                    *iManagedProfileRegistry,
+                                    *iSip );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::UnRegisterProfile
+// -----------------------------------------------------------------------------
+//
+TInt CScpProfileHandler::UnregisterProfile( TUint32 aProfileId )
+    {
+    SCPLOGSTRING2("CScpProfileHandler::UnregisterProfile id: %d", aProfileId );
+
+    CScpSipConnection* sipConnection( NULL );    
+
+    for( TInt i=0; i<iSipConnections.Count(); i++ )
+        {
+        sipConnection = iSipConnections[ i ];
+
+        if( sipConnection->ProfileId() == aProfileId )
+            {
+            return sipConnection->Disable();
+            }
+        }
+
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::CancelRegistration
+// -----------------------------------------------------------------------------
+//
+TInt CScpProfileHandler::CancelRegistration( TUint32 aProfileId )
+    {
+    SCPLOGSTRING2("CScpProfileHandler::UnregisterProfile id: %d", aProfileId );
+
+    TInt result = UnregisterProfile( aProfileId );
+
+    if( result == KErrNone ||
+        result == KErrNotFound || 
+        result == KErrArgument )
+        {
+        result = RemoveSipConnection( aProfileId );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::IncomingRequest
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::IncomingRequest( TUint32 /*aIapId*/,
+                                          CSIPServerTransaction* /*aTransaction*/ )
+    {
+    SCPLOGSTRING( "CScpProfileHandler::IncomingRequest" );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::TimedOut
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::TimedOut(
+    CSIPServerTransaction& /*aTransaction*/ )
+    {
+    SCPLOGSTRING( "CScpProfileHandler::TimedOut" );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::RemoveSipConnection
+// -----------------------------------------------------------------------------
+//
+TInt CScpProfileHandler::RemoveSipConnection( TUint32 aProfileId )
+    {
+    SCPLOGSTRING2( "CScpProfileHandler::RemoveSipConnection id: %i", 
+                   aProfileId );
+
+    TInt ret = ( KErrNotFound );
+    CScpSipConnection* sipConnection( NULL );
+    
+    sipConnection = GetSipConnection( aProfileId );
+    
+    if ( sipConnection )
+        {
+        TInt index = iSipConnections.Find( sipConnection );
+        iSipConnections.Remove( index );
+        delete sipConnection;
+        ret = KErrNone;
+        }
+    return ret;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::ProfileRegistryEventOccurred
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::ProfileRegistryEventOccurred(
+    TUint32 aProfileId,
+    MSIPProfileRegistryObserver::TEvent aEvent )
+    {
+    SCPLOGSTRING3( "CScpProfileHandler::ProfileRegistryEventOccurred id: %i event: %d", 
+                   aProfileId, aEvent );
+
+    CScpSipConnection* sipConnection = GetSipConnection( aProfileId );
+    
+    if( sipConnection )
+        {
+        sipConnection->ProfileRegistryEventOccurred( aEvent );
+        
+        // Deal with sip profile removals
+        switch ( aEvent )
+            {
+            case EProfileDeregistered:
+                {
+                // Remove sip connection only if user has requested deregistration
+                CScpSipConnection::TRegistrationRequestState state =
+                    sipConnection->RegistrationRequestState();
+
+                if( state == CScpSipConnection::EDeregistrationRequested )
+                    {
+                    RemoveSipConnection( aProfileId );
+                    }
+                }
+                break;
+
+            case EProfileDestroyed:
+                {
+                RemoveSipConnection( aProfileId );
+                }
+                break;
+               
+            default:
+                break;
+            }
+        }      
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::ProfileRegistryErrorOccurred
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::ProfileRegistryErrorOccurred( TUint32 aProfileId,
+                                                       TInt aError )
+    {
+    SCPLOGSTRING3( "CScpProfileHandler::ProfileRegistryErrorOccurred profile:%i error: %d", 
+                   aProfileId, aError );
+
+    CScpSipConnection* sipConnection = GetSipConnection( aProfileId );
+    
+    if( sipConnection )
+        {
+        sipConnection->ProfileRegistryErrorOccurred( aError );
+        }
+    }
+      
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::ProfileExist
+// -----------------------------------------------------------------------------
+//
+TBool CScpProfileHandler::ProfileExists( TUint32 aProfileId ) const
+    {    
+    SCPLOGSTRING2( "CScpProfileHandler::ProfileExists id: %d", aProfileId );
+
+    CSIPProfile* profile( NULL );
+    TRAPD( result, profile = iProfileRegistry->ProfileL( aProfileId ) );
+
+    if( result == KErrNone && profile )
+        {
+        delete profile;
+        return ETrue;
+        }
+
+    return EFalse;             
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::SetSipProfileReserved
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::SetSipProfileReserved( TUint32 aProfileId, TBool aReserved )
+    {
+    SCPLOGSTRING3( "CScpProfileHandler::SetSipProfileReserved id: %d reserved: %d", 
+                   aProfileId, aReserved );
+
+    CScpSipConnection* sipConnection = GetSipConnection( aProfileId );
+    
+    if( sipConnection )
+        {
+        sipConnection->SetReserved( aReserved );
+
+        // If profile was freed and iap availability alr event had come
+        // before, let ALR controller to know that the profile is up
+        // for ALR
+        if( aReserved == EFalse && 
+            sipConnection->IapAvailableOffered() )
+            {
+            TRAP_IGNORE( iAlrController->RefreshIapAvailabilityL( aProfileId ) );
+    
+            // Reset the iap availability offered flag
+            sipConnection->SetIapAvailableOffered( EFalse );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::StartAlrMigration
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::StartAlrMigration( TUint32 aProfileId )
+    {
+    SCPLOGSTRING2( "CScpProfileHandler::StartMigrtion profile: %i", aProfileId );
+    SCPLOGSTRING2( "CScpProfileHandler::StartMigrtion iNewAlrIapId: %i", iNewAlrIapId );
+    
+    TRAP_IGNORE(
+       iAlrController->AllowMigrationL( aProfileId, iNewAlrIapId ) );
+    
+    CScpSipConnection* sipConnection( NULL );
+    sipConnection = GetSipConnection( aProfileId );
+    
+    if ( sipConnection )
+        {
+        sipConnection->SetProfileCurrentlyRoaming();
+        }
+    
+    SCPLOGSTRING( "CScpProfileHandler::StartMigrtion -exit" );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::AlrEvent
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::AlrEvent( MSipProfileAlrObserver::TEvent aEvent,
+                                   TUint32 aProfileId,
+#ifdef _DEBUG
+                                   TUint32 aSnapId,
+#else
+                                   TUint32 /*aSnapId*/,
+#endif
+                                   TUint32 aIapId )
+    {
+    SCPLOGSTRING2("CScpProfileHandler::AlrEvent profile:%i", aProfileId);
+    SCPLOGSTRING2("CScpProfileHandler::AlrEvent aEvent:%i", (TInt)aEvent);
+    SCPLOGSTRING2("CScpProfileHandler::AlrEvent aSnapId:%i", aSnapId);
+    SCPLOGSTRING2("CScpProfileHandler::AlrEvent aIapId:%i", aIapId);
+
+    CScpSipConnection* sipConnection( NULL );
+    
+    switch( aEvent )
+        {
+        case MSipProfileAlrObserver::EIapAvailable:
+            {
+            TBool reserved( EFalse );
+            sipConnection = GetSipConnection( aProfileId );
+    
+            if( sipConnection )
+                {
+                reserved = sipConnection->Reserved();
+
+                if( reserved )
+                    {
+                    TRAPD( result, 
+                        iAlrController->DisallowMigrationL( aProfileId, aIapId ) );
+
+                    if( result == KErrNone )
+                        {
+                        // Raise the iap availability offered flag
+                        sipConnection->SetIapAvailableOffered( ETrue );
+                        }
+                    }
+                else
+                    {
+                    iAlrAllowedToStartImmediately = ETrue;
+
+                    for ( TInt i = 0; i < iObservers.Count(); i++ )
+                        {
+                        if ( !iObservers[ i ]->IsSipProfileAllowedToStartAlr() )
+                            {
+                            iAlrAllowedToStartImmediately = EFalse;
+                            break;
+                            }
+                        }
+                    if ( iAlrAllowedToStartImmediately )
+                        {
+                        TRAP_IGNORE(
+                            iAlrController->AllowMigrationL( aProfileId, aIapId ) );
+                        sipConnection->SetProfileCurrentlyRoaming();
+                        }
+                    else
+                        {
+                        iNewAlrIapId = aIapId;
+                        sipConnection->HandleMigrationStarted();
+                        }
+                    }
+                }
+            break;
+            }
+
+        // For possible beyond use (E.g. Maybe we should change CHH state
+        // during iap migration -> VoIP call not possible if iap migration
+        // ongoing.)
+        case MSipProfileAlrObserver::EMigrationStarted:
+            {
+            sipConnection = GetSipConnection( aProfileId );
+            
+            if( sipConnection && iAlrAllowedToStartImmediately )
+                {
+                sipConnection->HandleMigrationStarted();
+                }
+            break;
+            }
+        
+        case MSipProfileAlrObserver::EMigrationCompleted:
+        default:
+            {
+            break;
+            }            
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::AlrError
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::AlrError( 
+    TInt aError,
+    TUint32 aProfileId,
+    TUint32 aSnapId,
+    TUint32 aIapId )
+    {
+    SCPLOGSTRING("CScpProfileHandler::AlrError");
+    SCPLOGSTRING2("     profile id: %d", aProfileId);
+    SCPLOGSTRING2("     error:      %d", aError);
+    
+    CScpSipConnection* sipConnection = GetSipConnection( aProfileId );
+    if( sipConnection )
+        {
+        sipConnection->HandleMigrationError( 
+            aError, aProfileId, aSnapId, aIapId );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::HandleSipConnectionEvent
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::HandleSipConnectionEvent( TUint32 aProfileId,
+                                                   TScpConnectionEvent aSipEvent )
+    {
+    SCPLOGSTRING3( 
+        "CScpProfileHandler::HandleSipConnectionEvent profile id: %d sip event: %d",
+        aProfileId, aSipEvent );
+
+    // Make a copy of the observers array, since observers
+    // may be removed during the event handling
+    RPointerArray< MScpSipConnectionObserver > observers;
+    
+    for ( TInt i=0; i < iObservers.Count(); i++ )
+        {      
+        observers.Append( iObservers[ i ] );
+        }
+
+    // Send notify to observers
+    for( TInt i=0; i < observers.Count(); i++ )
+        {
+        //check that the observer is still valid before triggering notify
+        if ( KErrNotFound != iObservers.Find( observers[ i ] ) )
+            {
+            observers[ i ]->HandleSipConnectionEvent( aProfileId, aSipEvent );
+            }
+        }
+
+    observers.Close();
+        
+    // if registration failed, time to delete connection
+    if ( aSipEvent == EScpRegistrationFailed )
+        {
+        RemoveSipConnection( aProfileId );        
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::IsSipProfileAllowedToStartAlr
+// -----------------------------------------------------------------------------
+//
+TBool CScpProfileHandler::IsSipProfileAllowedToStartAlr()
+    {
+    return ETrue;
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::VmbxInterfaceL
+// -----------------------------------------------------------------------------
+//
+CIpVmbxInterface& CScpProfileHandler::VmbxInterfaceL( MIpVmbxObserver& aObserver )
+    {
+    SCPLOGSTRING( "CScpProfileHandler::VmbxInterfaceL" );
+
+    // Todo: save observer and set MIpVmbxObserver to this class
+	// problem when several vmbx services, current observer logic isn't work
+    
+    if( !iVmbxInterface )
+        {
+        iVmbxInterface = CIpVmbxInterface::NewL( aObserver );
+        }
+
+    return *iVmbxInterface;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::DeleteVmbxInterface
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::DeleteVmbxInterface()
+    {
+    SCPLOGSTRING( "CScpProfileHandler::DeleteVmbxInterface" );
+
+    if( iVmbxInterface )
+        {
+        delete iVmbxInterface;
+        iVmbxInterface = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::UpdateSipProfile
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::UpdateSipProfileL( 
+    TUint32 aProfileId,
+    TBool aTerminalType,
+    TBool aWlanMac,
+    TInt aStringLength )
+    {
+    SCPLOGSTRING( "CScpProfileHandler::UpdateSipProfileL IN" );
+    SCPLOGSTRING2( " profile id:    %d", aProfileId );
+    SCPLOGSTRING2( " terminal type: %d", aTerminalType );
+    SCPLOGSTRING2( " wlan mac:      %d", aWlanMac );
+    SCPLOGSTRING2( " string length: %d", aStringLength );
+    
+    // Do not update, if terminal type is not defined in user agent header
+    if ( !aTerminalType )
+        {
+        return;
+        }
+    
+    const MDesC8Array* array;
+    CSIPProfile* sipProfile = iProfileRegistry->ProfileL( aProfileId );
+    CleanupStack::PushL( sipProfile );
+    User::LeaveIfError( sipProfile->GetParameter( KSIPHeaders, array ) );
+
+    TBuf<KSCPMaxTerminalTypeLength> terminalType( KNullDesC );
+    TBuf<KTempStringlength> tempHeader( KNullDesC );
+    
+    // 1. Get the terminal type and seek is user agent header's 
+    // terminal type same, if so no need to continue
+    CIpAppPhoneUtils* libIpAppPhoneUtils = CIpAppPhoneUtils::NewLC();
+    libIpAppPhoneUtils->GetTerminalTypeL( terminalType );   
+    CleanupStack::PopAndDestroy( libIpAppPhoneUtils );
+    
+    for( TInt t( 0 ); t < array->MdcaCount(); t++ )
+        {
+        tempHeader.Copy( array->MdcaPoint( t ) );
+        if( tempHeader.Find( terminalType ) != KErrNotFound )
+            {
+            SCPLOGSTRING(" terminal type found");
+            CleanupStack::PopAndDestroy( sipProfile );
+            return;
+            }
+        }
+    
+    // 2. If appropriate terminal type not found, we need to update it
+    if ( array->MdcaCount() )
+        {
+        TBuf8<KTempStringlength> userAgentHeader;
+        CDesC8ArrayFlat* uahArray = new ( ELeave ) CDesC8ArrayFlat( 1 );
+        CleanupStack::PushL( uahArray );
+        //Find the User-Agent string
+        for( TInt t( 0 ); t < array->MdcaCount(); t++ )
+            {
+            tempHeader.Copy( array->MdcaPoint( t ) );
+            // user-Agent found, now change it
+            if( tempHeader.Find( KScpUserAgentString ) != KErrNotFound )
+                {
+                // 3. now we have the right user agent header which is not correct
+                // replace the old terminal type 
+                TInt len( KErrNone );
+                // Get mac if defined
+                if ( aWlanMac )
+                    {
+                    TBuf8<KSCPWlanMacAddressLength> wlanMacAddress( KNullDesC8 );
+                    TBuf<KSCPWlanMacAddressLength>  tempAddr( KNullDesC );
+                    CIPAppUtilsAddressResolver* addressResolver = 
+                        CIPAppUtilsAddressResolver::NewLC();    
+                    User::LeaveIfError( addressResolver->GetWlanMACAddress( 
+                        wlanMacAddress, KSCPWlanMacAddressFrmt ) );
+                    CleanupStack::PopAndDestroy( addressResolver );
+                    tempAddr.Copy( wlanMacAddress );
+                    
+                    // leave the space before MAC ADDR (-1)
+                    len = tempHeader.Find( tempAddr ) - KSCPUserAgentStringLength - 1;
+                    }
+                else
+                    {
+                    // leave the space before free string (-1)
+                    len = tempHeader.Length() - KSCPUserAgentStringLength - aStringLength - 1;
+                    }
+                // make sure that the len is correct value(not below zero)
+                if ( 0 >= len )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                tempHeader.Replace( KSCPUserAgentStringLength, len, terminalType );
+                SCPLOGSTRING2(" header:        %S", &tempHeader);
+                userAgentHeader.Append( tempHeader );
+                uahArray->AppendL( userAgentHeader );
+                }
+            else
+                {
+                //if this entry is not user agent, leave it untouched
+                uahArray->AppendL( array->MdcaPoint( t ) );    
+                }
+            }
+
+        CSIPManagedProfile* managedProfile = static_cast<CSIPManagedProfile*>( 
+            iProfileRegistry->ProfileL( aProfileId ) );
+        CleanupStack::PushL( managedProfile );
+        //Update the new user-agent to sipprofile
+        User::LeaveIfError( 
+            managedProfile->SetParameter( KSIPHeaders, *uahArray ) );
+        iManagedProfileRegistry->SaveL( *managedProfile );
+        CleanupStack::PopAndDestroy( managedProfile );
+        CleanupStack::PopAndDestroy( uahArray );
+        }        
+    CleanupStack::PopAndDestroy( sipProfile );    
+    SCPLOGSTRING( "CScpProfileHandler::UpdateSipProfileL OUT" );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::SetUsernameAndPasswordL
+// -----------------------------------------------------------------------------
+//
+void CScpProfileHandler::SetUsernameAndPasswordL( TUint32 aProfileId,
+                                                  const TDesC8& aUsername,
+                                                  TBool aSetUsername,
+                                                  const TDesC8& aPassword,
+                                                  TBool aSetPassword )
+    {
+    SCPLOGSTRING( "CScpProfileHandler::SetUsernameAndPasswordL" );
+
+    CSIPManagedProfile* profile = static_cast<CSIPManagedProfile*>
+                         (iProfileRegistry->ProfileL( aProfileId ));
+    CleanupStack::PushL( profile );
+
+    SCPLOGSTRING( "CScpProfileHandler::SetUsernameAndPasswordL sip profile availble" );
+    
+    if( aSetUsername )
+        {
+        RBuf8 formattedUsername;
+        CleanupClosePushL( formattedUsername );
+        
+        if( !TScpUtility::CheckSipUsername( aUsername ) )
+            {
+            // Since username is returned with prefix and domain, it needs
+            // to be possible to also set it with prefix and domain. 
+            // Strip prefix and domain from user aor if found.
+            // Prefix might be sip or sips so search by colon.
+            // If username is empty, leave with KErrArgument
+            if ( aUsername == KNullDesC8 )
+                {
+                User::Leave( KErrArgument );
+                }
+            else
+                {
+                User::LeaveIfError( TScpUtility::RemovePrefixAndDomain( 
+                    aUsername, formattedUsername ) );
+                }
+            }
+        else
+            {
+            formattedUsername.CreateL( aUsername.Length() );
+            formattedUsername.Copy( aUsername );
+            }
+        
+        TBool validAorExists( EFalse );       
+        const TDesC8* aorPtr( NULL );
+        
+        TInt err = profile->GetParameter( KSIPUserAor, aorPtr );
+        
+        TInt loc( KErrNotFound );
+        if ( !err && aorPtr->Length() )
+            {
+            loc = aorPtr->Find( KAt() );
+            
+            if ( KErrNotFound != loc )
+                {         
+                TPtrC8 ptr = aorPtr->Right( 1 );
+                
+                if ( ptr.Compare( KAt ) != 0 )
+                    {                    
+                    // @ is found and there is something in domain part
+                    validAorExists = ETrue;
+                    }              
+                }
+            }
+       
+       HBufC8* newAor = NULL;
+       TBuf8<KSipSchemeMaxLength> prefix;
+       TScpUtility::GetValidPrefix( aUsername, prefix );
+       
+       if ( validAorExists )
+           {           
+           SCPLOGSTRING( "CScpProfileHandler::SetUsernameAndPasswordL valid aor" );
+           TPtrC8 domainPart = aorPtr->Mid( loc );
+           
+           newAor = HBufC8::NewLC( prefix.Length() + 
+                                   domainPart.Length() + 
+                                   formattedUsername.Length() );
+           newAor->Des().Append( prefix );
+           newAor->Des().Append( formattedUsername );
+           newAor->Des().Append( domainPart );
+           }
+       else
+           {         
+           SCPLOGSTRING( "CScpProfileHandler::SetUsernameAndPasswordL no valid aor" );
+           // Check if given username contains valid aor
+           TInt loc = aUsername.Find( KAt() );
+           
+           if ( KErrNotFound != loc )
+               {               
+               TPtrC8 ptrRight = aorPtr->Right( 1 );
+               TPtrC8 ptrLeft = aorPtr->Left( 1 );
+               
+               if ( ( ptrRight.Compare( KAt ) != 0 ) && 
+                   ( ptrLeft.Compare( KAt ) != 0 ) )
+                   {                   
+                   // both sides of @ have data --> aor is valid
+                   newAor = HBufC8::NewLC( aUsername.Length() );
+                   newAor->Des().Copy( aUsername );
+                   }
+               else
+                   {
+                   User::Leave( KErrArgument );
+                   }
+               }
+           else
+               {               
+               User::Leave( KErrArgument );
+               }    
+           }
+
+        SCPLOGSTRING( "CScpProfileHandler::SetUsernameAndPasswordL set new aor value" );
+        
+        User::LeaveIfError( profile->SetParameter( KSIPUserAor, newAor->Des() ) );
+        CleanupStack::PopAndDestroy( newAor );
+        
+        // Add digest username & password
+        SCPLOGSTRING( "CScpProfileHandler:SetUsernameAndPasswordL outbound & digest username" );
+        User::LeaveIfError( profile->SetParameter( KSIPOutboundProxy,
+                                                   KSIPDigestUserName,
+                                                   formattedUsername ) );
+
+
+        SCPLOGSTRING( "CScpProfileHandler:SetUsernameAndPasswordL registrar & digest username" );
+        User::LeaveIfError( profile->SetParameter( KSIPRegistrar,
+                                                   KSIPDigestUserName,
+                                                   formattedUsername ) );
+        CleanupStack::PopAndDestroy( &formattedUsername );                                                   
+        }
+
+    if( aSetPassword )
+        {
+        if( !TScpUtility::CheckSipPassword( aPassword ) )
+            {
+            User::Leave( KErrArgument );
+            }
+        SCPLOGSTRING( "CScpProfileHandler:SetUsernameAndPasswordL outbound & digest pwd" );
+        User::LeaveIfError( profile->SetParameter( KSIPOutboundProxy,
+                                                   KSIPDigestPassword,
+                                                   aPassword ) );    
+        SCPLOGSTRING( "CScpProfileHandler:SetUsernameAndPasswordL registrar & digest pwd" );
+        User::LeaveIfError( profile->SetParameter( KSIPRegistrar,
+                                                   KSIPDigestPassword,
+                                                   aPassword ) );
+        }
+    
+    SCPLOGSTRING( "CScpProfileHandler:SetUsernameAndPasswordL save sip changes" );
+
+    // Save changes
+    TRAPD( err, iManagedProfileRegistry->SaveL( *profile ) );
+
+    CleanupStack::PopAndDestroy( profile );    
+    
+    SCPLOGSTRING2( "CScpProfileHandler:SetUsernameAndPasswordL save sip err: %d", err );
+    User::LeaveIfError( err );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CScpProfileHandler::GetDebugInfo
+// -----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+void CScpProfileHandler::GetDebugInfo( TDes& aInfo ) const
+    {
+    TInt connections = iSipConnections.Count();
+    TInt registeredConnections( 0 );
+    TInt registeringConnections( 0 );
+    TInt unregisteringConnections( 0 );
+    TInt unregisteredConnections( 0 );
+    
+    for( TInt i=0; i<iSipConnections.Count(); i++ )
+        {
+        CScpSipConnection* sipConnection = iSipConnections[ i ];
+        CScpSipConnection::TConnectionState state;
+        TInt error;
+
+        sipConnection->GetState( state, error );
+
+        switch( state )
+            {
+            case CScpSipConnection::ERegistered:
+                registeredConnections++;
+                break;
+
+            case CScpSipConnection::ERegistering:
+                registeringConnections++;
+                break;
+
+            case CScpSipConnection::EDeregistering:
+                unregisteringConnections++;
+                break;
+
+            case CScpSipConnection::EDeregistered:
+                unregisteredConnections++;
+                break;
+
+            default:
+                break;
+            }
+        }
+
+    TBuf< 255 > buffer;
+    buffer.Format( _L( "Connections: %d\n Registered: %d\n Registering: %d\n Unregistering: %d\n Unregistered: %d\n" ),
+                        connections, registeredConnections, registeringConnections,
+                        unregisteringConnections, unregisteredConnections );
+
+    aInfo.Append( buffer );
+    }
+#endif
+            
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scppropertynotifier.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,157 @@
+/*
+* 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:  
+*
+*/
+
+
+#include "scppropertynotifier.h"
+#include "scplogger.h"
+#include "scppropertyobserver.h"
+
+// -----------------------------------------------------------------------------
+// CScpPropertyNotifier::CCScpPropertyNotifier
+// -----------------------------------------------------------------------------
+//
+CScpPropertyNotifier::CScpPropertyNotifier( TUid aUid, 
+                                            TInt aType, 
+                                            MScpPropertyObserver& aObserver ) :
+    CActive( CActive::EPriorityStandard ),
+    iUid( aUid ),
+    iType( aType ),
+    iObserver( aObserver )
+    {
+    SCPLOGSTRING( "CScpPropertyNotifier::CScpPropertyNotifier" );
+
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPropertyNotifier::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CScpPropertyNotifier::ConstructL()
+    {
+    SCPLOGSTRING( "CScpPropertyNotifier::ConstructL" );
+    
+    User::LeaveIfError( iProperty.Attach( iUid, iType ) );
+
+    Subscribe();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPropertyNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+CScpPropertyNotifier* CScpPropertyNotifier::NewL( TUid aUid, 
+                                                  TInt aType,
+                                                  MScpPropertyObserver& aObserver )
+    {
+    SCPLOGSTRING( "CScpPropertyNotifier::NewL" );
+    
+    CScpPropertyNotifier* self = new(ELeave) CScpPropertyNotifier( aUid, 
+                                                                   aType,
+                                                                   aObserver );
+    CleanupStack::PushL( self );    
+    self->ConstructL();    
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPropertyNotifier::~CScpPropertyNotifier
+// -----------------------------------------------------------------------------
+//
+CScpPropertyNotifier::~CScpPropertyNotifier()
+    {
+    SCPLOGSTRING( "CScpPropertyNotifier::~CScpPropertyNotifier" );
+    
+    Cancel();
+    iProperty.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPropertyNotifier::GetValue
+// -----------------------------------------------------------------------------
+//
+TInt CScpPropertyNotifier::GetValue( TInt& aValue ) const
+    {
+    SCPLOGSTRING( "CScpPropertyNotifier::GetValue" );
+    
+    return iProperty.Get( iUid, iType, aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPropertyNotifier::Subscribe
+// -----------------------------------------------------------------------------
+//
+void CScpPropertyNotifier::Subscribe()
+    {
+    SCPLOGSTRING( "CScpPropertyNotifier::Subscribe" );      
+    __ASSERT_DEBUG(!IsActive(), User::Panic( KNullDesC, KErrGeneral ) );
+
+    if ( !IsActive() )
+        {
+        iProperty.Subscribe( iStatus );    
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPropertyNotifier::RunL
+// -----------------------------------------------------------------------------
+//
+void CScpPropertyNotifier::RunL()
+    {
+    SCPLOGSTRING( "CScpPropertyNotifier::RunL" );
+
+    if( iStatus.Int() == KErrNone )
+        {        
+        TInt value = 0;
+        GetValue( value );
+
+        iObserver.HandlePropertyChanged( value );
+        }
+
+    Subscribe();            
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPropertyNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+#ifdef _DEBUG
+TInt CScpPropertyNotifier::RunError( TInt aError )
+    {
+    SCPLOGSTRING2( "CScpPropertyNotifier::RunError: %d", aError );
+#else
+TInt CScpPropertyNotifier::RunError( TInt /*aError*/ )
+    {
+#endif
+    // Errors are disarded
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpPropertyNotifier::NewL
+// -----------------------------------------------------------------------------
+//
+void CScpPropertyNotifier::DoCancel()
+    {
+    SCPLOGSTRING( "CScpPropertyNotifier::DoCancel" );
+    
+    iProperty.Cancel();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpservice.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,636 @@
+/*
+* 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:  
+*
+*/
+
+
+#include <cchserviceobserver.h>
+
+#include "scpservice.h"
+#include "scpsubservice.h"
+#include "scplogger.h"
+#include "scputility.h"
+#include "scpprofilehandler.h"
+
+// -----------------------------------------------------------------------------
+// CScpService::CScpService
+// -----------------------------------------------------------------------------
+//
+CScpService::CScpService( TInt aId, 
+                          TInt aServiceId,
+                          CScpProfileHandler& aProfileHandler, 
+                          CScpServiceStorage& aServiceStorage,
+                          MCchServiceObserver& aServiceObserver ) :
+    iId( aId ),
+    iServiceId( aServiceId ),
+    iProfileHandler( aProfileHandler ), 
+    iServiceStorage( aServiceStorage ),
+    iServiceObserver( aServiceObserver )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::~CScpService
+// -----------------------------------------------------------------------------
+//
+CScpService::~CScpService()
+    {
+    SCPLOGSTRING2( "CScpService[0x%x]::~CScpService", this );
+
+    iSubServices.ResetAndDestroy();
+    iSubServices.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::NewL
+// -----------------------------------------------------------------------------
+//
+CScpService* CScpService::NewL( TInt aId, 
+                                TInt aServiceId,
+                                CScpProfileHandler& aProfileHandler,
+                                CScpServiceStorage& aServiceStorage, 
+                                MCchServiceObserver& aServiceObserver )
+    {
+    SCPLOGSTRING3( "CScpService::NewL id: %d service id: %d", aId, aServiceId );
+
+    CScpService* self = new (ELeave) CScpService( aId, 
+                                                  aServiceId,
+                                                  aProfileHandler,
+                                                  aServiceStorage,
+                                                  aServiceObserver );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::Id
+// -----------------------------------------------------------------------------
+//
+TInt CScpService::Id() const
+    {
+    SCPLOGSTRING2( "CScpService[0x%x]::Id", this );
+
+    return iId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::ProfileHandler
+// -----------------------------------------------------------------------------
+//
+CScpProfileHandler& CScpService::ProfileHandler() const
+    {
+    return iProfileHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::ServiceStorage
+// -----------------------------------------------------------------------------
+//
+CScpServiceStorage& CScpService::ServiceStorage() const
+    {
+    return iServiceStorage;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::ServiceObserver
+// -----------------------------------------------------------------------------
+//
+MCchServiceObserver& CScpService::ServiceObserver() const
+    {
+    return iServiceObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::AddSubServiceL
+// -----------------------------------------------------------------------------
+//
+CScpSubService& 
+    CScpService::AddSubServiceL( TCCHSubserviceType aSubServiceType )
+    {
+    SCPLOGSTRING2( "CScpService[0x%x]::AddSubServiceL", this );
+
+    TInt newId = GenerateNewSubServiceId();    
+    CScpSubService* service = CScpSubService::NewL( newId, 
+                                                    ServiceId(),
+                                                    aSubServiceType,
+                                                    *this );
+    CleanupStack::PushL( service );
+    iSubServices.AppendL( service );
+    CleanupStack::Pop( service );
+
+    return *iSubServices[ iSubServices.Count() - 1 ];
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::SubServiceCount
+// -----------------------------------------------------------------------------
+//
+TInt CScpService::SubServiceCount() const
+    {
+    SCPLOGSTRING2( "CScpService[0x%x]::SubServiceCount", this );
+
+    return iSubServices.Count();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::GenerateNewSubServiceId
+// -----------------------------------------------------------------------------
+//
+TInt CScpService::GenerateNewSubServiceId()
+    {
+    SCPLOGSTRING2( "CScpService[0x%x]::GenerateNewSubServiceId", this );
+
+    iSubServiceIdCounter++;
+    
+    return iId + iSubServiceIdCounter;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::GetSubServiceIds
+// -----------------------------------------------------------------------------
+//
+void CScpService::GetSubServiceIds( RArray<TInt>& aIds ) const
+    {
+    SCPLOGSTRING2( "CScpService[0x%x]::GetSubServiceIds", this );
+    __ASSERT_DEBUG( aIds.Count() == 0, User::Panic( KNullDesC, KErrGeneral ) );
+
+    for( TInt i=0; i<iSubServices.Count(); i++)
+        {
+        const CScpSubService* subService = iSubServices[ i ];
+        
+        aIds.Append( subService->Id() );
+        }    
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::GetSubService
+// -----------------------------------------------------------------------------
+//
+CScpSubService* CScpService::GetSubService( TInt aId ) const
+    {
+    SCPLOGSTRING3( "CScpService[0x%x]::GetSubService id: %d", this, aId );
+
+    for( TInt i=0; i<iSubServices.Count(); i++)
+        {
+        CScpService* self = const_cast<CScpService*>(this);
+        CScpSubService* subService = self->iSubServices[ i ];
+        if( aId == subService->Id() )
+            {
+            return subService;
+            }
+        }
+    
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::RemoveSubService
+// -----------------------------------------------------------------------------
+//
+TInt CScpService::RemoveSubService( TInt aId )
+    {
+    SCPLOGSTRING3( "CScpService[0x%x]::RemoveSubService id: %d", this, aId );
+
+    for( TInt i=0; i<iSubServices.Count(); i++)
+        {
+        CScpSubService* subService = iSubServices[ i ];
+        if( aId == subService->Id() )
+            {
+            delete subService;
+            iSubServices.Remove( i );
+            return KErrNone;
+            }
+        }
+
+    return KErrNotFound;        
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::ServiceId
+// -----------------------------------------------------------------------------
+//
+TInt CScpService::ServiceId() const
+    {
+    SCPLOGSTRING2( "CScpService[0x%x]::ServiceId", this );
+
+    return iServiceId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::SetServiceId
+// -----------------------------------------------------------------------------
+//
+void CScpService::SetServiceId( TInt aServiceId )
+    {
+    SCPLOGSTRING3( "CScpService[0x%x]::SetServiceId service id: %d", 
+                   this, aServiceId );
+
+    iServiceId = aServiceId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::State
+// -----------------------------------------------------------------------------
+//
+TInt CScpService::State( TCCHSubserviceType aSubServiceType, 
+                         TCCHSubserviceState& aState ) const
+    {
+    SCPLOGSTRING2( "CScpService[0x%x]::State", this );
+
+    TInt result = KErrNone;
+
+    if( ECCHUnknown == aSubServiceType )
+        {
+        TCCHSubserviceState state( ECCHUninitialized );
+
+        // Return other than unknown state if all the subservices are in same state 
+        for ( TInt i=0; i<iSubServices.Count(); i++ )
+            {
+            const CScpSubService* subService = iSubServices[i];
+            
+            if( state == ECCHUninitialized )
+                {
+                state = subService->State();
+                result = subService->LastReportedError();
+                } 
+            else
+                {
+                if ( state != subService->State() ||
+                     result != subService->LastReportedError() )
+                    {   
+                    // Sub services are in different states or have
+                    // different error codes
+                    SCPLOGSTRING( "Query failed: different states or error codes" );
+
+                    state = ECCHUninitialized;
+                    result = KErrUnknown;
+                    break;
+                    }
+                }
+            }
+
+        aState = state;
+        }
+    else
+        {
+        CScpSubService* subService = GetSubServiceByType( aSubServiceType );
+
+        if( subService )
+            {
+            aState = subService->State();
+            result = subService->LastReportedError();    
+            }
+        else
+            {
+            result = KErrNotFound;
+            }
+        }
+
+    SCPLOGSTRING3( "State: %d error: %d", aState, result );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::GetSubServiceByType
+// -----------------------------------------------------------------------------
+//
+CScpSubService* CScpService::GetSubServiceByType( TCCHSubserviceType aSubServiceType ) const
+    {
+    SCPLOGSTRING3( "CScpService[0x%x]::GetSubService type: %d",
+                   this, aSubServiceType );
+
+    for( TInt i=0; i<iSubServices.Count(); i++)
+        {
+        CScpSubService* subService = iSubServices[ i ];
+        if( subService->SubServiceType() == aSubServiceType )
+            {
+            return subService;
+            }
+        }
+
+    return NULL; 
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::ContainsSubServiceType
+// -----------------------------------------------------------------------------
+//
+TBool CScpService::ContainsSubServiceType( TCCHSubserviceType aSubServiceType ) const
+    {
+    SCPLOGSTRING3( "CScpService[0x%x]::ContainsSubServiceType type: %d",
+                   this, aSubServiceType );
+
+    for( TInt i=0; i<iSubServices.Count(); i++)
+        {
+        CScpSubService* subService = iSubServices[ i ];
+        if( subService->SubServiceType() == aSubServiceType )
+            {
+            return ETrue;
+            }
+        }
+
+    return EFalse; 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CScpService::SubServicesContainSameSipProfile
+// -----------------------------------------------------------------------------
+//
+TBool CScpService::SubServicesContainSameSipProfile() const
+    {
+    SCPLOGSTRING2( "CScpService[0x%x]::SubServicesContainSameSipProfile", this );    
+
+    TInt sipProfileId( 0 );
+
+    for( TInt i=0; i<iSubServices.Count(); i++)
+        {
+        TInt oldSipProfileId = sipProfileId;
+        
+        const CScpSubService* subService = iSubServices[ i ];
+        sipProfileId = subService->SipProfileId();
+
+        if( oldSipProfileId != 0 &&
+            sipProfileId != oldSipProfileId )
+            {
+            return EFalse;
+            }
+        }
+
+    return ETrue; 
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::SetReserved
+// -----------------------------------------------------------------------------
+//
+TInt CScpService::SetReserved( TBool aReserved, 
+                               TCCHSubserviceType aSubServiceType )
+    {
+    SCPLOGSTRING4( "CScpService[0x%x]::SetReserved: %d type: %d", 
+                   this, aSubServiceType, aReserved );    
+
+    TInt result = KErrNone;
+
+    if( aSubServiceType != ECCHUnknown )
+        {
+        CScpSubService* subService = GetSubServiceByType( aSubServiceType );
+
+        if( subService )
+            {
+            // If reserving the sub service must be enabled.
+            // It is always possible to free the service
+            if( subService->State() == ECCHEnabled ||
+                aReserved == EFalse )
+                {
+                subService->SetReserved( aReserved );
+                }
+            else
+                {
+                result = KErrNotSupported;
+                }
+            }
+        else
+            {
+            result = KErrNotFound;
+            }
+        }
+    else
+        {
+        for( TInt i=0; i<iSubServices.Count(); i++)
+            {
+            CScpSubService* subService = iSubServices[ i ];
+
+            // If reserving the sub service must be enabled.
+            // It is always possible to free the service
+            if( subService->State() == ECCHEnabled ||
+                aReserved == EFalse )
+                {
+                subService->SetReserved( aReserved );
+                }
+            else
+                {
+                result = KErrNotSupported;
+                }
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::IsReserved
+// -----------------------------------------------------------------------------
+//
+TBool CScpService::IsReserved( TCCHSubserviceType aSubServiceType ) const
+    {
+    SCPLOGSTRING3( "CScpService[0x%x]::IsReserved: type: %d", 
+                   this, aSubServiceType );
+
+    TBool result = EFalse;
+
+    if( aSubServiceType == ECCHUnknown )
+        {
+        for( TInt i=0; i<iSubServices.Count(); i++)
+            {
+            CScpSubService* subService = iSubServices[ i ];
+
+            TBool reserved = subService->IsReserved();
+
+            if( reserved )
+                {
+                result = ETrue;
+                break;
+                }
+            }
+        }
+    else
+        {
+        CScpSubService* subService = GetSubServiceByType( aSubServiceType );
+
+        if( subService )
+            {
+            result = subService->IsReserved();
+            }
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::SetAccessPointId
+// -----------------------------------------------------------------------------
+//
+TInt CScpService::SetAccessPointId( TCCHSubserviceType aSubServiceType, 
+                                    TScpAccessPointType aAccessPointType, 
+                                    TInt aAccessPointId )
+    {
+    SCPLOGSTRING4( "CScpService[0x%x]::SetAccessPointId: type: %d id: %d", 
+                    this, aSubServiceType, aAccessPointId );
+    __ASSERT_DEBUG( iSubServices.Count() > 0, User::Panic( KNullDesC, KErrGeneral ) );
+
+    TInt result = KErrNotFound;
+
+    if( IsAccessPointModifiable( aSubServiceType ) )
+        {
+        TBool sipConnectionCreated = EFalse;
+        CScpSipConnection* sipConnection = GetSipConnection( aSubServiceType,
+                                                             sipConnectionCreated );
+        if( sipConnection )
+            {      
+            switch ( aAccessPointType )
+                {
+                case EScpIap:
+                    {
+                    result = sipConnection->SetIap( aAccessPointId );
+                    }
+                    break;
+            
+                case EScpSnap:
+                    {
+                    result = sipConnection->SetSnap( aAccessPointId );
+                    }
+                    break;
+
+                default:
+                    break;
+
+                }
+
+            if( sipConnectionCreated )
+                {
+                delete sipConnection;
+                }
+            }
+        }
+    else
+        {
+        result = KErrNotSupported;
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::IsAccessPointModifiable
+// -----------------------------------------------------------------------------
+//
+TBool CScpService::IsAccessPointModifiable( TCCHSubserviceType aSubServiceType ) const
+    {
+    SCPLOGSTRING3( "CScpService[0x%x]::IsAccessPointModifiable: type: %d", 
+                    this, aSubServiceType );
+
+    TBool modifiable = EFalse;
+
+    TCCHSubserviceState state = ECCHUninitialized;
+
+    TInt error = State( aSubServiceType, state );
+
+    if( state == ECCHDisabled || ( state == ECCHConnecting && error != KErrNone ) )
+
+        {
+        if( !IsReserved( aSubServiceType ) )
+            {
+            // We can't set any valid access point values if different
+            // sip profiles are in use
+            if( aSubServiceType != ECCHUnknown || ( aSubServiceType == ECCHUnknown &&
+                                                    SubServicesContainSameSipProfile() ) )
+                {
+                modifiable = ETrue;
+                } 
+            }
+        }
+
+    return modifiable;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::GetSipConnection
+// -----------------------------------------------------------------------------
+//
+CScpSipConnection* CScpService::GetSipConnection( TCCHSubserviceType aSubServiceType,
+                                                  TBool& aSipConnectionCreated )
+    {
+    SCPLOGSTRING3( "CScpService[0x%x]::GetSipConnection: type: %d", 
+                    this, aSubServiceType );
+
+    CScpSipConnection* sipConnection = NULL;
+    CScpSubService* subService = NULL;
+
+    if( aSubServiceType == ECCHUnknown && iSubServices.Count() > 0 )
+        {
+        subService = iSubServices[0];
+        }
+    else
+        {
+        subService = GetSubServiceByType( aSubServiceType );
+        }
+
+    if( subService )
+        {
+        TInt sipProfileId = subService->SipProfileId();
+
+        if( iProfileHandler.ProfileExists( sipProfileId ) )
+            {
+            if( iProfileHandler.SipConnectionExists( sipProfileId ) )
+                {
+                sipConnection = iProfileHandler.GetSipConnection( sipProfileId );
+                }
+            else
+                {
+                aSipConnectionCreated = ETrue;
+                TRAP_IGNORE( sipConnection = 
+                             iProfileHandler.CreateSipConnectionL( sipProfileId ) );
+                }
+            }
+        }
+
+    return sipConnection;  
+    }
+
+// -----------------------------------------------------------------------------
+// CScpService::IsAllSubservicesDisabled
+// -----------------------------------------------------------------------------
+//
+TBool CScpService::IsAllSubservicesDisabled() const
+    {
+    TBool response( ETrue );
+       
+    for ( TInt i( 0 ); i < iSubServices.Count() && response; i++ )
+        {
+        SCPLOGSTRING3( "CScpService[0x%x]::IsAllSubservicesDisabled: state: %d", 
+                            this, iSubServices[ i ]->State() );
+        if ( ECCHDisabled != iSubServices[ i ]->State() )
+            {
+            response = EFalse;
+            }
+        }
+    
+    return response;
+    }
+        
+// -----------------------------------------------------------------------------
+// CScpService::ChangeLastReportedErrors
+// -----------------------------------------------------------------------------
+//
+void CScpService::ChangeLastReportedErrors(
+    const TInt aError )
+    {
+    for ( TInt i( 0 ); i < iSubServices.Count(); i++ )
+        {
+        iSubServices[ i ]->SetLastReportedError( aError );
+        }   
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpservicehandlerbase.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 of protocol profile handlers.
+*
+*/
+
+
+#include "scpservicehandlerbase.h"
+#include "scpprofilehandler.h"
+#include "scputility.h"
+#include "scplogger.h"
+#include "scpservicestorage.h"
+#include "scpsubservice.h"
+
+// If sub service disconnection fails a timeout for
+// forced disabled is used.
+const TInt KDisableTimeout = 5000000;
+
+// -----------------------------------------------------------------------------
+// CScpServiceHandlerBase::CScpServiceHandlerBase
+// -----------------------------------------------------------------------------
+//
+CScpServiceHandlerBase::CScpServiceHandlerBase( CScpSubService& aSubService ) :
+    iSubService( aSubService )
+    {
+    SCPLOGSTRING2( "CScpServiceHandlerBase[0x%x]::CScpServiceHandlerBase", this); 
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceHandlerBase::~CScpServiceHandlerBase
+// -----------------------------------------------------------------------------
+//
+CScpServiceHandlerBase::~CScpServiceHandlerBase()
+    {
+    SCPLOGSTRING2( "CScpServiceHandlerBase[0x%x]::~CScpServiceHandlerBase",this); 
+
+    delete iDisableTimer;
+
+    CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+    profileHandler.RemoveObserver( *this );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceHandlerBase::BaseConstructL
+// -----------------------------------------------------------------------------
+//
+void CScpServiceHandlerBase::BaseConstructL()
+    {
+    SCPLOGSTRING2( "CScpServiceHandlerBase[0x%x]::BaseConstructL", this );
+
+    CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+    profileHandler.AddObserverL( *this );
+    
+    iDisableTimer = CPeriodic::NewL( 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// From base class MScpSipConnectionObserver
+// CScpServiceHandlerBase::IsSipProfileAllowedToStartAlr
+// -----------------------------------------------------------------------------
+//
+TBool CScpServiceHandlerBase::IsSipProfileAllowedToStartAlr()
+    {
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceHandlerBase::RegisterProfileL
+// -----------------------------------------------------------------------------
+//
+void CScpServiceHandlerBase::RegisterProfileL()
+    {
+    SCPLOGSTRING2( "CScpServiceHandlerBase[0x%x]::RegisterProfileL", this );
+
+    CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+    profileHandler.RegisterProfileL( iSubService.SipProfileId() );
+
+    CScpSipConnection::TConnectionState currentState = CScpSipConnection::EUnknown;
+    TInt error = KErrNone;
+
+    profileHandler.GetCurrentState( iSubService.SipProfileId(), 
+                                     currentState,
+                                     error );
+
+    __ASSERT_DEBUG( currentState != CScpSipConnection::EUnknown, 
+                    User::Panic( KNullDesC, KErrGeneral ) );
+
+    TScpConnectionEvent event = TScpUtility::ConvertToConnectionEvent( currentState,
+                                                                       error );
+    if ( event == EScpRegistered )
+        {
+        // Sip profile was already registered
+        HandleSipConnectionEvent( iSubService.SipProfileId(), EScpRegistered );
+        }
+    else
+        {
+        iSubService.HandleConnectionEvent( event );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceHandlerBase::DeregisterProfile
+// -----------------------------------------------------------------------------
+//
+void CScpServiceHandlerBase::DeregisterProfile()
+    {
+    SCPLOGSTRING2( "CScpServiceHandlerBase[0x%x]::DeregisterProfile", this );
+
+    // At this point all the service related disconnection operations
+    // have been finished. Now the SIP profile needs to be disabled
+    iSubService.SetSubServiceDisconnected( ETrue );
+
+    TInt sipProfileId = iSubService.SipProfileId(); 
+    CScpServiceStorage& storage = iSubService.ServiceStorage();
+
+    // The SIP profile can be only disabled if
+    // - None of the sub services are in enable state with the same profile
+    // - None of the sub services are doing disconnection with the same profile
+    if ( !storage.IsSubServiceEnabled( sipProfileId ) &&
+         storage.AreAllSubServicesDisconnected( sipProfileId ) )
+        {  
+        CScpSipConnection::TConnectionState currentState = 
+            CScpSipConnection::EUnknown;
+        TInt error( KErrNone );        
+
+        CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+        profileHandler.GetCurrentState( sipProfileId, 
+                                         currentState,
+                                         error );        
+
+        if ( currentState == CScpSipConnection::ERegistering )
+            {
+            profileHandler.CancelRegistration( sipProfileId );
+            }
+        else
+            {
+            error = profileHandler.UnregisterProfile( sipProfileId );
+            if ( KErrNotFound == error )
+                {
+                SCPLOGSTRING3(
+                        "CScpServiceHandlerBase[0x%x]::DeregisterProfile - No profile with ID: %d",
+                        this,
+                        sipProfileId );
+                }
+            }
+        }
+
+    StartForcedDisableTimer( CScpServiceHandlerBase::ForceSipProfileDisable );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceHandlerBase::PerformInstantForceSipProfileDisable
+// -----------------------------------------------------------------------------
+//
+void CScpServiceHandlerBase::PerformInstantForceSipProfileDisable()
+    {
+    SCPLOGSTRING2( 
+        "CScpServiceHandlerBase[0x%x]::PerformInstantForceSipProfileDisable", 
+        this );
+    HandleSipProfileForcedDisable( ETrue );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceHandlerBase::StartForcedDisableTimer
+// -----------------------------------------------------------------------------
+//
+void CScpServiceHandlerBase::StartForcedDisableTimer( TInt (*aFunction)(TAny* aPtr) )
+    {
+    SCPLOGSTRING2( "CScpServiceHandlerBase[0x%x]::StartForcedDisableTimer", this );
+    __ASSERT_DEBUG( !iDisableTimer->IsActive(), 
+                    User::Panic( KNullDesC, KErrGeneral ) );
+
+    if ( !iDisableTimer->IsActive() )
+        {
+        iDisableTimer->Start( KDisableTimeout, 
+                              0, 
+                              TCallBack( aFunction, this ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceHandlerBase::CancelDisableTimer
+// -----------------------------------------------------------------------------
+//
+void CScpServiceHandlerBase::CancelDisableTimer()
+    {
+    SCPLOGSTRING2( "CScpServiceHandlerBase[0x%x]::CancelDisableTimer", this );
+
+    if ( iDisableTimer->IsActive() )
+        {
+        iDisableTimer->Cancel();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceHandlerBase::HandleSipProfileForcedDisable
+// -----------------------------------------------------------------------------
+//
+void CScpServiceHandlerBase::HandleSipProfileForcedDisable( 
+    TBool aForceDisableSipProfile )
+    {
+    SCPLOGSTRING2( 
+        "CScpServiceHandlerBase[0x%x]::HandleSipProfileForcedDisable", this );
+
+    if ( aForceDisableSipProfile )
+        {
+        CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+    
+        CScpSipConnection* sipConnection = 
+            profileHandler.GetSipConnection( iSubService.SipProfileId() );
+      
+        if ( sipConnection )
+            {
+            sipConnection->ForceDisable();
+            }
+        }
+    
+    HandleSipConnectionEvent( iSubService.SipProfileId(), EScpDeregistered );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceHandlerBase::ForceSipProfileDisable
+// -----------------------------------------------------------------------------
+//
+TInt CScpServiceHandlerBase::ForceSipProfileDisable( TAny* aSelf )
+    {
+    SCPLOGSTRING( "CScpServiceHandlerBase::ForceSipProfileDisable" );
+
+    CScpServiceHandlerBase* self = static_cast<CScpServiceHandlerBase*>( aSelf );
+    
+    self->CancelDisableTimer();
+    self->HandleSipProfileForcedDisable( EFalse );
+
+    return 1;
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpservicemanager.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1117 @@
+/*
+* 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:  
+*
+*/
+#include <e32std.h>
+#include <escapeutils.h>
+#include <cmmanager.h>
+#include <cmdestination.h>
+#include <cmconnectionmethoddef.h>
+#include <cmpluginwlandef.h>
+
+#include "scpservicemanager.h"
+#include "scpsettinghandler.h"
+#include "scpservicestorage.h"
+#include "scputility.h"
+#include "scplogger.h"
+#include "scpprofilehandler.h"
+#include "scpservice.h"
+#include "scpsubservice.h"
+#include "scpsipconnection.h"
+#include "scpstatecontainer.h"
+
+const TInt KUsernameMaxLength = 255;
+const TInt KDomainMaxLength = 255;
+const TInt KTempBufMaxLength = 255;
+
+const TUint32 KBearerWlanOnly = 1;
+
+#ifdef _DEBUG
+const TInt KDebugInfoMaxLength = 255;
+#endif
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::CScpServiceManager()
+// -----------------------------------------------------------------------------
+//
+CScpServiceManager::CScpServiceManager( MCchServiceObserver& aServiceObserver ) :
+    iServiceObserver( aServiceObserver )
+    {
+    SCPLOGSTRING( "CScpServiceManager::CScpServiceManager");
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::NewL
+// -----------------------------------------------------------------------------
+//
+CScpServiceManager* CScpServiceManager::NewL( MCchServiceObserver& aServiceObserver )
+    {
+    SCPLOGSTRING( "CScpServiceManager::NewL");
+
+    CScpServiceManager* self = new ( ELeave ) CScpServiceManager( aServiceObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::ConstructL()
+    {
+    SCPLOGSTRING( "CScpServiceManager::ConstructL");
+    
+    iProfileHandler = CScpProfileHandler::NewL();
+    iSettingHandler = CScpSettingHandler::NewL( *iProfileHandler );
+    iServiceStorage = CScpServiceStorage::NewL( *iSettingHandler );  
+    
+
+    iStateContainer.InitializeL();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::~CScpServiceManager
+// -----------------------------------------------------------------------------
+//
+CScpServiceManager::~CScpServiceManager()
+    {    
+    SCPLOGSTRING( "CScpServiceManager::~CScpServiceManager"); 
+
+    delete iServiceStorage;
+    delete iSettingHandler;
+    delete iProfileHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::GetServiceL
+// -----------------------------------------------------------------------------
+//
+CScpService* CScpServiceManager::GetServiceL( TUint aServiceId,
+                                              TCCHSubserviceType aSubServiceType )
+    {
+    SCPLOGSTRING2( "CScpServiceManager::GetService: %i", aServiceId );
+
+    CScpService* service( NULL );
+
+    if( iSettingHandler->ServiceExistsL( aServiceId ) )
+        {
+        service = iServiceStorage->GetServiceByServiceId( aServiceId );
+
+        if( service )
+            {
+            TRAPD( result, iSettingHandler->UpdateSettingsL( *service, aSubServiceType ) );
+             
+            if( result != KErrNone )
+                {
+#ifndef SCP_UNIT_TEST
+                __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) );
+#endif
+                service = NULL;                    
+                }
+            if ( KErrNoMemory == result )
+                {
+                User::Leave( KErrNoMemory );
+                }
+            }
+        }
+
+    return service;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::CreateServiceL
+// -----------------------------------------------------------------------------
+//
+CScpService* CScpServiceManager::CreateServiceL( TUint aServiceId,
+                                                 TCCHSubserviceType aSubServiceType )
+    {
+    SCPLOGSTRING2( "CScpServiceManager::CreateServiceL: %i", aServiceId );
+
+    if( !iSettingHandler->ServiceExistsL( aServiceId ) )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    // Check if it is already available
+    CScpService* service = iServiceStorage->GetServiceByServiceId( aServiceId );
+
+    if( !service )
+        {
+        CScpService& createdService = 
+            iServiceStorage->CreateServiceL( aServiceId, 
+                                             *iProfileHandler, 
+                                             iServiceObserver );
+        
+        service = &createdService;
+
+        TRAPD( result, iSettingHandler->UpdateSettingsL( *service, aSubServiceType ) );
+        
+        if( result != KErrNone )
+            {
+            // Remove the service if something went wrong
+            iServiceStorage->RemoveService( service->Id() );
+            User::Leave( result );
+            }
+        }
+    else
+        {
+#ifndef SCP_UNIT_TEST
+        __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrAlreadyExists ) );
+#endif
+        }
+  
+    return service;
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpServiceManager::EnableServiceL
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::EnableServiceL( TUint aServiceId,
+                                         TCCHSubserviceType aSubServiceType )
+    {
+    SCPLOGSTRING2( "CScpServiceManager::EnableServiceL service:%i", aServiceId );
+    SCPLOGSTRING2( "CScpServiceManager::EnableServiceL type:%i", aSubServiceType );
+    __ASSERT_DEBUG( aServiceId > 0, User::Panic( KNullDesC, KErrNotFound ) );
+
+    CheckRestrictedConnectionsL( aServiceId );
+    
+    CScpService* service = GetServiceL( aServiceId, aSubServiceType );
+    
+    if( !service )
+        {
+        service = CreateServiceL( aServiceId, aSubServiceType );
+        }
+
+    RArray< TInt > subServiceIds;
+    CleanupClosePushL( subServiceIds );
+    service->GetSubServiceIds( subServiceIds );
+    
+    for( TInt i=0 ;i<subServiceIds.Count(); i++ )
+        {
+        CScpSubService* subService = 
+            service->GetSubService( subServiceIds[ i ] );
+        
+        if( subService )
+            {
+            SCPLOGSTRING2( "Subservice's type: %d", subService->SubServiceType() );
+
+            // Check is VoIP supported
+            if ( !iSettingHandler->IsVoIPSupported() && 
+                 ECCHVoIPSub == subService->SubServiceType() )
+                {
+                SCPLOGSTRING( "No support for VoIP" );
+                subService = NULL;
+                }
+
+            if ( subService && 
+                 ( aSubServiceType == subService->SubServiceType() ||
+                 ECCHUnknown == aSubServiceType ) )
+                {
+                UpdateProfileValuesL( aServiceId, aSubServiceType );                
+                subService->EnableL();
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &subServiceIds );                 
+
+    SCPLOGSTRING( "CScpServiceManager::EnableServiceL out" );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::EnableServiceL
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::EnableServiceL( TUint aServiceId,
+                                         TCCHSubserviceType aSubServiceType,
+                                         TUint /*aIapId*/ )
+    {
+    // : Change sip profiles IAP settings, but
+    // If SNAP != 0 add the IAP to SNAP (CommsDB)
+    EnableServiceL( aServiceId, aSubServiceType );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::DisableServiceL
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::DisableServiceL( TUint aServiceId,
+                                          TCCHSubserviceType aSubServiceType )
+    {
+    SCPLOGSTRING2( "CScpServiceManager::DisableService service:%i", aServiceId );
+    __ASSERT_DEBUG( aServiceId > 0, User::Panic( KNullDesC, KErrNotFound ) );
+
+    CScpService* service = GetServiceL( aServiceId, aSubServiceType );
+    if( !service )
+        {
+        service = CreateServiceL( aServiceId, aSubServiceType );
+        }
+
+    RArray< TInt > subServiceIds;
+    CleanupClosePushL( subServiceIds );
+    service->GetSubServiceIds( subServiceIds );
+    
+    if( subServiceIds.Count() == 0 )
+        {
+        // Nothing to disable
+        User::Leave( KErrNotFound );
+        }
+
+    TBool atLeastOneDisableSucceeded = EFalse; 
+
+    for( TInt i=0 ;i<subServiceIds.Count(); i++ )
+        {
+        CScpSubService* subService = service->GetSubService( subServiceIds[ i ] );
+        if( subService && ( aSubServiceType == subService->SubServiceType() ||
+                            aSubServiceType == ECCHUnknown ) )
+            {
+            TInt result = subService->Disable(); 
+            if( result == KErrNone )
+                {
+                atLeastOneDisableSucceeded = ETrue;
+                }
+            }
+        }
+
+    if( !atLeastOneDisableSucceeded )
+        {
+        User::Leave( KErrNotSupported );
+        }
+
+    CleanupStack::PopAndDestroy( &subServiceIds );
+
+    // After the disabling there might be some cleaning to do
+    iServiceStorage->RemoveDisabledServices();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::IsAvailableL
+// -----------------------------------------------------------------------------
+//
+TBool CScpServiceManager::IsAvailableL( TUint /*aServiceId*/,
+                                        TCCHSubserviceType /*a*/,
+                                        const RArray<TUint32>& /*aIapIdArray*/ ) const
+    {
+    SCPLOGSTRING( "CScpServiceManager::IsAvailableL" );
+    // :
+    return ETrue;
+    }
+ 
+// -----------------------------------------------------------------------------
+// CScpServiceManager::GetServiceState
+// -----------------------------------------------------------------------------
+//
+TInt CScpServiceManager::GetServiceState( TUint aServiceId,
+                                          TCCHSubserviceType aSubServiceType, 
+                                          TCCHSubserviceState& aState ) const
+    {
+    SCPLOGSTRING2( "CScpServiceManager::GetServiceState service:%i", aServiceId );
+
+    TInt result( KErrNone );
+    aState = ECCHDisabled;
+    
+    CScpServiceManager* self = const_cast<CScpServiceManager*>(this);
+    CScpService* service = NULL;
+    TRAPD( err, service = self->GetServiceL( aServiceId, aSubServiceType ) );
+    if ( KErrNoMemory == err )
+        {
+        return err;
+        }
+    
+    if( service )
+        {
+        result = service->State( aSubServiceType, aState );
+        }
+    else
+        {
+        TRAP( result, service = CreateTemporaryServiceL( aServiceId, aSubServiceType ) );
+        
+        if( result == KErrNone && service )
+            {
+            result = service->State( aSubServiceType, aState );
+            delete service;
+            }
+        }    
+
+    return result;
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpServiceManager::GetServiceNetworkInfo
+// -----------------------------------------------------------------------------
+//
+TInt CScpServiceManager::GetServiceNetworkInfo( TUint aServiceId,
+                                                TCCHSubserviceType aSubServiceType,
+                                                TUint32& aSnapId, 
+                                                TUint32& aIapId,
+                                                TBool& aSnapLocked,
+                                                TBool& aPasswordSet  ) const
+    {
+    SCPLOGSTRING( "CScpServiceManager::GetServiceNetworkInfo" );
+
+    // Get service network info
+    TRAPD( ret, GetServiceNetworkInfoL( aServiceId,
+                                        aSubServiceType,
+                                        aSnapId,
+                                        aIapId,
+                                        aSnapLocked,
+                                        aPasswordSet) );
+                    
+    return ret;
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpServiceManager::SetSnapId
+// -----------------------------------------------------------------------------
+//
+TInt CScpServiceManager::SetSnapId( TUint aServiceId,
+                                    TCCHSubserviceType aSubServiceType,
+                                    const TUint aSnapId )
+    {
+    SCPLOGSTRING4( "CScpServiceManager::SetSnapId service id: %d type: %d snap: %d",
+                   aServiceId, aSubServiceType, aSnapId );
+
+    return SetAccessPointId( aServiceId, aSubServiceType, EScpSnap, aSnapId );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::SetIapId
+// -----------------------------------------------------------------------------
+//
+TInt CScpServiceManager::SetIapId( TUint aServiceId,
+                                   TCCHSubserviceType aSubServiceType,
+                                   TUint aIapId )
+    {
+    SCPLOGSTRING4( "CScpServiceManager::SetIapId service id: %d type: %d iap: %d",
+                   aServiceId, aSubServiceType, aIapId );
+
+    return SetAccessPointId( aServiceId, aSubServiceType, EScpIap, aIapId );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::SetAccessPointId
+// -----------------------------------------------------------------------------
+//
+TInt CScpServiceManager::SetAccessPointId( TUint aServiceId,
+                                           TCCHSubserviceType aSubServiceType, 
+                                           TScpAccessPointType aAccessPointType, 
+                                           TInt aAccessPointId )
+    {
+    SCPLOGSTRING4( "CScpServiceManager[0x%x]::SetAccessPointId: type: %d id: %d", 
+                    this, aSubServiceType, aAccessPointId );
+
+    TBool serviceCreated = EFalse;
+    TInt result = KErrNone;
+
+    CScpService* service = iServiceStorage->GetServiceByServiceId( aServiceId );
+
+    if( !service )
+        {
+        TRAP( result, service = CreateTemporaryServiceL( aServiceId, 
+                                                         ECCHUnknown ) );
+
+        if( result == KErrNone )
+            {
+            serviceCreated = ETrue;
+            }
+        }
+
+    if( result == KErrNone )
+        {
+        result = service->SetAccessPointId( aSubServiceType, 
+                                            aAccessPointType, 
+                                            aAccessPointId );
+        }
+    
+    if( serviceCreated )
+        {
+        delete service;
+        }
+    
+    return result;
+    }
+ 
+// -----------------------------------------------------------------------------
+// CScpServiceManager::CreateTemporaryServiceL
+// -----------------------------------------------------------------------------
+//   
+CScpService* CScpServiceManager::CreateTemporaryServiceL( TInt aServiceId,
+                                                          TCCHSubserviceType aSubServiceType ) const
+    {
+    SCPLOGSTRING3( "CScpServiceManager::CreateTemporaryServiceL service id: %d type: %d", 
+                    aServiceId,
+                    aSubServiceType );
+
+    // Create a temporary service
+    CScpService* service = CScpService::NewL( aServiceId, 
+                                              aSubServiceType, 
+                                              *iProfileHandler,
+                                              *iServiceStorage,  
+                                              iServiceObserver );
+
+    CleanupStack::PushL( service );
+
+    service->SetServiceId( aServiceId );
+
+    iSettingHandler->UpdateSettingsL( *service, aSubServiceType );
+
+    CleanupStack::Pop( service );
+
+    return service;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::GetServiceInfoL
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::GetServiceInfoL( TUint aServiceId,
+                                          TCCHSubserviceType aSubServiceType,
+                                          RBuf& aBuffer ) const
+    {
+    SCPLOGSTRING3( "CScpServiceManager::GetServiceInfoL service id: %d type: %d", 
+                    aServiceId, aSubServiceType );  
+
+// Info request about the state of SCP for debugging purposes
+#ifdef _DEBUG
+
+    TInt infoCode = 0xAAA;
+    if( aServiceId == infoCode )
+        {
+        aBuffer.Close();
+        HBufC* buf = HBufC::NewL( KDebugInfoMaxLength );
+        TPtr ptr = buf->Des();
+
+        iServiceStorage->GetDebugInfo( ptr );
+        iProfileHandler->GetDebugInfo( ptr );
+
+        aBuffer.Assign( buf );    
+
+        return;
+        }
+#endif
+
+    TBool sipConnectionCreated( EFalse );
+    
+    CScpSipConnection* sipConnection = GetSipConnectionL( aServiceId,
+                                                          aSubServiceType, 
+                                                          sipConnectionCreated );
+
+    if( sipConnectionCreated )
+        {
+        CleanupStack::PushL( sipConnection );
+        }
+      
+    TBuf8<KUsernameMaxLength> username;
+    TBuf8<KDomainMaxLength> domain;
+    TBuf16<KTempBufMaxLength> tempBuf;
+    
+    User::LeaveIfError( sipConnection->GetUsername( username ) );
+    User::LeaveIfError( sipConnection->GetDomain( domain ) );
+    
+    _LIT16( KUsername, "username=");
+    _LIT16( KDomain, "domain=");
+    _LIT16( KSpace, " ");
+    
+    HBufC* buffer = HBufC::NewL( KUsername().Length() +
+                                 KDomain().Length() +
+                                 ( KSpace().Length() * 2) +
+                                 username.Length() +
+                                 domain.Length() );
+                                 
+    buffer->Des().Copy( KUsername );
+    tempBuf.Copy( username );
+    buffer->Des().Append( tempBuf );
+    buffer->Des().Append( KSpace );
+    buffer->Des().Append( KDomain );
+    tempBuf.Copy( domain );
+    buffer->Des().Append( tempBuf );
+    buffer->Des().Append( KSpace );
+    
+    aBuffer.Assign( buffer );    
+
+    if( sipConnectionCreated )
+        {
+        CleanupStack::PopAndDestroy( sipConnection );
+        }
+
+    SCPLOGSTRING2( "Result: %S", &aBuffer );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::GetSipConnectionL
+// -----------------------------------------------------------------------------
+//
+CScpSipConnection* CScpServiceManager::GetSipConnectionL( 
+    TUint aServiceId,
+    TCCHSubserviceType aSubServiceType,
+    TBool& aConnectionCreated ) const
+    {
+    SCPLOGSTRING2( "CScpServiceManager::GetSipConnectionL service:%i", 
+                    aServiceId );
+
+    CScpSipConnection* sipConnection( NULL );
+    aConnectionCreated = EFalse;
+    TUint32 profileId( 0 );
+
+    // Get SIP profile for service
+    iSettingHandler->GetSipProfileIdByTypeL( aServiceId,
+                                             aSubServiceType, 
+                                             profileId );
+
+    if( profileId != 0 )
+        {
+        if( iProfileHandler->SipConnectionExists( profileId ) )
+            {
+            sipConnection = iProfileHandler->GetSipConnection( profileId );
+            }
+        else
+            {
+            if( iProfileHandler->ProfileExists( profileId ) )
+                {
+                sipConnection = iProfileHandler->CreateSipConnectionL( profileId );
+                aConnectionCreated = ETrue;
+                }
+            }
+        }
+
+    if( !sipConnection )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    return sipConnection;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::GetServiceNetworkInfoL
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::GetServiceNetworkInfoL( TUint aServiceId,
+                                                 TCCHSubserviceType aSubServiceType,
+                                                 TUint32& aSnapId, 
+                                                 TUint32& aIapId,
+                                                 TBool& aSnapLocked,
+                                                 TBool& aPasswordSet ) const
+    {
+    SCPLOGSTRING2( "CScpServiceManager::GetServiceNetworkInfoL service:%i", 
+                    aServiceId );
+    __ASSERT_DEBUG( (TInt)aServiceId > KErrNotFound, User::Panic( KNullDesC, KErrGeneral ) );
+    
+    TBool serviceCreated = EFalse;
+
+    CScpService* service = iServiceStorage->GetServiceByServiceId( aServiceId );
+
+    if( !service )
+        {
+        service = CreateTemporaryServiceL( aServiceId, ECCHUnknown );
+
+        serviceCreated = ETrue;
+        CleanupStack::PushL( service );
+        }
+
+    if( aSubServiceType == ECCHUnknown &&
+        service->SubServicesContainSameSipProfile() == EFalse )
+        {
+        // We can't return any valid snap/iap values if different
+        // sip profiles are in use
+        User::Leave( KErrNotSupported );
+        }        
+
+    TBool sipConnectionCreated( EFalse );
+    CScpSipConnection* sipConnection = GetSipConnectionL( aServiceId,
+                                                          aSubServiceType, 
+                                                          sipConnectionCreated );
+    
+    TInt result = sipConnection->GetIap( aIapId );
+    if( result != KErrNone )
+        {
+        aIapId = 0;
+        }
+
+    result = sipConnection->GetSnap( aSnapId );
+    if( result != KErrNone )
+        {
+        aSnapId = 0;
+        }
+		
+    aPasswordSet = sipConnection->IsPasswordSet(); 
+    
+    if( sipConnectionCreated )
+        {
+        delete sipConnection;
+        }
+
+    // Decide if snap is locked
+    aSnapLocked = ETrue;
+
+    if( aSubServiceType == ECCHUnknown || 
+        aSubServiceType == ECCHVoIPSub )
+        {
+        aSnapLocked = EFalse;
+        }
+    else
+        {
+        CScpSubService* voipSubService = service->GetSubServiceByType( ECCHVoIPSub );
+        if( voipSubService )
+            {
+            TInt sipProfileId = voipSubService->SipProfileId();
+
+            CScpSubService* subService = service->GetSubServiceByType( aSubServiceType );
+
+            if( subService )
+                {
+                // If profiles are same the snap can't be changed
+                if( subService->SipProfileId() != sipProfileId )
+                    {
+                    aSnapLocked = EFalse;
+                    }
+                }
+            else
+                {
+                User::Leave( KErrNotFound );
+                }
+            }
+        else
+            {
+            aSnapLocked = EFalse;
+            }
+        }
+        
+    if( serviceCreated )
+        {
+        CleanupStack::PopAndDestroy( service );
+        }
+    
+    SCPLOGSTRING2( "CScpServiceManager::ServiceNetworkInfo snap:%i", aSnapId );    
+    SCPLOGSTRING2( "CScpServiceManager::ServiceNetworkInfo iap:%i", aIapId );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::ReserveService
+// -----------------------------------------------------------------------------
+//
+TInt CScpServiceManager::SetServiceReserved( TBool aReserved,
+                                             TUint aServiceId,
+                                             TCCHSubserviceType aSubServiceType )
+    {
+    SCPLOGSTRING4( "CScpServiceManager::SetServiceReserved: %d service: %d type: %d",
+                  aReserved, aServiceId, aSubServiceType );
+
+    TInt result = KErrNone;
+
+    CScpService* service = iServiceStorage->GetServiceByServiceId( aServiceId );
+
+    if( service )
+        {
+        result = service->SetReserved( aReserved, aSubServiceType );
+        }
+    else
+        {
+        result = KErrNotFound;
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::IsReserved
+// -----------------------------------------------------------------------------
+//
+TInt CScpServiceManager::IsReserved( TUint aServiceId,
+                                     TCCHSubserviceType aSubServiceType ) const
+    {
+    SCPLOGSTRING3( "CScpServiceManager::IsReserved service: %d type: %d",
+                   aServiceId, aSubServiceType );
+
+    TBool result = EFalse;
+
+    CScpService* service = iServiceStorage->GetServiceByServiceId( aServiceId );
+
+    if( service )
+        {
+        result = service->IsReserved( aSubServiceType );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::UpdateProfileValuesL
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::UpdateProfileValuesL( 
+    TUint aServiceId,
+    TCCHSubserviceType aSubServiceType ) const
+    {
+    TUint32 sipId( KErrNone );
+    iSettingHandler->GetSipProfileIdByTypeL( aServiceId, aSubServiceType, sipId );
+    iProfileHandler->UpdateSipProfileL( sipId, 
+        iSettingHandler->IsUahTerminalTypeDefinedL( aServiceId ), 
+        iSettingHandler->IsUahWLANMacDefinedL( aServiceId ), 
+        iSettingHandler->UahStringLengthL( aServiceId ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::GetConnectionParameter
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::GetConnectionParameterL( 
+                             const TServiceSelection& /*aServiceSelection*/,
+                             TCchConnectionParameter /*aParameter*/,
+                             TInt& /*aValue*/ ) const
+    {
+    SCPLOGSTRING( "CScpServiceManager::GetConnectionParameter (int return)\
+    Not supported yet. GetServiceNetworkInfoL is used at the moment." );
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::GetConnectionParameter
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::GetConnectionParameterL( 
+                             const TServiceSelection& aServiceSelection, 
+                             TCchConnectionParameter aParameter,
+                             RBuf& aValue ) const
+    {
+    SCPLOGSTRING3( "CScpServiceManager::GetConnectionParameter (TBuf return) service id: %d type: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType );
+
+    // check supported get values here, to avoid unnecessary object creation
+    if( aParameter!=ECchUsername )
+        {
+        SCPLOGSTRING2( "CScpServiceManager::GetConnectionParameter: not supported parameter:%d", aParameter );
+        User::Leave(KErrArgument );
+        }
+    
+    TBool sipConnectionCreated( EFalse );
+    
+    CScpSipConnection* sipConnection = GetSipConnectionL( 
+                                            aServiceSelection.iServiceId,
+                                            aServiceSelection.iType, 
+                                            sipConnectionCreated );
+    if( sipConnectionCreated )
+        {
+        CleanupStack::PushL( sipConnection );
+        }
+    
+    
+    if( aParameter==ECchUsername )
+        {
+        TBuf16<KTempBufMaxLength> tempBuf;
+        TBuf8<KUsernameMaxLength> username;
+        
+        if( sipConnection->GetUsername( username ) == KErrNone )
+            {
+            // Decode encoded username (spaces to %20).
+            HBufC8* decodedUsername = EscapeUtils::EscapeDecodeL( username );
+            CleanupStack::PushL( decodedUsername );
+            
+            HBufC* userName16 =
+                    EscapeUtils::ConvertToUnicodeFromUtf8L( decodedUsername->Des() );
+            
+            CleanupStack::PopAndDestroy( decodedUsername );
+                        
+            if ( userName16 )
+                {
+                aValue.Copy( userName16->Des() );
+                delete userName16;
+                userName16 = NULL;
+                }
+            else
+                {
+                aValue.Copy( KNullDesC );
+                }
+            }
+        }
+    
+    if( sipConnectionCreated )
+        {
+        CleanupStack::PopAndDestroy( sipConnection );
+        }
+    
+    SCPLOGSTRING2( "Username: %S", &aValue );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::SetConnectionParameter
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::SetConnectionParameterL( 
+                             const TServiceSelection& /*aServiceSelection*/, 
+                             TCchConnectionParameter /*aParameter*/,
+                             TInt /*aValue*/ )
+    {
+    SCPLOGSTRING( "CScpServiceManager::SetConnectionParameter(TInt) \
+    Not supported yet. Separate set methods used." );
+
+    // this is not implemented yet, separate functions are used.
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::SetConnectionParameter
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::SetConnectionParameterL( 
+                     const TServiceSelection& aServiceSelection, 
+                     TCchConnectionParameter aParameter,
+                     const TDesC& aValue )
+    {
+    SCPLOGSTRING3( "CScpServiceManager::SetConnectionParameter (TDesC) service id: %d type: %d",
+                   aServiceSelection.iServiceId, aServiceSelection.iType );
+    
+    if( aParameter!=ECchUsername && aParameter!=ECchPassword )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    HBufC8* buf8 = NULL;
+    buf8 = EscapeUtils::ConvertFromUnicodeToUtf8L( aValue );
+    CleanupStack::PushL( buf8 );
+       
+    TBool sipConnectionCreated( EFalse );
+    
+    CScpSipConnection* sipConnection  = 
+        GetSipConnectionL( aServiceSelection.iServiceId,
+                           aServiceSelection.iType, 
+                           sipConnectionCreated );
+
+    if( sipConnectionCreated )
+        {
+        CleanupStack::PushL( sipConnection );
+        }
+
+    // Get presence settings id.
+    TInt presenceSettingsId( KErrNotFound );
+    TRAP_IGNORE( iSettingHandler->GetSPSettingsIntPropertyL(
+        aServiceSelection.iServiceId,
+        ESubPropertyPresenceSettingsId,
+        presenceSettingsId ) );
+    
+    if( aParameter == ECchUsername )
+        {
+        // Use EscapeUtils to convert spaces to %20.
+        HBufC8* encodedUsername = EscapeUtils::EscapeEncodeL( 
+            buf8->Des(), EscapeUtils::EEscapeNormal );
+        
+        if ( encodedUsername )
+            {
+            CleanupStack::PushL( encodedUsername );
+            
+            // Set username to SIP-profile
+            iProfileHandler->SetUsernameAndPasswordL( 
+                sipConnection->ProfileId(),
+                encodedUsername->Des(), ETrue, KNullDesC8, EFalse );
+            
+            // Set username to XDM-setting if setting exists
+            if ( KErrNotFound != presenceSettingsId )
+                {
+                SetUsernameAndPasswordToXdmL(
+                    aServiceSelection.iServiceId,
+                    *encodedUsername,
+                    ETrue,
+                    KNullDesC8,
+                    EFalse );
+                }           
+            
+            CleanupStack::PopAndDestroy( encodedUsername );
+            
+            SCPLOGSTRING2( "Username is set: %S", &aValue );
+            }
+        }
+    else if( aParameter == ECchPassword )
+        {
+        // Set password to SIP-profile
+        iProfileHandler->SetUsernameAndPasswordL( 
+            sipConnection->ProfileId(),
+            KNullDesC8, EFalse, buf8->Des(), ETrue );
+        
+        // Set password to XDM-setting if setting exists
+        if ( KErrNotFound != presenceSettingsId )
+            {
+            SetUsernameAndPasswordToXdmL(
+                aServiceSelection.iServiceId,
+                KNullDesC8,
+                EFalse,
+                buf8->Des(),
+                ETrue );
+            }
+        
+        SCPLOGSTRING2( "Password is set: %S", &aValue  );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    if( sipConnectionCreated )
+        {
+        CleanupStack::PopAndDestroy( sipConnection );
+        }
+    
+    CleanupStack::PopAndDestroy( buf8 ); 
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::SetUsernameAndPasswordToXdmL
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::SetUsernameAndPasswordToXdmL( 
+    TUint aServiceId,
+    const TDesC8& aUsername,
+    TBool aSetUsername,
+    const TDesC8& aPassword,
+    TBool aSetPassword )
+    {
+    CScpService* service = GetServiceL( 
+        aServiceId, ECCHPresenceSub );
+    
+    TBool deleteTemporaryService( EFalse );
+    if ( !service )
+        {
+        TRAPD( err, service = CreateTemporaryServiceL( 
+            aServiceId,
+            ECCHPresenceSub ) );
+                 
+        if( err == KErrNone && service )
+            {
+            deleteTemporaryService = ETrue;
+            }
+        }
+    
+    if ( service && aSetUsername )
+        {
+        iSettingHandler->UpdateXdmUsernameL( 
+            *service,
+            ECCHPresenceSub,
+            aUsername );
+        }
+    
+    if ( service && aSetPassword )
+        {
+        iSettingHandler->UpdateXdmPasswordL(
+            *service, 
+            ECCHPresenceSub,
+            aPassword );
+        }
+    
+    if ( deleteTemporaryService )
+        {
+        delete service;
+        service = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceManager::CheckRestrictedConnectionsL
+// -----------------------------------------------------------------------------
+//
+void CScpServiceManager::CheckRestrictedConnectionsL( TUint aServiceId )
+    {
+    TBool sipConnectionCreated( EFalse );
+    CScpSipConnection* sipConnection = GetSipConnectionL( 
+                                                    aServiceId,
+                                                    ECCHVoIPSub, 
+                                                    sipConnectionCreated );
+        
+    if( sipConnectionCreated )
+        {
+        CleanupStack::PushL( sipConnection );
+        }
+    // Check bearer filttering setting from sip
+    TUint32 bearerFilttering( 0 );
+    TInt err = sipConnection->BearerFiltteringSetting( bearerFilttering );
+        
+    SCPLOGSTRING2( "CScpServiceManager::CheckAvailableConnectionsL bearerFilttering = %d", bearerFilttering );
+    
+    if ( ( KErrNone == err ) && ( KBearerWlanOnly == bearerFilttering ) )
+        {
+        SCPLOGSTRING( "CScpServiceManager::CheckAvailableConnectionsL WLAN only" );
+        TUint32 snapId( KErrNone );
+        sipConnection->GetSnap( snapId );
+        
+        RArray<TInt> iaps;
+        CleanupClosePushL( iaps );
+        // get first iap and iap's bearer, there must be atleast 
+        // one iap if not cch does not work as it should
+        RCmManager cmm;
+        cmm.OpenL();
+        CleanupClosePushL( cmm );
+        RCmDestination destination( cmm.DestinationL( snapId ) );
+        CleanupClosePushL( destination );
+        
+        TBool wlanIapFound( EFalse );
+        
+        for ( TInt i = 0; i < destination.ConnectionMethodCount(); i++ )
+            {
+            RCmConnectionMethod cm = destination.ConnectionMethodL( i );
+            CleanupClosePushL( cm );
+
+            if( KUidWlanBearerType == 
+                cm.GetIntAttributeL( CMManager::ECmBearerType ) )
+                {
+                SCPLOGSTRING( "CScpServiceManager::CheckAvailableConnectionsL WLAN IAP found" );
+                iaps.Append( cm.GetIntAttributeL( CMManager::ECmIapId ) );
+                wlanIapFound = ETrue;
+                }
+            else
+                {
+                SCPLOGSTRING2( "CScpServiceManager::CheckAvailableConnectionsL iaps count = %d", iaps.Count() );
+                SCPLOGSTRING( "CScpServiceManager::CheckAvailableConnectionsL 3G IAP found break the loop" );
+                i = destination.ConnectionMethodCount();
+                }
+            
+            CleanupStack::PopAndDestroy( &cm );
+            }
+        
+        TBool available( EFalse );
+        for ( TInt j( 0 ); j < iaps.Count(); j++ )
+            {
+            if ( sipConnection->IsIapConnectionAvailable( iaps[ j ] ) )
+                {
+                SCPLOGSTRING( "CScpServiceManager::CheckAvailableConnectionsL WLAN IAP available" );
+                available = ETrue;
+                break;
+                }
+            }
+        
+        CleanupStack::PopAndDestroy( &destination ); 
+        CleanupStack::PopAndDestroy( &cmm );
+        CleanupStack::PopAndDestroy( &iaps );
+        
+        
+        
+        if ( !available && wlanIapFound )
+            {
+            User::Leave( KCCHErrorNetworkLost );
+            }
+        
+        else if( !wlanIapFound )
+            {
+            User::Leave( KCCHErrorAccessPointNotDefined );
+            }
+        } 
+    
+    if( sipConnectionCreated )
+        {
+        CleanupStack::PopAndDestroy( sipConnection );
+        }
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpservicestorage.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,495 @@
+/*
+* 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:  Service storage class.
+*
+*/
+
+
+#include "scpservicestorage.h"
+#include "scplogger.h"
+#include "scpservice.h"
+#include "scpsubservice.h"
+#include "scpsettinghandler.h"
+
+const TInt KServiceIdCounterIncrement = 100;
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::CScpServiceStorage
+// -----------------------------------------------------------------------------
+//
+CScpServiceStorage::CScpServiceStorage( CScpSettingHandler& aSettingHandler ) : 
+    iSettingHandler( aSettingHandler )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::NewL
+// -----------------------------------------------------------------------------
+//
+CScpServiceStorage* CScpServiceStorage::NewL( CScpSettingHandler& aSettingHandler )
+    {
+    SCPLOGSTRING( "CScpServiceStorage::NewL" );
+
+    CScpServiceStorage* self = new ( ELeave ) CScpServiceStorage( aSettingHandler );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::~CScpServiceStorage
+// -----------------------------------------------------------------------------
+//
+CScpServiceStorage::~CScpServiceStorage()
+    {
+    SCPLOGSTRING( "CScpServiceStorage::~CScpServiceStorage" );
+
+    iServiceItems.ResetAndDestroy();
+    iServiceItems.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::CreateServiceL
+// -----------------------------------------------------------------------------
+//
+CScpService& CScpServiceStorage::CreateServiceL( 
+    TInt aServiceId, 
+    CScpProfileHandler& aProfileHandler,
+    MCchServiceObserver& aServiceObserver )
+    {
+    SCPLOGSTRING( "CScpServiceStorage::CreateServiceL" );
+
+    CScpService* service( NULL );
+    
+    // Check that the service id does not already exist
+    service = GetServiceByServiceId( aServiceId );
+    if( service )
+        {
+        User::Leave( KErrAlreadyExists );
+        }
+
+    TInt newId = GenerateNewInternalIdForService();
+
+    service = CScpService::NewL( newId, 
+                                 aServiceId, 
+                                 aProfileHandler,
+                                 *this,
+                                 aServiceObserver );
+
+    CleanupStack::PushL( service );
+    iServiceItems.AppendL( service );
+    CleanupStack::Pop( service );
+
+    CScpService* lastService = iServiceItems[ iServiceItems.Count() - 1 ];
+    return *lastService;    
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::GenerateNewServiceId
+// -----------------------------------------------------------------------------
+//
+TInt CScpServiceStorage::GenerateNewInternalIdForService()
+    {
+    SCPLOGSTRING( "CScpServiceStorage::GenerateNewInternalIdForService" );
+
+    iServiceIdCounter += KServiceIdCounterIncrement;
+    
+    return iServiceIdCounter;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::RemoveService
+// -----------------------------------------------------------------------------
+//
+TInt CScpServiceStorage::RemoveService( TInt aId )
+    {    
+    SCPLOGSTRING2( "CScpServiceStorage::RemoveService id: %d", aId );
+
+    for( TInt i=0; i<iServiceItems.Count(); i++)
+        {
+        CScpService* service = iServiceItems[ i ];
+        if( service && aId == service->Id() )
+            {
+            delete service;
+            iServiceItems.Remove( i );
+            return KErrNone;
+            }
+        }
+
+    return KErrNotFound;      
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::RemoveDisabledServices
+// -----------------------------------------------------------------------------
+//
+void CScpServiceStorage::RemoveDisabledServices()
+    {
+    SCPLOGSTRING( "CScpServiceStorage::RemoveEmptyServices" );
+
+    RArray< TInt > subServiceIds;
+    RArray< TInt > removedServiceIds;
+
+    for( TInt i=0; i<iServiceItems.Count(); i++)
+        {
+        CScpService* service = iServiceItems[ i ];
+        if( service )
+            {
+            subServiceIds.Reset();
+                
+            service->GetSubServiceIds( subServiceIds );
+
+            TBool remove( ETrue );
+
+            // Remove if there are no sub services
+            if( subServiceIds.Count() > 0 )
+                {
+                for ( TInt j=0; j<subServiceIds.Count(); j++ )
+                    {
+                    CScpSubService* subService = 
+                        service->GetSubService( subServiceIds[ j ] );
+                    
+                    // Don't remove if there is at least one enabled or disconnecting
+                    // sub service
+                    if( subService && (
+                            subService->EnableRequestedState() == CScpSubService::EScpEnabled ||
+                            subService->State() == ECCHDisconnecting ) )
+                        {
+                        remove = EFalse;
+                        }
+                    else if ( subService )
+                        {
+                        service->RemoveSubService( subService->Id() );
+                        }
+                    }
+                }
+
+            if( remove ) 
+                {
+                removedServiceIds.Append( service->Id() ); 
+                }
+            }
+        }
+
+    for( TInt i=0; i<removedServiceIds.Count(); i++ )
+        {
+        RemoveService( removedServiceIds[ i ] );
+        }
+
+    removedServiceIds.Close();
+    subServiceIds.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::GetService
+// -----------------------------------------------------------------------------
+//
+CScpService* CScpServiceStorage::GetService( TInt aId ) const
+    {
+    SCPLOGSTRING2( "CScpServiceStorage::GetService id: %d", aId );
+
+    for( TInt i=0; i<iServiceItems.Count(); i++)
+        {
+        CScpService* service = iServiceItems[ i ];
+        if( aId == service->Id() )
+            {
+            return service;
+            }
+        }
+    
+    return NULL;    
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::GetServiceByServiceId
+// -----------------------------------------------------------------------------
+//
+CScpService* CScpServiceStorage::GetServiceByServiceId( TUint aServiceId ) const
+    {
+    SCPLOGSTRING2( "CScpServiceStorage::GetServiceByServiceId id: %d", aServiceId );
+
+    for( TInt i=0; i<iServiceItems.Count(); i++)
+        {
+        CScpService* service = iServiceItems[ i ];
+        if( aServiceId == service->ServiceId() )
+            {
+            return service;
+            }
+        }
+    
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::GetSubService
+// -----------------------------------------------------------------------------
+//
+CScpSubService* CScpServiceStorage::GetSubService( TInt aId ) const
+    {
+    SCPLOGSTRING2( "CScpServiceStorage::GetSubService id: %d", aId );
+
+    CScpSubService* returnSubService( NULL );
+
+    RArray<TInt> subServiceIds;
+    for( TInt i=0; i<iServiceItems.Count() && !returnSubService; i++)
+        {
+        CScpService* service = iServiceItems[ i ];
+        
+        subServiceIds.Reset();
+        service->GetSubServiceIds( subServiceIds );
+
+        for( TInt j=0; j<subServiceIds.Count(); j++)
+            {
+            returnSubService = service->GetSubService( subServiceIds[ j ] );
+
+            if( returnSubService )
+                {
+                if( returnSubService->Id() == aId )
+                    {
+                    break;
+                    }
+                else
+                    {
+                    returnSubService = NULL;
+                    }
+                }
+            }
+        }
+
+    subServiceIds.Close();
+    
+    return returnSubService;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::GetServiceIds
+// -----------------------------------------------------------------------------
+//
+void CScpServiceStorage::GetServiceIds( RArray<TInt>& aIds ) const
+    {
+    SCPLOGSTRING( "CScpServiceStorage::GetServiceIds" );
+    __ASSERT_DEBUG( aIds.Count() == 0, User::Panic( KNullDesC, KErrGeneral ) );
+
+    for( TInt i=0; i<iServiceItems.Count(); i++)
+        {
+        CScpService* service = iServiceItems[ i ];
+        aIds.Append( service->Id() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::GetSubServiceIds
+// -----------------------------------------------------------------------------
+//
+void CScpServiceStorage::GetSubServiceIds( RArray<TInt>& aIds ) const
+    {
+    SCPLOGSTRING( "CScpServiceStorage::GetSubServiceIds" );
+    __ASSERT_DEBUG( aIds.Count() == 0, User::Panic( KNullDesC, KErrGeneral ) );
+
+    RArray<TInt> subServiceIds;
+
+    for( TInt i=0; i<iServiceItems.Count(); i++ )
+        {
+        CScpService* service = iServiceItems[ i ];
+        
+        subServiceIds.Reset();
+        service->GetSubServiceIds( subServiceIds );
+
+        for( TInt j=0; j<subServiceIds.Count(); j++ )
+            {
+            aIds.Append( subServiceIds[ j ] );
+            }
+        }
+
+    subServiceIds.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::GetSubServiceIds
+// -----------------------------------------------------------------------------
+//
+void CScpServiceStorage::GetSubServiceIds( TCCHSubserviceType aSubServiceType,
+                                           RArray<TInt>& aIds ) const
+    {
+    SCPLOGSTRING( "CScpServiceStorage::GetSubServiceIds" );
+    __ASSERT_DEBUG( aIds.Count() == 0, User::Panic( KNullDesC, KErrGeneral ) );
+
+    RArray< TInt > subServiceIds;
+    GetSubServiceIds( subServiceIds );
+    
+    for( TInt i=0; i<subServiceIds.Count(); i++ )
+        {
+        CScpSubService* subService;
+        subService = GetSubService( subServiceIds[ i ] );
+
+        if( subService && subService->SubServiceType() == aSubServiceType )
+            {
+            aIds.Append( subService->Id() );
+            }
+        }
+    
+    subServiceIds.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::GetSubServiceIds
+// -----------------------------------------------------------------------------
+//
+void CScpServiceStorage::GetSubServiceIds( TUint32 aProfileId,
+                                           TCCHSubserviceType aSubServiceType,  
+                                           RArray<TInt>& aIds ) const
+    {
+    SCPLOGSTRING3( "CScpServiceStorage::GetSubServiceIds profileId: %d type: %d",
+                   aProfileId, aSubServiceType );
+    __ASSERT_DEBUG( aIds.Count() == 0, User::Panic( KNullDesC, KErrGeneral ) );
+
+    RArray< TInt > subServiceIds;
+    GetSubServiceIds( subServiceIds );
+    
+    for( TInt i=0; i<subServiceIds.Count(); i++ )
+        {
+        CScpSubService* subService;
+        subService = GetSubService( subServiceIds[ i ] );
+
+        if( subService &&
+            subService->SipProfileId() == aProfileId &&
+            ( subService->SubServiceType() == aSubServiceType ||
+            aSubServiceType == ECCHUnknown ) )
+            {
+            aIds.Append( subService->Id() );
+            }
+        }
+    
+    subServiceIds.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::IsSubServiceEnabled
+// -----------------------------------------------------------------------------
+//
+TBool CScpServiceStorage::IsSubServiceEnabled( TUint32 aProfileId ) const
+    {
+    SCPLOGSTRING2( "CScpServiceStorage::IsSubServiceEnabled profile id: %d",
+                   aProfileId );
+
+    TBool result( EFalse );
+    RArray< TInt > subServiceIds;
+
+    GetSubServiceIds( aProfileId, ECCHUnknown, subServiceIds );
+
+    for( TInt i=0; i<subServiceIds.Count(); i++ )
+        {
+        CScpSubService* subService = GetSubService( subServiceIds[ i ] );
+        if( subService )
+            {
+            // Find at least one sub service that is still enabled
+            if( subService->EnableRequestedState() == CScpSubService::EScpEnabled )
+                {
+                result = ETrue;
+                break;
+                }
+            }
+        }
+
+    subServiceIds.Close();
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::AreAllSubServicesDisconnected
+// -----------------------------------------------------------------------------
+//
+TBool CScpServiceStorage::AreAllSubServicesDisconnected( TUint32 aProfileId ) const
+    {
+    SCPLOGSTRING2( "CScpServiceStorage::AreAllSubServicesDisconnected profile id: %d",
+                   aProfileId );
+
+    TBool result( ETrue );
+    RArray< TInt > subServiceIds;
+
+    GetSubServiceIds( aProfileId, ECCHUnknown, subServiceIds );
+
+    for( TInt i=0; i<subServiceIds.Count(); i++ )
+        {
+        CScpSubService* subService = GetSubService( subServiceIds[ i ] );
+        if( subService )
+            {
+            // Find at least one sub service that has been disabled but
+            // it has not yet disconnected the service
+            if( subService->EnableRequestedState() == CScpSubService::EScpDisabled &&
+                subService->SubServiceDisconnected() == EFalse )
+                {
+                result = EFalse;
+                break;
+                }
+            }
+        }
+
+    subServiceIds.Close();
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::SettingsHandler
+// -----------------------------------------------------------------------------
+//
+CScpSettingHandler& CScpServiceStorage::SettingsHandler()
+    {
+    SCPLOGSTRING( "CScpServiceStorage::SettingsHandler" );
+
+    return iSettingHandler;
+    }
+
+
+#ifdef _DEBUG
+// -----------------------------------------------------------------------------
+// CScpServiceStorage::GetDebugInfo
+// -----------------------------------------------------------------------------
+//
+void CScpServiceStorage::GetDebugInfo( TDes& aInfo ) const
+    {
+    TInt serviceCount = iServiceItems.Count();
+    TInt subServiceCount( 0 );
+    TInt enabledSubServices( 0 );
+
+    for( TInt i=0; i<serviceCount; i++ )
+        {
+        CScpService* service = iServiceItems[ i ];
+        subServiceCount += service->SubServiceCount();
+    
+        RArray<TInt> subServiceIds;
+        service->GetSubServiceIds( subServiceIds );
+
+        for( TInt j=0; j<subServiceIds.Count(); j++ )
+            {
+            CScpSubService* subService = service->GetSubService( subServiceIds[ j ] );
+            
+            if( subService &&
+                    subService->EnableRequestedState() == CScpSubService::EScpEnabled )
+                {
+                enabledSubServices++;
+                }
+            }
+
+        subServiceIds.Close();
+        }
+
+    TBuf< 255 > buffer;
+    buffer.Format( _L( "\nServices: %d\n SubServices: %d\n Enabled: %d\n" ),
+                  serviceCount, subServiceCount, enabledSubServices ); 
+
+    aInfo.Append( buffer );
+    }
+#endif
+
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpsettinghandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1103 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 <crcseprofileregistry.h>
+#include <spsettings.h>
+#include <spentry.h>
+#include <spproperty.h>
+#include <spsettingsvoiputils.h>
+#include <pressettingsapi.h>
+#include <XdmSettingsApi.h>
+#include <XdmSettingsCollection.h>
+
+#include "scpsettinghandler.h"
+#include "scpservice.h"
+#include "scpsubservice.h"
+#include "scplogger.h"
+#include "scputility.h"
+#include "scpservicehandlerbase.h"
+#include "sipconnectionprovideruids.hrh"
+#include "scpprofilehandler.h"
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::CScpSettingHandler
+// -----------------------------------------------------------------------------
+//
+CScpSettingHandler::CScpSettingHandler( CScpProfileHandler& aProfileHandler ) :
+    iProfileHandler( aProfileHandler )
+    {
+    SCPLOGSTRING( "CScpSettingHandler::CScpSettingHandler" );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::NewL
+// -----------------------------------------------------------------------------
+//
+CScpSettingHandler* CScpSettingHandler::NewL( CScpProfileHandler& aProfileHandler )
+    {
+    SCPLOGSTRING( "CScpSettingHandler::NewL()" );
+
+    CScpSettingHandler* self = new( ELeave ) CScpSettingHandler( aProfileHandler );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::~CScpSettingHandler
+// -----------------------------------------------------------------------------
+//
+CScpSettingHandler::~CScpSettingHandler()
+    {
+    SCPLOGSTRING( "CScpSettingHandler::~CScpSettingHandler" );
+
+    delete iSpsVoIPUtils;
+    delete iSpSettings;
+    delete iRcseProfileEntry;
+    delete iRcseProfileRegistry;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::ConstructL()
+    {
+    SCPLOGSTRING("CScpSettingHandler::ConstructL" );
+
+    iRcseProfileRegistry = CRCSEProfileRegistry::NewL();
+    iRcseProfileEntry = CRCSEProfileEntry::NewL();
+
+    iSpSettings = CSPSettings::NewL(); 
+    iSpsVoIPUtils = CSPSettingsVoIPUtils::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::GetSipProfileIdByTypeL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::GetSipProfileIdByTypeL( TUint32 aServiceId,
+                                                 TCCHSubserviceType aSubServiceType, 
+                                                 TUint32& aSipId ) const
+    {
+    SCPLOGSTRING3( "CScpSettingHandler::GetSipProfileIdByTypeL service id :%i type %d", 
+                    aServiceId, aSubServiceType );
+
+    switch ( aSubServiceType )
+        {
+        case ECCHVoIPSub:
+        case ECCHIMSub:
+            {
+            GetVoipSipProfileIdL( aServiceId, aSipId );
+            }
+            break;
+
+        case ECCHVMBxSub:
+            {
+            GetVmbxSipProfileIdL( aServiceId, aSipId );
+            }
+            break;
+
+        case ECCHPresenceSub:
+            {
+            GetPresenceSipProfileIdL( aServiceId, aSipId );
+            }
+            break;
+
+        case ECCHUnknown:
+            {
+            GetUnknownSipProfileIdL( aServiceId, aSipId );
+            }
+            break;
+    
+        default:
+            __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) );
+            break;
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::GetSPSettingsIntPropertyL
+// -----------------------------------------------------------------------------
+//    
+ void CScpSettingHandler::GetSPSettingsIntPropertyL( TUint32 aServiceId,
+                                                     TServicePropertyName aPropertyName, 
+                                                     TInt& aProperty ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::GetSPSettingsIntPropertyL" );
+
+    CSPEntry* entry = CSPEntry::NewLC();
+    TInt result = iSpSettings->FindEntryL( aServiceId, *entry );
+
+    if ( result == KErrNone )
+        {
+        // Get asked property 
+        const CSPProperty* property = NULL;
+        result = entry->GetProperty( property, aPropertyName );
+
+        if ( result == KErrNone && property )
+            {
+            TInt value( 0 );
+            property->GetValue( value );
+            aProperty = value;
+            }
+        else
+            {
+            User::Leave( KErrNotFound );
+            }
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    CleanupStack::PopAndDestroy( entry );        
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::GetVoipSipProfileIdL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::GetVoipSipProfileIdL( TUint32 aServiceId, 
+                                               TUint32& aSipId ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::GetVoipSipProfileIdL" );
+
+    RPointerArray<CRCSEProfileEntry> entries;
+
+    // Push entries to cleanup stack
+    CleanupStack::PushL( TCleanupItem( TScpUtility::ResetAndDestroyEntries, 
+                                       &entries ) );
+
+    iRcseProfileRegistry->FindByServiceIdL( aServiceId, entries );
+    
+    if ( entries.Count() )
+        {            
+        CRCSEProfileEntry* entry = entries[0];
+        if ( entry->iIds.Count() > 0 )
+            {
+            aSipId = entry->iIds[0].iProfileId;
+            }
+        else
+            {
+            User::Leave( KErrNotFound );
+            }
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    CleanupStack::PopAndDestroy( &entries );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::GetVmbxSipProfileIdL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::GetVmbxSipProfileIdL( TUint32 aServiceId, 
+                                               TUint32& aSipId ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::GetVmbxSipProfileIdL" );
+
+    TInt sipId;
+    GetSPSettingsIntPropertyL( aServiceId, ESubPropertyVMBXSettingsId, sipId );
+    aSipId = sipId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::GetPresenceSipProfileIdL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::GetPresenceSipProfileIdL( TUint32 aServiceId, 
+                                                   TUint32& aSipId ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::GetPresenceSipProfileIdL" );
+
+    CSPEntry* entry = CSPEntry::NewLC();
+    TInt result = iSpSettings->FindEntryL( aServiceId, *entry );
+    if ( result == KErrNone )
+        {
+        // Get presence setting id for presence service
+        const CSPProperty* property = NULL;
+        result = entry->GetProperty( property, ESubPropertyPresenceSettingsId );
+
+        if ( result == KErrNone && property )
+            {
+            TInt presId;
+            property->GetValue( presId );
+
+            //Found out what is sip id in presencesettings
+            TPresSettingsSet mySet;
+            User::LeaveIfError( PresSettingsApi::SettingsSetL( presId, mySet ));
+
+            TInt sipId( 0 );
+            sipId = mySet.iSipProfile;
+            aSipId = (TUint32)(sipId);
+            }
+        else
+            {
+            User::Leave( KErrNotFound );
+            }         
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    CleanupStack::PopAndDestroy( entry );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::GetUnknownSipProfileIdL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::GetUnknownSipProfileIdL( TUint32 aServiceId, 
+                                                  TUint32& aSipId ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::GetVoipSipProfileIdL" );
+    
+    TInt result( KErrNone );
+    TUint32 genericSipId( KErrNone );
+    RArray< TInt > sipIds;
+    CleanupClosePushL( sipIds );
+    
+    TRAP( result, GetSipProfileIdByTypeL( aServiceId, ECCHVoIPSub, genericSipId ) );
+    
+    if ( result == KErrNone )
+        {
+        sipIds.AppendL( genericSipId );
+        }
+    else if ( KErrNoMemory == result )
+        {
+        User::Leave( KErrNoMemory );
+        }
+
+    TRAP( result, GetSipProfileIdByTypeL( aServiceId, ECCHVMBxSub, genericSipId ) );
+
+    if ( result == KErrNone )
+        {
+        sipIds.AppendL( genericSipId );
+        }
+    else if ( KErrNoMemory == result )
+        {
+        User::Leave( KErrNoMemory );
+        }
+    
+    TRAP( result, GetSipProfileIdByTypeL( aServiceId, ECCHPresenceSub, genericSipId ) );
+
+    if ( result == KErrNone )
+        {
+        sipIds.AppendL( genericSipId );
+        }
+    else if ( KErrNoMemory == result )
+        {
+        User::Leave( KErrNoMemory );
+        }
+    
+    // Check if all the sip profiles ids for different subservice types
+    // are the same
+    if ( sipIds.Count() > 0 )
+        {
+        result = KErrNone;
+        aSipId = sipIds[0];
+
+        for( TInt i=0; i<sipIds.Count(); i++ )
+            {
+            if( sipIds[i] != aSipId )
+                {
+                result = KErrArgument;
+                break;
+                }
+            }
+        }
+    else
+        {        
+        // There wasn't any sip profile ids
+        result = KErrNotFound;
+        }
+
+    CleanupStack::PopAndDestroy( &sipIds );
+
+    User::LeaveIfError( result );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::UpdateSettingsL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::UpdateSettingsL( CScpService& aService,
+                                          TCCHSubserviceType aSubServiceType ) const
+    {
+    SCPLOGSTRING4( "CScpSettingHandler::UpdateSettingsL: 0x%x id: %i type: %d", 
+                   &aService, aService.ServiceId(), aSubServiceType );
+    __ASSERT_DEBUG( aService.ServiceId() > KErrNotFound, 
+                    User::Panic( KNullDesC, KErrNotFound ) );
+
+    if ( !aService.ContainsSubServiceType( ECCHVoIPSub ) &&
+        ( aSubServiceType == ECCHVoIPSub || aSubServiceType == ECCHUnknown ) )
+        {
+        SCPLOGSTRING( "CScpSettingHandler::UpdateSettingsL voip " );
+        UpdateVoIPSettingsL( aService );
+        }
+
+    if ( !aService.ContainsSubServiceType( ECCHIMSub ) &&
+        ( ECCHIMSub == aSubServiceType || ECCHUnknown == aSubServiceType ) )
+        {
+        SCPLOGSTRING( "CScpSettingHandler::UpdateSettingsL IM" );
+        UpdateImSettingsL( aService );
+        }
+
+    if ( !aService.ContainsSubServiceType( ECCHVMBxSub ) &&
+        ( aSubServiceType == ECCHVMBxSub || aSubServiceType == ECCHUnknown ) )
+        {
+        SCPLOGSTRING( "CScpSettingHandler::UpdateSettingsL vmbx " );
+        UpdateVmbxSettingsL( aService );
+        }
+
+    if ( !aService.ContainsSubServiceType( ECCHPresenceSub ) &&
+        (aSubServiceType == ECCHPresenceSub || aSubServiceType == ECCHUnknown ) )
+        {
+        SCPLOGSTRING( "CScpSettingHandler::UpdateSettingsL presence x " );
+        UpdatePresenceSettingsL( aService );
+        }
+ 
+    if ( aService.SubServiceCount() == 0 )
+        {
+        User::Leave( KErrNotFound );
+        }   
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::UpdateXdmUsernameL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::UpdateXdmUsernameL( CScpService& aService, 
+    TCCHSubserviceType aSubServiceType, const TDesC8& aUsername )
+    {
+    SCPLOGSTRING2( "CScpSettingHandler::UpdateXdmUsernameL, service id: %d", 
+        aService.ServiceId() );
+    
+    if ( aService.ContainsSubServiceType( ECCHPresenceSub ) &&
+        ( aSubServiceType == ECCHPresenceSub || 
+        aSubServiceType == ECCHUnknown ) )
+        {
+        CSPEntry* entry = CSPEntry::NewLC();
+        User::LeaveIfError( iSpSettings->FindEntryL( 
+            aService.ServiceId(), *entry ) );
+                   
+        if ( ArePresenceSettingsValid( *entry ) )
+            {                
+            TInt presenceSettingsId = GetPresenceSettingsId( *entry );
+                
+            if ( presenceSettingsId != KErrNotFound )
+                {                    
+                // Find out the sip profile that the presence is using
+                TPresSettingsSet mySet;
+                TRAPD( result, 
+                    PresSettingsApi::SettingsSetL( 
+                         presenceSettingsId, mySet ) );
+                    
+                if ( KErrNone == result && mySet.iSipProfile > 0 )
+                    {                        
+                    // check XDM settings are valid
+                    CXdmSettingsCollection* xdmCollection = NULL;
+                    TRAPD( xdmResult, xdmCollection = 
+                        TXdmSettingsApi::SettingsCollectionL(
+                             mySet.iXDMSetting ) );
+                        
+                    if ( KErrNone == xdmResult && xdmCollection )
+                        {
+                        CleanupStack::PushL( xdmCollection );
+                            
+                        if ( iProfileHandler.ProfileExists( 
+                            mySet.iSipProfile ) )
+                            {
+                            RBuf8 formattedUsername;
+                            CleanupClosePushL( formattedUsername );
+                                
+                            if( !TScpUtility::CheckSipUsername( aUsername ) )
+                                {
+                                // Since username is returned with prefix and
+                                // domain, it needs to be possible to also set
+                                // it with prefix and domain.  Strip prefix
+                                // and domain from user aor if found. Prefix
+                                // might be sip or sips so search by colon.
+                                User::LeaveIfError( 
+                                    TScpUtility::RemovePrefixAndDomain(
+                                        aUsername, formattedUsername ) );
+                                }
+                            else
+                                {
+                                formattedUsername.CreateL( 
+                                    aUsername.Length() );
+                                formattedUsername.Copy( aUsername );
+                                }
+ 
+                            RBuf userName;
+                            CleanupClosePushL( userName );
+                            userName.CreateL( formattedUsername.Length() );
+                            userName.Copy( formattedUsername );
+                            
+                            // Update username to XDM-setting.
+                            TXdmSettingsApi::UpdatePropertyL( 
+                                mySet.iXDMSetting,
+                                userName,
+                                EXdmPropAuthName );
+                                
+                            CleanupStack::PopAndDestroy( &userName );
+                            CleanupStack::PopAndDestroy( &formattedUsername );
+                            
+                            SCPLOGSTRING( 
+                            "CScpSettingHandler::UpdateXdmUsernameL - DONE" );
+                            }
+                        else
+                            {
+                            User::Leave( KErrNotFound );
+                            }
+                            
+                        CleanupStack::PopAndDestroy( xdmCollection );
+                        }
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( entry );
+        }
+ 
+    if ( aService.SubServiceCount() == 0 )
+        {        
+        User::Leave( KErrNotFound );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::UpdateXdmPasswordL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::UpdateXdmPasswordL( CScpService& aService, 
+    TCCHSubserviceType aSubServiceType, const TDesC8& aPassword )
+    {
+    SCPLOGSTRING2( "CScpSettingHandler::UpdateXdmPasswordL, service id: %d",
+        aService.ServiceId() );
+    
+    if ( aService.ContainsSubServiceType( ECCHPresenceSub ) &&
+        ( aSubServiceType == ECCHPresenceSub || 
+        aSubServiceType == ECCHUnknown ) )
+        {
+        SCPLOGSTRING( "CScpSettingHandler::UpdateXdmPasswordL, presence" );
+
+        CSPEntry* entry = CSPEntry::NewLC();
+        User::LeaveIfError( iSpSettings->FindEntryL( 
+            aService.ServiceId(), *entry ) );
+        
+        if ( ArePresenceSettingsValid( *entry ) )
+            {
+            TInt presenceSettingsId = GetPresenceSettingsId( *entry );
+
+            if ( presenceSettingsId != KErrNotFound )
+                {
+                // Find out the sip profile that the presence is using
+                TPresSettingsSet mySet;
+
+                TRAPD( result, 
+                    PresSettingsApi::SettingsSetL(
+                        presenceSettingsId, mySet ) );
+                       
+                if ( KErrNone == result && mySet.iSipProfile > 0 )
+                    {
+                    // check XDM settings are valid
+                    CXdmSettingsCollection* xdmCollection = NULL;
+                    TRAPD( xdmResult, xdmCollection = 
+                        TXdmSettingsApi::SettingsCollectionL(
+                            mySet.iXDMSetting ) );
+                        
+                    if ( KErrNone == xdmResult && xdmCollection )
+                        {
+                        CleanupStack::PushL( xdmCollection );
+                                 
+                        if ( iProfileHandler.ProfileExists( 
+                            mySet.iSipProfile ) )
+                            {
+                            RBuf passwordBuf;
+                            CleanupClosePushL( passwordBuf );
+                            passwordBuf.CreateL( aPassword.Length() );
+                            passwordBuf.Copy( aPassword );
+                                
+                            // Update password to XDM-setting
+                            TXdmSettingsApi::UpdatePropertyL( 
+                                mySet.iXDMSetting,
+                                passwordBuf,
+                                EXdmPropAuthSecret );    
+                                    
+                            CleanupStack::PopAndDestroy( &passwordBuf );
+                            
+                            SCPLOGSTRING( 
+                            "CScpSettingHandler::UpdateXdmPasswordL - DONE" );
+                            }
+                        else
+                            {
+                            User::Leave( KErrNotFound );
+                            }
+
+                        CleanupStack::PopAndDestroy( xdmCollection );
+                        }
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( entry );
+        }
+ 
+    if ( aService.SubServiceCount() == 0 )
+        {
+        User::Leave( KErrNotFound );
+        }           
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::UpdatePresenceSettingsL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::UpdatePresenceSettingsL( CScpService& aService ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::UpdatePresenceSettingsL" );
+
+    CSPEntry* entry = CSPEntry::NewLC();
+    
+    if ( iSpSettings->FindEntryL( aService.ServiceId(), *entry ) == KErrNone )
+        {
+        if ( ArePresenceSettingsValid( *entry ) )
+            {
+            TInt presenceSettingsId = GetPresenceSettingsId( *entry );
+
+            if ( presenceSettingsId != KErrNotFound )
+                {
+                // Find out the sip profile that the presence is using
+                TPresSettingsSet mySet;
+
+                TRAPD( result, 
+                       PresSettingsApi::SettingsSetL( presenceSettingsId, mySet ) );
+                   
+                if ( KErrNone == result && mySet.iSipProfile > 0 )
+                    {
+                    // check XDM settings are valid
+                    CXdmSettingsCollection* xdmCollection = NULL;
+                    TRAPD( xdmResult, xdmCollection = 
+                        TXdmSettingsApi::SettingsCollectionL( mySet.iXDMSetting ) );
+                    
+                    if ( KErrNone == xdmResult && xdmCollection )
+                        {
+                        CleanupStack::PushL( xdmCollection );
+                                                
+                        if ( iProfileHandler.ProfileExists( mySet.iSipProfile ) )
+                            {
+                            CScpSubService& presenceService = aService.AddSubServiceL( ECCHPresenceSub );
+
+                            presenceService.SetSipProfileId( mySet.iSipProfile );
+                            }
+                        else
+                            {
+                            User::Leave( KErrNotFound );
+                            }
+
+                        CleanupStack::PopAndDestroy( xdmCollection );
+                        }
+                    }
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( entry );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::ArePresenceSettingsValid
+// -----------------------------------------------------------------------------
+//
+TBool CScpSettingHandler::ArePresenceSettingsValid( const CSPEntry& aEntry ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::ArePresenceSettingsValid" );
+
+    const CSPProperty* property = NULL;
+
+    // Make sure that the this is the correct plugin
+    TInt result = aEntry.GetProperty( property, EPropertyPresenceSubServicePluginId );
+    
+    if ( result == KErrNone && property )
+        {
+        TInt pluginId = 0;
+        property->GetValue( pluginId );
+
+        SCPLOGSTRING2( "Presence sub service plugin UID: 0x%x", pluginId );
+
+        if ( pluginId == KSIPConnectivityPluginImplUid )
+            {
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::GetPresenceSettingsId
+// -----------------------------------------------------------------------------
+//
+TInt CScpSettingHandler::GetPresenceSettingsId( const CSPEntry& aEntry ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::GetPresenceSettingsId" );
+
+    const CSPProperty* property = NULL;
+    TInt result = aEntry.GetProperty( property, ESubPropertyPresenceSettingsId );
+
+    if ( property && result == KErrNone )
+        {
+        TInt presenceSettingsId = 0;
+        result = property->GetValue( presenceSettingsId );
+
+        if ( result == KErrNone )
+            {
+            return presenceSettingsId;
+            }
+        }
+
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::UpdateVoIPSettingsL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::UpdateVoIPSettingsL( CScpService& aService ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::UpdateVoIPSettingsL" );
+
+    CSPEntry* entry = CSPEntry::NewLC();
+    
+    if ( iSpSettings->FindEntryL( aService.ServiceId(), *entry ) == KErrNone )
+        {
+        if ( AreVoipSettingsValid( *entry ) )
+            {
+            RPointerArray<CRCSEProfileEntry> entries;
+            // Push entries to cleanup stack
+            CleanupStack::PushL( TCleanupItem( TScpUtility::ResetAndDestroyEntries, 
+                                               &entries ) );
+                                  
+            iRcseProfileRegistry->FindByServiceIdL( aService.ServiceId(), entries );
+            
+            TInt idsCount = entries.Count();
+
+            if ( idsCount > 0 )
+                {
+                CRCSEProfileEntry* profileEntry = entries[ 0 ];
+                
+                if ( profileEntry && profileEntry->iIds.Count() )
+                    {
+                    TSettingIds& settingId = profileEntry->iIds[ 0 ];
+                    
+                    __ASSERT_DEBUG( settingId.iProfileId > 0, 
+                                    User::Panic( KNullDesC, KErrGeneral ) );            
+
+                    if ( iProfileHandler.ProfileExists( settingId.iProfileId ) )
+                        {
+                        CScpSubService& voipService = aService.AddSubServiceL( ECCHVoIPSub );
+            
+                        voipService.SetSipProfileId( settingId.iProfileId );
+                        }
+                    else
+                        {
+                        User::Leave( KErrNotFound );
+                        }
+                    }
+                }
+            
+            CleanupStack::PopAndDestroy( &entries );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( entry );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::AreVoipSettingsValid
+// -----------------------------------------------------------------------------
+//
+TBool CScpSettingHandler::AreVoipSettingsValid( const CSPEntry& aEntry ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::AreVoipSettingsValid" );
+
+    const CSPProperty* property = NULL;
+
+    // Make sure that the this is the correct plugin
+    TInt result = aEntry.GetProperty( property, EPropertyVoIPSubServicePluginId );
+    
+    if ( result == KErrNone && property )
+        {
+        TInt pluginId = 0;
+        property->GetValue( pluginId );
+
+        SCPLOGSTRING3( "VoIP sub service plugin UID: 0x%x this 0x%x", pluginId, KSIPConnectivityPluginImplUid );
+
+        if ( pluginId == KSIPConnectivityPluginImplUid )
+            {
+            return ETrue;
+            }
+        }
+
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::UpdateVmbxSettingsL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::UpdateVmbxSettingsL( CScpService& aService ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::UpdateVmbxSettingsL" );
+
+    CSPEntry* entry = CSPEntry::NewLC();
+    
+    if ( iSpSettings->FindEntryL( aService.ServiceId(), *entry ) == KErrNone )
+        {   
+        if( AreVmbxSettingsValid( *entry ) )
+            {
+            const CSPProperty* property = NULL;
+
+            // Get sip profile id for the vmbx service
+            TInt result = entry->GetProperty( property, ESubPropertyVMBXSettingsId );
+
+            if ( result == KErrNone && property )
+                {
+                TInt sipProfileId( 0 );
+                property->GetValue( sipProfileId );
+            
+                __ASSERT_DEBUG( sipProfileId > 0, User::Panic( KNullDesC, KErrGeneral ) );
+                
+                if ( iProfileHandler.ProfileExists( sipProfileId ) )
+                    {
+                    CScpSubService& vmbxService = aService.AddSubServiceL( ECCHVMBxSub );
+                
+                    vmbxService.SetSipProfileId( sipProfileId );
+                    }
+                else
+                    {
+                    User::Leave( KErrNotFound );
+                    }
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy( entry );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::AreVmbxSettingsValid
+// -----------------------------------------------------------------------------
+//
+TBool CScpSettingHandler::AreVmbxSettingsValid( const CSPEntry& aEntry ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::AreVmbxSettingsValid" );
+
+    const CSPProperty* property = NULL;
+
+    // Make sure that the this is the correct plugin
+    TInt result = aEntry.GetProperty( property, EPropertyVMBXSubServicePluginId );
+    
+    if ( result == KErrNone && property )
+        {
+        TInt pluginId = 0;
+        property->GetValue( pluginId );
+
+        SCPLOGSTRING2( "VMBx sub service plugin UID: 0x%x", pluginId );
+
+        if ( pluginId == KSIPConnectivityPluginImplUid )
+            {
+            // Make sure that the MWI address is found
+            result = aEntry.GetProperty( property, ESubPropertyVMBXMWIAddress );
+            
+            if ( result == KErrNone && property )
+                {
+                return ETrue;
+                }
+            }
+        }
+
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::ServiceExistsL
+// -----------------------------------------------------------------------------
+//
+TBool CScpSettingHandler::ServiceExistsL( TUint32 aServiceId ) const
+    {
+    SCPLOGSTRING2( "CScpSettingHandler::ServiceExistsL id: %d", aServiceId );
+
+    TBool serviceExists( EFalse );
+
+    RIdArray serviceIds;
+    iSpSettings->FindServiceIdsL( serviceIds );
+
+    for ( TInt i=0; i<serviceIds.Count(); i++ )
+        {
+        if ( aServiceId == serviceIds[ i ] )
+            {
+            serviceExists = ETrue;
+            break;
+            }
+        }
+    
+    serviceIds.Close();
+    return serviceExists;
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::GetServiceId
+// -----------------------------------------------------------------------------
+//
+TInt CScpSettingHandler::GetServiceIds( TUint32 aSipId, 
+                                        RArray< TUint32 >& aServiceIds ) const
+    {
+    SCPLOGSTRING2( "CScpSettingHandler::GetServiceIds sip id: %d", aSipId );
+
+    TRAPD( result, GetServiceIdsL( aSipId, aServiceIds ) );
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::GetServiceIdsL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::GetServiceIdsL( TUint32 aSipId, 
+                                         RArray< TUint32 >& aServiceIds ) const
+    {
+    SCPLOGSTRING2( "CScpSettingHandler::GetServiceIdsL sip id: %d", aSipId );
+    
+    CleanupClosePushL( aServiceIds );
+
+    RArray<TUint32> profileIdArray;
+    CleanupClosePushL( profileIdArray );    
+
+    iRcseProfileRegistry->GetAllIdsL( profileIdArray );
+
+    TBool found( EFalse );
+    
+    //VoIP profile count
+    for ( TInt i=0; i < profileIdArray.Count() && !found; i++ )
+        {
+        // profileEntry is reseted by rcse before the search
+        iRcseProfileRegistry->FindL( profileIdArray[i], 
+                                     *iRcseProfileEntry );
+
+        for ( TInt j=0; j < iRcseProfileEntry->iIds.Count(); j++ )
+            {
+            if ( aSipId == iRcseProfileEntry->iIds[j].iProfileId )
+                {
+                aServiceIds.Append( profileIdArray[i] );
+                }
+            }
+        }
+
+    if ( !aServiceIds.Count() )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    CleanupStack::PopAndDestroy( &profileIdArray );
+    CleanupStack::Pop( &aServiceIds );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::IsVoIPSupported
+// -----------------------------------------------------------------------------
+//
+TBool CScpSettingHandler::IsVoIPSupported() const
+    {
+    return iSpsVoIPUtils->IsVoIPSupported();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::IsUahTerminalTypeDefinedL
+// -----------------------------------------------------------------------------
+//
+TBool CScpSettingHandler::IsUahTerminalTypeDefinedL(
+    TUint32 aServiceId ) const
+    {
+    TBool defined( EFalse );
+    RPointerArray<CRCSEProfileEntry> entries;
+
+    // Push entries to cleanup stack
+    CleanupStack::PushL( TCleanupItem( TScpUtility::ResetAndDestroyEntries, 
+                                       &entries ) );
+
+    iRcseProfileRegistry->FindByServiceIdL( aServiceId, entries );
+    
+    if ( entries.Count() )
+        {            
+        // SIP VoIP User Agent header: terminal type display
+        defined = entries[0]->iSIPVoIPUAHTerminalType;
+        }
+    
+    CleanupStack::PopAndDestroy( &entries );
+    return defined;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::IsUahWLANMacDefinedL
+// -----------------------------------------------------------------------------
+//
+TBool CScpSettingHandler::IsUahWLANMacDefinedL(
+    TUint32 aServiceId ) const
+    {
+    TBool defined( EFalse );
+    RPointerArray<CRCSEProfileEntry> entries;
+
+    // Push entries to cleanup stack
+    CleanupStack::PushL( TCleanupItem( TScpUtility::ResetAndDestroyEntries, 
+                                       &entries ) );
+
+    iRcseProfileRegistry->FindByServiceIdL( aServiceId, entries );
+    
+    if ( entries.Count() )
+        {            
+        // SIP VoIP User Agent header WLAN MAC address display
+        defined = entries[0]->iSIPVoIPUAHeaderWLANMAC;
+        }
+    
+    CleanupStack::PopAndDestroy( &entries );
+    return defined;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::UahStringLengthL
+// -----------------------------------------------------------------------------
+//
+TInt CScpSettingHandler::UahStringLengthL(
+    TUint32 aServiceId ) const
+    {
+    TBool length( KErrNone );
+    RPointerArray<CRCSEProfileEntry> entries;
+
+    // Push entries to cleanup stack
+    CleanupStack::PushL( TCleanupItem( TScpUtility::ResetAndDestroyEntries, 
+                                       &entries ) );
+
+    iRcseProfileRegistry->FindByServiceIdL( aServiceId, entries );
+    
+    if ( entries.Count() )
+        {            
+        // SIP VoIP User Agent header string
+        length = entries[0]->iSIPVoIPUAHeaderString.Length();
+        }
+    
+    CleanupStack::PopAndDestroy( &entries );
+    return length;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::UpdateImSettingsL
+// -----------------------------------------------------------------------------
+//
+void CScpSettingHandler::UpdateImSettingsL( CScpService& aService ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::UpdateImSettingsL" );
+
+    CSPEntry* entry = CSPEntry::NewLC();
+    
+    if ( KErrNone == iSpSettings->FindEntryL( aService.ServiceId(), *entry ) )
+        {
+        if ( AreImSettingsValid( *entry ) )
+            {
+            RPointerArray<CRCSEProfileEntry> entries;
+            // Push entries to cleanup stack
+            CleanupStack::PushL( TCleanupItem(
+                TScpUtility::ResetAndDestroyEntries, &entries ) );
+            
+            iRcseProfileRegistry->FindByServiceIdL( aService.ServiceId(),
+                entries );
+            TInt idsCount = entries.Count();
+    
+            if ( idsCount > 0 )
+                {
+                CRCSEProfileEntry* profileEntry = entries[ 0 ];
+                
+                if ( profileEntry && profileEntry->iIds.Count() )
+                    {
+                    TSettingIds& settingId = profileEntry->iIds[ 0 ];
+                    
+                    __ASSERT_DEBUG( settingId.iProfileId > 0,
+                        User::Panic( KNullDesC, KErrGeneral ) );
+    
+                    if ( iProfileHandler.ProfileExists( settingId.iProfileId ) )
+                        {
+                        CScpSubService& imSubService = aService.AddSubServiceL(
+                            ECCHIMSub );
+                        imSubService.SetSipProfileId( settingId.iProfileId );
+                        }
+                    else
+                        {
+                        User::Leave( KErrNotFound );
+                        }
+                    }
+                }
+            
+            CleanupStack::PopAndDestroy( &entries );
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( entry );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSettingHandler::AreImSettingsValid
+// -----------------------------------------------------------------------------
+//
+TBool CScpSettingHandler::AreImSettingsValid( const CSPEntry& aEntry ) const
+    {
+    SCPLOGSTRING( "CScpSettingHandler::AreImSettingsValid" );
+    
+    const CSPProperty* property( NULL );
+    TBool imFeatureEnabled = ( KErrNone == aEntry.GetProperty( 
+        property, ESubPropertyIMLaunchUid ) ) && property;
+    if ( !imFeatureEnabled )
+        {
+        return EFalse;
+        }
+    
+    // Make sure that this is the correct plugin
+    TInt result = aEntry.GetProperty( property,
+        EPropertyIMSubServicePluginId );
+    
+    if ( KErrNone == result && property )
+        {
+        TInt pluginId = 0;
+        property->GetValue( pluginId );
+        
+        SCPLOGSTRING3( "IM Subservice plugin UID: 0x%x this 0x%x",
+            pluginId, KSIPConnectivityPluginImplUid );
+        
+        if ( KSIPConnectivityPluginImplUid == pluginId )
+            {
+            return ETrue;
+            }
+        }
+    
+    return EFalse;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpsipconnection.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1155 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 to SIP profiles.
+*
+*/
+
+#include <sipprofileregistry.h>
+#include <sipprofile.h>
+#include <sipmanagedprofile.h>
+#include <sipmanagedprofileregistry.h>
+#include <sipconnection.h>
+#include <commdb.h>
+#include <ccherror.h>
+
+#include "scpsipconnection.h"
+#include "scplogger.h"
+#include "scpsipconnectionobserver.h"
+#include "scputility.h"
+#include "voipeventlog.h"
+
+// If EnableL fails a timeout for reporting error
+const TInt KEnableTimeout = 120000000;
+
+const TInt KUsernameMaxLength = 255;
+
+_LIT8( KSCPAt8, "@" );
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::CScpSipConnection
+// -----------------------------------------------------------------------------
+//
+CScpSipConnection::CScpSipConnection( 
+    TInt aProfileId, 
+    CSIPProfileRegistry& aProfileRegistry,
+    CSIPManagedProfileRegistry& aManagedProfileRegistry,
+    CSIP& aSip ) :
+    iProfileId( aProfileId ),
+    iProfileRegistry( aProfileRegistry ),
+    iManagedProfileRegistry( aManagedProfileRegistry ),
+    iSip( aSip ),
+    iRegistrationRequestState( ENoRequest ),
+    iConnectionStateError( KErrNone ),
+    iReserved( EFalse ),
+    iIapAvailableOffered( EFalse )
+    {
+    SCPLOGSTRING3( "CScpSipConnection[0x%x]::CScpSipConnection profile id: %d", 
+                   this, aProfileId );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::ConstructL()
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::ConstructL", this );
+
+    iSipProfile = iProfileRegistry.ProfileL( iProfileId );
+
+    if ( !iSipProfile )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    iEnableTimeoutTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard );
+    
+    User::LeaveIfError( iConnectionMonitor.ConnectL() );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::NewL
+// -----------------------------------------------------------------------------
+//
+CScpSipConnection* CScpSipConnection::NewL( 
+    TInt aProfileId, 
+    CSIPProfileRegistry& aProfileRegistry,
+    CSIPManagedProfileRegistry& aManagedProfileRegistry,
+    CSIP& aSip )
+    {
+    SCPLOGSTRING( "CScpSipConnection::NewL" );
+    __ASSERT_DEBUG( aProfileId > 0, User::Panic( KNullDesC, KErrGeneral ) );
+
+    CScpSipConnection* self = new (ELeave) CScpSipConnection( aProfileId,
+                                                              aProfileRegistry,
+                                                              aManagedProfileRegistry,
+                                                              aSip );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpSipConnection::~CScpSipConnection
+// -----------------------------------------------------------------------------
+//
+CScpSipConnection::~CScpSipConnection()
+    {  
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::~CScpSipConnection", this );
+
+    delete iSipConnection;
+    iConnectionMonitor.Close();
+    delete iEnableTimeoutTimer;
+    delete iSipProfile;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::AddObserver
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::AddObserver( MScpSipConnectionObserver& aObserver )
+    {
+    SCPLOGSTRING3( "CScpSipConnection[0x%x]::AddObserverL: 0x%x",this, &aObserver );
+
+    iObserver = &aObserver;
+    } 
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::RemoveObserver
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::RemoveObserver( MScpSipConnectionObserver& aObserver )
+    {
+    SCPLOGSTRING3( "CScpSipConnection[0x%x]::RemoveObserver: 0x%x", this, &aObserver );
+
+    if ( &aObserver == iObserver )
+        {
+        iObserver = NULL;
+        return KErrNone;
+        }
+
+    return KErrNotFound;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::ProfileId
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::ProfileId() const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::ProfileId", this );
+
+    return iProfileId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::EnableL
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::EnableL()
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::EnableL", this );
+
+    if ( iRegistrationRequestState != ERegistrationRequested )
+        {
+        iConnectionStateError = KErrNone;
+        iRegistrationRequestState = ERegistrationRequested;
+
+        TUint32 iapId( 0 );
+        TUint32 snapId( 0 );
+
+        TInt result = GetSnap( snapId );
+
+        if ( result == KErrNotFound || snapId == 0 )
+            {
+            SCPLOGSTRING2( "CScpSipConnection[0x%x]::EnableL - SNAP not found", this );
+            result = GetIap( iapId );
+            }
+   
+        // If username is not set leave directly with KCCHErrorAuthenticationFailed
+        if ( !IsUsernameSetL() )
+            {
+            SCPLOGSTRING2( "CScpSipConnection[0x%x]::EnableL - AuthenticationFailed !!!", this );
+            User::Leave( KCCHErrorAuthenticationFailed );
+            }
+        
+        iProfileRegistry.EnableL( *iSipProfile, *this );
+          
+        if ( !iSipConnection && 0 != iapId )
+             {
+             iSipConnection = CSIPConnection::NewL( iSip, iapId, *this );
+             }
+        
+        TBool connectionAvailable = IsNetworkConnectionAvailable();
+        
+        if ( connectionAvailable )
+            {
+            TBool registered( EFalse );
+            User::LeaveIfError( iSipProfile->GetParameter( KSIPProfileRegistered, 
+                                                           registered ) );
+
+            if ( !registered )
+                {
+                StartEnableTimeoutTimer( CScpSipConnection::EnableTimeout );
+                }
+            }        
+        else
+            {
+            iConnectionStateError = KCCHErrorNetworkLost;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::Disable
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::Disable()
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::Disable", this );
+
+    iRegistrationRequestState = EDeregistrationRequested;
+    
+    CancelEnableTimeoutTimer();
+    
+    delete iSipConnection;
+    iSipConnection = NULL;
+    
+    TInt err = iProfileRegistry.Disable( *iSipProfile );
+    TRAPD( err1, DisableAlwaysOnModeL() );
+       
+    if ( err == KErrNone )
+        {
+        err = err1;
+        }
+
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::ForceDisable
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::ForceDisable()
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::ForceDisable", this );
+
+    iRegistrationRequestState = EDeregistrationRequested;   
+    CancelEnableTimeoutTimer();
+    
+    delete iSipConnection;
+    iSipConnection = NULL;
+    
+    TInt err = iProfileRegistry.ForceDisable( *iSipProfile );
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::DisableAlwaysOnModeL()
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::DisableAlwaysOnModeL()
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::DisableAlwaysOnModeL", this );
+
+    TBool autoRegistration( EFalse );
+    User::LeaveIfError( iSipProfile->GetParameter( KSIPAutoRegistration, 
+                                                   autoRegistration ) );
+
+    if ( autoRegistration )
+        {
+        CSIPManagedProfile* profile = static_cast<CSIPManagedProfile*> ( iSipProfile );
+        User::LeaveIfError( profile->SetParameter( KSIPAutoRegistration, EFalse ) );
+        iManagedProfileRegistry.SaveL( *profile );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::RegistrationRequestState
+// -----------------------------------------------------------------------------
+//
+CScpSipConnection::TRegistrationRequestState 
+    CScpSipConnection::RegistrationRequestState() const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::RegistrationRequestState", this );
+
+    return iRegistrationRequestState;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::GetState
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::GetState( CScpSipConnection::TConnectionState& aState,
+                                  TInt& aError ) const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::GetState", this );
+
+    aError = iConnectionStateError;
+
+    TBool registered( EFalse );
+    TInt result = iSipProfile->GetParameter( KSIPProfileRegistered, registered );
+    
+    if ( result == KErrNone )
+        {
+        switch ( iRegistrationRequestState )
+            {
+            case ENoRequest:
+                if( registered )
+                    {
+                    aState = ERegistered;
+                    }
+                else
+                    {
+                    aState = EDeregistered;
+                    }
+                break;
+
+            case ERegistrationRequested:
+                if ( registered )
+                    {
+                    aState = ERegistered;
+                    }
+                else
+                    {
+                    aState = ERegistering;
+                    }
+                break;
+
+            case EDeregistrationRequested:
+                if ( registered )
+                    {
+                    aState = EDeregistering;
+                    }
+                else
+                    {
+                    aState = EDeregistered;
+                    }
+                break;
+
+            default:
+                __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) );
+                break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::ProfileRegistryEventOccurred
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::ProfileRegistryEventOccurred( 
+    MSIPProfileRegistryObserver::TEvent aEvent )
+    {
+    SCPLOGSTRING3( "CScpSipConnection[0x%x]::ProfileRegistryEventOccurred event: %d", 
+                   this, aEvent );
+    
+    TScpConnectionEvent event( EScpUnknown );
+    
+    switch ( aEvent )
+        {
+        case MSIPProfileRegistryObserver::EProfileRegistered:
+            {
+            CancelEnableTimeoutTimer();
+            
+            delete iSipConnection;
+            iSipConnection = NULL;
+            
+            iConnectionStateError = KErrNone;
+            event = EScpRegistered;
+            }
+            break;
+
+        case MSIPProfileRegistryObserver::EProfileDeregistered:
+            {
+            CancelEnableTimeoutTimer();
+                
+            if ( iRegistrationRequestState == EDeregistrationRequested )
+                {
+                iConnectionStateError = KErrNone;
+                event = EScpDeregistered;            
+                }
+            else
+                {
+
+                // SIP will still notify the client with 
+                // MSIPProfileRegistryObserver::ProfileRegistryEventOccurred( EProfileDeregistered ) 
+                // but the reason for this event can be checked by the client
+                // by calling CSIPProfileRegistryBase::LastRegistrationError.
+                // If this function returns KErrDisconnected,
+                // the client can determine that the reason for the event was that the network connection was dropped.
+
+                TInt lastRegistrationError =
+                    iProfileRegistry.LastRegistrationError( *iSipProfile );
+                
+                SCPLOGSTRING2( "    -> last registration error: %d", lastRegistrationError );
+                
+                if (  KErrDisconnected != lastRegistrationError )
+                    {
+                    if ( iProfileCurrentlyRoaming )
+                        {
+                        iProfileCurrentlyRoaming = EFalse;
+                        iConnectionStateError = KCCHErrorNetworkLost;
+                        event = EScpNetworkLost;
+                        }
+                    else
+                        {
+                        iConnectionStateError = KErrNone;
+                        event = EScpDeregistered;
+                        } 
+                    }
+                else
+                    {
+                    iConnectionStateError = KCCHErrorNetworkLost;
+                    event = EScpNetworkLost;
+                    }
+                }
+            }
+            break;
+
+        case MSIPProfileRegistryObserver::EProfileUpdated:
+            {
+            // Should we start EnableTimeoutTimer if registration
+            // was requested?
+            
+            if ( iProfileCurrentlyRoaming )
+                {
+                iProfileCurrentlyRoaming = EFalse;
+                iConnectionStateError = KErrNone;
+                event = EScpRegistered;
+                }
+            }
+            break;
+            
+        default:
+            break;
+        }
+
+    if ( event != EScpUnknown && iObserver )
+        {
+        SCPLOGSTRING3( "id: %d HandleSipConnectionEvent event: %d", 
+                       iProfileId, event );
+
+        iObserver->HandleSipConnectionEvent( iProfileId, event );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::ProfileRegistryErrorOccurred
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::ProfileRegistryErrorOccurred( TInt aError )
+    {
+    SCPLOGSTRING3( "CScpSipConnection[0x%x]::ProfileRegistryErrorOccurred error: %d", 
+                   this, aError );
+    
+    CancelEnableTimeoutTimer();
+
+    iConnectionStateError = TScpUtility::ConvertToCchError( aError );
+    TScpConnectionEvent event = EScpUnknown;
+    if ( iConnectionStateError == KCCHErrorAuthenticationFailed )
+        {
+        event = EScpAuthenticationFailed;
+        }
+    else if ( iConnectionStateError == KCCHErrorInvalidSettings )
+        {
+        event = EScpInvalidSettings;
+        }
+    else
+        {
+        if ( KErrCancel == aError )
+            {
+            iConnectionStateError = KErrCancel;
+            event = EScpRegistrationCanceled;
+            iRegistrationRequestState = EDeregistrationRequested;
+            }
+        else
+            {
+            iConnectionStateError = KCCHErrorLoginFailed;
+            event = EScpRegistrationFailed;
+            }
+        }    
+    
+    TInt error = KErrNone;
+    CVoipEventLog* eventLog = NULL;
+    
+    TRAP( error, eventLog = CVoipEventLog::NewL() );
+    
+    if ( KErrNone == error )
+        {
+        eventLog->WriteError( aError );
+        }
+    
+    delete eventLog;
+    
+    iObserver->HandleSipConnectionEvent( iProfileId, event );    
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::StartEnableTimeoutTimer
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::StartEnableTimeoutTimer( TInt (*aFunction)(TAny* aPtr) )
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::StartEnableTimeoutTimer", this );
+    __ASSERT_DEBUG( !iEnableTimeoutTimer->IsActive(), 
+                    User::Panic( KNullDesC, KErrGeneral ) );
+
+    if ( !iEnableTimeoutTimer->IsActive() )
+        {
+        iEnableTimeoutTimer->Start( KEnableTimeout, 
+                              0, 
+                              TCallBack( aFunction, this ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::CancelEnableTimeoutTimer
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::CancelEnableTimeoutTimer()
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::CancelEnableTimeoutTimer", this );
+
+    if ( iEnableTimeoutTimer->IsActive() )
+        {
+        iEnableTimeoutTimer->Cancel();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::EnableTimeout
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::EnableTimeout( TAny* aSelf )
+    {
+    SCPLOGSTRING( "CScpSipConnection::EnableTimeout" );
+
+    CScpSipConnection* self = static_cast<CScpSipConnection*>( aSelf );
+    
+    self->HandleEnableTimeout();
+
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::HandleEnableTimeout
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::HandleEnableTimeout()
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::HandleEnableTimeout",
+                   this );
+    ProfileRegistryErrorOccurred( EScpRegistrationFailed );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::GetIap
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::GetIap( TUint32& aIapId ) const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::GetIap", this );
+    
+    return iSipProfile->GetParameter( KSIPAccessPointId, aIapId ); 
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::GetSnap
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::GetSnap( TUint32& aSnapId ) const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::GetSnap", this );
+
+    return iSipProfile->GetParameter( KSIPSnapId, aSnapId );          
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::GetUsername
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::GetUsername( TDes8& aUsername ) const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::GetUsername", this );
+
+    TInt result( KErrNotFound );
+    
+    // Check if profile is registered
+    TBool val( EFalse );
+    result = iSipProfile->GetParameter( KSIPProfileRegistered, val );
+    
+    const TDesC8* aor( NULL );
+
+    // Get SIP's Username    
+    result = iSipProfile->GetParameter( KSIPUserAor, aor );
+    
+    if ( result == KErrNone && aor->Length() > KErrNone  )
+        {
+        if ( aor->Length() <= aUsername.MaxLength() )
+            {
+            SCPLOGSTRING( "CScpSipConnection::GetUsername - Got username from AOR" );
+            aUsername.Copy( *aor );
+            }
+        else
+            {
+            SCPLOGSTRING( "CScpSipConnection::GetUsername - KErrOverflow" );
+            result = KErrOverflow;
+            }
+        }
+    else if ( val ) // registered
+        {
+        // Might be IMS case and UserAor is incomplete, then
+        // Get SIP's Username from registered AORs
+        const MDesC8Array* aors = 0;
+        result =  iSipProfile->GetParameter( KSIPRegisteredAors, aors );
+        if ( !aors || aors->MdcaCount() == 0 )
+            {
+            SCPLOGSTRING( "CScpSipConnection::GetUsername - KErrNotReady" );
+            result = KErrNotReady;
+            }
+        else
+            {            
+            TBuf8<KUsernameMaxLength> tmpUserName;
+            tmpUserName.Copy( aors->MdcaPoint( 0 ) );
+            
+            #ifdef _DEBUG
+                TBuf<KUsernameMaxLength> tmpUri;
+                tmpUri.Copy( aors->MdcaPoint( 0 ) );
+                SCPLOGSTRING2( "CScpSipConnection::GetUsername - use first registered AOR: %S", &tmpUri );
+            #endif
+                
+            TInt atPos = tmpUserName.Find( KSCPAt8 );
+            aUsername.Copy( tmpUserName.Left( atPos ) );
+            }
+        }
+    SCPLOGSTRING2( "CScpSipConnection::GetUsername - return error: %d", result );
+    return result;                
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::GetDomain
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::GetDomain( TDes8& aDomain ) const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::GetDomain", this );
+
+    TInt result( KErrNotFound );
+    const TDesC8* domain( NULL );
+
+    // Get SIP's Username    
+    result = iSipProfile->GetParameter( KSIPRegistrar, KSIPServerAddress, domain );
+    
+    if ( result == KErrNone && domain )
+        {
+        if ( domain->Length() <= aDomain.MaxLength() )
+            {
+            aDomain.Copy( *domain );
+            }
+        else
+            {
+            result = KErrOverflow;
+            }
+        }
+
+    return result;                
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::GetContactHeaderUser
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::GetContactHeaderUser( RBuf8& aContactHeaderUser ) const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::GetContactHeader", this );
+
+    TInt result( KErrNotFound );
+    const TDesC8* contactHeaderUser( NULL );
+
+    // Get SIP's Username    
+    result = iSipProfile->GetParameter( KSIPContactHeaderUser, contactHeaderUser );
+    
+    if ( result == KErrNone && contactHeaderUser )
+        {
+        result = aContactHeaderUser.ReAlloc( contactHeaderUser->Length() );
+        if ( KErrNone == result )
+            {
+            aContactHeaderUser.Copy( *contactHeaderUser );
+            }
+        }
+
+    return result;                
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::SipProfile
+// -----------------------------------------------------------------------------
+//
+CSIPProfile& CScpSipConnection::SipProfile() const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::SipProfile", this );
+    
+    return *iSipProfile;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::SetIap
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::SetIap( TUint32 aProfileIapId )
+    {
+    SCPLOGSTRING3( "CScpSipConnection[0x%x]::SetIap iap: %d",
+                   this, aProfileIapId );
+
+    TInt result( KErrNone );
+
+    // If snap exists, iap doesn't have an effect
+    TUint32 snapId( 0 );
+    result = GetSnap( snapId );
+
+    if ( result == KErrNotFound ||
+        snapId == 0 )
+        {
+        // Managed profile so we can change it
+        CSIPManagedProfile* profile = static_cast<CSIPManagedProfile*> ( iSipProfile );
+        
+        // Add new IAP Id to SIP Profile
+        result = profile->SetParameter( KSIPAccessPointId, aProfileIapId );
+        if ( KErrNone == result )
+            {
+            // Save changes
+            TRAP( result, iManagedProfileRegistry.SaveL( *profile ) );
+            }
+        }
+    else
+        {
+        result = KErrNotSupported;
+        }
+
+    return result; 
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::SetIap
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::SetSnap( TUint32 aProfileSnapId )
+    {
+    SCPLOGSTRING3( "CScpSipConnection[0x%x]::SetSnap snap: %d", 
+                   this, aProfileSnapId );
+        
+    // Managed profile so we can change it
+    CSIPManagedProfile* profile = static_cast<CSIPManagedProfile*> ( iSipProfile );
+    
+    // Add new SNAP Id to SIP Profile
+    TInt result = profile->SetParameter( KSIPSnapId, 
+                                         aProfileSnapId );
+
+    if ( KErrNone == result )
+        {
+        // Save changes
+        TRAP( result, iManagedProfileRegistry.SaveL( *profile ) );
+        }
+
+    return result; 
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::GetIapTypeL
+// -----------------------------------------------------------------------------
+//
+TScpIapType CScpSipConnection::GetIapTypeL() const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::GetIapTypeL", this );
+    
+    TScpIapType type = EScpUnknownType;
+
+    CCommsDatabase* commsDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
+    CleanupStack::PushL( commsDb );
+
+    CCommsDbTableView* iapTable = commsDb->OpenTableLC( TPtrC( IAP ) );
+
+    if ( iapTable->GotoFirstRecord() == KErrNone )
+        { 
+        TUint32 profilesIap = 0;
+        User::LeaveIfError( GetIap( profilesIap ) );
+
+        do 
+            {
+            TUint32 uid = 0;
+            iapTable->ReadUintL( TPtrC( COMMDB_ID ), uid );
+
+            if ( uid == profilesIap )
+                {
+                // The length should be defined somewhere
+                TBuf<256> serviceType;
+                iapTable->ReadTextL( TPtrC( IAP_SERVICE_TYPE ), serviceType );
+
+                if ( serviceType == TPtrC( INCOMING_GPRS ) ||
+                    serviceType == TPtrC( OUTGOING_GPRS ) ||
+                    serviceType == TPtrC( INCOMING_WCDMA) ||
+                    serviceType == TPtrC( OUTGOING_WCDMA) )
+                    {
+                    type = EScpGprs;
+                    }
+                else if ( serviceType == TPtrC( LAN_SERVICE ) )
+                    {
+                    type = EScpWlan;
+                    }
+                else
+                    {
+                    type = EScpUnknownType;
+                    }
+
+                break;
+                }
+
+            }
+        while( iapTable->GotoNextRecord() == KErrNone );
+    }
+
+    CleanupStack::PopAndDestroy( iapTable );
+    CleanupStack::PopAndDestroy( commsDb );    
+
+    SCPLOGSTRING2( "GetIapTypeL result: %d", type );
+
+    return type;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::SetReserved
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::SetReserved( TBool aReserved )
+    {
+    SCPLOGSTRING3( "CScpSipConnection[0x%x]::SetReserved: %d", this, aReserved );
+    
+    iReserved = aReserved;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::Reserved
+// -----------------------------------------------------------------------------
+//
+TBool CScpSipConnection::Reserved() const
+    {
+    SCPLOGSTRING3( "CScpSipConnection[0x%x]::Reserved: %d", this, iReserved );
+
+    return iReserved;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::SetIapAvailableOffered
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::SetIapAvailableOffered( TBool aIapAvailableOffered )   
+    {
+    SCPLOGSTRING3( "CScpSipConnection[0x%x]::SetIapAvailableOffered: %d", 
+    this, aIapAvailableOffered );
+    
+    iIapAvailableOffered = aIapAvailableOffered;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::IapAvailableOffered
+// -----------------------------------------------------------------------------
+//
+TBool CScpSipConnection::IapAvailableOffered() const
+    {
+    SCPLOGSTRING3( "CScpSipConnection[0x%x]::IapAvaiableOffered: %d", 
+    this, iIapAvailableOffered );
+    
+    return iIapAvailableOffered;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::IapAvailableOffered
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::SetProfileCurrentlyRoaming()
+    {
+    SCPLOGSTRING( "CScpSipConnection[0x%x]::SetProfileCurrentlyRoaming" );
+    
+    iProfileCurrentlyRoaming = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::IsPasswordSet
+// -----------------------------------------------------------------------------
+//
+TBool CScpSipConnection::IsPasswordSet() const
+    {
+    SCPLOGSTRING( "CScpSipConnection::IsPasswordSet" );
+
+    // no support exist in sip for getting is password set information */
+    SCPLOGSTRING( "CScpSipConnection::IsPasswordSet: pwd is set is always returned" );
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::IsUsernameSetL
+// -----------------------------------------------------------------------------
+//
+TBool CScpSipConnection::IsUsernameSetL() const
+    {
+    SCPLOGSTRING( "CScpSipConnection::IsUsernameSetL" );
+ 
+    TBool userNameSet( EFalse );
+    
+    // check from aor
+    RBuf8 username;
+    CleanupClosePushL( username );
+    username.CreateL( KUsernameMaxLength );
+    
+    TInt err = GetUsername( username );
+
+    if ( !err && username.Length() )
+        {
+        RBuf8 formattedUsername;
+        TScpUtility::RemovePrefixAndDomain( username, formattedUsername );
+        
+        if ( formattedUsername.Length() )
+            {
+            userNameSet = ETrue;
+            }   
+        
+        formattedUsername.Zero();
+        formattedUsername.Close();
+        }
+    else if ( KErrNone == err && SipProfileIMS() )
+        {
+        SCPLOGSTRING( "CScpSipConnection::IsUsernameSetL - SipProfileIMS" );
+        // Check if this is IMS case; then we can think username is set
+        // (SIP stack takes care of SIM handling)
+        userNameSet = ETrue;
+        }
+    
+    else
+        {
+        SCPLOGSTRING( "CScpSipConnection::IsUsernameSetL - ELSE!" );
+        }
+        
+    CleanupStack::PopAndDestroy( &username );
+    
+    return userNameSet;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::SipProfileIMS
+// -----------------------------------------------------------------------------
+//
+TBool CScpSipConnection::SipProfileIMS() const
+    {
+    SCPLOGSTRING( "CScpSipConnection::SipProfileIMS" );
+    if( TSIPProfileTypeInfo::EIms == iSipProfile->Type().iSIPProfileClass )
+        {
+        SCPLOGSTRING( "CScpSipConnection::SipProfileIMS - ETrue" );
+        return ETrue;
+        }
+    else
+        {
+        SCPLOGSTRING( "CScpSipConnection::SipProfileIMS - EFalse" );
+        return EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::HandleMigrationStarted
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::HandleMigrationStarted()
+    {
+    if( iObserver )
+        {
+        SCPLOGSTRING2( "    -> roaming - id: %d", iProfileId );
+
+        iObserver->HandleSipConnectionEvent( iProfileId, EScpRoaming );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::HandleMigrationError
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::HandleMigrationError(
+    TInt /*aError*/,
+    TUint32 /*aProfileId*/,
+    TUint32 /*aSnapId*/,
+    TUint32 /*aIapId*/ )
+    {
+    // Migration has failed -> check is sip still registered via old iap 
+    // and if is, set state back to registered
+    
+    TScpConnectionEvent event( EScpUnknown );
+    
+    if ( iProfileCurrentlyRoaming && iObserver )
+        {
+        iProfileCurrentlyRoaming = EFalse;
+        iConnectionStateError = KErrNone;
+        event = EScpRegistered;
+        SCPLOGSTRING3( "id: %d HandleSipConnectionEvent event: %d", 
+                       iProfileId, event );
+        iObserver->HandleSipConnectionEvent( iProfileId, event );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::IsNetworkConnectionAvailable
+// -----------------------------------------------------------------------------
+//
+TBool CScpSipConnection::IsNetworkConnectionAvailable() const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::IsNetworkConnectionAvailable", this );
+
+    TBool isAvailable = EFalse;
+
+    TUint32 snapId = 0;
+    TInt result = GetSnap( snapId );
+
+    if ( result == KErrNone ||
+        result == KErrNotFound )
+        {
+        if ( snapId != 0 )
+            {
+            isAvailable = IsSnapConnectionAvailable( snapId );
+            }   
+        else
+            {
+            TUint32 iapId = 0;
+            result = GetIap( iapId );
+
+            if( result == KErrNone )
+                {
+                isAvailable = IsIapConnectionAvailable( iapId );
+                }
+            }
+        }
+    
+    return isAvailable;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::IsSnapConnectionAvailable
+// -----------------------------------------------------------------------------
+//
+TBool CScpSipConnection::IsSnapConnectionAvailable( TInt aSnapId ) const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::IsSnapConnectionAvailable", this );
+
+    TBool isAvailable = EFalse;
+
+    TConnMonSNAPInfoBuf snapInfoBuf;
+    TRequestStatus status;
+    iConnectionMonitor.GetPckgAttribute( EBearerIdAll, 0, KSNAPsAvailability,
+                                         snapInfoBuf, status );
+
+    User::WaitForRequest( status );
+
+    for ( TInt i = 0; i < snapInfoBuf().Count(); i++ )
+        {
+        if ( aSnapId == snapInfoBuf().iSNAP[ i ].iSNAPId )
+            {
+            SCPLOGSTRING( "SNAP IS STILL ALIVE!!!" );
+            isAvailable = ETrue;
+            break;
+            } 
+        }
+
+    return isAvailable;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::IsIapConnectionAvailable
+// -----------------------------------------------------------------------------
+//
+TBool CScpSipConnection::IsIapConnectionAvailable( TInt aIapId ) const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::IsIapConnectionAvailable", this );
+
+    TBool isAvailable = EFalse;
+
+    TConnMonIapInfoBuf iapInfoBuf;
+    TRequestStatus status;
+    iConnectionMonitor.GetPckgAttribute( EBearerIdAll, 0, KIapAvailability,
+                                         iapInfoBuf, status );
+
+    User::WaitForRequest( status );
+
+    for ( TInt i = 0; i < iapInfoBuf().Count(); i++ )
+        {
+        if  ( aIapId == iapInfoBuf().iIap[ i ].iIapId )
+            {
+            SCPLOGSTRING( "IAP IS STILL ALIVE!!!" );
+            isAvailable = ETrue;
+            break;
+            } 
+        }
+
+    return isAvailable;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::BearerFiltteringSetting
+// -----------------------------------------------------------------------------
+//
+TInt CScpSipConnection::BearerFiltteringSetting(
+    TUint32& aBearerFilttering ) const
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::BearerFiltteringSetting - IN", this );
+    return iSipProfile->GetParameter( KBearerType, aBearerFilttering );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSipConnection::ConnectionStateChanged
+// -----------------------------------------------------------------------------
+//
+void CScpSipConnection::ConnectionStateChanged( CSIPConnection::TState aState )
+    {
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::ConnectionStateChanged - IN", this );
+    
+    switch ( aState )
+            {
+            case CSIPConnection::EInactive:
+                {
+                SCPLOGSTRING2( "CScpSipConnection[0x%x]::ConnectionStateChanged: EInactive", this );
+                
+                TUint32 iapId( 0 );
+                TInt result = GetIap( iapId );
+                    
+                if ( KErrNone == result && iSipConnection &&
+                        iapId == iSipConnection->IapId() &&
+                        KErrNone == iConnectionStateError )
+                    {
+                    delete iSipConnection;
+                    iSipConnection = NULL;
+                    
+                    iConnectionStateError = KCCHErrorLoginFailed;
+                    iObserver->HandleSipConnectionEvent( iProfileId, EScpRegistrationFailed );
+                    }
+                }
+                break;
+                
+            default:
+                {
+                SCPLOGSTRING2( "CScpSipConnection[0x%x]::ConnectionStateChanged: default", this );
+                }
+                break;
+            }
+    SCPLOGSTRING2( "CScpSipConnection[0x%x]::ConnectionStateChanged - OUT", this );
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpstatecontainer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,79 @@
+/*
+* 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:  
+*
+*/
+
+
+#include "scpstatecontainer.h"
+#include "scplogger.h"
+#include "scpdisabled.h"
+#include "scpconnectingservice.h"
+#include "scpenabled.h"
+#include "scpdisconnecting.h"
+
+// -----------------------------------------------------------------------------
+// TScpStateContainer::TScpStateContainer
+// -----------------------------------------------------------------------------
+//
+TScpStateContainer::TScpStateContainer()
+    {
+    SCPLOGSTRING( "TScpStateContainer::TScpStateContainer" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpStateContainer::InitializeL
+// -----------------------------------------------------------------------------
+//
+void TScpStateContainer::InitializeL()
+    {
+    SCPLOGSTRING( "TScpStateContainer::ConstructL" );
+
+    User::LeaveIfError( Dll::SetTls( static_cast<TAny*>( this ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpStateContainer::Instance
+// -----------------------------------------------------------------------------
+//
+TScpSubServiceState* TScpStateContainer::Instance( TCCHSubserviceState aState )
+    {
+    SCPLOGSTRING2( "TScpStateContainer::Instance state: %d", aState );
+
+    TScpStateContainer* container = static_cast<TScpStateContainer*>( Dll::Tls() );
+    __ASSERT_DEBUG( container, User::Panic( KNullDesC, KErrGeneral ) );
+    
+    switch( aState )
+        {
+        case ECCHDisabled:
+            return &container->iDisabled;
+
+        case ECCHConnecting:
+            return &container->iConnectingService;
+
+        case ECCHEnabled:
+            return &container->iEnabled;
+
+        case ECCHDisconnecting:
+            return &container->iDisconnecting;
+
+        default:
+            break;           
+        }
+    
+    __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) );
+    return NULL;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpsubservice.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,728 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "scpsubservice.h"
+#include "scpservice.h"
+#include "scplogger.h"
+#include "scputility.h"
+#include "scpservicehandlerbase.h"
+#include "scpprofilehandler.h"
+#include "scpservicestorage.h"
+#include "scpstatecontainer.h"
+#include "scpvoiphandler.h"
+#include "scpvmbxhandler.h"
+#include "scppresencehandler.h"
+#include "scpimhandler.h"
+#include "scpsubserviceobserver.h"
+#include "scppresencehandler.h"
+
+// -----------------------------------------------------------------------------
+// CScpSubService::NewL
+// -----------------------------------------------------------------------------
+//
+CScpSubService* CScpSubService::NewL( TInt aId, 
+                                      TInt aSubServiceId,
+                                      TCCHSubserviceType aSubServiceType,
+                                      CScpService& aService )
+    {
+    SCPLOGSTRING( "CScpSubService::CScpSubService" );
+
+    CScpSubService* self = new ( ELeave ) CScpSubService( aId, 
+                                                          aSubServiceId,
+                                                          aSubServiceType,
+                                                          aService );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::ConstructL()
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::ConstructL", this );
+
+    switch( iSubServiceType )
+        {
+        case ECCHVoIPSub:
+            iServiceHandler = CScpVoipHandler::NewL( *this );
+            SetPresenceToObserveVoIP();
+            break;
+ 
+        case ECCHVMBxSub:
+            iServiceHandler = CScpVmbxHandler::NewL( *this );  
+            break;
+
+        case ECCHIMSub:
+            iServiceHandler = CScpImHandler::NewL( *this );
+            break;
+
+        case ECCHPresenceSub:
+            iServiceHandler = CScpPresenceHandler::NewL( *this );
+            break;
+
+        default:
+            __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) );
+            User::Leave( KErrNotFound );
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::CScpSubService
+// -----------------------------------------------------------------------------
+//
+CScpSubService::CScpSubService( TInt aId, 
+                                TInt aSubServiceId,
+                                TCCHSubserviceType aSubServiceType,
+                                CScpService& aService ) :
+    iId( aId ),
+    iSubServiceId( aSubServiceId ),
+    iSubServiceType( aSubServiceType ),
+    iService( aService ),
+    iSipProfileId( 0 ),
+    iEnableRequestedState( EScpNoRequest ),
+    iSubServiceDisconnected( EFalse ),
+    iApId( 0 ),
+    iSnapId( 0 ),
+    iLastReportedError( KErrNone ),
+    iReserved( EFalse ),
+    iSubServiceState( TScpStateContainer::Instance( ECCHDisabled ) )
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::CScpSubService type: %d", 
+                   this, aSubServiceType );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::~CScpSubService
+// -----------------------------------------------------------------------------
+//
+CScpSubService::~CScpSubService()
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::~CScpSubService", this );
+
+    delete iServiceHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::EnableL
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::EnableL()
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::EnableL", this );
+
+    iSubServiceState->EnableL( *this );
+    EnableOccured();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::EnableOccured
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::EnableOccured()
+    {
+    switch ( iSubServiceType )
+        {
+        case ECCHPresenceSub:
+            {
+            iEnableCounter++;
+            }
+            break;
+            
+        case ECCHVoIPSub:
+        case ECCHIMSub:
+        case ECCHVMBxSub:
+        case ECCHUnknown:
+        default:
+            break;
+        }
+        
+    SCPLOGSTRING3( "CScpSubService[0x%x]::EnableOccured : %d", this, iEnableCounter );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::EnableCounter
+// -----------------------------------------------------------------------------
+//
+TInt CScpSubService::EnableCounter()
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::EnableCounter : %d", this, iEnableCounter );
+    return iEnableCounter;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::ResetEnableCounter
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::ResetEnableCounter()
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::ResetEnableCounter", this );
+    iEnableCounter = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::Disable
+// -----------------------------------------------------------------------------
+//
+TInt CScpSubService::Disable()
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::Disable", this );
+
+    return iSubServiceState->Disable( *this );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::Id
+// -----------------------------------------------------------------------------
+//
+TInt CScpSubService::Id() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::Id", this );
+
+    return iId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SubServiceId
+// -----------------------------------------------------------------------------
+//
+TInt CScpSubService::SubServiceId() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::SubServiceId", this );
+
+    return iSubServiceId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::ServiceStorage
+// -----------------------------------------------------------------------------
+//
+CScpServiceStorage& CScpSubService::ServiceStorage() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::ServiceStorage", this );
+
+    return iService.ServiceStorage();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::ProfileHandler
+// -----------------------------------------------------------------------------
+//
+CScpProfileHandler& CScpSubService::ProfileHandler() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::ProfileHandler", this );
+
+    return iService.ProfileHandler();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::State
+// -----------------------------------------------------------------------------
+//
+TCCHSubserviceState CScpSubService::State() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::State: %d", this );
+
+    return iSubServiceState->State();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SubServiceType
+// -----------------------------------------------------------------------------
+//
+TCCHSubserviceType CScpSubService::SubServiceType() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::Type", this );
+
+    return iSubServiceType;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SetSipProfileId
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::SetSipProfileId( TInt aSipProfileId )
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::SetSipProfileId profile id", 
+                   this, aSipProfileId );
+
+    iSipProfileId = aSipProfileId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SipProfileId
+// -----------------------------------------------------------------------------
+//
+TInt CScpSubService::SipProfileId() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::SipProfileId", this );
+
+    return iSipProfileId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::EnableRequestedState
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::SetEnableRequestedState( TEnableState aEnableRequestedState )
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::SetEnableRequestedState", this );
+
+    iEnableRequestedState = aEnableRequestedState;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::EnableRequestedState
+// -----------------------------------------------------------------------------
+//
+CScpSubService::TEnableState CScpSubService::EnableRequestedState() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::EnableRequestedState", this );
+
+    return iEnableRequestedState;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SetSubServiceDisconnected
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::SetSubServiceDisconnected( TBool aSubServiceDisconnected )
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::SetSubServiceDisconnected: %d", this, 
+                   aSubServiceDisconnected );
+
+    iSubServiceDisconnected = aSubServiceDisconnected;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SubServiceDisconnected
+// -----------------------------------------------------------------------------
+//
+TBool CScpSubService::SubServiceDisconnected() const
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::SubServiceDisconnected: %d", this, 
+                   iSubServiceDisconnected );
+
+    return iSubServiceDisconnected;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SetApId
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::SetApId( TUint32 aApId )
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::SetApId ap id: %d", this, aApId );
+
+    iApId = aApId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::ApId
+// -----------------------------------------------------------------------------
+//
+TUint32 CScpSubService::ApId() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::ApId", this );
+
+    return iApId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SetSnapId
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::SetSnapId( TUint32 aSnapId )
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::SetSnapId snap id: %d", this, aSnapId );
+
+    iSnapId = aSnapId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SnapId
+// -----------------------------------------------------------------------------
+//
+TUint32 CScpSubService::SnapId() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::SnapId", this );
+
+    return iSnapId;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::GetIapType
+// -----------------------------------------------------------------------------
+//
+TScpIapType CScpSubService::GetIapType() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::GetIapType", this );
+
+    TScpIapType type = EScpUnknownType;
+
+    // Check that the sip profile is not using WLAN iap
+    CScpProfileHandler& profileHandler = iService.ProfileHandler();
+
+    CScpSipConnection* sipConnection = NULL;
+
+    if( profileHandler.SipConnectionExists( iSipProfileId ) )
+        {
+        sipConnection = profileHandler.GetSipConnection( iSipProfileId );
+        }
+    else
+        {
+        TRAP_IGNORE( sipConnection = 
+                     profileHandler.CreateSipConnectionL( iSipProfileId ) );
+        }
+
+    __ASSERT_DEBUG( sipConnection, User::Panic( KNullDesC, KErrGeneral ) );
+
+    if( sipConnection )
+        {
+        TRAP_IGNORE( type = sipConnection->GetIapTypeL() );
+        }
+
+    return type;
+    }      
+            
+// -----------------------------------------------------------------------------
+// CScpSubService::ServiceHandler
+// -----------------------------------------------------------------------------
+//
+CScpServiceHandlerBase& CScpSubService::ServiceHandler() const
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::ServiceHandler", this );
+
+    return *iServiceHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::LastReportedError
+// -----------------------------------------------------------------------------
+//
+TInt CScpSubService::LastReportedError() const
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::LastReportedError: %d", 
+                   this, iLastReportedError );
+
+    return iLastReportedError;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SetLastReportedError
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::SetLastReportedError(
+    const TInt aError )
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::SetLastReportedError: %d", 
+                   this, aError );
+
+    iLastReportedError = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SetReserved
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::SetReserved( TBool aReserved )
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::SetReserved: %d", this, aReserved );
+
+    iReserved = aReserved;
+
+    CScpProfileHandler& profileHandler = iService.ProfileHandler();
+    profileHandler.SetSipProfileReserved( iSipProfileId, iReserved );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::IsReserved
+// -----------------------------------------------------------------------------
+//
+TBool CScpSubService::IsReserved() const
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::IsReserved: %d", this, iReserved );
+
+    return iReserved;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::IsRoaming
+// -----------------------------------------------------------------------------
+//
+TBool CScpSubService::IsRoaming() const
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::IsRoaming: %d", this, iRoaming );
+
+    return iRoaming;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::ChangeState
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::ChangeState( TCCHSubserviceState aState, TInt aError )
+    {
+    SCPLOGSTRING5( "CScpSubService[0x%x]::ChangeState from %d to %d error: %d", this,
+                    iSubServiceState->State(), aState, aError );
+    SCPLOGSTRING3( "CScpSubService[0x%x]::ChangeState type %d", this, iSubServiceType );
+    __ASSERT_DEBUG( aState != ECCHUninitialized, User::Panic( KNullDesC, KErrGeneral ) );
+
+    __ASSERT_DEBUG( iSubServiceState->State() == ECCHDisabled ? 
+                    aState != ECCHDisconnecting : ETrue, 
+                    User::Panic( KNullDesC, KErrGeneral ) );
+    __ASSERT_DEBUG( iSubServiceState->State() == ECCHConnecting ? 
+                    aState != ECCHDisabled || KErrCancel == aError : ETrue, 
+                    User::Panic( KNullDesC, KErrGeneral ) );
+    __ASSERT_DEBUG( iSubServiceState->State() == ECCHDisconnecting ? 
+                    aState == ECCHDisabled : ETrue, 
+                    User::Panic( KNullDesC, KErrGeneral ) );
+    __ASSERT_DEBUG( iSubServiceState->State() == ECCHEnabled ? 
+                    aState != ECCHDisabled : ETrue, 
+                    User::Panic( KNullDesC, KErrGeneral ) );
+
+    if ( aState != iSubServiceState->State() ||
+        ( aState == iSubServiceState->State() && iLastReportedError != aError ) )
+        {
+        iLastReportedError = aError;
+        
+        switch( aState )
+            {
+            case ECCHConnecting:
+                {
+                iSubServiceState = 
+                    TScpStateContainer::Instance( ECCHConnecting );
+                }
+                break;
+
+            case ECCHEnabled:
+                {
+                iSubServiceState = 
+                    TScpStateContainer::Instance( ECCHEnabled );
+					
+                if ( ECCHVoIPSub == iSubServiceType )
+                    {
+                    if ( iService.ContainsSubServiceType( ECCHPresenceSub ) )
+                        {
+                        CScpPresenceHandler* presenceHandler = static_cast<CScpPresenceHandler*>(
+                            &iService.GetSubServiceByType( ECCHPresenceSub )->ServiceHandler() );
+                            
+                        TRAP_IGNORE( presenceHandler->UpdateXdmSettingsL() );
+                        }
+                    }
+                }
+                break;
+
+            case ECCHDisconnecting:
+                {
+                iSubServiceState = 
+                    TScpStateContainer::Instance( ECCHDisconnecting );
+                }
+                break;
+
+            case ECCHDisabled:
+                {
+                iSubServiceState = 
+                    TScpStateContainer::Instance( ECCHDisabled );
+                }
+                break;
+
+            default:
+                __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) );
+                break;
+
+            }
+
+        TBool sendEvent = ETrue;
+        
+        // During connection refreshing we don't send events about disabling
+        if ( iEnableRequestedState == EScpRefreshed )
+            {
+            if ( aState == ECCHDisconnecting || aState == ECCHDisabled )
+                {
+                sendEvent = EFalse;
+                }
+            }
+            
+        if ( sendEvent )
+            {
+            TServiceSelection selection( iSubServiceId, iSubServiceType );
+
+            MCchServiceObserver& observer = iService.ServiceObserver();
+            observer.ServiceStateChanged( selection,
+                                          aState,
+                                          aError );
+            
+            if ( ECCHDisabled == aState )
+                {
+                ResetEnableCounter();
+                // No need to hold the last reported error, if all 
+                // subservices are in disabled state
+                if ( iService.IsAllSubservicesDisabled() )
+                    {
+                    iService.ChangeLastReportedErrors( KErrNone );
+                    }
+                }
+            }
+                                          
+        if ( iSubServiceObserver ) 
+            {
+            SCPLOGSTRING2( "CScpSubService[0x%x]::ChangeState HandleSubServiceChange", this );
+            iSubServiceObserver->HandleSubServiceChange( aState, aError );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::HandleConnectionEvent
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::HandleConnectionEvent( TScpConnectionEvent aEvent )
+    {
+    SCPLOGSTRING4( "CScpSubService[0x%x]::HandleConnectionEvent event: %d state: %d", 
+                   this, aEvent, iSubServiceState->State() );
+    __ASSERT_DEBUG( aEvent != EScpUnknown, User::Panic( KNullDesC, KErrGeneral ) );
+
+    // All other events than EScpRoaming finish roaming
+    iRoaming = EFalse;
+    
+    switch ( aEvent )
+        {
+        case EScpNetworkFound:
+            {
+            iSubServiceState->NetworkFound( *this );
+            }
+            break;
+
+        case EScpNetworkNotFound:
+            {
+            iSubServiceState->NetworkNotFound( *this );
+            }
+            break;
+
+        case EScpNetworkLost:
+            {
+            iSubServiceState->NetworkLost( *this );
+            }
+            break;
+
+        case EScpRegistered:
+            {
+            iSubServiceState->ServiceConnected( *this );
+            }
+            break;
+
+        case EScpRegistrationFailed:
+            {
+            iSubServiceState->ServiceConnectionFailed( *this );
+            }
+            break;
+        case EScpInvalidSettings:
+            {
+            iSubServiceState->ServiceInvalidSettings( *this );
+            }
+            break;
+        case EScpDeregistered:
+            {
+            iSubServiceState->ServiceDisconnected( *this );
+            }
+            break;
+
+        case EScpAuthenticationFailed:
+            {
+            iSubServiceState->AuthenticationFailed( *this );
+            }
+            break;
+            
+        case EScpRoaming:
+            {
+            iRoaming = ETrue;
+            iSubServiceState->Roaming( *this );
+            }
+            break;
+            
+        case EScpRegistrationCanceled:
+            {
+            iSubServiceState->ServiceConnectionCanceled( *this );
+            }
+            break;
+                        
+        case EScpRegistrationPending:
+            {
+            iSubServiceState->RegistrationPending( *this );
+            }
+            break;
+            
+        default:
+            __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) );
+            break;
+        }
+
+    // Remove user disabled sub services if correct
+    // network event received
+    if ( iEnableRequestedState == EScpDisabled &&
+         ( aEvent == EScpDeregistered ||
+           aEvent == EScpRegistrationFailed ||
+           aEvent == EScpNetworkLost ||
+           aEvent == EScpNetworkNotFound ) )
+        {
+        CScpServiceStorage& storage = ServiceStorage();
+        storage.RemoveDisabledServices();
+        }
+    else if ( iEnableRequestedState == EScpRefreshed &&
+             aEvent == EScpDeregistered )
+        {
+        // We can only ingnore the error
+        TRAP_IGNORE( EnableL() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpSubService::SetSubServiceObserver
+// -----------------------------------------------------------------------------
+//
+void CScpSubService::SetSubServiceObserver( MScpSubServiceObserver* aSubServiceObserver )
+    {
+    SCPLOGSTRING3( "CScpSubService[0x%x]::SetSubServiceObserver aSubServiceObserver[0x%x]", 
+        this, aSubServiceObserver );
+        
+    iSubServiceObserver = aSubServiceObserver;
+    }
+  
+// -----------------------------------------------------------------------------
+// CScpSubService::SetPresenceToObserveVoIPL
+// -----------------------------------------------------------------------------
+// 
+void CScpSubService::SetPresenceToObserveVoIP()
+    {
+    SCPLOGSTRING2( "CScpSubService[0x%x]::SetPresenceToObserveVoIP", this );
+    CScpSubService* presenceSubService = iService.GetSubServiceByType( ECCHPresenceSub );
+    if ( presenceSubService )
+        {
+        SCPLOGSTRING( "CScpSubService::SetPresenceToObserveVoIPL - presenceSubService exists" );
+        CScpPresenceHandler* presenceHandler =
+            static_cast<CScpPresenceHandler*>( &presenceSubService->ServiceHandler() );
+          SetSubServiceObserver( presenceHandler );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpsubservicestate.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,163 @@
+/*
+* 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:  
+*
+*/
+
+
+#include "scpsubservicestate.h"
+#include "scpsubservice.h"
+#include "scplogger.h"
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::TScpSubServiceState
+// -----------------------------------------------------------------------------
+//
+TScpSubServiceState::TScpSubServiceState()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::ChangeState
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::ChangeState( CScpSubService& aSubService, 
+                                       TCCHSubserviceState aState,
+                                       TInt aError ) const
+    {
+    SCPLOGSTRING( "TScpSubServiceState::ChangeState" );
+
+    aSubService.ChangeState( aState, aError );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::EnableL
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::EnableL( CScpSubService& /*aSubService*/ ) const
+    {
+    SCPLOGSTRING( "TScpSubServiceState::EnableL" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::Disable
+// -----------------------------------------------------------------------------
+//
+TInt TScpSubServiceState::Disable( CScpSubService& /*aSubService*/ ) const
+    {
+    SCPLOGSTRING( "TScpSubServiceState::Disable" );
+ 
+    return KErrNotSupported; 
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::NetworkFound
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::NetworkFound( CScpSubService& /*aSubService*/ ) const
+    {
+    SCPLOGSTRING( "TScpSubServiceState::NetworkFound" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::NetworkLost
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::NetworkLost( CScpSubService& /*aSubService*/ ) const
+    {
+    SCPLOGSTRING( "TScpSubServiceState::NetworkLost" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::NetworkNotFound
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::NetworkNotFound( CScpSubService& /*aSubService*/ ) const
+    {
+    SCPLOGSTRING( "TScpSubServiceState::NetworkNotFound" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::ServiceInvalidSettings
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::ServiceInvalidSettings( CScpSubService& /*aSubService*/ ) const
+    {
+    SCPLOGSTRING( "TScpSubServiceState::ServiceInvalidSettings" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::ServiceConnectionFailed
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::ServiceConnectionFailed( CScpSubService& /*aSubService*/ ) const
+    {
+    SCPLOGSTRING( "TScpSubServiceState::ServiceConnectionFailed" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::ServiceConnected
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::ServiceConnected( CScpSubService& /*aSubService*/ ) const
+    {
+    SCPLOGSTRING( "TScpSubServiceState::ServiceConnected" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::ServiceDisconnected
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::ServiceDisconnected( CScpSubService& /*aSubService*/ ) const
+    {
+    SCPLOGSTRING( "TScpSubServiceState::ServiceDisconnected" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::AuthenticationFailed
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::AuthenticationFailed( CScpSubService& /*aSubService*/ ) const
+    {
+    SCPLOGSTRING( "TScpSubServiceState::AuthenticationFailed" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::Roaming
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::Roaming( CScpSubService& /*aSubService*/ ) const 
+    {
+    SCPLOGSTRING( "TScpSubServiceState::Roaming" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::ServiceConnectionCanceled
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::ServiceConnectionCanceled( CScpSubService& /*aSubService*/ ) const 
+    {
+    SCPLOGSTRING( "TScpSubServiceState::ServiceConnectionCanceled" );
+    }
+
+// -----------------------------------------------------------------------------
+// TScpSubServiceState::RegistrationPending
+// -----------------------------------------------------------------------------
+//
+void TScpSubServiceState::RegistrationPending( CScpSubService& /*aSubService*/ ) const 
+    {
+    SCPLOGSTRING( "TScpSubServiceState::RegistrationPending" );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scputility.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,277 @@
+/*
+* Copyright (c) 2007-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:  Provides static utility functions for SCP
+*
+*/
+
+
+#include <e32property.h>
+#include <crcseprofileregistry.h>
+#include <ccherror.h>
+#include <siperr.h>
+
+#include "scputility.h"
+#include "scplogger.h"
+
+const TScpUtility::SCchErrorMapping TScpUtility::iErrorTable[] = 
+    {
+        { KCCHErrorInvalidSettings, KErrArgument },
+        { KCCHErrorAccessPointNotDefined, KErrBadName },
+        { KCCHErrorAuthenticationFailed, KErrSIPForbidden }
+    };
+
+// -----------------------------------------------------------------------------
+// TScpUtility::ConvertToConnectionEvent
+// -----------------------------------------------------------------------------
+//
+TScpConnectionEvent TScpUtility::ConvertToConnectionEvent( 
+    CScpSipConnection::TConnectionState aState,
+    TInt aError )
+    {
+    TScpConnectionEvent returnEvent( EScpUnknown );    
+
+    switch( aState )
+        {
+        case CScpSipConnection::ERegistered:
+            {
+            returnEvent = EScpRegistered;    
+            }
+            break;
+
+        case CScpSipConnection::ERegistering:
+            {
+            if( aError == KErrNone )
+                {
+                returnEvent = EScpNetworkFound;
+                }
+            else if( aError == KCCHErrorNetworkLost )
+                {
+                returnEvent = EScpNetworkLost;
+                }
+            else
+                {
+                returnEvent = EScpRegistrationFailed;
+                }
+            }
+            break;
+
+        case CScpSipConnection::EDeregistered:
+            {
+            returnEvent = EScpDeregistered;
+            }
+            break;
+
+        case CScpSipConnection::EDeregistering:
+            {
+            returnEvent = EScpNetworkNotFound;
+            }
+            break;
+
+        default:
+            User::Panic( KNullDesC, KErrGeneral );
+            break;
+        }
+
+    return returnEvent;
+    }
+
+// -----------------------------------------------------------------------------
+// TScpUtility::ConvertToConnectionEvent
+// -----------------------------------------------------------------------------
+//
+TScpConnectionEvent TScpUtility::ConvertToConnectionEvent( 
+    TCCHSubserviceState aState )
+    {
+    TScpConnectionEvent returnEvent( EScpUnknown );    
+
+    switch( aState )
+        {
+        case ECCHEnabled:
+            {
+            returnEvent = EScpRegistered;
+            }
+            break;
+
+        case ECCHConnecting:
+            {
+            returnEvent = EScpNetworkFound;
+            }
+            break;
+
+        case ECCHDisabled:
+            {
+            returnEvent = EScpDeregistered;
+            }
+            break;
+
+        case ECCHDisconnecting:
+            {
+            returnEvent = EScpNetworkNotFound;
+            }
+            break;
+
+        default:
+            User::Panic( KNullDesC, KErrGeneral );
+            break;
+        }
+
+    return returnEvent;
+    }
+
+// -----------------------------------------------------------------------------
+// TScpUtility::ResetAndDestroyEntries
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void TScpUtility::ResetAndDestroyEntries( TAny* anArray )
+    {
+    SCPLOGSTRING( "TScpUtility::ResetAndDestroyEntries" );
+    
+    RPointerArray<CRCSEProfileEntry>* array = 
+        reinterpret_cast<RPointerArray<CRCSEProfileEntry>*>( anArray );
+        
+    if (array)
+        {
+        array->ResetAndDestroy();
+        array->Close();
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// TScpUtility::ConvertToCchError
+// -----------------------------------------------------------------------------
+//
+TInt TScpUtility::ConvertToCchError( TInt aErrorCode )
+    {
+    TInt count = sizeof( iErrorTable ) / sizeof( struct SCchErrorMapping );
+    TInt error = KErrUnknown;
+    while( count-- )
+        {
+        if ( iErrorTable[ count ].iProtocolError == aErrorCode )
+            {
+            error = iErrorTable[ count ].iServiceError;
+            break;
+            }
+        }
+    return error; 
+    }
+
+// -----------------------------------------------------------------------------
+// TScpUtility::RemovePrefixAndDomain
+// -----------------------------------------------------------------------------
+//
+TInt TScpUtility::RemovePrefixAndDomain( const TDesC8& aUsername, 
+    RBuf8& aFormattedUsername )
+    {
+    TInt err( KErrNone );
+    
+    TInt startPosition = aUsername.Find( KColon() );
+    if ( KErrNotFound == startPosition )
+        {
+        startPosition = 0;
+        }
+    else
+        {
+        startPosition = ( startPosition + KColon().Length() );
+        }
+    TInt endPos = aUsername.Find( KAt() );
+    if ( KErrNotFound == endPos )
+        {
+        endPos = ( aUsername.Length() - startPosition );
+        }            
+    else
+        {
+        endPos = ( endPos - startPosition );
+        }
+    
+    TPtrC8 formatted = aUsername.Mid( startPosition, endPos );            
+    err = aFormattedUsername.Create( formatted.Length() );
+    
+    if ( KErrNone == err )
+        {
+        aFormattedUsername.Copy( formatted );
+        }
+    
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// TScpUtility::CheckSipUsername
+// -----------------------------------------------------------------------------
+//
+TBool TScpUtility::CheckSipUsername( const TDesC8& aUsername )
+    {
+    TInt retval = ETrue;
+
+    if ( KErrNotFound != aUsername.Find( KSipScheme() ) || 
+         KErrNotFound != aUsername.Find( KAt() ) )
+        {
+        SCPLOGSTRING( "TScpUtility::CheckSipUsername: username has prefix or domain" );
+        retval = EFalse;
+        }
+
+    if( aUsername == KNullDesC8 )
+        {
+        SCPLOGSTRING( "TScpUtility::CheckSipUsername: username is empty - not allowed" );
+        retval = EFalse;
+        }
+        
+    return retval; 
+    }
+
+// -----------------------------------------------------------------------------
+// TScpUtility::CheckSipPassword
+// -----------------------------------------------------------------------------
+//
+TBool TScpUtility::CheckSipPassword( const TDesC8& /*aPassword*/ )
+    {
+    TInt retval = ETrue;
+
+    return retval; 
+    }
+
+// -----------------------------------------------------------------------------
+// TScpUtility::GetValidPrefix
+// -----------------------------------------------------------------------------
+//
+void TScpUtility::GetValidPrefix( const TDesC8& aUsername, TDes8& aPrefix )
+    {
+    // no prefix -> use sip:
+    aPrefix.Copy( KSipScheme() );
+    
+    TInt index = aUsername.Find( KColon() );
+    if ( KErrNotFound != index )
+        {
+        index += KColon().Length();
+        // if prefix isn't sip or sips, prefix isn't valid
+        if ( !aUsername.Left( index ).Compare( KSipScheme() ) )
+            {
+            aPrefix.Copy( KSipScheme() );
+            }
+        else if ( !aUsername.Left( index ).Compare( KSipsScheme() ) )
+            {
+            aPrefix.Copy( KSipsScheme() );
+            }
+        else
+            {
+            // prefix not valid -> use sip:
+            }
+        }
+        
+    SCPLOGSTRING2( "TScpUtility::GetValidPrefix: %S", &aPrefix );
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpvmbxhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,416 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Vmbx handler.
+*
+*/
+
+
+#include "ipvmbxinterface.h"
+#include "scpvmbxhandler.h"
+#include "scplogger.h"
+#include "scpservice.h"
+#include "scpsubservice.h"
+#include "scpservicestorage.h"
+#include "scputility.h"
+#include "scpsipconnection.h"
+#include "scpprofilehandler.h"
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::CCScpVmbxHandler
+// -----------------------------------------------------------------------------
+//
+CScpVmbxHandler::CScpVmbxHandler( CScpSubService& aSubService ) :
+    CScpServiceHandlerBase( aSubService )
+    {
+    SCPLOGSTRING2( "CScpVmbxHandler[0x%x]::CScpVmbxHandler", this );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CScpVmbxHandler::ConstructL()
+    {
+    SCPLOGSTRING2( "CScpVmbxHandler[0x%x]::ConstructL", this );
+
+    BaseConstructL();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::NewL
+// -----------------------------------------------------------------------------
+//
+CScpVmbxHandler* CScpVmbxHandler::NewL( CScpSubService& aSubService )
+    {
+    SCPLOGSTRING( "CScpVmbxHandler::NewL" );
+
+    CScpVmbxHandler* self = new(ELeave) CScpVmbxHandler( aSubService );
+    CleanupStack::PushL( self );    
+    self->ConstructL();    
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::~CScpVmbxHandler
+// -----------------------------------------------------------------------------
+//
+CScpVmbxHandler::~CScpVmbxHandler()
+    {
+    SCPLOGSTRING2( "CScpVmbxHandler[0x%x]::~CScpVmbxHandler", this );
+    
+    if ( !IsAnotherVmbxSubServiceAlreadyEnabled() )
+        {
+        iSubService.ProfileHandler().DeleteVmbxInterface();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::EnableSubServiceL
+// -----------------------------------------------------------------------------
+//
+void CScpVmbxHandler::EnableSubServiceL()
+    {
+    SCPLOGSTRING4( "CScpVmbxHandler[0x%x]::EnableSubServiceL: 0x%x type: %i", 
+                   this, &iSubService, iSubService.SubServiceType() );
+    __ASSERT_DEBUG( iSubService.SubServiceType() == ECCHVMBxSub,
+                    User::Panic( KNullDesC, KErrGeneral ) );
+
+    // Only one enabled vmbx service is allowed at a time.
+    if( IsAnotherVmbxSubServiceAlreadyEnabled() )
+        {
+        User::Leave( KErrInUse );
+        }
+
+    CScpServiceHandlerBase::RegisterProfileL();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::IsAnotherVmbxSubServiceAlreadyEnabled
+// -----------------------------------------------------------------------------
+//
+TBool CScpVmbxHandler::IsAnotherVmbxSubServiceAlreadyEnabled() const
+    {
+    SCPLOGSTRING2( "CScpVmbxHandler[0x%x]::IsAnotherVmbxSubServiceAlreadyEnabled", this );
+
+    TBool result = EFalse;
+
+    CScpServiceStorage& storage = iSubService.ServiceStorage();
+    RArray<TInt> ids;
+
+    storage.GetSubServiceIds( ECCHVMBxSub, ids );
+
+    TInt count( ids.Count() );
+
+    for ( TInt i( 0 ); i < count; i++ )
+        {
+        CScpSubService* subService = storage.GetSubService( ids[i] );
+
+        if ( subService && ECCHDisabled != subService->State() )
+            {
+            result = ETrue;
+            break;
+            }
+        }
+
+    ids.Close();
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::DisableSubService
+// -----------------------------------------------------------------------------
+//
+TInt CScpVmbxHandler::DisableSubService()
+    {
+    SCPLOGSTRING4( "CScpVmbxHandler[0x%x]::DisableSubService: 0x%x type: %i", 
+                   this, &iSubService, iSubService.SubServiceType() );
+    __ASSERT_DEBUG( iSubService.SubServiceType() == ECCHVMBxSub,
+                    User::Panic( KNullDesC, KErrGeneral ) );  
+
+    TInt result = KErrNone;
+
+    if( iSubService.State() != ECCHDisabled )
+        {
+        TRAP( result, UnsubscribeL() );
+
+        if( result == KErrNone )
+            {
+            // Deregister if still connecting and subscribed message 
+            // not yet received
+            if( iSubService.State() == ECCHConnecting )
+                {
+                DeregisterProfile();
+                }
+            else
+                {
+                StartForcedDisableTimer( CScpVmbxHandler::ForceVmbxServiceDisable );
+                }
+            }
+        else
+            {
+            DeregisterProfile();
+            }
+        }
+    else
+        {
+        result = KErrNotSupported;
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::UnsubscribeL
+// -----------------------------------------------------------------------------
+//
+void CScpVmbxHandler::UnsubscribeL()
+    {
+    SCPLOGSTRING2( "CScpVmbxHandler[0x%x]::UnsubscribeL", this );
+
+    CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+
+    // Unsubscribe is not called when refreshing the connection
+    if( iSubService.EnableRequestedState() != CScpSubService::EScpRefreshed )
+        {
+        CIpVmbxInterface& vmbxInterface = profileHandler.VmbxInterfaceL( *this );
+        vmbxInterface.UnsubscribeL( iSubService.SubServiceId() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::HandleMessage
+// -----------------------------------------------------------------------------
+//
+void CScpVmbxHandler::HandleMessage( TUint32 aServiceId, TVmbxMessage aMessage )
+    {
+    SCPLOGSTRING4( "CScpVmbxHandler[0x%x]::HandleMessage: id: %d message: %d", 
+                   this, aServiceId, aMessage );
+
+    TInt result = KErrNone;
+    
+    if( iSubService.SubServiceId() == aServiceId )
+        {
+        switch( aMessage )
+            {
+            case ESubscribed:
+                {
+                iSubService.HandleConnectionEvent( EScpRegistered );
+                }
+                break;
+
+            case EUnsubscribed:
+                {
+                // Check if disable was requested
+                if( iSubService.EnableRequestedState() == CScpSubService::EScpDisabled )
+                    {
+                    CancelDisableTimer();
+                    DeregisterProfile();
+                    }
+                else
+                    {
+                    if ( iResubscribe )
+                        {
+                        iResubscribe = EFalse;
+                        TRAP( result, SubscribeL() )
+                        SCPLOGSTRING2( "Subscribe result: %d", result ); 
+                        
+                        if( result == KErrNone )
+                            {
+                            // Still connecting the service
+                            iSubService.HandleConnectionEvent( EScpNetworkFound );
+                            }
+                        else if ( KErrAlreadyExists == result )
+                            {
+                            iSubService.HandleConnectionEvent( EScpRegistrationPending );
+                            }
+                        else
+                            {
+                            iSubService.HandleConnectionEvent( EScpRegistrationFailed );
+                            }
+                        }
+                    else
+                        {
+                        // Connection to VMBx server lost
+                        iSubService.HandleConnectionEvent( EScpDeregistered );
+                        }
+                    }
+                }
+                break;
+
+            case ENetworkError:
+                {
+                // Network lost errors may have already been reported
+                if( iSubService.LastReportedError() == KErrNone )
+                    {
+                    // Connection to VMBx server lost
+                    iSubService.HandleConnectionEvent( EScpRegistrationFailed );
+                    }
+                break;
+                }
+                
+            case EFatalNetworkError:
+                {
+                // In case of fatal network error forced disable is done to
+                // SIP profile.
+                PerformInstantForceSipProfileDisable();
+                break;
+                }
+
+            case EIncorrectSettings:
+                {
+                iSubService.HandleConnectionEvent( EScpRegistrationFailed );
+                }
+                break;
+
+            case ENoMemory:
+            case ESmsError:
+                {
+                // :
+                // Error handling for VMBx errors
+                // In network error case we should change the state to connecting +
+                // "service not respondig" error
+                SCPLOGSTRING( "Error message from VMBx interface" ) 
+                }
+                break;
+
+            default:
+                {
+                __ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) );
+                }
+            }
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::SubServiceType
+// -----------------------------------------------------------------------------
+//
+TCCHSubserviceType CScpVmbxHandler::SubServiceType() const
+    {
+    SCPLOGSTRING2( "CScpVmbxHandler[0x%x]::SubServiceType", this );
+
+    return ECCHVMBxSub;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::HandleSipConnectionEvent
+// -----------------------------------------------------------------------------
+//
+void CScpVmbxHandler::HandleSipConnectionEvent( TUint32 aProfileId,
+                                                TScpConnectionEvent aEvent )
+    {
+    SCPLOGSTRING4( "CScpVmbxHandler[0x%x]::HandleSipConnectionEvent id: %d event: %d",
+                   this, aProfileId, aEvent );
+    
+    TInt result = KErrNone;
+    
+    if( iSubService.SipProfileId() == aProfileId &&
+        iSubService.EnableRequestedState() != CScpSubService::EScpNoRequest )
+        {
+        if ( EScpRoaming == aEvent )
+            {
+            SCPLOGSTRING( "CScpVmbxHandler - EScpRoaming -> unsubscribe" );
+            TRAP( result, UnsubscribeL() );
+            SCPLOGSTRING2( "CScpVmbxHandler - unsubscribe error: %d", result );
+            }
+        
+        if( aEvent == EScpRegistered &&
+            iSubService.EnableRequestedState() == CScpSubService::EScpEnabled )
+            {
+            TRAP( result, SubscribeL() )
+
+            SCPLOGSTRING2( "Subscribe result: %d", result ); 
+        
+            if( result == KErrNone )
+                {
+                // Still connecting the service
+                aEvent = EScpNetworkFound;
+                }
+            else
+                {
+                if ( iSubService.IsRoaming() && KErrAlreadyExists == result )
+                    {
+                    // There's still unsubscribe ongoing, we have to wait
+                    // ipvoicemailengine event EUnsubscribed and try to 
+                    // make subscribe again
+                    SCPLOGSTRING( "Resubscribe later" ); 
+                    iResubscribe = ETrue;
+                    // Still connecting the service
+                    aEvent = EScpNetworkFound;
+                    }
+                else
+                    {
+                    aEvent = EScpRegistrationFailed;
+                    }
+                }
+            }
+        else if( aEvent == EScpDeregistered &&
+                 iSubService.EnableRequestedState() == CScpSubService::EScpDisabled ||
+                 iSubService.EnableRequestedState() == CScpSubService::EScpRefreshed )
+            {
+            CancelDisableTimer();
+            }
+
+        iSubService.HandleConnectionEvent( aEvent );
+        }        
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::SubscribeL
+// -----------------------------------------------------------------------------
+//
+void CScpVmbxHandler::SubscribeL()
+    {
+    SCPLOGSTRING2( "CScpVmbxHandler[0x%x]::SubscribeL", this );
+
+    TUint32 sipProfileId = iSubService.SipProfileId();
+    CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+
+    CScpSipConnection* sipConnection = profileHandler.GetSipConnection( sipProfileId );
+
+    if( sipConnection )
+        {
+        CIpVmbxInterface& vmbxInterface = profileHandler.VmbxInterfaceL( *this );
+
+        // It must be possible to add observers for the vmbx interface
+
+        vmbxInterface.SubscribeL( iSubService.SubServiceId(), 
+                                  sipConnection->SipProfile() );
+        }
+    else
+        {
+        User::LeaveIfError( KErrNotFound );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVmbxHandler::ForceDisable
+// -----------------------------------------------------------------------------
+//
+TInt CScpVmbxHandler::ForceVmbxServiceDisable( TAny* aSelf )
+    {
+    SCPLOGSTRING( "CScpVmbxHandler[0x%x]::ForceVmbxServiceDisable" );
+
+    CScpVmbxHandler* self = static_cast<CScpVmbxHandler*>( aSelf );
+
+    self->CancelDisableTimer();
+    self->DeregisterProfile();
+
+    return 1;
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipconnectionprovider/src/scpvoiphandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,272 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Voip handler.
+*
+*/
+
+
+#include <e32property.h>
+#include <spdefinitions.h>
+#include "scpvoiphandler.h"
+#include "scpprofilehandler.h"
+#include "scplogger.h"
+#include "scpsubservice.h"
+#include "scpservicestorage.h"
+#include "scpsettinghandler.h"
+#include "scpsipconnection.h"
+#include "scputility.h"
+#include "csipclientresolverutils.h"
+
+// : These need to be in some common header
+const TUid KResolver = { 0x10283140 };
+
+
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::CCScpVoipHandler
+// -----------------------------------------------------------------------------
+//
+CScpVoipHandler::CScpVoipHandler( CScpSubService& aSubService ) :
+    CScpServiceHandlerBase( aSubService )
+    {
+    SCPLOGSTRING2( "CScpVoipHandler[0x%x]::CScpVoipHandler", this );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CScpVoipHandler::ConstructL()
+    {
+    SCPLOGSTRING2( "CScpVoipHandler[0x%x]::ConstructL", this );
+    
+    BaseConstructL();
+    iSipClientResolver = CSipClientResolverUtils::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::NewL
+// -----------------------------------------------------------------------------
+//
+CScpVoipHandler* CScpVoipHandler::NewL( CScpSubService& aSubService )
+    {
+    SCPLOGSTRING( "CScpVoipHandler::NewL" );
+
+    CScpVoipHandler* self = new(ELeave) CScpVoipHandler( aSubService );
+    CleanupStack::PushL( self );    
+    self->ConstructL();    
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::~CScpVoipHandler
+// -----------------------------------------------------------------------------
+//
+CScpVoipHandler::~CScpVoipHandler()
+    {
+    SCPLOGSTRING2( "CScpVoipHandler[0x%x]::~CScpVoipHandler", this );
+    delete iSipClientResolver;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::HandlePropertyChanged
+// -----------------------------------------------------------------------------
+//
+void CScpVoipHandler::HandlePropertyChanged( TInt /* aPropertyValue */)
+    {
+    CScpSipConnection::TConnectionState sipState = CScpSipConnection::EUnknown;
+    TInt sipError = KErrNotFound;
+    CScpSipConnection* sipConnection = 
+        iSubService.ProfileHandler().GetSipConnection( 
+            iSubService.SipProfileId() );
+    if ( sipConnection )
+        {
+        sipConnection->GetState( sipState, sipError );
+        }
+    if (  ECCHEnabled == iSubService.State() && 
+        KErrNone == sipError && CScpSipConnection::ERegistered == sipState )
+        {
+        HandleSipConnectionEvent( iSubService.SipProfileId(), EScpRegistered );
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::EnableSubServiceL
+// -----------------------------------------------------------------------------
+//
+void CScpVoipHandler::EnableSubServiceL()
+    {
+    SCPLOGSTRING4( "CScpVoipHandler[0x%x]::EnableSubServiceL: 0x%x type: %i", 
+                   this, &iSubService, iSubService.SubServiceType() );
+    __ASSERT_DEBUG( iSubService.SubServiceType() == ECCHVoIPSub,
+                    User::Panic( KNullDesC, KErrGeneral ) );
+    
+    CScpServiceHandlerBase::RegisterProfileL();
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::DisableSubService
+// -----------------------------------------------------------------------------
+//
+TInt CScpVoipHandler::DisableSubService()
+    {
+    SCPLOGSTRING4( "CScpVoipHandler[0x%x]::DisableSubService: 0x%x type: %i", 
+                   this, &iSubService, iSubService.SubServiceType() );
+    __ASSERT_DEBUG( iSubService.SubServiceType() == ECCHVoIPSub,
+                    User::Panic( KNullDesC, KErrGeneral ) ); 
+
+    TInt result = KErrNone;
+
+    TCCHSubserviceState subServiceState = iSubService.State();
+
+    if( subServiceState != ECCHDisabled )
+        {
+        TRAP( result, DeregisterContactHeaderL() )        
+
+        DeregisterProfile();
+        }
+    else
+        {
+        result = KErrNotSupported;
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::DeregisterContactHeaderL
+// -----------------------------------------------------------------------------
+//
+void CScpVoipHandler::DeregisterContactHeaderL()
+    {
+    SCPLOGSTRING2( "CScpVoipHandler[0x%x]::DeregisterContactHeaderL", this );
+
+    RBuf8 contactHeaderUser;
+    contactHeaderUser.CleanupClosePushL();
+
+    GetSipProfileContactHeaderUserL( contactHeaderUser );
+    
+    iSipClientResolver->UnRegisterClientWithUserL( 
+        GetCallProviderImplementationUidL(), contactHeaderUser );
+
+    CleanupStack::PopAndDestroy( &contactHeaderUser );
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::SubServiceType
+// -----------------------------------------------------------------------------
+//
+TCCHSubserviceType CScpVoipHandler::SubServiceType() const
+    {
+    SCPLOGSTRING2( "CScpVoipHandler[0x%x]::SubServiceType", this );
+
+    return ECCHVoIPSub;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::HandleSipConnectionEvent
+// -----------------------------------------------------------------------------
+//
+void CScpVoipHandler::HandleSipConnectionEvent( TUint32 aProfileId,
+                                                TScpConnectionEvent aEvent )
+    {
+    TRAP_IGNORE( HandleSipConnectionEventL( aProfileId,aEvent ));
+    }
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::HandleSipConnectionEvent
+// -----------------------------------------------------------------------------
+//
+void CScpVoipHandler::HandleSipConnectionEventL( TUint32 aProfileId,
+                                                TScpConnectionEvent aEvent )
+    {
+    SCPLOGSTRING4( "CScpVoipHandler[0x%x]::HandleSipConnectionEvent id: %d event: %d",
+        this, aProfileId, aEvent );
+
+    if( iSubService.SipProfileId() == aProfileId &&
+        iSubService.EnableRequestedState() != CScpSubService::EScpNoRequest )
+        {
+        if( aEvent == EScpRegistered &&
+            iSubService.EnableRequestedState() == CScpSubService::EScpEnabled )
+            {
+            RBuf8 contactHeaderUser;
+            contactHeaderUser.CleanupClosePushL();
+            GetSipProfileContactHeaderUserL( contactHeaderUser );
+            
+            SCPLOGSTRING( "HandleSipConnectionEventL -> register client" );
+            
+            iSipClientResolver->RegisterClientWithUserL( 
+                GetCallProviderImplementationUidL(), contactHeaderUser, KResolver );
+            
+            CleanupStack::PopAndDestroy( &contactHeaderUser );
+            }
+
+        iSubService.HandleConnectionEvent( aEvent );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::GetSipProfileContactHeaderL
+// -----------------------------------------------------------------------------
+//
+void CScpVoipHandler::GetSipProfileContactHeaderUserL( 
+    RBuf8& aContactHeaderUser ) const
+    {
+    SCPLOGSTRING2( "CScpVoipHandler[0x%x]::GetSipProfileContactHeaderL", this );
+
+    TUint32 sipProfileId = iSubService.SipProfileId();
+
+    CScpProfileHandler& profileHandler = iSubService.ProfileHandler();
+    CScpSipConnection* sipConnection = 
+        profileHandler.CreateSipConnectionL( sipProfileId );
+    CleanupStack::PushL( sipConnection );
+    
+    if( sipConnection )
+        {
+        User::LeaveIfError( sipConnection->GetContactHeaderUser( aContactHeaderUser ) );
+        __ASSERT_DEBUG( aContactHeaderUser.Length() > 0, 
+        User::Panic( KNullDesC, KErrGeneral ) );
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    CleanupStack::PopAndDestroy( sipConnection );
+    }
+    
+// -----------------------------------------------------------------------------
+// CScpVoipHandler::CallProviderImplementationUid
+// -----------------------------------------------------------------------------
+//   
+TUid CScpVoipHandler::GetCallProviderImplementationUidL()
+    {
+    SCPLOGSTRING2( "CScpVoipHandler[0x%x]::GetCallProviderImplementationUidL", this );
+
+    CScpServiceStorage& serviceStorage = iSubService.ServiceStorage();
+    CScpSettingHandler& settingHandler = serviceStorage.SettingsHandler();
+
+    TInt impUid = 0;
+    settingHandler.GetSPSettingsIntPropertyL( iSubService.SubServiceId(),
+                                              EPropertyCallProviderPluginId,
+                                              impUid );
+   
+    TUid implementationUid; 
+    implementationUid.iUid = impUid;
+
+    return implementationUid;
+    }
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipimresolver/data/2002133c.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,56 @@
+/*
+* 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 definitions for project sipimresolver
+*
+*/
+
+
+#include <registryinfov2.rh>
+#include "sipimresolveruids.hrh"
+
+// ---------------------------------------------------------------------------
+// REGISTRY_INFO
+// ecom plugin resource info
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+
+    dll_uid = KDllUidSipImResolver;
+
+    // Declare array of interface info
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // CSIPResolvedClient2 interface UID
+            interface_uid = 0x10282EE5;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KImplUidSipImResolver;
+                    version_no         = 1;
+                    display_name       = "SIP IM Resolver";
+                    default_data       = "";
+                    opaque_data        = "";
+                    rom_only           = 0;
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipimresolver/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Build information file for project sipimresolver
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/sipimresolver.iby CORE_APP_LAYER_IBY_EXPORT_PATH( sipimresolver.iby )
+
+PRJ_MMPFILES
+sipimresolver.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipimresolver/group/sipimresolver.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,50 @@
+/*
+* 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 sipimresolver
+*
+*/
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET                  sipimresolver.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x2002133C
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  sipimresolver.cpp
+SOURCE                  sipimresolverimplementationproxy.cpp
+
+START RESOURCE          ../data/2002133c.rss
+TARGET	                sipimresolver.rsc
+END // RESOURCE
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../inc
+USERINCLUDE             ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+
+LIBRARY                 bafl.lib
+LIBRARY                 euser.lib 
+LIBRARY	                ecom.lib 
+LIBRARY                 sipcodec.lib
+LIBRARY	                sdpcodec.lib
+LIBRARY                 inetprotutil.lib      // URI parsing
+LIBRARY                 ipapputils.lib        // UID resolving
+LIBRARY                 serviceprovidersettings.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipimresolver/inc/sipimresolver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,141 @@
+/*
+* 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:  header file for sipimresolver
+*
+*/
+
+
+#ifndef C_SIPIMRESOLVER_H
+#define C_SIPIMRESOLVER_H
+
+
+#include <implementationproxy.h>
+#include <sipresolvedclient2.h>
+
+
+/**
+ *  Class for aiding SIP Client Resolver component to route the incoming
+ *  invites to Instant Messaging (IM) according to request headers and
+ *  content. It also takes relevant phone state variables into account
+ *  when resolving.
+ *
+ *  @code
+ *   CSipImResolver* imResolver = CSipImResolver::NewL();
+ *   TBool match = imResolver->MatchRequestL( method, *requestUri, headers,
+ *       *content, contentType, resolvedClientUid );
+ *  @endcode
+ *
+ *  @lib sipimresolver.lib
+ *  @since S60 v5.0
+ */
+class CSipImResolver : public CSIPResolvedClient2
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSipImResolver* NewL();
+
+    /**
+     * Destructor.
+     */
+	virtual	~CSipImResolver();
+
+// from base class CSIPResolvedClient2
+
+    /**
+     * From CSIPResolvedClient2
+     * Defined in a base class
+     */
+    TBool MatchAcceptContactsL( RStringF aMethod,
+                                const CUri8& aRequestUri,
+                                const RPointerArray<CSIPHeaderBase>& aHeaders,
+                                const TDesC8& aContent,
+                                const CSIPContentTypeHeader* aContentType,
+                                TUid& aClientUid );
+
+    /**
+     * From CSIPResolvedClient2
+     * Defined in a base class
+     */
+    TBool MatchEventL( RStringF aMethod,
+                       const CUri8& aRequestUri,
+                       const RPointerArray<CSIPHeaderBase>& aHeaders,
+                       const TDesC8& aContent,
+                       const CSIPContentTypeHeader* aContentType,
+                       TUid& aClientUid );
+
+    /**
+     * From CSIPResolvedClient2
+     * Defined in a base class
+     */
+    TBool MatchRequestL( RStringF aMethod,
+                         const CUri8& aRequestUri,
+                         const RPointerArray<CSIPHeaderBase>& aHeaders,
+                         const TDesC8& aContent,
+                         const CSIPContentTypeHeader* aContentType,
+                         TUid& aClientUid );
+
+    /**
+     * From CSIPResolvedClient2
+     * Defined in a base class
+     */
+    TBool ConnectSupported();
+
+    /**
+     * From CSIPResolvedClient2
+     * Defined in a base class
+     */
+    void ConnectL( const TUid& aClientUid );
+
+    /**
+     * From CSIPResolvedClient2
+     * Defined in a base class
+     */
+    void CancelConnect( const TUid& aClientUid );
+
+    /**
+     * From CSIPResolvedClient2
+     * Defined in a base class
+     */
+    RPointerArray<CSIPContentTypeHeader> SupportedContentTypesL();
+
+    /**
+     * From CSIPResolvedClient2
+     * Defined in a base class
+     */
+    RPointerArray<CSdpMediaField> SupportedSdpMediasL();
+
+    /**
+     * From CSIPResolvedClient2
+     * Defined in a base class
+     */
+    void AddClientSpecificHeadersForOptionsResponseL(
+        RPointerArray<CSIPHeaderBase>& aHeaders );
+
+private:
+
+    CSipImResolver();
+
+private: // data
+
+    /**
+     * Application UID
+     */
+    TUid iApplicationUID;
+    };
+
+#endif // C_SIPIMRESOLVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipimresolver/inc/sipimresolverdebug.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Provides macros for logging and testing
+*
+*/
+
+
+#ifndef SIPIMRESOLVERDEBUG_H
+#define SIPIMRESOLVERDEBUG_H
+
+#include <e32std.h>
+
+//-----------------------------------------------------------------------------
+// LOG/TEST MACROS
+//-----------------------------------------------------------------------------
+
+#ifdef _DEBUG
+    #include <e32svr.h>
+    #define SIPIMRLOG(AA)           { RDebug::Print(_L(AA)); }
+    #define SIPIMRLOGP(AA,BB)       { RDebug::Print(_L(AA),BB); }
+    #define SIPIMR_TEST(AA)         friend class AA; 
+#else
+    #define SIPIMRLOG(AA)           // Example: SIPIMRLOG("Test");
+    #define SIPIMRLOGP(AA,BB)       // Example: SIPIMRLOGP("Test %d", aValue);
+    #define SIPIMR_TEST(AA)
+#endif
+
+#endif  //SIPIMRESOLVERDEBUG_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipimresolver/inc/sipimresolveruids.hrh	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* 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 sipimresolver
+*
+*/
+
+
+#ifndef SIPIMRESOLVERUIDS_H
+#define SIPIMRESOLVERUIDS_H
+
+/**
+ * Plugin DLL UID
+ */
+#define KDllUidSipImResolver 0x2002133C
+
+/**
+ * Interface Implementation UIDs
+ */
+#define KImplUidSipImResolver 0x2002133D
+
+#endif // SIPIMRESOLVERUIDS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipimresolver/rom/sipimresolver.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Image description file for project sipimresolver
+*
+*/
+
+
+#ifndef SIPIMRESOLVER_IBY
+#define SIPIMRESOLVER_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( sipimresolver.dll, 2002133c.rsc )
+
+#endif // SIPIMRESOLVER_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipimresolver/src/sipimresolver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,311 @@
+/*
+* 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 of sipimresolver
+*
+*/
+
+
+#include <spentry.h>
+#include <spproperty.h>
+#include <spsettings.h>
+#include <sdpmediafield.h>
+
+#include "sipimresolver.h"
+#include "csipclientresolverutils.h"
+#include "sipimresolverdebug.h"
+
+// media field descriptors
+_LIT8( KIMField1, "m=application 0 TCP SIPIM\r\n" );
+// For content-type header
+_LIT8( KIMContentType, "text/plain" );
+// For content-type header checks
+_LIT8( KIMMediaTypeApp, "text" );
+// SDP media subtype
+_LIT8( KIMMediaSubtypeSdp, "plain" );
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CleanupSdpMediasArray
+// ---------------------------------------------------------------------------
+//
+void CleanupSdpMediasArray( TAny* aObj )
+    {
+    if ( aObj )
+        {
+        static_cast<RPointerArray<CSdpMediaField>*>( aObj )->
+            ResetAndDestroy();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CleanupSipContentTypeHeaderArray
+// ---------------------------------------------------------------------------
+//
+void CleanupSipContentTypeHeaderArray( TAny* aObj )
+    {
+    if ( aObj )
+        {
+        static_cast<RPointerArray<CSIPContentTypeHeader>*>( aObj )->
+            ResetAndDestroy();
+        }
+    }
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// CSipImResolver::CSipImResolver
+// ---------------------------------------------------------------------------
+//
+CSipImResolver::CSipImResolver() 
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSipImResolver::NewL
+// ---------------------------------------------------------------------------
+//
+CSipImResolver* CSipImResolver::NewL()
+	{
+	SIPIMRLOG( "[SIPIMRESOLVER] -> CSipImResolver::NewL()" )
+	CSipImResolver* self = new ( ELeave ) CSipImResolver;
+	return self;
+	}
+
+// ---------------------------------------------------------------------------
+// CSipImResolver::~CSipImResolver
+// ---------------------------------------------------------------------------
+//
+CSipImResolver::~CSipImResolver()
+	{
+    SIPIMRLOG( "[SIPIMRESOLVER] -> CSipImResolver::~CSipImResolver()" )
+	}
+
+// ---------------------------------------------------------------------------
+// From class CSIPResolvedClient2
+// CSipImResolver::MatchAcceptContactsL
+// ---------------------------------------------------------------------------
+//
+TBool CSipImResolver::MatchAcceptContactsL(
+    RStringF /*aMethod*/,
+    const CUri8& /*aRequestUri*/,
+    const RPointerArray<CSIPHeaderBase>& /*aHeaders*/,
+    const TDesC8& /*aContent*/,
+    const CSIPContentTypeHeader* /*aContentType*/,
+    TUid& /*aClientUid*/ )
+    {
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CSIPResolvedClient2
+// CSipImResolver::MatchEventL
+// ---------------------------------------------------------------------------
+// 
+TBool CSipImResolver::MatchEventL(
+    RStringF /*aMethod*/,
+    const CUri8& /*aRequestUri*/,
+    const RPointerArray<CSIPHeaderBase>& /*aHeaders*/,
+    const TDesC8& /*aContent*/,
+    const CSIPContentTypeHeader* /*aContentType*/,
+    TUid& /*aClientUid*/)
+    {
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CSIPResolvedClient2
+// CSIPImResolver::MatchRequestL
+// ---------------------------------------------------------------------------
+// 
+TBool CSipImResolver::MatchRequestL(
+    RStringF /*aMethod*/,
+    const CUri8& aRequestUri,
+    const RPointerArray<CSIPHeaderBase>& /*aHeaders*/,
+    const TDesC8& aContent,
+    const CSIPContentTypeHeader* aContentType,
+    TUid& aClientUid )
+    {
+    SIPIMRLOG( "[SIPIMRESOLVER] MatchRequetsL() IN" )
+    
+    aClientUid.iUid = 0;
+    RArray<TInt> callProviderIds;
+    CleanupClosePushL( callProviderIds );
+    
+    TBool match( EFalse );
+    TBool imrequest = ( aContent.Length() > 0 && aContentType &&
+        aContentType->MediaType().CompareF( KIMMediaTypeApp ) == 0 &&
+        aContentType->MediaSubtype().CompareF( KIMMediaSubtypeSdp ) == 0 );
+    
+    if( imrequest )
+        {
+        CSPSettings* spSettings = CSPSettings::NewLC();
+        CSPProperty* property = CSPProperty::NewLC();
+        
+        RArray<TUint> serviceIds;
+        CleanupClosePushL( serviceIds );
+        spSettings->FindServiceIdsL( serviceIds );
+        
+        for( TInt i( 0 ) ; i < serviceIds.Count() ; i++ )
+            {
+            TInt err = spSettings->FindPropertyL( 
+                serviceIds[ i ],
+                EPropertyCallProviderPluginId,
+                *property );
+            
+            if ( !err )
+                {
+                TInt callProviderId( 0 );
+                err = property->GetValue( callProviderId );
+                
+                if ( !err )
+                    {
+                    callProviderIds.AppendL( callProviderId );
+                    }
+                }
+            }
+        
+        CleanupStack::PopAndDestroy( &serviceIds );
+        CleanupStack::PopAndDestroy( property );
+        CleanupStack::PopAndDestroy( spSettings ); 
+        
+        CSipClientResolverUtils* resolver = CSipClientResolverUtils::NewLC();
+                
+        RArray<TUid> uids;
+        CleanupClosePushL( uids );
+        
+        TRAPD( err, resolver->GetAllImplementationUidsWithUserL(
+            aRequestUri.Uri().Extract( EUriUserinfo ), uids ) );
+        if ( KErrNotFound != err && KErrNone != err )
+            {
+            User::Leave( err );
+            }
+        TInt imProviderId( KErrNotFound );
+        for ( TInt j( 0 ) ; j < uids.Count() ; j++ )
+            {
+            TInt ret = callProviderIds.Find( uids[ j ].iUid );
+            
+            if ( KErrNotFound == ret )
+                {
+                imProviderId = uids[ j ].iUid;
+                break;
+                }         
+            }
+        
+        CleanupStack::PopAndDestroy( &uids );
+        CleanupStack::PopAndDestroy( resolver );
+        
+        if ( !err && ( KErrNotFound != imProviderId ) )
+            {
+            aClientUid.iUid = imProviderId;
+            match = ETrue;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &callProviderIds );
+    
+    SIPIMRLOGP( "[SIPIMRESOLVER] MatchRequetsL() match = %d", match  )
+    SIPIMRLOGP( "[SIPIMRESOLVER] MatchRequetsL() client uid = %d", aClientUid.iUid  )
+  
+    return match; 
+    }
+
+// ---------------------------------------------------------------------------
+// From class CSIPResolvedClient2
+// CSIPImResolver::ConnectSupported
+// ---------------------------------------------------------------------------
+// 
+TBool CSipImResolver::ConnectSupported()
+    {
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CSIPResolvedClient2
+// CSIPImResolver::ConnectL
+// ---------------------------------------------------------------------------
+//
+void CSipImResolver::ConnectL( const TUid& /*aClientUid*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From class CSIPResolvedClient2
+// CSIPImResolver::CancelConnect
+// ---------------------------------------------------------------------------
+// 
+void CSipImResolver::CancelConnect( const TUid& /*aClientUid*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From class CSIPResolvedClient2
+// CSIPImResolver::SupportedContentTypesL
+// ---------------------------------------------------------------------------
+// 
+RPointerArray<CSIPContentTypeHeader> CSipImResolver::SupportedContentTypesL()
+    {
+    SIPIMRLOG( "[SIPIMRESOLVER] -> CSipImResolver::SupportedContentTypesL()" )
+
+    RPointerArray<CSIPContentTypeHeader> ret;   
+    TCleanupItem tci( CleanupSipContentTypeHeaderArray, &ret );
+    
+    CleanupStack::PushL( tci );
+    CSIPContentTypeHeader* ctype = CSIPContentTypeHeader::DecodeL(
+        KIMContentType );
+    ret.AppendL( ctype );
+    CleanupStack::Pop( ); // TCleanupItem
+
+    SIPIMRLOG( "[SIPIMRESOLVER] <- CSipImResolver::SupportedContentTypesL()" )
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CSIPResolvedClient2
+// CSIPImResolver::SupportedSdpMediasL
+// ---------------------------------------------------------------------------
+// 
+RPointerArray<CSdpMediaField> CSipImResolver::SupportedSdpMediasL()
+    {
+    SIPIMRLOG( "[SIPIMRESOLVER] -> CSipImResolver::SupportedSdpMediasL()" )
+    
+    // Initialise return array
+    RPointerArray<CSdpMediaField> ret;
+    TCleanupItem tci( CleanupSdpMediasArray, &ret );
+    CleanupStack::PushL( tci );  
+    
+    CSdpMediaField* field = CSdpMediaField::DecodeLC( KIMField1 );
+    ret.AppendL( field );
+    CleanupStack::Pop( field );    
+    
+    CleanupStack::Pop( ); // TCleanupItem
+
+    SIPIMRLOG( "[SIPIMRESOLVER] <- CSipImResolver::SupportedSdpMediasL()" )
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CSIPResolvedClient2
+// CSIPImResolver::AddClientSpecificHeadersForOptionsResponseL
+// ---------------------------------------------------------------------------
+// 
+void CSipImResolver::AddClientSpecificHeadersForOptionsResponseL(
+    RPointerArray<CSIPHeaderBase>& /*aHeaders*/ )
+    {
+    // do nothing
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipimresolver/src/sipimresolverimplementationproxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  ECom implementation proxy.
+*
+*/
+
+
+#include "sipimresolver.h"
+#include "sipimresolveruids.hrh"
+
+// LOCAL CONSTANTS AND MACROS
+const TImplementationProxy ImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KImplUidSipImResolver, CSipImResolver::NewL )
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Function to return the implementation 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/voipplugins/sipmxresolver/data/10283140.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Plugin resource definition for SIP MX resolver
+*
+*/
+
+
+// INCLUDES
+#include <registryinfo.rh>
+#include "sipmxresolveruids.h"
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    // UID for the DLL
+    dll_uid = KSIPMXRESOLVERIMPLUID;
+    // Declare array of interface info
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // CSIPResolvedClient2 interface UID
+            interface_uid = 0x10282EE5; 
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KSIPMXRESOLVERIMPLUID;
+                    version_no         = 1;
+                    display_name       = "SIP MX Resolver";
+                    default_data       = "";
+                    opaque_data        = "";
+                    }
+                };
+            }
+        };
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipmxresolver/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SipMXResolver
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+../rom/sipmxresolver.iby CORE_APP_LAYER_IBY_EXPORT_PATH( sipmxresolver.iby )
+
+PRJ_MMPFILES
+//sipmxresolver is included only in builds that have CCE
+sipmxresolver.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipmxresolver/group/sipmxresolver.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  mmp file for sipmxresolver
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "sipmxresolveruids.h"
+
+TARGET          sipmxresolver.dll
+TARGETTYPE      PLUGIN
+
+UID             0x10009D8D KSIPMXRESOLVERIMPLUID
+
+VENDORID        0x101FB657
+
+CAPABILITY      CAP_ECOM_PLUGIN
+
+SOURCEPATH      ../src
+SOURCE          sipmxresolver.cpp
+SOURCE          sipmxresolverimplementationproxy.cpp
+
+LANG            SC
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+USERINCLUDE     .
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+START RESOURCE  ../data/10283140.rss
+TARGET          sipmxresolver.rsc
+END
+
+LIBRARY     euser.lib 
+LIBRARY     ecom.lib
+LIBRARY     flogger.lib
+LIBRARY		bafl.lib
+LIBRARY     sipclient.lib         // sip message decoding
+LIBRARY     sipcodec.lib          //
+LIBRARY		sdpcodec.lib          //
+LIBRARY     ipapputils.lib        // UID resolving
+LIBRARY     inetprotutil.lib      // URI parsing
+LIBRARY		centralrepository.lib // for dynamic voip check
+LIBRARY     featmgr.lib           // feature availability checks
+LIBRARY     musmanagerclient.lib  // multimedia sharing client
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipmxresolver/group/sipmxresolveruids.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 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:  common defines for plugin
+*
+*/
+
+#ifndef __SIPMXRESOLVERUIDS_H__
+#define __SIPMXRESOLVERUIDS_H__
+
+#define KSIPMXRESOLVERIMPLUID 0x10283140
+
+#endif // __SIPMXRESOLVERUIDS_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipmxresolver/inc/sipmxresolver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 sipmxresolver
+*
+*/
+
+#ifndef CSIPMXRESOLVER_H
+#define CSIPMXRESOLVER_H
+
+//  INCLUDES
+#include <apgcli.h>
+#include <e32base.h>
+#include <implementationproxy.h>
+#include <sipresolvedclient2.h>
+#include "sipmxresolverdebug.h"
+
+// FORWARD DECLARATIONS
+class CSdpDocument;
+class CSdpMediaField;
+class CMusManager;
+
+/**
+*  SIP MX Resolver 
+*  
+*  SIP MX Resolver implements CSIPResolvedClient2 ECOM API.
+*  It aids SIP Client Resolver component to route the incoming invites
+*  either to Multimedia Sharing / VoIP client according to
+*  request headers and content. It also takes relevant phone state
+*  variables into account when resolving.
+*  
+*  @lib sipmxresolver
+*  @since Series 60 3.2
+*/
+class CSipMXResolver : public CSIPResolvedClient2
+    {
+public: // Constructors and destructor
+	
+	/**
+	* Two-phased constructor.
+    */
+    static CSipMXResolver* NewL();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSipMXResolver();
+
+
+public: // From CSIPResolvedClient2
+
+	/**
+    * Matches the Accept-Contact-headers
+    * to the client(s) represented by this plug-in.
+    * This function is called for an incoming SIP request
+    * if it contains Accept-Contact-header(s).
+    * 
+    * @param aMethod the method of the SIP request
+    * @param aRequestUri the request-URI of the SIP request
+    * @param aHeaders all the headers in the SIP request
+    * @param aContent SIP request body; 
+    *        zero-length descriptor if not present
+    * @param aContentType the content-type of the SIP request. 
+	*        Zero-pointer if body is not present.
+	* @param aClientUid indicates client's UID for 
+	*        SIP e.g. the one passed as a parameter to CSIP::NewL().
+	* @return ETrue, if the Accept-Contact-headers match to the client
+	*         represented by this plug-in, otherwise EFalse. 
+	*/
+	TBool MatchAcceptContactsL(
+            RStringF aMethod,
+            const CUri8& aRequestUri,
+            const RPointerArray<CSIPHeaderBase>& aHeaders,
+            const TDesC8& aContent,
+            const CSIPContentTypeHeader* aContentType,
+            TUid& aClientUid );
+	
+    /**
+    * Matches the Event-header to the client(s) represented by this plug-in.
+    * This function is called for an incoming SIP request, 
+    * if it contains an Event-header and 
+    * MatchAcceptContactsL returned EFalse.
+    * 
+    * @param aMethod the method of the SIP request
+	* @param aRequestUri the request-URI of the SIP request
+	* @param aHeaders all the headers in the SIP request
+	* @param aContent SIP request body; 
+	*        zero-length descriptor if not present
+	* @param aContentType the content-type of the SIP request. 
+	*        Zero-pointer if body is not present.
+	* @param aClientUid indicates client's UID for 
+	*        SIP e.g. the one passed as a parameter to CSIP::NewL().
+	* @return ETrue, if the Event-header matches to the client
+	*         represented by this plug-in, otherwise EFalse. 
+	*/
+	TBool MatchEventL(
+            RStringF aMethod,
+            const CUri8& aRequestUri,
+            const RPointerArray<CSIPHeaderBase>& aHeaders,
+            const TDesC8& aContent,
+            const CSIPContentTypeHeader* aContentType,
+            TUid& aClientUid );
+	
+	/**
+    * Matches the whole SIP request to the client(s)
+	* represented by this plug-in.
+	* This function is called if the SIP request does not contain
+	* Accept- or Event-headers or
+	* MatchAcceptContactsL and MatchEventL returned EFalse.
+	* 
+	* @param aMethod the method of the SIP request
+	* @param aRequestUri the request-URI of the SIP request
+	* @param aHeaders all the headers in the SIP request
+	* @param aContent SIP request body; 
+	*        zero-length descriptor if not present
+	* @param aContentType the content-type of the SIP request. 
+	*        Zero-pointer if body is not present.
+	* @param aClientUid indicates client's UID for 
+	*        SIP e.g. the one passed as a parameter to CSIP::NewL().
+	* @return ETrue, if the request can be handled by the client
+	*         represented by this plug-in, otherwise EFalse. 
+	*/
+	TBool MatchRequestL(
+            RStringF aMethod,
+            const CUri8& aRequestUri,
+            const RPointerArray<CSIPHeaderBase>& aHeaders,
+            const TDesC8& aContent,
+            const CSIPContentTypeHeader* aContentType,
+            TUid& aClientUid );
+	
+	/**
+	* Indicates whether the plug-in implements CSIPResolvedClient2::ConnectL
+	* and by calling CSIPResolvedClient2::ConnectL 
+	* SIP stack is able to force the client to connect to SIP stack.
+	* 
+	* @return ETrue, if the plug-in supports
+	*         CSIPResolvedClient2::ConnectL, otherwise EFalse.
+	*/
+	TBool ConnectSupported();
+	
+	/**
+	* Requests the client to connect to SIP with resolved
+	* UID in case there's no connection with resolved channel UID.
+	* 
+	* @param aClientUid previously resolved channel UID
+	* @leave KErrNoMemory if out of memory
+	* @leave KErrNotFound in case non-existing channel UID was provided
+	*/
+	void ConnectL( const TUid& aClientUid );
+	
+	/**
+	* Cancels a ConnectL request for a client.
+	* Is called when for example a CANCEL for an INVITE is received
+	* before the client connects to SIP stack.
+	* 
+	* @param aClientUid a UID for which ConnectL was previously called
+	*/
+	void CancelConnect( const TUid& aClientUid );
+	
+	/**
+	* Gets all the SIP message content types supported by the client.
+	* 
+	* @return 0..n SIP Content-Type-headers.
+	*         The ownership of the headers is transferred.
+	*/
+	RPointerArray<CSIPContentTypeHeader> SupportedContentTypesL();
+	
+	/**
+	* Gets all the SDP media-fields supported by the client.
+	* 
+	* @return 0..n SDP media-fields describing the client's media support.
+	*         The ownership of the media-fields is transferred.
+	*/
+	RPointerArray<CSdpMediaField> SupportedSdpMediasL();
+	
+	/**
+    * Adds client specific SIP-headers for the 200 OK for OPTIONS.
+	* Each plug-in must check that the header to be added
+	* is not yet in the array. For example when adding header
+	* "Allow: INVITE" the client must check that
+	* the header is not already present in the array.
+	* 
+	* @param aHeaders headers to be added to 200 OK for OPTIONS.
+	*        The ownership of the added headers is transferred to the caller.
+	*/
+	void AddClientSpecificHeadersForOptionsResponseL(
+            RPointerArray<CSIPHeaderBase>& aHeaders );
+
+
+private: // Constructors
+
+	/**
+    * C++ default constructor.
+	*/
+	CSipMXResolver();
+	
+	/**
+	* By default Symbian 2nd phase constructor is private.
+	*/
+	void ConstructL();
+
+
+private: // New functions
+
+	/**
+	* Checks given header array for accept-contact (AC) headers and
+	* returns ETrue if there is an AC header and it contains
+	* given feature tag.
+	* 
+	* @param aHeaders Headers from request to check
+	* @param aTag Feature specific tag to check AC header for
+	* @ret ETrue if the AC header contain the given feature tag
+	*/
+	TBool CheckForACHeaderTagL(
+            const RPointerArray<CSIPHeaderBase>& aHeaders,
+            const TDesC8& aTag ) const;
+	
+	/**
+	* Checks a SDP document for specified media type lines
+	* 
+	* @param aSpdDoc pointer to sdp document to check for medias
+	* @param aMediaType specifies the media type to check for
+	* @return ETrue if aSpdDoc contains m lines with
+	*         given media type.
+	*/
+	TBool CheckForMedia(
+            CSdpDocument* aSdpDoc,
+            const RStringF& aMediaType ) const;
+
+	/**
+	* Checks given sdp media fields array for VS specific attributes
+	* 
+	* @aFields array of media fields to check
+	* @return ETrue if the given media fields contain
+	*         VS specific attributes
+	*/
+	TBool CheckForVSAttributes(
+            RPointerArray<CSdpMediaField>& aFields ) const;
+	
+	/**
+	* Checks if a CS call is ongoing. This information is
+	* used in the resolving logic.
+	* 
+	* @return ETrue if there is an active CS call
+	*/
+	TBool IsCSCallActive() const;
+	
+	/**
+	* Resolves the Uid to return in VS cases based on request method
+	* 
+	* @param aMethod SIP request method
+	* @return Uid that corresponds to the given method. KNullUid if no match.
+	*/
+	TUid ResolveVSUidL( const RStringF& aMethod );
+	
+	/**
+	* Resolves the Uid of CCP plugin if VoIP is recogniced
+	* 
+	* @param aUid Resolved UID
+	* @param aRequestUri URI received in request
+	*/
+	void ResolveCPPluginUidL( TUid& aUid, const CUri8& aRequestUri );
+
+
+private: // Data
+        
+	///own: VoIP availability status
+	TBool iVoIPEnabled;
+	///own: Multimedia Sharing client for Uid resolving
+	CMusManager* iMuSManager;
+	///own: RStringF handles to video/audio media strings from SIPStrings
+	RStringF iVideoType;
+	RStringF iAudioType;
+	///own: String pool closing control; if ETrue, pool is closed in dtor
+	TBool iCloseStringPool;
+	
+	SIPMXR_TEST( UT_CSipMXResolver ) // for unit tests
+	
+    };
+
+#endif  // CSIPMXRESOLVER_H   
+            
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipmxresolver/inc/sipmxresolverdebug.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 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:  Provides macros for logging and testing
+*
+*/
+
+
+
+#ifndef SIPMXRESOLVERDEBUG_H
+#define SIPMXRESOLVERDEBUG_H
+
+//  INCLUDES
+#include <e32def.h>
+
+//-----------------------------------------------------------------------------
+// LOG/TEST MACROS
+//-----------------------------------------------------------------------------
+
+#ifdef _DEBUG
+    #include <e32svr.h>
+    #define SIPMXRLOG(AA)           { RDebug::Print(_L(AA)); }
+    #define SIPMXRLOGP(AA,BB)       { RDebug::Print(_L(AA),BB); }
+    #define SIPMXR_TEST(AA)         friend class AA; 
+#else
+    #define SIPMXRLOG(AA)           // Example: SIPMXRLOG("Test");
+    #define SIPMXRLOGP(AA,BB)       // Example: SIPMXRLOGP("Test %d", aValue);
+    #define SIPMXR_TEST(AA)
+#endif
+
+#endif  //SIPMXRESOLVERDEBUG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipmxresolver/rom/sipmxresolver.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,24 @@
+/*
+* 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:  Image description file for project sipmxresolver
+*
+*/
+
+
+#ifndef SIPMXRESOLVER_IBY
+#define SIPMXRESOLVER_IBY
+
+ECOM_PLUGIN( sipmxresolver.dll, 10283140.rsc )
+
+#endif // SIPMXRESOLVER_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipmxresolver/src/sipmxresolver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,759 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 sipmxresolver
+*
+*/
+
+
+// INCLUDE FILES
+#include "sipmxresolver.h"
+#include "csipclientresolverutils.h"
+#include <e32base.h>
+#include <e32std.h>
+#include <e32property.h>
+
+//for checking CS call status
+#include <ctsydomainpskeys.h>
+
+//SIP message content parsing APIs
+#include <sipheaderbase.h>
+#include <sipacceptcontactheader.h>
+#include <sipaddress.h>
+#include <sdpdocument.h>
+#include <sdpmediafield.h>
+#include <sdpcodecstringpool.h>
+#include <sdpcodecstringconstants.h>
+#include <sdpattributefield.h>
+#include <sipstrings.h>
+#include <sipallowheader.h>
+#include <sipsupportedheader.h>
+
+//For checking dynamic voip status and MuS availability
+#include <featmgr.h>
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h>
+
+//Multimedia Sharing client API
+#include <musmanager.h>
+
+//Incoming Call Monitor API
+#include <icmapi.h>
+
+
+// CONSTANTS
+_LIT8( KFTagChar, "+" ); 						// All feature tags start with +
+_LIT8( KVSFeatureTag, "+g.3gpp.cs-voice" );		// For checking VS specific tag
+_LIT8( KPoCFeatureTag, "+g.poc.talkburst" ); 	// PoC specific tag (for ruling out)
+_LIT8( KContentType, "application/sdp" );		// For content-type header
+_LIT8( KMediaTypeApp, "application" );        	// For content-type header checks
+_LIT8( KMediaSubtypeSdp, "sdp" );            	// For content-type header checks
+_LIT8( KSendOnly, "sendonly" );            		// For attribute checks
+_LIT8( KApplicationAttr, "application" );   	// For attribute checks
+_LIT8( KXApplicationAttr, "X-application" );	// For attribute checks
+_LIT8( KNokiaRtvs, "com.nokia.rtvs" );       	// For attribute checks
+_LIT8( KSIPMethodsInAllowHeader, "INVITE,ACK,CANCEL,OPTIONS,BYE,PRACK,SUBSCRIBE,REFER,NOTIFY,UPDATE");	// SIP Methods allowed by various plugins
+_LIT8( KSIPExtensionsSupported, "100rel,timer,sec-agree"); //Extensions supported by various plugins
+
+/**
+ * Cleanup function for RPointerArray
+ * Called in case of a leave in SupportedSdpMediasL
+ */
+void CleanupSdpMediasArray( TAny* aObj )
+    {
+    if ( aObj )
+        {
+        static_cast<RPointerArray<CSdpMediaField>*>( aObj )->ResetAndDestroy();
+        }
+    }
+
+
+// ============================ MEMBER FUNCTIONS =============================
+// ---------------------------------------------------------------------------
+// CSipMXResolver::CSipMXResolver
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CSipMXResolver::CSipMXResolver() 
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+// 
+void CSipMXResolver::ConstructL()
+    {
+    SIPMXRLOG( "[SIPMXRESOLVER] -> CSipMXResolver::ConstructL()" )
+    
+    // Open sdp string pool (needed in media field checks)
+    TRAPD( err, SdpCodecStringPool::OpenL() );
+    
+    switch ( err )
+	    {
+    	case KErrNone:
+	    	{
+	    	//close pool at destructor, not opened by others
+			iCloseStringPool = ETrue;
+			break;
+	    	}
+	    
+	    case KErrAlreadyExists:
+	    	{
+	    	//already opened, do not try to close at destructor
+	    	iCloseStringPool = EFalse;
+	    	break;
+	    	}
+	    
+	    default:
+	    	{
+	    	User::Leave( err );
+	    	}
+	    }
+    
+    // Check VoIP and Multimedia Sharing availability
+    FeatureManager::InitializeLibL();
+    
+    TInt dynvoip = 0;
+    CRepository* repository = CRepository::NewL( KCRUidTelephonySettings );
+    repository->Get( KDynamicVoIP, dynvoip );
+    delete repository;
+    
+    iVoIPEnabled = ( dynvoip && FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) );
+    
+    if ( FeatureManager::FeatureSupported( KFeatureIdMultimediaSharing ) )
+        {
+        iMuSManager = CMusManager::NewL();
+        }
+    
+    FeatureManager::UnInitializeLib();
+    
+    // initialize media type strings
+    iAudioType = SdpCodecStringPool::StringPoolL().StringF(
+                    SdpCodecStringConstants::EMediaAudio,
+                        SdpCodecStringPool::StringTableL() );
+    
+    iVideoType = SdpCodecStringPool::StringPoolL().StringF(
+                    SdpCodecStringConstants::EMediaVideo,
+                        SdpCodecStringPool::StringTableL() );
+    
+    SIPMXRLOG( "[SIPMXRESOLVER] <- CSipMXResolver::ConstructL()" )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+// 
+CSipMXResolver* CSipMXResolver::NewL()
+    {
+    CSipMXResolver* self = new( ELeave ) CSipMXResolver;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self);
+    return self;
+    }
+
+
+// Destructor
+CSipMXResolver::~CSipMXResolver()
+    {
+    SIPMXRLOG( "[SIPMXRESOLVER] -> CSipMXResolver::~CSipMXResolver()" )
+    
+    delete iMuSManager;
+    iAudioType.Close();
+    iVideoType.Close();
+    
+    if ( iCloseStringPool )
+	    {
+	    SdpCodecStringPool::Close();
+	    }
+    
+    SIPMXRLOG( "[SIPMXRESOLVER] <- CSipMXResolver::~CSipMXResolver()" )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::MatchAcceptContactsL
+// ---------------------------------------------------------------------------
+// 
+TBool CSipMXResolver::MatchAcceptContactsL(
+            RStringF aMethod,
+            const CUri8& /*aRequestUri*/,
+            const RPointerArray<CSIPHeaderBase>& aHeaders,
+            const TDesC8& /*aContent*/,
+            const CSIPContentTypeHeader* /*aContentType*/,
+            TUid& aClientUid )
+    {
+    SIPMXRLOG( "[SIPMXRESOLVER] -> CSipMXResolver::MatchAcceptContactsL()" )
+    
+    TBool match = EFalse;
+    
+    // check if we have active CS call
+    // and MM Sharing is enabled (otherwise this can't be MuS)
+    if ( iMuSManager && IsCSCallActive() )
+        {
+        if ( CheckForACHeaderTagL( aHeaders, KVSFeatureTag ) )
+            {
+            match = ETrue;
+            aClientUid = ResolveVSUidL( aMethod );
+            }
+        }
+    
+    SIPMXRLOGP( \
+    "[SIPMXRESOLVER] <- CSipMXResolver::MatchAcceptContactsL(), ret:%d", match )
+    return match;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::MatchEventL
+// ---------------------------------------------------------------------------
+// 
+TBool CSipMXResolver::MatchEventL(
+            RStringF /*aMethod*/,
+            const CUri8& /*aRequestUri*/,
+            const RPointerArray<CSIPHeaderBase>& /*aHeaders*/,
+            const TDesC8& /*aContent*/,
+            const CSIPContentTypeHeader* /*aContentType*/,
+            TUid& /*aClientUid*/)
+    {
+    //SipMXResolver returns always EFalse for MatchEventL calls
+    SIPMXRLOG( "[SIPMXRESOLVER] <-> CSipMXResolver::MatchEventL()" )
+    return EFalse;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::MatchRequestL
+// ---------------------------------------------------------------------------
+// 
+TBool CSipMXResolver::MatchRequestL(
+            RStringF aMethod,
+            const CUri8& aRequestUri,
+            const RPointerArray<CSIPHeaderBase>& aHeaders,
+            const TDesC8& aContent,
+            const CSIPContentTypeHeader* aContentType,
+            TUid& aClientUid )
+    {
+    SIPMXRLOG( "[SIPMXRESOLVER] -> CSipMXResolver::MatchRequestL()" )
+    
+    TBool match = EFalse;
+    
+    //poc specific requests will not be processed
+    TBool poc = CheckForACHeaderTagL( aHeaders, KPoCFeatureTag );
+    
+    //OPTIONS and INVITE requests are processed
+    TBool requestok = ( aMethod == SIPStrings::StringF( SipStrConsts::EOptions ) ||
+         aMethod == SIPStrings::StringF( SipStrConsts::EInvite ) );
+    
+    //application/sdp content type is required
+    TBool contentok = ( aContent.Length() > 0 && aContentType &&
+         aContentType->MediaType().CompareF( KMediaTypeApp ) == 0 &&
+         aContentType->MediaSubtype().CompareF( KMediaSubtypeSdp ) == 0 );
+    
+    // do further checks only if we have either VoIP and/or MuS active,
+    // content type must be valid and accept-contact is not poc specific
+    if ( ( iVoIPEnabled || iMuSManager ) && requestok && contentok && !poc )
+        {
+        CSdpDocument* sdpDocument = CSdpDocument::DecodeLC( aContent );
+        
+        // determine the parameters
+        TBool hasAudio = CheckForMedia( sdpDocument, iAudioType );
+        TBool hasVideo = CheckForMedia( sdpDocument, iVideoType );
+        TBool cscall = IsCSCallActive();
+        
+        if ( iMuSManager && hasVideo && hasAudio && cscall )
+            {
+            // both audio and video medias present and cs call on
+            // and multimedia sharing enabled =>
+            // we need to do some further resolving for client
+            if ( CheckForVSAttributes( sdpDocument->MediaFields() ) )
+                {
+                // this is VS
+                match = ETrue;
+                aClientUid = ResolveVSUidL( aMethod );
+                }
+            else if ( iVoIPEnabled )
+                {
+                // no vs attributes and voip status is enabled
+                match = ETrue;
+                ResolveCPPluginUidL( aClientUid, aRequestUri );
+                }
+            else
+                {
+                // possible voip match, but voip not activated
+                match = EFalse;
+                }
+            }
+        else if ( iMuSManager && hasVideo && cscall )
+            {
+            //video media only && cs call ongoing && multimedia sharing enabled
+            // => Multimedia Sharing
+            match = ETrue;
+            aClientUid = ResolveVSUidL( aMethod );
+            }
+        else if ( hasAudio && iVoIPEnabled )
+            {
+            // audio only or audio and video and no cs call + voip supported
+            // => this is VoIP
+            match = ETrue;
+            ResolveCPPluginUidL( aClientUid, aRequestUri );
+            }
+        else
+            {
+            // no medias or has video but no CS call or has audio
+            // but voip status is disabled 
+            // => no match
+            match = EFalse;
+            }
+        
+        CleanupStack::PopAndDestroy( sdpDocument );
+        }
+    else if ( aMethod == SIPStrings::StringF( SipStrConsts::EInvite ) &&
+    		  iVoIPEnabled && !poc && aContent.Length() == 0 )
+    	{
+    	// Pull model: this is a re-Invite without content
+    	ResolveCPPluginUidL( aClientUid, aRequestUri );
+    	match = ETrue;
+    	}
+    else
+    	{
+    	//no match
+    	match = EFalse;
+        }
+    
+    SIPMXRLOGP( \
+    "[SIPMXRESOLVER] <- CSipMXResolver::MatchRequestL(), ret:%d", match )
+    return match;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::ConnectSupported
+// ---------------------------------------------------------------------------
+// 
+TBool CSipMXResolver::ConnectSupported()
+    {
+    return ETrue;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::ConnectL
+// ---------------------------------------------------------------------------
+//
+void CSipMXResolver::ConnectL( const TUid& aClientUid )
+    {
+    SIPMXRLOGP(\
+    "[SIPMXRESOLVER] -> CSipMXResolver::ConnectL(), uid:%d", aClientUid.iUid )
+    
+    // If Uid matches with MuS, forward to MusManager
+    if ( iMuSManager &&
+         ( aClientUid.iUid == CMusManager::ESipOptions ||
+           aClientUid.iUid == CMusManager::ESipInviteDesired ||
+           aClientUid.iUid == CMusManager::ESipInviteNotDesired ) )
+        {
+        iMuSManager->HandleSipRequestL(
+                  ( CMusManager::TRequestType ) aClientUid.iUid );
+        }
+    else
+        {
+        // start through ICM
+        TInt result = RProperty::Set( KPSUidICMIncomingCall,
+        		KPropertyKeyICMPluginUID, aClientUid.iUid );
+        User::LeaveIfError( result );
+        }
+    
+    SIPMXRLOG( "[SIPMXRESOLVER] <- CSipMXResolver::ConnectL()" )
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::CancelConnect
+// ---------------------------------------------------------------------------
+// 
+void CSipMXResolver::CancelConnect( const TUid& /*aClientUid*/ )
+    {
+    SIPMXRLOG( "[SIPMXRESOLVER] <-> CSipMXResolver::CancelConnect()" )
+    // No implementation for VoIP / MuS.
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::SupportedContentTypesL
+// ---------------------------------------------------------------------------
+// 
+RPointerArray<CSIPContentTypeHeader> CSipMXResolver::SupportedContentTypesL()
+    {
+    RPointerArray<CSIPContentTypeHeader> ret;
+    
+    CSIPContentTypeHeader* ctype = CSIPContentTypeHeader::DecodeL( KContentType );
+    CleanupStack::PushL( ctype );
+    ret.AppendL( ctype );
+    CleanupStack::Pop( ctype );
+    
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::SupportedSdpMediasL
+// ---------------------------------------------------------------------------
+// 
+RPointerArray<CSdpMediaField> CSipMXResolver::SupportedSdpMediasL()
+    {
+    // Initialise return array
+    RPointerArray<CSdpMediaField> ret;
+    TCleanupItem tci( CleanupSdpMediasArray, &ret );
+    CleanupStack::PushL( tci );
+    
+    // media field descriptors
+    _LIT8( KMuSField1, "m=video 0 RTP/AVP 96\r\na=application:com.nokia.rtvs\r\na=X-application:com.nokia.rtvs\r\n" );
+    _LIT8( KMuSField2, "m=audio 0 RTP/AVP 97\r\n" );
+    _LIT8( KVoIPField1, "m=video 0 RTP/AVP 0\r\n" );
+    _LIT8( KVoIPField2, "m=application 0 tcp wb\r\n" );
+    _LIT8( KVoIPField3, "m=audio 0 RTP/AVP 0\r\n" );
+    _LIT8( KVoIPField4, "m=audio 0 RTP/SAVP 0\r\n" );
+    
+    CSdpMediaField* field = NULL;
+    
+    // add media fields to array
+    if ( iMuSManager )
+        {
+        field = CSdpMediaField::DecodeLC( KMuSField1 );
+        ret.AppendL( field ); // ownership to array
+        CleanupStack::Pop( field );
+        
+        field = CSdpMediaField::DecodeLC( KMuSField2 );
+        ret.AppendL( field );
+        CleanupStack::Pop( field );
+        }
+    
+    if ( iVoIPEnabled )
+        {
+        field = CSdpMediaField::DecodeLC( KVoIPField1 );
+        ret.AppendL( field );
+        CleanupStack::Pop( field );
+        
+        field = CSdpMediaField::DecodeLC( KVoIPField2 );
+        ret.AppendL( field );
+        CleanupStack::Pop( field );
+        
+        field = CSdpMediaField::DecodeLC( KVoIPField3 );
+        ret.AppendL( field );
+        CleanupStack::Pop( field );
+        
+        field = CSdpMediaField::DecodeLC( KVoIPField4 );
+        ret.AppendL( field );
+        CleanupStack::Pop( field );
+        }
+    
+    CleanupStack::Pop(); // tcleanupitem
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::AddClientSpecificHeadersForOptionsResponseL
+// ---------------------------------------------------------------------------
+// 
+void CSipMXResolver::AddClientSpecificHeadersForOptionsResponseL(
+    RPointerArray<CSIPHeaderBase>& aHeaders )
+    {
+    SIPMXRLOG( "[SIPMXRESOLVER] -> \
+    CSipMXResolver::AddClientSpecificHeadersForOptionsResponseL()" )
+	//Add Allow Header		
+	RPointerArray<CSIPAllowHeader> allowheaders = 
+	    CSIPAllowHeader::DecodeL(KSIPMethodsInAllowHeader);
+	TInt count = allowheaders.Count();
+	for(TInt i = 0; i<count; i++)
+		{
+		User::LeaveIfError(aHeaders.Append(allowheaders[i]));
+		}
+	allowheaders.Reset();
+
+	//Add Supported Header
+	RPointerArray<CSIPSupportedHeader> supportedheaders = 
+	    CSIPSupportedHeader::DecodeL(KSIPExtensionsSupported);
+	count = supportedheaders.Count();
+	for(TInt j = 0; j<count; j++)
+		{
+		User::LeaveIfError(aHeaders.Append(supportedheaders[j]));
+		}
+	supportedheaders.Reset();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::IsCsCallActive
+// ---------------------------------------------------------------------------
+// 
+TBool CSipMXResolver::IsCSCallActive() const
+    {
+    SIPMXRLOG( "[SIPMXRESOLVER] -> CSipMXResolver::IsCSCallActive()" )
+    
+    TBool retval = EFalse;
+    
+    TInt callType = KErrNone;
+    RProperty::Get( KPSUidCtsyCallInformation,
+    		KCTsyCallType, callType );
+    
+    if ( EPSCTsyCallTypeCSVoice == callType )
+        {
+        TInt callState = KErrNone;
+        RProperty::Get( KPSUidCtsyCallInformation,
+        		KCTsyCallState, callState );
+        
+        if ( EPSCTsyCallStateConnected == callState ||
+             EPSCTsyCallStateHold == callState )
+            {
+            retval = ETrue;
+            }
+        }
+    
+    SIPMXRLOGP( \
+    "[SIPMXRESOLVER] <- CSipMXResolver::IsCSCallActive(), ret:%d", retval )
+    
+    return retval;
+    }
+
+// -----------------------------------------------------------------------------
+// CSipMXResolver::CheckForMedia
+// -----------------------------------------------------------------------------
+//
+TBool CSipMXResolver::CheckForMedia( CSdpDocument* aSdpDoc,
+    const RStringF& aMediaType ) const
+    {
+    SIPMXRLOG( "[SIPMXRESOLVER] -> CSipMXResolver::CheckForMedia()" )
+    
+    TBool present = EFalse;
+    
+    if ( aSdpDoc )
+        {
+        RPointerArray<CSdpMediaField>& mFields = aSdpDoc->MediaFields();
+        const TInt count = mFields.Count();
+        
+        // if there is media fields, check them for type
+        for ( TInt i = 0; i < count && !present; i++ )
+            {
+            if ( aMediaType == mFields[ i ]->Media() )
+                {
+                present = ETrue;
+                }
+            }
+        }
+    
+    SIPMXRLOGP( \
+    "[SIPMXRESOLVER] <- CSipMXResolver::CheckForMedia(), ret:%d", present )
+    
+    return present;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::CheckForACHeaderTagL
+// ---------------------------------------------------------------------------
+// 
+TBool CSipMXResolver::CheckForACHeaderTagL(
+    const RPointerArray<CSIPHeaderBase>& aHeaders,
+    const TDesC8& aTag ) const
+    {
+    TBool match = EFalse;
+    TInt ftagcount = 0;
+    
+    for ( TInt i = 0; i < aHeaders.Count(); i++ )
+        {
+        if ( aHeaders[i]->Name() ==
+             SIPStrings::StringF( SipStrConsts::EAcceptContactHeader ) ||
+             aHeaders[i]->Name() ==
+             SIPStrings::StringF( SipStrConsts::EAcceptContactHeaderCompact ) )
+            {
+            RStringF featureTagStr = SIPStrings::Pool().OpenFStringL( aTag );
+            CleanupClosePushL( featureTagStr );
+            
+            CSIPAcceptContactHeader* ach = 
+                static_cast<CSIPAcceptContactHeader*>(aHeaders[i]);
+            TInt pcount = ach->ParamCount();
+            
+            for ( TInt p = 0; p < pcount; p++ )
+                {
+                RStringF mparam;
+                CleanupClosePushL( mparam );
+                
+                if ( KErrNone == ach->Param( p, mparam ) )
+                    {
+                    //we need to count all feature tags
+                    if ( mparam.DesC().Left(1).Compare( KFTagChar ) == 0 )
+                        {
+                        ftagcount++;
+                        }
+                    if ( mparam == featureTagStr )
+                        {
+                        match = ETrue;
+                        //loop is continued after match to count feature tags
+                        }
+                    }
+                
+                CleanupStack::PopAndDestroy( 1 ); //mparam
+                }
+            
+            // Use the dynamic string.
+            CleanupStack::PopAndDestroy( 1 ); // featureTagStr
+            }
+        }
+    
+    //return ETrue only if there's only one feature tag and it is MuS specific
+    return ( match && ftagcount == 1 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::CheckForVSAttributesL
+// ---------------------------------------------------------------------------
+// 
+TBool CSipMXResolver::CheckForVSAttributes(
+    RPointerArray<CSdpMediaField>& aFields ) const
+    {
+    SIPMXRLOG( "[SIPMXRESOLVER] -> CSipMXResolver::CheckForVSAttributes()" )
+    
+    TBool vsattributefound = EFalse;
+    TInt sendonlycount = 0; 
+    TInt videofields = 0;
+    const TInt fieldcount = aFields.Count();
+    
+    for ( TInt i = 0; i < fieldcount; i++ )
+        {
+        CSdpMediaField* mField = aFields[i];
+        
+        //only check audio/video fields
+        TBool audio = mField->Media() == iAudioType;
+        TBool video = mField->Media() == iVideoType;
+        
+        if ( video )
+            {
+            videofields++;
+            }
+        
+        if ( video || audio )
+            {
+            RPointerArray< CSdpAttributeField > attrList =
+                mField->AttributeFields();
+            
+            TInt attrCount = attrList.Count();
+            for (TInt j = 0; j < attrCount && !vsattributefound; j++ )
+                {
+                CSdpAttributeField* attributeField = attrList[j];
+                RStringF attribute = attributeField->Attribute();
+                
+                // for each sendonly attribute, add counter
+                if ( KErrNotFound != attribute.DesC().FindF( KSendOnly ) )
+                    {
+                    sendonlycount++;                        
+                    }
+                
+                // check m=video fields for com.nokia.rtvs attribute
+                if ( video )
+                    {
+                    if ( ( KErrNotFound !=
+                           attribute.DesC().FindF( KApplicationAttr ) ||
+                           KErrNotFound !=
+                           attribute.DesC().FindF( KXApplicationAttr ) ) &&
+                         KErrNotFound !=
+                         attributeField->Value().FindF( KNokiaRtvs ) )
+                        {
+                        //attribute found
+                        vsattributefound = ETrue;
+                        }
+                    }
+                }
+            }
+        }
+    
+    // Video Sharing is assumed if nokia vs specific attributes are found
+    // or if there is at least one m=video line and all media fields have
+    // sendonly attribute.
+    TBool retval = ( vsattributefound ||
+        		     ( videofields > 0 && fieldcount == sendonlycount ) );
+    
+    SIPMXRLOGP( \
+    "[SIPMXRESOLVER] <- CSipMXResolver::CheckForVSAttributes(),ret:%d", retval )
+    
+    return retval;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSipMXResolver::ResolveVSUid
+// ---------------------------------------------------------------------------
+// 
+TUid CSipMXResolver::ResolveVSUidL( const RStringF& aMethod )
+    {
+    SIPMXRLOG( "[SIPMXRESOLVER] -> CSipMXResolver::ResolveVSUidL()" )
+    
+    TUid muid  = KNullUid;
+    
+    if ( iMuSManager )
+        {
+        if ( aMethod == SIPStrings::StringF( SipStrConsts::EOptions ) )
+            {
+            muid.iUid = ( TInt32 ) CMusManager::ESipOptions;
+            }
+        else
+            {
+            MultimediaSharing::TMusAvailabilityStatus capability =
+            	iMuSManager->AvailabilityL();
+            
+            //check if availability value is from non-error-range
+            if( capability >= KErrNone &&
+                capability < MultimediaSharing::EErrSipRegistration )
+                {
+                muid.iUid = ( TInt32 ) CMusManager::ESipInviteDesired;
+                }
+            else
+                {
+                muid.iUid = ( TInt32 ) CMusManager::ESipInviteNotDesired;
+                }
+            }
+        }
+    
+    SIPMXRLOGP( \
+    "[SIPMXRESOLVER] <- CSipMXResolver::ResolveVSUidL(), ret:%d", muid.iUid )
+    
+    return muid;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CSipMXResolver::ResolveCPPluginUidL
+// -----------------------------------------------------------------------------
+// 
+void CSipMXResolver::ResolveCPPluginUidL( TUid& aUid, const CUri8& aRequestUri )
+    {
+    SIPMXRLOG( "[SIPMXRESOLVER] -> CSipMXResolver::ResolveCPPluginUidL()" )
+    
+    CSipClientResolverUtils* resolver = CSipClientResolverUtils::NewLC();
+    resolver->GetImplementationUidWithUserL(
+    		aRequestUri.Uri().Extract( EUriUserinfo ), aUid );
+    CleanupStack::PopAndDestroy( resolver );
+    
+    SIPMXRLOGP( \
+    "[SIPMXRESOLVER] <- CSipMXResolver::ResolveCPPluginUidL(),uID:%d", aUid.iUid )
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/sipmxresolver/src/sipmxresolverimplementationproxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,49 @@
+/*
+* 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:  ECOM implementation proxy for sipmxresolver
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include "sipmxresolver.h"
+#include <e32svr.h>
+#include "sipmxresolveruids.h"
+
+// Exported proxy for instantiation method resolution
+// Use the interface implementation UID and Implementation factory method
+// as a pair for ECom instantiation.
+const TImplementationProxy Implementations[] = 
+    {
+    // Remove PCLint warning "Suspicious cast"
+    //lint -e611
+    IMPLEMENTATION_PROXY_ENTRY( KSIPMXRESOLVERIMPLUID, CSipMXResolver::NewL )
+    //lint +e611
+    };
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Function to return the implementation proxy table 
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+    {
+    aTableCount = sizeof( Implementations ) / sizeof( TImplementationProxy );
+    return Implementations;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtcallmenu/data/2001E2C7.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Resource definitions for project svtcallmenu
+*
+*/
+
+
+#include <eikon.rh>
+#include <registryinfov2.rh>
+
+
+
+//  RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+//   
+// theInfo
+// REGISTRY_INFO for ECom
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2; 
+    dll_uid = 0x2001E2C7;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x2001E2A0;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2001E2A1;
+                    version_no = 1;
+                    display_name = "SIP VoIP Menu Extension";
+                    default_data = "";
+                    opaque_data = "";
+                    rom_only = 0;
+                    }             
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtcallmenu/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -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 project svtcallmenu
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// IBY files
+../rom/svtcallmenu.iby                              CORE_APP_LAYER_IBY_EXPORT_PATH(svtcallmenu.iby)
+
+PRJ_MMPFILES
+svtcallmenu.mmp
+//../internal/tsrc/sipmatchingplugin_ut/group/t_csipmatchingplugin.mmp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtcallmenu/group/svtcallmenu.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Project definition file for project svtcallmenu
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET    	svtcallmenu.dll
+TARGETTYPE  PLUGIN
+UID 	    0x10009D8D 0x2001E2C7
+
+CAPABILITY  CAP_ECOM_PLUGIN
+VENDORID    VID_DEFAULT
+
+SOURCEPATH  ../src
+SOURCE      svtcallmenu.cpp
+SOURCE      svtcallstatehandler.cpp
+SOURCE      csvtcallmenuimplementationproxy.cpp
+
+
+USERINCLUDE ../inc
+USERINCLUDE ../data
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+//ECOM resource definition
+START RESOURCE  ../data/2001E2C7.rss
+TARGET          svtcallmenu.rsc                                                              
+END
+
+
+LIBRARY     ecom.lib
+LIBRARY     euser.lib
+LIBRARY     eikcoctl.lib // CEikMenuPane
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtcallmenu/inc/svtcallmenu.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Main class for svtcallmenu.
+*
+*/
+
+
+#ifndef C_SCMTELCALLMENU_H
+#define C_SCMTELCALLMENU_H
+
+#include <telmenuextension.h>
+
+class CSvtCallStateHandler;
+
+/**
+ *  Main class for svtcallmenu.
+ *
+ *  @lib svtcallmenu
+ *  @since S60 v5.1
+ */
+NONSHARABLE_CLASS(CSvtCallMenu) :
+    public CTelMenuExtension
+  {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSvtCallMenu* NewL();
+  
+  
+    /**
+     * Destructor.
+     */
+    ~CSvtCallMenu();
+
+    
+// from base class CTelMenuExtension
+        
+    /**
+     * Modifys given menu pane. Removes unsupported options from call menu and 
+     * adds custom menu commands to the menu.
+     *
+     * @param aCallArray - Array holding information of all ongoing calls.
+     * @param aMenuPane - A modifyable menu pane.
+     */
+    void ModifyExtensionsCallMenuL( 
+            const RArray<CTelMenuExtension::TCallInfo>& aCallArray,
+            CEikMenuPane& aMenuPane );
+
+    /**
+     * Modifys given touch pane buttons. Dimms unsupported buttons from the
+     * pane.
+     *
+     * @param aCallArray - Array holding information of all ongoing calls.
+     * @param aTouchPane - A touch pane interface.
+     */
+    void ModifyExtensionsTouchPaneButtonsL( 
+                    const RArray<CTelMenuExtension::TCallInfo>& aCallArray,
+                    MTelTouchPaneExtension& aTouchPane );
+    
+    /**
+     * Handles custom menu commands.
+     *
+     * @param aCommand It is the code of the command to be handled.
+     * @return boolean value was the command handled (ETrue) or not (EFalse).
+     */
+    TBool HandleCommandL( TInt aCommand );
+
+
+private:
+    
+    CSvtCallMenu();
+
+    /**
+     * Creates new call state handler.
+     *
+     * @param aCallArray - Array holding information of all ongoing calls.
+     */
+    void CreateCallStateHandlerL( 
+            const RArray<CTelMenuExtension::TCallInfo>& aCallArray );
+      
+private:    // data
+
+    /**
+     * Pointer to call state handler.
+     * Own.
+     */
+    CSvtCallStateHandler* iCallStateHandler; 
+
+ 
+#ifdef _DEBUG   
+    friend class T_CSvtCallMenuPlugin;
+#endif
+    
+  };  
+
+#endif  // C_SCMTELCALLMENU_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtcallmenu/inc/svtcallstatehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Call handler class for svtcallmenu.
+*
+*/
+
+
+#ifndef C_SVTCALLSTATEHANDLER_H
+#define C_SVTCALLSTATEHANDLER_H
+
+#include <e32base.h>
+#include <telmenuextension.h>
+
+/**
+ *  Call state handler class for svtmatching.
+ *
+ *  @lib svtmatching
+ *  @since S60 v5.1
+ */
+NONSHARABLE_CLASS( CSvtCallStateHandler ) : public CBase
+    {
+public: // Data
+    
+    /**
+     * Features
+     */
+    enum TFeature
+        {
+        ESvmFeatureNone,
+        ESvmFeatureConference,
+        ESvmFeatureUnattendedTransfer,
+        ESvmFeatureAttendedTransfer
+        };
+    
+    
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aCallArray Current call info array.
+     */
+    static CSvtCallStateHandler* NewL( 
+            const RArray<CTelMenuExtension::TCallInfo>& aCallArray );
+  
+  
+    /**
+     * Destructor.
+     */
+    virtual ~CSvtCallStateHandler();
+ 
+    /**
+     * Checks is feature supported.
+     * @param aFeature - Feature to be checked.
+     * @return ETrue if feature supported.
+     */    
+    TBool FeatureSupported( TFeature aFeature ) const;
+ 
+    
+private:
+
+    CSvtCallStateHandler();
+
+    void ConstructL( const RArray<CTelMenuExtension::TCallInfo>& aCallArray );
+    
+    /**
+     * Checks is unattended transfer currently supported.
+     * @return ETrue if supported.
+     */  
+    TBool UnattendedTransferPossible() const;
+    
+private: // Data
+
+    /**
+     * Current call information.
+     */
+    RArray<CTelMenuExtension::TCallInfo> iCallArray;
+    
+
+#ifdef _DEBUG    
+    friend class T_CSvtCallStateHandler;
+#endif
+    
+    };
+
+#endif // C_SVTCALLSTATEHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtcallmenu/rom/svtcallmenu.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 description file for project svtcallmenu
+*
+*/
+
+
+#include <data_caging_paths_for_iby.hrh>
+
+#ifndef SIPVOIPTELMENU_IBY
+#define SIPVOIPTELMENU_IBY
+
+ECOM_PLUGIN( svtcallmenu.dll, 2001E2C7.rsc )
+
+#endif // SIPVOIPTELMATCHING_IBY
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtcallmenu/src/csvtcallmenuimplementationproxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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 implementation proxy.
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "svtcallmenu.h"
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 
+        0x2001E2A1, CSvtCallMenu::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy implements for ECom
+// Exported proxy for instantiation method resolution
+// Returns: ImplementationTable
+// ---------------------------------------------------------------------------
+//
+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/voipplugins/svtcallmenu/src/svtcallmenu.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 for svtcallmenu.
+*
+*/
+
+
+#include "svtcallmenu.h"
+#include "svtcallstatehandler.h"
+
+#include <eikmenup.h>
+#include <phoneappcommands.hrh>
+#include <phoneappvoipcommands.hrh>
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtCallMenu::CSvtCallMenu()
+    {
+    }
+
+  
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtCallMenu* CSvtCallMenu::NewL()
+    {
+    CSvtCallMenu* self = new ( ELeave ) CSvtCallMenu;
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtCallMenu::~CSvtCallMenu()
+    {
+    delete iCallStateHandler;
+    }
+      
+       
+// ---------------------------------------------------------------------------
+// Modifys call menu
+// ---------------------------------------------------------------------------
+//
+void CSvtCallMenu::ModifyExtensionsCallMenuL( 
+        const RArray<CTelMenuExtension::TCallInfo>& aCallArray,
+        CEikMenuPane& aMenuPane )
+    {
+    CreateCallStateHandlerL( aCallArray );
+    CEikMenuPane*  menuPane= &aMenuPane;
+    RArray<TInt> menuItemArray;
+    CleanupClosePushL( menuItemArray );
+
+    // Menu items to array
+    TInt menuItemCount = menuPane->NumberOfItemsInPane();
+    for ( TInt i( 0 ); i < menuItemCount; i++ )
+        {
+        menuItemArray.AppendL( menuPane->MenuItemCommandId( i ) );
+        }
+
+    // Menu items to be deleted 
+    for ( TInt i( 0 ); i < menuItemArray.Count(); i++ )
+        {
+        switch( menuItemArray[ i ] )
+            {
+            case EPhoneInCallCmdUnattendedTransfer:
+                {
+                if ( !iCallStateHandler->FeatureSupported( 
+                       CSvtCallStateHandler::ESvmFeatureUnattendedTransfer ) )
+                    {
+                    menuPane->DeleteMenuItem( menuItemArray[ i ] ); 
+                    }
+                break;
+                }
+            case EPhoneInCallCmdSwitchToVideo:
+            case EPhoneInCallCmdCreateConference:
+            case EPhoneInCallCmdConferenceMenu:
+            case EPhoneInCallCmdJoin:
+            case EPhoneCallComingCmdSoftReject:
+            case EPhoneInCallCmdSendToCallerMenu:
+                    {
+                    // SIP voip doesn't support above features
+                    // Remove those items from the menu
+                    menuPane->DeleteMenuItem( menuItemArray[ i ] ); 
+                    }
+                break;
+            default: 
+                break;
+            }
+        }
+    
+    CleanupStack::PopAndDestroy( &menuItemArray );    
+
+    }
+
+// ---------------------------------------------------------------------------
+// Modifys touch pane
+// ---------------------------------------------------------------------------
+//
+void CSvtCallMenu::ModifyExtensionsTouchPaneButtonsL( 
+        const RArray<CTelMenuExtension::TCallInfo>& /*aCallArray*/,
+        MTelTouchPaneExtension& aTouchPane )
+    {  
+    TInt buttonCount = aTouchPane.NumberOfButtonsInPane();
+        
+    for ( TInt i=0; i < buttonCount; i++ )    
+        {
+        TInt commandId = aTouchPane.ButtonCommandId( i );
+    
+        switch ( commandId )
+            {
+            case EPhoneInCallCmdConferenceMenu:
+            case EPhoneInCallCmdCreateConference:
+            case EPhoneInCallCmdJoin:
+                {
+                // SIP VoIP not support conference -> set item dimmed
+                aTouchPane.SetButtonDimmed( commandId, ETrue );         
+                break;  
+                }
+            default:
+                break;                    
+            } // switch
+        } // for        
+    }
+          
+// ---------------------------------------------------------------------------
+// Handles custom menu commands.
+// ---------------------------------------------------------------------------
+//
+TBool CSvtCallMenu::HandleCommandL( TInt /*aCommand*/ )
+    {        
+    return EFalse;
+    }
+    
+// ---------------------------------------------------------------------------
+// Creates call state handler
+// ---------------------------------------------------------------------------
+//
+void CSvtCallMenu::CreateCallStateHandlerL(
+        const RArray<CTelMenuExtension::TCallInfo>& aCallArray )
+    {
+    if ( iCallStateHandler )
+        {
+        delete iCallStateHandler;
+        iCallStateHandler = NULL;
+        }
+    
+    iCallStateHandler = CSvtCallStateHandler::NewL( aCallArray );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtcallmenu/src/svtcallstatehandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 handler class for svtcallmenu.
+*
+*/
+
+
+#include "svtcallstatehandler.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CSvtCallStateHandler::ConstructL( 
+        const RArray<CTelMenuExtension::TCallInfo>& aCallArray )
+    {
+    TInt arrayCount = aCallArray.Count();
+    for ( TInt i=0; i < arrayCount; i++ )
+        {
+        iCallArray.AppendL( aCallArray[i] );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtCallStateHandler::CSvtCallStateHandler()
+    {
+
+    }
+
+  
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtCallStateHandler* CSvtCallStateHandler::NewL(
+        const RArray<CTelMenuExtension::TCallInfo>& aCallArray )
+    {
+    CSvtCallStateHandler* self = new ( ELeave ) CSvtCallStateHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL( aCallArray );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtCallStateHandler::~CSvtCallStateHandler()
+    {
+    iCallArray.Close();    
+    }
+
+// ---------------------------------------------------------------------------
+// Checks is feature supported
+// ---------------------------------------------------------------------------
+//
+TBool CSvtCallStateHandler::FeatureSupported( 
+    TFeature aFeature ) const
+    {
+    TBool ret( EFalse );
+    
+    switch( aFeature )
+        {
+        case ESvmFeatureUnattendedTransfer:
+            {
+            ret = UnattendedTransferPossible();
+            break;
+            }
+        default:
+            break;
+        }
+    
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Checks is unattended transfer currently possible
+// ---------------------------------------------------------------------------
+//
+TBool CSvtCallStateHandler::UnattendedTransferPossible() const
+    {
+    TBool ret( EFalse );
+    TInt arrayCount = iCallArray.Count();
+
+    for ( TInt i=0; i < arrayCount; i++ )
+        {
+        if ( iCallArray[i].iCallType == CTelMenuExtension::EPsVoice &&
+             iCallArray[i].iCallState == CTelMenuExtension::EActive )
+            {
+            // Unattended transfer possible if there is active voip call
+            ret = ETrue;
+            }
+        }
+    return ret;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/data/2001E2C8.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Resource definitions for SIP VoIP Logging Extension.
+*
+*/
+
+
+#include <registryinfov2.rh>
+
+// ---------------------------------------------------------------------------
+// REGISTRY_INFO
+// ecom plugin resource info
+// ---------------------------------------------------------------------------
+//
+// Declares info for implementations
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    
+    dll_uid = 0x2001E2C8;
+    
+    // Declare array of interface info
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = 0x2001E2A2;
+            implementations = 
+                {
+                // Info for ICE plugin
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2001E2A3;
+                    version_no = 1;
+                    display_name = "SIP VoIP Logging Extension";
+                    default_data = "";
+                    opaque_data = "";
+                    rom_only = 0;
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 SIP Logging Plugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/svtlogging.iby    CORE_APP_LAYER_IBY_EXPORT_PATH(svtlogging.iby)
+
+PRJ_MMPFILES
+svtlogging.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/group/svtlogging.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -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 project SIP VoIP Logging Extension.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET          svtlogging.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x2001E2C8
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          csvtlogging.cpp
+SOURCE          csvtloggingimplementationproxy.cpp 
+SOURCE          csvtsipuriparser.cpp
+SOURCE          csvtsettingshandler.cpp
+SOURCE          svtphonenumbervalidator.cpp
+
+START RESOURCE  ../data/2001E2C8.rss
+TARGET          svtlogging.rss
+END
+
+USERINCLUDE     ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+LIBRARY         serviceprovidersettings.lib
+LIBRARY         rcse.lib            // ignore domain part setting
+LIBRARY         sipprofilecli.lib   // my address resolving
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/inc/csvtlogging.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Implements call logging extension plugin for SIP VoIP.
+*
+*/
+
+
+#ifndef C_CSVTLOGGING_H
+#define C_CSVTLOGGING_H
+
+#include <e32base.h>
+#include <telloggingextension.h>
+#include "csvtsipuriparser.h"
+
+class CSPSettings;
+class CSvtSettingsHandler;
+class CRCSEProfileRegistry;
+
+/**
+ *  Implements call logging extension plugin inteface for SIP VoIP.
+ *
+ *  @lib svtlogging.dll
+ *  @since S60 v5.1
+ */
+class CSvtLogging : public CTelLoggingExtension
+    {
+
+public:
+
+    static CSvtLogging* NewL();
+    static CSvtLogging* NewLC();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CSvtLogging();
+
+// from base class CTelLoggingExtension
+
+    /**
+    * From CTelLoggingExtension.
+    * @see CTelLoggingExtension.
+    */
+    void InitializeL( TUint aServiceId, const TDesC& aOrigAddress );
+    
+    /**
+    * From CTelLoggingExtension.
+    * @see CTelLoggingExtension.
+    */
+    TInt GetPhoneNumber( RBuf& aPhoneNumber );
+
+    /**
+    * From CTelLoggingExtension.
+    * @see CTelLoggingExtension.
+    */
+    TInt GetVoipAddress( RBuf& aVoipAddress );
+    
+    /**
+    * From CTelLoggingExtension.
+    * @see CTelLoggingExtension.
+    */
+    TInt GetMyAddress( RBuf& aMyAddress );
+    
+    /**
+    * From CTelLoggingExtension.
+    * @see CTelLoggingExtension.
+    */
+    TInt GetRemotePartyName( RBuf& aRemotePartyName );
+    
+private:
+
+    CSvtLogging();
+
+    CSvtSettingsHandler* CreateSvtSettingsHandlerL( TUint aServiceId ) const;
+            
+    CSvtSipUriParser::TDomainPartClippingSetting ConvertToUriParserSetting( 
+        TInt aDomainClipSetting ) const;
+    
+    CSvtSipUriParser* CreateSipUriParserL( const TDesC& aOrigAddress, 
+        TInt aDomainClipSetting ) const;
+    
+private: // data
+
+    /**
+     * SIP URI parser.
+     * Own.
+     */
+    CSvtSipUriParser* iParser;    
+    
+    /**
+     * Settings handler.
+     * Own.
+     */
+    CSvtSettingsHandler* iSettingsHandler;
+    
+    /**
+     * User name if plugin is initialized with SIP user name only.
+     * Own.
+     */
+    RBuf iSipUserName;
+
+    };
+
+#endif // C_CSVTLOGGING_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/inc/csvtsettingshandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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_CSVTSETTINGSHANDLER_H
+#define C_CSVTSETTINGSHANDLER_H
+
+#include <e32base.h>
+#include <sipprofileregistryobserver.h>
+
+class CSPSettings;
+class CRCSEProfileRegistry;
+class CSIPManagedProfileRegistry;
+class CRCSEProfileEntry;
+
+/**
+ *  Encapsulates handling of system settings having an effect on plugin.
+ *
+ *  @lib svtlogging.dll
+ *  @since S60 v5.1
+ */
+class CSvtSettingsHandler : public CBase, public MSIPProfileRegistryObserver
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     * @param aServiceId    The service identifier.
+     * @leave KErrNotFound if service provider settings for given identifier
+     * do not exist.
+     */
+    static CSvtSettingsHandler* NewL( TUint aServiceId );
+
+    /**
+     * Two-phased constructor.
+     * @param aServiceId    The service identifier.
+     * @leave KErrNotFound if service provider settings for given identifier
+     * do not exist.
+     */
+    static CSvtSettingsHandler* NewLC( TUint aServiceId );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSvtSettingsHandler();
+
+    /**
+     * Returns SIP address domain part clipping setting.
+     *
+     * @since   S60 v5.1
+     * @return  Clipping setting.
+     */
+    TInt DomainPartClippingSetting() const;
+    
+    /**
+     * Returns local user's AOR.
+     *
+     * @since   S60 v5.1
+     * @param   aUserAor      User AOR.
+     */
+    void GetUserAorL( RBuf& aUserAor );
+
+// from base class MSIPProfileRegistryObserver.
+
+    /**
+     * From MSIPProfileRegistryObserver.
+     * @see MSIPProfileRegistryObserver.
+     */
+    void ProfileRegistryEventOccurred( TUint32 aProfileId, TEvent aEvent );
+
+    /**
+     * From MSIPProfileRegistryObserver.
+     * @see MSIPProfileRegistryObserver.
+     */
+    void ProfileRegistryErrorOccurred( TUint32 aProfileId, TInt aError );
+
+private:
+
+    CSvtSettingsHandler() {};
+    
+    CSvtSettingsHandler( TUint aServiceId );
+
+    void ConstructL();
+    
+    TBool IsServiceConfiguredL( TUint aServiceId ) const;
+    
+    CSPSettings* CreateServiceProviderSettingsL() const;
+    
+    CRCSEProfileRegistry* CreateRcseProfileRegistryLC() const;
+    
+    CSIPManagedProfileRegistry* CreateSipProfileRegistryLC();
+    
+    CRCSEProfileEntry* RcseProfileForServiceL( TUint aServiceId ) const;
+    
+    TInt SipProfileIdForServiceL( TUint aServiceId ) const;
+    
+private: // data
+
+    /**
+     * Service identifier.
+     */
+    TUint iServiceId;
+
+    };
+
+#endif // C_CSVTSETTINGSHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/inc/csvtsipuriparser.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  
+*
+*/
+
+
+
+#ifndef C_CSVTSIPURIPARSER_H
+#define C_CSVTSIPURIPARSER_H
+
+#include <e32base.h>
+
+/**
+ *  Provides services for SIP URI parsing.
+ *
+ *  @lib svtlogging.dll
+ *  @since S60 v5.1
+ */
+class CSvtSipUriParser : public CBase
+    {
+
+public:
+
+    /**  Domain part clipping options for SIP URIs. */
+    enum TDomainPartClippingSetting
+        {
+        /** Domain part is not clipped. */ 
+        ENoClipping           = 0,
+        /** Domain part is clipped if user name part presents 
+            a telephony number. */
+        EClipDomainIfNumber   = 1,
+        /** Domain part is always clipped. */
+        EClipDomain           = 2
+        };
+
+    /**
+     * Two-phased constructor.
+     * @param   aSipUri     The SIP URI to be parsed.
+     * @param   aOptions    Clipping options.
+     */
+    static CSvtSipUriParser* NewL( const TDesC& aSipUri,
+        TDomainPartClippingSetting aOptions );
+
+    /**
+     * Two-phased constructor.
+     * @param   aSipUri     The SIP URI to be parsed.
+     * @param   aOptions    Clipping options.
+     */
+    static CSvtSipUriParser* NewLC( const TDesC& aSipUri,
+        TDomainPartClippingSetting aOptions );
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CSvtSipUriParser();
+
+    /**
+     * Returns parsed VoIP address if available. If VoIP address is not
+     * available a KNullDesC is returned. That can happen in case of private
+     * address.
+     *
+     * @since   S60 v5.1
+     * @param   aVoipAddress    Parsed VoIP address or KNullDesC.
+     * @return  System wide error code.
+     */
+    TInt GetVoipAddress( RBuf& aVoipAddress ) const;
+
+    /**
+     * Returns parsed phone number if available. If phone number is not
+     * available a KNullDesC is returned.
+     *
+     * @since   S60 v5.1
+     * @param   aPhoneNumber    Parsed phone number or KNullDesC.
+     * @return  System wide error code.
+     */
+    TInt GetPhoneNumber( RBuf& aPhoneNumber ) const;
+    
+    /**
+     * Returns display name if available. If display name is not available
+     * a KNullDesC is returned.
+     *
+     * @since   S60 v5.1
+     * @param   aPhoneNumber    Display name or KNullDesC.
+     * @return  System wide error code.
+     */
+    TInt GetDisplayName( RBuf& aDisplayName ) const;
+    
+private:
+
+    CSvtSipUriParser() {};
+    
+    CSvtSipUriParser( TDomainPartClippingSetting aOptions );
+
+    void ConstructL( const TDesC& aSipUri );
+    
+    void ParseSipUriL( const TDesC& aSipUri );
+    
+    void ParseDisplayNameL( const TDesC& aSipUri );
+    
+    void RemoveElbows( TDes& sipUri ) const;
+    
+    void ParseUserNameL( const TDesC& aSipUri );
+    
+    void ParseDomainL( const TDesC& aSipUri );
+    
+    void ParsePrivateAddress();
+    
+    TInt AddressLength( const TDesC& aUserName, const TDesC& aDomain,
+        TDomainPartClippingSetting aClipSetting ) const;
+    
+    TBool IsAnonymousUri( const TDesC& aCandidate ) const;
+
+private: // data
+
+    /**
+     * Domain part clipping options.
+     */
+    TDomainPartClippingSetting iOptions;
+
+    /**
+     * User name part of the parsed SIP URI.
+     * Own.
+     */
+    RBuf iUserName;
+
+    /**
+     * Domain name part of the parsed SIP URI.
+     * Own.
+     */
+    RBuf iDomain;
+    
+    /**
+     * Display name from the parsed SIP URI if available.
+     * Own.
+     */
+    RBuf iDisplayName;
+
+    };
+
+#endif // C_CSVTSIPURIPARSER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/inc/svtphonenumbervalidator.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  
+*
+*/
+
+
+
+#ifndef C_SVTPHONENUMBERVALIDATOR_H
+#define C_SVTPHONENUMBERVALIDATOR_H
+
+#include <e32base.h>
+
+/**
+ *  Provides services to validate phone numbers.
+ *
+ *  @lib svtlogging.dll
+ *  @since S60 v5.1
+ */
+class SvtPhoneNumberValidator
+    {
+
+public:
+
+    /**
+     * Checks whether the given candidate presents phone number. Empty
+     * candidate is considered to be invalid phone number.
+     *
+     * @since   S60 v5.1
+     * @param   aCandidate    Phone number candidate.
+     * @return  ETrue if candidate presents phone number, EFalse otherwise.
+     */
+    static TBool IsValidNumber( const TDesC& aCandidate );
+    
+private:
+    
+    static TBool ContainsValidCharacters( const TDesC& aCandidate );    
+    
+    static TBool AreStartCharactersValid( const TDesC& aCandidate );
+    };
+
+#endif // C_SVTPHONENUMBERVALIDATOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/rom/svtlogging.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 description file for project svtlogging.
+*
+*/
+
+
+#ifndef SVTLOGGING_IBY
+#define SVTLOGGING_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( svtlogging.dll, 2001E2C8.rsc )
+
+#endif // SVTLOGGING_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/src/csvtlogging.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,266 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "csvtlogging.h"
+#include "csvtsettingshandler.h"
+#include "svtphonenumbervalidator.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSvtLogging::CSvtLogging
+// ---------------------------------------------------------------------------
+//
+CSvtLogging::CSvtLogging()
+    {
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtLogging::NewL
+// ---------------------------------------------------------------------------
+//
+CSvtLogging* CSvtLogging::NewL()
+    {
+    CSvtLogging* self = CSvtLogging::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtLogging::NewLC
+// ---------------------------------------------------------------------------
+//
+CSvtLogging* CSvtLogging::NewLC()
+    {
+    CSvtLogging* self = new( ELeave ) CSvtLogging;
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtLogging::~CSvtLogging
+// ---------------------------------------------------------------------------
+//
+CSvtLogging::~CSvtLogging()
+    {
+    delete iParser;
+    delete iSettingsHandler;
+    iSipUserName.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CLoggingPluginInterface.
+// ---------------------------------------------------------------------------
+//
+void CSvtLogging::InitializeL( 
+        TUint aServiceId, const TDesC& aOrigAddress )
+    {
+    __ASSERT_ALWAYS( aOrigAddress.Length() != 0, User::Leave( KErrArgument ) );
+    
+    iSipUserName.Close();
+    
+    delete iSettingsHandler;
+    iSettingsHandler = NULL;
+    iSettingsHandler = CreateSvtSettingsHandlerL( aServiceId );
+    
+    delete iParser;
+    iParser = NULL;
+    TInt domainClipSetting = iSettingsHandler->DomainPartClippingSetting();
+    TRAPD( result, iParser = 
+        CreateSipUriParserL( aOrigAddress, domainClipSetting ) );
+    if ( KErrNone != result )
+        {
+        if ( KErrNoMemory == result )
+            {
+            User::Leave( KErrNoMemory );
+            }
+        else
+            {
+            // plugin is initialized with user name only 
+            iSipUserName.Assign( aOrigAddress.AllocL() );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CLoggingPluginInterface.
+// ---------------------------------------------------------------------------
+//
+TInt CSvtLogging::GetPhoneNumber( RBuf& aPhoneNumber )
+    {
+    TInt result( KErrNone );
+    
+    if ( iParser )
+        {
+        result = iParser->GetPhoneNumber( aPhoneNumber );        
+        }
+    else if ( iSipUserName.Length() != 0 )
+        {
+        if ( SvtPhoneNumberValidator::IsValidNumber( iSipUserName ) )
+            {
+            if ( aPhoneNumber.MaxLength() < iSipUserName.Length() )
+                {
+                result = aPhoneNumber.ReAlloc( iSipUserName.Length() );
+                }
+            
+            if ( KErrNone == result )
+                {
+                aPhoneNumber.Copy( iSipUserName );
+                }
+            }
+        }
+    else
+        {
+        result = KErrNotReady;
+        }
+    
+    return result;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CLoggingPluginInterface.
+// ---------------------------------------------------------------------------
+//
+TInt CSvtLogging::GetVoipAddress( RBuf& aVoipAddress )
+    {
+    TInt result( KErrNone );
+    
+    if ( iParser )
+        {
+        result = iParser->GetVoipAddress( aVoipAddress );
+        }
+    else if ( iSipUserName.Length() != 0 )
+        {
+        if ( aVoipAddress.MaxLength() < iSipUserName.Length() )
+            {
+            result = aVoipAddress.ReAlloc( iSipUserName.Length() );
+            }
+        
+        if ( KErrNone == result )
+            {
+            aVoipAddress.Copy( iSipUserName );
+            }
+        }
+    else
+        {
+        result = KErrNotReady;
+        }
+    
+    return result;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CLoggingPluginInterface.
+// ---------------------------------------------------------------------------
+//
+TInt CSvtLogging::GetMyAddress( RBuf& aMyAddress )
+    {
+    TInt result( KErrNotReady );
+    if ( iSettingsHandler )
+        {
+        TRAP( result, iSettingsHandler->GetUserAorL( aMyAddress ) );        
+        }
+    
+    return result;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CLoggingPluginInterface.
+// ---------------------------------------------------------------------------
+//
+TInt CSvtLogging::GetRemotePartyName( RBuf& aRemotePartyName )
+    {
+    TInt result( KErrNone );
+    
+    if ( iParser )
+        {
+        result = iParser->GetDisplayName( aRemotePartyName );
+        }
+    else if ( iSipUserName.Length() != 0 )
+        {
+        aRemotePartyName = KNullDesC();
+        }
+    else
+        {
+        return KErrNotReady;
+        }
+    
+    return result;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtLogging::CreateSvtSettingsHandlerL()
+// ---------------------------------------------------------------------------
+//
+CSvtSettingsHandler* CSvtLogging::CreateSvtSettingsHandlerL( 
+        TUint aServiceId ) const
+    {
+    return CSvtSettingsHandler::NewL( aServiceId );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtLogging::CreateSipUriParserL()
+// ---------------------------------------------------------------------------
+//
+CSvtSipUriParser* CSvtLogging::CreateSipUriParserL( 
+        const TDesC& aOrigAddress, TInt aDomainClipSetting ) const
+    {
+    return CSvtSipUriParser::NewL( aOrigAddress, 
+        ConvertToUriParserSetting( aDomainClipSetting ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtLogging::ConvertToUriParserSetting()
+// ---------------------------------------------------------------------------
+//
+CSvtSipUriParser::TDomainPartClippingSetting 
+    CSvtLogging::ConvertToUriParserSetting( 
+        TInt aDomainClipSetting ) const
+    {
+    CSvtSipUriParser::TDomainPartClippingSetting setting( 
+        CSvtSipUriParser::ENoClipping );
+    
+    switch ( aDomainClipSetting )
+        {
+        case 0:
+            setting = CSvtSipUriParser::ENoClipping;
+            break;
+        case 1:
+            setting = CSvtSipUriParser::EClipDomainIfNumber;
+            break;
+        case 2:
+            setting = CSvtSipUriParser::EClipDomain;
+            break;
+        default:
+            ASSERT( EFalse );
+        }
+    
+    return setting;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/src/csvtloggingimplementationproxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  ECom implementation proxy.
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "csvtlogging.h"
+
+// Map the interface UIDs to implementation factory functions
+const TImplementationProxy ImplementationTable[] = 
+    {
+    // lint #611
+    IMPLEMENTATION_PROXY_ENTRY( 0x2001E2A3, CSvtLogging::NewL )
+    };
+
+// Exported proxy for instantiation method resolution
+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/voipplugins/svtlogging/src/csvtsettingshandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  
+*
+*/
+
+
+#include <spsettings.h>
+#include <spentry.h>
+#include <crcseprofileregistry.h>
+#include <sipmanagedprofile.h>
+#include <sipmanagedprofileregistry.h>
+#include "csvtsettingshandler.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ResetAndDestroy for RCSE profile entry array.
+// ---------------------------------------------------------------------------
+//
+void ResetAndDestroy( TAny* aAny )
+    {
+    if ( aAny ) 
+        {
+        static_cast<RPointerArray<CRCSEProfileEntry>*>( aAny )
+            ->ResetAndDestroy();
+        }
+    }
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::CSvtSettingsHandler
+// ---------------------------------------------------------------------------
+//
+CSvtSettingsHandler::CSvtSettingsHandler( TUint aServiceId )
+    : iServiceId( aServiceId )
+    {
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSvtSettingsHandler::ConstructL()
+    {
+    TBool isServiceConfigured = IsServiceConfiguredL( iServiceId );
+    __ASSERT_ALWAYS( isServiceConfigured, User::Leave( KErrNotFound ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CSvtSettingsHandler* CSvtSettingsHandler::NewL( TUint aServiceId )
+    {
+    CSvtSettingsHandler* self = CSvtSettingsHandler::NewLC( aServiceId );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::NewLC
+// ---------------------------------------------------------------------------
+//
+CSvtSettingsHandler* CSvtSettingsHandler::NewLC( TUint aServiceId )
+    {
+    CSvtSettingsHandler* self = new( ELeave ) CSvtSettingsHandler( aServiceId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::~CSvtSettingsHandler
+// ---------------------------------------------------------------------------
+//
+CSvtSettingsHandler::~CSvtSettingsHandler()
+    {
+    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::DomainPartClippingSetting()
+// ---------------------------------------------------------------------------
+//
+TInt CSvtSettingsHandler::DomainPartClippingSetting() const
+    {
+    const TInt KNoDomainPartClipping = 0;
+    TInt setting( KNoDomainPartClipping );
+    
+    CRCSEProfileEntry* profile = NULL;
+    TRAP_IGNORE( profile = RcseProfileForServiceL( iServiceId ) )
+    if ( profile )
+        {
+        setting = profile->iIgnoreAddrDomainPart;
+        delete profile;
+        }
+    
+    return setting;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::GetUserAorL()
+// ---------------------------------------------------------------------------
+//
+void CSvtSettingsHandler::GetUserAorL( RBuf& aUserAor )
+    {
+    aUserAor = KNullDesC();
+    
+    TInt sipProfileId = SipProfileIdForServiceL( iServiceId );
+    
+    // fetch sip profile based on sip profile id
+    CSIPManagedProfileRegistry* sipProfileRegistry = 
+        CreateSipProfileRegistryLC();
+    CSIPManagedProfile* profile = static_cast<CSIPManagedProfile*>
+        ( sipProfileRegistry->ProfileL( sipProfileId ) );
+    CleanupStack::PushL( profile );
+    
+    // Read user aor setting from fetched sip profile.
+    const TDesC8* userAor = NULL;
+    User::LeaveIfError( profile->GetParameter( KSIPUserAor, userAor ) );
+    if ( userAor )
+        {
+        if ( aUserAor.Length() < userAor->Length() )
+            {
+            aUserAor.ReAllocL( userAor->Length() );
+            }
+        
+        aUserAor.Copy( *userAor );
+        }
+    
+    CleanupStack::PopAndDestroy( profile );
+    CleanupStack::PopAndDestroy( sipProfileRegistry );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver.
+// Implementation currently not needed because SIP profile registry is used
+// only in function scope.
+// ---------------------------------------------------------------------------
+//
+void CSvtSettingsHandler::ProfileRegistryEventOccurred( 
+        TUint32 /*aProfileId*/, TEvent /*aEvent*/ )
+    {
+    
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver.
+// Implementation currently not needed because SIP profile registry is used
+// only in function scope.
+// ---------------------------------------------------------------------------
+//
+void CSvtSettingsHandler::ProfileRegistryErrorOccurred( 
+        TUint32 /*aProfileId*/, TInt /*aError*/ )
+    {
+    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::IsServiceConfiguredL
+// ---------------------------------------------------------------------------
+//
+TBool CSvtSettingsHandler::IsServiceConfiguredL( TUint aServiceId ) const
+    {
+    CSPSettings* settings = CreateServiceProviderSettingsL();
+    CleanupStack::PushL( settings );
+    
+    RIdArray ids;
+    CleanupClosePushL( ids );
+    TBool result = 
+        ( KErrNone == settings->FindServiceIdsL( ids ) 
+        && KErrNotFound != ids.Find( aServiceId ) );
+    CleanupStack::PopAndDestroy( &ids );
+    
+    CleanupStack::PopAndDestroy( settings );
+    return result;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::CreateServiceProviderSettingsL()
+// ---------------------------------------------------------------------------
+//
+CSPSettings* CSvtSettingsHandler::CreateServiceProviderSettingsL() const
+    {
+    return CSPSettings::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::CreateRcseProfileRegistryLC()
+// ---------------------------------------------------------------------------
+//
+CRCSEProfileRegistry* CSvtSettingsHandler::CreateRcseProfileRegistryLC() const
+    {
+    return CRCSEProfileRegistry::NewLC();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::CreateRcseProfileRegistryLC()
+// ---------------------------------------------------------------------------
+//
+CSIPManagedProfileRegistry* CSvtSettingsHandler::CreateSipProfileRegistryLC()
+    {
+    return CSIPManagedProfileRegistry::NewLC( *this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::RcseProfileForServiceL()
+// ---------------------------------------------------------------------------
+//
+CRCSEProfileEntry* CSvtSettingsHandler::RcseProfileForServiceL( 
+        TUint aServiceId ) const
+    {
+    CRCSEProfileEntry* rcseProfile = NULL;
+    CRCSEProfileRegistry* registry = CreateRcseProfileRegistryLC();
+    RPointerArray<CRCSEProfileEntry> profileEntries;
+    CleanupStack::PushL( TCleanupItem( ResetAndDestroy, &profileEntries ) );
+    
+    registry->FindByServiceIdL( aServiceId, profileEntries  );
+    if ( profileEntries.Count() && profileEntries[ 0 ] )
+        {
+        rcseProfile = profileEntries[ 0 ];
+        profileEntries.Remove( 0 );
+        }
+    
+    CleanupStack::PopAndDestroy( &profileEntries );
+    CleanupStack::PopAndDestroy( registry );
+    return rcseProfile;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSettingsHandler::SipProfileIdForServiceL()
+// ---------------------------------------------------------------------------
+//
+TInt CSvtSettingsHandler::SipProfileIdForServiceL( TUint aServiceId ) const
+    {
+    TInt sipProfileId( KErrNotFound );
+    
+    CRCSEProfileEntry* rcseProfile = RcseProfileForServiceL( aServiceId );
+    if ( NULL != rcseProfile )
+        {
+        const TInt KSipProfileIdIndex = 0;
+        sipProfileId = rcseProfile->iIds[ KSipProfileIdIndex ].iProfileId;
+        delete rcseProfile;        
+        }
+    
+    return sipProfileId;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/src/csvtsipuriparser.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,370 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "csvtsipuriparser.h"
+#include "svtphonenumbervalidator.h"
+
+_LIT( KColon, ":");
+_LIT( KAtSign, "@");
+_LIT( KLeftElbow, "<" );
+_LIT( KRightElbow, ">" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::CSvtSipUriParser
+// ---------------------------------------------------------------------------
+//
+CSvtSipUriParser::CSvtSipUriParser( TDomainPartClippingSetting aOptions )
+    :
+    iOptions( aOptions )
+    {
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CSvtSipUriParser::ConstructL( const TDesC& aSipUri )
+    {
+    ParseSipUriL( aSipUri );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::NewL
+// ---------------------------------------------------------------------------
+//
+CSvtSipUriParser* CSvtSipUriParser::NewL( const TDesC& aSipUri,
+        TDomainPartClippingSetting aOptions )
+    {
+    CSvtSipUriParser* self = CSvtSipUriParser::NewLC( aSipUri, aOptions );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::NewLC
+// ---------------------------------------------------------------------------
+//
+CSvtSipUriParser* CSvtSipUriParser::NewLC( const TDesC& aSipUri,
+        TDomainPartClippingSetting aOptions )
+    {
+    CSvtSipUriParser* self = new( ELeave ) CSvtSipUriParser( aOptions );
+    CleanupStack::PushL( self );
+    self->ConstructL( aSipUri );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::~CSvtSipUriParser
+// ---------------------------------------------------------------------------
+//
+CSvtSipUriParser::~CSvtSipUriParser()
+    {
+    iUserName.Close();
+    iDomain.Close();
+    iDisplayName.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::GetVoipAddress
+// ---------------------------------------------------------------------------
+//
+TInt CSvtSipUriParser::GetVoipAddress( RBuf& aVoipAddress ) const
+    {
+    aVoipAddress = KNullDesC();
+    
+    if ( IsAnonymousUri( iUserName ) )
+        {
+        return KErrNone;
+        }
+    
+    TInt result( KErrNone );
+    TInt addressLength = AddressLength( iUserName, iDomain, iOptions );
+    if ( aVoipAddress.MaxLength() < addressLength )
+        {
+        result = aVoipAddress.ReAlloc( addressLength );
+        }
+    
+    if ( KErrNone == result )
+        {
+        aVoipAddress.Append( iUserName );
+        
+        if ( iUserName.Length() < addressLength )
+            {
+            // domain part clipping isn't used
+            aVoipAddress.Append( KAtSign() );
+            aVoipAddress.Append( iDomain );
+            }
+        }
+    
+    return result;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::GetPhoneNumber
+// ---------------------------------------------------------------------------
+//
+TInt CSvtSipUriParser::GetPhoneNumber( RBuf& aPhoneNumber ) const
+    {
+    aPhoneNumber = KNullDesC();
+    
+    TInt result( KErrNone );
+    if ( SvtPhoneNumberValidator::IsValidNumber( iUserName ) 
+            && ( ENoClipping != iOptions ) )
+        {
+        if ( aPhoneNumber.MaxLength() < iUserName.Length() )
+            {
+            result = aPhoneNumber.ReAlloc( iUserName.Length() );
+            }
+        
+        if ( KErrNone == result )
+            {
+            aPhoneNumber.Append( iUserName );
+            }        
+        }
+    
+    return result;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::GetDisplayName
+// ---------------------------------------------------------------------------
+//
+TInt CSvtSipUriParser::GetDisplayName( RBuf& aDisplayName ) const
+    {
+    aDisplayName = KNullDesC();
+    
+    TInt result( KErrNone );
+    if ( aDisplayName.MaxLength() < iDisplayName.Length() )
+        {
+        result = aDisplayName.ReAlloc( iDisplayName.Length() );
+        }
+    
+    if ( KErrNone == result )
+        {
+        aDisplayName = iDisplayName;
+        }
+    
+    return result;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::ParseSipUriL
+// Accepted URI forms are: [schema:]user@host[:port] and 
+// displayname <[schema:]user@host[:port]>. URI parameters and headers are 
+// ripped off in MCE & SVP.
+// ---------------------------------------------------------------------------
+//
+void CSvtSipUriParser::ParseSipUriL( const TDesC& aSipUri )
+    {
+    if ( IsAnonymousUri( aSipUri ) )
+        {
+        ParsePrivateAddress();
+        }
+    else
+        {
+        RBuf sipUri( aSipUri.AllocL() );
+        CleanupClosePushL( sipUri );
+        
+        // remove trailing and leading white spaces from input uri
+        sipUri.TrimAll();
+        ParseDisplayNameL( sipUri );
+        RemoveElbows( sipUri );
+        ParseUserNameL( sipUri );
+        ParseDomainL( sipUri );
+        
+        CleanupStack::PopAndDestroy( &sipUri );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::ParseDisplayNameL
+// ---------------------------------------------------------------------------
+//
+void CSvtSipUriParser::ParseDisplayNameL( const TDesC& aSipUri )
+    {
+    iDisplayName.Close();
+    
+    TInt leftElbowIndex = aSipUri.Find( KLeftElbow );
+    TInt rightElbowIndex = aSipUri.Find( KRightElbow );
+    if ( ( 0 < leftElbowIndex ) && ( KErrNotFound != rightElbowIndex ) )
+        {
+        // display name is available
+        iDisplayName.Assign( aSipUri.Left( leftElbowIndex ).AllocL() );
+        
+        // remove whitespace around display name
+        iDisplayName.TrimAll();
+        
+        // remove quatation marks around display name
+        _LIT( KQuatationMark, "\"");
+        if ( iDisplayName.Length() && iDisplayName[0] == '"' )
+            {
+            iDisplayName.Delete( 0, KQuatationMark().Length() );
+            }
+        
+        if ( iDisplayName.Length() 
+                && iDisplayName[iDisplayName.Length() - 1] == '"')
+            {
+            iDisplayName.Delete( 
+                iDisplayName.Length() - 1, KQuatationMark().Length() );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::RemoveElbows
+// ---------------------------------------------------------------------------
+//
+void CSvtSipUriParser::RemoveElbows( TDes& sipUri ) const
+    {
+    TInt leftElbowIndex = sipUri.Find( KLeftElbow );
+    if ( KErrNotFound != leftElbowIndex )
+        {
+        sipUri.Delete( leftElbowIndex, KLeftElbow().Length() );
+        }
+    
+    TInt rightElbowIndex = sipUri.Find( KRightElbow );
+    if ( KErrNotFound != rightElbowIndex )
+        {
+        sipUri.Delete( rightElbowIndex, KRightElbow().Length() );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::ParseUserNameL
+// ---------------------------------------------------------------------------
+//
+void CSvtSipUriParser::ParseUserNameL( const TDesC& aSipUri )
+    {
+    // If uri does not specify schema, user name starts from the beginning of
+    // the uri. Otherwise additional calculations are done.
+    TInt userNameStartInd = 0;
+    TInt indexOfColon = aSipUri.Find( KColon() );
+    if ( KErrNotFound != indexOfColon )
+        {
+        userNameStartInd = aSipUri.Find( KColon() ) + KColon().Length();
+        __ASSERT_ALWAYS( KColon().Length() <= userNameStartInd, 
+            User::Leave( KErrArgument ) );
+        }
+    
+    TInt userNameEndInd = aSipUri.Find( KAtSign() ) - KAtSign().Length();
+    __ASSERT_ALWAYS( 0 <= userNameEndInd, User::Leave( KErrArgument ) );
+    
+    TInt userNameLength = ( userNameEndInd - userNameStartInd ) + 1;
+    __ASSERT_ALWAYS( 0 < userNameLength, User::Leave( KErrArgument ) );
+    
+    iUserName.Close();
+    iUserName.Assign( aSipUri.Mid( userNameStartInd, userNameLength ).AllocL() );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::ParseDomainL
+// ---------------------------------------------------------------------------
+//
+void CSvtSipUriParser::ParseDomainL( const TDesC& aSipUri )
+    {
+    TInt hostNameStartInd = aSipUri.Find( KAtSign() ) + KAtSign().Length();
+    __ASSERT_ALWAYS( KAtSign().Length() <= hostNameStartInd, 
+        User::Leave( KErrArgument ) );
+    
+    TInt hostNameEndInd = aSipUri.Length() - 1;
+    TInt hostNameLength = ( hostNameEndInd - hostNameStartInd ) + 1;
+    __ASSERT_ALWAYS( 0 < hostNameLength, User::Leave( KErrArgument ) );
+    
+    iDomain.Close();
+    iDomain.Assign( aSipUri.Mid( hostNameStartInd, hostNameLength ).AllocL() );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::ParsePrivateAddress
+// ---------------------------------------------------------------------------
+//
+void CSvtSipUriParser::ParsePrivateAddress()
+    {
+    iUserName.Close();
+    iUserName = KNullDesC();
+    
+    iDomain.Close();
+    iDomain = KNullDesC();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::AddressLength
+// ---------------------------------------------------------------------------
+//
+TInt CSvtSipUriParser::AddressLength( const TDesC& aUserName, 
+        const TDesC& aDomain, TDomainPartClippingSetting aClipSetting ) const
+    {
+    TInt addressLength( 0 );
+    TBool isPhoneNumber( SvtPhoneNumberValidator::IsValidNumber( aUserName ) );
+    switch ( aClipSetting )
+        {
+        case ENoClipping:
+            addressLength = 
+            aUserName.Length() + KAtSign().Length() + aDomain.Length();
+            break;
+        
+        case EClipDomainIfNumber:
+            addressLength = isPhoneNumber 
+                ? aUserName.Length() 
+                : aUserName.Length() + KAtSign().Length() + aDomain.Length();
+            break;
+        
+        case EClipDomain:
+            addressLength = aUserName.Length();
+            break;
+        
+        default:
+            ASSERT( EFalse );
+        }
+    
+    return addressLength;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CSvtSipUriParser::IsAnonymousUri
+// ---------------------------------------------------------------------------
+//
+TBool CSvtSipUriParser::IsAnonymousUri( const TDesC& aCandidate ) const
+    {
+    if ( aCandidate.Length() == 0 )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtlogging/src/svtphonenumbervalidator.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 "svtphonenumbervalidator.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// SvtPhoneNumberValidator::IsValidNumber
+// ---------------------------------------------------------------------------
+//
+TBool SvtPhoneNumberValidator::IsValidNumber( const TDesC& aCandidate )
+    {
+    if ( aCandidate.Length() != 0 
+            && AreStartCharactersValid( aCandidate )
+            && ContainsValidCharacters( aCandidate ) )
+        {
+        return ETrue;
+        }
+    else
+        {
+        return EFalse;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// SvtPhoneNumberValidator::ContainsValidCharacters
+// ---------------------------------------------------------------------------
+//
+TBool SvtPhoneNumberValidator::ContainsValidCharacters( 
+        const TDesC& aCandidate )
+    {
+    _LIT( KAllowedCharsInPhoneNumber, "0123456789*+pw#PW" );
+    
+    TLex input( aCandidate );
+    TPtrC validChars( KAllowedCharsInPhoneNumber );
+    while ( validChars.Locate( input.Peek() ) != KErrNotFound )
+        {
+        input.Inc();
+        }
+    
+    return ( !input.Remainder().Length() );
+    }
+
+
+// ---------------------------------------------------------------------------
+// SvtPhoneNumberValidator::AreStartCharactersValid
+// ---------------------------------------------------------------------------
+//
+TBool SvtPhoneNumberValidator::AreStartCharactersValid( 
+        const TDesC& aCandidate )
+    {
+    TBool isValidStart( ETrue );
+    
+    TChar firstChar  = '0';
+    TChar secondChar = '0';
+    TInt candidateLength( aCandidate.Length() );
+    if ( 0 < candidateLength )
+        {
+        firstChar = aCandidate[0];
+        firstChar.LowerCase();
+        }
+    
+    if ( 1 < candidateLength )
+        {
+        secondChar = aCandidate[1];
+        secondChar.LowerCase();
+        }
+    
+    if ( firstChar == 'p' || firstChar == 'w' )
+        {
+        isValidStart = EFalse;
+        }
+    
+    if ( ( firstChar == '+' && secondChar == '+' ) ||
+         ( firstChar == '+' && secondChar == 'p' ) ||
+         ( firstChar == '+' && secondChar == 'w' ) )
+        {
+        isValidStart = EFalse;
+        }
+    
+    return isValidStart;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtmatching/data/2001E2C9.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Resource definitions for project sipvoiptelmatching
+*
+*/
+
+
+#include <eikon.rh>
+#include <registryinfov2.rh>
+
+
+
+//  RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+//   
+// theInfo
+// REGISTRY_INFO for ECom
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2; 
+    dll_uid = 0x2001E2C9;
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x2001E2A4; //KTelMatchingExtensionUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x2001E2A5;
+                    version_no = 1;
+                    display_name = "SIP VoIP Matching Extension";
+                    default_data = "";
+                    opaque_data = "";
+                    rom_only = 0;
+                    }             
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtmatching/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -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 project svtmatching
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// IBY files
+../rom/svtmatching.iby                              CORE_APP_LAYER_IBY_EXPORT_PATH(svtmatching.iby)
+
+PRJ_MMPFILES
+svtmatching.mmp
+
+//../internal/tsrc/sipmatchingplugin_ut/group/t_csipmatchingplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtmatching/group/svtmatching.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -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 sipvoiptelmatching
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET    	svtmatching.dll
+TARGETTYPE  PLUGIN
+UID 	    0x10009D8D 0x2001E2C9
+
+CAPABILITY  CAP_ECOM_PLUGIN
+VENDORID    VID_DEFAULT
+
+SOURCEPATH  ../src
+SOURCE      svtmatching.cpp
+SOURCE      svtsettingshandler.cpp
+SOURCE      svturiparser.cpp
+
+
+USERINCLUDE ../inc
+USERINCLUDE ../data
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+//ECOM resource definition
+START RESOURCE  ../data/2001E2C9.rss
+TARGET          svtmatching.rsc                                                              
+END
+
+
+LIBRARY     bafl.lib
+LIBRARY     ecom.lib
+LIBRARY     cone.lib
+LIBRARY     euser.lib
+LIBRARY     efsrv.lib
+LIBRARY     commonengine.lib
+LIBRARY     serviceprovidersettings.lib
+LIBRARY     centralrepository.lib
+LIBRARY     rcse.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtmatching/inc/svtcleanup.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Implementation of cleanup for pointer arrays
+*
+*/
+
+
+#ifndef SVTMATCHINGCLEANUP_H
+#define SVTMATCHINGCLEANUP_H
+
+#include <e32base.h>
+
+/**
+ * Template class for cleaning up arrays that have a ResetAndDestroy() function.
+ * To be used with the CleanupStack.
+ * 
+ * @lib svtmatching.lib
+ * @since S60 v5.0
+ */
+template <class T>
+class CleanupResetAndDestroy
+	{
+	public:	// New functions
+
+		inline static void PushL( T& aRef );
+
+	private: // New functions
+
+		static void ResetAndDestroy( TAny *aPtr );
+
+	};
+
+// INLINE FUNCTIONS
+template <class T>
+inline void CleanupResetAndDestroy< T >::PushL( T& aRef )
+	{
+	CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) );
+	}
+
+template <class T>
+void CleanupResetAndDestroy<T>::ResetAndDestroy( TAny *aPtr )
+	{
+	( static_cast< T* >( aPtr ) )->ResetAndDestroy();
+	( static_cast< T* >( aPtr ) )->Close();
+	}
+
+template <class T>
+inline void CleanupResetAndDestroyPushL( T& aRef )
+	{ CleanupResetAndDestroy< T >::PushL( aRef ); }
+
+#endif // SVTMATCHINGCLEANUP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtmatching/inc/svtmatching.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 for svtmatching.
+*
+*/
+
+
+#ifndef C_SCMTELMATCHING_H
+#define C_SCMTELMATCHING_H
+
+#include <telmatchingextension.h>
+
+class CSvtUriParser;
+class CSvtSettingsHandler;
+
+/**
+ *  Main class for svtmatching.
+ *
+ *  @lib svtmatching
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS(CSvtMatching) :
+    public CTelMatchingExtension
+  {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSvtMatching* NewL();
+  
+  
+    /**
+     * Destructor.
+     */
+    ~CSvtMatching();
+
+    
+// from base class CTelMatchingExtension
+    
+    /**
+     * Initialize class after it is created with NewL.
+     * @param aServiceId - This id identify what service is currently used in call.
+     * @param aOrigAddress - Original address.
+     */
+    void InitializeL( TUint aServiceId, const TDesC& aOrigAddress );
+
+    /**
+     * Returns parsed address to be used in contact matching.
+     * Sets aParsedAddress parameter as empty (KNullDesC) if original number should be used
+     * in contact matching. 
+     * @param aParsedAddress - Address parsed by plugin. This address will be used for matching.
+     * @param aMeaningfulDigits - How many digits (starting from the right) are meaningful for matching.
+     *                            Value of the parameter have to be between 4-20 otherwise the whole
+     *                            of address will be used for matching (e.g. by value 0).
+     *                            If length of the address is less than value of the parameter the whole
+     *                            of address will be used for matching.
+     * @return - Return KErrNone if operation succeed.
+     */
+    TInt GetAddressForMatching( RBuf& aParsedAddress, TInt& aMeaningfulDigits );
+
+    /**
+     * Returns contact store uris which are opened and will be used for matching.
+     * @param aStoreUris - Contact store uri array.
+     * @return - Return KErrNone if operation succeed.
+     */
+    TInt GetContactStoreUris( CDesCArray& aStoreUris );
+
+    /**
+     * Returns remote party name (remote party name is shown in the call bubble).
+     * Sets aRemotePartyName parameter as empty (KNullDesC) if remote party name is not available.
+     * Remote party name (aRemotePartyName) will be shown in the call bubble when contact 
+     * matching not succeed.
+     * @param aRemotePartyName - Remote party name.
+     * @return - Return KErrNone if operation succeed.
+     */
+    TInt GetRemotePartyName( RBuf& aRemotePartyName );
+
+private:
+    
+    CSvtMatching();
+
+    void ConstructL();
+      
+private:    // data
+
+    /**
+     * Service id
+     */
+    TUint iServiceId;
+ 
+    /**
+     * Pointer to settings handler.
+     * Own.
+     */
+    CSvtSettingsHandler* iSettingsHandler; 
+    
+    /**
+     * Pointer to Uri parser.
+     * Own.
+     */
+    CSvtUriParser* iUriParser;
+    
+    /**
+     * Pointer for original address.
+     * Own.
+     */
+    HBufC*  iOriginalAddress;
+ 
+#ifdef _DEBUG   
+    friend class T_CSvtMatchingPlugin;
+#endif
+    
+  };  
+
+#endif  // C_SCMTELMATCHING_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtmatching/inc/svtsettingshandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Settings handler class for svtmatching.
+*
+*/
+
+
+#ifndef C_SVTSETTINGSHANDLER_H
+#define C_SVTSETTINGSHANDLER_H
+
+#include <e32base.h>
+#include <badesca.h>
+
+class CRCSEProfileRegistry;
+class CSPSettings;
+
+/**
+ *  Settings handler class for svtmatching.
+ *
+ *  @lib svtmatching
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CSvtSettingsHandler ) : public CBase
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSvtSettingsHandler* NewL();
+  
+  
+    /**
+     * Destructor.
+     */
+    virtual ~CSvtSettingsHandler();
+ 
+    /**
+     * Initializes settings for parsing.
+     * @param aServiceId - This id identify what service is currently used.
+     */    
+    void InitializeSettingsL( TUint aServiceId );
+ 
+    /**
+     * Returns how many digits are meaningful for matching (from rcse).
+     * InitializeSettingsL should to be called before this.
+     * @return  - Value of meaningful digits.
+     */
+    TInt MeaningfulDigits() const;
+
+    /**
+     * Returns value of ignore domain part setting (from rcse).
+     * InitializeSettingsL should to be called before this.
+     * @return  - Value of ignore domain part setting.
+     */
+    TUint IgnoreDomainPartValue() const;
+
+    /**
+     * Gets services contact store uris that should
+     * be used for matching.
+     * InitializeSettingsL should to be called before this.
+     * @param Contact store uri array.
+     * @return  KErrNone if succeed.
+     */
+    TInt GetContactStoreUris( CDesCArray& aStoreUris ) const;
+    
+private:
+
+    /**
+     * Returns services contact store uris that should
+     * be used for matching.
+     * InitializeSettingsL should to be called before this.
+     * @leave Leaves if operation not succeed.
+     * @param Contact store uri array.
+     */
+    void GetContactStoreUrisL( CDesCArray& aStoreUris ) const;
+
+    /**
+     * Creates a new instance of rcse profile registry.
+     * @return Pointer to rcse profile registry.
+     */
+    CRCSEProfileRegistry* CreateRcseRegistryLC() const;
+
+    /**
+     * Creates a new instance of service provider settings.
+     * @return Pointer to SPSettings.
+     */
+    CSPSettings* CreateSpSettingsLC() const;
+    
+private:
+    
+    CSvtSettingsHandler();
+    
+private: // Data
+
+    /**
+     * Value of ignore domain part setting.
+     */
+    TUint iIgnoreDomainPart;
+    
+    /**
+     * Meaningful digits
+     */
+    TInt iMeaningfulDigits;
+    
+    /**
+     * Service id
+     */
+    TUint iServiceId;
+
+#ifdef _DEBUG    
+    friend class T_CSvtSettinsHandler;
+#endif
+    
+    };
+
+#endif //C_SVTSETTINGSHANDLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtmatching/inc/svturiparser.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,126 @@
+/*
+* 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:  Uri parser class for svtmatching.
+*
+*/
+
+
+#ifndef C_SVTURIPARSER_H
+#define C_SVTURIPARSER_H
+
+#include <e32base.h>
+
+
+/**
+ *  Uri parser class for svtmatching.
+ *
+ *  @lib svtmatching
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CSvtUriParser ) : public CBase
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CSvtUriParser* NewL();
+  
+  
+    /**
+     * Destructor.
+     */
+    ~CSvtUriParser();
+ 
+    /**
+     * Parses address by rcse's ignore domain part setting.
+     * @param aIgnoreDomain - Value of ignore domain part setting.
+     * @param aOriginal - Original address to be parsed.
+     * @param aParsedAddress - Parsed address.
+     */     
+    void ParseAddressL( TInt aIgnoreDomain, 
+                        const TDesC& aOriginal, 
+                        RBuf& aParsedAddress ) const;
+
+    /**
+     * Parses displayname part from uri.
+     * @param aData - Original uri.
+     * @param aDisplayname - Uris displayname part if found from
+     *                       original uri.
+     * @return KErrNone if succeed
+     */ 
+    TInt DisplayNameFromUri( const TDesC& aData, RBuf& aDisplayname ) const;
+    
+    /**
+     * Parses displayname part from uri.
+     * @leave Leaves with system wide error.
+     * @param aData - Original uri.
+     * @param aDisplayname - Uris displayname part if found from
+     *                       original uri.
+     * @param aResult - Result of operation, KErrNone if success.
+     */ 
+    void DisplayNameFromUriL( const TDesC& aData, RBuf& aDisplayname, TInt& aResult ) const;
+    
+    /**
+     * Checks sip uri for spaces in begin and end of string.
+     * @leave Leaves on failure.
+     * @param aOriginal - Original sip uri.
+     * @param aCheckedAddress - checked sip uri.
+     */ 
+    void CheckForSpacesL( const TDesC& aOriginal, 
+                          RBuf& aCheckedAddress ) const;
+
+private:
+    
+    /**
+     * Checks is a string valid for CS call.
+     * @param aOriginal - String to be checked.
+     * @return ETrue if string valid for CS call.
+     */ 
+    TBool IsValidGsmNumber( const TDesC& aOriginal ) const;
+    
+    /**
+     * Parses username part from sip uri.
+     * @param aOriginal - Original sip uri.
+     * @param aUserName - Username part of the sip uri.
+     * @return KErrNone if operation succeed.
+     */ 
+    TInt GetUserNamePart( const TDesC& aOriginal,
+                          TDes& aUserName  ) const;
+    
+    /**
+     * Handles username parts for ignore domain part setting
+     * values 1 and 2.
+     * @leave Leaves on failure.
+     * @param aIgnoreDomain - Value of ignore domain part setting.
+     * @param aOriginal - Original sip uri.
+     * @param aParsedAddress - Parsed sip uri.
+     */ 
+    void HandleUserNamePartL( TInt aIgnoreDomain, 
+                              const TDesC& aOriginal, 
+                              RBuf& aParsedAddress ) const;
+    
+private:
+    
+    CSvtUriParser();
+    
+private: // Data
+
+#ifdef _DEBUG    
+    friend class T_CSvtUriParser;
+#endif
+    
+    };
+
+#endif //C_SVTURIPARSER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtmatching/rom/svtmatching.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 description file for project sipvoiptelmatching
+*
+*/
+
+
+#ifndef SIPVOIPTELMATCHING_IBY
+#define SIPVOIPTELMATCHING_IBY
+
+ECOM_PLUGIN( svtmatching.dll, 2001E2C9.rsc )
+    
+#endif // SIPVOIPTELMATCHING_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtmatching/src/svtmatching.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,206 @@
+/*
+* 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:  Main class for svtmatching.
+*
+*/
+
+
+#include <implementationproxy.h>
+#include <data_caging_path_literals.hrh>
+
+#include "svtmatching.h"
+#include "svtsettingshandler.h"
+#include "svturiparser.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+void CSvtMatching::ConstructL()
+    {
+    iSettingsHandler = CSvtSettingsHandler::NewL();
+    iUriParser = CSvtUriParser::NewL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtMatching::CSvtMatching()
+    {
+    }
+
+  
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtMatching* CSvtMatching::NewL()
+    {
+    CSvtMatching* self = new ( ELeave ) CSvtMatching;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtMatching::~CSvtMatching()
+    {
+    delete iUriParser;
+    delete iSettingsHandler;
+    delete iOriginalAddress;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Initializes plugin
+// ---------------------------------------------------------------------------
+//
+void CSvtMatching::InitializeL( 
+    TUint aServiceId, 
+    const TDesC& aOrigAddress )
+    {
+    if ( 0 == aOrigAddress.Length() ||
+         0 == aServiceId )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    iSettingsHandler->InitializeSettingsL( aServiceId );
+        
+    // Check original address for spaces. If found found begin or end
+    // of string, remove them.
+    RBuf checkedAddress;
+    CleanupClosePushL( checkedAddress );  
+    iUriParser->CheckForSpacesL( aOrigAddress, checkedAddress );
+    
+    // Realloc buffer
+    delete iOriginalAddress;
+    iOriginalAddress = NULL;
+    iOriginalAddress = HBufC::NewL( checkedAddress.Length() );
+    iOriginalAddress->Des().Copy( checkedAddress ); 
+    CleanupStack::PopAndDestroy( &checkedAddress );
+    
+    iServiceId = aServiceId;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// Gets address and meaningful digits for matching.
+// ---------------------------------------------------------------------------
+//
+TInt CSvtMatching::GetAddressForMatching( 
+    RBuf& aParsedAddress, 
+    TInt& aMeaningfulDigits )
+    {
+    if( iServiceId == 0 || !iOriginalAddress )
+        {
+        return KErrNotReady;
+        }
+    
+    aParsedAddress.Close();
+    TInt ret = aParsedAddress.Create( iOriginalAddress->Length() );
+    
+    if ( KErrNone == ret )
+        {
+        TRAP( ret, iUriParser->ParseAddressL( 
+                iSettingsHandler->IgnoreDomainPartValue(), 
+                *iOriginalAddress, 
+                aParsedAddress ) );
+        
+        if ( KErrNone == ret )
+            {
+            aMeaningfulDigits = iSettingsHandler->MeaningfulDigits();
+            }
+        }        
+    return ret;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Gets contact store uris
+// ---------------------------------------------------------------------------
+//
+TInt CSvtMatching::GetContactStoreUris( CDesCArray& aStoreUris )
+    {
+    if( iServiceId == 0 )
+        {
+        return KErrNotReady;
+        }
+    
+    return iSettingsHandler->GetContactStoreUris( aStoreUris );
+    }
+   
+    
+// ---------------------------------------------------------------------------
+// Gets remote party name
+// ---------------------------------------------------------------------------
+//
+TInt CSvtMatching::GetRemotePartyName( RBuf& aRemotePartyName )
+    {
+    if( iServiceId == 0 || !iOriginalAddress )
+        {
+        return KErrNotReady;
+        }
+
+    aRemotePartyName.Close();
+    
+    TInt ret = iUriParser->DisplayNameFromUri(
+                    *iOriginalAddress, 
+                    aRemotePartyName );
+    
+    if ( KErrNoMemory == ret )
+        {
+        return ret;
+        }
+ 
+    // If displayname is not found aRemotePartyName
+    // will be empty and return value is still KErrNone.
+    return KErrNone;
+    }    
+    
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =======================
+
+//
+// Rest of the file is for ECom initialization. 
+//
+
+// Map the interface UIDs
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( 
+        0x2001E2A5, CSvtMatching::NewL )
+    };
+
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy implements for ECom
+// Exported proxy for instantiation method resolution
+// Returns: ImplementationTable
+// ---------------------------------------------------------------------------
+//
+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/voipplugins/svtmatching/src/svtsettingshandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 handler class for svtmatching.
+*
+*/
+
+
+#include <spsettings.h>
+#include <spdefinitions.h>
+#include <spproperty.h>
+#include <crcseprofileregistry.h>
+
+#include "svtsettingshandler.h"
+#include "svtcleanup.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtSettingsHandler::CSvtSettingsHandler()
+    {
+    }
+
+  
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtSettingsHandler* CSvtSettingsHandler::NewL()
+    {
+    CSvtSettingsHandler* self = new ( ELeave ) CSvtSettingsHandler;
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtSettingsHandler::~CSvtSettingsHandler()
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// Initializes settings
+// ---------------------------------------------------------------------------
+//
+void CSvtSettingsHandler::InitializeSettingsL( TUint aServiceId )
+    {
+    CRCSEProfileRegistry* registry = CreateRcseRegistryLC();
+    
+    RPointerArray<CRCSEProfileEntry> entries;
+    // Cleanup for pointer array
+    CleanupResetAndDestroy< 
+        RPointerArray< CRCSEProfileEntry > >::PushL( entries );
+    
+    // Find voip settings by service id
+    registry->FindByServiceIdL( aServiceId, entries );
+    if ( 0 == entries.Count() )
+        {
+        User::Leave( KErrNotFound );
+        }
+    
+    // Ignore domain part setting from rcse
+    iIgnoreDomainPart = entries[0]->iIgnoreAddrDomainPart;
+    // Meaningful digits for matching
+    iMeaningfulDigits = entries[0]->iMeanCountOfVoIPDigits;
+    // Service id
+    iServiceId = aServiceId;
+    
+    CleanupStack::PopAndDestroy( &entries );
+    CleanupStack::PopAndDestroy( registry );
+    }
+
+// ---------------------------------------------------------------------------
+// Returns value of meaningful digits
+// ---------------------------------------------------------------------------
+//
+TInt CSvtSettingsHandler::MeaningfulDigits() const
+    {
+    return iMeaningfulDigits;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns value of ignore domain part setting
+// ---------------------------------------------------------------------------
+//
+TUint CSvtSettingsHandler::IgnoreDomainPartValue() const
+    {
+    return iIgnoreDomainPart;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets contact store uris
+// ---------------------------------------------------------------------------
+//
+TInt CSvtSettingsHandler::GetContactStoreUris( CDesCArray& aStoreUris ) const
+    {
+    TRAPD( ret, GetContactStoreUrisL( aStoreUris ) );
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets contact store uris
+// ---------------------------------------------------------------------------
+//
+void CSvtSettingsHandler::GetContactStoreUrisL( CDesCArray& aStoreUris ) const
+    {
+    // Get contact store id from Service Table
+    //KSPMaxDesLength from spdefinitions.h
+    HBufC* cntStoreId = HBufC::NewLC( KSPMaxDesLength );
+    CSPSettings* spSettings = CreateSpSettingsLC(); 
+    
+    CSPProperty* property = CSPProperty::NewLC();
+    User::LeaveIfError( spSettings->FindPropertyL( 
+            TServiceId( iServiceId ), EPropertyContactStoreId, *property ) ); 
+                           
+               
+    TPtr storeUri( cntStoreId->Des() );
+    User::LeaveIfError( property->GetValue( storeUri ) );   
+    
+    aStoreUris.AppendL( storeUri );
+    
+    CleanupStack::PopAndDestroy( property ); 
+    CleanupStack::PopAndDestroy( spSettings ); 
+    CleanupStack::PopAndDestroy( cntStoreId ); 
+    }
+
+// ---------------------------------------------------------------------------
+// Returns new instance of rcse registry
+// ---------------------------------------------------------------------------
+//
+CRCSEProfileRegistry* CSvtSettingsHandler::CreateRcseRegistryLC() const
+    {
+    return CRCSEProfileRegistry::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Returns new instance of SPSettings
+// ---------------------------------------------------------------------------
+//
+CSPSettings* CSvtSettingsHandler::CreateSpSettingsLC() const
+    {
+    return CSPSettings::NewLC();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/svtmatching/src/svturiparser.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,323 @@
+/*
+* 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:  Settings handler class for svtmatching.
+*
+*/
+
+
+#include "svturiparser.h"
+
+// Valid characters for GSM call
+_LIT( KPhoneValidChars, "0123456789*#+pwPW" );
+// For parsing protocol prefix and domain part out of a VoIP call URI
+_LIT( KSvtColon, ":" );
+_LIT( KSvtAt, "@" );
+// Indicates the start of sip uri.
+const TUint KStartBracket = '<'; 
+// Indicates the end of sip uri.
+const TUint KEndBracket = '>'; 
+const TUint KSpaceMark = ' ';
+const TUint KQuotationMark = '"';
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtUriParser::CSvtUriParser()
+    {
+    }
+
+  
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtUriParser* CSvtUriParser::NewL()
+    {
+    CSvtUriParser* self = new ( ELeave ) CSvtUriParser;
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+//
+CSvtUriParser::~CSvtUriParser()
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// Parses sip uri by ignore domain part setting
+// ---------------------------------------------------------------------------
+//
+void CSvtUriParser::ParseAddressL( 
+        TInt aIgnoreDomain, 
+        const TDesC& aOriginal, 
+        RBuf& aParsedAddress ) const
+    {
+    switch ( aIgnoreDomain )
+        {
+        case 1:
+        case 2:
+            {
+            HandleUserNamePartL( aIgnoreDomain, aOriginal, aParsedAddress );
+            break;
+            }
+        case 0:
+        default:
+            {
+            aParsedAddress.Close();
+            aParsedAddress.CreateL( aOriginal );
+            break;
+            }
+        
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Resolves display name from sip uri
+// ---------------------------------------------------------------------------
+//
+TInt CSvtUriParser::DisplayNameFromUri( 
+        const TDesC& aData, 
+        RBuf& aDisplayname ) const
+    {
+    TInt result = KErrNotFound;
+
+    TRAPD( err, DisplayNameFromUriL( aData, aDisplayname, result ) );
+    if ( err )
+        {
+        result = err;
+        }
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// The inner logic for resolving display name from sip uri
+// ---------------------------------------------------------------------------
+//
+void CSvtUriParser::DisplayNameFromUriL(
+        const TDesC& aData,
+        RBuf& aDisplayname,
+        TInt& aResult ) const
+    {
+    aResult = KErrNotFound;
+    
+    TPtrC preResultStr( aData );
+    aDisplayname.Close();
+    
+    HBufC* tempBuffer = preResultStr.AllocLC(); // CS:1
+    tempBuffer->Des().TrimAll();
+    
+    if ( tempBuffer->Length() )
+        {
+        TPtrC resultStr( tempBuffer->Des() );
+
+        // resolves potential SIP Display info and removes it from uri
+        // also possible "<" and ">" character are removed around the SIP uri
+        TInt uriStartIndex = resultStr.LocateReverse( KStartBracket );      
+        TInt uriEndIndex = resultStr.LocateReverse( KEndBracket );       
+        
+        if ( KErrNotFound != uriStartIndex && KErrNotFound != uriEndIndex )
+            {
+            if ( uriStartIndex < uriEndIndex )
+                {
+                // brackets found so modify descriptor and save the display info
+                
+                // check if there is anything before "<" if there is use
+                // it as displayname if match op fails.
+                if ( uriStartIndex > 1 )
+                    {        
+                    TPtrC tempStr( resultStr.Left( uriStartIndex ) );          
+                    // remove possible quotation marks from displayname
+                    TInt index = tempStr.Locate( KQuotationMark );
+                    if ( KErrNotFound != index )
+                        {
+                        // marks have to be removed
+                        tempStr.Set( tempStr.Mid( ++index ) );    
+                        if ( tempStr[tempStr.Length() - 1] == KQuotationMark )
+                            {
+                            tempStr.Set( tempStr.Left( tempStr.Length() - 1 ) );
+                            }
+                        }
+                    aResult = aDisplayname.Create( tempStr );
+                    }                      
+                }
+            else
+                {
+                // Start and end separators in wrong order: "xxxx>xxxx<xxx"
+                aResult = KErrArgument;
+                }
+            }        
+        else 
+            {
+            // it is also possible that displayname is included, in case there's
+            // no brackets around the uri. So if there is something
+            // inside quotationMarks it should be used as displayname
+    
+            // check if displayname is found
+            TInt displayNameStart = resultStr.Locate( KQuotationMark );
+            TInt displayNameEnd = resultStr.LocateReverse( KQuotationMark );
+    
+            if ( displayNameStart != KErrNotFound 
+                && displayNameEnd != KErrNotFound 
+                && displayNameStart < displayNameEnd )
+                {
+                // displayname is included
+                // +1, to remove quotationMark from the start
+                // -1, to remove quotationMark from the end
+                aResult = aDisplayname.Create( resultStr.Mid( displayNameStart + 1,
+                                       displayNameEnd - displayNameStart - 1 ) );
+                }                                
+            else
+                {
+                // check if there is spaces in the uri. If there is,
+                // everything before it belongs to display name                
+                TInt index = resultStr.LocateReverse( KSpaceMark );
+                
+                if ( KErrNotFound != index )            
+                    {
+                    // set displayname
+                    aResult = aDisplayname.Create( resultStr.Left( index ) );
+                    }            
+                }
+             }
+        }
+    else
+        {
+        // Invalid data length
+        aResult = KErrArgument;
+        }
+
+    CleanupStack::PopAndDestroy( tempBuffer ); // CS:0
+    }
+
+// ---------------------------------------------------------------------------
+// Check original address for spaces. 
+// ---------------------------------------------------------------------------
+//
+void CSvtUriParser::CheckForSpacesL(
+    const TDesC& aOriginal, 
+    RBuf& aCheckedAddress ) const
+    {
+    aCheckedAddress.CreateL( aOriginal );
+    
+    TInt index( 0 );
+    while ( index != KErrNotFound )
+        {
+        index = aCheckedAddress.Locate( KSpaceMark );
+        
+        // Remove space if it´s in begin or end of string
+        if ( index == 0 || ( index == ( aCheckedAddress.Length() - 1 ) ) )
+            {
+            aCheckedAddress.Delete( index, 1 );
+            }
+        else
+            {
+            index = KErrNotFound;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Check is string valid for gsm call
+// ---------------------------------------------------------------------------
+//
+TBool CSvtUriParser::IsValidGsmNumber( const TDesC& aOriginal ) const
+    {
+    TLex input( aOriginal );
+    TPtrC valid( KPhoneValidChars );
+
+    while ( valid.Locate( input.Peek() ) != KErrNotFound )
+        {
+        input.Inc();
+        }
+  
+    return !input.Remainder().Length();
+    }
+
+// ---------------------------------------------------------------------------
+// Gets username part from sip uri
+// ---------------------------------------------------------------------------
+//
+TInt CSvtUriParser::GetUserNamePart( 
+        const TDesC& aOriginal,
+        TDes& aUserName ) const
+    {
+    if ( aOriginal.Length() > aUserName.MaxLength() )
+        {
+        return KErrArgument;
+        }
+    
+    aUserName.Copy( aOriginal );
+    
+    // Parse protocol prefix and domain part out of a VoIP call URI
+    TInt pos( aUserName.Find( KSvtColon ) );
+    if ( pos > KErrNotFound )
+        {
+        aUserName.Delete( 0, pos+1 );
+        }                
+        
+    pos = aUserName.Find( KSvtAt );
+    if ( pos > KErrNotFound )
+        {
+        aUserName.Delete( pos, aUserName.Length() - pos );
+        }
+    
+    if ( 0 == aUserName.Length() )
+        {
+        return KErrNotFound;
+        }
+    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles sip uri's username part for ignore domain part values 1 and 2
+// ---------------------------------------------------------------------------
+//
+void CSvtUriParser::HandleUserNamePartL( 
+        TInt aIgnoreDomain, 
+        const TDesC& aOriginal, 
+        RBuf& aParsedAddress ) const
+    {
+    if ( 0 == aOriginal.Length() )
+        {
+        User::Leave( KErrArgument );
+        }
+    
+    HBufC* buf = HBufC::NewLC( aOriginal.Length() );
+    TPtr des( buf->Des() );
+    
+    User::LeaveIfError( GetUserNamePart( aOriginal, des ) );
+    
+    aParsedAddress.Close();
+    
+    if ( ( 1 == aIgnoreDomain && IsValidGsmNumber( des ) ) ||
+           2 == aIgnoreDomain )
+        {
+        // Set parsed address
+        User::LeaveIfError( aParsedAddress.Create( des ) );
+        }
+    else
+        {
+        User::LeaveIfError( aParsedAddress.Create( aOriginal ) );
+        }
+        
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/data/10275411.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* 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:  Resource definitions for project WPGeneralVoIPSettingsAdapter
+*
+*/
+
+
+#include <registryinfov2.rh>
+#include "wpgeneralvoipsettingsadapteruids.h"
+
+// ---------------------------------------------------------------------------
+//   
+//    theInfo
+//    Resource defining the General VoIP Settings Adapter plugin.
+//
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+	{
+	resource_format_version = RESOURCE_FORMAT_VERSION_2;
+	dll_uid = KProvisioningGeneralVoIPSettingsAdapterDllUid3;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = KProvisioningAdapterInterface;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KProvisioningGeneralVoIPSettingsAdapterUid;
+					version_no = 1;
+					display_name = "General VoIP Settings Provisioning Adapter||Copyright © 2006 Nokia Corporation.";
+					default_data = "";
+					opaque_data = "10";
+					rom_only = 1;
+					}
+
+				};
+			}
+		};
+	}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/data/WPGeneralVoIPSettingsAdapter.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,35 @@
+/*
+* 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:  Resource definitions for project WPGeneralVoIPSettingsAdapter
+*
+*/
+
+
+//  NAME    ?resource_name
+
+#include <badef.rh>
+#include <bldvariant.hrh>
+#include "wpgeneralvoipsettingsadapter.loc"
+
+// Rich text labels
+RESOURCE LBUF r_qtn_sm_head_general_voip_settings
+	{
+	txt = qtn_sm_head_general_voip_settings;
+	}
+RESOURCE LBUF r_qtn_sm_default_name_general_voip_settings
+	{
+	txt = qtn_sm_default_name_general_voip_settings;
+	}
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for GeneralVoIPSettingsAdapter
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/wpgeneralvoipsettingsadapter.iby CORE_APP_LAYER_IBY_EXPORT_PATH( wpgeneralvoipsettingsadapter.iby )
+
+../rom/wpgeneralvoipsettingsadapterresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH( wpgeneralvoipsettingsadapterresources.iby )
+
+../loc/wpgeneralvoipsettingsadapter.loc APP_LAYER_LOC_EXPORT_PATH( wpgeneralvoipsettingsadapter.loc )
+
+PRJ_MMPFILES
+./wpgeneralvoipsettingsadapter.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/group/wpgeneralvoipsettingsadapter.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,57 @@
+/*
+* 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 file provides the information required for building the
+*                whole of a CWPGeneralVoIPSettingsAdapter.dll.
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          wpgeneralvoipsettingsadapter.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x10275411
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN
+
+SOURCEPATH      ../src
+SOURCE          cwpgeneralvoipsettingsadapter.cpp
+SOURCE          wpgeneralvoipsettingsadaptergroupproxy.cpp
+SOURCE          wpgeneralvoipsettingsadaptermain.cpp
+
+SOURCEPATH      ../data
+
+START RESOURCE 10275411.rss
+TARGET wpgeneralvoipsettingsadapter.rsc
+END
+
+START RESOURCE WPGeneralVoIPSettingsAdapter.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+USERINCLUDE     .
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom 
+
+LIBRARY        	euser.lib 
+LIBRARY	        provisioningengine.lib
+LIBRARY         charconv.lib
+LIBRARY         centralrepository.lib
+LIBRARY         rcse.lib
+LIBRARY         featmgr.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/inc/cwpgeneralvoipsettingsadapter.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,504 @@
+/*
+* 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:  ?Description
+*
+*/
+
+
+#ifndef CWPGENERALVOIPSETTINGSADAPTER_H
+#define CWPGENERALVOIPSETTINGSADAPTER_H
+
+#include <CWPAdapter.h>
+#include <MWPContextExtension.h>
+
+class CWPCharacteristic;
+
+/**
+ *  Realizes general VoIP settings provisioning adapter.
+ *
+ *  General VoIP settings adapter handles general VoIP settings and stores
+ *  them via Central Repository.
+ *
+ *  @lib CWPGeneralVoIPSettingsAdapter.lib
+ *  @since S60 v3.0.
+ */
+class CWPGeneralVoIPSettingsAdapter : public CWPAdapter, public MWPContextExtension
+    {
+    #ifdef _DEBUG
+    /**
+     * Friend class for unit testing.
+     */
+    friend class UT_CWPGeneralVoIPSettingsAdapter;
+    #endif
+
+    public:
+
+        static CWPGeneralVoIPSettingsAdapter* NewL();
+
+        virtual ~CWPGeneralVoIPSettingsAdapter();
+
+        /**
+         * Setter for iName.
+         *
+         * @since S60 v3.0.
+         * @param aName User viewable name of general VoIP settings.
+         */
+        void SetNameL( const TDesC& aName );
+ 
+        /**
+         * Setter for iToAppref. Value is changed only if iToApprefSet
+         * is EFalse.
+         *
+         * @since S60 v3.2.3.
+         * @param aToAppRef Value for TO-APPREF. Links to VoIP settings.
+         */
+        void SetToApprefL( const TDesC8& aToAppRef ); 
+        
+        /**
+         * Setter for iClir.
+         *
+         * @since S60 v3.0.
+         * @param aClir Value for VoIP CLIR enabling rule.
+         */
+        void SetClir( const TInt aClir );
+ 
+        /**
+         * Setter for iACBRule.
+         *
+         * @since S60 v3.0.
+         * @param aACBRule Value for anonymous call blocking rule.
+         */
+        void SetACBRule( const TInt aACBRule );
+ 
+        /**
+         * Setter for iPrefTel.
+         *
+         * @since S60 v3.0.
+         * @param aPrefTel Preferred telephony mode value.
+         */
+        void SetPrefTel( const TInt aPrefTel );
+
+        /**
+         * Setter for iDnd.
+         *
+         * @since S60 v3.0.
+         * @param aDnd Value for do not disturb setting.
+         */
+        void SetDnd( const TInt aDnd );
+
+        /**
+         * Setter for iPSCallWaiting.
+         *
+         * @since S60 v3.0.
+         * @param aPSCallWaiting Value for PS call waiting rule.
+         */
+        void SetPSCallWaiting( const TInt aPSCallWaiting );
+
+        /**
+         * Setter for iPrefTelLock.
+         *
+         * @since S60 v3.0.
+         * @param aPrefTelLock Value for telephony preference lock.
+         */
+        void SetPrefTelLock( const TInt aPrefTelLock );
+
+        /**
+         * Setter for iCsRadioWifiOff.
+         *
+         * @since S60 v3.0.
+         * @param aCsRadioWifiOff Value for turning CS radio off in WiFi mode.
+         */
+        void SetCsRadioWifiOff( const TInt aCsRadioWifiOff );
+
+        /**
+         * Getter for iProviderId.
+         *
+         * @since S60 v3.0.
+         * @return Provider of general VoIP settings.
+         */
+        TDesC& ProviderId();
+
+        /**
+         * Getter for iName.
+         *
+         * @since S60 v3.0.
+         * @return User viewable name of general VoIP settings.
+         */
+        TDesC& Name();
+
+        /**
+         * Getter for iClir.
+         *
+         * @since S60 v3.0.
+         * @return Value for VoIP CLIR enabling rule.
+         */
+        TInt Clir();
+
+        /**
+         * Getter for iACBRule.
+         *
+         * @since S60 v3.0.
+         * @return Value for anonymous call blocking rule.
+         */
+        TInt ACBRule();
+
+        /**
+         * Getter for iPrefTel.
+         *
+         * @since S60 v3.0.
+         * @return Preferred telephony mode value.
+         */
+        TInt PrefTel();
+
+        /**
+         * Getter for iDnd.
+         *
+         * @since S60 v3.0.
+         * @return Value for do not disturb setting.
+         */
+        TInt Dnd();
+
+        /**
+         * Getter for iPSCallWaiting.
+         *
+         * @since S60 v3.0.
+         * @return Value for call waiting rule.
+         */
+        TInt PSCallWaiting();
+
+        /**
+         * Getter for iPrefTelLock.
+         *
+         * @since S60 v3.0.
+         * @return Value for telephony preference lock.
+         */
+        TInt PrefTelLock();
+
+        /**
+         * Getter for iCsRadioWifiOff.
+         *
+         * @since S60 v3.0.
+         * @return Value for turning CS radio off in WiFi mode.
+         */
+        TInt CsRadioWifiOff();
+
+    // from base class CWPAdapter
+
+        /**
+         * From CWPAdapter.
+         * Checks the number of settings items.
+         *
+         * @since S60 v3.0.
+         * @return Quantity of items (always one).
+         */
+        TInt ItemCount() const;
+
+        /**
+         * From CWPAdapter.
+         * Getter for the summary title of general VoIP settings item. Text is
+         * shown to the user in an opened configuration message.
+         *
+         * @since S60 v3.0.
+         * @param aIndex Not used.
+         * @return Summary title.
+         */
+        const TDesC16& SummaryTitle( TInt /*aIndex*/ ) const;
+
+        /**
+         * From CWPAdapter.
+         * Getter for the summary text of general VoIP settings. Text is shown
+         * to the user in opened configuration message.
+         *
+         * @since S60 v3.0.
+         * @param aIndex Not used.
+         * @return Summary text.
+         */
+        const TDesC16& SummaryText( TInt /*aIndex*/ ) const;
+
+        /**
+         * From CWPAdapter.
+         * Saves general VoIP settings.
+         *
+         * @since S60 v3.0.
+         * @param aIndex Not used.
+         */
+        void SaveL( TInt /*aIndex*/ );
+
+        /**
+         * From CWPAdapter.
+         * Returns EFalse since there can only be one set of general VoIP
+         * settings.
+         *
+         * @since S60 v3.0.
+         * @param aIndex Location of the general VoIP settings item to
+         *        be queried. Not used.
+         * @return Information whether these settings can be set as default.
+         */
+        TBool CanSetAsDefault( TInt /*aIndex*/ ) const;
+
+        /**
+         * From CWPAdapter.
+         * Adapter sets the settings as default. Not supported.
+         *
+         * @since S60 v3.0.
+         * @param aIndex Location of the general VoIP settings item to be
+         *        set as default.
+         */
+        void SetAsDefaultL( TInt /*aIndex*/ )
+            {
+            };
+
+        /**
+         * From CWPAdapter.
+         * Query for detailed information about the general VoIP settings.
+         * This is not supported feature as in other adapters in the framework.
+         *
+         * @since S60 v3.0.
+         * @param aItem Not used but here because of inheritance.
+         * @param aVisitor Object for retrieveing details of a setting entry.
+         * @return KErrNotSupported if not supported.
+         */
+        TInt DetailsL( TInt aItem, MWPPairVisitor& aVisitor );
+
+        /**
+         * From CWPAdapter.
+         * Visit method. Visits the adapter. Adapter checks from 
+         * aCharacteristic if the data is targetet to it and acts according to
+         * that.
+         *
+         * @since S60 v3.0.
+         * @param aCharacteristic The characteristic found.
+         */
+        void VisitL( CWPCharacteristic& aCharacteristic );        
+
+        /**
+         * From CWPAdapter.
+         * Visit method. Visits the adapter. Method sets the iAppId value.
+         *
+         * @since S60 v3.0.
+         * @param aParameter The parameter found.
+         */
+        void VisitL( CWPParameter& aParameter );        
+
+        /**
+         * From CWPAdapter.
+         * Visit method. Not supported.
+         *
+         * @since S60 v3.0.
+         * @param aLink Link to the characteristic.
+         */
+        void VisitLinkL( CWPCharacteristic& /*aLink*/ )
+            {
+            };
+
+        /**
+         * From CWPAdapter.
+         * Informs the adapters of the saved settings. Not supported since
+         * this adapter does not communicate with other adapters.
+         *
+         * @since S60 v3.0.
+         * @param aAppIdOfSavingItem UID of the adapter component. 
+         * @param aAppRef APPREF of the saved settings.
+         * @param aStorageIdValue Value that identifies the settings in its
+         *        storage.
+         */
+        void SettingsSavedL ( const TDesC8& aAppIdOfSavingItem,
+            const TDesC8& aAppRef, const TDesC8& aStorageIdValue );
+
+        /**
+         * From CWPAdapter.
+         * Lets the adapters know when the saving has been finalized in 
+         * viewpoint of the provisioning framework. The adapters can make 
+         * finalization of saving the settings after receiving this call.
+         *
+         * @since S60 v3.0.
+         */
+        void SavingFinalizedL();
+
+    // from base class MWPContextExtension
+
+        /**
+         * From MWPContextExtension.
+         * Returns a pointer to a context extension.
+         *
+         * @since S60 v3.0.
+         * @param aExtension Contains a pointer to MWPContextExtension if
+         *                   supported.
+         * @return KErrNotSupported if not supported, otherwise KErrNone.
+         */
+        TInt ContextExtension( MWPContextExtension*& aExtension );
+
+        /**
+         * From MWPContextExtension.
+         * Returns the data used for saving.
+         *
+         * @since S60 v3.0.
+         * @param aIndex The index of the data.
+         * @return The data; ownership is transferred.
+         */
+        const TDesC8& SaveDataL( TInt /*aIndex*/ ) const;
+
+        /**
+         * From MWPContextExtension.
+         * Deletes a saved settings.
+         *
+         * @since S60 v3.0.
+         * @param aSaveData The data used for saving.
+         */
+        void DeleteL( const TDesC8& aSaveData );
+
+        /**
+         * From MWPContextExtension.
+         * Returns the UID of the adapter.
+         *
+         * @since S60 v3.0.
+         * @return UID of the adapter.
+         */
+        TUint32 Uid() const;
+
+    protected:
+
+    private:
+
+        CWPGeneralVoIPSettingsAdapter();
+
+        void ConstructL();
+
+    public:  // Data
+
+    private: // Data
+
+        /**
+         * Application ID of the current characteristic.
+         */
+        TPtrC iAppID;
+ 
+        /**
+         * Confirms whether APPID is correct (w9033).
+         */
+        TBool iIsAppIdOk;
+
+        /**
+         * Confirms whether iName has been correctly set.
+         */
+        TBool iIsNameOk;
+
+        /**
+         * Title for general VoIP settings. Value read from the resource file 
+         * in initiation phase.
+         * Own.
+         */
+        HBufC16* iTitle;
+
+        /**
+         * Holds the ID of saved data.
+         * Here because of inherited method SaveDataL.
+         * Own.
+         */
+        HBufC8* iSavedDataId;
+
+        /**
+         * Default name of general VoIP settings visible to user when viewing
+         * the provisioning message. Value is read from the resource file in
+         * initiation phase.
+         * Own.
+         */
+        HBufC* iDefaultName;
+
+        /**
+         * Name of general VoIP settings visible to user when viewing the
+         * provisioning message.
+         * Own.
+         */
+        HBufC* iName;
+
+        /**
+         * The VoIP APPREF references by TO-APPREF of general VoIP settings.
+         * Own.
+         */
+        HBufC8* iToAppref; 
+        
+        /**
+         * A flag indicating whether or not correct TO-APPREF value 
+         * has been found.
+         */
+        TBool iToApprefSet;
+
+        /**
+         * VoIP CLIR. Tells whether CLIR (Calling Line Identification
+         * Restriction) is enabled or disabled. See w9033.txt or
+         * VoIP software settings document.
+         * CP parameter: CLIR.
+         */
+        TInt iClir;
+
+        /**
+         * Anonymous Call Block rule. Determines the rule for Anonymous Call
+         * Block feature. See w9033.txt or VoIP software settings document.
+         * CP parameter: ACBRULE.
+         */
+        TInt iACBRule;
+
+        /**
+         * Preferred telephony. Tells which telephony mode is preferred.
+         * See w9033.txt or VoIP software settings document.
+         * CP parameter: PREFTEL.
+         */
+        TInt iPrefTel;
+
+        /**
+         * Do Not Disturb (DND) setting. See w9033.txt or VoIP software
+         * settings document.
+         * CP parameter: DND.
+         */
+        TInt iDnd;
+
+        /**
+         * Call waiting. Tells whether call waiting is enabled or disabled.
+         * See w9033.txt or VoIP software settings document.
+         * CP parameter: PSCALLWAITING.
+         */
+        TInt iPSCallWaiting;
+
+
+        /**
+         * Telephony preference lock. Tells whether preferred telephony mode 
+         * is UI editable. See w9033.txt or VoIP software settings document.
+         * CP parameter: PREFTELLOCK.
+         */
+        TInt iPrefTelLock;
+
+        
+        /**
+         * Shut down CS radio in WiFi mode. Tells whether CS radio is turned
+         * off in WiFi mode. See w9033.txt or VoIP software settings document.
+         * CP parameter: CSRADIOWIFIOFF.
+         */
+        TInt iCsRadioWifiOff;
+
+        /**
+         * Flag telling if feature manager has been initialized.
+         */
+        TBool iFeatMgrInitialized;
+
+        /**
+         * VoIP ID received from cpvoipadapter in SettingsSavedL method.
+         */
+        TUint32 iVoipId;
+
+    };
+
+#endif      // CWPGENERALVOIPSETTINGSADAPTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/inc/wpgeneralvoipsettingsadapteruids.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* 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:  UIDs for project.
+*
+*/
+
+
+#ifndef WPGENERALVOIDSETTINGSADAPTERUIDS_H
+#define WPGENERALVOIDSETTINGSADAPTERUIDS_H
+
+// MACROS
+ 
+// ECOM plugin
+#define KECOMUid2 0x10009D8D
+
+// UID2 for the GeneralVoIPSettingsAdapter. ECOM plug-in.
+#define KProvisioningGeneralVoIPSettingsAdapterDllUid2 KECOMUid2
+
+// UID3 for the GeneralVoIPSettingsAdapter DLL
+#define KProvisioningGeneralVoIPSettingsAdapterDllUid3 0x10275411
+
+// UID for the GeneralVoIPSettingsAdapter
+#define KProvisioningGeneralVoIPSettingsAdapterUid 0x10275412
+
+#define KProvisioningAdapterInterface 0x101F84D5
+
+#endif //  WPGENERALVOIDSETTINGSADAPTERUIDS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/loc/wpgeneralvoipsettingsadapter.loc	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Localization strings for project WPGeneralVoIPSettignsAdapter
+*
+*/
+
+
+// LOCALISATION STRINGS
+//d:Summary text for general VoIP settings.
+//l:msg_body_pane/opt
+//r:VoIP Rel3.0
+//
+#define qtn_sm_default_name_general_voip_settings "VoIP Terminal Settings"
+
+//d:Summary title for general VoIP settings.
+//l:msg_body_pane_t1
+//r:VoIP Rel3.0
+//
+#define qtn_sm_head_general_voip_settings "VoIP terminal settings"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/rom/wpgeneralvoipsettingsadapter.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* 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:  WPGeneralVoIPSettingsAdapter iby file
+*
+*/
+
+#ifndef __WPGENERALVOIPSETTINGSADAPTER_IBY__
+#define __WPGENERALVOIPSETTINGSADAPTER_IBY__
+
+#include <bldvariant.hrh>
+
+ECOM_PLUGIN(wpgeneralvoipsettingsadapter.dll,10275411.rsc) 
+
+#endif // __WPGENERALVOIPSETTINGSADAPTER_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/rom/wpgeneralvoipsettingsadapterresources.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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:  WPGeneralVoIPSettingsAdapter resources iby file
+*
+*/
+
+
+#ifndef __WPGENERALVOIPSETTINGSADAPTERRESOURCES_IBY__
+#define __WPGENERALVOIPSETTINGSADAPTERRESOURCES_IBY__
+
+#include <bldvariant.hrh>
+
+data=DATAZ_/RESOURCE_FILES_DIR/wpgeneralvoipsettingsadapter.rsc       RESOURCE_FILES_DIR/wpgeneralvoipsettingsadapter.rsc
+
+#endif // __WPGENERALVOIPSETTINGSADAPTERRESOURCES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/src/cwpgeneralvoipsettingsadapter.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,706 @@
+/*
+* 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:  Receives and stores general VoIP settings.
+*
+*/
+
+
+#include <e32base.h>
+#include <CWPAdapter.h>
+#include <CWPCharacteristic.h>
+#include <CWPParameter.h>
+#include <wpgeneralvoipsettingsadapter.rsg>
+#include <bldvariant.hrh>
+#include <commdb.h>
+#include <e32des8.h>
+#include <WPAdapterUtil.h> // Adapter utils
+#include <utf.h> // Unicode conversion
+#include <crcseprofileentry.h>
+#include <crcseprofileregistry.h>
+#include <settingsinternalcrkeys.h>
+#include <centralrepository.h>
+#include <featmgr.h>
+
+#include "cwpgeneralvoipsettingsadapter.h"
+
+// Application related constants.
+_LIT( KGeneralVoIPSettingsAdapterName, "WPGeneralVoIPSettingsAdapter");
+_LIT( KGeneralVoIPSettingsAppID, "w9033" ); // OMA CP registration document.
+const TInt KMaxCharsInTUint32 = 10;
+_LIT8( KVoIPAppID8,       "w9013" );
+
+// RESOURCE parameters.
+// OMA CP registration document for general VoIP settings.
+_LIT( KParmCLIR,           "CLIR" );
+_LIT( KParmACBRULE,        "ACBRULE" );
+_LIT( KParmPREFTEL,        "PREFTEL" );
+_LIT( KParmDND,            "DND" );
+_LIT( KParmPSCALLWAITING,  "PSCALLWAITING" );
+// GOANNA:
+_LIT( KParmPREFTELLOCK,    "PREFTELLOCK" );
+_LIT( KParmCSRADIOWIFIOFF, "CSRADIOWIFIOFF" );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::CWPGeneralVoIPSettingsAdapter
+// ---------------------------------------------------------------------------
+//
+CWPGeneralVoIPSettingsAdapter::CWPGeneralVoIPSettingsAdapter() : CWPAdapter()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::ConstructL()
+    {
+    TFileName fileName;
+    Dll::FileName( fileName );
+    
+    iTitle = WPAdapterUtil::ReadHBufCL( fileName,
+        KGeneralVoIPSettingsAdapterName,
+        R_QTN_SM_HEAD_GENERAL_VOIP_SETTINGS );
+    
+    iDefaultName = WPAdapterUtil::ReadHBufCL( fileName,
+        KGeneralVoIPSettingsAdapterName,
+        R_QTN_SM_DEFAULT_NAME_GENERAL_VOIP_SETTINGS );
+    
+    iName = HBufC::NewL( 0 );
+    iToAppref = HBufC8::NewL( 0 );
+
+    _LIT8( KFormatTxt,"%u" );
+    iSavedDataId    = HBufC8::NewL( KMaxCharsInTUint32 );
+    iSavedDataId->Des().Format( KFormatTxt, KCRUidRichCallSettings );
+
+    iIsAppIdOk      = EFalse;
+    iIsNameOk       = EFalse;
+    iClir           = KNotSet;
+    iACBRule        = KNotSet;
+    iPrefTel        = KNotSet;
+    iDnd            = KNotSet;
+    iPSCallWaiting  = KNotSet;
+    iPrefTelLock    = KNotSet;
+    iCsRadioWifiOff = KNotSet;
+    iVoipId         = (TUint32)KNotSet;
+
+    FeatureManager::InitializeLibL();
+    iFeatMgrInitialized = ETrue;
+    
+    if ( !FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
+        {
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::NewL
+// ---------------------------------------------------------------------------
+//
+CWPGeneralVoIPSettingsAdapter* CWPGeneralVoIPSettingsAdapter::NewL()
+    {
+    CWPGeneralVoIPSettingsAdapter* self = new (ELeave) 
+        CWPGeneralVoIPSettingsAdapter;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::~CWPGeneralVoIPSettingsAdapter
+// ---------------------------------------------------------------------------
+//
+CWPGeneralVoIPSettingsAdapter::~CWPGeneralVoIPSettingsAdapter()
+    {
+    delete iTitle;
+    delete iDefaultName;
+    delete iName;
+    delete iSavedDataId;
+    delete iToAppref;
+
+    if ( iFeatMgrInitialized )
+        {
+        FeatureManager::UnInitializeLib();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SetNameL
+// Set iName, the user viewable name of general VoIP settings.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::SetNameL( const TDesC& aName )
+    {
+    if ( !iIsNameOk )
+        {
+        delete iName;
+        iName = NULL;
+        iName = aName.AllocL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SetClir
+// Sets CLIR in enabled or disabled mode.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::SetClir( const TInt aClir )
+    {
+    iClir = aClir;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SetACBRule
+// Sets a rule for Anonymous Call Blocking feature.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::SetACBRule( const TInt aACBRule )
+    {
+    iACBRule = aACBRule;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SetPrefTel
+// Sets the preferred telephony mode.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::SetPrefTel( const TInt aPrefTel )
+    {
+    iPrefTel = aPrefTel;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SetDnd
+// Enables or disables the Do Not Disturb setting.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::SetDnd( const TInt aDnd )
+    {
+    iDnd = aDnd;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SetPSCallWaiting
+// Sets call waiting in enabled or disabled mode.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::SetPSCallWaiting( 
+    const TInt aPSCallWaiting )
+    {
+    iPSCallWaiting = aPSCallWaiting;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SetPrefTelLock
+// Enables or disables preferred telephony mode to be edited from UI.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::SetPrefTelLock( const TInt aPrefTelLock )
+    {
+    iPrefTelLock = aPrefTelLock;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SetCsRadioWifiOff
+// Sets CS radio in WiFi mode in turned on or off mode.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::SetCsRadioWifiOff( 
+    const TInt aCsRadioWifiOff )
+    {
+    iCsRadioWifiOff = aCsRadioWifiOff;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SetToApprefL
+// Sets TO-APPREF if it hasn't been set before.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::SetToApprefL( const TDesC8& aToAppRef )
+    {
+    if ( !iToApprefSet )
+        {        
+        delete iToAppref;
+        iToAppref = NULL;
+        iToAppref = aToAppRef.AllocL(); 
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::Name
+// Returns the user viewable name of general VoIP settings.
+// ---------------------------------------------------------------------------
+//
+TDesC& CWPGeneralVoIPSettingsAdapter::Name()
+    {
+    return *iName;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::Clir
+// Tells whether CLIR is enabled or disabled.
+// ---------------------------------------------------------------------------
+//
+TInt CWPGeneralVoIPSettingsAdapter::Clir()
+    {
+    return iClir;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::ACBRule
+// Returns the rule of Anonymous Call Blocking feature.
+// ---------------------------------------------------------------------------
+//
+TInt CWPGeneralVoIPSettingsAdapter::ACBRule()
+    {
+    return iACBRule;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::PrefTel
+// Returns the preferred telephony mode.
+// ---------------------------------------------------------------------------
+//
+TInt CWPGeneralVoIPSettingsAdapter::PrefTel()
+    {
+    return iPrefTel;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::Dnd
+// Returns the state of the Do Not Disturb setting.
+// ---------------------------------------------------------------------------
+//
+TInt CWPGeneralVoIPSettingsAdapter::Dnd()
+    {
+    return iDnd;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::PSCallWaiting
+// Returns the state of VoIP call waiting feature.
+// ---------------------------------------------------------------------------
+//
+TInt CWPGeneralVoIPSettingsAdapter::PSCallWaiting()
+    {
+    return iPSCallWaiting;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::PrefTelLock
+// Returns preferred telephony lock, i.e. tells whether preferred telephony
+// can be edited from UI.
+// ---------------------------------------------------------------------------
+//
+TInt CWPGeneralVoIPSettingsAdapter::PrefTelLock()
+    {
+    return iPrefTelLock;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::CsRadioWifiOff
+// Tells whether CS radio is turned off in WiFi mode.
+// ---------------------------------------------------------------------------
+//
+TInt CWPGeneralVoIPSettingsAdapter::CsRadioWifiOff()
+    {
+    return iCsRadioWifiOff;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::ItemCount
+// From class CWPAdapter.
+// Checks the number of settings items. Since there can only be one set of
+// general VoIP settings, always return 1.
+// ---------------------------------------------------------------------------
+//
+TInt CWPGeneralVoIPSettingsAdapter::ItemCount() const
+    {
+    return iIsAppIdOk ? 1 : 0;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CWPAdapter.
+// CWPGeneralVoIPSettingsAdapter::SummaryTitle
+// Returns the summary title of general VoIP settings item.
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CWPGeneralVoIPSettingsAdapter::SummaryTitle( 
+    TInt /*aIndex*/ ) const
+    {
+    if ( iIsAppIdOk )
+        {
+        return *iTitle;
+        }
+    return KNullDesC16;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SummaryText
+// From class CWPAdapter.
+// Returns the summary text of general VoIP settings.
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CWPGeneralVoIPSettingsAdapter::SummaryText( 
+    TInt /*aIndex*/ ) const
+    {
+    if ( iIsAppIdOk )
+        {
+        if ( 0 == iName->Length() )
+            {
+            return *iDefaultName;
+            }
+        return *iName;
+        }
+    return KNullDesC16;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SaveL
+// From class CWPAdapter.
+// Saves the general VoIP settings via Central Repository.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::SaveL( TInt /*aIndex*/ )
+    {
+    // Settings will not be saved if the APPID parameter is not w9033, i.e. 
+    // OMA APPID for general VoIP settings.
+    if ( iIsAppIdOk )
+        {
+        CRepository* cRepository = CRepository::NewLC( 
+            KCRUidRichCallSettings );
+        if( KNotSet != Clir() )
+            {
+            User::LeaveIfError( cRepository->Set( KRCSEClir, Clir() ) );
+            }
+        if ( KNotSet != ACBRule() )
+            {
+            User::LeaveIfError( cRepository->Set( KRCSEAnonymousCallBlockRule,
+                ACBRule() ) );
+            }
+        if ( KNotSet != PrefTel() )
+            {
+            User::LeaveIfError( cRepository->Set( KRCSEPreferredTelephony,
+                PrefTel() ) );
+            }
+        if ( KNotSet != Dnd() )
+            {
+            User::LeaveIfError( cRepository->Set( KRCSEDoNotDisturb,
+                Dnd() ) );
+            }
+        if ( KNotSet != PSCallWaiting() )
+            {
+            User::LeaveIfError( cRepository->Set( KRCSPSCallWaiting,
+                PSCallWaiting() ) );
+            }
+        CleanupStack::PopAndDestroy( cRepository );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::CanSetAsDefault
+// From class CWPAdapter.
+// Return EFalse since there can only be one set of general VoIP settings.
+// ---------------------------------------------------------------------------
+//
+TBool CWPGeneralVoIPSettingsAdapter::CanSetAsDefault( TInt /*aIndex*/ ) const
+    {
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::DetailsL
+// From class CWPAdapter.
+// Not supported.
+// ---------------------------------------------------------------------------
+//
+TInt CWPGeneralVoIPSettingsAdapter::DetailsL( TInt /*aItem*/, 
+    MWPPairVisitor& /*aVisitor */ )
+    {
+    return KErrNotSupported;
+    }  
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::VisitL
+// From class CWPAdapter.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::VisitL( 
+    CWPCharacteristic& aCharacteristic )
+    {
+    switch( aCharacteristic.Type() )
+        {
+        // Core general VoIP settings.
+        case KWPApplication:
+            {
+            aCharacteristic.AcceptL( *this );
+            if ( 0 == iAppID.Compare( KGeneralVoIPSettingsAppID() ) )
+                {
+                iIsAppIdOk = ETrue;
+                iIsNameOk = ETrue;
+                iToApprefSet = ETrue; // TO-APPREF can't be modified anymore.
+                }
+            if ( !iIsAppIdOk )
+                {
+                iName->Des().Zero(); // Otherwise iName may have wrong value.
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SettingsSavedL
+// From class CWPAdapter.
+// ---------------------------------------------------------------------------
+// 
+void CWPGeneralVoIPSettingsAdapter::SettingsSavedL( const TDesC8& aAppIdOfSavingItem,
+    const TDesC8& aAppRef, const TDesC8& aStorageIdValue )
+    {
+    if ( PrefTel() && KVoIPAppID8().CompareF( aAppIdOfSavingItem ) == 0 &&
+         0 == iToAppref->Compare( aAppRef ) )
+        {
+        TInt voipId;
+        TLex8 lex( aStorageIdValue );
+        User::LeaveIfError( lex.Val( voipId ) );
+        iVoipId = voipId;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::VisitL
+// From class CWPAdapter.
+// General VoIP settings parameters are handled in this method.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::VisitL( CWPParameter& aParameter )
+    {
+    // tmpValue holds the value converted from Unicode to UTF8.
+    HBufC8* tmpValue = HBufC8::NewLC( aParameter.Value().Length() ); // CS:1
+    TPtr8 ptrTmpValue( tmpValue->Des() );
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( ptrTmpValue,
+        aParameter.Value() );
+    
+    switch ( aParameter.ID() )
+        {
+        case EWPParameterToAppRef:
+            {
+            SetToApprefL( tmpValue->Des() );
+            }
+            break;
+            
+        case EWPParameterAppID:
+            {
+	        iAppID.Set( aParameter.Value() );
+            break;
+            }
+        
+        // Case 0 handles the general VoIP parameters that are extensions to
+        // OMA Client Provisioning parameter set.
+        case 0:
+            if ( 0 == aParameter.Name().Compare( KParmCLIR ) )
+                {
+                TInt tIntParameterValue;
+                TLex8 lex( tmpValue->Des() );
+                TInt err( KErrNone );            
+                err = lex.Val( tIntParameterValue );
+                if ( KErrNone != err )
+                    {
+                    break;
+                    }
+                SetClir( tIntParameterValue );    
+                }
+            else if ( 0 == aParameter.Name().Compare( KParmACBRULE ) )
+                {
+                TInt tIntParameterValue;
+                TLex8 lex( tmpValue->Des() );
+                TInt err( KErrNone );            
+                err = lex.Val( tIntParameterValue );
+                if ( KErrNone != err )
+                    {
+                    break;
+                    }
+                SetACBRule( tIntParameterValue );    
+                }
+            else if ( 0 == aParameter.Name().Compare( KParmPREFTEL ) )
+                {
+                TInt tIntParameterValue;
+                TLex8 lex( tmpValue->Des() );
+                TInt err( KErrNone );            
+                err = lex.Val( tIntParameterValue );
+                if ( KErrNone != err )
+                    {
+                    break;
+                    }
+                SetPrefTel( tIntParameterValue );
+                }
+            else if ( 0 == aParameter.Name().Compare( KParmDND ) )
+                {
+                TInt tIntParameterValue;
+                TLex8 lex( tmpValue->Des() );
+                TInt err( KErrNone );            
+                err = lex.Val( tIntParameterValue );
+                if ( KErrNone != err )
+                    {
+                    break;
+                    }
+                SetDnd( tIntParameterValue );    
+                }
+            else if ( 0 == aParameter.Name().Compare( KParmPSCALLWAITING ) )
+                {
+                TInt tIntParameterValue;
+                TLex8 lex( tmpValue->Des() );
+                TInt err( KErrNone );            
+                err = lex.Val( tIntParameterValue );
+                if ( KErrNone != err )
+                    {
+                    break;
+                    }
+                SetPSCallWaiting( tIntParameterValue );    
+                }
+            else if ( 0 == aParameter.Name().Compare( KParmPREFTELLOCK ) )
+                {
+                TInt tIntParameterValue;
+                TLex8 lex( tmpValue->Des() );
+                TInt err( KErrNone );            
+                err = lex.Val( tIntParameterValue );
+                if ( KErrNone != err )
+                    {
+                    break;
+                    }
+                SetPrefTelLock( tIntParameterValue );    
+                }
+            else if ( 0 == aParameter.Name().Compare( KParmCSRADIOWIFIOFF ) )
+                {
+                TInt tIntParameterValue;
+                TLex8 lex( tmpValue->Des() );
+                TInt err( KErrNone );            
+                err = lex.Val( tIntParameterValue );
+                if ( KErrNone != err )
+                    {
+                    break;
+                    }
+                SetCsRadioWifiOff( tIntParameterValue );    
+                }
+            break;
+            
+        case EWPParameterName: // APPLICATION/NAME
+            SetNameL( aParameter.Value() );
+            break;
+
+		default:
+			break;
+        }// switch
+    CleanupStack::PopAndDestroy( tmpValue ); // CS:0				
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SavingFinalizedL
+// From class CWPAdapter.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::SavingFinalizedL()
+    {
+    if ( (TUint32)KNotSet == iVoipId )
+        {
+        return;
+        }
+
+    // Get service ID from RCSE.
+    CRCSEProfileRegistry* registry = CRCSEProfileRegistry::NewLC();
+    CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();        
+
+    registry->FindL( iVoipId, *entry );        
+    TUint serviceId = entry->iServiceProviderId;
+
+    CleanupStack::PopAndDestroy( 2, registry ); // entry, registry
+
+    // Set the preferred service ID.
+    CRepository* repository = CRepository::NewL( KCRUidRichCallSettings );
+    repository->Set( KRCSPSPreferredService, (TInt)serviceId );
+    delete repository;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::ContextExtension
+// From class MWPContextExtension.
+// Returns a pointer to context extension.
+// ---------------------------------------------------------------------------
+//
+TInt CWPGeneralVoIPSettingsAdapter::ContextExtension( 
+    MWPContextExtension*& aExtension )
+    {
+    aExtension = this;
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::SaveDataL
+// From class MWPContextExtension.
+// Returns ID of saved data.
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CWPGeneralVoIPSettingsAdapter::SaveDataL( TInt /*aIndex*/ ) const
+    {
+    return *iSavedDataId;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::DeleteL
+// From class MWPContextExtension.
+// Deletes general VoIP settings from Central Repository.
+// ---------------------------------------------------------------------------
+//
+void CWPGeneralVoIPSettingsAdapter::DeleteL( const TDesC8& aSaveData )
+    {
+    TInt tInt( 0 );
+    TLex8 lex( aSaveData );
+    TInt err( KErrNone );            
+    err = lex.Val( tInt );
+    TUid cenRepUid = { tInt };
+    if ( KErrNone == err && KCRUidRichCallSettings == cenRepUid )
+        {
+        CRepository* cRepository = CRepository::NewLC( cenRepUid );
+        User::LeaveIfError( cRepository->Reset( KRCSEClir ) );
+        User::LeaveIfError( cRepository->Reset(
+            KRCSEAnonymousCallBlockRule ) );
+        User::LeaveIfError( cRepository->Reset( KRCSEPreferredTelephony ) );
+        User::LeaveIfError( cRepository->Reset( KRCSEDoNotDisturb ) );
+        User::LeaveIfError( cRepository->Reset( KRCSPSCallWaiting ) );
+        User::LeaveIfError( cRepository->Reset( KRCSPSPreferredService ) );
+        
+        CleanupStack::PopAndDestroy( cRepository );
+        cRepository = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CWPGeneralVoIPSettingsAdapter::Uid
+// From class MWPContextExtension.
+// Returns the UID of this adapter.
+// ---------------------------------------------------------------------------
+//
+TUint32 CWPGeneralVoIPSettingsAdapter::Uid() const
+    {
+    return iDtor_ID_Key.iUid;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/src/wpgeneralvoipsettingsadaptergroupproxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  General VoIP settings adapter implementation group proxy
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "wpgeneralvoipsettingsadapteruids.h"
+#include "cwpgeneralvoipsettingsadapter.h"
+
+// CONSTANTS
+const TImplementationProxy KImplementationTable[] = 
+    {
+	IMPLEMENTATION_PROXY_ENTRY( KProvisioningGeneralVoIPSettingsAdapterUid, 
+	CWPGeneralVoIPSettingsAdapter::NewL )
+    };
+
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Returns: TImplementationProxy*: pointer to TImplementationProxy
+// -----------------------------------------------------------------------------
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+    {
+    aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy );
+    return KImplementationTable;
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpgenvoipsettings/src/wpgeneralvoipsettingsadaptermain.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* 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:  DLL entry point.
+*
+*/
+
+
+#include <e32std.h>
+
+#ifndef EKA2
+GLDEF_C TInt E32Dll( TDllReason /*aReason*/ )
+    {
+    return KErrNone;
+    }
+#endif // EKA2
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/data/10201F9A.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,60 @@
+/*
+* 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:  Resource definitions for project cpvoipdapter.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+
+//  INCLUDES
+#include <registryinfov2.rh>
+#include "WPVoIPAdapterUIDs.h"
+#include "cpvoipadapter.rls"
+
+//  RESOURCE DEFINITIONS 
+// ---------------------------------------------------------
+//   
+//    theInfo
+//    Resource defining the VoIP Adapter plugin.
+//
+// ---------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+	{
+	resource_format_version = RESOURCE_FORMAT_VERSION_2;
+	dll_uid = KPROVISIONINGVOIPADAPTERDLLUID3;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = KPROVISIONINGADAPTERINTERFACE;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KPROVISIONINGVOIPADAPTERUID;
+					version_no = 1;
+					display_name = r_qtn_sm_display_name;
+					default_data = r_qtn_sm_default_data;
+					opaque_data = r_qtn_sm_opaque_data;
+					rom_only = 1;
+					}
+
+				};
+			}
+		};
+	}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/data/WPVoIPAdapter.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,42 @@
+/*
+* 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:  Resources for VoIP adapter.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+
+//  INCLUDES
+#include <badef.rh>
+#include "wpvoipadapter.loc"
+
+// Rich text labels
+RESOURCE LBUF r_qtn_sm_head_voip
+	{
+	txt = qtn_sm_head_voip;
+	}
+RESOURCE LBUF r_qtn_sm_default_name_voip
+	{
+	txt = qtn_sm_default_name_voip;
+	}
+RESOURCE LBUF r_qtn_sm_provider_voip
+	{
+	txt = qtn_sm_provider_voip;
+	}
+RESOURCE LBUF r_qtn_sm_voipid_default
+	{
+	txt = qtn_sm_provider_voip;
+	}
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  VoIPAdapter bld.inf
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+
+PRJ_PLATFORMS
+default
+
+PRJ_EXPORTS
+../rom/wpvoipadapter.iby CORE_APP_LAYER_IBY_EXPORT_PATH( wpvoipadapter.iby )
+../rom/wpvoipadapterresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH( wpvoipadapterresources.iby )
+../loc/wpvoipadapter.loc APP_LAYER_LOC_EXPORT_PATH( wpvoipadapter.loc )
+
+PRJ_MMPFILES
+./wpvoipadapter.mmp
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/group/wpvoipadapter.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* 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:  This file provides the information required for building the
+*               whole of a CWPVoIPAdapter.dll.
+*
+*/
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          wpvoipadapter.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x10201F9A
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN
+
+SOURCEPATH      ../src
+SOURCE          CWPVoIPAdapter.cpp	
+SOURCE          CWPVoIPItem.cpp
+SOURCE	        WPVoIPAdapterGroupProxy.cpp
+SOURCE          WPVoIPAdapterMain.cpp
+SOURCE          CWPVoIPCodec.cpp
+SOURCE	        CSIPProfileRegistryObserver.cpp
+
+SOURCEPATH      ../data
+
+START RESOURCE 10201F9A.rss
+TARGET wpvoipadapter.rsc
+END
+
+START RESOURCE WPVoIPAdapter.rss
+HEADER
+TARGETPATH RESOURCE_FILES_DIR
+LANGUAGE_IDS
+END
+
+USERINCLUDE     .
+USERINCLUDE     ../inc
+USERINCLUDE     ../../group 
+
+SYSTEMINCLUDE  ../../../../inc  // iptelephony's
+SYSTEMINCLUDE   /epoc32/include/ecom 
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY        	euser.lib 
+LIBRARY	        provisioningengine.lib
+LIBRARY	        bafl.lib 
+LIBRARY         rcse.lib
+LIBRARY         charconv.lib
+LIBRARY         centralrepository.lib 
+LIBRARY         sipprofilecli.lib
+LIBRARY         sysutil.lib
+LIBRARY         efsrv.lib
+LIBRARY         cone.lib
+LIBRARY         serviceprovidersettings.lib
+LIBRARY         cmmanager.lib
+LIBRARY         ipapputils.lib
+LIBRARY         featmgr.lib
+LIBRARY         vimpstsettings.lib  // For IM tone path
+LIBRARY         PlatformEnv.lib // For getting rom digital tone path.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/inc/CSIPProfileRegistryObserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,95 @@
+/*
+* 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:  Implements MSIPProfileRegistryObserver interface.
+*
+*/
+
+
+#ifndef CSIPPROFILEREGISTRYOBSERVER_H
+#define CSIPPROFILEREGISTRYOBSERVER_H
+
+//  INCLUDES
+#include <sipprofileregistryobserver.h>
+
+// CLASS DECLARATION
+/**
+ * Class implements MSIPProfileRegistryObserver interface. 
+ * Observs changes in the SIP profile registry.
+ *
+ * @lib wpsipadapter.lib
+ * @since 2.0
+ */
+class CSIPProfileRegistryObserver : 
+    public CBase, public MSIPProfileRegistryObserver
+    {    
+    #ifdef _DEBUG
+    /**
+     * Friend class for unit testing.
+     */
+    friend class UT_CWPVoIPAdapter;
+    #endif
+
+
+    public: // Constructors and destructor.
+
+        /**
+         * Two-phased constructor.
+         */
+        static CSIPProfileRegistryObserver* NewLC();
+
+        /**
+         * Two-phased constructor.
+         */
+        static CSIPProfileRegistryObserver* NewL();
+
+
+        /**
+         *   Destructor.
+         */
+        virtual ~CSIPProfileRegistryObserver();
+
+    public: // Methods from base classes
+    
+		/** 
+         * An event related to SIP Profile has accorred
+         * @param aProfileId a profile Id
+         * @param aEvent an occurred event
+         **/
+        void ProfileRegistryEventOccurred( 
+            TUint32 aProfileId, TEvent aEvent );
+
+        /**
+         * An asynchronous error has occurred related to SIP profile
+         * Event is send to those observers, who have the
+         * corresponding profile instantiated.
+         * @param aProfileId the id of failed profile 
+         * @param aError an occurred error
+         */
+        void ProfileRegistryErrorOccurred( TUint32 aProfileId, TInt aError );
+
+  private:
+        /**
+         *   C++ Default constructor.
+         */
+        CSIPProfileRegistryObserver(); 
+
+        /**
+         *   By default Symbian 2nd phase constructor is private.
+         */
+        void ConstructL();
+    };
+
+#endif // CSIPPROFILEREGISTRYOBSERVER_H
+
+// End of file.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/inc/CWPSIPSpecificSettingsItem.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles and stores the SIP profile relateted SIP URIs needed
+*                by VoIP when functioning in SIP mode.
+*
+*/
+
+
+#ifndef CWPSIPSPECIFICSETTINGSITEM_H
+#define CWPSIPSPECIFICSETTINGSITEM_H
+
+//  INCLUDES
+#include <e32base.h> // CBase
+
+// CLASS DECLARATION
+/**
+*  This class keeps transiently the VoIP codec data and stores the 
+*  codec via interface provided by RCSE.
+*
+*  @lib CWPSIPSpecificSettingsItem.lib
+*  @since Series 60 3.0
+*/
+class CWPSIPSpecificSettingsItem : public CBase
+    {
+    #ifdef _DEBUG
+    /**
+     * Friend class for unit testing.
+     */
+    friend class UT_CWPVoIPAdapter;
+    friend class UT_CWPSIPSpecificSettingsItem;
+    friend class UT_CWPVoIPItem;
+    #endif
+
+    
+    public: // Constructors and destructor
+        
+        /**
+         * Two-phased constructor.
+        */
+        static CWPSIPSpecificSettingsItem* NewL();
+        
+        /**
+         * Destructor.
+         */
+        virtual ~CWPSIPSpecificSettingsItem();
+
+    public: // New functions
+        /**
+         * SetConferencingFactoryURIL.
+         * @since Series 60 3.0
+         * @param TDesC& aParamameter
+         */
+        void SetConferencingFactoryURIL( const TDesC& aParamameter );
+
+        /**
+         * SetMusicServerURIL
+         * @since Series 60 3.0
+         * @param TDesC& aParamameter
+         */
+        void SetMusicServerURIL( const TDesC& aParamameter );
+        
+        /**
+         * SetIPVoiceMailBoxURIL
+         * @since Series 60 3.0
+         * @param TDesC& aParamameter
+         */
+        void SetIPVoiceMailBoxURIL( const TDesC& aParamameter );
+        
+        /**
+         * SetCFNoAnsURIL
+         * @since Series 60 3.0
+         * @param TDesC& aParamameter
+         */
+        void SetCFNoAnsURIL( const TDesC& aParamameter );
+        
+        /**
+         * SetCFBusyURIL
+         * @since Series 60 3.0
+         * @param TDesC& aParamameter
+         */
+        void SetCFBusyURIL( const TDesC& aParamameter );
+        
+        /**
+         * SetCFUncondURIL
+         * @since Series 60 3.0
+         * @param TDesC& aParamameter
+         */
+        void SetCFUncondURIL( const TDesC& aParamameter );
+        
+        /**
+         * SetToAppRefL
+         * @since Series 60 3.0
+         * @param TDesC& aParamameter
+         */
+        void SetToAppRefL( const TDesC8& aParamameter );
+        
+    private:
+
+        /**
+         * C++ default constructor.
+         */
+        CWPSIPSpecificSettingsItem();
+
+        /**
+         * By default Symbian 2nd phase constructor is private.
+         */
+        void ConstructL();
+
+    public: // Data
+        
+        // SIP related parameters described in the document VoIP software 
+        // settings.
+        
+        /*
+         * Id of the SIP profile specific VoIP settings.
+         */
+        TUint iId;
+        
+        /*
+         * APPREF value which is referred (SIP or SCCP settings).
+         * Own.
+         */
+        HBufC8* iToAppRef;
+        
+        /*
+         * SIP profile id.
+         */
+        TUint iSipProfileReferred;
+        
+
+        /*
+         * Conferencing factory URI.
+         * Own.
+         */
+        HBufC* iConferencingFactoryURI;
+        
+        /*
+         * Music server URI.
+         * Own.
+         */
+        HBufC* iMusicServerURI;
+        
+        /*
+         * IP VoiceMailBox URI.
+         * Own.
+         */
+        HBufC* iIPVoiceMailBoxURI;
+        
+        /*
+         * Call forwarding URI when no answer.
+         * Own.
+         */
+        HBufC* iCFNoAnsURI;
+        
+        /*
+         * Call forwarding URI when busy.
+         * Own.
+         */
+        HBufC* iCFBusyURI;
+        
+        /*
+         * Unconditional call forwarding URI.
+         * Own.
+         */
+        HBufC* iCFUncondURI;
+    };
+
+#endif      // CWPSIPSPECIFICSETTINGSITEM_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/inc/CWPVoIPAdapter.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,311 @@
+/*
+* Copyright (c) 2002-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:  Realizes VoIP provisioning adapter. The VoIP adapter 
+*                handles VoIP settings and stores them in 
+*                CWPVoIPItem instances.
+*
+*/
+
+
+#ifndef CWPVOIPADAPTER_H
+#define CWPVOIPADAPTER_H
+
+#include <CWPAdapter.h>
+#include <MWPContextExtension.h>
+
+class CWPCharacteristic;
+class CWPVoIPItem;
+class CWPVoIPCodec;
+
+/**
+ *  Realizes VoIP provisioning adapter.
+ *  VoIP adapter handles VoIP settings and stores them via RCSE.DLL 
+ *  and serviceprovidersettings.dll.
+ *
+ *  @lib CWPVoIPAdapter.lib
+ *  @since Series60 3.0.
+ */
+class CWPVoIPAdapter :  public CWPAdapter, public MWPContextExtension
+    {
+    #ifdef _DEBUG
+    /**
+     * Friend class for unit testing.
+     */
+     friend class UT_CWPVoIPAdapter;
+    #endif
+
+public:  // Constructor and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CWPVoIPAdapter* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CWPVoIPAdapter();
+
+public:
+
+// from base class CWPAdapter
+
+    /**
+     * Gets the saving information from the
+     * adapter that has saved settings.
+     *
+     * @since S60 3.2
+     * @param TInt aIndex. Index of the previously saved item.
+     * @param aSavingInfo Saving information (APPID, APPREF, settings ID).
+     */
+    void GetSavingInfoL( TInt aIndex, 
+        RPointerArray<HBufC8>& aSavingInfo );
+
+    /**
+     * Returns the number of the summary lines to be shown in 
+     * BIO control.
+     *
+     * @since S60 v3.0
+     * @return TInt. Quantity of items (SIP profiles).
+     */
+    TInt ItemCount() const;
+
+    /**
+     * Getter for the summary text of the SIP item (SIP profile) 
+     * located in the array. Text is shown to the user in 
+     * opened configuration message.
+     *
+     * @since S60 v3.0
+     * @param TInt aIndex. Location of the SIP item.
+     * @return TDesC16&. Summary title.
+     */
+    const TDesC16& SummaryTitle( TInt /*aIndex*/ ) const;
+
+    /**
+     * Getter for the summary text of the VoIP item (VoIP settings) 
+     * located in the array. Text is shown to the user in 
+     * opened configuration message.
+     *
+     * @since S60 v3.0
+     * @param TInt aIndex. Location of the SIPVoIP item.
+     * @return TDesC16&. Summary text.
+     */
+    const TDesC16& SummaryText( TInt aIndex ) const;
+
+    /**
+     * Saves VoIP item (VoIP settings) located in array.
+     *
+     * @since S60 v3.0
+     * @param TInt aIndex. Location of the VoIP item to be saved.
+     */
+    void SaveL( TInt aIndex );
+
+    /**
+     * Query if the VoIP item on place pointed by parameter can 
+     * be set as default.
+     *
+     * @since S60 v3.0
+     * @param TInt aIndex. Not used.
+     * @return False since defaultness is not supported.
+     */
+    TBool CanSetAsDefault( TInt /*aIndex*/ ) const;
+
+    /**
+     * Sets the VoIP item on place pointed by parameter as default.
+     * 
+     * @since S60 v3.0
+     * @param TInt aIndex. Location of the VoIP item to be queried.
+     */
+    void  SetAsDefaultL( TInt aIndex );
+
+    /**
+     * Query for the detail information about the VoIP settings. 
+     * MWPPairVisitor is used for retrieving the details of a single 
+     * setting entry. This is not supported feature as in the other 
+     * adapters in the framework.
+     *
+     * @since S60 v3.0
+     * @param TInt aItem.
+     * @param MWPPairVisitor aVisitor.
+     * @return TInt. 
+     */
+    TInt DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/ );
+
+    /**
+     * Visit method. Visits the adapter. Adapter then checks from the 
+     * aCharacteristic if the data is targetet to it and acts according to
+     * that.
+     *
+     * @since S60 v3.0
+     * @param CWPCharacteristic& aCharacteristic.
+     */
+    void VisitL( CWPCharacteristic& aCharacteristic );		
+
+    /**
+     * Visit method. Visits the adapter. Methods set the iAppId value.
+     *
+     * @since S60 v3.0
+     * @param CWPParameter& aParameter.
+     */
+    void VisitL( CWPParameter& aParameter );		
+
+    /**
+     * Visit method. For linking VoiceMailBox settings to a certain IAP.
+     * @since S60 v3.2
+     * @param CWPCharacteristic& aLink.
+     */
+    void VisitLinkL( CWPCharacteristic& aLink );
+
+    /**
+     * Informs the adapters of the saved settings.
+     *
+     * @since S60 v3.0
+     * @param TDesC8& aAppIdOfSavingItem. UID of the adapter component. 
+     * @param HBufC8& aAppRef. APPREF of the saved settings.
+     * @param TAny& aStorageIdValue. Value that identifies the settings in
+     *        its storage.
+     * @param TBool aIsLastOfItsType. If the settings saved is the last of
+     *        its kind, the value of the parameter is ETrue (or 1, because
+     *        the TBool type does not work correctly via interface class 
+     *        definition (based on information from MVC documentation).
+     */
+    void SettingsSavedL (const TDesC8& aAppIdOfSavingItem,
+        const TDesC8& aAppRef, const TDesC8& aStorageIdValue );
+
+    /**
+     * Lets the adapters know when the saving has been finalized in 
+     * viewpoint of the provisioning framework. The adapters can make 
+     * finalization of saving the settings after receiving this call.
+     *
+     * @since S60 v3.0
+     */
+    void SavingFinalizedL();
+
+    /**
+     * Returns a pointer to a context extension.
+     * @param aExtension Contains a pointer to MWPContextExtension 
+     * if supported
+     * @return KErrNotSupported if not supported, KErrNone otherwise
+     */
+    TInt ContextExtension(MWPContextExtension*& aExtension);
+
+// from base class MWPContextExtension
+
+    /**
+     * Returns the data used for saving.
+     * @param aIndex The index of the data
+     * @return The data. Ownership is transferred.
+     */
+    const TDesC8& SaveDataL(TInt aIndex) const;
+
+    /**
+     * Deletes a saved item.
+     * @param aSaveData The data used for saving
+     */
+    void DeleteL(const TDesC8& aSaveData);
+
+    /**
+     * Returns the UID of the adapter.
+     * @return UID
+     */
+    TUint32 Uid() const;
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CWPVoIPAdapter();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private: // New functions
+
+    /**
+     * Converts descriptor to integer.
+     * @since Series60 3.2
+     * @param aDescValue Descriptor data.
+     * @param aIntValue Refenced integer value.
+     * @return KErrNone if converting is done.
+     */
+    TInt DescToInt( HBufC8* aDescValue, TInt& aIntValue ) const;
+
+    /**
+     * Gets IAP ID according to WAP ID.
+     * @since Series60 3.2
+     * @param aWapId WAP ID of access point.
+     * @return IAP ID of access point
+     */
+    TUint32 IapIdFromWapIdL( TUint32 aWapId );
+
+private: // Data
+
+    /*
+     * Holds the received VoIP item data.
+     * Own.
+     */
+    RPointerArray<CWPVoIPItem> iDatas;
+
+    /*
+     * Current VoIP setting data.
+     * Own.
+     */
+    CWPVoIPItem* iCurrentVoIPItem;
+
+    /*
+     * The application id of the current characteristic.
+     */
+    TPtrC iAppID;
+
+    /*
+     * Title for VoIP settings. Value read from the resource file 
+     * in initiation phase. 
+     * Own.
+     */
+    HBufC*  iTitle;
+
+    /*
+     * Holds the value of current characteristic type (state).
+     */
+    TUint iCurrentCharacteristic;
+
+    /*
+     * Holds the parameters of the currently handled codec item.
+     * Own.
+     */
+    CWPVoIPCodec* iCurrentCodec;
+
+    /*
+     * Descriptor containing uids of the saved items (as TUint32).
+     */
+    mutable HBufC8* iUids;
+
+    /*
+     * Booleans for telling if certain settings can be set.
+     */
+    TBool iSetCodec;
+    TBool iSetVoipUris;
+
+    /*
+     * Flag telling if feature manager has been initialized.
+     */
+    TBool iFeatMgrInitialized;
+    };
+
+#endif      // CWPVOIPADAPTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/inc/CWPVoIPCodec.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,291 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles and stores the VoIP codec settings.
+*
+*/
+
+
+#ifndef CWPVOIPCODEC_H
+#define CWPVOIPCODEC_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// Media type name.
+_LIT( KAudio, "audio" );
+
+// Media sub-type names.
+_LIT( KAMR,      "AMR"         ); // 0
+_LIT( KILBC,     "iLBC"        ); // 1
+_LIT( KVMRWB,    "VMR-WB"      ); // 2
+_LIT( KG711ALAW, "PCMA"        ); // 3
+_LIT( KG711uLAW, "PCMU"        ); // 4
+_LIT( KG726_40,  "G726-40"     ); // 5
+_LIT( KG726_32,  "G726-32"     ); // 6
+_LIT( KG726_24,  "G726-24"     ); // 7
+_LIT( KG726_16,  "G726-16"     ); // 8
+_LIT( KCN,       "CN"          ); // 9
+_LIT( KG729B,    "G729"        ); // 10
+_LIT( KAMRWB,    "AMR-WB"      ); // 11
+_LIT( KGSMEFR,   "GSM-EFR"     ); // 12
+_LIT( KGSMFR,    "GSM-FR"      ); // 13
+_LIT( KEVRC,     "EVRC"        ); // 14
+_LIT( KEVRC0,    "EVRC0"       ); // 15
+_LIT( KSMV,      "SMV"         ); // 16
+_LIT( KSMV0,     "SMV0"        ); // 17
+
+
+// CLASS DECLARATION
+/**
+*  This class keeps transiently the VoIP codec data and stores the 
+*  codec via interface provided by RCSE.
+*
+*  @lib CWPVoIPAdapter.lib
+*  @since Series 60 3.0.
+*/
+class CWPVoIPCodec : public CBase
+    {    
+    #ifdef _DEBUG
+    /**
+     * Friend class for unit testing.
+     */
+    friend class UT_CWPVoIPAdapter;
+    friend class UT_CWPVoIPCodec;
+    friend class UT_CWPVoIPItem;
+    #endif
+
+
+    public: // Enums
+
+    enum TAudioCodecs
+        {
+        EAMR = 0,
+        EiLBC,
+        EVMRWB,
+        EPCMA,
+        EPCMU,
+        EG726_40,
+        EG726_32,
+        EG726_24,
+        EG726_16,
+        ECN,
+        EG729,
+        EAMRWB,
+        EGSMEFR,
+        EGSMFR,
+        EEVRC,
+        EEVRC0,
+        ESMV,
+        ESMV0,
+        };
+
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         */
+        static CWPVoIPCodec* NewL();
+
+        /**
+         * Destructor.
+         */
+        virtual ~CWPVoIPCodec();
+
+    public: // New functions
+
+        /**
+         * Setter for MediaSubtypeName.
+         * @since Series 60 3.0.
+         * @param TDesC& aMediaSubtypeName.
+         */
+		void SetMediaSubtypeNameL( const TDesC& aMediaSubtypeName );
+
+    private:
+
+        /**
+         * C++ default constructor.
+         */
+        CWPVoIPCodec();
+
+        /**
+         * By default Symbian 2nd phase constructor is private.
+         */
+        void ConstructL();
+
+    public: // Data
+        /** 
+         * Existence of the data member value is dependent on the type of the 
+         * particular codec. The following table describes the codecs 
+         * parameter  by parameter. See further description on VoIP software 
+         * settings document.
+         *
+         * Table legend:
+         * X: there must be a value.
+         * D: there is a default value (VoIP software settings document).
+         * -: there is no value at all.
+         * +: the value is optional.
+         *
+         * Codecs: (same values as in enum TVoIPCodec)
+         *         0: AMR-NB
+         *         1: iLBC
+         *         2: VMR-WB
+         *         3: G.711 A-law
+         *         4: G.711 µ-law
+         *         5: G726-40
+         *         6: G726-32
+         *         7: G726-24
+         *         8: G726-16
+         *         9: CN
+         *        10: G.729B
+         *        11: AMR-WB
+         *        12: GSM-EFR
+         *        13: GSM-FR
+         *        14: EVRC
+         *        15: EVRC0
+         *        16: SMV
+         *        17: SMV0
+         *
+         * Codec                             0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17
+         * VoIP codec id.                    X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X  X
+         * Media type name.                  XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD
+         * Media subtype name.               XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD XD
+         * Jitter buffer size.               +D +D +D +D +D -  -  -  -  +D +D +D -  -  +D +D +D +D
+         * octet-align.                      +D -  +D +D +D -  -  -  -  -  -  +  -  -  -  -  -  -
+         * Mode-set.                         +  +  +  -  -  -  -  -  -  -  -  +  -  -  -  -  -  - 
+         * Mode-change-period.               +  -  -  -  -  -  -  -  -  -  -  +D -  -  +D -  -  -
+         * Mode-change-neighbor.             +D -  -  -  -  -  -  -  -  -  -  +D -  -  -  -  -  -
+         * Ptime.                            +D +D +  +D +D -  -  -  -  -  +  +D -  -  +  +  +  -
+         * Maxptime.                         +D +D +  +D +D -  -  -  -  -  +  +D -  -  +D +  +  -
+         * Crc.                              +  -  -  -  -  -  -  -  -  -  -  +  -  -  -  -  -  -
+         * Robust-sorting.                   +  -  -  -  -  -  -  -  -  -  -  +  -  -  -  -  -  -
+         * Interleaving.                     +  -  +  -  -  -  -  -  -  -  -  +  -  -  -  -  +D -
+         * Channels.                         +D -  +  -  -  -  -  -  -  -  -  +D -  -  -  -  -  -
+         * Voice Activation Detection (VAD). +  -  -  +D +D -  -  -  -  -  -  +  -  -  -  -  -  -
+         * Discontinuous transmission (DTX). +  -  +D -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
+         * Sampling rate.                    -  -  +D +D -  -  -  -  -  -  -  -  -  -  -  -  -  +D
+         * Annex b.                          -  -  -  -  -  -  -  -  -  +D -  -  -  -  -  -  -  -
+         * Max-red                           -  -  -  -  -  -  -  -  -  -  -  +D -  -  -  -  -  -
+         */
+
+        /*
+         * VoIP codec id.
+         */
+        TUint iId;
+
+        /*
+         * Media type name.
+         * Own.
+         */
+        HBufC* iMediaTypeName;
+
+        /*
+         * Media subtype name.
+         * Own.
+         */
+        HBufC* iMediaSubtypeName;
+
+        /*
+         * PriorityIndex by which the codecs of the VoIP profile are ordered.
+         */
+        TInt32 iPriorityIndex;
+
+        /*
+         * Jitter buffer size.
+         */
+        TInt32 iJitterBufferSize;
+
+        /*
+         * octet-align.
+         */
+        TInt32 iOctetAlign;
+
+        /*
+         * Mode-set.
+         * Own.
+         */
+        RArray<TInt32> iModeSet;
+
+        /*
+         * Mode-change-period.
+         */
+        TInt32 iModeChangePeriod;
+
+        /*
+         * Mode-change-neighbor.
+         */
+        TInt32 iModeChangeNeighbor;
+
+        /*
+         * Ptime.
+         */
+        TInt32 iPTime;
+
+        /*
+         * Maxptime.
+         */
+        TInt32 iMaxPTime;
+
+        /*
+         * Crc.
+         */
+        TInt32 iCrc;
+
+        /*
+         * Robust-sorting.
+         */
+        TInt32 iRobustSorting;
+
+        /*
+         * Interleaving.
+         */
+        TInt32 iInterLeaving;
+
+        /*
+         * Channels.
+         * Own.
+         */
+        RArray<TInt32> iChannels;
+
+        /*
+         * Voice Activation Detection (VAD).
+         */
+        TInt32 iVAD;
+
+        /*
+         * Discontinuous transmission (DTX).
+         */
+        TInt32 iDTX;
+
+        /*
+         * Sampling rate.
+         */
+        TInt32 iSamplingRate;
+
+        /*
+         * Annex b.
+         */
+        TInt iAnnexB;
+
+        /*
+         * Max-red
+         */
+        TInt32 iMaxRed;
+
+    };
+
+#endif      // CWPVOIPCODEC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/inc/CWPVoIPItem.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,864 @@
+/*
+* Copyright (c) 2002-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:  Holds and stores one VoIP item.
+*
+*/
+
+
+#ifndef CWPVOIPITEM_H
+#define CWPVOIPITEM_H
+
+//  INCLUDES
+#include <e32base.h> // CBase.
+#include <crcseprofileentry.h> // TOnOff, RCSE entry
+#include "CWPVoIPCodec.h" // VoIP codecs.
+
+// CONSTANTS
+const TUint KMaxTerminalTypeLength = 64;
+const TUint KWlanMacAddressLength  = 50;
+const TUint KPhoneModelLength      = 20;
+const TUint KUAHLength             = 200;
+
+// MACROS
+
+// DATA TYPES
+typedef CRCSEProfileEntry VoIPProfileEntry;
+
+// FORWARD DECLARATIONS
+class CWPCharacteristic;
+class CWPVoIPCodec;
+class CCoeEnv;
+
+// CLASS DECLARATION
+/**
+ *  This class keeps transiently the VoIP setting values and stores the 
+ *  values via interface provided by RCSE and SPS.
+ *
+ *  @lib CWPVoIPAdapter.lib
+ *  @since S60 3.0
+ */
+class CWPVoIPItem : public CBase
+    {    
+    #ifdef _DEBUG
+    /**
+     * Friend class for unit testing.
+     */
+    friend class UT_CWPVoIPItem;
+    friend class UT_CWPVoIPAdapter;
+    #endif
+
+    public: // Data types 
+        
+        /**  For setting telephony preference */
+        enum TTelephonyPreference
+            {
+            ECSPreferred,
+            EPSPreferred
+            };
+
+        /** For telling which settings storage ID is related to. */
+        enum TSettingsType
+            {
+            ESIP,
+            ESCCP,
+            ENATFW,
+            EPresence,
+            ESNAP
+            };
+
+    public: // Constructor and destructor
+        
+        static CWPVoIPItem* NewL();
+        virtual ~CWPVoIPItem();
+
+    public: // New functions
+
+        /**
+         * Setter for AppRef.
+         *
+         * @since S60 3.2
+         * @param aAppRef.
+         */
+        void SetAppRefL( const TDesC8& aAppRef );
+
+        /**
+         * Getter for AppRef.
+         *
+         * @since S60 3.2
+         * @return AppRef.
+         */        
+        HBufC8* AppRef();
+
+        /**
+         * Setter for provider.
+         *
+         * @since S60 3.0
+         * @param aPROVIDERID.
+         */
+        void SetProviderIdL( const TDesC& aPROVIDERID );
+
+        /**
+         * Setter for user viewable name of the setting.
+         *
+         * @since S60 3.0
+         * @param aNAME - value is TCP or UDP.
+         */
+        void SetNameL( const TDesC& aNAME );
+
+        /**
+         * Setter for TO-APPREF parameter values.
+         *
+         * @since S60 3.0
+         * @param aTOAPPREF (i.e.actual CP parameter TO-APPREF).
+         */
+        void AddToAppRefL( const TDesC8& aTOAPPREF );
+
+        /**
+         * Setter for start media port.
+         *
+         * @since S60 3.0
+         * @param aSMPORT.
+         */
+        void SetStartMediaPort( TInt aSMPORT );
+
+        /**
+         * Setter for end media port.
+         *
+         * @since S60 3.0
+         * @param aEMPORT.
+         */
+        void SetEndMediaPort( TInt aEMPORT );
+
+        /**
+         * Setter for media QoS.
+         *
+         * @since S60 3.0
+         * @param aMediaQoSValue.
+         */
+        void SetMediaQoS( TInt aMEDIAQOS );
+
+        /**
+         * Setter for switching DTMF in-band on/off.
+         *
+         * @since S60 3.0
+         * @param aDTMFInBand (derived from CP parameter NODTMFIB, where
+         * "NO" means negation).
+         */
+        void SetDTMFInBand( TInt aDTMFInBand );
+
+        /**
+         * Setter for DTMF out-of-band parameter.
+         *
+         * @since S60 3.0
+         * @param aDTMFOutBandValue (derived from CP parameter 
+         * NODTMFOOB, where "NO" means negation).
+         */
+        void SetDTMFOutBand( TInt aDTMFOutBandValue );
+
+        /**
+         * Setter for VoIP codecs.
+         * Takes ownership of aVoIPCodec.
+         *
+         * @since S60 3.0
+         * @param aVoIPCodec.
+         */
+        void AddCodecL( const CWPVoIPCodec* aVoIPCodec );
+
+        /**
+         * Setter for iSecureCallPreference.
+         *
+         * @since S60 3.0
+         * @return aSecureCallPreference.
+         */
+        void SetSecureCallPref( TInt aSecureCallPref );
+
+        /**
+         * Setter for iRTCP.
+         *
+         * @since S60 3.0
+         * @param aRTCP.
+         */
+        void SetRTCP( TInt aRTCP );
+
+        /**
+         * Setter for iUAHTerminalType.
+         *
+         * @since S60 3.0
+         * @param aUAHTerminalType SIP User Agent Header:
+         *                         terminal type display.
+         */
+        void SetUAHTerminalType( TInt aUAHTerminalType );
+
+        /**
+         * Setter for iUAHWLANMAC.
+         *
+         * @since S60 3.0
+         * @param aUAHWLANMAC SIP User Agent Header: WLAN MAC address display.
+         */
+        void SetUAHWLANMAC( TInt aUAHWLANMAC );
+
+        /**
+         * Setter for iUAHString.
+         *
+         * @since S60 3.0
+         * @param aUAHString SIP User Agent Header: free string.
+         */
+        void SetUAHStringL( const TDesC& aUAHString );
+
+        /**
+         * Setter for iProfileLockedToIAP.
+         *
+         * @since S60 3.0
+         * @param aProfileLockedToIAP Is profile locked to a pre-defined IAP.
+         */
+        void SetProfileLockedToIAP( TInt aProfileLockedToIAP );
+
+        /**
+         * Setter for iVoIPPluginUid.
+         *
+         * @since S60 3.0
+         * @param aVoIPPluginUid VoIP plugin UID.
+         */
+        void SetVoIPPluginUid( TInt aVoIPPluginUid );
+
+        /**
+         * Setter for iAllowVoIPOverWCDMA.
+         *
+         * @since S60 3.0
+         * @param aAllowVoIPOverWCDMA Allow VoIP over WCDMA.
+         */
+        void SetAllowVoIPOverWCDMA( TInt aAllowVoIPOverWCDMA );
+
+        /**
+         * Setter for iVoIPDigits.
+         *
+         * @since S60 3.0
+         * @param aVoIPDigits Number of meaningful VoIP digits for call
+         *                    identification.
+         */
+        void SetVoIPDigits( TInt aVoIPDigits );
+
+        /**
+         * Setter for iDomainPartIgnoreRule.
+         *
+         * @since S60 3.0
+         * @param aDomainPartIgnoreRule Rule for ignoring domain part of URI 
+         *                              for VoIP calls.
+         */
+        void SetDomainPartIgnoreRule( TInt aDomainPartIgnoreRule );
+
+        /**
+         * Setter for iAddUserPhoneToAllNumbers.
+         *
+         * @since S60 3.2
+         * @param aAddUserPhone The indication whether or not to add 
+         *        user=phone to all numbers.
+         */
+        void SetAddUserPhone( TInt32 aAddUserPhone );
+
+        /**
+         * Setter for iSIPConnTestAddress.
+         *
+         * @since S60 3.2
+         * @param aSIPConnTestAddress Connectivity test call address 
+         *        in registering.
+         */
+        void SetSipConnTestAddressL( const TDesC& aSIPConnTestAddress );
+
+         /**
+          * Setter for iServiceProviderBookmark.
+          *
+          * @since S60 3.2
+          * @param aServiceProviderBookmark Absolute URI for service 
+          *        provider bookmark.
+          */         
+        void SetServiceProviderBookmarkL( 
+            const TDesC& aServiceProviderBookmark );
+
+        /**
+         * Setter for iSIPMinSE.
+         *
+         * @since S60 3.2
+         * @param aSIPMinSE The minimum allowed value for the session timer.
+         */
+        void SetSipMinSe( TInt32 aSIPMinSE );
+
+        /**
+         * Setter for iSIPSessionExpires.
+         *
+         * @since S60 3.2
+         * @param aSIPMinSE The session interval for a SIP session.
+         */
+        void SetSipSessionExpires( TInt32 aSIPSessionExpires );
+
+        /**
+         * Setter for iIPVoiceMailBoxURI.
+         *
+         * @since S60 3.
+         * @param aIPVoiceMailBoxURI IP Voice Mail Box address.
+         */
+        void SetIPVoiceMailBoxURIL( const TDesC& aIPVoiceMailBoxURI );
+
+        /**
+         * Setter for iVmbxListenAddress.
+         *
+         * @since S60 3.2
+         * @param aVmbxListenAddress VoiceMailBox listening address.
+         */
+        void SetVoiceMailBoxListenURIL( const TDesC& aVmbxListenAddress );
+
+        /**
+         * Setter for iReSubscribeInterval.
+         *
+         * @since S60 3.2
+         * @param aReSubscribeInterval Interval for sending re-SUBSCRIBE.
+         */
+        void SetReSubscribeInterval( TInt32 aReSubscribeInterval );
+
+        /**
+         * Setter for iBrandingDataAddress.
+         *
+         * @since S60 3.2
+         * @param aBrandingDataAddress URI to branding data xml.
+         */
+        void SetBrandingDataAddressL( const TDesC& aVmbxListenAddress );
+
+        /**
+         * Setter for iAutoAcceptBuddy.
+         *
+         * @since S60 3.2
+         * @param aAutoAcceptBuddy for defining auto accept buddy presence
+         *        subscription request.
+         */
+        void SetAutoAcceptBuddyRequest( TInt32 aAutoAcceptBuddyRequest );
+
+        /**
+         * Setter for iAutoEnableService.
+         *
+         * @since S60 3.2
+         * @param aAutoEnableService for defining 
+         *        auto enable state of service.
+         */
+        void SetAutoEnableService( TInt32 aAutoEnableService );
+
+        /**
+         * Setter for NAPDEF (IAP settings).
+         *
+         * @since S60 3.2
+         * @param aNapDef NAPDEF (IAP settings) characteristic.
+         */
+        void SetNapDef( CWPCharacteristic* aNapDef );
+
+        /**
+         * Setter for TO-NAPID parameter.
+         *
+         * @since S60 3.2
+         * @param aNapDefName TO-NAPID value.
+         */
+        void SetToNapIdL( const TDesC8& ToNapId );
+
+        /**
+         * Setter for IAP ID.
+         *
+         * @since S60 3.2
+         * @param aIapId IAP ID.
+         */
+        void SetIapId( TUint32 aIapId );
+
+        /**
+         * Setter for storage ID's (APPREF/TO-APPREF linkage).
+         *
+         * @since S60 3.2
+         * @param aAppId APPID value.
+         * @param aStorageId Storage ID.
+         * @return ETrue if storage ID was set,
+                   EFalse if storage ID was not set.
+         */
+        TBool SetStorageId( TSettingsType aProfileType, TUint32 aStorageId, 
+            const TDesC8& aAppRef );
+
+        /**
+         * Sets TO-APPREF value to internal variable.
+         *
+         * @since S60 3.2
+         * @param aToAppRef TO-APPREF value.
+         */
+        void SetVoipUrisToAppRefL( const TDesC8& aToAppRef );
+
+        /**
+         * Setter for iUsedNatProtocol.
+         *
+         * @since S60 3.2
+         * @param aUsedNatProtocol for indicating which NAT protocol should
+         *        be used.         
+         */
+         void SetUsedNatProtocol( TInt32 aUsedNatProtocol);
+
+        /**
+         * Getter for user viewable name of VoIP settings item.
+         *
+         * @since S60 3.0
+         * @return Settings name.
+         */
+        const TDesC& Name() const; 
+        
+        /** 
+         * Getter for iUAHString.
+         *
+         * @since S60 3.0
+         * @return SIP VoIP User Agent header: free string.
+         */
+        const TDesC& UAHString() const;
+
+        /**
+         * Getter for NAPDEF (IAP settings).
+         *
+         * @since S60 3.2
+         * @return NAPDEF characteristic.
+         */
+        CWPCharacteristic* NapDef();
+
+        /**
+         * Getter for TO-NAPID value.
+         *
+         * @since S60 3.2.
+         * @return TO-NAPID value.
+         */
+        const TDesC8& ToNapId() const;
+
+        /**
+         * Returns TO-APPREF value.
+         *
+         * @since S60 3.2
+         * @return TO-APPREF value.
+         */
+        const TDesC8& VoipUrisToAppRef() const;
+
+        /**
+         * Saves the VoIP settings and returns the uid of the stored new VoIP 
+         * profile.
+         *
+         * @since S60 3.0
+         * @return VoIP profile ID.
+         */
+        TUint StoreL();
+
+        /**
+         * Return profile ID as a descriptor.
+         *
+         * @since 3.0
+         * @return ID of the VoIP item (VoIP profile ID).
+         */
+        const TDesC8& SaveData() const;
+
+        /**
+         * Make update for data that is received after the actual StoreL save 
+         * method call. Data received after that can be: SIP profile ids in 
+         * VoIP profile settings and in the SIP specific VoIP settings items 
+         * and SCCP profile ids. SIP and SCCP ids are always received from the
+         * other adapters via CWPAdapter::SettingsSaved mehod that can be
+         * called after call to StoreL.
+         *
+         * @since S60 3.0
+         */
+        void SavingFinalizedL();
+
+        /**
+         * Sets CS/PS telephony preference.
+         *
+         * @since S60 3.0
+         * @param aTelephonyPreference state to set
+         */
+        void SetTelephonyPreferenceL( const TTelephonyPreference& 
+            aTelephonyPreference ) const;
+
+        /**
+         * Gather SIP User-Agent header.
+         *
+         * @since S60 3.0
+         * @param aUserAgentHeader User Agent Header.
+         */
+        void GetUserAgentHeaderL( TBuf8<KUAHLength>& aUserAgentHeader ) const;
+
+        /**
+         * Getter for RCSE storage ID.
+         *
+         * @since S60 3.2
+         * @return RCSE storage ID.
+         */
+        TUint32 ItemId();
+
+        /**
+         * Sets IM enabled flag to true.
+         *
+         * @since S60 3.2
+         */
+        void EnableIm();
+
+    private:
+
+        CWPVoIPItem();
+        void ConstructL();
+
+    private: // New functions
+
+        /**
+         * Check for duplicate provider and settingsname and renames if same.
+         *
+         * @since S60 3.0
+         * @param aProfile Profile to check.
+         * @return ETrue if operation was done; otherwise EFalse.
+         */
+        TBool CheckDuplicatesL( CRCSEProfileEntry& aEntry ) const;
+
+        /**
+         * Get Terminal Type for SIP User Agent Header.
+         *
+         * @since S60 3.0
+         * @param aTeminalType Terminal type.
+         */
+        void GetTerminalTypeL( 
+            TBuf<KMaxTerminalTypeLength>& aTerminalType ) const;
+
+        /**
+         * Get WLAN MAC address for SIP User Agent Header.
+         *
+         * @since S60 3.0
+         * @param aMac WLAN MAC address.
+         */
+        void GetWlanMacAddressL( TBuf<KWlanMacAddressLength>& aMac ) const;
+
+        /**
+         * Cleanup method for array.
+         *
+         * @since S60 3.1
+         * @param aParameter Parameter to be cleaned.
+         */
+        static void CleanupArrayItem( TAny* aArray );
+
+        /**
+         * Creates default codecs.
+         *
+         * @since S60 3.2
+         * @param aProfile Profile to append new codecs.
+         */
+        void AddDefaultCodecsL( CRCSEProfileEntry& aProfileEntry );
+
+    private: // Data.
+
+        /*
+         * VoIP codecs.
+         * Own.
+         */
+         RPointerArray<CWPVoIPCodec> iCodecs;
+
+        /*
+         * Identifies the item.
+         */
+        TUint iItemId;
+
+        /* Provider of settings. See OMA ProvCont document.
+         * CP parameter: PROVIDER-ID.
+         * Own.
+         */
+        HBufC* iProviderId;
+
+        /* Name of VoIP settings visible to user when viewing the provisioning
+         * message. See OMA ProvCont document.
+         * CP parameter: NAME
+         * Own.
+         */
+        HBufC* iName;
+
+        /* All APPREFs that are referenced from this VoIP item's TO-APPREF 
+         * parameter.
+         * Own.
+         */
+        RPointerArray<HBufC8> iToAppRefs;
+
+        /* Start media port.See w9013.txt or VoIP software settings document.
+         * CP parameter: SMPORT.
+         */
+        TInt32 iStartMediaPort;
+
+        /* End media port.See w9013.txt or VoIP software settings document.
+         * CP parameter: EMPORT.
+         */
+        TInt32 iEndMediaPort;
+
+        /* Quality of service for the media.See w9013.txt or VoIP software 
+         * settings document.
+         * CP parameter: MEDIAQOS.
+         */
+        TInt32 iMediaQoS;
+
+        /* In band. See w9013.txt or VoIP software settings document.
+         * CP parameter: NODTMFIB
+         */
+        TInt32 iDTMFInBand;
+
+        /* Out-of-band. See w9013.txt or VoIP software settings document.
+         * CP parameter: NODTMFOOB.
+         */
+        TInt32 iDTMFOutBand;
+
+        /* VoIP id as descriptor to be returned by the SaveData method to the 
+         * framework via adapter SaveDataL.
+         * Own.
+         */
+        HBufC8* iSavedProfileId;
+
+        /**
+         * Secure call preference. See w9013.txt or VoIP software settings
+         * document.
+         */
+        TInt iSecureCallPref;
+
+        /**
+         * RTCP, Real-Time Control Protocol reporting. See w9013.txt or VoIP
+         * software settings document.
+         */
+        TInt iRTCP;
+
+        /**
+         * SIP VoIP User Agent header: terminal type display. See w9013.txt or
+         * VoIP software settings document.
+         */
+        TInt iUAHTerminalType;
+
+        /**
+         * SIP VoIP User Agent header WLAN MAC address display. See w9013.txt
+         * or VoIP software settings document.
+         */
+        TInt iUAHWLANMAC;
+
+        /**
+         * SIP VoIP User Agent header: free string. See w9013.txt or VoIP
+         * software settings document.
+         * Own.
+         */
+        HBufC* iUAHString;
+
+        /**
+         * Profile locked to IAP. See w9013.txt or VoIP software settings
+         * document.
+         */
+        TInt iProfileLockedToIAP;
+
+        /**
+         * VoIP plugin UID. See w9013.txt or VoIP software settings document.
+         */
+        TInt iVoIPPluginUid;
+
+        /**
+         * Allow VoIP over WCDMA. See w9013.txt or VoIP software settings
+         * document.
+         */
+        TInt iAllowVoIPOverWCDMA;
+
+        /**
+         * Number of meaningful VoIP digits for call identification.
+         * See w9013.txt.
+         */
+        TInt iVoIPDigits;
+
+        /**
+         * Ignore domain part of address (URI) for VoIP calls rule.
+         * See w9013.txt.
+         */
+        TInt iDomainPartIgnoreRule;
+
+        /**
+         * Flag to prevent set vmbx sip id if no vmbx settings are used.         
+         */
+        TBool iVmbxSettingsExist;
+
+        /**
+         * Whether or not to add user=phone to all numbers.
+         * See w9013.txt.
+         */
+        TInt32 iAddUserPhoneToAllNumbers;
+
+        /**
+         * Connectivity test call address in registering.
+         * See w9013.txt.
+         * Own.
+         */   
+        HBufC* iSIPConnTestAddress;
+
+        /**
+         * Absolute URI for service provider bookmark.
+         * See w9013.txt.
+         * Own.
+         */   
+        HBufC* iServiceProviderBookmark;
+
+        /**
+         * The minimum allowed value for the session timer.
+         * See w9013.txt.
+         */
+        TInt32 iSIPMinSE;
+
+        /**
+         * The session interval for a SIP session.
+         * See w9013.txt.
+         */
+        TInt32 iSIPSessionExpires;
+
+        /**
+         * VoiceMailBox: MWI-URI.
+         * See w9013.txt.
+         * Own.
+         */
+        HBufC* iIPVoiceMailBoxURI;
+
+        /**
+         * VoiceMailBox: VoiceMailBox listening address.
+         * See w9013.txt.
+         * Own.
+         */
+        HBufC* iVmbxListenAddress;
+
+        /**
+         * VoiceMailBox: Interval for sending re-SUBSCRIBE.
+         * See w9013.txt.
+         */
+        TInt32 iReSubscribeInterval;
+
+        /**
+         * VoiceMailBox: NAPDEF.
+         * See w9013.txt.
+         * Not own.
+         */
+        CWPCharacteristic* iNapDef;
+
+        /**
+         * VoiceMailBox: IAP ID.
+         * See w9013.txt.
+         */
+        TUint32 iVmbxIapId;
+
+        /**
+         * URI to branding data xml.
+         * See w9013.txt
+         * Own.
+         */   
+        HBufC* iBrandingDataAddress;
+
+        /**
+         * Auto accept buddy presence subscription request.
+         * see w9013.txt.
+         */
+        TInt32 iAutoAcceptBuddyRequest;
+
+        /**
+         * Auto enable state of service.
+         * see w9013.txt.
+         */
+        TInt32 iAutoEnableService;
+
+        /**
+         * TO-NAPID value.
+         * See w9013.txt
+         * Own.
+         */
+        HBufC8* iToNapId;
+
+        /**
+         * SIP profile ID for VoIP profile.
+         */
+        TUint32 iSipId;
+
+        /**
+         * SCCP profile ID for VoIP profile.
+         */
+        TUint32 iSccpId;
+
+        /**
+         * SIP profile ID for VoiceMailBox.
+         */
+        TUint32 iVmbxSipId;
+
+        /**
+         * NATFW profile ID for VoIP profile.
+         */
+        TUint32 iNatFwId;
+
+        /**
+         * Presence settings ID for service settings.
+         */
+        TUint32 iPresenceId;
+
+        /**
+         * Boolean for telling if SIP ID is already set.
+         */
+        TBool iSipIdSet;
+
+        /**
+         * Boolean for telling if SCCP ID is already set.
+         */
+        TBool iSccpIdSet;
+
+        /**
+         * Boolean for telling if VMBX SIP ID is already set.
+         */
+        TBool iVmbxSipIdSet;
+
+        /**
+         * Boolean for telling if NATFW ID is already set.
+         */
+        TBool iNatFwIdSet;
+
+        /**
+         * Boolean for telling if Presence ID is already set.
+         */
+        TBool iPresenceIdSet;
+
+        /**
+         * TO-APPREF value under characteristic VOIPURIS.
+         * Own.
+         */
+        HBufC8* iVoipUrisToAppRef;
+
+        /**
+         * Indicates which NAT protocol should be used.
+         * see w9013.txt.
+         */
+        TInt32 iUsedNatProtocol;
+
+        /**
+         * Boolean for telling if SNAP ID is already set.
+         */
+        TBool iSnapIdSet;
+
+        /**
+         * SNAP profile ID for VoIP profile.
+         */
+        TUint32 iSnapId;        
+
+        /**
+         * APPREF of this settings item.
+         * Own.
+         */
+        HBufC8* iAppRef;
+
+        /**
+         * Tells if IM is enabled or not.
+         */
+        TBool iImEnabled;
+    };
+
+#endif      // CWPVOIPITEM_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/inc/WPVoIPAdapterUIDs.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UIDs for project.
+*
+*/
+
+
+#ifndef WPVOIPADAPTERUID_H
+#define WPVOIPADAPTERUID_H
+
+/// UID3 for the VoIP Adapter DLL
+#define KPROVISIONINGVOIPADAPTERDLLUID3 0x10201F9A
+
+/// UID for the VoIP Adapter
+#define KPROVISIONINGVOIPADAPTERUID 0x10201F9B
+
+// UID of the Provisisioning Adapter plugin interface
+// Copied from ProvisioningUIDs.h
+#define KPROVISIONINGADAPTERINTERFACE 0x101F84D5
+
+#endif      //  WPVOIPADAPTERUID_H            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/inc/cpvoipadapter.rls	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* 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 cpvoipdapter.
+*
+*/
+
+
+#ifndef CPVOIPADAPTER_RLS
+#define CPVOIPADAPTER_RLS
+
+rls_string r_qtn_sm_display_name "VoIP settings provisioning||Implements a VoIP Provisioning Adapter||Copyright © 2004-2007 Nokia Corporation."
+rls_string r_qtn_sm_default_data ""
+rls_string r_qtn_sm_opaque_data "10"
+
+#endif // CPVOIPADAPTER_RLS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/loc/wpvoipadapter.loc	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* 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:  Localization strings for project cpvoipadapter
+*
+*/
+
+
+//d:Summary text for VoIP settings
+//l:msg_body_pane/opt
+//w:
+//r:VoIP Rel3.0
+//
+#define qtn_sm_default_name_voip "VoIP Settings"
+
+//d:Summary title for VoIP settings
+//l:msg_body_pane_t1
+//w:
+//r:VoIP Rel3.0
+//
+#define qtn_sm_head_voip "VoIP settings"
+
+//d:Default provider name. Used when saving the SIP settings.
+//l:popup_info_list_pane_t2/opt1
+//w:
+//r:VoIP Rel3.0
+//
+#define qtn_sm_provider_voip "Provider"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/rom/wpvoipadapter.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,25 @@
+/*
+* 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:  WPVoIPAdapter iby file
+*
+*/
+
+#ifndef __WPVOIPADAPTER_IBY__
+#define __WPVOIPADAPTER_IBY__
+
+#include <bldvariant.hrh>
+
+ECOM_PLUGIN(wpvoipadapter.dll,10201F9A.rsc) 
+
+#endif // __WPVOIPADAPTER_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/rom/wpvoipadapterresources.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2007-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:  WPVoIPAdapter resources iby file
+*
+*/
+
+
+#ifndef __WPVOIPADAPTERRESOURCES_IBY__
+#define __WPVOIPADAPTERRESOURCES_IBY__
+
+#include <bldvariant.hrh>
+
+data=DATAZ_/RESOURCE_FILES_DIR/wpvoipadapter.rsc        RESOURCE_FILES_DIR/wpvoipadapter.rsc
+
+#endif // __WPVOIPADAPTERRESOURCES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/src/CSIPProfileRegistryObserver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2002-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:  Implements MSIPProfileRegistryObserver interface.
+*
+*/
+
+
+// INCLUDE FILES
+#include "CSIPProfileRegistryObserver.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CSIPProfileRegistryObserver::CSIPProfileRegistryObserver()
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+CSIPProfileRegistryObserver::CSIPProfileRegistryObserver()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSIPProfileRegistryObserver::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//lint -e{1762} ConstructL is not const
+void CSIPProfileRegistryObserver::ConstructL()
+    {
+    }
+
+CSIPProfileRegistryObserver* CSIPProfileRegistryObserver::NewLC()
+    {
+    CSIPProfileRegistryObserver* self =
+        new ( ELeave ) CSIPProfileRegistryObserver();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+CSIPProfileRegistryObserver* CSIPProfileRegistryObserver::NewL()
+    {
+    CSIPProfileRegistryObserver* self =
+        new ( ELeave ) CSIPProfileRegistryObserver();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+CSIPProfileRegistryObserver::~CSIPProfileRegistryObserver()
+   {   
+   }
+
+// ---------------------------------------------------------------------------
+// CSIPProfileRegistryObserver::ProfileRegistryEventOccurred.
+// ---------------------------------------------------------------------------
+void CSIPProfileRegistryObserver::ProfileRegistryEventOccurred( TUint32 
+    /*aProfileId*/, TEvent /*aEvent*/ )
+    {    
+    }
+// ---------------------------------------------------------------------------
+// CSIPProfileRegistryObserver::ProfileRegistryEventOccurred.
+// ---------------------------------------------------------------------------
+void CSIPProfileRegistryObserver::ProfileRegistryErrorOccurred( TUint32 
+    /*aProfileId*/, TInt /*aError*/ )
+    {    
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/src/CWPSIPSpecificSettingsItem.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles and stores the SIP profile relateted SIP URIs needed
+*                by VoIP when functioning in SIP mode.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "CWPSIPSpecificSettingsItem.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+//----------------------------------------------------------------------------
+// CWPSIPSpecificSettingsItem::CWPSIPSpecificSettingsItem
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//----------------------------------------------------------------------------
+//
+CWPSIPSpecificSettingsItem::CWPSIPSpecificSettingsItem()
+    {
+    }
+
+//----------------------------------------------------------------------------
+// CWPSIPSpecificSettingsItem::ConstructL
+// Symbian 2nd phase constructor can leave.
+//----------------------------------------------------------------------------
+void CWPSIPSpecificSettingsItem::ConstructL()
+    {
+    iToAppRef = HBufC8::NewL( 0 );
+    iConferencingFactoryURI = HBufC::NewL( 0 );
+    iMusicServerURI = HBufC::NewL( 0 );
+    iIPVoiceMailBoxURI = HBufC::NewL( 0 );
+    iCFNoAnsURI = HBufC::NewL( 0 );
+    iCFBusyURI = HBufC::NewL( 0 );
+    iCFUncondURI = HBufC::NewL( 0 );
+    }
+
+//----------------------------------------------------------------------------
+// CWPSIPSpecificSettingsItem::NewL
+// Two-phased constructor.
+//----------------------------------------------------------------------------
+CWPSIPSpecificSettingsItem* CWPSIPSpecificSettingsItem::NewL()
+    {
+    CWPSIPSpecificSettingsItem* self = 
+        new( ELeave ) CWPSIPSpecificSettingsItem;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+    
+// Destructor
+CWPSIPSpecificSettingsItem::~CWPSIPSpecificSettingsItem()
+    {
+    delete iConferencingFactoryURI;
+    delete iMusicServerURI;
+    delete iIPVoiceMailBoxURI;
+    delete iCFNoAnsURI;
+    delete iCFBusyURI;
+    delete iCFUncondURI;
+    delete iToAppRef;
+    }
+
+//----------------------------------------------------------------------------
+// CWPSIPSpecificSettingsItem::SetConferencingFactoryURIL
+// 
+//----------------------------------------------------------------------------
+void CWPSIPSpecificSettingsItem::SetConferencingFactoryURIL( 
+    const TDesC& aParamameter )
+    {
+    delete iConferencingFactoryURI;
+    iConferencingFactoryURI = NULL;
+    iConferencingFactoryURI = aParamameter.AllocL();
+    }
+//----------------------------------------------------------------------------
+// CWPSIPSpecificSettingsItem::SetMusicServerURIL
+// 
+//----------------------------------------------------------------------------
+void CWPSIPSpecificSettingsItem::SetMusicServerURIL( 
+    const TDesC& aParamameter )
+    {
+    delete iMusicServerURI;
+    iMusicServerURI = NULL;
+    iMusicServerURI = aParamameter.AllocL();
+    }
+
+//----------------------------------------------------------------------------
+// CWPSIPSpecificSettingsItem::SetIPVoiceMailBoxURIL
+// 
+//----------------------------------------------------------------------------
+void CWPSIPSpecificSettingsItem::SetIPVoiceMailBoxURIL( 
+    const TDesC& aParamameter )
+    {
+    delete iIPVoiceMailBoxURI;
+    iIPVoiceMailBoxURI = NULL;
+    iIPVoiceMailBoxURI = aParamameter.AllocL();
+    }
+    
+//----------------------------------------------------------------------------
+// CWPSIPSpecificSettingsItem::SetCFNoAnsURIL
+// 
+//----------------------------------------------------------------------------
+void CWPSIPSpecificSettingsItem::SetCFNoAnsURIL( 
+    const TDesC& aParamameter )
+    {
+    delete iCFNoAnsURI;
+    iCFNoAnsURI = NULL;
+    iCFNoAnsURI = aParamameter.AllocL();
+    }
+    
+//----------------------------------------------------------------------------
+// CWPSIPSpecificSettingsItem::SetCFBusyURIL
+// 
+//----------------------------------------------------------------------------
+void CWPSIPSpecificSettingsItem::SetCFBusyURIL( 
+    const TDesC& aParamameter )
+    {
+    delete iCFBusyURI;
+    iCFBusyURI = NULL;
+    iCFBusyURI = aParamameter.AllocL();
+    }
+
+//----------------------------------------------------------------------------
+// CWPSIPSpecificSettingsItem::SetCFUncondURIL
+// 
+//----------------------------------------------------------------------------
+void CWPSIPSpecificSettingsItem::SetCFUncondURIL( 
+    const TDesC& aParamameter )
+    {
+    delete iCFUncondURI;
+    iCFUncondURI = NULL;
+    iCFUncondURI = aParamameter.AllocL();
+    }
+    
+//----------------------------------------------------------------------------
+// CWPSIPSpecificSettingsItem::SetToAppRefL
+// 
+//----------------------------------------------------------------------------
+void CWPSIPSpecificSettingsItem::SetToAppRefL( 
+    const TDesC8& aParamameter )
+    {
+    delete iToAppRef;
+    iToAppRef = NULL;
+    iToAppRef = aParamameter.AllocL();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/src/CWPVoIPAdapter.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1210 @@
+/*
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Receives and stores VoIP settings.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <CWPAdapter.h>
+#include <CWPCharacteristic.h>
+#include <CWPParameter.h>
+#include <wpvoipadapter.rsg>
+#include <WPAdapterUtil.h> // Adapter utils
+#include <s32mem.h>        // RDesWriteStream
+#include <s32strm.h>
+#include <e32des8.h>
+#include <utf.h> // Unicode conversion
+#include <featmgr.h>
+#include <cmmanagerext.h>
+#include <cmdestinationext.h>
+#include <cmconnectionmethoddef.h>
+#include <crcseprofileentry.h>
+#include <crcseprofileregistry.h>
+#include <crcseaudiocodecentry.h>
+#include <crcseaudiocodecregistry.h>
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+#include "CWPVoIPAdapter.h"
+#include "CWPVoIPItem.h"
+
+// The following four includes are because of SIP User Agent Header.
+#include "CSIPProfileRegistryObserver.h"
+#include <sipmanagedprofile.h>
+#include <sipprofileregistryobserver.h>
+#include <sipmanagedprofileregistry.h>
+
+// LOCAL CONSTANTS
+// Application related constants
+_LIT( KVoIPAdapterName, "WPVoIPAdapter");
+_LIT( KVoIPAppID,       "w9013" );  // OMA CP registration document for VoIP
+_LIT8( KVoIPAppID8,     "w9013" );  // OMA CP registration document for VoIP
+_LIT8( KSIPAppID8,      "w9010" );  // OMA CP registration document for SIP
+_LIT8( KSCCPAppID8,     "w9018" );  // OMA CP registration document for SCCP
+_LIT8( KNATFWAppID8,    "w902E" );  // OMA CP registration document for NATFW
+_LIT8( KPresenceAppId8, "ap0002" ); // OMA CP registration document for 
+                                    // SIMPLE Presence
+_LIT8( KSNAPAppID8,     "w904C" );  // OMA CP registration document for 
+                                    // Destination Networks
+// Characterictic clear text names.
+_LIT( KCODEC16,         "CODEC" );
+_LIT( KVOIPURIS16,      "VOIPURIS" );
+
+// VoIP profile parameters.
+// OMA CP registration document for VoIP, w9013.txt.
+_LIT( KParmSMPORT,               "SMPORT" );
+_LIT( KParmEMPORT,               "EMPORT" );
+_LIT( KParmMEDIAQOS,             "MEDIAQOS" );
+_LIT( KParmNODTMFIB,             "NODTMFIB" );
+_LIT( KParmNODTMFOOB,            "NODTMFOOB" );
+_LIT( KParmSECURECALLPREF,       "SECURECALLPREF" );
+_LIT( KParmRTCP,                 "RTCP" );
+_LIT( KParmUAHTERMINALTYPE,      "UAHTERMINALTYPE" );
+_LIT( KParmUAHWLANMAC,           "UAHWLANMAC" );
+_LIT( KParmUAHSTRING,            "UAHSTRING" );
+_LIT( KParmPROFILELOCKEDTOIAP,   "PROFILELOCKEDTOIAP" );
+_LIT( KParmVOIPPLUGINUID,        "VOIPPLUGINUID" );
+_LIT( KParmALLOWVOIPOVERWCDMA,   "ALLOWVOIPOVERWCDMA" );
+_LIT( KParmVOIPDIGITS,           "VOIPDIGITS" );
+_LIT( KParmIGNDOMPART,           "IGNDOMPART" );
+_LIT( KParmAABUDDYREQUEST,       "AABUDDYREQUEST" );
+_LIT( KParmADDUSERPHONE,         "ADDUSERPHONE" );
+_LIT( KParmSIPCONNTESTURI,       "SIPCONNTESTURI" );
+_LIT( KParmPROVIDERURI,          "PROVIDERURI" );
+_LIT( KParmMINSE,                "MINSE" );
+_LIT( KParmSESSIONEXP,           "SESSIONEXP" );
+_LIT( KParmBRANDINGURI,          "BRANDINGURI" );
+_LIT( KParmNATPROTOCOL,          "NATPROTOCOL" );
+_LIT( KParmAUTOENABLE,           "AUTOENABLE" );
+_LIT( KParmIMENABLED,            "IMENABLED" );
+
+// RESOURCE parameters.
+// OMA CP registration document for VoIP, w9013.txt.
+// RESOURCETYPE indicates if the following parameters are for a codec, SIP 
+// specific (URIs), Handover or VoIP Presence settings.
+_LIT( KParmMEDIASUBTYPE,         "MEDIASUBTYPE" );// Codec.
+_LIT( KParmPRIORITYINDEX,        "PRIORITYINDEX" );// Codec.
+_LIT( KParmJITTERBUFFERSIZE,     "JITTERBUFFERSIZE" );// Codec.
+_LIT( KParmOCTETALIGN,           "OCTET-ALIGN" );// Codec.
+_LIT( KParmMODESET,              "MODE-SET" );// Codec.
+_LIT( KParmMODECHANGEPERIOD,     "MODE-CHANGE-PERIOD" );// Codec.
+_LIT( KParmMODECHANGENEIGHBOR,   "MODE-CHANGE-NEIGHBOR" );// Codec.
+_LIT( KParmPTIME,                "PTIME" );// Codec.
+_LIT( KParmMAXPTIME,             "MAXPTIME" );// Codec.
+_LIT( KParmVAD,                  "VAD" );// Codec.
+_LIT( KParmANNEXB,               "ANNEXB" );// Codec.
+_LIT( KParmMAXRED,               "MAXRED" );// Codec.
+_LIT( KParmIPVOICEMAILBOXURI,    "IPVOICEMAILBOXURI" );// VMBX.
+_LIT( KParmVMBXLISTENURI,        "VMBXLISTENURI" );// VMBX.
+_LIT( KParmRESUBSCRIBE,          "RESUBSCRIBE" );// VMBX.
+
+// For other purposes.
+_LIT8( KHexPrefix,              "0x" ); // For parsing PLUGINUID.
+const TUint KTempStringlength( 200 ); // For SIP User-Agent Header.
+const TInt KMaxCharsInTUint32( 10 );
+const TInt KTen( 10 ); 
+
+static const TInt32 KNotSaved( -1 );
+
+// Following lines are for enabling debug prints.
+#ifdef _DEBUG
+#define DBG_PRINT(p) RDebug::Print(_L(p))
+#define DBG_PRINT2(p,a) RDebug::Print(_L(p),a)
+#else
+#define DBG_PRINT(p)
+#define DBG_PRINT2(p,a)
+#endif // _DEBUG
+
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::CWPVoIPAdapter
+// ---------------------------------------------------------------------------
+//
+CWPVoIPAdapter::CWPVoIPAdapter() : CWPAdapter()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPAdapter::ConstructL()
+    {
+    DBG_PRINT( "CWPVoIPAdapter::ConstructL - begin" );
+    TFileName fileName;
+    Dll::FileName( fileName );
+    iTitle = WPAdapterUtil::ReadHBufCL( fileName, KVoIPAdapterName, 
+        R_QTN_SM_HEAD_VOIP );
+    iUids = HBufC8::NewL( 0 );
+    iCurrentVoIPItem = NULL;
+
+    FeatureManager::InitializeLibL();
+    iFeatMgrInitialized = ETrue;
+
+    DBG_PRINT( "CWVoIPAdapter::ConstructL - Checking VoIP support." );
+    if ( !FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
+        {
+        DBG_PRINT( "CWVoIPAdapter::ConstructL - VoIP not supported; leave." );
+        User::Leave( KErrNotSupported );
+        }
+    DBG_PRINT( "CWPVoIPAdapter::ConstructL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::NewL
+// ---------------------------------------------------------------------------
+//
+CWPVoIPAdapter* CWPVoIPAdapter::NewL()
+    {
+    DBG_PRINT( "CWPVoIPAdapter::NewL - begin" );
+    CWPVoIPAdapter* self = new (ELeave) CWPVoIPAdapter;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    DBG_PRINT( "CWVoIPAdapter::NewL - end" );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::~CWPVoIPAdapter
+// ---------------------------------------------------------------------------
+//
+CWPVoIPAdapter::~CWPVoIPAdapter()
+    {
+    DBG_PRINT( "CWVoIPAdapter::~CWPVoIPAdapter - begin" );
+    delete iTitle;
+    delete iUids;
+    iDatas.ResetAndDestroy();
+    iDatas.Close();
+
+    if ( iFeatMgrInitialized )
+        {
+        FeatureManager::UnInitializeLib();
+        }
+
+    DBG_PRINT( "CWVoIPAdapter::~CWPVoIPAdapter - end" );
+    //lint -e{1740} iCurrentCodec is deleted in another class
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::ContextExtension
+// ---------------------------------------------------------------------------
+//
+TInt CWPVoIPAdapter::ContextExtension( MWPContextExtension*& aExtension )
+    {
+    aExtension = this;
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::SaveDataL
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CWPVoIPAdapter::SaveDataL( TInt aIndex ) const
+    {
+    return iDatas[aIndex]->SaveData();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::DeleteL
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPAdapter::DeleteL( const TDesC8& aSaveData )
+    {
+    DBG_PRINT( "CWVoIPAdapter::DeleteL - begin" );
+    TUint tId;
+    TLex8 lex( aSaveData );
+    TInt err( KErrNone );            
+    err = lex.Val( tId );
+    if ( KErrNone == err )
+        {
+        CRCSEProfileRegistry* cRCSEProfileRegistry = 
+            CRCSEProfileRegistry::NewLC();
+        cRCSEProfileRegistry->DeleteL( tId );
+        
+        // set CS preferred if last VoIP profile deleted
+        RArray<TUint32> voipIds;
+        cRCSEProfileRegistry->GetAllIdsL( voipIds );
+        if ( KErrNone == voipIds.Count()  )
+            {
+            CWPVoIPItem* cVoIPItem = CWPVoIPItem::NewL();
+            CleanupStack::PushL( cVoIPItem );
+            cVoIPItem->SetTelephonyPreferenceL( CWPVoIPItem::ECSPreferred );
+            CleanupStack::PopAndDestroy( cVoIPItem );
+            }
+        voipIds.Close();  
+        CleanupStack::PopAndDestroy( cRCSEProfileRegistry );
+        }// if
+    DBG_PRINT( "CWVoIPAdapter::DeleteL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::Uid
+// ---------------------------------------------------------------------------
+//
+TUint32 CWPVoIPAdapter::Uid() const
+    {
+    return iDtor_ID_Key.iUid; 
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::DetailsL
+// ---------------------------------------------------------------------------
+//
+TInt CWPVoIPAdapter::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor */ )
+    {
+    return KErrNotSupported;
+    }  
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::SummaryCount
+// ---------------------------------------------------------------------------
+//
+TInt CWPVoIPAdapter::ItemCount() const
+    {
+    return iDatas.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::SummaryTitle
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CWPVoIPAdapter::SummaryTitle( TInt /*aIndex*/ ) const
+    {
+    return *iTitle;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::SummaryText
+// ---------------------------------------------------------------------------
+//
+const TDesC16& CWPVoIPAdapter::SummaryText( TInt aIndex ) const
+    {
+    return iDatas[aIndex]->Name();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::SaveL
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPAdapter::SaveL( TInt aIndex )
+    {
+    DBG_PRINT( "CWVoIPAdapter::SaveL - begin" );
+
+    CWPVoIPItem* voipItem = iDatas[aIndex];
+
+    if ( voipItem->NapDef() && voipItem->NapDef()->Data().Length() <= 
+        KMaxCharsInTUint32 )
+        {
+        // Get WAP ID.
+        TPckgBuf<TUint32> uid;
+        uid.Copy( voipItem->NapDef()->Data( 0 ) );
+        TUint32 wapId( uid() );
+        // Get corresponding IAP ID.
+        TUint32 iapId = IapIdFromWapIdL( wapId );
+        voipItem->SetIapId( iapId );
+        }
+
+    voipItem->StoreL();
+    voipItem = NULL;
+    DBG_PRINT( "CWVoIPAdapter::SaveL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::CanSetAsDefault
+// ---------------------------------------------------------------------------
+//
+TBool CWPVoIPAdapter::CanSetAsDefault( TInt /*aIndex*/ ) const
+    {
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::SetAsDefaultL
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPAdapter::SetAsDefaultL( TInt /*aIndex*/ )
+    {
+    // From VoIP release 3.0 onwards VoIP profiles cannot be set as default
+    // => this mehod does nothing but is present because of inheritance.
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::VisitL
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPAdapter::VisitL( CWPCharacteristic& aCharacteristic )
+    {
+    DBG_PRINT( "CWVoIPAdapter::VisitL( characteristic ) - begin" );
+    
+    switch( aCharacteristic.Type() )
+        {
+        // Core VoIP settings.
+        case KWPApplication:
+            {
+            DBG_PRINT(
+                 "CWVoIPAdapter::VisitL(characteristic) - case APPLICATION" );
+            iCurrentCharacteristic = KWPApplication;
+            iCurrentVoIPItem = CWPVoIPItem::NewL();
+            aCharacteristic.AcceptL( *this );
+            // If VoIP settings, append the item into iDatas array and leave
+            // iCurrentVoIPItem to point to it.
+            if ( iAppID == KVoIPAppID ) 
+                {
+                User::LeaveIfError( iDatas.Append( iCurrentVoIPItem ) );
+                }
+            else // else the settigs are no longer of type VoIP.
+                {
+                DBG_PRINT( 
+                    "CWVoIPAdapter::VisitL( characteristic ) - no VoIP." );
+                delete iCurrentVoIPItem;
+                iCurrentVoIPItem = NULL;
+                }
+            break;
+            }
+        // Codec and SIP profile specific settings.
+        case KWPNamedCharacteristic:
+            {
+            iCurrentCharacteristic = KWPNamedCharacteristic;
+            //lint -e{961} No need for else statement here
+            if ( aCharacteristic.Name().Compare( KCODEC16() ) == 0 )
+                {
+                DBG_PRINT(
+                    "CWVoIPAdapter::VisitL( characteristic ) - case CODEC" );
+                iCurrentCodec = CWPVoIPCodec::NewL();
+                iSetCodec = ETrue;
+                aCharacteristic.AcceptL( *this ); 
+                iCurrentVoIPItem->AddCodecL( iCurrentCodec );
+                iSetCodec = EFalse;
+                }
+            else if ( aCharacteristic.Name().Compare( KVOIPURIS16() ) == 0 )
+                {
+                DBG_PRINT(
+                    "CWVoIPAdapter::VisitL(characteristic) - case VOIPURIS" );
+                iSetVoipUris = ETrue;
+                aCharacteristic.AcceptL( *this );
+                iSetVoipUris = EFalse;
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    DBG_PRINT( "CWVoIPAdapter::VisitL( characteristic ) - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::GetSavingInfoL
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPAdapter::GetSavingInfoL( TInt aIndex, 
+    RPointerArray<HBufC8>& aSavingInfo )
+    {
+    CleanupResetAndDestroyPushL( aSavingInfo );
+    
+    // APPID into place [0].
+    HBufC8* temp = KVoIPAppID8().AllocLC();
+    aSavingInfo.AppendL( temp );
+    CleanupStack::Pop();
+    
+    // APPREF into place [1].
+    temp = iDatas[aIndex]->AppRef()->AllocLC();
+    aSavingInfo.AppendL( temp );
+    CleanupStack::Pop();
+    
+    // Profile id into place [2].
+    temp = iDatas[aIndex]->SaveData().AllocLC();
+    aSavingInfo.AppendL( temp );
+    CleanupStack::Pop();
+    
+    CleanupStack::Pop( &aSavingInfo );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::VisitL
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPAdapter::VisitL( CWPParameter& aParameter )
+    {
+    DBG_PRINT( "CWVoIPAdapter::VisitL( parameter ) - begin" );
+    // tmpValue holds the value converted from Unicode to UTF8.
+    HBufC8* tmpValue = HBufC8::NewLC( aParameter.Value().Length() ); // CS:1
+    TPtr8 ptrTmpValue( tmpValue->Des() );
+    CnvUtfConverter::ConvertFromUnicodeToUtf8( ptrTmpValue, 
+        aParameter.Value() );    
+    TInt tIntParameterValue( 0 );
+    
+    switch( aParameter.ID() )
+        {
+        case EWPParameterAppRef:
+            {
+            iCurrentVoIPItem->SetAppRefL( tmpValue->Des() );
+            break;
+            }
+        case EWPParameterAppID:
+            {
+            iAppID.Set( aParameter.Value() );
+            break;
+            }
+        // Here case 0 are handled the VoIP parameters that are extensions  
+        // to OMA Client Provisioning parameter set.
+        case 0:
+            //lint -e{961} No need for else statement here
+            if ( aParameter.Name().Compare( KParmSMPORT ) == 0 )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetStartMediaPort( tIntParameterValue );
+                    }// if
+                }
+            else if ( aParameter.Name().Compare( KParmEMPORT ) == 0 )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetEndMediaPort( tIntParameterValue );
+                    }//if
+                }// else if
+            else if ( aParameter.Name().Compare( KParmMEDIAQOS ) == 0 )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetMediaQoS( tIntParameterValue );
+                    }// if
+                }// else if
+            else if ( aParameter.Name().Compare( KParmNODTMFIB ) == 0 )
+                {
+                iCurrentVoIPItem->SetDTMFInBand( 0 );
+                }// else if
+            else if ( aParameter.Name().Compare( KParmNODTMFOOB ) == 0 )
+                {
+                iCurrentVoIPItem->SetDTMFOutBand( 0 );
+                }
+            else if ( aParameter.Name().Compare( KParmSECURECALLPREF ) == 0 )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetSecureCallPref( tIntParameterValue );
+                    }// if
+                }// else if
+
+            else if ( aParameter.Name().Compare( KParmRTCP ) == 0 )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetRTCP( tIntParameterValue );
+                    }// if
+                }// else if
+
+            else if ( aParameter.Name().Compare( 
+                KParmUAHTERMINALTYPE ) == 0 )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetUAHTerminalType( 
+                        tIntParameterValue );
+                    }// if
+                }// else if
+
+            else if ( aParameter.Name().Compare( KParmUAHWLANMAC ) == 0 )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetUAHWLANMAC( tIntParameterValue );
+                    }// if
+                }// else if
+
+            else if ( aParameter.Name().Compare( KParmUAHSTRING ) == 0 )
+                {
+                iCurrentVoIPItem->SetUAHStringL( aParameter.Value() );
+                }
+
+            else if ( aParameter.Name().Compare( 
+                KParmPROFILELOCKEDTOIAP ) == 0 )
+                {
+                iCurrentVoIPItem->SetProfileLockedToIAP( 1 );
+                }
+
+            else if ( aParameter.Name().Compare( KParmVOIPPLUGINUID ) == 0 )
+                {
+                TInt hexStart ( tmpValue->Find( KHexPrefix() ) );
+                if ( hexStart == KErrNotFound )
+                    {
+                    hexStart = KErrNone;
+                    }
+                else
+                    {
+                    hexStart = KHexPrefix().Length();
+                    }
+                TUint32 paramValue;
+                TLex8 lex( tmpValue->Des().Mid( hexStart ));
+                TInt err( KErrNone );
+                err = lex.Val( paramValue, EHex );
+                if ( KErrNone == err && paramValue <= KMaxTInt )
+                    {
+                    iCurrentVoIPItem->SetVoIPPluginUid( paramValue );
+                    }// if
+                }// else if
+
+            else if ( aParameter.Name().Compare( 
+                KParmALLOWVOIPOVERWCDMA ) == 0 )
+                {
+                iCurrentVoIPItem->SetAllowVoIPOverWCDMA( 1 );
+                }
+            
+            else if ( aParameter.Name().Compare( KParmVOIPDIGITS ) == 0 )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetVoIPDigits( tIntParameterValue );
+                    }
+                }
+
+            else if ( aParameter.Name().Compare( KParmIGNDOMPART ) == 0 )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetDomainPartIgnoreRule( 
+                        tIntParameterValue );
+                    }
+                }
+
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmADDUSERPHONE ) )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetAddUserPhone( tIntParameterValue );
+                    }
+                }
+
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmSIPCONNTESTURI ) )
+                {
+                iCurrentVoIPItem->SetSipConnTestAddressL( 
+                    aParameter.Value() );
+                }
+
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmPROVIDERURI ) )
+                {
+                iCurrentVoIPItem->SetServiceProviderBookmarkL( 
+                    aParameter.Value() );
+                }
+
+            else if ( KErrNone == aParameter.Name().Compare( KParmMINSE ) )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetSipMinSe( tIntParameterValue );
+                    }
+                }
+
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmSESSIONEXP ) )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetSipSessionExpires( 
+                        tIntParameterValue );
+                    }
+                }
+
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmBRANDINGURI ) )
+                {
+                iCurrentVoIPItem->SetBrandingDataAddressL( 
+                    aParameter.Value() );
+                }
+
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmAABUDDYREQUEST ) )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetAutoAcceptBuddyRequest( 
+                        tIntParameterValue );
+                    }
+                }                               
+
+            // VoiceMailBox parameter.
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmIPVOICEMAILBOXURI ) )
+                {
+                iCurrentVoIPItem->SetIPVoiceMailBoxURIL(
+                    aParameter.Value() );
+                }
+
+            // VoiceMailBox parameter.
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmVMBXLISTENURI ) )
+                {
+                iCurrentVoIPItem->SetVoiceMailBoxListenURIL( 
+                    aParameter.Value() );
+                }
+                
+            // VoiceMailBox parameter.
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmRESUBSCRIBE ) )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetReSubscribeInterval( 
+                        tIntParameterValue );
+                    }
+                }
+
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmNATPROTOCOL ) )
+                {                
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetUsedNatProtocol( 
+                        tIntParameterValue );                    
+                    }
+                }     
+                
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmAUTOENABLE ) )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentVoIPItem->SetAutoEnableService( 
+                        tIntParameterValue );
+                    }
+                }             
+            else if ( KErrNone == aParameter.Name().Compare( 
+                KParmIMENABLED ) )
+                {
+                iCurrentVoIPItem->EnableIm();
+                }
+
+            // Codec parameter.    
+            else if ( aParameter.Name().Compare( KParmMEDIASUBTYPE ) == 0 
+                && iSetCodec )
+                {
+                typedef CWPVoIPCodec CMediaSubType;
+                // don't need to check value because of switch-default:
+                // coverity[check_return] coverity[unchecked_value]
+                DescToInt( tmpValue, tIntParameterValue );
+
+                switch ( tIntParameterValue )
+                    {
+                    case CMediaSubType::EAMR:
+                        {
+                        iCurrentCodec->SetMediaSubtypeNameL( 
+                            KAudioCodecAMR() );
+                        }
+                    break;
+
+                    case CMediaSubType::EiLBC:
+                        {
+                        iCurrentCodec->SetMediaSubtypeNameL( 
+                            KAudioCodeciLBC() );
+                        }
+                    break;
+
+                    case CMediaSubType::EPCMA:
+                        {
+                        iCurrentCodec->SetMediaSubtypeNameL( 
+                            KAudioCodecPCMA() );
+                        }
+                    break;
+
+                    case CMediaSubType::EPCMU:
+                        {
+                        iCurrentCodec->SetMediaSubtypeNameL( 
+                            KAudioCodecPCMU() );
+                        }
+                    break;
+
+                    case CMediaSubType::ECN:
+                        {
+                        iCurrentCodec->SetMediaSubtypeNameL( 
+                            KAudioCodecCN() );
+                        }
+                    break;
+
+                    case CMediaSubType::EG729:
+                        {
+                        iCurrentCodec->SetMediaSubtypeNameL( 
+                            KAudioCodecG729() );
+                        }
+                    break;
+
+                    case CMediaSubType::EAMRWB:
+                        {
+                        iCurrentCodec->SetMediaSubtypeNameL( 
+                            KAudioCodecAMRWB() );
+                        }
+                    break;
+
+                    case CMediaSubType::EVMRWB:
+                    case CMediaSubType::EEVRC:
+                    case CMediaSubType::EEVRC0:
+                    case CMediaSubType::ESMV:
+                    case CMediaSubType::ESMV0:
+                    case CMediaSubType::EG726_40:
+                    case CMediaSubType::EG726_32:
+                    case CMediaSubType::EG726_24:
+                    case CMediaSubType::EG726_16:
+                    case CMediaSubType::EGSMEFR:
+                    case CMediaSubType::EGSMFR:
+                    default:
+                        {
+                        // Error or not supported => Codec deleted later.
+                        iCurrentCodec->SetMediaSubtypeNameL( 
+                            KNullDesC() );
+                        }
+                    }// switch
+                }
+            // Codec parameter.                    
+            else if ( aParameter.Name().Compare( KParmPRIORITYINDEX ) == 0 
+                && iSetCodec )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentCodec->iPriorityIndex = tIntParameterValue;
+                    }
+                }
+            // Codec parameter.    
+            else if ( aParameter.Name().Compare( KParmJITTERBUFFERSIZE ) == 0
+                && iSetCodec )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentCodec->iJitterBufferSize = tIntParameterValue;
+                    }
+                }
+            // Codec parameter.    
+            else if ( aParameter.Name().Compare( KParmOCTETALIGN ) == 0 
+                && iSetCodec )
+                {
+                iCurrentCodec->iOctetAlign = 1;
+                }
+            // Codec parameter.    
+            else if ( aParameter.Name().Compare( KParmMODESET ) == 0 
+                && iSetCodec )
+                {
+                TLex8 lexModeSet( tmpValue->Des() );
+                TChar tmpChar;
+
+                while ( lexModeSet.Peek() != 0 )                
+                    {
+                    TInt32 tmpModeSetValue ( 0 );
+                    TBool cycle ( ETrue );
+                    TBool stateDigit ( ETrue );
+                    TBool numberExists ( EFalse );
+                    
+                    while ( cycle ) 
+                        {
+                        switch( stateDigit )
+                            {
+                            case ETrue:
+                                {
+                                if ( lexModeSet.Peek() != 0 )
+                                    {
+                                    tmpChar = lexModeSet.Get();
+                                    if ( tmpChar.IsDigit() )
+                                        {
+                                        // for example: 25 =  2 * 10 + 5
+                                        //             257 = 25 * 10 + 7  
+                                        tmpModeSetValue = tmpModeSetValue * KTen 
+                                                 + tmpChar.GetNumericValue();
+                                        numberExists = ETrue;
+                                        }
+                                    else
+                                        {
+                                        stateDigit = EFalse;
+                                        }
+                                    }
+                                else
+                                    {
+                                    stateDigit = EFalse;    
+                                    }
+                                break;
+                                }
+                                
+                            case EFalse:
+                                {
+                                cycle = EFalse;
+                                break;
+                                }
+                            }
+                        }
+                        if ( numberExists )
+                            {
+                            iCurrentCodec->iModeSet.Append( tmpModeSetValue );
+                            }
+                    }
+                }
+                
+            // Codec parameter.    
+            else if ( aParameter.Name().Compare( KParmMODECHANGEPERIOD ) == 0
+                && iSetCodec )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentCodec->iModeChangePeriod = tIntParameterValue;  
+                    }
+                }
+            // Codec parameter.    
+            else if ( 
+                aParameter.Name().Compare( KParmMODECHANGENEIGHBOR ) == 0
+                && iSetCodec )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentCodec->iModeChangeNeighbor = tIntParameterValue;
+                    }
+                }
+            // Codec parameter.    
+            else if ( aParameter.Name().Compare( KParmPTIME ) == 0 
+                && iSetCodec )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentCodec->iPTime = tIntParameterValue;
+                    }
+                }
+            // Codec parameter.    
+            else if ( aParameter.Name().Compare( KParmMAXPTIME ) == 0 
+                && iSetCodec )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentCodec->iMaxPTime = tIntParameterValue;
+                    }
+                }
+
+            // Codec parameter.    
+            else if ( aParameter.Name().Compare( KParmVAD ) == 0 
+                && iSetCodec )
+                {
+                iCurrentCodec->iVAD = 1;
+                }
+
+            // Codec parameter.    
+            else if ( aParameter.Name().Compare( KParmANNEXB ) == 0 
+                && iSetCodec )
+                {
+                iCurrentCodec->iAnnexB = 1;
+                }
+            // Codec parameter.
+            else if ( aParameter.Name().Compare( KParmMAXRED ) == 0 
+                && iSetCodec )
+                {
+                if ( KErrNone == DescToInt( tmpValue, tIntParameterValue ) )
+                    {
+                    iCurrentCodec->iMaxRed = tIntParameterValue;
+                    }
+                }
+            break; // case 0:
+            
+        case EWPParameterProviderID: // APPLICATION/PROVIDER-ID
+            iCurrentVoIPItem->SetProviderIdL( aParameter.Value() );
+            break;
+
+        case EWPParameterName: // APPLICATION/NAME
+            iCurrentVoIPItem->SetNameL( aParameter.Value() );
+            break;
+
+        case EWPParameterToAppRef: // TO-APPREF
+            {
+            // APPLICATION/TO-APPREF
+            if ( !iSetVoipUris )
+                {
+                iCurrentVoIPItem->AddToAppRefL( tmpValue->Des() );
+                }
+            else
+                {
+                if ( iCurrentVoIPItem && 
+                    iCurrentVoIPItem->VoipUrisToAppRef().Length() == 0 )
+                    {
+                    iCurrentVoIPItem->SetVoipUrisToAppRefL( tmpValue->Des() );
+                    }
+                }// else if
+            } //case
+            break;
+
+        // VOIPURIS/TO-NAPID
+        case EWPParameterToNapID:
+            {
+            if ( iCurrentVoIPItem && iSetVoipUris 
+                && iCurrentVoIPItem->ToNapId().Length() == 0 )
+                {
+                iCurrentVoIPItem->SetToNapIdL( tmpValue->Des() );
+                }
+            break;
+            }
+
+        default:
+            break;
+        }// switch
+    CleanupStack::PopAndDestroy( tmpValue );
+    DBG_PRINT( "CWVoIPAdapter::VisitL( parameter ) - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::VisitLinkL
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPAdapter::VisitLinkL( CWPCharacteristic& aLink )
+    {
+    DBG_PRINT( "CWVoIPAdapter::VisitLinkL - begin" );
+    switch( aLink.Type() )
+        {
+        case KWPNapDef:
+            {            
+            if ( !iCurrentVoIPItem->NapDef() )
+                {
+                iCurrentVoIPItem->SetNapDef( &aLink );
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    DBG_PRINT( "CWVoIPAdapter::VisitLinkL - end" );
+    }
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::SettingsSavedL
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPAdapter::SettingsSavedL ( const TDesC8& aAppIdOfSavingItem,
+    const TDesC8& aAppRef, const TDesC8& aStorageIdValue )
+    {
+    DBG_PRINT( "CWVoIPAdapter::SettingsSavedL - begin" );
+
+    if ( !aAppIdOfSavingItem.Length() || !aAppRef.Length() || 
+        !aStorageIdValue.Length() )
+        {
+        DBG_PRINT( "CWVoIPAdapter::SettingsSavedL - end" );
+        return;
+        }
+
+    HBufC8* tmpAppId = aAppIdOfSavingItem.AllocLC(); // CS:1
+
+    TUint32 storageId( 0 );
+    TLex8 lex( aStorageIdValue );
+    User::LeaveIfError( lex.Val( storageId, EDecimal ) );
+
+    const TInt itemCount = iDatas.Count();
+
+    //lint -e{961} No need for else statement here
+    if ( KErrNone == KSIPAppID8().CompareF( tmpAppId->Des() ) )
+        {
+        for ( TInt itemIndex = 0; itemIndex < itemCount; itemIndex++ )
+            {
+            TBool setOk = iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESIP,
+                storageId, aAppRef );
+
+            TBuf8<KTempStringlength> userAgentHeader;
+            iDatas[itemIndex]->GetUserAgentHeaderL( userAgentHeader );
+            if ( setOk && storageId > 0 )
+                {
+                TUint32 itemId = iDatas[itemIndex]->ItemId();
+                if ( TUint( KNotSaved ) != itemId )
+                    {
+                    // First update RCSE so that service will be created.
+                    DBG_PRINT( "CWVoIPAdapter::SettingsSavedL - update RCSE..." );
+                    CRCSEProfileRegistry* rcseReg = 
+                        CRCSEProfileRegistry::NewLC();
+                    CRCSEProfileEntry* rcseProf = CRCSEProfileEntry::NewLC();
+                    rcseReg->FindL( itemId, *rcseProf );
+                    TSettingIds referredIds;
+                    referredIds.iProfileType = 0; // SIP.
+                    referredIds.iProfileId = TInt( storageId );
+                    // Never reference to profile specific settings.
+                    referredIds.iProfileSpecificSettingId = KNotSet; 
+                    rcseProf->iIds.Append( referredIds );
+                    rcseReg->UpdateL( itemId, *rcseProf );
+                    CleanupStack::PopAndDestroy( 2, rcseReg );
+                    }
+
+                // Then set SIP user-agent header
+                DBG_PRINT(
+                    "CWVoIPAdapter::SettingsSavedL - \
+                    create SIP User-Agent Header..." );
+                CSIPProfileRegistryObserver* cSIPProfRegObserver = 
+                    CSIPProfileRegistryObserver::NewLC(); // CS:2
+                CSIPManagedProfileRegistry* cSIPManagedProfileRegistry =
+                    CSIPManagedProfileRegistry::NewLC( 
+                        *cSIPProfRegObserver ); // CS:3
+                CSIPProfile* cSIPProfile = NULL;
+                cSIPProfile = cSIPManagedProfileRegistry->ProfileL( 
+                    storageId );
+                CleanupStack::PushL( cSIPProfile ); // CS:4
+                CSIPManagedProfile* cSIPManagedProfile = 
+                    static_cast<CSIPManagedProfile*>( cSIPProfile );
+                CleanupStack::PushL( cSIPManagedProfile ); // CS:5
+                // Create an array for setting the user agent header.
+                // Granularity is 1 since only one item is appended into
+                // the array.
+                CDesC8ArrayFlat* uahArray = 
+                    new ( ELeave ) CDesC8ArrayFlat( 1 );
+                CleanupStack::PushL( uahArray ); // CS:6
+                uahArray->AppendL( userAgentHeader );
+                if ( userAgentHeader.Length() > 0 )
+                    {
+                    User::LeaveIfError( cSIPManagedProfile->SetParameter( 
+                        KSIPHeaders, *uahArray ) );
+                    }
+
+                cSIPManagedProfileRegistry->SaveL( *cSIPManagedProfile );
+                uahArray->Reset();
+                CleanupStack::PopAndDestroy( uahArray ); // CS:5
+                CleanupStack::PopAndDestroy( cSIPManagedProfile ); // CS:4
+                CleanupStack::Pop( cSIPProfile ); // CS:3
+                cSIPProfile = NULL;
+                CleanupStack::PopAndDestroy( 
+                    cSIPManagedProfileRegistry );// CS:2
+                CleanupStack::PopAndDestroy( cSIPProfRegObserver );// CS:1
+                DBG_PRINT(
+                    "CWVoIPAdapter::SettingsSavedL - \
+                    SIP User-Agent Header created and set." );
+                } // if ( matches ... )
+            } // for
+        }
+    else if ( KErrNone == KSCCPAppID8().CompareF( tmpAppId->Des() ) )
+        {
+        for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
+            {
+            iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESCCP, storageId, 
+                aAppRef );
+            }
+        }
+    else if ( KErrNone == KNATFWAppID8().CompareF( tmpAppId->Des() ) )
+        {
+        for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
+            {
+            iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ENATFW, storageId,
+                aAppRef );
+            }
+        }
+    else if ( KErrNone == KPresenceAppId8().CompareF( tmpAppId->Des() ) )
+        {
+        for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
+            {
+            iDatas[itemIndex]->SetStorageId( CWPVoIPItem::EPresence, 
+                storageId, aAppRef );
+            }
+        }
+    else if ( KErrNone == KSNAPAppID8().CompareF( tmpAppId->Des() ) )
+        {
+        for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
+            {
+            iDatas[itemIndex]->SetStorageId( CWPVoIPItem::ESNAP, storageId, 
+                aAppRef );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( tmpAppId ); // CS:0
+    DBG_PRINT( "CWVoIPAdapter::SettingsSavedL - end" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::SavingFinalizedL()
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPAdapter::SavingFinalizedL()
+    {
+    DBG_PRINT( "CWVoIPAdapter::SavingFinalizedL - begin" );
+    // Prerequisites: All data received and is stored at least transiently in
+    // the data structures in VoIP items. Call SavingFinalized for everyone to
+    // make them update the APPREF/TO-APPREF linkage data.
+    for ( TInt itemIndex = 0; itemIndex < iDatas.Count(); itemIndex++ )
+        {
+        iDatas[itemIndex]->SavingFinalizedL();
+        }// for
+    DBG_PRINT( "CWVoIPAdapter::SavingFinalizedL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::DescToInt()
+// ---------------------------------------------------------------------------
+//
+TInt CWPVoIPAdapter::DescToInt( HBufC8* aDescValue, TInt& aIntValue ) const
+    {
+    TInt err( KErrNotFound );
+    if ( aDescValue )
+        {
+        TLex8 lex( aDescValue->Des() );
+        err = lex.Val( aIntValue );    
+        }    
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPAdapter::IapIdFromWapIdL
+// Returns IAP ID from WAP ID.
+// ---------------------------------------------------------------------------
+//
+TUint32 CWPVoIPAdapter::IapIdFromWapIdL( TUint32 aWapId )
+    {
+    DBG_PRINT( "CWPVoIPAdapter::IapIdFromWapIdL - begin" );
+    RCmManagerExt cmManager;
+    cmManager.OpenLC(); // CS:1
+    RArray<TUint32> iapIds;
+    TUint32 iapId( 0 );
+
+    // First get all free IAP ID's.
+    cmManager.ConnectionMethodL( iapIds );
+    CleanupClosePushL( iapIds ); // CS:2
+ 
+    // Then get IAP ID's from all destinations.
+    RArray<TUint32> destIds;
+    cmManager.AllDestinationsL( destIds );
+    CleanupClosePushL( destIds ); // CS:3
+    
+    TInt destCount = destIds.Count();
+    
+    for ( TInt destIndex = 0; destIndex < destCount; destIndex++ )
+        {
+        RCmDestinationExt dest = cmManager.DestinationL( 
+            destIds[destIndex] );
+        CleanupClosePushL( dest ); // CS:4
+        TInt cmCount = dest.ConnectionMethodCount();
+        for ( TInt cmIndex = 0; cmIndex < cmCount; cmIndex++ )
+            {
+            TUint32 apId = dest.ConnectionMethodL( 
+                cmIndex ).GetIntAttributeL( CMManager::ECmIapId );
+            iapIds.AppendL( apId );
+            }
+        CleanupStack::PopAndDestroy( &dest ); // CS:3
+        }
+    // Finally, go through all connection methods and find correct IAP ID.
+    const TInt cmCount = iapIds.Count();
+    for ( TInt counter = 0; counter < cmCount; counter++ )
+        {
+        TUint32 id = cmManager.GetConnectionMethodInfoIntL( 
+            iapIds[counter], CMManager::ECmWapId );
+
+        if ( id == aWapId )
+            {
+            iapId = iapIds[counter];
+            // No need to go through rest of IAPs.
+            break;
+            }
+        }
+    
+    // PopAndDestroy destIds, iapIds, cmManager.
+    CleanupStack::PopAndDestroy( 3, &cmManager ); // CS:0
+
+    DBG_PRINT( "CWPVoIPAdapter::IapIdFromWapIdL - end" );
+    return iapId;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/src/CWPVoIPCodec.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles and stores the VoIP codec settings.
+*
+*/
+
+
+// INCLUDE FILES
+#include    <crcseaudiocodecentry.h>
+#include    "CWPVoIPCodec.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// CWPVoIPCodec::CWPVoIPCodec
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+CWPVoIPCodec::CWPVoIPCodec()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPCodec::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+void CWPVoIPCodec::ConstructL()
+    {
+    iMediaTypeName = HBufC::NewL( 0 );
+    iMediaSubtypeName = HBufC::NewL( 0 );
+    iJitterBufferSize = KNotSet;
+    iOctetAlign = KNotSet;
+    iModeChangePeriod = KNotSet;
+    iModeChangeNeighbor = KNotSet;
+    iPTime = KNotSet;
+    iMaxPTime = KNotSet;
+    iCrc = KNotSet;
+    iRobustSorting = KNotSet;
+    iInterLeaving = KNotSet;
+    iVAD = KNotSet;
+    iDTX = KNotSet;
+    iSamplingRate = KNotSet;
+    iAnnexB = KNotSet;
+    iMaxRed = KNotSet;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPCodec::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+CWPVoIPCodec* CWPVoIPCodec::NewL()
+    {
+    CWPVoIPCodec* self = new( ELeave ) CWPVoIPCodec;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// Destructor
+CWPVoIPCodec::~CWPVoIPCodec()
+    {
+    delete iMediaTypeName;
+    delete iMediaSubtypeName;
+    if ( iModeSet.Count() )
+        {
+        iModeSet.Reset();
+        iModeSet.Close();
+        }
+    if ( iChannels.Count() )
+        {
+        iChannels.Reset();
+        iChannels.Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPCodec::SetMediaSubtypeNameL
+//
+// ---------------------------------------------------------------------------
+void CWPVoIPCodec::SetMediaSubtypeNameL( const TDesC& aMediaSubtypeName )
+	{
+	delete iMediaSubtypeName;
+	iMediaSubtypeName = NULL;
+	iMediaSubtypeName = aMediaSubtypeName.AllocL();
+	}
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/src/CWPVoIPItem.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,2186 @@
+/*
+* Copyright (c) 2002-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:  Holds transiently and stores one VoIP settings item.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include    <wpvoipadapter.rsg>
+#include    <charconv.h>
+#include    <in_sock.h>                // TInetAddr, TSockAddr
+#include    <crcseprofileentry.h>
+#include    <crcseprofileregistry.h>
+#include    <crcseaudiocodecentry.h>
+#include    <crcseaudiocodecregistry.h>
+#include    <CWPCharacteristic.h>
+#include    <sysutil.h>            // For GetWlanMacAddressL.
+#include    <wlaninternalpskeys.h> // For GetWlanMacAddressL.
+#include    <centralrepository.h>
+#include    <settingsinternalcrkeys.h>
+#include <coemain.h> // For GetPhoneModelL.
+#include <WPAdapterUtil.h>
+#include <sipmanagedprofile.h>
+#include <sipprofileregistryobserver.h>
+#include <sipmanagedprofileregistry.h>
+#include <spsettings.h>     // for SPS
+#include <spentry.h>        // for SPS
+#include <spproperty.h>     // for SPS
+#include <spdefinitions.h> 
+#include <cmmanagerext.h>
+#include <cmdestinationext.h>
+#include <cmconnectionmethodext.h>
+#include <cmconnectionmethoddef.h>
+#include <cmpluginwlandef.h> // For WLAN plugin UID, i.e. bearer type.
+#include <versit.h>
+#include <cvimpstsettingsstore.h> // For IM tone path
+#include <pathinfo.h> // For getting phone rom root path.
+
+#include "CWPVoIPItem.h"
+#include "CSIPProfileRegistryObserver.h"
+#include "cipappphoneutils.h"           // For GetPhoneModelL, GetTerminalTypeL
+#include "cipapputilsaddressresolver.h"    // For GetWlanMacAddressL
+
+// LOCAL CONSTANTS
+static const TInt32 KNotSaved( -1 );
+static const TInt KMaxCharsInTUint32( 10 );
+const TInt32 KCCHPresenceSubServicePlugId = 0x1027545A;
+_LIT8( KUserAgent,        "User-Agent" );
+_LIT8( KColonMark,        ":" );
+// Default IM message tone
+_LIT( KDefaultTone,       "Message 2.aac" );
+_LIT8( KSpaceMark,        " " );
+_LIT( KVoIPAdapterName,   "WPVoIPAdapter");
+_LIT( KOpenParenthesis,   "(" );
+_LIT( KClosedParenthesis, ")" );
+const TInt KTwo( 2 );
+const TInt KVmbxResubscribeDefault = 600;
+
+// IM related constants.
+const TUint32 KIMSubServicePluginId = 0x1027545A; // KSIPConnectivityPluginImplUid
+const TUint32 KIMLaunchUid          = 0x200255D0;
+const TInt    KIMSettingsId         = 1;
+
+// Bearer related constants
+const TUint32 KBearerNotSpecified = 0;
+const TUint32 KBearerWlanOnly = 1;
+const TUint32 KBearerCellularOnly = 2;
+
+// Following lines are for enabling debug prints.
+#ifdef _DEBUG
+#define DBG_PRINT(p) RDebug::Print(_L(p))
+#define DBG_PRINT2(p,a) RDebug::Print(_L(p),a)
+#else
+#define DBG_PRINT(p)
+#define DBG_PRINT2(p,a)
+#endif // _DEBUG
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::CWPVoIPItem
+// 
+// ---------------------------------------------------------------------------
+//
+CWPVoIPItem::CWPVoIPItem()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::NewL
+// 
+// ---------------------------------------------------------------------------
+//
+CWPVoIPItem* CWPVoIPItem::NewL() 
+    {
+    DBG_PRINT( "CWPVoIPItem::NewL - begin" );
+    CWPVoIPItem* self = new (ELeave) CWPVoIPItem;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    DBG_PRINT( "CWPVoIPItem::NewL - end" );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::ConstructL()
+// 
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::ConstructL()
+    {
+    // Initialization with empty string or KNotSaved or -1 or if default 
+    // value exists with default values.
+    iItemId = TUint( KNotSaved );
+    TFileName fileName;
+    Dll::FileName(fileName);
+
+    // Default provider value read from the resource file.
+    iProviderId = WPAdapterUtil::ReadHBufCL( fileName, 
+        KVoIPAdapterName, R_QTN_SM_PROVIDER_VOIP );
+    // Default name value read from the resource file.
+    iName = WPAdapterUtil::ReadHBufCL( fileName, KVoIPAdapterName, 
+        R_QTN_SM_HEAD_VOIP );
+
+    iStartMediaPort            = KNotSet;
+    iEndMediaPort              = KNotSet;
+    iMediaQoS                  = KNotSet;
+    iDTMFInBand                = KNotSet;
+    iDTMFOutBand               = KNotSet;
+    iSavedProfileId            = HBufC8::NewL( 0 );
+    iSecureCallPref            = KNotSet;
+    iRTCP                      = KNotSet;
+    iUAHTerminalType           = KNotSet;
+    iUAHWLANMAC                = KNotSet;
+    iUAHString                 = HBufC::NewL( 0 );
+    iProfileLockedToIAP        = KNotSet;
+    iVoIPPluginUid             = KNotSet;
+    iAllowVoIPOverWCDMA        = KNotSet;
+    iVoIPDigits                = KNotSet;
+    iDomainPartIgnoreRule      = KNotSet;
+    iAddUserPhoneToAllNumbers  = KNotSet;
+    iSIPConnTestAddress        = HBufC::NewL( 0 );
+    iServiceProviderBookmark   = HBufC::NewL( 0 );
+    iSIPMinSE                  = KNotSet;
+    iSIPSessionExpires         = KNotSet;
+    iIPVoiceMailBoxURI         = HBufC::NewL( 0 );
+    iVmbxListenAddress         = HBufC::NewL( 0 );
+    iAutoAcceptBuddyRequest    = KNotSet;
+    iBrandingDataAddress       = HBufC::NewL( 0 );
+    iToNapId                   = HBufC8::NewL( 0 );
+    iVoipUrisToAppRef          = HBufC8::NewL( 0 );
+    iUsedNatProtocol           = KNotSet;
+    iAppRef                    = HBufC8::NewL( 0 );
+    iReSubscribeInterval       = KVmbxResubscribeDefault;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::~CWPVoIPItem
+//
+// ---------------------------------------------------------------------------
+//
+CWPVoIPItem::~CWPVoIPItem()
+    {
+    DBG_PRINT( "CWPVoIPItem::~CWPVoIPItem - begin" );
+    delete iProviderId;
+    delete iName;
+    iToAppRefs.ResetAndDestroy();
+    iToAppRefs.Close();
+    delete iSavedProfileId;
+    delete iUAHString;
+    delete iSIPConnTestAddress;
+    delete iServiceProviderBookmark;
+    delete iIPVoiceMailBoxURI;
+    delete iVmbxListenAddress;
+    delete iBrandingDataAddress;
+    delete iToNapId;
+    delete iVoipUrisToAppRef;
+    delete iAppRef;
+
+    iCodecs.ResetAndDestroy();
+    iCodecs.Close();
+
+    DBG_PRINT( "CWPVoIPItem::~CWPVoIPItem - end" );
+    //lint -e{1740} iNapDef is not owned
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetAppRefL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetAppRefL( const TDesC8& aAppRef )
+    {
+    delete iAppRef;
+    iAppRef = NULL;
+    iAppRef = aAppRef.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetProviderIdL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetProviderIdL( const TDesC& aPROVIDERID )
+    {
+    delete iProviderId;
+    iProviderId = NULL;
+    iProviderId = aPROVIDERID.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetNameL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetNameL( const TDesC& aNAME )
+    {
+    delete iName;
+    iName = NULL;
+    iName = aNAME.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::AddToAppRefL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::AddToAppRefL( const TDesC8& aToAppRef )
+    {
+    // Dependencies to SIP, SCCP, NATFW and SNAP settings.
+    
+    // Must put string on cleanup stack in case memory alloc fails in AppendL.
+    HBufC8* tmp = aToAppRef.AllocLC();
+    iToAppRefs.AppendL( tmp );
+    CleanupStack::Pop( tmp );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetStartMediaPort
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetStartMediaPort( TInt aStartMediaPort )
+    {
+    iStartMediaPort = aStartMediaPort;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetEndMediaPort
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetEndMediaPort( TInt aEndMediaPort )
+    {
+    iEndMediaPort = aEndMediaPort;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetMediaQoS
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetMediaQoS( TInt aMediaQoS )
+    {
+    iMediaQoS = aMediaQoS;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetDTMFInBand
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetDTMFInBand( TInt aDTMFInBand )
+    {
+    iDTMFInBand = aDTMFInBand;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetDTMFOutOfBand
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetDTMFOutBand( TInt aDTMFOutBand )
+    {
+    iDTMFOutBand = aDTMFOutBand;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::AddCodec
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::AddCodecL( const CWPVoIPCodec* aVoIPCodec )
+    {
+    iCodecs.AppendL( aVoIPCodec );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetSecureCallPref
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetSecureCallPref( TInt aSecureCallPref )
+    {
+    iSecureCallPref = aSecureCallPref;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetRTCP
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetRTCP( TInt aRTCP )
+    {
+    iRTCP = aRTCP;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetUAHTerminalType
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetUAHTerminalType( TInt aUAHTerminalType )
+    {
+    iUAHTerminalType = aUAHTerminalType;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetUAHWLANMAC
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetUAHWLANMAC( TInt aUAHWLANMAC )
+    {
+    iUAHWLANMAC = aUAHWLANMAC;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetUAHStringL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetUAHStringL( const TDesC& aUAHString )
+    {
+    delete iUAHString;
+    iUAHString = NULL;
+    iUAHString = aUAHString.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetProfileLockedToIAP
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetProfileLockedToIAP( TInt aProfileLockedToIAP )
+    {
+    iProfileLockedToIAP = aProfileLockedToIAP;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetVoIPPluginUid
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetVoIPPluginUid( TInt aVoIPPluginUid )
+    {
+    iVoIPPluginUid = aVoIPPluginUid;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetAllowVoIPOverWCDMA
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetAllowVoIPOverWCDMA( TInt aAllowVoIPOverWCDMA )
+    {
+    iAllowVoIPOverWCDMA = aAllowVoIPOverWCDMA;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetVoIPDigits
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetVoIPDigits( TInt aVoIPDigits )
+    {
+    iVoIPDigits = aVoIPDigits;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetDomainPartIgnoreRule
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetDomainPartIgnoreRule( TInt aDomainPartIgnoreRule )
+    {
+    iDomainPartIgnoreRule = aDomainPartIgnoreRule;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetAddUserPhone
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetAddUserPhone( TInt32 aAddUserPhone )
+    {
+    iAddUserPhoneToAllNumbers = aAddUserPhone;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetSipConnTestAddress
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetSipConnTestAddressL( const TDesC& aSIPConnTestAddress )
+    {
+    delete iSIPConnTestAddress;
+    iSIPConnTestAddress = NULL;
+    iSIPConnTestAddress = aSIPConnTestAddress.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetServiceProviderBookmarkL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetServiceProviderBookmarkL( 
+    const TDesC& aServiceProviderBookmark )
+    {
+    delete iServiceProviderBookmark;
+    iServiceProviderBookmark = NULL;
+    iServiceProviderBookmark = aServiceProviderBookmark.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetSipMinSe
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetSipMinSe( TInt32 aSIPMinSE )
+    {
+    iSIPMinSE = aSIPMinSE;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetSipSessionExpires
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetSipSessionExpires( TInt32 aSIPSessionExpires )
+    {
+    iSIPSessionExpires = aSIPSessionExpires;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetIPVoiceMailBoxURIL
+// 
+// ---------------------------------------------------------------------------
+void CWPVoIPItem::SetIPVoiceMailBoxURIL( const TDesC& aIPVoiceMailBoxURI )
+    {
+    delete iIPVoiceMailBoxURI;
+    iIPVoiceMailBoxURI = NULL;
+    iIPVoiceMailBoxURI = aIPVoiceMailBoxURI.AllocL();
+    iVmbxSettingsExist = ETrue;
+    }    
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetVoiceMailBoxListenURIL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetVoiceMailBoxListenURIL( const TDesC& aVmbxListenAddress )
+    {
+    delete iVmbxListenAddress;
+    iVmbxListenAddress = NULL;
+    iVmbxListenAddress = aVmbxListenAddress.AllocL();
+    iVmbxSettingsExist = ETrue;
+    }
+    
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetReSubscribeInterval
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetReSubscribeInterval( TInt32 aReSubscribeInterval )
+    {
+    iReSubscribeInterval = aReSubscribeInterval;
+    iVmbxSettingsExist = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetBrandingDataAddressL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetBrandingDataAddressL( const TDesC& aBrandingDataAddress )
+    {
+    delete iBrandingDataAddress;
+    iBrandingDataAddress = NULL;
+    iBrandingDataAddress = aBrandingDataAddress.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetAutoAcceptBuddyRequest
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetAutoAcceptBuddyRequest( TInt32 aAutoAcceptBuddyRequest )
+    {
+    iAutoAcceptBuddyRequest = aAutoAcceptBuddyRequest;
+    }    
+    
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetAutoEnableService
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetAutoEnableService( TInt32 aAutoEnableService )
+    {
+    iAutoEnableService = aAutoEnableService;
+    }
+    
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetNapDef
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetNapDef( CWPCharacteristic* aNapDef )
+    {
+    iNapDef = aNapDef;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetToNapIdL
+//
+// ---------------------------------------------------------------------------
+void CWPVoIPItem::SetToNapIdL( const TDesC8& aToNapId )
+    {
+    delete iToNapId;
+    iToNapId = NULL;
+    iToNapId = aToNapId.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetIapId
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetIapId( TUint32 aIapId )
+    {
+    iVmbxIapId = aIapId;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetStorageId
+//
+// ---------------------------------------------------------------------------
+//
+TBool CWPVoIPItem::SetStorageId( TSettingsType aProfileType, 
+    TUint32 aStorageId, const TDesC8& aAppRef )
+    {
+    DBG_PRINT( "CWPVoIPItem::SetStorageId - begin" );
+    const TInt toAppRefCount = iToAppRefs.Count();
+    TInt counter( KErrNone );
+
+    //lint -e{961} No need for else statement here
+    if ( ESIP == aProfileType )
+        {
+        for ( counter = 0; counter < toAppRefCount; counter++ )
+            {
+            if ( KErrNone == iToAppRefs[counter]->CompareF( aAppRef ) 
+                && !iSipIdSet )
+                {
+                iSipId = aStorageId;
+                iSipIdSet = ETrue;
+                DBG_PRINT( "CWPVoIPItem::SetStorageId - SIP ID set; end" );
+                return ETrue;
+                }
+            }
+        if ( KErrNone == iVoipUrisToAppRef->CompareF( aAppRef ) )
+            {
+            iVmbxSipId = aStorageId;
+            iVmbxSipIdSet = ETrue;
+            DBG_PRINT( 
+            	"CWPVoIPItem::SetStorageId - SIP ID for VMBX set; end" );
+            return ETrue;
+            }
+        }
+
+    else if ( ESCCP == aProfileType )
+        {
+        for ( counter = 0; counter < toAppRefCount; counter++ )
+            {
+            if ( KErrNone == iToAppRefs[counter]->CompareF( aAppRef ) 
+                && !iSccpIdSet )
+                {
+                iSccpId = aStorageId;
+                iSccpIdSet = ETrue;
+                DBG_PRINT( "CWPVoIPItem::SetStorageId - SCCP ID set; end" );
+                return ETrue;
+                }
+            }
+        }
+
+    else if ( ENATFW == aProfileType )
+        {
+        for ( counter = 0; counter < toAppRefCount; counter++ )
+            {
+            if ( KErrNone == iToAppRefs[counter]->CompareF( aAppRef ) 
+                && !iNatFwIdSet )
+                {
+                iNatFwId = aStorageId;
+                iNatFwIdSet = ETrue;
+                DBG_PRINT(
+                    "CWPVoIPItem::SetStorageId - NAT/FW ID set; end" );
+                return ETrue;
+                }
+            }
+        }
+
+    else if ( EPresence == aProfileType )
+        {
+        for ( counter = 0; counter < toAppRefCount; counter++ )
+            {
+            if ( KErrNone == iToAppRefs[counter]->CompareF( aAppRef )
+                && !iPresenceIdSet )
+                {
+                iPresenceId = aStorageId;
+                iPresenceIdSet = ETrue;
+                DBG_PRINT(
+                    "CWPVoIPItem::SetStorageId - Presence ID set; end" );
+                return ETrue;
+                }
+            }
+        }
+        
+    else if ( ESNAP == aProfileType )
+        {
+        for ( counter = 0; counter < toAppRefCount; counter++ )
+            {
+            if ( KErrNone == iToAppRefs[counter]->CompareF( aAppRef ) 
+                && !iSnapIdSet )
+                {
+                iSnapId = aStorageId;
+                iSnapIdSet = ETrue;
+                DBG_PRINT( "CWPVoIPItem::SetStorageId - SNAP ID set; end" );
+                return ETrue;
+                }
+            }
+        }
+
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetVoipUrisToAppRefL
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetVoipUrisToAppRefL( const TDesC8& aToAppRef )
+    {
+    // VMBX dependency to SIP settigns, VoIP dependency to Presence settings.
+    delete iVoipUrisToAppRef;
+    iVoipUrisToAppRef = NULL;
+    iVoipUrisToAppRef = aToAppRef.AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SetUsedNatProtocol
+//
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetUsedNatProtocol( TInt32 aUsedNatProtocol)
+    {
+    iUsedNatProtocol = aUsedNatProtocol;
+    }    
+
+// Getters
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::Name
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC& CWPVoIPItem::Name() const
+    {
+    return *iName;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::UAHString
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC& CWPVoIPItem::UAHString() const
+    {
+    return *iUAHString;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::ToNapId
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CWPVoIPItem::ToNapId() const
+    {
+    return *iToNapId;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::NapDef
+//
+// ---------------------------------------------------------------------------
+//
+CWPCharacteristic* CWPVoIPItem::NapDef()
+    {
+    return iNapDef;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::VoipUrisToAppRef
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CWPVoIPItem::VoipUrisToAppRef() const
+    {
+    return *iVoipUrisToAppRef;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::StoreL
+// 1) Set VoIP parameters into the VoIP profile entry.
+// 2) Save audio codecs and add their storage ids into the VoIP profile entry
+//    and VoIP item.
+// 3) Save the VoIP profile entry.
+// SIP ID's, SIP profile specific data, SCCP ID & Presence ID are not stored
+// here, nor are VoIP settings belonging to SPS. They are all stored when the
+// SavingFinalized method is called because only then it is guaranteed that
+// the data needed is received and ready for saving.
+// ---------------------------------------------------------------------------
+//
+TUint CWPVoIPItem::StoreL()
+    {
+    DBG_PRINT( "CWPVoIPItem::StoreL - begin" );
+    // Save the VoIP profile.
+    CRCSEProfileEntry* cRCSEProfileEntry = CRCSEProfileEntry::NewLC(); // CS:1
+    cRCSEProfileEntry->iId = iItemId;
+    cRCSEProfileEntry->iProviderName.Copy( iProviderId->Des() );
+    cRCSEProfileEntry->iSettingsName.Copy( iName->Des() );
+
+    // Saving the codecs and and storaging their ids in VoIP profile.
+    typedef CRCSEAudioCodecEntry AudioCodecEntry;
+    CRCSEAudioCodecRegistry* cRCSEAudioCodecRegistry = 
+        CRCSEAudioCodecRegistry::NewLC(); // CS:2
+
+    CWPVoIPCodec* tmpCodec = NULL;
+    const TInt numberOfCodecs = iCodecs.Count();
+
+    for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; codecIndex++ )
+        {
+        tmpCodec = iCodecs[codecIndex];
+        CRCSEAudioCodecEntry* cRCSEAudioCodecEntry = 
+            CRCSEAudioCodecEntry::NewLC(); // CS:3
+
+        // Codec initiated with it's default values.
+        cRCSEAudioCodecEntry->SetDefaultCodecValueSet( tmpCodec->
+            iMediaSubtypeName->Des() );
+
+        cRCSEAudioCodecEntry->iMediaSubTypeName.Zero();
+        cRCSEAudioCodecEntry->iMediaSubTypeName.Copy( tmpCodec->
+            iMediaSubtypeName->Des() );
+
+        // Set codec values, take values only when they exist.
+
+        // JitterBufferSize
+        if ( KNotSet != tmpCodec->iJitterBufferSize )
+            {
+            cRCSEAudioCodecEntry->iJitterBufferSize = 
+                tmpCodec->iJitterBufferSize;
+            }
+
+        // OctetAlign
+        if ( KNotSet != tmpCodec->iOctetAlign )
+            {
+            cRCSEAudioCodecEntry->iOctetAlign = 
+                static_cast<AudioCodecEntry::TOnOff>
+                ( tmpCodec->iOctetAlign );
+            }
+
+        // ModeSet
+        TInt modeSetCount = iCodecs[codecIndex]->iModeSet.Count();
+        if ( modeSetCount > 0 )
+            {
+            // Take off default values if some values are provisioned.
+            cRCSEAudioCodecEntry->iModeSet.Reset();
+            for ( TInt modeSetIndex = 0; modeSetIndex < modeSetCount; 
+                modeSetIndex++ )
+                {
+                cRCSEAudioCodecEntry->iModeSet.Append( iCodecs[codecIndex]->
+                    iModeSet[modeSetIndex] );
+                }// for
+            }// if
+
+        // ModeChangePeriod
+        if ( KNotSet != tmpCodec->iModeChangePeriod )
+            {
+            cRCSEAudioCodecEntry->iModeChangePeriod = 
+                tmpCodec->iModeChangePeriod;
+            }
+
+        // ModeChangeNeighbor
+        if ( KNotSet != tmpCodec->iModeChangeNeighbor )
+            {
+            cRCSEAudioCodecEntry->iModeChangeNeighbor = 
+                static_cast<AudioCodecEntry::TOnOff>
+                ( tmpCodec->iModeChangeNeighbor );
+            }
+
+        // PTime    
+        if ( KNotSet != tmpCodec->iPTime )
+            {
+            cRCSEAudioCodecEntry->iPtime = tmpCodec->iPTime;
+            }
+
+        // MaxPTime
+        if ( KNotSet != tmpCodec->iMaxPTime )
+            {
+            cRCSEAudioCodecEntry->iMaxptime = tmpCodec->iMaxPTime;
+            }
+
+        // VAD
+        if ( KNotSet != tmpCodec->iVAD )
+            {
+            cRCSEAudioCodecEntry->iVAD = 
+                static_cast<AudioCodecEntry::TOnOff>( tmpCodec->iVAD );
+            }
+
+        // AnnexB
+        if ( KNotSet != tmpCodec->iAnnexB )
+            {
+            cRCSEAudioCodecEntry->iAnnexb = 
+                static_cast<AudioCodecEntry::TOnOff>( tmpCodec->iAnnexB );
+            }
+
+        // MaxRed
+        if ( KNotSet != tmpCodec->iMaxRed )
+            {
+            cRCSEAudioCodecEntry->iMaxRed = tmpCodec->iMaxRed;
+            }
+        // Simple check, that there is at least media sub type name.
+        // If not ok, then the codec is not saved.
+        if ( tmpCodec->iMediaSubtypeName->Length() > 0 )
+            {
+            // Store the codec entry and get the storage id.
+            tmpCodec->iId = cRCSEAudioCodecRegistry->AddL( 
+                *cRCSEAudioCodecEntry );
+            }// if
+
+        CleanupStack::PopAndDestroy( cRCSEAudioCodecEntry ); // CS:2
+        }// for
+
+    CleanupStack::PopAndDestroy ( cRCSEAudioCodecRegistry ); // CS:1
+
+    if ( numberOfCodecs > 1 )
+        {
+        // Sort the codec array into priority order (by PRIORITYINDEX).
+        RArray<TInt> priorityArray;
+        for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; codecIndex++ )
+            {
+            priorityArray.Append( iCodecs[codecIndex]->iPriorityIndex );
+            }
+        priorityArray.Sort();
+        
+        //delete possible duplicate priority index
+        for ( TInt index = 0; index < priorityArray.Count()-1; ++index )
+            {
+            TInt tmpIndex = index + 1; 
+            while ( tmpIndex < priorityArray.Count() &&
+                    priorityArray[tmpIndex] == priorityArray[index] )
+                {
+                priorityArray.Remove( tmpIndex );
+                }
+            }
+
+        RPointerArray<CWPVoIPCodec> tmpArray;
+
+        TInt numberOfPriority = priorityArray.Count();
+        for ( TInt priorityIndex = 0; priorityIndex < numberOfPriority; 
+            priorityIndex++ )
+            {
+            for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; 
+                codecIndex++ )
+                {
+                if ( priorityArray[priorityIndex] == 
+                    iCodecs[codecIndex]->iPriorityIndex )
+	            
+                    {
+                    tmpArray.Append( iCodecs[codecIndex] );
+                    }
+                }
+            }
+
+        for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; codecIndex++ )
+            {
+            iCodecs[codecIndex] = tmpArray[codecIndex];
+            }
+        tmpArray.Close();
+        priorityArray.Close();
+        } // if
+
+    // Set the priority list of codecs.
+    for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; codecIndex++ )
+        {
+        cRCSEProfileEntry->iPreferredCodecs.Append( 
+            iCodecs[codecIndex]->iId );
+        }// for
+
+    // If no codecs exist create default codecs
+    if ( !numberOfCodecs )
+        {
+        AddDefaultCodecsL( *cRCSEProfileEntry );
+        }
+
+    // StartMediaPort
+    if ( KNotSet != iStartMediaPort )
+        {
+        cRCSEProfileEntry->iStartMediaPort = iStartMediaPort;
+        }
+
+    // EndMediaPort
+    if ( KNotSet != iEndMediaPort )
+        {
+        cRCSEProfileEntry->iEndMediaPort = iEndMediaPort;
+        }
+
+    // MediaQoS
+    if ( KNotSet != iMediaQoS )
+        {
+        cRCSEProfileEntry->iMediaQOS = iMediaQoS;
+        }
+
+    // InbandDTMF
+    if ( KNotSet != iDTMFInBand )
+        {
+        cRCSEProfileEntry->iInbandDTMF = 
+            static_cast<VoIPProfileEntry::TOnOff>( iDTMFInBand );
+        }
+
+    // OutbandDTMF
+    if ( KNotSet != iDTMFOutBand )
+        {
+        cRCSEProfileEntry->iOutbandDTMF = 
+            static_cast<VoIPProfileEntry::TOnOff>( iDTMFOutBand );
+        }
+
+    // SecureCallPref
+    if ( KNotSet != iSecureCallPref )
+        {
+        cRCSEProfileEntry->iSecureCallPreference = iSecureCallPref;
+        }
+
+    // RTCP
+    if ( KNotSet != iRTCP )
+        {
+        cRCSEProfileEntry->iRTCP = iRTCP;
+        }
+
+    // UAHTerminalType
+    if ( KNotSet != iUAHTerminalType )
+        {
+        cRCSEProfileEntry->iSIPVoIPUAHTerminalType = iUAHTerminalType;
+        }
+
+    // UAHWLANMAC
+    if ( KNotSet != iUAHWLANMAC )
+        {
+        cRCSEProfileEntry->iSIPVoIPUAHeaderWLANMAC = iUAHWLANMAC;
+        }
+
+    // UAHString
+    if ( iUAHString->Des().Length() > 0 )
+        {
+        cRCSEProfileEntry->iSIPVoIPUAHeaderString.Zero();
+        cRCSEProfileEntry->iSIPVoIPUAHeaderString.Insert( 0, 
+            iUAHString->Des() );
+        }
+
+    // ProfileLockedToIAP
+    if ( KNotSet != iProfileLockedToIAP )
+        {
+        cRCSEProfileEntry->iProfileLockedToIAP = 
+            static_cast<VoIPProfileEntry::TOnOff>( iProfileLockedToIAP );
+        }
+
+    // VoIPPluginUid
+    if ( KNotSet != iVoIPPluginUid )
+        {
+        cRCSEProfileEntry->iVoIPPluginUID = iVoIPPluginUid;
+        }
+
+    // VoIPDigits
+    if ( KNotSet != iVoIPDigits )
+        {
+        cRCSEProfileEntry->iMeanCountOfVoIPDigits = iVoIPDigits;
+        }
+
+    // DomainPartIgnoreRule
+    if ( KNotSet != iDomainPartIgnoreRule )
+        {
+        cRCSEProfileEntry->iIgnoreAddrDomainPart = iDomainPartIgnoreRule;
+        }
+
+    // UserPhoneToAllNumbers
+    if ( KNotSet != iAddUserPhoneToAllNumbers )
+        {
+        cRCSEProfileEntry->iUserPhoneUriParameter = 
+            static_cast<VoIPProfileEntry::TOnOff>
+            ( iAddUserPhoneToAllNumbers );
+        }
+
+    // SIPConnTestAddress
+    if ( iSIPConnTestAddress->Des().Length() > 0 )
+        {
+        cRCSEProfileEntry->iSIPConnTestAddress.Zero();
+        cRCSEProfileEntry->iSIPConnTestAddress.Insert( 0, 
+            iSIPConnTestAddress->Des() );
+        }
+
+    // SIPMinSE
+    if ( KNotSet != iSIPMinSE )
+        {
+        cRCSEProfileEntry->iSIPMinSE = iSIPMinSE;
+        }
+
+    // SIPSessionExpires
+    if ( KNotSet != iSIPSessionExpires )
+        {
+        cRCSEProfileEntry->iSIPSessionExpires = iSIPSessionExpires;
+        }
+
+    // UsedNATProtocol
+    if ( KNotSet != iUsedNatProtocol )
+        {
+        cRCSEProfileEntry->iNATProtocol = iUsedNatProtocol;
+        }                
+
+    if ( iSipIdSet )
+        {
+        TSettingIds referredIds;
+        referredIds.iProfileType = 0; // SIP.
+        referredIds.iProfileId = TInt( iSipId );
+        // Never reference to profile specific settings.
+        referredIds.iProfileSpecificSettingId = KNotSet; 
+        cRCSEProfileEntry->iIds.Append( referredIds );
+        }
+
+    // Save the new profile into the registry.
+    CRCSEProfileRegistry* cRCSEProfileRegistry = 
+        CRCSEProfileRegistry::NewLC();
+    // CS:2
+    CheckDuplicatesL( *cRCSEProfileEntry );
+    iItemId = cRCSEProfileRegistry->AddL( *cRCSEProfileEntry );
+
+    CleanupStack::PopAndDestroy( cRCSEProfileRegistry ); // CS:1
+    CleanupStack::PopAndDestroy( cRCSEProfileEntry ); // CS:0
+
+    // __UHEAP_MARKEND; // for testing
+
+    HBufC8* tmpId = HBufC8::NewL( KMaxCharsInTUint32 );
+    _LIT8( KFormatTxt,"%u" );
+    tmpId->Des().Format( KFormatTxt, iItemId );
+    delete iSavedProfileId;
+    iSavedProfileId = NULL;
+    iSavedProfileId = tmpId;
+    tmpId = NULL;
+    DBG_PRINT( "CWPVoIPItem::StoreL - end" );
+    return iItemId;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SaveData
+//
+// ---------------------------------------------------------------------------
+//
+const TDesC8& CWPVoIPItem::SaveData() const
+    {
+    return *iSavedProfileId;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::SavingFinalizedL()
+// 1) Save TO-APPREF dependent data and set SIP User Agent Header in SIP
+//    profile.
+// 2) Update the VoIP profile with references to the saved TO-APPREF dependent 
+//    data.
+// 3) Reset the data collections that are based on data received via call to
+//    method SettingsSaved (i.e. APPREF related data). This is because the
+//    user might for some reason save the settings twice and then the data is
+//    received once again (there would be then dublicates of data).
+//    
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SavingFinalizedL()
+    {
+    DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - begin" );
+    // Load the VoIP profile for update from the registry.
+    CRCSEProfileRegistry* cRCSEProfileRegistry = 
+        CRCSEProfileRegistry::NewLC();
+    // CS:1
+    CRCSEProfileEntry* cRCSEProfileEntry = CRCSEProfileEntry::NewLC(); // CS:2
+    cRCSEProfileRegistry->FindL( iItemId, *cRCSEProfileEntry );
+
+    // Data dependent on the other adapters can be saved here, because it is 
+    // now quaranteed that TO-APPREF pointed information is known.
+    // Test if this VoIP settings item of type SIP or SCCP dependent.
+
+    // Save RCSE related data.
+    //lint -e{961} No need for else statement here
+    if ( iSccpIdSet )
+        {
+        TSettingIds referredIds;
+        referredIds.iProfileType = 1; // SCCP.
+        referredIds.iProfileId = TInt( iSccpId );
+        // Never reference to profile specific settings.
+        referredIds.iProfileSpecificSettingId = KNotSet; 
+        cRCSEProfileEntry->iIds.Append( referredIds );
+        cRCSEProfileRegistry->UpdateL( iItemId, *cRCSEProfileEntry );
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - SCCP ID set" );
+        }
+
+    if ( iNatFwIdSet )
+        {
+        cRCSEProfileEntry->iNATSettingsStorageId = iNatFwId;
+        cRCSEProfileRegistry->UpdateL( iItemId, *cRCSEProfileEntry );
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - NAT/FW ID set" );
+        }
+
+    // Save Service Provider Settings related data if service ID exists.
+    TUint32 serviceId = cRCSEProfileEntry->iServiceProviderId;
+    if ( 0 == serviceId )
+        {
+        CleanupStack::PopAndDestroy( 2, cRCSEProfileRegistry );
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - end" );
+        return;
+        }
+    CSPSettings* spSettings = CSPSettings::NewLC(); // CS:3
+    CSPEntry* spEntry = CSPEntry::NewLC(); // CS:4
+
+    TInt err = spSettings->FindEntryL( serviceId, *spEntry );
+    User::LeaveIfError( err );
+
+    CSPProperty* property = CSPProperty::NewLC(); // CS:5
+
+    // VoiceMailBox: SIP ID
+    //lint -e{961} No need for else statement here
+    if ( iVmbxSipIdSet )
+        {
+        err = property->SetName( ESubPropertyVMBXSettingsId );
+        property->SetValue( iVmbxSipId );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyVMBXSettingsId, iVmbxSipId ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - Vmbx SIP ID set" );
+        }
+    // Use the same SIP ID as in RCSE. Store only if some 
+    // vmbx settings are provisioned.
+    else if ( iSipIdSet && iVmbxSettingsExist )
+        {
+        err = property->SetName( ESubPropertyVMBXSettingsId );
+        property->SetValue( iSipId );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyVMBXSettingsId, iSipId ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+            Vmbx SIP ID set (same SIP ID as in RCSE)" );
+        }
+        
+    // VoiceMailBox: MWI-URI
+    if ( iIPVoiceMailBoxURI->Des().Length() > 0 )
+        {
+        err = property->SetName( ESubPropertyVMBXMWIAddress );
+        property->SetValue( iIPVoiceMailBoxURI->Des() );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyVMBXMWIAddress, 
+                    iIPVoiceMailBoxURI->Des() ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - Vmbx MWI-URI set" );
+        }
+
+    // VoiceMailBox: Listening URI
+    if ( !iVmbxListenAddress->Des().Length() 
+        && iIPVoiceMailBoxURI->Des().Length() )
+        {
+        // Use same URI as with MWI-URI.
+        delete iVmbxListenAddress;
+        iVmbxListenAddress = NULL;
+        iVmbxListenAddress = iIPVoiceMailBoxURI->Des().AllocL();
+        }
+
+    if ( iVmbxListenAddress->Des().Length() > 0 )
+        {        
+        err = property->SetName( ESubPropertyVMBXListenAddress );
+        property->SetValue( iVmbxListenAddress->Des() );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyVMBXListenAddress, 
+                    iVmbxListenAddress->Des() ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        DBG_PRINT(
+            "CWPVoIPItem::SavingFinalizedL - Vmbx Listening URI set" );
+        }        
+
+    // VoiceMailBox: Re-Subscribe interval
+    if ( iVmbxSettingsExist )
+        {
+        err = property->SetName( ESubPropertyVMBXMWISubscribeInterval );
+        property->SetValue( iReSubscribeInterval );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyVMBXMWISubscribeInterval, 
+                    iReSubscribeInterval ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+            Vmbx re-SUBSCRIBE interval set" );
+        }
+
+    // VoiceMailBox: Preferred IAP ID
+    if ( iVmbxIapId )
+        {
+        err = property->SetName( ESubPropertyVMBXPreferredIAPId );
+        property->SetValue( iVmbxIapId );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyVMBXPreferredIAPId, iVmbxIapId ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - Vmbx IAP ID set" );
+        }
+
+    // Service provider bookmark URI
+    if ( iServiceProviderBookmark->Des().Length() > 0 )
+        {
+        err = property->SetName( EPropertyServiceBookmarkUri );
+        property->SetValue( iServiceProviderBookmark->Des() );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    EPropertyServiceBookmarkUri, 
+                    iServiceProviderBookmark->Des() ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+            Service provider bookmark URI set" );
+        }
+
+    // Branding data URI
+    if ( iBrandingDataAddress->Des().Length() > 0 )
+        {
+        err = property->SetName( ESubPropertyVoIPBrandDataUri );
+        property->SetValue( iBrandingDataAddress->Des() );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyVoIPBrandDataUri, 
+                    iBrandingDataAddress->Des() ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - Branding data URI set" );
+        }
+
+    // Presence settings ID and Presence Subservice plug-in UID
+    if ( iPresenceIdSet )
+        {
+        err = property->SetName( ESubPropertyPresenceSettingsId );
+        property->SetValue( iPresenceId );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyPresenceSettingsId, iPresenceId ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        
+        // Converged Connection Handler (CCH) Presence Subservice plug-in UID
+        err = property->SetName( EPropertyPresenceSubServicePluginId );
+        property->SetValue( KCCHPresenceSubServicePlugId );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    EPropertyPresenceSubServicePluginId, 
+                    KCCHPresenceSubServicePlugId ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            }
+
+        // ***************
+        // IM settings
+        // ***************
+        //
+        if ( iImEnabled )
+            {
+            property->SetName( ESubPropertyIMEnabled );
+            property->SetValue( EOn );
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyIMEnabled, EOn ) );
+                }
+
+            property->SetName( ESubPropertyIMLaunchUid );
+            property->SetValue( KIMLaunchUid );
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyIMLaunchUid, KIMLaunchUid ) );
+                }
+
+            property->SetName( ESubPropertyIMSettingsId );
+            // The value only needs to be different from 0,
+            // no-one actually uses it.
+            property->SetValue( KIMSettingsId );
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyIMSettingsId, KIMSettingsId ) );
+                }
+
+            property->SetName( EPropertyIMSubServicePluginId );
+            property->SetValue( KIMSubServicePluginId );
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    EPropertyIMSubServicePluginId, KIMSubServicePluginId ) );
+                }
+
+            DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - set IM tonepath" );
+
+            MVIMPSTSettingsStore* settings =
+                CVIMPSTSettingsStore::NewLC(); // CS: 1
+
+            // Set default tone.
+            TFileName toneFile;
+            toneFile.Copy( PathInfo::RomRootPath() );
+            toneFile.Append( PathInfo::DigitalSoundsPath() );
+            toneFile.Append( KDefaultTone );
+            User::LeaveIfError( settings->SetL( serviceId,
+                EServiceToneFileName, toneFile ) );
+            // settings
+            CleanupStack::PopAndDestroy(); // CS: 0
+
+            DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - IM settings set" );
+            }
+        DBG_PRINT( 
+        	"CWPVoIPItem::SavingFinalizedL - Presence settings ID set" );
+        }
+
+    // AutoAcceptBuddyRequest
+    if ( KNotSet != iAutoAcceptBuddyRequest )
+        {
+        err = property->SetName( ESubPropertyPresenceRequestPreference );
+        property->SetValue( static_cast<TOnOff> ( iAutoAcceptBuddyRequest ) );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyPresenceRequestPreference, 
+                    static_cast<TOnOff> ( iAutoAcceptBuddyRequest ) ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            }
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+            AutoAcceptBuddyRequest set" );
+        }
+        
+    // AutoEnableService
+    if ( KNotSet != iAutoEnableService )
+        {
+        err = property->SetName( ESubPropertyVoIPEnabled );
+        property->SetValue( static_cast<TOnOff>( iAutoEnableService ) );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyVoIPEnabled, 
+                    static_cast<TOnOff> ( iAutoEnableService ) ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+                voip AutoEnableService set" );
+            }
+        if ( iPresenceIdSet )
+            {
+            err = property->SetName( ESubPropertyPresenceEnabled );
+            property->SetValue( 
+                static_cast<TOnOff>( iAutoEnableService ) );
+            if ( KErrNone == err )
+                {
+                err = spEntry->AddPropertyL( *property );
+                if ( KErrAlreadyExists == err )
+                    {
+                    User::LeaveIfError( spEntry->UpdateProperty( 
+                        ESubPropertyPresenceEnabled, 
+                        static_cast<TOnOff> ( iAutoEnableService ) ) );
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+                    presence AutoEnableService set" );
+                }
+
+            }
+        if ( iVmbxSipIdSet || ( iSipIdSet && iVmbxSettingsExist ) 
+            && iIPVoiceMailBoxURI->Des().Length() )    
+            {
+            err = property->SetName( ESubPropertyVMBXEnabled );
+            property->SetValue( static_cast<TOnOff>( iAutoEnableService ) );
+            if ( KErrNone == err )
+                {
+                err = spEntry->AddPropertyL( *property );
+                if ( KErrAlreadyExists == err )
+                    {
+                    User::LeaveIfError( spEntry->UpdateProperty( 
+                        ESubPropertyVMBXEnabled, 
+                        static_cast<TOnOff> ( iAutoEnableService ) ) );
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                }
+                DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+                    vmbx AutoEnableService set" );
+            }
+        
+        if ( iImEnabled )
+            {
+            err = property->SetName( ESubPropertyIMEnabled );
+            property->SetValue( static_cast<TOnOff>( iAutoEnableService ) );
+            if ( KErrNone == err )
+                {
+                err = spEntry->AddPropertyL( *property );
+                if ( KErrAlreadyExists == err )
+                    {
+                    User::LeaveIfError( spEntry->UpdateProperty( 
+                        ESubPropertyIMEnabled, 
+                        static_cast<TOnOff> ( iAutoEnableService ) ) );
+                    }
+                else
+                    {
+                    User::LeaveIfError( err );
+                    }
+                }
+            DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+            im AutoEnableService set" );         
+            }
+        }
+
+    // SNAP ID
+    if ( iSnapIdSet && iSipIdSet )
+        {
+        CSIPProfileRegistryObserver* sipObs = 
+            CSIPProfileRegistryObserver::NewLC(); // CS:1
+        CSIPManagedProfileRegistry* sipReg =
+            CSIPManagedProfileRegistry::NewLC( *sipObs ); // CS:2
+        CSIPProfile* sipProf = NULL;
+        sipProf = sipReg->ProfileL( iSipId );
+        CleanupStack::PushL( sipProf ); // CS:3
+        CSIPManagedProfile* sipManagedProf = 
+            static_cast<CSIPManagedProfile*>( sipProf );
+        CleanupStack::PushL( sipManagedProf ); // CS:4
+        sipManagedProf->SetParameter( KSIPSnapId, iSnapId );
+        sipManagedProf->SetParameter( KSIPAccessPointId, (TUint32)0 );
+        DBG_PRINT2( "CWPVoIPItem::SavingFinalizedL - SNAP ID (1): %d", iSnapId );
+        sipReg->SaveL( *sipManagedProf );
+        CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3
+        CleanupStack::Pop( sipProf ); // CS:2
+        sipProf = NULL;
+        // sipReg, sipObs
+        CleanupStack::PopAndDestroy( 2, sipObs ); // CS:0
+        }
+    else if ( !iSnapIdSet && iSipIdSet )
+        {
+        CSIPProfileRegistryObserver* sipObs = 
+            CSIPProfileRegistryObserver::NewLC(); // CS:1
+        CSIPManagedProfileRegistry* sipReg =
+            CSIPManagedProfileRegistry::NewLC( *sipObs ); // CS:2
+        CSIPProfile* sipProf = NULL;
+        sipProf = sipReg->ProfileL( iSipId );
+        CleanupStack::PushL( sipProf ); // CS:3
+        CSIPManagedProfile* sipManagedProf = 
+            static_cast<CSIPManagedProfile*>( sipProf );
+        CleanupStack::PushL( sipManagedProf ); // CS:4
+
+        TUint32 snapId( 0 );
+        err = sipManagedProf->GetParameter( KSIPSnapId, snapId );
+                
+        if ( KErrNone == err )
+            {
+            iSnapId = snapId;
+            iSnapIdSet = ETrue;
+            }
+        else if ( KErrNotFound == err )
+            {
+            TUint32 iapId( 0 );
+            err = sipManagedProf->GetParameter( KSIPAccessPointId, iapId );
+            
+            if ( KErrNone == err )
+                {
+                // Copy connection method to default SNAP
+                RCmManagerExt cmManager;
+                CleanupClosePushL( cmManager );
+                cmManager.OpenL();
+                
+                TCmDefConnValue defConn;
+                cmManager.ReadDefConnL( defConn );
+                iSnapId = defConn.iId;  
+                iSnapIdSet = ETrue;
+                
+                RCmDestinationExt defaultSnap;
+                CleanupClosePushL( defaultSnap );
+                defaultSnap = cmManager.DestinationL( iSnapId );
+                
+                RCmConnectionMethodExt connection = 
+                    cmManager.ConnectionMethodL( iapId );
+                CleanupClosePushL( connection );
+                
+                // Get connection name
+                HBufC* connectionName = 
+                    connection.GetStringAttributeL( CMManager::ECmName );
+                CleanupStack::PushL( connectionName );   
+                
+                RBuf parsedConnectionName;
+                CleanupClosePushL( parsedConnectionName );
+                parsedConnectionName.CreateL( connectionName->Des().Length() );
+                
+                // Parse possible unique number from end of connection
+                // method name. accesspoint(xx) --> accesspoint
+                TInt pos = connectionName->Des().Locate( '(' );
+                if ( KErrNotFound != pos )
+                    {
+                    parsedConnectionName.Copy( 
+                        connectionName->Des().Left( pos ) );
+                    }
+                else
+                    {
+                    parsedConnectionName.Copy( 
+                        connectionName->Des() );
+                    }  
+                
+                // Check if connection method already exists in default snap
+                TBool matchFound( EFalse );
+                TInt conMethodCount = defaultSnap.ConnectionMethodCount();
+                
+                for ( TInt i( 0 ) ; 
+                    i < conMethodCount && matchFound == 0; i ++ )
+                    {
+                    RCmConnectionMethodExt cm = 
+                        defaultSnap.ConnectionMethodL( i );
+                    CleanupClosePushL( cm );
+                        
+                    HBufC* cmName = 
+                        cm.GetStringAttributeL( CMManager::ECmName );
+                    CleanupStack::PushL( cmName );    
+   
+                    RBuf parsedCmName;
+                    CleanupClosePushL( parsedCmName );
+                    parsedCmName.CreateL( cmName->Des().Length() );
+                    
+                    // Parse possible unique number from end of connection
+                    // method name. accesspoint(xx) --> accesspoint
+                    TInt pos = cmName->Des().Locate( '(' );
+                    if ( KErrNotFound != pos )
+                        {
+                        parsedCmName.Copy( cmName->Des().Left( pos ) );
+                        }
+                    else
+                        {
+                        parsedCmName.Copy( cmName->Des() );
+                        }   
+                    
+                    // Compare connection method names
+                    if ( parsedConnectionName.Compare( parsedCmName ) == 0 )
+                        {
+                        matchFound = ETrue;
+                        }
+
+                    CleanupStack::PopAndDestroy( &parsedCmName );
+                    CleanupStack::PopAndDestroy( cmName );
+                    CleanupStack::PopAndDestroy( &cm );
+                    }
+                
+                CleanupStack::PopAndDestroy( &parsedConnectionName );
+                CleanupStack::PopAndDestroy( connectionName );
+                
+                // Add copy only if not already exists with same name
+                if ( !matchFound )
+                    {
+                    defaultSnap.AddConnectionMethodL( 
+                        connection.CreateCopyL() );
+                    }
+                
+                // Change seamlessness level for linked WLAN IAP so that
+                // roaming is allowed without asking it from the user.
+                TUint32 bearerType = connection.GetIntAttributeL( 
+                    CMManager::ECmBearerType );
+                
+                if ( KUidWlanBearerType == bearerType )
+                    {
+                    connection.SetIntAttributeL( 
+                        CMManager::ECmSeamlessnessLevel, 
+                        CMManager::ESeamlessnessShowprogress );
+                    }
+                
+                defaultSnap.UpdateL();
+                
+                CleanupStack::PopAndDestroy( &connection );
+                CleanupStack::PopAndDestroy( &defaultSnap );
+                CleanupStack::PopAndDestroy( &cmManager );
+
+                // Update sip profile to use default snap
+                sipManagedProf->SetParameter( KSIPAccessPointId, (TUint32)0 );
+                sipManagedProf->SetParameter( KSIPSnapId, iSnapId );
+                DBG_PRINT2( "CWPVoIPItem::SavingFinalizedL - SNAP ID (2): %d", iSnapId );
+                sipReg->SaveL( *sipManagedProf );
+                }
+            }
+        
+        CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3
+        CleanupStack::Pop( sipProf ); // CS:2
+        sipProf = NULL;
+        // sipReg, sipObs
+        CleanupStack::PopAndDestroy( 2, sipObs ); // CS:0
+        sipReg = NULL;
+        }
+
+    if ( iSnapIdSet )
+        {
+        err = property->SetName( ESubPropertyVoIPPreferredSNAPId );
+        property->SetValue( iSnapId );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+            if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyVoIPPreferredSNAPId, iSnapId ) );
+                }
+            else
+                {
+                User::LeaveIfError( err );
+                }
+            DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - SNAP ID set" );
+            }
+        }
+
+    // ***************
+    // IM SNAP ID
+    // ***************
+    //
+    if ( iImEnabled )
+        {
+        property->SetName( ESubPropertyIMPreferredSNAPId );
+        err = property->SetValue( iSnapId );
+        if ( KErrNone == err )
+            {
+            err = spEntry->AddPropertyL( *property );
+           if ( KErrAlreadyExists == err )
+                {
+                User::LeaveIfError( spEntry->UpdateProperty( 
+                    ESubPropertyIMPreferredSNAPId, iSnapId ) );
+                }
+            }
+        }
+
+    User::LeaveIfError( spSettings->UpdateEntryL( *spEntry ) );
+    DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+        Service provider entry updated" );
+
+    DBG_PRINT2( "CWPVoIPItem::SavingFinalizedL - \
+        set allow VoIP over wcdma iAlowVoIPOverWCDMA=%d", iAllowVoIPOverWCDMA );
+    
+    //***********************
+    // Allow VoIP over WCDMA
+    //***********************
+    CSIPProfileRegistryObserver* sipObs = 
+        CSIPProfileRegistryObserver::NewLC(); // CS:1
+    CSIPManagedProfileRegistry* sipReg =
+        CSIPManagedProfileRegistry::NewLC( *sipObs ); // CS:2
+    CSIPProfile* sipProf = NULL;
+    sipProf = sipReg->ProfileL( iSipId );
+    CleanupStack::PushL( sipProf ); // CS:3
+    CSIPManagedProfile* sipManagedProf = 
+        static_cast<CSIPManagedProfile*>( sipProf );
+    CleanupStack::PushL( sipManagedProf ); // CS:4
+        
+    if ( iAllowVoIPOverWCDMA == 1 )
+        {
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+          set bearer not specified" );
+    
+        // If VoIP is allowed over wcdma set bearer type to sip as 
+        // not specified.
+        sipManagedProf->SetParameter( KBearerType, KBearerNotSpecified );
+        }
+    else
+        {
+        DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+            set bearer setting wlan only" );
+    
+        // If not allowed set bearer type to sip as wlan only
+        sipManagedProf->SetParameter( KBearerType, KBearerWlanOnly );
+        }
+    
+    sipReg->SaveL( *sipManagedProf );   
+    CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3
+    CleanupStack::Pop( sipProf ); // CS:2
+    sipProf = NULL;
+    // sipReg, sipObs
+    CleanupStack::PopAndDestroy( 2, sipObs ); // CS:0
+    
+    DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \
+      bearer settings set" );
+
+    // property, spEntry spSettings, cRCSEProfileEntry, cRCSEProfileRegistry
+    CleanupStack::PopAndDestroy( 5, cRCSEProfileRegistry ); // CS:0
+    iSipIdSet = EFalse;
+
+    DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::CheckDuplicatesL
+// Checks if duplicate provider and settings name. Renames if same.
+// ---------------------------------------------------------------------------
+//
+TBool CWPVoIPItem::CheckDuplicatesL( 
+    CRCSEProfileEntry& aEntry ) const
+    {
+    DBG_PRINT( "CWPVoIPItem::CheckDuplicatesL - begin" );
+    CRCSEProfileRegistry *cRCSEProfile = CRCSEProfileRegistry::NewLC();
+
+    // Array of pointers to all profile entries.
+    CArrayPtrFlat<CRCSEProfileEntry>* profileEntries = new (ELeave) 
+        CArrayPtrFlat<CRCSEProfileEntry>( 1 );
+    TCleanupItem cleanupItem( CWPVoIPItem::CleanupArrayItem, profileEntries );
+    CleanupStack::PushL( cleanupItem );
+
+    // Load profiles to pointerarray.
+    RArray<TUint32> allIds;
+    CleanupClosePushL( allIds );
+    cRCSEProfile->GetAllIdsL( allIds ); 
+
+    for ( TInt counter = 0; counter < allIds.Count(); counter++ )
+        {
+        CRCSEProfileEntry* profile = CRCSEProfileEntry::NewLC();
+        cRCSEProfile->FindL( allIds[counter], *profile );
+        profileEntries->AppendL( profile );
+        CleanupStack::Pop( profile ); 
+        }
+    CleanupStack::PopAndDestroy( &allIds );
+
+    // Check and rename duplicate provider.
+
+    TBool isValid( EFalse );
+
+    HBufC* newProviderName = HBufC::NewLC( KMaxProviderNameLength * KTwo );
+    newProviderName->Des().Copy( aEntry.iProviderName );
+
+    TInt count( profileEntries->Count() );
+
+    for ( TInt n = 0; n < count; n++ )
+        {
+        const TDesC& existingName = profileEntries->At( n )->iProviderName;
+        if ( existingName.Compare( aEntry.iProviderName ) == 0 )
+            {
+            TBool isUnique( EFalse );
+
+            for ( TInt i = 1; !isUnique; i++ )
+                {
+                TBool found( EFalse );
+                newProviderName->Des().Copy( aEntry.iProviderName );
+                newProviderName->Des().Append( KOpenParenthesis() );
+                newProviderName->Des().AppendNum( static_cast<TInt64>( i ) );
+                newProviderName->Des().Append( KClosedParenthesis() );
+                for ( TInt m = 0; m < count; m++ )
+                    {
+                    if ( profileEntries->At( m )->iProviderName.Compare( 
+                        newProviderName->Des() ) == 0 )
+                        {
+                        found = ETrue;
+                        }
+                    }
+                if ( !found )
+                    {
+                    isUnique = ETrue;
+                    }
+                }
+            }
+        }
+
+    // Change setting only if length is smaller than max length.
+    if ( newProviderName->Length() < KMaxProviderNameLength )
+        {
+        aEntry.iProviderName.Copy( newProviderName->Des() );
+        isValid = ETrue;
+        }
+
+    // Check and rename also duplicate settingsName.
+    HBufC* newSettingsName = HBufC::NewLC( KMaxSettingsNameLength * KTwo );
+    newSettingsName->Des().Copy( aEntry.iSettingsName );
+    isValid = EFalse;
+    for ( TInt n = 0; n < count; n++ )
+        {
+        const TDesC& existingName = profileEntries->At( n )->iSettingsName;
+        if ( existingName.Compare( aEntry.iSettingsName ) == 0 )
+            {
+            TBool isUnique( EFalse );
+
+            for ( TInt i = 1; !isUnique; i++ )
+                {
+                TBool found( EFalse );
+                newSettingsName->Des().Copy( aEntry.iSettingsName );
+                newSettingsName->Des().Append( KOpenParenthesis() );
+                newSettingsName->Des().AppendNum( static_cast<TInt64>( i ) );
+                newSettingsName->Des().Append( KClosedParenthesis() );
+                for ( TInt m = 0; m < count; m++ )
+                    {
+                    if ( profileEntries->At( m )->iSettingsName.Compare( 
+                        newSettingsName->Des() ) == 0 )
+                        {
+                        found = ETrue;
+                        } // if
+                    } // for
+                    
+                if ( !found )
+                    {
+                    isUnique = ETrue;
+                    }
+                } // for ( TInt m = 0; m < count; m++ )
+            } // if ( existingName.Compare( ...
+        } // for ( TInt n = 0; n < count; n++ )
+
+    // Change setting only if length is smaller than max length.
+    if ( newSettingsName->Length() < KMaxSettingsNameLength )
+        {
+        aEntry.iSettingsName.Copy( newSettingsName->Des() );
+        isValid = ETrue;
+        }
+
+    // newSettingsName, newProviderName, profileEntries, cRCSEProfile
+    CleanupStack::PopAndDestroy( 4, cRCSEProfile );
+    DBG_PRINT( "CWPVoIPItem::CheckDuplicatesL - end" );
+    return isValid;
+    }
+
+// ---------------------------------------------------------------------------
+// void CWPVoIPItem::SetTelephonyPreferenceL
+// For setting telephony preference.
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::SetTelephonyPreferenceL ( const TTelephonyPreference& 
+    aTelephonyPreference ) const
+    {
+    DBG_PRINT( "CWPVoIPItem::SetTelephonyPreferenceL - begin" );
+    // Central Repository for richcall settings
+    CRepository* rep = CRepository::NewLC( KCRUidRichCallSettings );
+    //lint -e{961} No need for else statement here
+    if ( EPSPreferred == aTelephonyPreference )
+        {
+        rep->Set( KRCSEPreferredTelephony, EPSPreferred );
+        }
+    else if ( ECSPreferred == aTelephonyPreference )
+        {
+        rep->Set( KRCSEPreferredTelephony, ECSPreferred );
+        }
+    
+    CleanupStack::PopAndDestroy( rep );
+    
+    DBG_PRINT( "CWPVoIPItem::SetTelephonyPreferenceL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// void CWPVoIPItem::AppRef
+// ---------------------------------------------------------------------------
+//
+HBufC8* CWPVoIPItem::AppRef()
+    {
+    DBG_PRINT( "CWPVoIPItem::AppRef()" );
+    return iAppRef;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::GetTerminalTypeL
+// Collect terminal type used in SIP User Agent Header.
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::GetTerminalTypeL(
+    TBuf<KMaxTerminalTypeLength>& aTerminalType ) const
+    {
+    DBG_PRINT( "CWPVoIPItem::GetTerminalTypeL - begin" );
+
+    aTerminalType.Zero(); // Reset before use
+
+    CIpAppPhoneUtils* phoneUtils = CIpAppPhoneUtils::NewLC();
+    phoneUtils->GetTerminalTypeL( aTerminalType ); // Gets phone model + type
+    CleanupStack::PopAndDestroy( phoneUtils );
+
+    DBG_PRINT( "CWPVoIPItem::GetTerminalTypeL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::GetWlanMacAddressL
+// Gets WLAN MAC address used in SIP User Agent Header (same as *#62209526#).
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::GetWlanMacAddressL( 
+    TBuf<KWlanMacAddressLength>& aMac ) const
+    {
+    DBG_PRINT( "CWPVoIPItem::GetWlanMacAddressL - begin" );
+
+    CIPAppUtilsAddressResolver* resolver = 
+        CIPAppUtilsAddressResolver::NewLC();
+
+    TBuf8<KWlanMacAddressLength> wlanmac;
+    _LIT8( KFormat, "-" );
+    resolver->GetWlanMACAddress( wlanmac, KFormat );
+    // wlanmac buffer contains now the wlan mac address like 00-15-a0-99-10-ec
+    CleanupStack::PopAndDestroy( resolver );
+    aMac.Copy( wlanmac );
+
+    DBG_PRINT( "CWPVoIPItem::GetWlanMacAddressL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::GetUserAgentHeaderL
+// Gets SIP User Agent Header.
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::GetUserAgentHeaderL( 
+    TBuf8<KUAHLength>& aUserAgentHeader ) const
+    {
+    DBG_PRINT( "CWPVoIPItem::GetUserAgentHeaderL - begin" );
+    // Create a CRCSEProfileEntry to get default values for User-Agent header
+    // parameters.
+    CRCSEProfileEntry* cRCSEProfileEntry = CRCSEProfileEntry::NewLC();
+
+    aUserAgentHeader.Zero(); // Reset before use
+    TBuf<KMaxTerminalTypeLength> tempTerminalType;
+    TBuf<KWlanMacAddressLength> tempWlanMac;
+    TBuf<KMaxSettingsLength32> tempFreeString;
+    tempFreeString = UAHString();
+
+    TInt uahTerminalType = iUAHTerminalType;
+    TInt uahWlanMac = iUAHWLANMAC;
+
+    if ( KNotSet == iUAHTerminalType )
+        {
+        uahTerminalType = cRCSEProfileEntry->iSIPVoIPUAHTerminalType;
+        }
+
+    if ( KNotSet == uahWlanMac )
+        {
+        uahWlanMac = cRCSEProfileEntry->iSIPVoIPUAHeaderWLANMAC;
+        }
+
+    if ( uahTerminalType || uahWlanMac || ( tempFreeString.Length() > 0 ) )
+        {
+        aUserAgentHeader.Append( KUserAgent );
+        aUserAgentHeader.Append( KColonMark );
+        aUserAgentHeader.Append( KSpaceMark );
+        }
+
+    if ( uahTerminalType )
+        {
+        GetTerminalTypeL( tempTerminalType );
+        aUserAgentHeader.Append( tempTerminalType );
+        aUserAgentHeader.Append( KSpaceMark );
+        }
+    if ( uahWlanMac )
+        {
+        GetWlanMacAddressL( tempWlanMac );
+        aUserAgentHeader.Append( tempWlanMac );
+        aUserAgentHeader.Append( KSpaceMark );
+        }
+    if ( tempFreeString.Length() > 0 )
+        {
+        aUserAgentHeader.Append( tempFreeString );
+        }
+    CleanupStack::PopAndDestroy( cRCSEProfileEntry );
+    DBG_PRINT( "CWPVoIPItem::GetUserAgentHeader - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::CleanupArrayItem
+// Cleans up an array.
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::CleanupArrayItem( TAny* aArray )
+    {
+    CArrayPtrFlat<CRCSEProfileEntry>* tempArray = 
+        static_cast<CArrayPtrFlat<CRCSEProfileEntry>*>( aArray );
+    if ( tempArray )
+        {
+        tempArray->ResetAndDestroy();
+        }
+    delete tempArray;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::AddDefaultCodecsL
+// Creates default codecs.
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::AddDefaultCodecsL( CRCSEProfileEntry& aProfileEntry )
+    {
+    DBG_PRINT( "CWPVoIPItem::AddDefaultCodecsL - start" );
+
+    CRCSEAudioCodecRegistry* audioCodecRegistry = 
+        CRCSEAudioCodecRegistry::NewLC();
+    CRCSEAudioCodecEntry* audioCodecEntry = CRCSEAudioCodecEntry::NewLC();
+
+    TUint32 codecId( KErrNone );
+
+    audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecAMRWB() );
+    codecId = audioCodecRegistry->AddL( *audioCodecEntry );
+    aProfileEntry.iPreferredCodecs.AppendL( codecId );
+
+    audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecAMR() );
+    codecId = audioCodecRegistry->AddL( *audioCodecEntry );
+    aProfileEntry.iPreferredCodecs.AppendL( codecId );
+
+    audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecPCMU() );
+    codecId = audioCodecRegistry->AddL( *audioCodecEntry );
+    aProfileEntry.iPreferredCodecs.AppendL( codecId );
+
+    audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecPCMA() );
+    codecId = audioCodecRegistry->AddL( *audioCodecEntry );
+    aProfileEntry.iPreferredCodecs.AppendL( codecId );
+
+    audioCodecEntry->SetDefaultCodecValueSet( KAudioCodeciLBC() );
+    codecId = audioCodecRegistry->AddL( *audioCodecEntry );
+    aProfileEntry.iPreferredCodecs.AppendL( codecId );
+
+    audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecG729() );
+    codecId = audioCodecRegistry->AddL( *audioCodecEntry );
+    aProfileEntry.iPreferredCodecs.AppendL( codecId );
+
+    audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecCN() );
+    codecId = audioCodecRegistry->AddL( *audioCodecEntry );
+    aProfileEntry.iPreferredCodecs.AppendL( codecId );
+
+    // audioCodecEntry, audioCodecRegistry
+    CleanupStack::PopAndDestroy( 2, audioCodecRegistry );
+
+    DBG_PRINT( "CWPVoIPItem::AddDefaultCodecsL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::ItemId
+// ---------------------------------------------------------------------------
+//
+TUint32 CWPVoIPItem::ItemId()
+    {
+    return iItemId;
+    }
+
+// ---------------------------------------------------------------------------
+// CWPVoIPItem::EnableIm
+// ---------------------------------------------------------------------------
+//
+void CWPVoIPItem::EnableIm()
+    {
+    iImEnabled = ETrue;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/src/WPVoIPAdapterGroupProxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "WPVoIPAdapterUIDs.h" // KPROVISIONINGVOIPADAPTERUID
+#include "CWPVoIPAdapter.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// CONSTANTS
+const TImplementationProxy KImplementationTable[] = 
+{
+	//lint -e{611,1924} Warning "Suspicious cast" can not be avoided.
+	IMPLEMENTATION_PROXY_ENTRY( 
+        KPROVISIONINGVOIPADAPTERUID, CWPVoIPAdapter::NewL )
+
+};
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy
+// Returns: TImplementationProxy*: pointer to TImplementationProxy
+// ---------------------------------------------------------------------------
+
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
+    TInt& aTableCount )
+{
+    aTableCount = sizeof( KImplementationTable ) / 
+        sizeof( TImplementationProxy );
+    return KImplementationTable;
+}
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/cpvoipadapter/src/WPVoIPAdapterMain.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2002-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:  DLL entry point
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32std.h>
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmgenvoipsettings/group/NSmlDmGeneralVoIPSettingsAdapter.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* 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 Management General VoIP settings adapter
+*
+*/
+
+
+#include "defaultcaps.hrh"
+#include  <platform_paths.hrh>
+
+CAPABILITY              CAP_ECOM_PLUGIN
+TARGET                  nsmldmgeneralvoipsettingsadapter.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x10275414
+VENDORID                VID_DEFAULT
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+SOURCEPATH      ../src
+USERINCLUDE     ../inc
+
+SOURCE                  NSmlDmGeneralVoIPSettingsAdapter.cpp
+
+START RESOURCE          NSmlDmGeneralVoIPSettingsAdapter.rss
+END
+
+LIBRARY                 euser.lib
+LIBRARY                 ecom.lib
+LIBRARY                 nsmldebug.lib
+LIBRARY                 charconv.lib
+LIBRARY                 centralrepository.lib
+LIBRARY                 sysutil.lib
+LIBRARY                 rcse.lib
+LIBRARY                 featmgr.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmgenvoipsettings/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info file for Device Management General VoIP Settings
+                 Adapter
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/dmgeneralvoipsettingsadapter.iby CORE_APP_LAYER_IBY_EXPORT_PATH( dmgeneralvoipsettingsadapter.iby )
+
+PRJ_MMPFILES
+./NSmlDmGeneralVoIPSettingsAdapter.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmgenvoipsettings/inc/NSmlDmGeneralVoIPSettingsAdapter.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,498 @@
+/*
+* 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 Management General VoIP settings adapter
+*
+*/
+
+
+#ifndef __NSMLDMGENERALVOIPSETTINGSADAPTER_H__
+#define __NSMLDMGENERALVOIPSETTINGSADAPTER_H__
+
+#include <smldmadapter.h>
+
+/**
+ *  Cleanup item for deleting contents of RPointerArray.
+ *
+ */
+template <class T>
+class CleanupResetAndDestroy
+	{
+public:
+	
+	inline static void PushL(T& aRef);
+	
+private:
+	
+	static void ResetAndDestroy(TAny *aPtr);
+	};
+	
+template <class T>
+inline void CleanupResetAndDestroyL(T& aRef);
+
+/**
+ *  Entry point for general VoIP settings.
+ *
+ *  Holds general VoIP settings transiently before they are stored permanently
+ *  in Central Repository.
+ *  @since S60 v3.0
+ */
+class TGenVoIPEntry
+    {
+
+    public:
+
+        /**
+         * Status reference for this command.
+         */
+        TInt iStatusRef;
+
+        /**
+         * For telling whether general VoIP settings are loaded from
+         * Central Repository.
+         */
+        TInt iAreSettingsLoaded;
+
+        /**
+         * CLIR, Calling Line Identification Restriction.
+         */
+        TInt iClir;
+
+        /**
+         * Anonymous Call Block rule. Determines the rule for Anonymous Call
+         * Block feature.
+         */
+        TInt iACBRule;
+
+        /**
+         * Preferred telephony. Tells which telephony mode is preferred.
+         */
+        TInt iPrefTel;
+
+        /**
+         * Do Not Disturb (DND) setting.
+         */
+        TInt iDnd;
+
+        /**
+         * Call waiting. Tells whether call waiting is enabled or disabled.
+         */
+        TInt iPSCallWaiting;
+
+        /**
+         * Telephony preference lock. Tells whether preferred telephony mode 
+         * is UI editable.
+         */
+        TInt iPrefTelLock;
+
+        /**
+         * Shut down CS radio in WiFi mode. Tells whether CS radio is turned
+         * off in WiFi mode.
+         */
+        TInt iCsRadioWifiOff;
+        
+        /**
+         * VoIP profile name. If preferred telephony mode is set to VoIP,
+         * the service id of this VoIP profile is set as preferred service id.
+         */
+        TBuf8<64> iVoipProfileId;
+    };
+
+/**
+ *  CNSmlDmGeneralVoIPSettingsAdapter.
+ *
+ *  Main implementation of Device Management General VoIP Settings Adapter.
+ *  @lib cnsmldmgeneralvoipsettingsadapter.lib
+ *  @since S60 v3.0
+ */
+class CNSmlDmGeneralVoIPSettingsAdapter : public CSmlDmAdapter
+    {
+
+#ifdef EUNIT_TESTING
+    /**
+     * Friend class for unit testing.
+     */
+    friend class UT_CNSmlDmGeneralVoIPSettingsAdapter;
+#endif
+
+    public:
+        
+        static CNSmlDmGeneralVoIPSettingsAdapter* NewL( MSmlDmCallback* aDmCallback );
+
+        static CNSmlDmGeneralVoIPSettingsAdapter* NewLC( MSmlDmCallback* aDmCallback );
+
+        virtual ~CNSmlDmGeneralVoIPSettingsAdapter();
+
+    private:
+
+        CNSmlDmGeneralVoIPSettingsAdapter( TAny* aEcomArguments );
+
+        /**
+         * By default Symbian 2nd phase constructor is private.
+         */
+        void ConstructL();
+        
+        /**
+         * Fetches leaf object values
+         *
+         * @since S60 v3.0.
+         * @param aURI URI of the object.
+         * @param aLUID LUID of the object.
+         * @param aObject Data of the object.
+         * @return Status code of operation
+         */       
+        CSmlDmAdapter::TError FetchObjectL( 
+            const TDesC8& aURI, 
+            CBufBase& aObject );
+
+        /**
+         * Loads general VoIP settings from Central Repository.
+         *
+         * @since S60 v3.0.
+         * @param aEntry General VoIP settings entry.
+         * @return Error code for the operation.
+         */
+        TInt LoadSettingsL();
+
+        /**
+         * Converts descriptor to int.
+         *
+         * @since S60 v3.0.
+         * @param aDes Descriptor to convert.
+         * @return Converted value.
+         */
+        TInt DesToInt( const TDesC8& aDes );
+
+        /**
+         * Removes last URI segment from aURI
+         *
+         * @since S60 v3.0.
+         * @param aDes Descriptor to handle.
+         * @return Pointer to URI.
+         */        
+        TPtrC8 RemoveLastURISeg( const TDesC8& aURI );
+
+        /**
+         * Gets number of URI segments.
+         *
+         * @since S60 v3.0.
+         * @param aURI Descriptor to handle.
+         * @return Number of URI segments.
+         */
+        TInt NumOfURISegs( const TDesC8& aURI );
+
+        /**
+         * Gets last URI segment.
+         *
+         * @since S60 v3.0.
+         * @param aURI Descriptor to handle.
+         * @return Pointer to beginning of last URI segment.
+         */
+        TPtrC8 LastURISeg( const TDesC8& aURI ) const;
+
+        /**
+         * Removes ./ from URI
+         *
+         * @since S60 v3.0.
+         * @param aURI Descriptor to handle.
+         * @return Pointer to URI.
+         */
+        TPtrC8 RemoveDotSlash( const TDesC8& aURI );
+
+        // from base class MSmlDmAdapter
+
+        /**
+         * From MSmlDmAdapter.
+         *
+         * @since S60 v3.0.
+         * @param aDDFVersion for returning DDF version of adapter.
+         */
+        void DDFVersionL( CBufBase& aDDFVersion );
+
+        /**
+         * From MSmlDmAdapter.
+         *
+         * @since S60 v3.0.
+         * @param aDDF for returning DDF structure of adapter.
+         */
+        void DDFStructureL( MSmlDmDDFObject& aDDF );
+   
+        /**
+         * From MSmlDmAdapter.
+         *
+         * @since S60 v3.0.
+         * @param aURI URI of the object.
+         * @param aLUID LUID of the object.
+         * @param aObject Data of the object.
+         * @param aType MIME type of the object.
+         * @param aStatusRef Reference to correct command.
+         */                                                     
+        void UpdateLeafObjectL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const TDesC8& aObject,
+            const TDesC8& aType, 
+            const TInt aStatusRef );
+    
+        /**
+         * From MSmlDmAdapter.
+         * Not supported.
+         *
+         * @param aURI URI of the object.
+         * @param aLUID LUID of the object.
+         * @param aStream Data of the object.
+         * @param aType MIME type of the object.
+         * @param aStatusRef Reference to correct command.
+         */
+        void UpdateLeafObjectL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            RWriteStream*& aStream,
+            const TDesC8& aType, 
+            TInt aStatusRef );
+
+        /**
+         * From MSmlDmAdapter.
+         * Deletes (resets) General VoIP Settings profile.
+         *
+         * @since S60 v3.0.
+         * @param aURI URI of the object.
+         * @param aLUID LUID of the object.
+         * @param aStatusRef Reference to correct command.
+         */        
+        void DeleteObjectL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const TInt aStatusRef );
+    
+        /**
+         * From MSmlDmAdapter.
+         * Fetches the values of leaf objects.
+         *
+         * @since S60 v3.0.
+         * @param aURI URI of the object.
+         * @param aLUID LUID of the object.
+         * @param aType MIME type of the object.
+         * @param aResultsRef Reference to correct results.
+         * @param aStatusRef Reference to correct command.
+         */                      
+        void FetchLeafObjectL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const TDesC8& aType, 
+            const TInt aResultsRef, 
+            const TInt aStatusRef );
+    
+        /**
+         * From MSmlDmAdapter.
+         * Fetches the size of a leaf object.
+         *
+         * @since S60 v3.0.
+         * @param aURI URI of the object.
+         * @param aLUID LUID of the object.
+         * @param aType MIME type of the object.
+         * @param aResultsRef Reference to correct results.
+         * @param aStatusRef Reference to correct command.
+         */                      
+        void FetchLeafObjectSizeL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const TDesC8& aType, 
+            TInt aResultsRef, 
+            TInt aStatusRef );
+
+        /**
+         * From MSmlDmAdapter.
+         * Asks for the list of child objects of the node.
+         *
+         * @since S60 v3.0.
+         * @param aURI URI from DM module.
+         * @param aLUID LUID of the parent object.
+         * @param aPreviousURISegmentList from DM module.
+         * @param aResultsRef results reference from DM module.
+         * @param aStatusRef Reference to correct command.
+         */
+        void ChildURIListL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
+            const TInt aResultsRef, 
+            const TInt aStatusRef );
+    
+        /**
+         * From MSmlDmAdapter.
+         * Not supported (there can only be one general VoIP settings node).
+         *
+         * @since S60 v3.0.
+         * @param aURI URI of the object.
+         * @param aParentLUID LUID of the parent object.
+         * @param aStatusRef Reference to correct command.
+         */        
+        void AddNodeObjectL( 
+            const TDesC8& aURI, 
+            const TDesC8& aParentLUID, 
+            const TInt aStatusRef );
+    
+        /**
+         * From MSmlDmAdapter.
+         * Not supported.
+         *
+         * @since S60 v3.0.
+         * @param aURI URI from DM module.
+         * @param aLUID LUID of the object.
+         * @param aArgument Argument for the command.
+         * @param aType MIME type of the object.
+         * @param aStatusRef Reference to correct command.
+         */
+        void ExecuteCommandL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const TDesC8& aArgument, 
+            const TDesC8& aType, 
+            const TInt aStatusRef );
+    
+        /**
+         * From MSmlDmAdapter.
+         * Not supported.
+         *
+         * @since S60 v3.0.
+         * @param aURI URI from DM module.
+         * @param aLUID LUID of the object.
+         * @param aStream Argument for the command.
+         * @param aType MIME type of the object.
+         * @param aStatusRef Reference to correct command.
+         */
+        void ExecuteCommandL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            RWriteStream*& aStream, 
+            const TDesC8& aType, 
+            const TInt aStatusRef );
+    
+        /**
+         * From MSmlDmAdapter.
+         * Not supported.
+         *
+         * @since S60 v3.0.
+         * @param aTargetURI Target URI for the command.
+         * @param aTargetLUID LUID of the target object.
+         * @param aSourceURI Source URI for the command.
+         * @param aSourceLUID LUID of the source object.
+         * @param aType MIME type of the objects.
+         * @param aStatusRef Reference to correct command.
+         */
+        void CopyCommandL( 
+            const TDesC8& aTargetURI, 
+            const TDesC8& aTargetLUID, 
+            const TDesC8& aSourceURI, 
+            const TDesC8& aSourceLUID, 
+            const TDesC8& aType, 
+            TInt aStatusRef );
+    
+        /**
+         * From MSmlDmAdapter.
+         * Not supported.
+         *
+         * @since S60 v3.0.
+         */     
+        void StartAtomicL();
+
+        /**
+         * From MSmlDmAdapter.
+         * Not supported.
+         *
+         * @since S60 v3.0.
+         */
+        void CommitAtomicL();
+
+        /**
+         * From MSmlDmAdapter.
+         * Not supported.
+         *
+         * @since S60 v3.0.
+         */
+        void RollbackAtomicL();
+
+        /**
+         * From MSmlDmAdapter.
+         * Not supported.
+         *
+         * @since S60 v3.0.
+         * @param aItemSize Size limit for stream usage.
+         * @return Streaming support.
+         */
+        TBool StreamingSupport( TInt& aItemSize );
+
+        /**
+         * From MSmlDmAdapter.
+         * Not supported.
+         *
+         * @since S60 v3.0.
+         */
+        void StreamCommittedL();
+
+        /**
+         * From MSmlDmAdapter.
+         * Saves modified profiles back to permanent store.
+         *
+         * @since S60 v3.0.
+         */
+        void CompleteOutstandingCmdsL();
+
+        /**
+         * Gets VoIP profile id.
+         *
+         * @since S60 v3.2.3.
+         * @param aObject URI of the object to fetch.
+         */
+        TUint32 VoIPProfileIdL( const TDesC8& aObject ) const;
+
+        /**
+         * Resolves the name of the preferred service and saves it to an
+         * internal variable.
+         *
+         * @since S60 v3.2.3.
+         * @param aRepository Reference to a previously opened repository.
+         */
+        TInt ResolvePreferredServiceNameL( CRepository& aRepository );
+
+    private: // data
+
+        /**
+         * For returning data to DM module.
+         */
+        MSmlDmCallback* iDmCallback;
+
+        /**
+         * Profile ID currently being modified.
+         */
+        TInt iProfileID;
+
+        /**
+         * For knowing status of DM module.
+         */
+        TInt iStatus;
+
+        /**
+         * Entry point for general VoIP settings.
+         */
+        TGenVoIPEntry iEntry;
+
+        /**
+         * For returning results to DM module.
+         */
+        CBufBase* iResults;
+
+    };
+
+#endif // __NSMLDMGENERALVOIPSETTINGSADAPTER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmgenvoipsettings/rom/dmgeneralvoipsettingsadapter.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* 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:  Device Management General VoIP Settings Adapter iby file
+*
+*/
+
+#ifndef __DMNGENERALVOIPSETTINGSADAPTER_IBY__
+#define __DMNGENERALVOIPSETTINGSADAPTER_IBY__
+
+ECOM_PLUGIN(NSmlDmGeneralVoIPSettingsAdapter.dll, NSmlDmGeneralVoIPSettingsAdapter.rsc)
+
+#endif // __DMNGENERALVOIPSETTINGSADAPTER_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmgenvoipsettings/src/NSmlDmGeneralVoIPSettingsAdapter.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1102 @@
+/*
+* 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 Management General VoIP Settings Adapter
+*
+*/
+
+
+#include <utf.h>
+#include <implementationproxy.h> // For TImplementationProxy definition
+#include <sysutil.h>
+#include <e32property.h>
+#include <centralrepository.h>
+#include <crcseprofileentry.h>
+#include <crcseprofileregistry.h>
+#include <settingsinternalcrkeys.h>
+#include <featmgr.h>
+
+#include "NSmlDmGeneralVoIPSettingsAdapter.h"
+#include "nsmlconstants.h"
+#include "nsmldmconstants.h"
+#include "nsmldmconst.h"
+
+const TUint KNSmlDMGenVoIPAdapterImplUid = 0x10275413;
+const TInt  KNSmlGenVoIPMaxResultLength  = 256;
+const TInt  KNSmlGenVoIPMaxUriLength     = 100;
+const TInt  KDefaultResultSize           = 64;
+const TInt  KTwoSegs                     = 2;
+const TInt  KMaxUriLength                = 64;
+
+// Reference: OMA_Device_Management_DDF_for_General_VoIP_Settings
+_LIT8( KNSmlDMGenVoIPDDFVersion,            "0.1" );
+_LIT8( KNSmlDMGenVoIPNodeName,              "GenVoIP" );
+_LIT8( KNSmlDMVoIPNodeName,                 "VoIP" );
+_LIT8( KNSmlDMGenVoIPClir,                  "Clir" );
+_LIT8( KNSmlDMGenVoIPAnonCallBlockRule,     "AnonCallBlockRule" );
+_LIT8( KNSmlDMGenVoIPPreferredTelephony,    "PrefTelephony" );
+_LIT8( KNSmlDMGenVoIPDoNotDisturb,          "DoNotDisturb" );
+_LIT8( KNSmlDMGenVoIPPSCallWaiting,         "PSCallWaiting" );
+_LIT8( KNSmlDMGenVoIPProfileId,             "VoIPProfileId" );
+
+_LIT8( KNSmlDMGenVoIPNodeNameExp,           "Main node for General VoIP settings" );
+_LIT8( KNSmlDMGenVoIPClirExp,               "Calling Line Identification Restriction" );
+_LIT8( KNSmlDMGenVoIPPSCallWaitingExp,      "PS call waiting" );
+_LIT8( KNSmlDMGenVoIPAnonCallBlockRuleExp,  "Anonymous call blocking rule" );
+_LIT8( KNSmlDMGenVoIPPreferredTelephonyExp, "Preferred telephony" );
+_LIT8( KNSmlDMGenVoIPDoNotDisturbExp,       "Do not disturb" );
+_LIT8( KNSmlDMGenVoIPProfileIdExp,          "VoIP node id for linking" );
+
+// Other
+_LIT8( KNSmlDMGenVoIPTextPlain,             "text/plain" );
+_LIT8( KNSmlDMGenVoIPSeparator,             "/" );
+_LIT8( KNSmlDMGenVoIPUriDotSlash,           "./");
+_LIT8( KVoipId,                             "VoIPId" );
+
+//MACROS 
+#define KNSMLDMURISEPARATORDEF '/'
+
+// Following lines are for enabling debug prints.
+#ifdef _DEBUG
+#define _DBG_FILE(p) RDebug::Print(_L(p))
+#define _DBG_FILE2(p,a) RDebug::Print(_L(p),a)
+#else
+#define _DBG_FILE(p)
+#define _DBG_FILE2(p,a)
+#endif // _DEBUG
+
+// ======== LOCAL FUNCTIONS ========
+
+template <class T>
+inline void CleanupResetAndDestroy<T>::PushL(T& aRef)
+	{CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef));}
+
+template <class T>
+void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr)
+	{(STATIC_CAST(T*,aPtr))->ResetAndDestroy();}
+
+template <class T>
+inline void CleanupResetAndDestroyL(T& aRef)
+	{CleanupResetAndDestroy<T>::PushL(aRef);}
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::ConstructL()
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::ConstructL(): begin" );
+    // Check VoIP support from feature manager
+    FeatureManager::InitializeLibL();
+    TBool support = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
+    FeatureManager::UnInitializeLib();
+
+    if( !support )
+        {
+        _DBG_FILE( 
+            "CNSmlDmGeneralVoIPSettingsAdapter::ConstructL(): no support" );
+        User::Leave( KErrNotSupported );
+        }
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::ConstructL(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter* CNSmlDmGeneralVoIPSettingsAdapter::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CNSmlDmGeneralVoIPSettingsAdapter* CNSmlDmGeneralVoIPSettingsAdapter::NewL( 
+    MSmlDmCallback* aDmCallback )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::NewL(): begin" );
+    CNSmlDmGeneralVoIPSettingsAdapter* self = NewLC( aDmCallback );
+    CleanupStack::Pop( self );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::NewL(): end" );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter* CNSmlDmGeneralVoIPSettingsAdapter::NewLC
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CNSmlDmGeneralVoIPSettingsAdapter* CNSmlDmGeneralVoIPSettingsAdapter::NewLC( 
+    MSmlDmCallback* aDmCallback )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::NewLC(): begin" );
+    CNSmlDmGeneralVoIPSettingsAdapter* self = 
+        new ( ELeave ) CNSmlDmGeneralVoIPSettingsAdapter( aDmCallback );
+    CleanupStack::PushL( self );
+
+    self->ConstructL();
+    self->iDmCallback = aDmCallback;
+    
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::NewLC(): end" );
+    return self;
+    }
+    
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::~CNSmlDmGeneralVoIPSettingsAdapter()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CNSmlDmGeneralVoIPSettingsAdapter::~CNSmlDmGeneralVoIPSettingsAdapter()
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::~CNSmlDmGeneralVoIPSettingsAdapter(): begin" );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::~CNSmlDmGeneralVoIPSettingsAdapter(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::CNSmlDmGeneralVoIPSettingsAdapter
+// ---------------------------------------------------------------------------
+//
+CNSmlDmGeneralVoIPSettingsAdapter::CNSmlDmGeneralVoIPSettingsAdapter(
+    TAny* aEcomArguments ):CSmlDmAdapter( aEcomArguments )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::CNSmlDmGeneralVoIPSettingsAdapter( aEcomArguments ): begin" );
+    iEntry.iAreSettingsLoaded = EFalse;
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::CNSmlDmGeneralVoIPSettingsAdapter( aEcomArguments ): end" ); 
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::FetchObjectL
+// Fetches the values of leaf objects.
+// ---------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CNSmlDmGeneralVoIPSettingsAdapter::FetchObjectL( 
+    const TDesC8& aURI, 
+    CBufBase& aResult )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::FetchObjectL(): begin" );
+    CSmlDmAdapter::TError status = CSmlDmAdapter::EError;
+    TBuf8< KNSmlGenVoIPMaxResultLength > segmentResult;
+    TPtrC8 lastURISeg = LastURISeg( aURI );
+    TPtrC8 uriTmp = RemoveLastURISeg( aURI );
+    TPtrC8 secondLastURISeg = LastURISeg( uriTmp );
+
+    if ( !( iEntry.iAreSettingsLoaded ) )
+        {
+        TInt err = LoadSettingsL();
+        if ( KErrNone != err )
+            {
+            return status;
+            }
+        }
+
+    if ( 0 == secondLastURISeg.Compare( KNSmlDMGenVoIPNodeName() )
+        && KTwoSegs == NumOfURISegs( aURI ) )
+        {
+        status = CSmlDmAdapter::EOk;
+        // Clir
+        if ( KNSmlDMGenVoIPClir() == lastURISeg )
+            {
+            segmentResult.Num( iEntry.iClir );
+            }
+        // AnonCallBlockRule
+        else if ( KNSmlDMGenVoIPAnonCallBlockRule() == lastURISeg )
+            {
+            segmentResult.Num( iEntry.iACBRule );
+            }
+        // PreferredTelephony
+        else if ( KNSmlDMGenVoIPPreferredTelephony() == lastURISeg )
+            {
+            segmentResult.Num( iEntry.iPrefTel );
+            }
+        // DoNotDisturb
+        else if ( KNSmlDMGenVoIPDoNotDisturb() == lastURISeg )
+            {
+            segmentResult.Num( iEntry.iDnd );
+            }
+        // PSCallWaiting
+        else if ( KNSmlDMGenVoIPPSCallWaiting() == lastURISeg )
+            {
+            segmentResult.Num( iEntry.iPSCallWaiting );
+            }
+        // ProfileName
+        else if ( KNSmlDMGenVoIPProfileId() == lastURISeg )
+            {
+            segmentResult.Copy( iEntry.iVoipProfileId );
+            }
+        else
+            {
+            status = CSmlDmAdapter::ENotFound;
+            }
+        }
+    else
+        {
+        status = CSmlDmAdapter::ENotFound;
+        }
+
+    if ( CSmlDmAdapter::EOk == status )    
+        {
+        aResult.InsertL( aResult.Size(), segmentResult );
+        }
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::FetchObjectL(): end" );
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::LoadSettingsL
+// Loads general VoIP settings from Central Repository.
+// ---------------------------------------------------------------------------
+//
+TInt CNSmlDmGeneralVoIPSettingsAdapter::LoadSettingsL()
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSEttingsAdapter::LoadSettingsL(): begin" );
+    CRepository* cRepository = CRepository::NewLC( KCRUidRichCallSettings );
+    
+    TInt err( KErrNone );
+    err = cRepository->Get( KRCSEClir, iEntry.iClir );
+    if ( KErrNone == err )
+        {
+        err = cRepository->Get( KRCSEAnonymousCallBlockRule,
+            iEntry.iACBRule );
+        }
+    if ( KErrNone == err )
+        {
+        err = cRepository->Get( KRCSEPreferredTelephony, iEntry.iPrefTel );
+        }
+    if ( KErrNone == err )
+        {
+        err = cRepository->Get( KRCSEDoNotDisturb, iEntry.iDnd );
+        }
+    if ( KErrNone == err )
+        {
+        err = cRepository->Get( KRCSPSCallWaiting, iEntry.iPSCallWaiting );
+        }
+    if ( KErrNone == err )
+        {
+        err = ResolvePreferredServiceNameL( *cRepository );
+        }
+    if ( KErrNone == err )
+        {
+        iEntry.iAreSettingsLoaded = ETrue;
+        }
+    CleanupStack::PopAndDestroy( cRepository );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSEttingsAdapter::LoadSettingsL(): end" );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::DesToInt
+// Converts a 8 bit descriptor to int.
+// ---------------------------------------------------------------------------
+//
+TInt CNSmlDmGeneralVoIPSettingsAdapter::DesToInt( 
+    const TDesC8& aDes )
+    {
+    TLex8 lex( aDes );
+    TInt value( 0 );
+    lex.Val( value );
+    return value;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::RemoveLastURISeg
+// returns parent uri, i.e. removes last uri segment
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CNSmlDmGeneralVoIPSettingsAdapter::RemoveLastURISeg( 
+    const TDesC8& aURI )
+    {
+    TInt counter( 0 );
+    
+    // Check that aURI exists
+    if ( 0 < aURI.Length() )
+        {
+        for ( counter = aURI.Length() - 1; counter >= 0; counter-- )
+            {
+            if ( KNSMLDMURISEPARATORDEF == aURI[ counter ] )
+                {
+                break;
+                }
+            }
+        }
+    return aURI.Left( counter );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::NumOfURISegs
+// For getting the number of uri segs
+// ---------------------------------------------------------------------------
+//
+TInt CNSmlDmGeneralVoIPSettingsAdapter::NumOfURISegs( 
+    const TDesC8& aURI )
+    {
+    TInt numOfURISegs( 1 );
+    for ( TInt counter = 0; counter < aURI.Length(); counter++ )
+        {
+        if ( KNSMLDMURISEPARATORDEF == aURI[ counter ] )
+            {
+            numOfURISegs++;
+            }
+        }
+    return numOfURISegs;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::LastURISeg
+// Returns only the last uri segment
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CNSmlDmGeneralVoIPSettingsAdapter::LastURISeg( 
+    const TDesC8& aURI ) const
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::LastURISeg() : begin" );
+    TInt counter( 0 );
+    
+    // Check that aURI exists
+    if ( 0 < aURI.Length() )
+        {
+        for ( counter = aURI.Length() - 1; counter >= 0; counter-- )
+            {
+            if ( KNSMLDMURISEPARATORDEF == aURI[ counter ] )
+                {
+                break;
+                }
+            }
+        }
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::LastURISeg() : end" );
+    if ( 0 == counter  )
+        {
+        return aURI;
+        }
+    else
+        {
+        return aURI.Mid( counter + 1 );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::RemoveDotSlash
+// return uri without dot and slash in start
+// ---------------------------------------------------------------------------
+//
+TPtrC8 CNSmlDmGeneralVoIPSettingsAdapter::RemoveDotSlash( 
+    const TDesC8& aURI )
+    {
+    if ( 0 == aURI.Find( KNSmlDMGenVoIPUriDotSlash ) )
+        {
+        return aURI.Right( 
+            aURI.Length() - KNSmlDMGenVoIPUriDotSlash().Length() );
+        }
+    else
+        {
+        return aURI;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::DDFVersionL
+// From base class CNSmlDmAdapter.
+// Inserts DDF version of the adapter to aDDFVersion
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::DDFVersionL(
+    CBufBase& aDDFVersion )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::DDFVersionL( TDes& aDDFVersion): begin" );
+    aDDFVersion.InsertL( 0, KNSmlDMGenVoIPDDFVersion );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::DDFVersionL( TDes& aDDFVersion): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::DDFStructureL
+// From base class CNSmlDmAdapter.
+// Builds the DDF structure of adapter
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
+    {
+    _DBG_FILE("CNSmlDmGeneralVoIPSettingsAdapter::DDFStructureL(): begin");
+
+    TSmlDmAccessTypes accessTypesGet;
+    accessTypesGet.SetGet();
+
+    TSmlDmAccessTypes accessTypesGetAdd;
+    accessTypesGetAdd.SetGet();
+    accessTypesGetAdd.SetAdd();
+
+    TSmlDmAccessTypes accessTypesGetReplaceAdd;
+    accessTypesGetReplaceAdd.SetGet();
+    accessTypesGetReplaceAdd.SetReplace();
+    accessTypesGetReplaceAdd.SetAdd();
+
+    TSmlDmAccessTypes accessTypesAll;
+    accessTypesAll.SetGet();
+    accessTypesAll.SetDelete();
+    accessTypesAll.SetAdd();
+    accessTypesAll.SetReplace();
+
+    // GenVoIP
+    MSmlDmDDFObject& genVoIP = aDDF.AddChildObjectL( KNSmlDMGenVoIPNodeName );
+    genVoIP.SetAccessTypesL( accessTypesGet );
+    genVoIP.SetOccurenceL( MSmlDmDDFObject::EOne );
+    genVoIP.SetScopeL( MSmlDmDDFObject::EPermanent );
+    genVoIP.SetDFFormatL( MSmlDmDDFObject::ENode );
+    genVoIP.AddDFTypeMimeTypeL( KNSmlDMGenVoIPTextPlain );
+    genVoIP.SetDescriptionL( KNSmlDMGenVoIPNodeNameExp );
+
+    // Clir
+    MSmlDmDDFObject& clir = genVoIP.AddChildObjectL( KNSmlDMGenVoIPClir );
+    clir.SetAccessTypesL( accessTypesGetReplaceAdd );
+    clir.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    clir.SetScopeL( MSmlDmDDFObject::EDynamic );
+    clir.SetDFFormatL( MSmlDmDDFObject::EInt );
+    clir.AddDFTypeMimeTypeL( KNSmlDMGenVoIPTextPlain );
+    clir.SetDescriptionL( KNSmlDMGenVoIPClirExp );
+
+    // AnonCallBlockRule
+    MSmlDmDDFObject& acbRule = genVoIP.AddChildObjectL( 
+        KNSmlDMGenVoIPAnonCallBlockRule );
+    acbRule.SetAccessTypesL( accessTypesGetReplaceAdd );
+    acbRule.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    acbRule.SetScopeL( MSmlDmDDFObject::EDynamic );
+    acbRule.SetDFFormatL( MSmlDmDDFObject::EInt );
+    acbRule.AddDFTypeMimeTypeL( KNSmlDMGenVoIPTextPlain );
+    acbRule.SetDescriptionL( KNSmlDMGenVoIPAnonCallBlockRuleExp );
+
+    // PreferredTelephony
+    MSmlDmDDFObject& prefTel = genVoIP.AddChildObjectL( 
+        KNSmlDMGenVoIPPreferredTelephony );
+    prefTel.SetAccessTypesL( accessTypesGetReplaceAdd );
+    prefTel.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    prefTel.SetScopeL( MSmlDmDDFObject::EDynamic );
+    prefTel.SetDFFormatL( MSmlDmDDFObject::EInt );
+    prefTel.AddDFTypeMimeTypeL( KNSmlDMGenVoIPTextPlain );
+    prefTel.SetDescriptionL( KNSmlDMGenVoIPPreferredTelephonyExp );
+
+    // DoNotDisturb
+    MSmlDmDDFObject& dnd = genVoIP.AddChildObjectL( 
+        KNSmlDMGenVoIPDoNotDisturb );
+    dnd.SetAccessTypesL( accessTypesGetReplaceAdd );
+    dnd.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    dnd.SetScopeL( MSmlDmDDFObject::EDynamic );
+    dnd.SetDFFormatL( MSmlDmDDFObject::EInt );
+    dnd.AddDFTypeMimeTypeL( KNSmlDMGenVoIPTextPlain );
+    dnd.SetDescriptionL( KNSmlDMGenVoIPDoNotDisturbExp );
+
+    // PSCallWaiting
+    MSmlDmDDFObject& psCallWaiting = genVoIP.AddChildObjectL( 
+        KNSmlDMGenVoIPPSCallWaiting );
+    psCallWaiting.SetAccessTypesL( accessTypesGetReplaceAdd );
+    psCallWaiting.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    psCallWaiting.SetScopeL( MSmlDmDDFObject::EDynamic );
+    psCallWaiting.SetDFFormatL( MSmlDmDDFObject::EInt );
+    psCallWaiting.AddDFTypeMimeTypeL( KNSmlDMGenVoIPTextPlain );
+    psCallWaiting.SetDescriptionL( KNSmlDMGenVoIPPSCallWaitingExp );
+
+    // ProfileName
+    MSmlDmDDFObject& voipProfileId = genVoIP.AddChildObjectL(
+        KNSmlDMGenVoIPProfileId );
+    voipProfileId.SetAccessTypesL( accessTypesGetReplaceAdd );
+    voipProfileId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    voipProfileId.SetScopeL( MSmlDmDDFObject::EDynamic );
+    voipProfileId.SetDFFormatL( MSmlDmDDFObject::EChr );
+    voipProfileId.AddDFTypeMimeTypeL( KNSmlDMGenVoIPTextPlain );
+    voipProfileId.SetDescriptionL( KNSmlDMGenVoIPProfileIdExp );
+
+    _DBG_FILE("CNSmlDmGeneralVoIPSettingsAdapter::DDFStructureL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::UpdateLeafObjectL
+// From base class CNSmlDmAdapter.
+// Updates value of a leaf object
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::UpdateLeafObjectL( 
+    const TDesC8& aURI, 
+    const TDesC8& /*aLUID*/, 
+    const TDesC8& aObject, 
+    const TDesC8& /*aType*/, 
+    const TInt aStatusRef )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::UpdateLeafObjectL(): begin" );
+
+    CSmlDmAdapter::TError status = EError;
+
+    TPtrC8 lastURISeg = LastURISeg( aURI );
+    TPtrC8 uriTmp = RemoveLastURISeg( aURI );
+    TPtrC8 secondLastURISeg = LastURISeg( uriTmp );
+
+    // Make sure iEntry holds values.
+    if ( !( iEntry.iAreSettingsLoaded ) )
+        {
+        TInt err = LoadSettingsL();
+        if ( KErrNone != err )
+            {
+            status = CSmlDmAdapter::EError;
+            iDmCallback->SetStatusL( aStatusRef, status );
+            return;
+            }
+        }
+
+    if( 0 == secondLastURISeg.Compare( KNSmlDMGenVoIPNodeName() )
+        && KTwoSegs == NumOfURISegs( aURI ) )
+        {
+        status = CSmlDmAdapter::EOk;
+        iEntry.iStatusRef = aStatusRef;
+
+        // Clir
+        if ( KNSmlDMGenVoIPClir() == lastURISeg )
+            {
+            iEntry.iClir = DesToInt( aObject );
+            }
+        // AnonCallBlockRule
+        else if ( KNSmlDMGenVoIPAnonCallBlockRule() == lastURISeg )
+            {
+            iEntry.iACBRule = DesToInt( aObject );
+            }
+        // PreferredTelephony
+        else if ( KNSmlDMGenVoIPPreferredTelephony() == lastURISeg )
+            {
+            iEntry.iPrefTel = DesToInt( aObject );
+            }
+        // DoNotDisturb
+        else if ( KNSmlDMGenVoIPDoNotDisturb() == lastURISeg )
+            {
+            iEntry.iDnd = DesToInt( aObject );
+            }
+        // PSCallWaiting
+        else if ( KNSmlDMGenVoIPPSCallWaiting() == lastURISeg )
+            {
+            iEntry.iPSCallWaiting = DesToInt( aObject );
+            }
+        else if ( KNSmlDMGenVoIPProfileId() == lastURISeg )
+            {
+            iEntry.iVoipProfileId = aObject;
+            }
+        else
+            {
+            status = CSmlDmAdapter::ENotFound;
+            }
+        }
+    else
+        {
+        status = CSmlDmAdapter::ENotFound;
+        }
+
+    iDmCallback->SetStatusL( aStatusRef, status ); 
+
+    _DBG_FILE("CNSmlDmGeneralVoIPSettingsAdapter::UpdateLeafObjectL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::UpdateLeafObjectL
+// From base class CNSmlDmAdapter.
+// Not supported (see smldmadapter.h).
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::UpdateLeafObjectL( 
+    const TDesC8& /*aURI*/, 
+    const TDesC8& /*aLUID*/, 
+    RWriteStream*& /*aStream*/, 
+    const TDesC8& /*aType*/, 
+    const TInt aStatusRef )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::UpdateLeafObjectL(): stream: begin" );
+    iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::UpdateLeafObjectL(): stream: end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::DeleteObjectL
+// From base class CNSmlDmAdapter.
+// Not supported.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::DeleteObjectL( 
+    const TDesC8& /*aURI*/, 
+    const TDesC8& /*aLUID*/, 
+    const TInt aStatusRef )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::DeleteObjectL(): begin" );
+    iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::DeleteObjectL(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::FetchLeafObjectL
+// From base class CNSmlDmAdapter.
+// Fetches the values of leaf objects.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::FetchLeafObjectL( 
+    const TDesC8& aURI, 
+    const TDesC8& /*aLUID*/, 
+    const TDesC8& aType, 
+    const TInt aResultsRef, 
+    const TInt aStatusRef )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::FetchLeafObjectL(): begin" );
+
+    CBufBase *result = CBufFlat::NewL( KDefaultResultSize );
+    CleanupStack::PushL( result );
+    CSmlDmAdapter::TError status = FetchObjectL( aURI, *result );
+
+    if ( CSmlDmAdapter::EOk == status )
+        {
+        iDmCallback->SetResultsL( aResultsRef, *result, aType );
+        }
+    iDmCallback->SetStatusL( aStatusRef, status );
+
+    CleanupStack::PopAndDestroy( result ); 
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::FetchLeafObjectL(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::FetchLeafObjectSizeL
+// From base class CNSmlDmAdapter.
+// Fetches the size of a leaf object.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::FetchLeafObjectSizeL( 
+    const TDesC8& aURI, 
+    const TDesC8& /*aLUID*/, 
+    const TDesC8& aType, 
+    const TInt aResultsRef, 
+    const TInt aStatusRef )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::FetchLeafObjectSizeL(): begin" );
+    CBufBase *result = CBufFlat::NewL( 1 );
+    CleanupStack::PushL( result );
+    CSmlDmAdapter::TError status = FetchObjectL( aURI, *result );
+    
+    TInt objSizeInBytes = result->Size();
+    TBuf8<16> stringObjSizeInBytes;
+    stringObjSizeInBytes.Num( objSizeInBytes );
+    result->Reset();
+    result->InsertL( 0, stringObjSizeInBytes );
+
+    iDmCallback->SetStatusL( aStatusRef, status );
+    iDmCallback->SetResultsL( aResultsRef, *result, aType );
+    CleanupStack::PopAndDestroy( result );
+    _DBG_FILE("CNSmlDmGeneralVoIPSettingsAdapter::FetchLeafObjectSizeL(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::ChildURIListL
+// From base class CNSmlDmAdapter.
+// Asks for the list of child objects of the node.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::ChildURIListL( 
+    const TDesC8& aURI,
+    const TDesC8& /*aLUID*/, 
+    const CArrayFix<TSmlDmMappingInfo>& /*aPreviousURISegmentList*/, 
+    const TInt aResultsRef, 
+    const TInt aStatusRef ) 
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::ChildURIListL(): start" );
+    CSmlDmAdapter::TError status = CSmlDmAdapter::EError;
+
+    CBufBase *currentURISegmentList = CBufFlat::NewL( KDefaultResultSize );
+    CleanupStack::PushL( currentURISegmentList );
+    TBuf8<KNSmlGenVoIPMaxUriLength> mappingInfo( KNullDesC8 );
+    TBuf8<KNSmlGenVoIPMaxUriLength> uri = aURI;
+    TBuf8<KSmlMaxURISegLen> segmentName;
+
+    if ( KNSmlDMGenVoIPNodeName() == LastURISeg( aURI ) )
+        {
+        // Clir
+        segmentName.Copy( KNSmlDMGenVoIPClir );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMGenVoIPSeparator );
+        // AnonCallBlockRule
+        segmentName.Copy( KNSmlDMGenVoIPAnonCallBlockRule );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMGenVoIPSeparator );
+        // PreferredTelephony
+        segmentName.Copy( KNSmlDMGenVoIPPreferredTelephony );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMGenVoIPSeparator );
+        // DoNotDisturb
+        segmentName.Copy( KNSmlDMGenVoIPDoNotDisturb );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMGenVoIPSeparator );
+        // PSCallWaiting
+        segmentName.Copy( KNSmlDMGenVoIPPSCallWaiting );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMGenVoIPSeparator );
+        // ProfileName
+        segmentName.Copy( KNSmlDMGenVoIPProfileId );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMGenVoIPSeparator );
+        status = CSmlDmAdapter::EOk;
+        }
+
+    iDmCallback->SetStatusL( aStatusRef, status );
+    iDmCallback->SetResultsL( aResultsRef, 
+        *currentURISegmentList, KNullDesC8 );
+    CleanupStack::PopAndDestroy( currentURISegmentList );
+
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::ChildURIListL(): end" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::AddNodeObjectL
+// From base class CNSmlDmAdapter.
+// Not supported since there can only be one general VoIP settings node.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::AddNodeObjectL( 
+    const TDesC8& /*aURI*/, 
+    const TDesC8& /*aParentLUID*/, 
+    const TInt aStatusRef )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::AddNodeObjectL(): begin" );
+    iDmCallback->SetStatusL( aStatusRef, EOk );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::AddNodeObjectL(): end" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::ExecuteCommandL
+// From base class CNSmlDmAdapter.
+// Not supported (see smldmadapter.h).
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::ExecuteCommandL( 
+    const TDesC8& /*aURI*/, 
+    const TDesC8& /*aLUID*/, 
+    const TDesC8& /*aArgument*/, 
+    const TDesC8& /*aType*/, 
+    const TInt aStatusRef )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::ExecuteCommandL(): begin" );
+    iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::ExecuteCommandL(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::ExecuteCommandL
+// From base class CNSmlDmAdapter.
+// Not supported (see smldmadapter.h).
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::ExecuteCommandL( 
+    const TDesC8& /*aURI*/, 
+    const TDesC8& /*aParentLUID*/, 
+    RWriteStream*& /*aStream*/, 
+    const TDesC8& /*aType*/, 
+    const TInt aStatusRef )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::ExecuteCommandL(): stream: begin" );
+    iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::ExecuteCommandL(): stream: end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::CopyCommandL
+// From base class CNSmlDmAdapter.
+// Not supported (see smldmadapter.h).
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::CopyCommandL( 
+    const TDesC8& /*aTargetURI*/, 
+    const TDesC8& /*aTargetLUID*/, 
+    const TDesC8& /*aSourceURI*/, 
+    const TDesC8& /*aSourceLUID*/, 
+    const TDesC8& /*aType*/, 
+    TInt aStatusRef )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::CopyCommandL(): begin" );
+    iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::CopyCommandL(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::StartAtomicL
+// From base class CNSmlDmAdapter.
+// Not supported (see smldmadapter.h).
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::StartAtomicL()
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::StartAtomicL(): begin" );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::StartAtomicL(): end" );
+    }
+    
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::CommitAtomicL
+// From base class CNSmlDmAdapter.
+// Not supported (see smldmadapter.h).
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::CommitAtomicL()
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::CommitAtomicL(): begin" );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::CommitAtomicL(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::RollbackAtomicL
+// From base class CNSmlDmAdapter.
+// Not supported (see smldmadapter.h).
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::RollbackAtomicL()
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::RollbackAtomicL(): begin" );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::RollbackAtomicL(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::StreamingSupport
+// From base class CNSmlDmAdapter.
+// Not supported (see smldmadapter.h).
+// ---------------------------------------------------------------------------
+//
+TBool CNSmlDmGeneralVoIPSettingsAdapter::StreamingSupport( TInt& /*aItemSize*/ )
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::StreamingSupport(): begin" );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::StreamingSupport(): end" );
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::StreamCommittedL
+// From base class CNSmlDmAdapter.
+// Not supported (see smldmadapter.h).
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::StreamCommittedL()
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::StreamCommittedL(): begin" );
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::StreamCommittedL(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::CompleteOutstandingCmdsL
+// From base class CNSmlDmAdapter.
+// Saves modified profiles back to permanent store.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmGeneralVoIPSettingsAdapter::CompleteOutstandingCmdsL()
+    {
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::CompleteOutstandingCmdsL(): begin" );
+    // All commands received, save changes.
+    if ( iEntry.iAreSettingsLoaded )
+        {
+        CRepository* cRepository = CRepository::NewLC( KCRUidRichCallSettings );
+
+        User::LeaveIfError( cRepository->Set( KRCSEClir, iEntry.iClir ) );
+        User::LeaveIfError( cRepository->Set( KRCSEAnonymousCallBlockRule,
+            iEntry.iACBRule ) );
+        User::LeaveIfError( cRepository->Set( KRCSEPreferredTelephony,
+            iEntry.iPrefTel ) );
+        User::LeaveIfError( cRepository->Set( KRCSEDoNotDisturb,
+            iEntry.iDnd ) );
+        User::LeaveIfError( cRepository->Set( KRCSPSCallWaiting, 
+            iEntry.iPSCallWaiting ) );
+
+        // If preferred telephony mode has been set to VoIP and general VoIP
+        // settings "links" to a VoIP profile, set the service id stored in 
+        // the profile as the preferred service id.
+        if ( 1 == iEntry.iPrefTel && iEntry.iVoipProfileId.Length() )
+            {
+            // Get VoIP profile id.
+            TInt voipId( VoIPProfileIdL( iEntry.iVoipProfileId ) );
+            
+            // Get service ID from RCSE.
+            CRCSEProfileRegistry* registry = CRCSEProfileRegistry::NewLC();
+            CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();        
+
+            registry->FindL( voipId, *entry );        
+            TUint serviceId = entry->iServiceProviderId;
+
+            CleanupStack::PopAndDestroy( 2, registry ); // entry, registry
+
+            cRepository->Set( KRCSPSPreferredService, (TInt)serviceId );
+            }
+        
+        CleanupStack::PopAndDestroy( cRepository );
+        }
+    else
+        {
+        User::Leave( KErrGeneral );
+        }
+    
+    _DBG_FILE( "CNSmlDmGeneralVoIPSettingsAdapter::CompleteOutstandingCmdsL(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::VoIPProfileIdL
+// Get VoIP profile ID.
+// ---------------------------------------------------------------------------
+//
+TUint32 CNSmlDmGeneralVoIPSettingsAdapter::VoIPProfileIdL(
+    const TDesC8& aObject ) const
+    {
+    _DBG_FILE("CNSmlDmGeneralVoIPSettingsAdapter::VoIPProfileIdL : begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    HBufC8* luid = iDmCallback->GetLuidAllocL( aObject );
+    CleanupStack::PushL( luid ); // CS:1
+    if ( luid->Des().Length() )
+        {
+        TBuf8<KMaxUriLength> tmp;
+        tmp.Copy( luid->Des().Mid( KVoipId().Length() ) );
+        TLex8 lex( tmp );
+        TUint profileId( 0 );
+        User::LeaveIfError( lex.Val( profileId ) );
+
+        CleanupStack::PopAndDestroy( luid ); // CS:0
+        _DBG_FILE("CNSmlDmGeneralVoIPSettingsAdapter::VoIPProfileIdL : end");
+        return profileId;
+        }
+    CleanupStack::PopAndDestroy( luid ); // CS:0
+    
+    _DBG_FILE("CNSmlDmGeneralVoIPSettingsAdapter::VoIPProfileIdL : end");
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmGeneralVoIPSettingsAdapter::ResolvePreferredServiceNameL
+// Get name of the preferred VoIP service.
+// ---------------------------------------------------------------------------
+//
+TInt CNSmlDmGeneralVoIPSettingsAdapter::ResolvePreferredServiceNameL(
+    CRepository& aRepository )
+    {
+    _DBG_FILE("CNSmlDmGeneralVoIPSettingsAdapter::ResolvePreferredServiceNameL : begin");
+
+    // Reset VoIP profile id.
+    iEntry.iVoipProfileId.Zero();
+    
+    // No need to resolve if preferred telephony isn't set to VoIP.
+    if ( 1 != iEntry.iPrefTel )
+        {
+        return KErrNone;
+        }
+    
+    // Get preferred service id from central repository.
+    TInt serviceId( KErrNotFound );
+    
+    User::LeaveIfError( aRepository.Get(
+        KRCSPSPreferredService, serviceId ) );
+    
+    // Find the VoIP profile with the given service id.
+    CRCSEProfileRegistry* registry = CRCSEProfileRegistry::NewLC();
+    RPointerArray<CRCSEProfileEntry> entries;
+    CleanupResetAndDestroyL( entries );
+
+    registry->FindByServiceIdL( serviceId, entries );
+
+    if ( !entries.Count() )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    TInt voipProfileId = entries[0]->iId;
+    
+    CleanupStack::PopAndDestroy( 2, registry ); // entries, registry
+
+    // Get URIs to all VoIP settings.
+    CBufBase* result = CBufFlat::NewL( 1 );
+    CleanupStack::PushL( result ); // CS:1
+    CSmlDmAdapter::TError status;
+
+    iDmCallback->FetchLinkL( KNSmlDMVoIPNodeName(), *result, status );
+    
+    result->Compress();
+    
+    HBufC8* childList = HBufC8::NewLC( result->Size() ); // CS:2
+    TInt uriSegCount( 0 );
+
+    if ( result->Size() )
+        {
+        childList->Des().Copy( result->Ptr( 0 ) );
+        uriSegCount = NumOfURISegs( childList->Des() );
+        }
+
+    // Get LUIDs for URIs and save the correct profile name.
+    for ( TInt index = 0; index < uriSegCount; index++ )
+        {
+        HBufC8* uri = HBufC8::NewLC( KMaxUriLength ); // CS:3
+      
+        uri->Des().Copy( KNSmlDMVoIPNodeName() );
+        uri->Des().Append( KNSmlDMGenVoIPSeparator() );
+        uri->Des().Append( LastURISeg( childList->Des() ) );        
+
+        HBufC8* luid = iDmCallback->GetLuidAllocL( uri->Des() );
+        CleanupStack::PushL( luid ); // CS:4
+
+        if ( luid->Des().Length() && 
+            voipProfileId == DesToInt(
+                luid->Des().Mid( KVoipId().Length() ) ) )
+            {
+            iEntry.iVoipProfileId.Copy( uri->Des() );
+            CleanupStack::PopAndDestroy( luid ); // CS:3
+            CleanupStack::PopAndDestroy( uri );  // CS:2
+            break;
+            }
+        childList->Des().Copy( RemoveLastURISeg( childList->Des() ) );
+        CleanupStack::PopAndDestroy( luid ); // CS:3
+        CleanupStack::PopAndDestroy( uri );  // CS:2
+        }
+
+    CleanupStack::PopAndDestroy( childList );  // CS:1
+    CleanupStack::PopAndDestroy( result );     // CS:0
+
+    _DBG_FILE("CNSmlDmGeneralVoIPSettingsAdapter::ResolvePreferredServiceNameL : end");
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// TImplementationProxy ImplementationTable[]
+// Needed because of ECOM architecture
+// ---------------------------------------------------------------------------
+//
+#ifndef IMPLEMENTATION_PROXY_ENTRY
+#define IMPLEMENTATION_PROXY_ENTRY( aUid, aFuncPtr ) {{ aUid }, ( aFuncPtr )}
+#endif
+
+const TImplementationProxy ImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KNSmlDMGenVoIPAdapterImplUid, 
+        CNSmlDmGeneralVoIPSettingsAdapter::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// ImplementationGroupProxy()
+// Needed because of ECOM architecture
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( 
+    TInt& aTableCount )
+    {
+    _DBG_FILE( "ImplementationGroupProxy() for CNSmlDmGeneralVoIPSettingsAdapter: begin" );
+    aTableCount = sizeof( ImplementationTable ) / 
+        sizeof( TImplementationProxy );
+    _DBG_FILE( "ImplementationGroupProxy() for CNSmlDmGeneralVoIPSettingsAdapter: end" );
+    return ImplementationTable;
+    }
+  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmgenvoipsettings/src/NSmlDmGeneralVoIPSettingsAdapter.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Device Management General VoIP settings adapter resource file
+*
+*/
+
+
+//  INCLUDES
+#include <registryinfov2.rh>
+//#include <registryinfo.rh>
+#include "nsmldmconstants.h"
+
+// -----------------------------------------------------------------------------
+// RESOURCE DEFINITION 
+// -----------------------------------------------------------------------------
+RESOURCE REGISTRY_INFO theRegistryInfo
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+ 	dll_uid = 0x10275414; //The DLL's 3rd UID.
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KNSmlDMInterfaceUid; // DM interface UID
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10275413; // implementation UID
+                    version_no = 1; 
+                    display_name = "";
+                    default_data = "";
+                    opaque_data = "";
+                    rom_only = 1;
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Device Management VoIP adapter.
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+default
+
+PRJ_EXPORTS
+../rom/dmvoipadapter.iby CORE_APP_LAYER_IBY_EXPORT_PATH( dmvoipadapter.iby )
+
+PRJ_MMPFILES
+./nsmldmvoipadapter.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/group/nsmldmvoipadapter.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2002-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:  Device Management VoIP Settings Adapter
+*
+*/
+
+
+#include "defaultcaps.hrh"
+#include <platform_paths.hrh>
+
+CAPABILITY     CAP_ECOM_PLUGIN
+TARGET         nsmldmvoipadapter.dll
+TARGETTYPE     PLUGIN
+UID            0x10009D8D 0x10201F9C
+VENDORID       VID_DEFAULT
+
+
+SOURCEPATH     ../src
+USERINCLUDE    ../inc
+USERINCLUDE    ../../inc
+
+SYSTEMINCLUDE  /epoc32/include/ecom
+SYSTEMINCLUDE  ../../../../inc  // iptelephony's inc
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCE         nsmldmvoipadapter.cpp
+SOURCE	       CSIPProfileRegistryObserver.cpp
+SOURCE         nsmldmvoipadaptergroupproxy.cpp
+SOURCE         cdmvoipspsettings.cpp
+
+START RESOURCE nsmldmvoipadapter.rss
+END
+
+LIBRARY        euser.lib 
+LIBRARY        nsmldebug.lib 
+LIBRARY        ecom.lib 
+LIBRARY        charconv.lib 
+LIBRARY        rcse.lib 
+LIBRARY        efsrv.lib
+LIBRARY        centralrepository.lib 
+LIBRARY        sipprofilecli.lib
+LIBRARY        sysutil.lib
+LIBRARY        bafl.lib
+LIBRARY        cone.lib
+LIBRARY        nsmldmiapmatcher.lib
+LIBRARY        serviceprovidersettings.lib
+LIBRARY        presencesettingsapi.lib
+LIBRARY        nsmldmclientserverutils.lib
+LIBRARY        ipapputils.lib
+LIBRARY        featmgr.lib
+LIBRARY        vimpstsettings.lib // For setting IM tone.
+LIBRARY        platformenv.lib // For getting rom digital tone path.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/inc/CSIPProfileRegistryObserver.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 MSIPProfileRegistryObserver interface.
+*
+*/
+
+
+#ifndef CSIPPROFILEREGISTRYOBSERVER_H
+#define CSIPPROFILEREGISTRYOBSERVER_H
+
+//  INCLUDES
+#include <sipprofileregistryobserver.h>
+
+// CLASS DECLARATION
+/**
+ * Class implements MSIPProfileRegistryObserver interface. 
+ * Observs changes in the SIP profile registry.
+ *
+ * @lib nsmldmvopipadapter.lib
+ * @since S60 3.0
+ */
+class CSIPProfileRegistryObserver : 
+    public CBase, public MSIPProfileRegistryObserver
+    {
+    #ifdef _DEBUG
+    /**
+     * Friend class for unit testing.
+     */
+    friend class UT_CNSmlDmVoIPAdapter; 
+    #endif
+
+
+    public: // Constructors and destructor.
+
+        static CSIPProfileRegistryObserver* NewLC();
+        static CSIPProfileRegistryObserver* NewL();
+        virtual ~CSIPProfileRegistryObserver();
+
+    public: // Methods from base classes
+    
+		/** 
+         * An event related to SIP Profile has occurred
+         *
+         * @param aProfileId a profile Id
+         * @param aEvent an occurred event
+         **/
+        void ProfileRegistryEventOccurred( 
+            TUint32 aProfileId, TEvent aEvent );
+
+        /**
+         * An asynchronous error has occurred related to SIP profile
+         * Event is send to those observers, who have the
+         * corresponding profile instantiated.
+         *
+         * @param aProfileId the id of failed profile 
+         * @param aError an occurred error
+         */
+        void ProfileRegistryErrorOccurred( TUint32 aProfileId, TInt aError );
+
+  private:
+        CSIPProfileRegistryObserver(); 
+        void ConstructL();
+    };
+
+#endif // CSIPPROFILEREGISTRYOBSERVER_H
+
+// End of file.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/inc/cdmvoipspsettings.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,115 @@
+/*
+* 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:  SPSettings class for Device Management VoIP Settings Adapter
+*
+*/
+
+#ifndef CDMVOIPSPSETTINGS_H
+#define CDMVOIPSPSETTINGS_H
+
+#include <e32base.h>
+#include <e32cmn.h>
+
+/**
+ * CDMVoIPSPSettings
+ * Class for transiently holding Service Provider Setting values.
+ *
+ * @since S60 3.2
+ */
+class CDMVoIPSPSettings: public CBase
+    {
+public:
+    static CDMVoIPSPSettings* NewL();
+    static CDMVoIPSPSettings* NewLC();
+    virtual ~CDMVoIPSPSettings();
+
+private:
+    CDMVoIPSPSettings();
+    void ConstructL();
+
+public: // data
+
+    /**
+     * VoiceMailBox MWI URI.
+     * Own.
+     */
+    HBufC* iVmbxMwiUri;
+
+    /**
+     * VoiceMailBox listening address (URI).
+     * Own.
+     */
+    HBufC* iVmbxListenUri;
+
+    /**
+     * VoiceMailBox IAP ID.
+     */
+    TUint32 iVmbxIapId;
+
+    /**
+     * VoiceMailBox Re-SUBSCRIBE interval.
+     */
+    TInt iReSubscribeInterval;
+
+    /**
+     * VoiceMailBox SIP ID.
+     */
+    TUint32 iVmbxSipId;
+
+    /**
+     * Service provider bookmark URI.
+     * Own.
+     */
+    HBufC* iServiceProviderBookmark;
+
+    /**
+     * Branding data URI.
+     * Own.
+     */
+    HBufC* iBrandingDataUri;
+
+    /**
+     * Presence profile ID.
+     */
+    TUint32 iPresenceId;
+
+    /**
+     * RCSE profile ID.
+     */
+    TUint32 iRcseProfileId;
+
+    /**
+     * Presence auto accept buddy subscription request.
+     */
+    TInt iAutoAcceptBuddy;
+
+    /**
+     * Auto enable state of service.
+     */
+    TInt iAutoEnableService;
+
+    /**
+     * Snap profile ID.
+     */
+    TUint32 iSnapId;
+
+    /**
+     * IM enabled.
+     */
+    TInt iImEnabled;
+    };
+
+#endif // CDMVOIPSPSETTINGS_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/inc/nsmldmvoipadapter.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,646 @@
+/*
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies 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 Management VoIP Settings Adapter
+*
+*/
+
+
+#ifndef __NSMLDMVOIPADAPTER_H__
+#define __NSMLDMVOIPADAPTER_H__
+
+// INCLUDES
+#include <e32base.h>
+#include <smldmadapter.h>
+
+// CONSTANTS
+const TUint KMaxTerminalTypeLength = 64;
+const TUint KWlanMacAddressLength  = 50;
+const TUint KPhoneModelLength      = 20;
+const TInt KMaxUriLength           = 64;
+const TInt KMaxDebugPrintLength    = 256;
+
+// CLASS DECLARATION
+class CRCSEProfileRegistry;
+class CRCSEProfileEntry;
+class CRCSEAudioCodecRegistry;
+class CRCSEAudioCodecEntry;
+class MSIPProfileRegistryObserver;
+class CSIPProfileRegistryObserver;
+class CSIPManagedProfileRegistry;
+class CSIPManagedProfile;
+class CCoeEnv;
+class CDMVoIPSPSettings;
+
+/**
+ *  CNSmlDmVoIPAdapter
+ *  ?other_description_lines
+ *
+ *  @lib ?library
+ *  @since Series 60_3.0
+ */
+class CNSmlDmVoIPAdapter : public CSmlDmAdapter
+    {
+    #ifdef _DEBUG
+    /**
+     * Friend class for unit testing.
+     */
+    friend class UT_CNSmlDmVoIPAdapter;
+    #endif
+
+    public:
+
+        static CNSmlDmVoIPAdapter* NewL( MSmlDmCallback* aDmCallback );
+
+        virtual ~CNSmlDmVoIPAdapter();
+
+    /**  For setting telephony preference */
+	enum TTelephonyPreference
+			{
+            ECSPreferred,
+            EPSPreferred
+			};
+
+    private:
+
+// From base class NSmlDmAdapter
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param aVersion for returning DDF version of adapter
+         */
+        void DDFVersionL( CBufBase& aDDFVersion );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param aDDF for returning DDF structure of adapter
+         */
+        void DDFStructureL( MSmlDmDDFObject& aDDF );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param aURI URI from dm-module
+         * @param aParentLUID luid mapping from dm-module
+         * @param aType object type from dm-module
+         * @param aStatusRef status from dm-module
+         */                            
+        void UpdateLeafObjectL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const TDesC8& aObject,
+            const TDesC8& /*aType*/, 
+            const TInt aStatusRef );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param aURI URI from dm-module
+         * @param aParentLUID luid mapping from dm-module
+         * @param aType object type from dm-module
+         * @param aStatusRef status from dm-module
+         */                            
+        void UpdateLeafObjectL( 
+            const TDesC8& /*aURI*/, 
+            const TDesC8& /*aLUID*/, 
+            RWriteStream*& /*aStream*/,
+            const TDesC8& /*aType*/, 
+            TInt aStatusRef );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param aURI URI from dm-module
+         * @param aLUID luid mapping from dm-module
+         * @param aStatusRef status from dm-module
+         */        
+        void DeleteObjectL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const TInt aStatusRef );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param aURI URI from dm-module
+         * @param aLUID luid mapping from dm-module
+         * @param aType object type from dm-module
+         * @param aResultsRef results reference from dm-module
+         * @param aStatusRef status reference from dm-module
+         */        
+        void FetchLeafObjectL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const TDesC8& aType, 
+            const TInt aResultsRef, 
+            const TInt aStatusRef );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param aURI URI from dm-module
+         * @param aLUID luid mapping from dm-module
+         * @param CArrayFix previousURISegmentList from dm-module
+         * @param aResultsRef results reference from dm-module
+         * @param aStatusRef status reference from dm-module
+         */
+        void ChildURIListL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
+            const TInt aResultsRef, 
+            const TInt aStatusRef );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param aURI URI from dm-module
+         * @param aParentLUID luid mapping from dm-module
+         * @param aStatusRef status from dm-module
+         */        
+        void AddNodeObjectL( 
+            const TDesC8& aURI, 
+            const TDesC8& aParentLUID, 
+            const TInt aStatusRef );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param ?arg1 ?description
+         * 
+         */
+        void ExecuteCommandL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const TDesC8& aArgument, 
+            const TDesC8& aType, 
+            const TInt aStatusRef );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param ?arg1 ?description
+         * 
+         */
+        void ExecuteCommandL( 
+            const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            RWriteStream*& aStream, 
+            const TDesC8& aType, 
+            const TInt aStatusRef );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param ?arg1 ?description
+         * 
+         */   
+        void CopyCommandL( 
+            const TDesC8& aTargetURI, 
+            const TDesC8& aTargetLUID, 
+            const TDesC8& aSourceURI, 
+            const TDesC8& aSourceLUID, 
+            const TDesC8& aType, 
+            TInt aStatusRef );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param ?arg1 ?description
+         * 
+         */
+        void FetchLeafObjectSizeL( const TDesC8& aURI, 
+            const TDesC8& aLUID, 
+            const TDesC8& aType, 
+            TInt aResultsRef, 
+            TInt aStatusRef );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param ?arg1 ?description
+         * 
+         */
+        void StartAtomicL();
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param ?arg1 ?description
+         * 
+         */
+        void CommitAtomicL();
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param ?arg1 ?description
+         * 
+         */
+        void RollbackAtomicL();
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param ?arg1 ?description
+         * 
+         */
+        TBool StreamingSupport( TInt& aItemSize );
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param ?arg1 ?description
+         * 
+         */
+        void StreamCommittedL();
+
+        /**
+         * From CNsmlDmAdapter
+         * @since Series 60_3.0
+         * @param ?arg1 ?description
+         * 
+         */
+        void CompleteOutstandingCmdsL();
+
+    private: 
+
+        CNSmlDmVoIPAdapter( TAny* aEcomArguments );
+
+        void ConstructL();
+
+        /**
+         * Fetches object based on URI and LUID.
+         * @since Series 60_3.0
+         * @param aURI URI of the object.
+         * @param aLUID LUID of the object.
+         * @param aObject The object.
+         * @return DM error status.
+         */
+        CSmlDmAdapter::TError FetchObjectL( 
+            const TDesC8& aURI,
+            const TDesC8& aLUID, 
+            CBufBase& aObject );
+
+        /**
+         * Loads SIP profile information
+         * @since Series 60_3.0
+         */        
+        void LoadProfilesL();
+
+        /**
+         * Converts 8 bit descriptor to integer.
+         * @since Series 60_3.0
+         * @param aDes Descriptor to convert
+         * @return integer
+         */        
+        TInt DesToInt( const TDesC8& aDes ) const;
+
+        /**
+         * Converts descriptor to unsigned integer
+         * @since Series 60_3.0
+         * @param aDes Descriptor to convert
+         * @return unsigned integer
+         */        
+        TUint DesToTUint( const TDesC8& aDes ) const;
+
+        /**
+         * Removes last uri segment from aURI
+         * @since Series 60_3.0
+         * @param aDes Descriptor to handle
+         * @return pointer to uri
+         */        
+        const TPtrC8 RemoveLastURISeg( const TDesC8& aURI ) const;
+
+        /**
+         * Gets number of uri segments.
+         * @since Series 60_3.0
+         * @param aURI Descriptor to handle
+         * @return pointer to uri
+         */
+        TInt NumOfURISegs( const TDesC8& aURI ) const;
+
+        /**
+         * Gets last uri segment.
+         * @since Series 60_3.0
+         * @param aURI Descriptor to handle
+         * @return integer
+         */
+        const TPtrC8 LastURISeg( const TDesC8& aURI ) const;
+
+        /**
+         * Removes ./ from uri
+         * @since Series 60_3.0
+         * @param aURI Descriptor to handle
+         * @return pointer to uri
+         */
+        const TPtrC8 RemoveDotSlash( const TDesC8& aURI ) const;
+
+        /**
+         * Get Sip URI reference from SIP adapter
+         * @since Series 60_3.0
+         * @param aObject Object to insert found URI.
+         * @param aID SIP profile ID to get URI
+         * @return errorcode to tell wether operation was successful
+         */        
+        MSmlDmAdapter::TError GetSipIdL( CBufBase& aObject, 
+            TUint32 aID ) const;
+
+        /**
+         * Set SipRef value according to aObject
+         * Converts aObject to TUint 
+         * @since Series 60_3.0
+         * @param aObject SIP reference to change
+         * @return SIP profile ID as TUint
+         */
+        TUint32 SetSipRefL( const TDesC8& aObject ) const;
+
+        /**
+         * Get Sccp URI reference from SIP adapter
+         * @since Series 60_3.0
+         * @param aObject Object to insert found URI.
+         * @param aID SIP profile ID to get URI
+         * @return errorcode to tell wether operation was successful
+         */        
+        MSmlDmAdapter::TError GetSccpIdL( CBufBase& aObject, 
+            TUint32 aID ) const;
+
+        /**
+         * Set SccpRef value according to aObject
+         * Converts aObject to TUint 
+         * @since Series 60_3.0
+         * @param aObject SIP reference to change
+         * @return SIP profile ID as TUint
+          */
+        TUint SetSccpRefL( const TDesC8& aObject ) const;
+
+        /**
+         * Check for duplicate settingsName and rename if same
+         * @since Series 60_3.0
+         * @param aProfile Profile to check.
+         */
+        TBool CheckDuplicateNameL( CRCSEProfileEntry& aEntry );
+
+        /**
+         * Check for duplicate providerName and rename if same
+         * @since Series 60_3.0
+         * @param aProfile Profile to check.
+         */
+        TBool CheckDuplicateProviderL( CRCSEProfileEntry& aEntry );
+
+        /**
+         * Finds profile location in profile array.
+         * @since Series 60_3.0
+         * @param aURI Descriptor to look for
+         * @return Profile location TInt
+         */
+        TInt FindProfileLocation( const TDesC8& aURI ) const;
+
+        /**
+         * Finds codec location in codec array.
+         * @since Series 60_3.0
+         * @param aID CodecId
+         * @return Profile location TInt
+         */
+        TInt FindCodecLocation( TUint32 aID ) const;
+
+	    /**
+	     * Sets CS/PS telephony preference
+	     * @since Series 60_3.0
+	     * @param aTelephonyPreference state to set
+	     */
+	    void SetTelephonyPreferenceL( const TTelephonyPreference& 
+	        aTelephonyPreference );
+
+        /**
+         * Get Terminal Type for SIP User Agent Header.
+         * @since S60 v3.0
+         * @param aTeminalType Terminal type.
+         */
+        void GetTerminalTypeL( TBuf<KMaxTerminalTypeLength>& aTerminalType ) 
+            const;
+
+        /**
+         * Get WLAN MAC address for SIP User Agent Header.
+         * @since S60 v3.0
+         * @param aMac WLAN MAC address.
+         */
+        void GetWlanMacAddressL( TBuf<KWlanMacAddressLength>& aMac ) const;
+
+        /**
+         * Get NAT/FW Domain specific URI according to given profile ID.
+         * @since S60 3.2
+         * @param aObject URI to be set.
+         * @param aProfileId Profile ID from which the URI is to be found.
+         * @return DM error status.
+         */
+        MSmlDmAdapter::TError GetNatFwUriL( TBuf16<KMaxUriLength>& aObject, 
+            TInt aProfileId ) const;
+
+        /**
+         * Get NAT/FW Domain specific ID according to given URI.
+         * @since S60 3.2
+         * @param aObject URI with which to resolve the ID.
+         * @return NAT/FW Domain specific ID.
+         */
+        TUint32 NatFwIdL( const TDesC8& aObject ) const;
+
+        /**
+         * Get Access Point ID (connection reference) according to aObject.
+         * @since S60 3.2
+         * @param aObject URI to look from AP adapter.
+         * @return Access point ID number.
+         */    
+        TInt ConRefL( const TDesC8& aObject ) const;
+
+        /**
+         * Get Access Point URI reference from AP adapter.
+         * @since S60 3.2
+         * @param aObject Object into which to insert found URI.
+         * @param aIapID IAP ID to look for.
+         * @return DM error status.
+         */
+        MSmlDmAdapter::TError GetConRefL( CBufBase& aObject, 
+            TInt aIapId ) const;
+
+        /**
+         * Get Presence profile URI according to given profile ID.
+         * @since S60 3.2
+         * @param aObject URI to be set.
+         * @param aProfileId Profile ID from which the URI is to be found.
+         * @return DM error status.
+         */
+        MSmlDmAdapter::TError GetPresenceUriL( TBuf16<KMaxUriLength>& aObject,
+            TUint32 aProfileId ) const;
+
+        /**
+         * Get Presence profile ID according to given URI.
+         * @since S60 3.2
+         * @param aObject URI with which to resolve the ID.
+         * @return Presence profile ID.
+         */
+        TUint32 PresenceIdL( const TDesC8& aObject ) const;
+		
+        /**
+         * Checks if Presence Settings ID is valid.
+         * @since S60 3.2
+         * @param aSetId Presence Settings ID.
+         * @return ETrue if settings exists, EFalse if not.
+         */
+        TBool IsPresIDValidL( TUint32 aSetId ) const;
+        
+        /**
+         * Get SNAP ID.
+         * @since S60 3.2.
+         * @param aUri URI from which to find SNAP ID.
+         * @return SNAP ID.
+         */
+        TInt SnapIdL( const TDesC8& aUri );
+
+        /**
+         * Set SNAP URI.
+         * @since S60 3.2.
+         * @param aObject Object in which found URI is set.
+         * @param aSnapId SNAP ID from which to find URI.
+         * @return ETrue if successful, EFalse if not.
+         */
+        MSmlDmAdapter::TError GetSnapUriL( TDes8& aObject, TInt aSnapId );
+
+        /**
+         * Updates Codec specific object.
+         * @since S60 3.2
+         * @param aLUID luid mapping from dm-module
+         * @param aUriSeg Last URI segment.
+         * @param aObject Data of the object.
+         * @return Value indicating if object was found.
+         */
+        CSmlDmAdapter::TError UpdateCodecSpecificObject( 
+            const TDesC8& aLUID, const TDesC8& aUriSeg, 
+            const TDesC8& aObject );
+
+        /**
+         * Fetches the values of Codec specific leaf objects.
+         * @since S60 3.2
+         * @param aLUID luid mapping from dm-module
+         * @param aUriSeg Last URI segment.
+         * @param aSegmentResult Storage for fetched objects.
+         * @return Value indicating if object was found.
+         */
+        CSmlDmAdapter::TError FetchCodecObject( const TDesC8& aLUID,
+            const TDesC8& aUriSeg, TDes8& aSegmentResult );
+
+        /**
+         * Inserts Codec specific leaf objects.
+         * @since S60 3.2
+         * @param aCurrentURISegmentList List for leaf objects.
+         */
+        void CodecChildListL( CBufBase* const aCurrentURISegmentList );
+            
+        /**
+         * Updates Setting Ids specific object.
+         * @since S60 3.2
+         * @param aLUID luid mapping from dm-module
+         * @param aUriSeg Last URI segment.
+         * @param aObject Data of the object.
+         * @return Value indicating if object was found.
+         */
+        CSmlDmAdapter::TError UpdateSettingIdsSpecificObjectL( 
+            const TDesC8& aLUID, const TDesC8& aUriSeg, 
+            const TDesC8& aObject );
+            
+        /**
+         * Inserts Voip leaf objects.
+         * @since S60 3.2
+         * @param aCurrentURISegmentList List for leaf objects.
+         */
+        void VoipChildListL( CBufBase* const aCurrentURISegmentList );
+
+    private:    // Data
+
+        /**
+         * RCSE profile registry handle.
+         * Own.
+         */
+        CRCSEProfileRegistry* iCRCSEProfile;
+
+        /**
+         * RCSE codec registry handle.
+         * Own.
+         */
+        CRCSEAudioCodecRegistry* iCRCSEAudioCodec;
+
+        /**
+         * Handle for DM callback interface.
+         * Not own.
+         */
+        MSmlDmCallback* iDmCallback;
+
+        /**
+         * For telling status of command to the adapter.
+         */
+        TInt iStatusRef;
+
+        /**
+         * Array of pointers to all profile entries.
+         * Own.
+         */
+        RPointerArray<CRCSEProfileEntry> iProfileEntries;
+
+        /**
+         * Array of pointers to all codec entries.
+         * Own.
+         */
+        RPointerArray<CRCSEAudioCodecEntry> iCodecEntries;
+
+        /**
+         * For knowing if there are modifications to entries.
+         */
+        RArray<TInt> iProfileModifs;
+
+        /**
+         * For knowing if there are modifications to entries.
+         */
+        RArray<TInt> iCodecModifs;
+
+        /**
+         * Current editable profileID in array of profiles.
+         */
+        TInt iProfileID;
+
+        /**
+         * Array for service provider settings.
+         */
+        RPointerArray<CDMVoIPSPSettings> iSPSettings;
+
+        /**
+         * the temporary string used to fetch profile id 
+         */
+        HBufC8* iTempProfileIdObject;
+
+        /**
+         * flag which indicates whether the profile type is set or not
+         */
+        TBool iIsProfileTypeSet;
+        
+        /**
+         * flag which indicates whether the AllowVoIPOverWCDMA flag is 
+         * modified or not
+         */
+        TBool iAllowVoIPOverWCDMAModified;
+    };
+
+#endif // __NSMLDMVOIPADAPTER_H__
+
+// End of File.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/inc/smldmvoipdebug.h	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Logging header
+*
+*/
+
+
+#ifndef SMLDMVOIPDEBUG_H
+#define SMLDMVOIPDEBUG_H
+
+//  INCLUDES
+#include <e32debug.h>
+
+#ifdef _DEBUG
+#define DBG_PRINT( p )     RDebug::Print( _L( p ) )
+#define DBG_PRINT2( p, a ) RDebug::Print( _L( p ), a )
+#else
+#define DBG_PRINT( p )
+#define DBG_PRINT2( p, a )
+#endif // _DEBUG
+
+#endif  // SMLDMVOIPDEBUG_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/rom/dmvoipadapter.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* 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:  Device Management VoIP Adapter iby file
+*
+*/
+
+#ifndef __DMVOIPADAPTER_IBY__
+#define __DMVOIPADAPTER_IBY__
+
+ECOM_PLUGIN(nsmldmvoipadapter.dll,nsmldmvoipadapter.rsc)
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/src/CSIPProfileRegistryObserver.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,88 @@
+/*
+* 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:  Implements MSIPProfileRegistryObserver interface.
+*
+*/
+
+
+// INCLUDE FILES
+#include "CSIPProfileRegistryObserver.h"
+
+// ---------------------------------------------------------------------------
+// CSIPProfileRegistryObserver::CSIPProfileRegistryObserver();
+// ---------------------------------------------------------------------------
+//
+CSIPProfileRegistryObserver::CSIPProfileRegistryObserver()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSIPProfileRegistryObserver::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void CSIPProfileRegistryObserver::ConstructL()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CSIPProfileRegistryObserver::NewLC
+// ---------------------------------------------------------------------------
+//
+CSIPProfileRegistryObserver* CSIPProfileRegistryObserver::NewLC()
+    {
+    CSIPProfileRegistryObserver* self =
+        new ( ELeave ) CSIPProfileRegistryObserver();
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSIPProfileRegistryObserver::NewL
+// ---------------------------------------------------------------------------
+//
+CSIPProfileRegistryObserver* CSIPProfileRegistryObserver::NewL()
+    {
+    CSIPProfileRegistryObserver* self =
+        new ( ELeave ) CSIPProfileRegistryObserver();
+    CleanupStack::PushL( self );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CSIPProfileRegistryObserver::~CSIPProfileRegistryObserver
+// ---------------------------------------------------------------------------
+//
+CSIPProfileRegistryObserver::~CSIPProfileRegistryObserver()
+   {
+   }
+
+// ---------------------------------------------------------------------------
+// CSIPProfileRegistryObserver::ProfileRegistryEventOccurred.
+// ---------------------------------------------------------------------------
+//
+void CSIPProfileRegistryObserver::ProfileRegistryEventOccurred( TUint32 
+    /*aProfileId*/, TEvent /*aEvent*/ )
+    {
+    }
+// ---------------------------------------------------------------------------
+// CSIPProfileRegistryObserver::ProfileRegistryEventOccurred.
+// ---------------------------------------------------------------------------
+//
+void CSIPProfileRegistryObserver::ProfileRegistryErrorOccurred( TUint32 
+    /*aProfileId*/, TInt /*aError*/ )
+    {
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/src/cdmvoipspsettings.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,85 @@
+/*
+* 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:  SPSettings class implementation for dmvoipadapter
+*
+*/
+
+
+#include "cdmvoipspsettings.h"
+#include "smldmvoipdebug.h"
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::NewL
+// ---------------------------------------------------------------------------
+//
+CDMVoIPSPSettings* CDMVoIPSPSettings::NewL()
+    {
+    CDMVoIPSPSettings* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::NewLC
+// ---------------------------------------------------------------------------
+//
+CDMVoIPSPSettings* CDMVoIPSPSettings::NewLC()
+    {
+    CDMVoIPSPSettings* self = new (ELeave) CDMVoIPSPSettings();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::CDMVoIPSPSettings
+// ---------------------------------------------------------------------------
+//
+CDMVoIPSPSettings::CDMVoIPSPSettings()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::~CDMVoIPSPSettings
+// ---------------------------------------------------------------------------
+//
+CDMVoIPSPSettings::~CDMVoIPSPSettings()
+    {
+    DBG_PRINT( "CDMVoIPSPSettings::~CDMVoIPSPSettings - begin" );
+    delete iVmbxMwiUri;
+    delete iVmbxListenUri;
+    delete iServiceProviderBookmark;
+    delete iBrandingDataUri;
+    DBG_PRINT( "CDMVoIPSPSettings::~CDMVoIPSPSettings - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CDMVoIPSPSettings::ConstructL()
+    {
+    DBG_PRINT( "CDMVoIPSPSettings::ConstructL - begin" );
+    iVmbxMwiUri              = HBufC::NewL( 0 );
+    iVmbxListenUri           = HBufC::NewL( 0 );
+    iServiceProviderBookmark = HBufC::NewL( 0 );
+    iBrandingDataUri         = HBufC::NewL( 0 );
+    iReSubscribeInterval     = KErrNotFound;
+    iAutoAcceptBuddy         = KErrNotFound;
+    iAutoEnableService       = KErrNotFound;
+    iImEnabled               = KErrNotFound;
+    DBG_PRINT( "CDMVoIPSPSettings::ConstructL - end" );
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/src/nsmldmvoipadapter.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,5801 @@
+/*
+* Copyright (c) 2002-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:  Device Management VoIP adapter
+*
+*/
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <sysutil.h>
+#include <settingsinternalcrkeys.h>
+#include <centralrepository.h>
+#include <wlaninternalpskeys.h> // For GetWlanacAddress and GetWlanTypeL.
+#include <badesca.h> // For CDesC8ArrayFlat used in CompleteOutstandingCmdsL.
+#include <coemain.h> // For GetPhoneModelL.
+#include <crcseprofileregistry.h>
+#include <crcseprofileentry.h>
+#include <crcseaudiocodecregistry.h>
+#include <crcseaudiocodecentry.h>
+#include <utf.h>
+#include <sipmanagedprofile.h> // For SIP User Agent Header.
+#include <sipprofileregistryobserver.h> // For SIP User Agent Header.
+#include <sipmanagedprofileregistry.h> // For SIP User Agent Header.
+#include <spdefinitions.h> // For Service Provider Settings.
+#include <spsettings.h>    // For Service Provider Settings.
+#include <spentry.h>       // For Service Provider Settings.
+#include <spproperty.h>    // For Service Provider Settings.
+#include <featmgr.h>
+#include <nsmldmiapmatcher.h> // For fetching IAP.
+#include <nsmldmuri.h> // for parsing uris
+#include <pathinfo.h> // For getting phone rom root path.
+#include <cvimpstsettingsstore.h> // For IM tone path
+#include <pressettingsset.h> // for checking if presence settings is valid
+#include <pressettingsapi.h> // for checking if presence settings is valid
+
+#include "nsmldmvoipadapter.h"
+#include "cdmvoipspsettings.h"
+#include "CSIPProfileRegistryObserver.h" // For SIP User Agent Header.
+#include "cipappphoneutils.h"            // For GetPhoneModelL, GetTerminalTypeL
+#include "cipapputilsaddressresolver.h"  // For GetWlanMacAddress
+#include "smldmvoipdebug.h"
+
+// CONSTANTS
+
+const TInt   KNSmlVoIPMaxUriLength     = 256;
+const TInt   KDefaultResultSize        = 64;
+const TInt   KNSmlVoIPMaxResultLength  = 256;
+const TInt   KNSmlDMFatMinimumFileSize = 512;
+const TUint  KTempStringlength = 200;
+_LIT8( KSpaceMark,         " " );
+_LIT8( KUserAgent,         "User-Agent" );
+_LIT8( KColonMark,         ":" );
+
+_LIT8( KNSmlDMVoIPDDFVersion,                "1.0" ); 
+_LIT8( KNSmlDMVoIPNodeName,                  "VoIP" );
+_LIT8( KNSmlDMVoIPPrefix,                    "VoIPId" );
+_LIT8( KNSmlDMVoIPDynamicNode,               "" );
+_LIT8( KNSmlDMVoIPSetID,                     "VoIPId" ); 
+_LIT8( KNSmlDMVoIPProvID,                    "ProviderName" ); 
+_LIT8( KNSmlDMVoIPName,                      "SettingsName" );
+_LIT8( KNSmlDMVoIPPreferredCodecsNode,       "PreferredCodecs" );
+
+// VoIP/x/CodecSettings
+_LIT8( KNSmlDMVoIPCodecSettingsNode,         "CodecSettings" );
+_LIT8( KNSmlDMVoIPCodecSettingsId,           "CodecSettingsId" );
+_LIT8( KNSmlDMVoIPCodecId,                   "VoIPCodecId" );
+_LIT8( KNSmlDMVoIPPreferredCodecId,          "PreferredCodecId" );
+_LIT8( KNSmlDMVoIPMediaTypeName,             "MediaTypeName" );
+_LIT8( KNSmlDMVoIPMediaSubTypeName,          "MediaSubTypeName" );
+_LIT8( KNSmlDMVoIPJitterBufferSize,          "JitterBufferSize" );
+_LIT8( KNSmlDMVoIPOctetAlign,                "OctetAlign" );
+_LIT8( KNSmlDMVoIPModeSetNode,               "ModeSet" );
+_LIT8( KNSmlDMVoIPMode,                      "Mode" );
+_LIT8( KNSmlDMVoIPModeId,                    "ModeId" );
+_LIT8( KNSmlDMVoIPModeChangePeriod,          "ModeChangePeriod" );
+_LIT8( KNSmlDMVoIPModeChangeNeighbor,        "ModeChangeNeighbor" );
+_LIT8( KNSmlDMVoIPPtime,                     "Ptime" );
+_LIT8( KNSmlDMVoIPMaxPtime,                  "MaxPtime" );
+_LIT8( KNSmlDMVoIPVAD,                       "VAD" ); 
+_LIT8( KNSmlDMVoIPAnnexB,                    "AnnexB" );
+_LIT8( KNSmlDMVoIPMaxRed,                    "MaxRed" );
+
+// VoIP/x/SettingIds node
+_LIT8( KNSmlDMVoIPSettingIdsNode,            "SettingIds" );
+_LIT8( KNSmlDMVoIPSettingId,                 "SettingId" );
+_LIT8( KNSmlDMVoIPProfileType,               "ProfileType" ); 
+_LIT8( KNSmlDMVoIPProfileId,                 "ProfileId" );
+_LIT8( KNSmlDMVoIPProfileSpecificId,         "ProfileSpecificId" );
+_LIT8( KNSmlDMVoIPProfileTypeSIP,            "SIP" );
+_LIT8( KNSmlDMVoIPProfileTypeSCCP,           "SCCP" );
+
+// VoIP/x/
+_LIT8( KNSmlDMVoIPSMPort,                    "StartMediaPort" );
+_LIT8( KNSmlDMVoIPEMPort,                    "EndMediaPort" );
+_LIT8( KNSmlDMVoIPMediaQos,                  "MediaQos" );
+_LIT8( KNSmlDMVoIPDTMFIB,                    "InbandDTMF" );
+_LIT8( KNSmlDMVoIPDTMFOB,                    "OutbandDTMF" );
+_LIT8( KNSmlDMVoIPSecureCallPref,            "SecureCallPref" );
+_LIT8( KNSmlDMVoIPRTCP,                      "RTCP" );
+_LIT8( KNSmlDMVoIPUAHTerminalType,           "UAHTerminalType" );
+_LIT8( KNSmlDMVoIPUAHWLANMAC,                "UAHWLANMAC" );
+_LIT8( KNSmlDMVoIPUAHString,                 "UAHString" );
+_LIT8( KNSmlDMVoIPProfileLockedToIAP,        "ProfileLockedToIAP" );
+_LIT8( KNSmlDMVoIPPluginUID,                 "VoIPPluginUID" );
+_LIT8( KNSmlDMVoIPAllowVoIPOverWCDMA,        "AllowVoIPOverWCDMA" );
+_LIT8( KNSmlDMVoIPVoIPDigits,                "VoIPDigits" );
+_LIT8( KNSmlDMVoIPURIDomainIgnoreRule,       "URIDomainIgnoreRule" );
+_LIT8( KNSmlDMVoIPAutoAcceptBuddyRequest,    "AutoAcceptBuddyRequest" );
+_LIT8( KNSmlDMVoIPUsedVoIPRelease,           "UsedVoIPRelease" );
+_LIT8( KNSmlDMVoIPAddUserPhone,              "AddUserPhone" );
+_LIT8( KNSmlDMVoIPProviderBookmarkUri,       "ProviderBookmarkURI" );
+_LIT8( KNSmlDMVoIPSIPConnTestUri,            "SIPConnectivityTestURI" );
+_LIT8( KNSmlDMVoIPNatFwProfileId,            "NATFWProfileId" );
+_LIT8( KNSmlDMVoIPMinSessionInterval,        "MinSessionInterval" );
+_LIT8( KNSmlDMVoIPSessionExpires,            "SessionExpires" );
+_LIT8( KNSmlDMVoIPBrandingDataUri,           "BradingDataURI" );
+_LIT8( KNSmlDMVoIPPresenceSettingsId,        "PresenceSettingsId" );
+_LIT8( KNSmlDMVoIPUsedNatProtocol,           "UsedNATProtocol" );
+_LIT8( KNSmlDMVoIPAutoEnable,                "AutoEnable" );
+_LIT8( KNSmlDMVoIPSnapProfileId,             "SNAPProfileId" );
+_LIT8( KNSmlDMVoIPEnableIm,                  "EnableIM" );
+
+// VoIP/x/VoiceMailBox
+_LIT8( KNSmlDMVoIPVmbxNode,                  "VoiceMailBox" );
+_LIT8( KNSmlDMVoIPMwiUri,                    "MWI-URI" );
+_LIT8( KNSmlDMVoIPListeningUri,              "ListeningURI" );
+_LIT8( KNSmlDMVoIPUsedIAPId,                 "UsedIAPId" );
+_LIT8( KNSmlDMVoIPReSubscribeInterval,       "ReSubscribeInterval" );
+_LIT8( KNSmlDMVoIPUsedSIPProfileId,          "UsedSIPProfileId" );
+
+// Explanations of parameters
+_LIT8( KNSmlDMVoIPNodeNameExp,               "The interior object holds all VoIP objects" );
+_LIT8( KNSmlDMVoIPDynamicNodeExp,            "Placeholder for settings ID's" );
+_LIT8( KNSmlDMVoIPSetIDExp,                  "Settings ID number" );
+_LIT8( KNSmlDMVoIPProvIDExp,                 "Provider ID" ); 
+_LIT8( KNSmlDMVoIPNameExp,                   "Name of the settings" );
+
+// CodecSettings
+_LIT8( KNSmlDMVoIPCodecOrderExp,             "Codec order" );
+_LIT8( KNSmlDMVoIPCodecSettingsNodeExp,      "CodecSettings" );
+_LIT8( KNSmlDMVoIPCodecSettingsIdExp,        "CodecSettingsID" );
+_LIT8( KNSmlDMVoIPMediaTypeNameExp,          "MediaTypeName" );
+_LIT8( KNSmlDMVoIPMediaSubTypeNameExp,       "MediaSubTypeName" );
+_LIT8( KNSmlDMVoIPJitterBufferSizeExp,       "JitterBufferSize" );
+_LIT8( KNSmlDMVoIPOctetAlignExp,             "OctetAlign" );
+_LIT8( KNSmlDMVoIPModeSetNodeExp,            "ModeSet" );
+_LIT8( KNSmlDMVoIPModeSetIdExp,              "Mode Id" );
+_LIT8( KNSmlDMVoIPModeChangePeriodExp,       "ModeChangePeriod" );
+_LIT8( KNSmlDMVoIPModeChangeNeighborExp,     "ModeChangeNeighbor" );
+_LIT8( KNSmlDMVoIPPtimeExp,                  "Ptime" );
+_LIT8( KNSmlDMVoIPMaxPtimeExp,               "MaxPtime" );
+_LIT8( KNSmlDMVoIPVADExp,                    "Voice activation detection" );
+_LIT8( KNSmlDMVoIPAnnexBExp,                 "AnnexB" );
+_LIT8( KNSmlDMVoIPMaxRedExp,                 "Max-red" );
+
+// VoIP/x/
+_LIT8( KNSmlDMVoIPSMPortExp,                 "Start media port" );
+_LIT8( KNSmlDMVoIPEMPortExp,                 "End media port" );
+_LIT8( KNSmlDMVoIPMediaQosExp,               "Media QOS" );
+_LIT8( KNSmlDMVoIPDTMFIBExp,                 "DTMF in-band" );
+_LIT8( KNSmlDMVoIPDTMFOBExp,                 "DTMF out-band" );
+_LIT8( KNSmlDMVoIPSecureCallPrefExp,         "Secure call preference");
+_LIT8( KNSmlDMVoIPRTCPExp,                   "Real-Time Control Protocol reporting" );
+_LIT8( KNSmlDMVoIPUAHTerminalTypeExp,        "SIP VoIP User Agent header: terminal type display" );
+_LIT8( KNSmlDMVoIPUAHWLANMACExp,             "SIP VoIP User Agent header: WLAN MAC address display " );
+_LIT8( KNSmlDMVoIPUAHStringExp,              "SIP VoIP User Agent header: free string" );
+_LIT8( KNSmlDMVoIPProfileLockedToIAPExp,     "Profile locked to IAP" );
+_LIT8( KNSmlDMVoIPPluginUIDExp,              "VoIP plugin UID" );
+_LIT8( KNSmlDMVoIPAllowVoIPOverWCDMAExp,     "Allow VoIP over WCDMA" );
+_LIT8( KNSmlDMVoIPVoIPDigitsExp,             "Number of meaningful VoIP digits" );
+_LIT8( KNSmlDMVoIPURIDomainIgnoreRuleExp,    "Domain part of URI ignore rule" );
+_LIT8( KNSmlDMVoIPAutoAcceptBuddyRequestExp, "Auto-accept buddy request" );
+_LIT8( KNSmlDMVoIPUsedVoIPReleaseExp,        "Used VoIP release" );
+_LIT8( KNSmlDMVoIPAddUserPhoneExp,           "Add user=phone to all numbers" );
+_LIT8( KNSmlDMVoIPProviderBookmarkUriExp,    "Provider bookmark URI" );
+_LIT8( KNSmlDMVoIPSIPConnTestUriExp,         "SIP connectivity test URI" );
+_LIT8( KNSmlDMVoIPNatFwProfileIdExp,         "NATFW profile ID" );
+_LIT8( KNSmlDMVoIPMinSessionIntervalExp,     "Minimum value for session interval" );
+_LIT8( KNSmlDMVoIPSessionExpiresExp,         "Session interval for SIP session" );
+_LIT8( KNSmlDMVoIPBrandingDataUriExp,        "Brading data URI" );
+_LIT8( KNSmlDMVoIPPresenceSettingsIdExp,     "Presence settings ID" );
+_LIT8( KNSmlDMVoIPUsedNatProtocolExp,        "Used NAT Protocol" );
+_LIT8( KNSmlDMVoIPAutoEnableExp,             "Auto enable the service" );
+_LIT8( KNSmlDMVoIPSnapProfileIdExp,          "SNAP profile ID" );
+_LIT8( KNSmlDMVoIPEnableImExp,               "Enable IM" );
+
+// VoIP/x/VoiceMailBox
+_LIT8( KNSmlDMVoIPVmbxNodeExp,               "VoiceMailBox node" );
+_LIT8( KNSmlDMVoIPMwiUriExp,                 "MWI-URI" );
+_LIT8( KNSmlDMVoIPListeningUriExp,           "Listening-URI" );
+_LIT8( KNSmlDMVoIPUsedIAPIdExp,              "Used IAP ID" );
+_LIT8( KNSmlDMVoIPReSubscribeIntervalExp,    "Re-rubscribe interval" );
+_LIT8( KNSmlDMVoIPUsedSIPProfileIdExp,       "Used SIP profile ID" );
+
+// VoIP/x/SettingIds node
+_LIT8( KNSmlDMVoIPProfileTypeExp,            "ProfileType" ); 
+_LIT8( KNSmlDMVoIPProfileIdExp,              "ProfileId" );
+_LIT8( KNSmlDMVoIPProfileSpecificExp,        "ProfileSpecificId" );
+
+// Other
+_LIT8( KNSmlDMVoIPValueTrue,                 "True" );
+_LIT8( KNSmlDMVoIPValueFalse,                "False" );
+_LIT8( KNSmlDMVoIPValueNotSet,               "NotSet" );
+_LIT8( KNSmlDefDMSIP,                        "SIP" );
+_LIT8( KNSmlDefDMSCCP,                       "SCCP/SCCPAcc" );
+_LIT8( KNSmlDMVoIPTextPlain,                 "text/plain" );
+_LIT8( KNSmlDMVoIPSeparator,                 "/" );
+_LIT8( KNSmlVoIPUriDotSlash,                 "./");
+_LIT( KOpenParenthesis,                      "(" );
+_LIT( KClosedParenthesis,                    ")" );
+_LIT8( KDefaultSettingsName,                 "DMAdapterIns" );
+_LIT8( KNSmlDMSIPSipID,                      "SIPId" );
+_LIT8( KNSmlDMSCCPSccpID,                    "SCCPId" );
+_LIT8( KNSmlDMNATFWDomain,                   "NATFW/DomainSpecific" );
+_LIT8( KNSmlDMPresence,                      "OMA_PRESENCE" );
+_LIT8( KNSmlDMSnapUriPrefix,                 "BearerManagementSNAP" );
+const TInt KSixSegs   = 6;
+const TInt KFiveSegs  = 5;
+const TInt KFourSegs  = 4;
+const TInt KThreeSegs = 3;
+const TInt KTwoSegs   = 2;
+
+const TUint8 KDMVoIPSeparator = '/';
+
+// VoiceMailBox related constants.
+const TInt KDefaultReSubscribe = 600;
+// IM related constants.
+const TUint32 KIMSubServicePluginId = 0x1027545A; // KSIPConnectivityPluginImplUid
+const TUint32 KIMLaunchUid          = 0x200255D0;
+const TInt    KIMSettingsId         = 1;
+// Default IM message tone
+_LIT( KDefaultTone,       "Message 2.aac" );
+
+// Bearer related constants
+const TUint32 KBearerNotSpecified = 0;
+const TUint32 KBearerWlanOnly = 1;
+const TUint32 KBearerCellularOnly = 2;
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::ConstructL()
+    {
+    DBG_PRINT( "CNSmlDmVoIPAdapter::ConstructL(): begin" );
+    // Check VoIP support from feature manager
+    FeatureManager::InitializeLibL();
+    TBool support = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
+    FeatureManager::UnInitializeLib();
+
+    if ( !support )
+        {
+        DBG_PRINT( "CNSmlDmVoIPAdapter::ConstructL(): no support" );        
+        User::Leave( KErrNotSupported );
+        }
+    DBG_PRINT( "CNSmlDmVoIPAdapter::ConstructL(): end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter* CNSmlDmVoIPAdapter::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CNSmlDmVoIPAdapter* CNSmlDmVoIPAdapter::NewL(
+    MSmlDmCallback* aDmCallback )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::NewL(): begin");
+    CNSmlDmVoIPAdapter* self = new (ELeave) CNSmlDmVoIPAdapter( aDmCallback );
+    self->ConstructL();
+    self->iDmCallback = aDmCallback;
+    DBG_PRINT("CNSmlDmVoIPAdapter::NewL(): end");
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::~CNSmlDmVoIPAdapter
+// ---------------------------------------------------------------------------
+//
+CNSmlDmVoIPAdapter::~CNSmlDmVoIPAdapter()
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::~CNSmlDmVoIPAdapter(): begin");
+
+    iCodecEntries.ResetAndDestroy();
+    iCodecEntries.Close();
+
+    iProfileEntries.ResetAndDestroy();
+    iProfileEntries.Close();
+
+    if ( iCRCSEAudioCodec )
+        {
+        delete iCRCSEAudioCodec;
+        }
+
+    if ( iCRCSEProfile )
+        {
+        delete iCRCSEProfile; 
+        }
+    delete iTempProfileIdObject;
+    iProfileModifs.Close();
+    iCodecModifs.Close();
+
+    iSPSettings.ResetAndDestroy();
+    iSPSettings.Close();
+
+    DBG_PRINT("CNSmlDmVoIPAdapter::~CNSmlDmVoIPAdapter(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::LoadProfilesL
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::LoadProfilesL()
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::LoadProfilesL(): begin");
+
+    if ( !iCRCSEProfile )
+        {
+        iCRCSEProfile = CRCSEProfileRegistry::NewL();
+        }
+
+    if ( !iCRCSEAudioCodec )
+        {
+        iCRCSEAudioCodec = CRCSEAudioCodecRegistry::NewL();
+        }
+
+    // Load profiles to pointerarray
+    RArray<TUint32> allIds;
+    iCRCSEProfile->GetAllIdsL( allIds ); 
+    TInt idCount = allIds.Count();
+    for ( TInt counter = 0; counter < idCount; counter++ )
+        {
+        CRCSEProfileEntry* profile = CRCSEProfileEntry::NewLC();
+        iCRCSEProfile->FindL( allIds[counter], *profile );
+        // Ownership change to iProfileEntries:
+        iProfileEntries.AppendL( profile );
+        CleanupStack::Pop( profile );
+        }
+
+    allIds.Reset();
+
+    // Load audio codecs information to pointerarray
+    iCRCSEAudioCodec->GetAllCodecIdsL( allIds );
+    idCount = allIds.Count();
+    for ( TInt counter = 0; counter < idCount; counter++ )
+        {
+        CRCSEAudioCodecEntry* codec = CRCSEAudioCodecEntry::NewLC();
+        iCRCSEAudioCodec->FindL( allIds[counter], *codec );
+        // Ownership change to iCodecEntries:
+        iCodecEntries.AppendL( codec );
+        CleanupStack::Pop( codec );
+        }
+    allIds.Close();
+    DBG_PRINT("CNSmlDmVoIPAdapter::LoadProfilesL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::CNSmlDmVoIPAdapter
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CNSmlDmVoIPAdapter::CNSmlDmVoIPAdapter( TAny* aEcomArguments ):
+    CSmlDmAdapter( aEcomArguments )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::CNSmlDmVoIPAdapter(aEcomArguments): begin");
+    DBG_PRINT("CNSmlDmVoIPAdapter::CNSmlDmVoIPAdapter(aEcomArguments): end");   
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::DDFVersionL
+// Inserts DDF version of the adapter to aDDFVersion
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::DDFVersionL( CBufBase& aDDFVersion )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::DDFVersionL(TDes& aDDFVersion): begin");
+    aDDFVersion.InsertL( 0, KNSmlDMVoIPDDFVersion );
+    DBG_PRINT("CNSmlDmVoIPAdapter::DDFVersionL(TDes& aDDFVersion): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::DDFStructureL
+// Builds the DDF structure of adapter
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::DDFStructureL( MSmlDmDDFObject& aDDF )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::DDFStructureL(): begin");
+
+    TSmlDmAccessTypes accessTypesGet;
+    accessTypesGet.SetGet();
+
+    TSmlDmAccessTypes accessTypesGetAdd;
+    accessTypesGetAdd.SetGet();
+    accessTypesGetAdd.SetAdd();
+
+    TSmlDmAccessTypes accessTypesGetReplaceAdd;
+    accessTypesGetReplaceAdd.SetGet();
+    accessTypesGetReplaceAdd.SetReplace();
+    accessTypesGetReplaceAdd.SetAdd();
+
+    TSmlDmAccessTypes accessTypesAll;
+    accessTypesAll.SetGet();
+    accessTypesAll.SetDelete();
+    accessTypesAll.SetAdd();
+    accessTypesAll.SetReplace();
+
+    // VoIP
+    MSmlDmDDFObject& voip = aDDF.AddChildObjectL( KNSmlDMVoIPNodeName );
+    voip.SetAccessTypesL( accessTypesGetAdd );
+    voip.SetOccurenceL( MSmlDmDDFObject::EOne );
+    voip.SetScopeL( MSmlDmDDFObject::EPermanent );
+    voip.SetDFFormatL( MSmlDmDDFObject::ENode );
+    voip.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    voip.SetDescriptionL( KNSmlDMVoIPNodeNameExp );
+
+    // dynamic settings ID node
+    MSmlDmDDFObject& idNode = voip.AddChildObjectGroupL();
+    idNode.SetAccessTypesL( accessTypesAll );
+    idNode.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
+    idNode.SetScopeL( MSmlDmDDFObject::EDynamic );
+    idNode.SetDFFormatL( MSmlDmDDFObject::ENode );
+    idNode.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    idNode.SetDescriptionL( KNSmlDMVoIPDynamicNode );
+
+    // VoIPId
+    MSmlDmDDFObject& setID = idNode.AddChildObjectL( 
+        KNSmlDMVoIPSetID );
+    setID.SetAccessTypesL( accessTypesGet );
+    setID.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    setID.SetScopeL( MSmlDmDDFObject::EDynamic );
+    setID.SetDFFormatL( MSmlDmDDFObject::EInt );
+    setID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    setID.SetDescriptionL( KNSmlDMVoIPSetIDExp );
+
+    // ProviderName
+    MSmlDmDDFObject& provID = idNode.AddChildObjectL( 
+        KNSmlDMVoIPProvID );
+    provID.SetAccessTypesL( accessTypesGetReplaceAdd );
+    provID.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    provID.SetScopeL( MSmlDmDDFObject::EDynamic );
+    provID.SetDFFormatL( MSmlDmDDFObject::EChr );
+    provID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    provID.SetDescriptionL( KNSmlDMVoIPProvIDExp );
+
+    // SettingsName
+    MSmlDmDDFObject& name = idNode.AddChildObjectL( 
+        KNSmlDMVoIPName );
+    name.SetAccessTypesL( accessTypesGetReplaceAdd );
+    name.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    name.SetScopeL( MSmlDmDDFObject::EDynamic );
+    name.SetDFFormatL( MSmlDmDDFObject::EChr );
+    name.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    name.SetDescriptionL( KNSmlDMVoIPNameExp );
+
+    // PreferredCodecs node
+    MSmlDmDDFObject& codecOrder = idNode.AddChildObjectL( 
+        KNSmlDMVoIPPreferredCodecsNode );
+    codecOrder.SetAccessTypesL( accessTypesGet );
+    codecOrder.SetOccurenceL( MSmlDmDDFObject::EOne );
+    codecOrder.SetScopeL( MSmlDmDDFObject::EDynamic );
+    codecOrder.SetDFFormatL( MSmlDmDDFObject::ENode );
+    codecOrder.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    codecOrder.SetDescriptionL( KNSmlDMVoIPCodecOrderExp );
+
+    // PreferredCodecs dynamic
+    MSmlDmDDFObject& codecDyn = codecOrder.AddChildObjectGroupL();
+    codecDyn.SetAccessTypesL( accessTypesGet );
+    codecDyn.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
+    codecDyn.SetScopeL( MSmlDmDDFObject::EDynamic );
+    codecDyn.SetDFFormatL( MSmlDmDDFObject::ENode );
+    codecDyn.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    codecDyn.SetDescriptionL( KNSmlDMVoIPCodecOrderExp );
+
+    // PreferredCodecs/PreferredCodecId
+    MSmlDmDDFObject& preferredCodecID = codecDyn.AddChildObjectL( 
+        KNSmlDMVoIPPreferredCodecId );
+    preferredCodecID.SetAccessTypesL( accessTypesGetReplaceAdd );
+    preferredCodecID.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    preferredCodecID.SetScopeL( MSmlDmDDFObject::EDynamic );
+    preferredCodecID.SetDFFormatL( MSmlDmDDFObject::EInt );
+    preferredCodecID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    preferredCodecID.SetDescriptionL( KNSmlDMVoIPCodecSettingsIdExp );
+
+    // CodecSettings node
+    MSmlDmDDFObject& codecNode = idNode.AddChildObjectL( 
+        KNSmlDMVoIPCodecSettingsNode );
+    codecNode.SetAccessTypesL( accessTypesGetAdd );
+    codecNode.SetOccurenceL( MSmlDmDDFObject::EOne );
+    codecNode.SetScopeL( MSmlDmDDFObject::EDynamic );
+    codecNode.SetDFFormatL( MSmlDmDDFObject::ENode );
+    codecNode.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    codecNode.SetDescriptionL( KNSmlDMVoIPCodecSettingsNodeExp );
+
+    // CodecSettings dynamic
+    MSmlDmDDFObject& codecSetDyn = codecNode.AddChildObjectGroupL();
+    codecSetDyn.SetAccessTypesL( accessTypesAll );
+    codecSetDyn.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
+    codecSetDyn.SetScopeL( MSmlDmDDFObject::EDynamic );
+    codecSetDyn.SetDFFormatL( MSmlDmDDFObject::ENode );
+    codecSetDyn.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    codecSetDyn.SetDescriptionL( KNSmlDMVoIPDynamicNodeExp );
+
+    // CodecSettings/VoIPCodecId
+    MSmlDmDDFObject& codecsetID = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPCodecId );
+    codecsetID.SetAccessTypesL( accessTypesGet );
+    codecsetID.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    codecsetID.SetScopeL( MSmlDmDDFObject::EDynamic );
+    codecsetID.SetDFFormatL( MSmlDmDDFObject::EInt );
+    codecsetID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    codecsetID.SetDescriptionL( KNSmlDMVoIPCodecSettingsIdExp );
+
+    // CodecSettings/MediaTypeName
+    MSmlDmDDFObject& mediaTypeName = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPMediaTypeName );
+    mediaTypeName.SetAccessTypesL( accessTypesGetReplaceAdd );
+    mediaTypeName.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    mediaTypeName.SetScopeL( MSmlDmDDFObject::EDynamic );
+    mediaTypeName.SetDFFormatL( MSmlDmDDFObject::EChr );
+    mediaTypeName.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    mediaTypeName.SetDescriptionL( KNSmlDMVoIPMediaTypeNameExp );
+
+    // CodecSettings/MediaSubTypeName
+    MSmlDmDDFObject& mediaSubTypeName = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPMediaSubTypeName );
+    mediaSubTypeName.SetAccessTypesL( accessTypesGetReplaceAdd );
+    mediaSubTypeName.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    mediaSubTypeName.SetScopeL( MSmlDmDDFObject::EDynamic );
+    mediaSubTypeName.SetDFFormatL( MSmlDmDDFObject::EChr );
+    mediaSubTypeName.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    mediaSubTypeName.SetDescriptionL( KNSmlDMVoIPMediaSubTypeNameExp );
+
+     // CodecSettings/JitterBufferSize
+    MSmlDmDDFObject& jitterBufferSize = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPJitterBufferSize );
+    jitterBufferSize.SetAccessTypesL( accessTypesGetReplaceAdd );
+    jitterBufferSize.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    jitterBufferSize.SetScopeL( MSmlDmDDFObject::EDynamic );
+    jitterBufferSize.SetDFFormatL( MSmlDmDDFObject::EInt );
+    jitterBufferSize.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    jitterBufferSize.SetDescriptionL( KNSmlDMVoIPJitterBufferSizeExp );
+
+     // CodecSettings/OctetAlign
+    MSmlDmDDFObject& octetAlign = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPOctetAlign );
+    octetAlign.SetAccessTypesL( accessTypesGetReplaceAdd );
+    octetAlign.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    octetAlign.SetScopeL( MSmlDmDDFObject::EDynamic );
+    octetAlign.SetDFFormatL( MSmlDmDDFObject::EBool );
+    octetAlign.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    octetAlign.SetDescriptionL( KNSmlDMVoIPOctetAlignExp );
+
+    // CodecSettings/ModeSet node
+    MSmlDmDDFObject& modeSetNode = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPModeSetNode );
+    modeSetNode.SetAccessTypesL( accessTypesGetAdd );
+    modeSetNode.SetOccurenceL( MSmlDmDDFObject::EOne );
+    modeSetNode.SetScopeL( MSmlDmDDFObject::EDynamic );
+    modeSetNode.SetDFFormatL( MSmlDmDDFObject::ENode );
+    modeSetNode.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    modeSetNode.SetDescriptionL( KNSmlDMVoIPModeSetNodeExp );
+
+    // ModeSet dynamic
+    MSmlDmDDFObject& modeSetDyn = modeSetNode.AddChildObjectGroupL();
+    modeSetDyn.SetAccessTypesL( accessTypesAll );
+    modeSetDyn.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
+    modeSetDyn.SetScopeL( MSmlDmDDFObject::EDynamic );
+    modeSetDyn.SetDFFormatL( MSmlDmDDFObject::ENode );
+    modeSetDyn.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    modeSetDyn.SetDescriptionL( KNSmlDMVoIPModeSetIdExp );
+
+     // ModeSet/x/Mode
+    MSmlDmDDFObject& modeSetId = modeSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPMode );
+    modeSetId.SetAccessTypesL( accessTypesGetReplaceAdd );
+    modeSetId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    modeSetId.SetScopeL( MSmlDmDDFObject::EDynamic );
+    modeSetId.SetDFFormatL( MSmlDmDDFObject::EInt );  // int
+    modeSetId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    modeSetId.SetDescriptionL( KNSmlDMVoIPModeChangePeriodExp );
+
+     // CodecSettings/ModeChangePeriod
+    MSmlDmDDFObject& modeChangePer = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPModeChangePeriod );
+    modeChangePer.SetAccessTypesL( accessTypesGetReplaceAdd );
+    modeChangePer.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    modeChangePer.SetScopeL( MSmlDmDDFObject::EDynamic );
+    modeChangePer.SetDFFormatL( MSmlDmDDFObject::EInt );
+    modeChangePer.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    modeChangePer.SetDescriptionL( KNSmlDMVoIPModeChangePeriodExp );
+
+     // CodecSettings/ModeChangeNeighbor
+    MSmlDmDDFObject& modeChange = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPModeChangeNeighbor );
+    modeChange.SetAccessTypesL( accessTypesGetReplaceAdd );
+    modeChange.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    modeChange.SetScopeL( MSmlDmDDFObject::EDynamic );
+    modeChange.SetDFFormatL( MSmlDmDDFObject::EBool );
+    modeChange.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    modeChange.SetDescriptionL( KNSmlDMVoIPModeChangeNeighborExp );
+
+     // CodecSettings/Ptime
+    MSmlDmDDFObject& ptime = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPPtime );
+    ptime.SetAccessTypesL( accessTypesGetReplaceAdd );
+    ptime.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    ptime.SetScopeL( MSmlDmDDFObject::EDynamic );
+    ptime.SetDFFormatL( MSmlDmDDFObject::EInt );  // int
+    ptime.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    ptime.SetDescriptionL( KNSmlDMVoIPPtimeExp );
+
+     // CodecSettings/MaxPtime
+    MSmlDmDDFObject& maxptime = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPMaxPtime );
+    maxptime.SetAccessTypesL( accessTypesGetReplaceAdd );
+    maxptime.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    maxptime.SetScopeL( MSmlDmDDFObject::EDynamic );
+    maxptime.SetDFFormatL( MSmlDmDDFObject::EInt );
+    maxptime.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    maxptime.SetDescriptionL( KNSmlDMVoIPMaxPtimeExp );
+
+     // CodecSettings/VAD
+    MSmlDmDDFObject& vad = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPVAD );
+    vad.SetAccessTypesL( accessTypesGetReplaceAdd );
+    vad.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    vad.SetScopeL( MSmlDmDDFObject::EDynamic );
+    vad.SetDFFormatL( MSmlDmDDFObject::EBool ); // bool
+    vad.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    vad.SetDescriptionL( KNSmlDMVoIPVADExp );
+
+    // CodecSettings/AnnexB
+    MSmlDmDDFObject& annexB = codecSetDyn.AddChildObjectL( 
+        KNSmlDMVoIPAnnexB );
+    annexB.SetAccessTypesL( accessTypesGetReplaceAdd );
+    annexB.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    annexB.SetScopeL( MSmlDmDDFObject::EDynamic );
+    annexB.SetDFFormatL( MSmlDmDDFObject::EBool );  // bool
+    annexB.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    annexB.SetDescriptionL( KNSmlDMVoIPAnnexBExp ); 
+
+    // CodecSettings/MaxRed
+    MSmlDmDDFObject& maxRed = codecSetDyn.AddChildObjectL(
+        KNSmlDMVoIPMaxRed );
+    maxRed.SetAccessTypesL( accessTypesGetReplaceAdd );
+    maxRed.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    maxRed.SetScopeL( MSmlDmDDFObject::EDynamic );
+    maxRed.SetDFFormatL( MSmlDmDDFObject::EInt );
+    maxRed.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    maxRed.SetDescriptionL( KNSmlDMVoIPMaxRedExp );
+
+    // SettingsIds node
+    MSmlDmDDFObject& settingIds = idNode.AddChildObjectL( 
+        KNSmlDMVoIPSettingIdsNode );
+    settingIds.SetAccessTypesL( accessTypesGetAdd );
+    settingIds.SetOccurenceL( MSmlDmDDFObject::EOne );
+    settingIds.SetScopeL( MSmlDmDDFObject::EDynamic );
+    settingIds.SetDFFormatL( MSmlDmDDFObject::ENode );
+    settingIds.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    settingIds.SetDescriptionL( KNSmlDMVoIPDynamicNode );
+
+    // settingsIds dynamic
+    MSmlDmDDFObject& settingIdsDynID = settingIds.AddChildObjectGroupL();
+    settingIdsDynID.SetAccessTypesL( accessTypesAll );
+    settingIdsDynID.SetOccurenceL( MSmlDmDDFObject::EZeroOrMore );
+    settingIdsDynID.SetScopeL( MSmlDmDDFObject::EDynamic );
+    settingIdsDynID.SetDFFormatL( MSmlDmDDFObject::ENode );
+    settingIdsDynID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    settingIdsDynID.SetDescriptionL( KNSmlDMVoIPDynamicNodeExp );
+
+    // SettingIds/ProfileType
+    MSmlDmDDFObject& profileType = settingIdsDynID.AddChildObjectL( 
+        KNSmlDMVoIPProfileType );
+    profileType.SetAccessTypesL( accessTypesGetReplaceAdd );
+    profileType.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    profileType.SetScopeL( MSmlDmDDFObject::EDynamic );
+    profileType.SetDFFormatL( MSmlDmDDFObject::EChr );
+    profileType.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    profileType.SetDescriptionL( KNSmlDMVoIPProfileTypeExp ); 
+
+    // SettingIds/ProfileId
+    MSmlDmDDFObject& profileId = settingIdsDynID.AddChildObjectL( 
+        KNSmlDMVoIPProfileId );
+    profileId.SetAccessTypesL( accessTypesGetReplaceAdd );
+    profileId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    profileId.SetScopeL( MSmlDmDDFObject::EDynamic );
+    profileId.SetDFFormatL( MSmlDmDDFObject::EChr );
+    profileId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    profileId.SetDescriptionL( KNSmlDMVoIPProfileIdExp );
+
+    // SettingIds/ProfileSpecificId
+    MSmlDmDDFObject& profileSpecific = settingIdsDynID.AddChildObjectL( 
+        KNSmlDMVoIPProfileSpecificId );
+    profileSpecific.SetAccessTypesL( accessTypesGetReplaceAdd );
+    profileSpecific.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    profileSpecific.SetScopeL( MSmlDmDDFObject::EDynamic );
+    profileSpecific.SetDFFormatL( MSmlDmDDFObject::EInt );
+    profileSpecific.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    profileSpecific.SetDescriptionL( KNSmlDMVoIPProfileSpecificExp );
+
+    // VoIP/<x>/VoiceMailBox
+    MSmlDmDDFObject& vmbx = idNode.AddChildObjectL( 
+        KNSmlDMVoIPVmbxNode );
+    vmbx.SetAccessTypesL( accessTypesGetAdd );
+    vmbx.SetOccurenceL( MSmlDmDDFObject::EOne );
+    vmbx.SetScopeL( MSmlDmDDFObject::EDynamic );
+    vmbx.SetDFFormatL( MSmlDmDDFObject::ENode );
+    vmbx.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    vmbx.SetDescriptionL( KNSmlDMVoIPVmbxNodeExp );
+
+    // VoIP/<x>/VoiceMailBox/MWI-URI
+    MSmlDmDDFObject& mwiUri = vmbx.AddChildObjectL( 
+        KNSmlDMVoIPMwiUri );
+    mwiUri.SetAccessTypesL( accessTypesGetReplaceAdd );
+    mwiUri.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    mwiUri.SetScopeL( MSmlDmDDFObject::EDynamic );
+    mwiUri.SetDFFormatL( MSmlDmDDFObject::EChr );
+    mwiUri.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    mwiUri.SetDescriptionL( KNSmlDMVoIPMwiUriExp );
+
+    // VoIP/<x>/VoiceMailBox/ListeningURI
+    MSmlDmDDFObject& listenUri = vmbx.AddChildObjectL( 
+        KNSmlDMVoIPListeningUri );
+    listenUri.SetAccessTypesL( accessTypesGetReplaceAdd );
+    listenUri.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    listenUri.SetScopeL( MSmlDmDDFObject::EDynamic );
+    listenUri.SetDFFormatL( MSmlDmDDFObject::EChr );
+    listenUri.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    listenUri.SetDescriptionL( KNSmlDMVoIPListeningUriExp );
+
+    // VoIP/<x>/VoiceMailBox/UsedIAPId
+    MSmlDmDDFObject& usedIapId = vmbx.AddChildObjectL( 
+        KNSmlDMVoIPUsedIAPId );
+    usedIapId.SetAccessTypesL( accessTypesGetReplaceAdd );
+    usedIapId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    usedIapId.SetScopeL( MSmlDmDDFObject::EDynamic );
+    usedIapId.SetDFFormatL( MSmlDmDDFObject::EChr );
+    usedIapId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    usedIapId.SetDescriptionL( KNSmlDMVoIPUsedIAPIdExp );
+
+    // VoIP/<x>/VoiceMailBox/ReSubscribeInterval
+    MSmlDmDDFObject& reSubscribe = vmbx.AddChildObjectL( 
+        KNSmlDMVoIPReSubscribeInterval );
+    reSubscribe.SetAccessTypesL( accessTypesGetReplaceAdd );
+    reSubscribe.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    reSubscribe.SetScopeL( MSmlDmDDFObject::EDynamic );
+    reSubscribe.SetDFFormatL( MSmlDmDDFObject::EInt );
+    reSubscribe.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    reSubscribe.SetDescriptionL( KNSmlDMVoIPReSubscribeIntervalExp );
+
+    // VoIP/<x>/VoiceMailBox/UsedSIPProfileId
+    MSmlDmDDFObject& sipId = vmbx.AddChildObjectL( 
+        KNSmlDMVoIPUsedSIPProfileId );
+    sipId.SetAccessTypesL( accessTypesGetReplaceAdd );
+    sipId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    sipId.SetScopeL( MSmlDmDDFObject::EDynamic );
+    sipId.SetDFFormatL( MSmlDmDDFObject::EChr );
+    sipId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    sipId.SetDescriptionL( KNSmlDMVoIPUsedSIPProfileIdExp );
+
+    // StartMediaPort
+    MSmlDmDDFObject& smport = idNode.AddChildObjectL( 
+        KNSmlDMVoIPSMPort );
+    smport.SetAccessTypesL( accessTypesGetReplaceAdd );
+    smport.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    smport.SetScopeL( MSmlDmDDFObject::EDynamic );
+    smport.SetDFFormatL( MSmlDmDDFObject::EInt );
+    smport.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    smport.SetDescriptionL( KNSmlDMVoIPSMPortExp );
+
+    // EndMediaPort
+    MSmlDmDDFObject& emport = idNode.AddChildObjectL( 
+        KNSmlDMVoIPEMPort );
+    emport.SetAccessTypesL( accessTypesGetReplaceAdd );
+    emport.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    emport.SetScopeL( MSmlDmDDFObject::EDynamic );
+    emport.SetDFFormatL( MSmlDmDDFObject::EInt );
+    emport.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    emport.SetDescriptionL( KNSmlDMVoIPEMPortExp );
+
+    // MediaQos
+    MSmlDmDDFObject& mediaQos = idNode.AddChildObjectL( 
+        KNSmlDMVoIPMediaQos );
+    mediaQos.SetAccessTypesL( accessTypesGetReplaceAdd );
+    mediaQos.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    mediaQos.SetScopeL( MSmlDmDDFObject::EDynamic );
+    mediaQos.SetDFFormatL( MSmlDmDDFObject::EInt );
+    mediaQos.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    mediaQos.SetDescriptionL( KNSmlDMVoIPMediaQosExp );
+
+    // DTMFIB
+    MSmlDmDDFObject& dtmfbib = idNode.AddChildObjectL( 
+        KNSmlDMVoIPDTMFIB );
+    dtmfbib.SetAccessTypesL( accessTypesGetReplaceAdd );
+    dtmfbib.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    dtmfbib.SetScopeL( MSmlDmDDFObject::EDynamic );
+    dtmfbib.SetDFFormatL( MSmlDmDDFObject::EBool );
+    dtmfbib.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    dtmfbib.SetDescriptionL( KNSmlDMVoIPDTMFIBExp );
+
+    // DTMFOB
+    MSmlDmDDFObject& dtmfob = idNode.AddChildObjectL( 
+        KNSmlDMVoIPDTMFOB );
+    dtmfob.SetAccessTypesL( accessTypesGetReplaceAdd );
+    dtmfob.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    dtmfob.SetScopeL( MSmlDmDDFObject::EDynamic );
+    dtmfob.SetDFFormatL( MSmlDmDDFObject::EBool );
+    dtmfob.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    dtmfob.SetDescriptionL( KNSmlDMVoIPDTMFOBExp );
+
+    // SecureCallPref
+    MSmlDmDDFObject& secureCallPref = idNode.AddChildObjectL(
+        KNSmlDMVoIPSecureCallPref );
+    secureCallPref.SetAccessTypesL( accessTypesGetReplaceAdd );
+    secureCallPref.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    secureCallPref.SetScopeL( MSmlDmDDFObject::EDynamic );
+    secureCallPref.SetDFFormatL( MSmlDmDDFObject::EInt );
+    secureCallPref.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    secureCallPref.SetDescriptionL( KNSmlDMVoIPSecureCallPrefExp );
+
+    // RTCP
+    MSmlDmDDFObject& rtcp = idNode.AddChildObjectL(
+        KNSmlDMVoIPRTCP );
+    rtcp.SetAccessTypesL( accessTypesGetReplaceAdd );
+    rtcp.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    rtcp.SetScopeL( MSmlDmDDFObject::EDynamic );
+    rtcp.SetDFFormatL( MSmlDmDDFObject::EInt );
+    rtcp.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    rtcp.SetDescriptionL( KNSmlDMVoIPRTCPExp );
+
+    // UAHTerminalType
+    MSmlDmDDFObject& uahTerminalType = idNode.AddChildObjectL(
+        KNSmlDMVoIPUAHTerminalType );
+    uahTerminalType.SetAccessTypesL( accessTypesGetReplaceAdd );
+    uahTerminalType.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    uahTerminalType.SetScopeL( MSmlDmDDFObject::EDynamic );
+    uahTerminalType.SetDFFormatL( MSmlDmDDFObject::EInt );
+    uahTerminalType.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    uahTerminalType.SetDescriptionL( KNSmlDMVoIPUAHTerminalTypeExp );
+
+    // UAHWLANMAC
+    MSmlDmDDFObject& uahWLANMAC = idNode.AddChildObjectL(
+        KNSmlDMVoIPUAHWLANMAC );
+    uahWLANMAC.SetAccessTypesL( accessTypesGetReplaceAdd );
+    uahWLANMAC.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    uahWLANMAC.SetScopeL( MSmlDmDDFObject::EDynamic );
+    uahWLANMAC.SetDFFormatL( MSmlDmDDFObject::EInt );
+    uahWLANMAC.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    uahWLANMAC.SetDescriptionL( KNSmlDMVoIPUAHWLANMACExp );
+
+    // UAHString
+    MSmlDmDDFObject& uahString = idNode.AddChildObjectL(
+        KNSmlDMVoIPUAHString );
+    uahString.SetAccessTypesL( accessTypesGetReplaceAdd );
+    uahString.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    uahString.SetScopeL( MSmlDmDDFObject::EDynamic );
+    uahString.SetDFFormatL( MSmlDmDDFObject::EChr );
+    uahString.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    uahString.SetDescriptionL( KNSmlDMVoIPUAHStringExp );
+
+    // ProfileLockedToIAP
+    MSmlDmDDFObject& profileLockedToIAP = idNode.AddChildObjectL(
+        KNSmlDMVoIPProfileLockedToIAP );
+    profileLockedToIAP.SetAccessTypesL( accessTypesGetReplaceAdd );
+    profileLockedToIAP.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    profileLockedToIAP.SetScopeL( MSmlDmDDFObject::EDynamic );
+    profileLockedToIAP.SetDFFormatL( MSmlDmDDFObject::EBool );
+    profileLockedToIAP.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    profileLockedToIAP.SetDescriptionL( KNSmlDMVoIPProfileLockedToIAPExp );
+
+    // VoIPPluginUID
+    MSmlDmDDFObject& voipPluginUID = idNode.AddChildObjectL(
+        KNSmlDMVoIPPluginUID );
+    voipPluginUID.SetAccessTypesL( accessTypesGetReplaceAdd );
+    voipPluginUID.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    voipPluginUID.SetScopeL( MSmlDmDDFObject::EDynamic );
+    voipPluginUID.SetDFFormatL( MSmlDmDDFObject::EInt );
+    voipPluginUID.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    voipPluginUID.SetDescriptionL( KNSmlDMVoIPPluginUIDExp );
+
+    // AllowVoIPOverWCDMA
+    MSmlDmDDFObject& voipOverWCDMA = idNode.AddChildObjectL(
+        KNSmlDMVoIPAllowVoIPOverWCDMA );
+    voipOverWCDMA.SetAccessTypesL( accessTypesGetReplaceAdd );
+    voipOverWCDMA.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    voipOverWCDMA.SetScopeL( MSmlDmDDFObject::EDynamic );
+    voipOverWCDMA.SetDFFormatL( MSmlDmDDFObject::EBool );
+    voipOverWCDMA.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    voipOverWCDMA.SetDescriptionL( KNSmlDMVoIPAllowVoIPOverWCDMAExp );
+
+    // VoIPDigits
+    MSmlDmDDFObject& voipDigits = idNode.AddChildObjectL(
+        KNSmlDMVoIPVoIPDigits );
+    voipDigits.SetAccessTypesL( accessTypesGetReplaceAdd );
+    voipDigits.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    voipDigits.SetScopeL( MSmlDmDDFObject::EDynamic );
+    voipDigits.SetDFFormatL( MSmlDmDDFObject::EInt );
+    voipDigits.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    voipDigits.SetDescriptionL( KNSmlDMVoIPVoIPDigitsExp );
+
+    // URIDomainIgnoreRule
+    MSmlDmDDFObject& uriDomainIgn = idNode.AddChildObjectL(
+        KNSmlDMVoIPURIDomainIgnoreRule );
+    uriDomainIgn.SetAccessTypesL( accessTypesGetReplaceAdd );
+    uriDomainIgn.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    uriDomainIgn.SetScopeL( MSmlDmDDFObject::EDynamic );
+    uriDomainIgn.SetDFFormatL( MSmlDmDDFObject::EInt );
+    uriDomainIgn.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    uriDomainIgn.SetDescriptionL( KNSmlDMVoIPURIDomainIgnoreRuleExp );
+
+    // AutoAcceptBuddyRequest
+    MSmlDmDDFObject& aaBuddyReq = idNode.AddChildObjectL(
+        KNSmlDMVoIPAutoAcceptBuddyRequest );
+    aaBuddyReq.SetAccessTypesL( accessTypesGetReplaceAdd );
+    aaBuddyReq.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    aaBuddyReq.SetScopeL( MSmlDmDDFObject::EDynamic );
+    aaBuddyReq.SetDFFormatL( MSmlDmDDFObject::EBool );
+    aaBuddyReq.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    aaBuddyReq.SetDescriptionL( KNSmlDMVoIPAutoAcceptBuddyRequestExp );
+
+    // UsedVoIPRelease
+    MSmlDmDDFObject& voipRel = idNode.AddChildObjectL(
+        KNSmlDMVoIPUsedVoIPRelease );
+    voipRel.SetAccessTypesL( accessTypesGet );
+    voipRel.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    voipRel.SetScopeL( MSmlDmDDFObject::EDynamic );
+    voipRel.SetDFFormatL( MSmlDmDDFObject::EChr );
+    voipRel.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    voipRel.SetDescriptionL( KNSmlDMVoIPUsedVoIPReleaseExp );
+
+    // AddUserPhone
+    MSmlDmDDFObject& addUserPhone = idNode.AddChildObjectL(
+        KNSmlDMVoIPAddUserPhone );
+    addUserPhone.SetAccessTypesL( accessTypesGetReplaceAdd );
+    addUserPhone.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    addUserPhone.SetScopeL( MSmlDmDDFObject::EDynamic );
+    addUserPhone.SetDFFormatL( MSmlDmDDFObject::EInt );
+    addUserPhone.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    addUserPhone.SetDescriptionL( KNSmlDMVoIPAddUserPhoneExp );
+
+    // ProviderBookmarkURI
+    MSmlDmDDFObject& providerBkmarkUri = idNode.AddChildObjectL(
+        KNSmlDMVoIPProviderBookmarkUri );
+    providerBkmarkUri.SetAccessTypesL( accessTypesGetReplaceAdd );
+    providerBkmarkUri.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    providerBkmarkUri.SetScopeL( MSmlDmDDFObject::EDynamic );
+    providerBkmarkUri.SetDFFormatL( MSmlDmDDFObject::EChr );
+    providerBkmarkUri.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    providerBkmarkUri.SetDescriptionL( KNSmlDMVoIPProviderBookmarkUriExp );
+
+    // SIPConnectivityTestURI
+    MSmlDmDDFObject& sipConnTestUri = idNode.AddChildObjectL( 
+        KNSmlDMVoIPSIPConnTestUri );
+    sipConnTestUri.SetAccessTypesL( accessTypesGetReplaceAdd );
+    sipConnTestUri.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    sipConnTestUri.SetScopeL( MSmlDmDDFObject::EDynamic );
+    sipConnTestUri.SetDFFormatL( MSmlDmDDFObject::EChr );
+    sipConnTestUri.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    sipConnTestUri.SetDescriptionL( KNSmlDMVoIPSIPConnTestUriExp );
+
+    // NATFWProfileId
+    MSmlDmDDFObject& natfwId = idNode.AddChildObjectL(
+        KNSmlDMVoIPNatFwProfileId );
+    natfwId.SetAccessTypesL( accessTypesGetReplaceAdd );
+    natfwId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    natfwId.SetScopeL( MSmlDmDDFObject::EDynamic );
+    natfwId.SetDFFormatL( MSmlDmDDFObject::EChr );
+    natfwId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    natfwId.SetDescriptionL( KNSmlDMVoIPNatFwProfileIdExp );
+
+    // MinSessionInterval
+    MSmlDmDDFObject& minSe = idNode.AddChildObjectL(
+        KNSmlDMVoIPMinSessionInterval );
+    minSe.SetAccessTypesL( accessTypesGetReplaceAdd );
+    minSe.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    minSe.SetScopeL( MSmlDmDDFObject::EDynamic );
+    minSe.SetDFFormatL( MSmlDmDDFObject::EInt );
+    minSe.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    minSe.SetDescriptionL( KNSmlDMVoIPMinSessionIntervalExp );
+
+    // SessionExpires
+    MSmlDmDDFObject& sessionExpires = idNode.AddChildObjectL(
+        KNSmlDMVoIPSessionExpires );
+    sessionExpires.SetAccessTypesL( accessTypesGetReplaceAdd );
+    sessionExpires.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    sessionExpires.SetScopeL( MSmlDmDDFObject::EDynamic );
+    sessionExpires.SetDFFormatL( MSmlDmDDFObject::EInt );
+    sessionExpires.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    sessionExpires.SetDescriptionL( KNSmlDMVoIPSessionExpiresExp );
+
+    // BradingDataURI
+    MSmlDmDDFObject& brandingUri = idNode.AddChildObjectL(
+        KNSmlDMVoIPBrandingDataUri );
+    brandingUri.SetAccessTypesL( accessTypesGetReplaceAdd );
+    brandingUri.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    brandingUri.SetScopeL( MSmlDmDDFObject::EDynamic );
+    brandingUri.SetDFFormatL( MSmlDmDDFObject::EInt );
+    brandingUri.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    brandingUri.SetDescriptionL( KNSmlDMVoIPBrandingDataUriExp );
+
+    // PresenceSettingsID
+    MSmlDmDDFObject& presenceId = idNode.AddChildObjectL(
+        KNSmlDMVoIPPresenceSettingsId );
+    presenceId.SetAccessTypesL( accessTypesGetReplaceAdd );
+    presenceId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    presenceId.SetScopeL( MSmlDmDDFObject::EDynamic );
+    presenceId.SetDFFormatL( MSmlDmDDFObject::EChr );
+    presenceId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    presenceId.SetDescriptionL( KNSmlDMVoIPPresenceSettingsIdExp );
+
+    // UsedNatProtocol
+    MSmlDmDDFObject& natProtocol = idNode.AddChildObjectL(
+        KNSmlDMVoIPUsedNatProtocol );
+    natProtocol.SetAccessTypesL( accessTypesGetReplaceAdd );
+    natProtocol.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    natProtocol.SetScopeL( MSmlDmDDFObject::EDynamic );
+    natProtocol.SetDFFormatL( MSmlDmDDFObject::EInt );
+    natProtocol.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    natProtocol.SetDescriptionL( KNSmlDMVoIPUsedNatProtocolExp );
+
+    // AutoEnableService
+    MSmlDmDDFObject& autoEnable = idNode.AddChildObjectL(
+        KNSmlDMVoIPAutoEnable );
+    autoEnable.SetAccessTypesL( accessTypesGetReplaceAdd );
+    autoEnable.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    autoEnable.SetScopeL( MSmlDmDDFObject::EDynamic );
+    autoEnable.SetDFFormatL( MSmlDmDDFObject::EBool );
+    autoEnable.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    autoEnable.SetDescriptionL( KNSmlDMVoIPAutoEnableExp );
+    
+    // SNAPProfileId
+    MSmlDmDDFObject& snapId = idNode.AddChildObjectL(
+        KNSmlDMVoIPSnapProfileId );
+    snapId.SetAccessTypesL( accessTypesGetReplaceAdd );
+    snapId.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    snapId.SetScopeL( MSmlDmDDFObject::EDynamic );
+    snapId.SetDFFormatL( MSmlDmDDFObject::EChr );
+    snapId.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    snapId.SetDescriptionL( KNSmlDMVoIPSnapProfileIdExp );
+
+    // EnableIM
+    MSmlDmDDFObject& enableIm = idNode.AddChildObjectL(
+        KNSmlDMVoIPEnableIm );
+    enableIm.SetAccessTypesL( accessTypesGetReplaceAdd );
+    enableIm.SetOccurenceL( MSmlDmDDFObject::EZeroOrOne );
+    enableIm.SetScopeL( MSmlDmDDFObject::EDynamic );
+    enableIm.SetDFFormatL( MSmlDmDDFObject::EBool );
+    enableIm.AddDFTypeMimeTypeL( KNSmlDMVoIPTextPlain );
+    enableIm.SetDescriptionL( KNSmlDMVoIPEnableImExp );
+    
+    DBG_PRINT("CNSmlDmVoIPAdapter::DDFStructureL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::UpdateLeafObjectL
+// Updates value of leaf object
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::UpdateLeafObjectL( 
+    const TDesC8& aURI, 
+    const TDesC8& aLUID, 
+    const TDesC8& aObject, 
+    const TDesC8& /*aType*/, 
+    const TInt aStatusRef )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    // Load VoIP profile information if not loaded yet
+    if ( !iProfileEntries.Count() )
+        {
+        LoadProfilesL();
+        }
+
+    CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+    TPtrC8 uriSeg = LastURISeg( aURI );
+    TPtrC8 uriTmp = RemoveLastURISeg( aURI );
+    TPtrC8 secondLastUriSeg = LastURISeg( uriTmp );
+
+    // Check that luid mapping exist 
+    if ( !aLUID.Length() )
+        {
+        iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+        DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): no LUID end");
+        return;
+        }
+
+     // Find profile and get settings
+    iProfileID = FindProfileLocation( aLUID );
+
+    // If profile is not found return error.
+    if ( KErrNotFound == iProfileID )
+        {
+        retValue = CSmlDmAdapter::ENotFound;
+        iDmCallback->SetStatusL( aStatusRef, retValue );
+        DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): not found end");
+        return;
+        }
+
+    CDMVoIPSPSettings* spSettings = CDMVoIPSPSettings::NewLC(); // CS:1
+    spSettings->iRcseProfileId = iProfileEntries[iProfileID]->iId;
+    TInt spSettingsId( KErrNotFound );
+    // Check if service provider settings for this VoIP profile are already
+    // updated to be stored.
+    for ( TInt counter = 0; counter < iSPSettings.Count(); counter++ )
+        {
+        if ( iProfileEntries[iProfileID]->iId == 
+            iSPSettings[counter]->iRcseProfileId )
+            {
+            spSettingsId = counter;
+            }
+        }
+    TBool addSpSettings( EFalse );
+
+    // Check that profile is not already to be saved.
+    if ( KErrNotFound == iProfileModifs.Find( iProfileID ) )
+        {
+        iProfileModifs.Insert( iProfileID, iProfileModifs.Count() );
+        }
+
+    // VoIP/x/ProviderName
+    if ( KNSmlDMVoIPProvID() == uriSeg )
+        {
+        CRCSEProfileEntry* tmpEntryForProvider = CRCSEProfileEntry::NewLC();
+        tmpEntryForProvider->iProviderName.Copy( aObject );
+        CheckDuplicateProviderL( *tmpEntryForProvider );
+        iProfileEntries[iProfileID]->iProviderName.Copy( 
+            tmpEntryForProvider->iProviderName );
+        CleanupStack::PopAndDestroy( tmpEntryForProvider );
+        }
+    // VoIP/x/SettingsName
+    else if ( KNSmlDMVoIPName() == uriSeg )
+        {
+        CRCSEProfileEntry* tmpEntryForName = CRCSEProfileEntry::NewLC();
+        tmpEntryForName->iSettingsName.Copy( aObject );
+        CheckDuplicateNameL( *tmpEntryForName );
+        iProfileEntries[iProfileID]->iSettingsName.Copy( 
+            tmpEntryForName->iSettingsName );
+        CleanupStack::PopAndDestroy( tmpEntryForName ); 
+        }
+    // VoIP/x/SMPort
+    else if ( KNSmlDMVoIPSMPort() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->iStartMediaPort = 
+            DesToInt( aObject );
+        }
+    // VoIP/x/EMPort
+    else if ( KNSmlDMVoIPEMPort() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->iEndMediaPort = DesToInt( aObject );
+        }
+    // VoIP/x/MediaQos
+    else if ( KNSmlDMVoIPMediaQos() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->iMediaQOS = DesToInt( aObject );
+        }
+    // VoIP/x/DTMFIB
+    else if ( KNSmlDMVoIPDTMFIB() == uriSeg )
+        {
+        if ( KNSmlDMVoIPValueTrue() == aObject )
+            {
+            iProfileEntries[iProfileID]->iInbandDTMF = CRCSEProfileEntry::EOn;
+            }
+        else if ( KNSmlDMVoIPValueFalse() == aObject )
+            {
+            iProfileEntries[iProfileID]->iInbandDTMF = 
+                CRCSEProfileEntry::EOff;
+            }
+        else
+            {
+            retValue = CSmlDmAdapter::EInvalidObject;   
+            }
+        }
+    // VoIP/x/DTMFOB
+    else if ( KNSmlDMVoIPDTMFOB() == uriSeg )
+        {
+        if ( KNSmlDMVoIPValueTrue() == aObject )
+            {
+            iProfileEntries[iProfileID]->iOutbandDTMF = 
+                CRCSEProfileEntry::EOn;
+            }
+        else if ( KNSmlDMVoIPValueFalse() == aObject )
+            {
+            iProfileEntries[iProfileID]->iOutbandDTMF = 
+                CRCSEProfileEntry::EOff;
+            }
+        else
+            {
+            retValue = CSmlDmAdapter::EInvalidObject;   
+            }
+        }
+    // VoIP/x/SecureCallPref
+    else if ( KNSmlDMVoIPSecureCallPref() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->
+            iSecureCallPreference = DesToInt( aObject );
+        }
+    // VoIP/x/RTCP
+    else if ( KNSmlDMVoIPRTCP() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->iRTCP = DesToInt( aObject );
+        }
+    // VoIP/x/UAHTerminalType
+    else if ( KNSmlDMVoIPUAHTerminalType() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->
+            iSIPVoIPUAHTerminalType = DesToInt( aObject );
+        }
+    // VoIP/x/UAHWLANMAC
+    else if ( KNSmlDMVoIPUAHWLANMAC() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->
+            iSIPVoIPUAHeaderWLANMAC = DesToInt( aObject );
+        }
+    // VoIP/x/UAHString
+    else if ( KNSmlDMVoIPUAHString() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->
+            iSIPVoIPUAHeaderString.Copy( aObject );
+        }
+    // VoIP/x/ProfileLockedToIAP
+    else if ( KNSmlDMVoIPProfileLockedToIAP() == uriSeg )
+        {
+        if ( KNSmlDMVoIPValueTrue() == aObject )
+            {
+            iProfileEntries[iProfileID]->
+                iProfileLockedToIAP = CRCSEProfileEntry::EOn;
+            }
+        else if ( KNSmlDMVoIPValueFalse() == aObject )
+            {
+            iProfileEntries[iProfileID]->
+                iProfileLockedToIAP = CRCSEProfileEntry::EOff;
+            }
+        else
+            {
+            retValue = CSmlDmAdapter::EInvalidObject;   
+            }
+        }
+    // VoIP/x/VoIPPluginUID
+    else if ( KNSmlDMVoIPPluginUID() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->iVoIPPluginUID = 
+            DesToTUint( aObject );
+        }
+    // VoIP/x/AllowVoIPOverWCDMA
+    else if ( KNSmlDMVoIPAllowVoIPOverWCDMA() == uriSeg )
+        {
+        if ( KNSmlDMVoIPValueTrue() == aObject )
+            {
+            iProfileEntries[iProfileID]->
+                iAllowVoIPoverWCDMA = CRCSEProfileEntry::EOn;
+            }
+        else if ( KNSmlDMVoIPValueFalse() == aObject )
+            {
+            iProfileEntries[iProfileID]->
+                iAllowVoIPoverWCDMA = CRCSEProfileEntry::EOff;
+            }
+        else
+            {
+            retValue = CSmlDmAdapter::EInvalidObject;   
+            }
+        iAllowVoIPOverWCDMAModified = ETrue; 
+        }
+    // VoIP/x/VoIPDigits
+    else if ( KNSmlDMVoIPVoIPDigits() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->iMeanCountOfVoIPDigits = 
+            DesToInt( aObject );
+        }
+    // VoIP/x/URIDomainIgnoreRule
+    else if ( KNSmlDMVoIPURIDomainIgnoreRule() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->iIgnoreAddrDomainPart = 
+            DesToInt( aObject );
+        }
+    // VoIP/x/AddUserPhone
+    else if ( KNSmlDMVoIPAddUserPhone() == uriSeg )
+        {
+        if ( KNSmlDMVoIPValueFalse() == aObject )
+            {
+            iProfileEntries[iProfileID]->iUserPhoneUriParameter =
+            CRCSEProfileEntry::EOff;
+            }
+        else if ( KNSmlDMVoIPValueTrue() == aObject )
+            {
+            iProfileEntries[iProfileID]->iUserPhoneUriParameter =
+            CRCSEProfileEntry::EOn;
+            }
+        else
+            {
+            retValue = CSmlDmAdapter::EInvalidObject;
+            }
+        }
+    // VoIP/x/ProviderBookmarkURI
+    else if ( KNSmlDMVoIPProviderBookmarkUri() == uriSeg )
+        {
+        if ( KErrNotFound == spSettingsId )
+            {
+            delete spSettings->iServiceProviderBookmark;
+            spSettings->iServiceProviderBookmark = NULL;
+            spSettings->iServiceProviderBookmark = HBufC::NewL( 
+                aObject.Length() );
+            spSettings->iServiceProviderBookmark->Des().Copy( aObject );
+            addSpSettings = ETrue;
+            }
+        else
+            {
+            delete iSPSettings[spSettingsId]->iServiceProviderBookmark;
+            iSPSettings[spSettingsId]->iServiceProviderBookmark = NULL;
+            iSPSettings[spSettingsId]->iServiceProviderBookmark = HBufC::NewL(
+                aObject.Length() );
+            iSPSettings[spSettingsId]->iServiceProviderBookmark->Des().Copy( 
+                aObject );
+            }
+        }
+    // VoIP/x/SIPConnectivityTestURI
+    else if ( KNSmlDMVoIPSIPConnTestUri() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->iSIPConnTestAddress.Copy( 
+            aObject );
+        }
+    // VoIP/x/NATFWProfileId
+    else if ( KNSmlDMVoIPNatFwProfileId() == uriSeg )
+        {
+        TUint32 natId = NatFwIdL( aObject );
+        if ( KErrNone == natId )
+            {
+            retValue = CSmlDmAdapter::EInvalidObject;
+            }
+        else
+            {
+            iProfileEntries[iProfileID]->iNATSettingsStorageId = natId;
+            }
+        }
+    // VoIP/x/MinSessionInterval
+    else if ( KNSmlDMVoIPMinSessionInterval() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->iSIPMinSE = DesToInt( aObject );
+        }
+    // VoIP/x/SessionExpires
+    else if ( KNSmlDMVoIPSessionExpires() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->iSIPSessionExpires = 
+            DesToInt( aObject );
+        }
+    // VoIP/x/BradingDataURI
+    else if ( KNSmlDMVoIPBrandingDataUri() == uriSeg )
+        {
+        if ( KErrNotFound == spSettingsId )
+            {
+            delete spSettings->iBrandingDataUri;
+            spSettings->iBrandingDataUri = NULL;
+            spSettings->iBrandingDataUri = HBufC::NewL( aObject.Length() );
+            spSettings->iBrandingDataUri->Des().Copy( aObject );
+            addSpSettings = ETrue;
+            }
+        else
+            {
+            delete iSPSettings[spSettingsId]->iBrandingDataUri;
+            iSPSettings[spSettingsId]->iBrandingDataUri = NULL;
+            iSPSettings[spSettingsId]->iBrandingDataUri = 
+                HBufC::NewL( aObject.Length() );
+            iSPSettings[spSettingsId]->iBrandingDataUri->Des().Copy( 
+                aObject );
+            }
+        }
+    // VoIP/x/PresenceSettingsID
+    else if ( KNSmlDMVoIPPresenceSettingsId() == uriSeg )
+        {
+        if ( KErrNotFound == spSettingsId )
+            {
+            spSettings->iPresenceId = PresenceIdL( aObject );
+            addSpSettings = ETrue;
+            }
+        else
+            {
+            iSPSettings[spSettingsId]->iPresenceId = PresenceIdL( aObject );
+            }
+        }
+    // VoIP/x/UsedNATProtocol
+    else if ( KNSmlDMVoIPUsedNatProtocol() == uriSeg )
+        {
+        iProfileEntries[iProfileID]->iNATProtocol = DesToInt( aObject );
+        }
+    // VoIP/x/AutoEnable
+    else if ( KNSmlDMVoIPAutoEnable() == uriSeg )
+        {
+        if ( KErrNotFound == spSettingsId )
+            {
+            spSettings->iAutoEnableService = DesToInt( aObject );
+            addSpSettings = ETrue;
+            }
+        else
+            {
+            iSPSettings[spSettingsId]->iAutoEnableService =  
+                DesToInt( aObject );
+            }
+        }
+    // VoIP/x/SNAPProfileId
+    else if ( KNSmlDMVoIPSnapProfileId() == uriSeg )
+        {
+        if ( KErrNotFound == spSettingsId )
+            {
+            spSettings->iSnapId = SnapIdL( aObject );
+            addSpSettings = ETrue;
+            }
+        else
+            {
+            iSPSettings[spSettingsId]->iSnapId = SnapIdL( aObject );
+            }
+        }
+    // VoIP/x/EnableIM
+    else if ( KNSmlDMVoIPEnableIm() == uriSeg )
+        {
+        if ( KErrNotFound == spSettingsId )
+            {
+            if ( KNSmlDMVoIPValueFalse() == aObject )
+                {
+                spSettings->iImEnabled = EFalse;
+                addSpSettings = ETrue;
+                }
+            else if ( KNSmlDMVoIPValueTrue() == aObject )
+                {
+                spSettings->iImEnabled = ETrue;
+                addSpSettings = ETrue;
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EInvalidObject;
+                }
+            }
+        else
+            {
+            if ( KNSmlDMVoIPValueFalse() == aObject )
+                {
+                iSPSettings[spSettingsId]->iImEnabled = EFalse;
+                }
+            else if ( KNSmlDMVoIPValueTrue() == aObject )
+                {
+                iSPSettings[spSettingsId]->iImEnabled = ETrue;
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EInvalidObject;
+                }
+            }
+        }
+
+    // ==============================
+    // SettingIds node (update)
+    // ==============================
+    //
+
+    // VoIP/x/SettingIds
+    if ( KNSmlDMVoIPSettingId() == LastURISeg( aLUID ).Left( 
+        KNSmlDMVoIPSettingId().Length() ) 
+        && KFiveSegs == NumOfURISegs( aURI ) )
+        {
+        retValue = UpdateSettingIdsSpecificObjectL( aLUID, uriSeg, aObject );
+        }
+
+    // ==============================
+    // PreferredCodecs node (update)
+    // ==============================
+    //
+
+    // VoIP/x/PreferredCodecs node
+    if ( KNSmlDMVoIPPreferredCodecId() == uriSeg
+        && KFiveSegs == NumOfURISegs( aURI ) ) 
+        {
+        // Check that codec ID is found from codec entries before setting it.
+        // Preferred codec ID setting is only for knowing and changing an
+        // already existing codec priority.
+        if ( FindCodecLocation( DesToInt( aObject ) ) != KErrNotFound &&
+            DesToInt( aLUID.Right( 10 ) ) <= iProfileEntries[iProfileID]->
+            iPreferredCodecs.Count() )
+            {
+            iProfileEntries[iProfileID]->iPreferredCodecs[ 
+                DesToInt( aLUID.Right( 10 ))] = DesToInt( aObject );
+            }
+        else
+            {
+            // Codec is not found from codecsettings or
+            // invalid LUID is passed to the adapter.
+            retValue = CSmlDmAdapter::EInvalidObject;
+            }
+
+        }
+
+    // ==============================
+    // CodecSettings node (update)
+    // ==============================
+    //
+    if ( KNSmlDMVoIPCodecSettingsId() == LastURISeg( aLUID ).
+        Left( KNSmlDMVoIPCodecSettingsId().Length() )
+        && KFiveSegs == NumOfURISegs( aURI ) )
+        {
+        retValue = UpdateCodecSpecificObject( aLUID, uriSeg, aObject );
+        }
+
+    // ==============================
+    // VoiceMailBox node (update)
+    // ==============================
+    //
+    if ( KNSmlDMVoIPVmbxNode() == secondLastUriSeg && 
+        KFourSegs == NumOfURISegs( aURI ) )
+        {
+        if ( KNSmlDMVoIPMwiUri() == uriSeg )
+            {
+            if ( KErrNotFound == spSettingsId )
+                {
+                delete spSettings->iVmbxMwiUri;
+                spSettings->iVmbxMwiUri = NULL;
+                spSettings->iVmbxMwiUri = HBufC::NewL( aObject.Length() );
+                spSettings->iVmbxMwiUri->Des().Copy( aObject );
+                addSpSettings = ETrue;
+                }
+            else
+                {
+                delete iSPSettings[spSettingsId]->iVmbxMwiUri;
+                iSPSettings[spSettingsId]->iVmbxMwiUri = NULL;
+                iSPSettings[spSettingsId]->iVmbxMwiUri = HBufC::NewL( 
+                    aObject.Length() );
+                iSPSettings[spSettingsId]->iVmbxMwiUri->Des().Copy( aObject );
+                }
+            }
+        else if ( KNSmlDMVoIPListeningUri() == uriSeg )
+            {
+            if ( KErrNotFound == spSettingsId )
+                {
+                delete spSettings->iVmbxListenUri;
+                spSettings->iVmbxListenUri = NULL;
+                spSettings->iVmbxListenUri = HBufC::NewL( aObject.Length() );
+                spSettings->iVmbxListenUri->Des().Copy( aObject );
+                addSpSettings = ETrue;
+                }
+            else
+                {
+                delete iSPSettings[spSettingsId]->iVmbxListenUri;
+                iSPSettings[spSettingsId]->iVmbxListenUri = NULL;
+                iSPSettings[spSettingsId]->iVmbxListenUri = HBufC::NewL( 
+                    aObject.Length() );
+                iSPSettings[spSettingsId]->iVmbxListenUri->Des().Copy( 
+                    aObject );
+                }
+            }
+        else if ( KNSmlDMVoIPUsedIAPId() == uriSeg )
+            {
+            TInt iapId = ConRefL( aObject );
+            if ( KErrNotFound == iapId )
+                {
+                retValue = CSmlDmAdapter::EInvalidObject;
+                }
+            else
+                {
+                if ( KErrNotFound == spSettingsId )
+                    {
+                    spSettings->iVmbxIapId = iapId;
+                    addSpSettings = ETrue;
+                    }
+                else
+                    {
+                    iSPSettings[spSettingsId]->iVmbxIapId = iapId;
+                    }
+                }
+            }
+        else if ( KNSmlDMVoIPReSubscribeInterval() == uriSeg )
+            {
+            if ( KErrNotFound == spSettingsId )
+                {
+                spSettings->iReSubscribeInterval = DesToInt( aObject );
+                addSpSettings = ETrue;
+                }
+            else
+                {
+                iSPSettings[spSettingsId]->iReSubscribeInterval = 
+                    DesToInt( aObject );
+                }
+            }
+        else if ( KNSmlDMVoIPUsedSIPProfileId() == uriSeg )
+            {
+            TUint32 profileId = SetSipRefL( aObject ); 
+            if ( profileId > 0 )
+                {
+                if ( KErrNotFound == spSettingsId )
+                    {
+                    spSettings->iVmbxSipId = profileId;
+                    addSpSettings = ETrue;
+                    }
+                else
+                    {
+                    iSPSettings[spSettingsId]->iVmbxSipId = profileId;
+                    }
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EInvalidObject;
+                }
+            }
+        else if ( KNSmlDMVoIPAutoAcceptBuddyRequest() == uriSeg )
+            {
+            if ( KErrNotFound == spSettingsId )
+                {
+                spSettings->iAutoAcceptBuddy = DesToInt( aObject );
+                addSpSettings = ETrue;
+                }
+            else
+                {
+                iSPSettings[spSettingsId]->iAutoAcceptBuddy = 
+                    DesToInt( aObject );
+                }
+            }
+        else
+            {
+            retValue = CSmlDmAdapter::EInvalidObject;
+            }
+        }
+
+    if ( addSpSettings )
+        {
+        // Append Service Provider Settings to array for saving them later.
+        // iSPSettings array will own the object now. 
+        iSPSettings.AppendL( spSettings );
+        CleanupStack::Pop( spSettings ); // CS:0
+        }
+    else
+        {
+        // Local Service Provider Settings not needed.
+        CleanupStack::PopAndDestroy( spSettings ); // CS:0
+        }
+
+    iDmCallback->SetStatusL( aStatusRef, retValue );
+
+    DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): end");
+    }
+    
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::UpdateCodecSpecificObject
+// Updates Codec specific object.
+// ---------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CNSmlDmVoIPAdapter::UpdateCodecSpecificObject(
+    const TDesC8& aLUID, const TDesC8& aUriSeg, const TDesC8& aObject )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::UpdateCodecSpecificObject(): begin");
+
+    CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+
+    // Get codec ID used by these settings.
+    TUint32 codecId = DesToInt( aLUID.Right( 10 ) );
+    TInt codecPos = FindCodecLocation( codecId );
+    if ( KErrNotFound != codecPos )
+        {
+        // Add profile to be saved if not done already.
+        if ( KErrNotFound == iCodecModifs.Find( codecPos ) )
+            {
+            iCodecModifs.Insert( codecPos, iCodecModifs.Count() );
+            }
+        //CodecId
+        if ( KNSmlDMVoIPCodecId() == aUriSeg ) 
+            {
+            iCodecEntries[codecPos]->iCodecId = DesToInt( aObject );
+            }
+        //MediaTypeName
+        if ( KNSmlDMVoIPMediaTypeName() == aUriSeg ) 
+            {
+            iCodecEntries[codecPos]->iMediaTypeName.Copy( aObject );
+            }
+        //MediaSubTypeName
+        if ( KNSmlDMVoIPMediaSubTypeName() == aUriSeg ) 
+            {
+            iCodecEntries[codecPos]->
+                iMediaSubTypeName.Copy( aObject );
+            }
+        //JitterBufferSize
+        if ( KNSmlDMVoIPJitterBufferSize() == aUriSeg ) 
+            {
+            iCodecEntries[codecPos]->iJitterBufferSize = 
+                DesToInt( aObject );
+            }
+        //OctetAlign
+        if ( KNSmlDMVoIPOctetAlign() == aUriSeg ) 
+            {
+            if ( KNSmlDMVoIPValueTrue() == aObject )
+                {
+                iCodecEntries[codecPos]->iOctetAlign = 
+                    CRCSEAudioCodecEntry::EOn;
+                }
+            else if ( KNSmlDMVoIPValueFalse() == aObject )
+                {
+                iCodecEntries[codecPos]->iOctetAlign = 
+                    CRCSEAudioCodecEntry::EOff;
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EInvalidObject;
+                }
+            }
+        //ModeChangePeriod
+        if ( KNSmlDMVoIPModeChangePeriod() == aUriSeg ) 
+            {
+            iCodecEntries[codecPos]->iModeChangePeriod = 
+                DesToInt( aObject );
+            }
+        //ModeChangeNeighbor                
+        if ( KNSmlDMVoIPModeChangeNeighbor() == aUriSeg ) 
+            {
+            if ( KNSmlDMVoIPValueTrue() == aObject )
+                {
+                iCodecEntries[codecPos]->iModeChangeNeighbor = 
+                    CRCSEAudioCodecEntry::EOn;
+                }
+            else if ( KNSmlDMVoIPValueFalse() == aObject )
+                {
+                iCodecEntries[codecPos]->iModeChangeNeighbor = 
+                    CRCSEAudioCodecEntry::EOff;
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EInvalidObject;
+                }
+            }
+        //Ptime
+        if ( KNSmlDMVoIPPtime() == aUriSeg ) 
+            {
+            iCodecEntries[codecPos]->iPtime = DesToInt( aObject );
+            }
+        //Maxptime
+        if ( KNSmlDMVoIPMaxPtime() == aUriSeg ) 
+            {
+            iCodecEntries[codecPos]->iMaxptime = DesToInt( aObject );
+            }
+        //VAD                
+        if ( KNSmlDMVoIPVAD() == aUriSeg ) 
+            {
+            if ( KNSmlDMVoIPValueTrue() == aObject )
+                {
+                iCodecEntries[codecPos]->iVAD = 
+                    CRCSEAudioCodecEntry::EOn;
+                }
+            else if ( KNSmlDMVoIPValueFalse() == aObject )
+                {
+                iCodecEntries[codecPos]->iVAD = 
+                    CRCSEAudioCodecEntry::EOff;
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EInvalidObject;
+                }
+            }
+        //AnnexB                
+        if ( KNSmlDMVoIPAnnexB() == aUriSeg ) 
+            {
+            if ( KNSmlDMVoIPValueTrue() == aObject )
+                {
+                iCodecEntries[codecPos]->iAnnexb =
+                    CRCSEAudioCodecEntry::EOn;
+                }
+            else if ( KNSmlDMVoIPValueFalse() == aObject )
+                {
+                iCodecEntries[codecPos]->iAnnexb =
+                    CRCSEAudioCodecEntry::EOff;
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EInvalidObject;
+                }
+            }
+        // MaxRed
+        if ( KNSmlDMVoIPMaxRed() == aUriSeg )
+            {
+            iCodecEntries[codecPos]->iMaxRed = DesToInt( aObject );
+            }
+
+        // ==============================
+        // ModeSet node ( update )
+        // ==============================
+        //
+        if ( KNSmlDMVoIPMode() == aUriSeg )  
+            {
+            // Add profile to be saved if not done already.
+            if ( KErrNotFound == iCodecModifs.Find( codecPos ) )
+                {
+                iCodecModifs.Insert( codecPos, iCodecModifs.Count() );
+                }
+            iCodecEntries[codecPos]->iModeSet[ 
+                DesToInt( aLUID.Right( 10 ))] = DesToInt( aObject );
+            }
+        }
+    else
+        {
+        // codecsetting not found even in luid exists
+        retValue = CSmlDmAdapter::EError;
+        }
+    DBG_PRINT("CNSmlDmVoIPAdapter::UpdateCodecSpecificObject(): end");
+
+    return retValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::UpdateSettingIdsSpecificObjectL
+// Updates SettingIds specific object.
+// ---------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CNSmlDmVoIPAdapter::UpdateSettingIdsSpecificObjectL(
+    const TDesC8& aLUID, const TDesC8& aUriSeg, const TDesC8& aObject )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::UpdateSettingIdsSpecificObjectL(): start");
+
+    CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+
+    // Get SIP Specific ID used by these settings.
+
+    // Add profile to be saved if not done already.
+    if ( KErrNotFound == iProfileModifs.Find( iProfileID ) )
+        {
+        iProfileModifs.Insert( iProfileID, iProfileModifs.Count() );
+        }
+    //ProfileType
+    if ( KNSmlDMVoIPProfileType() == aUriSeg )
+        {
+        if ( KNSmlDMVoIPProfileTypeSIP() == aObject )
+            {
+            iProfileEntries[iProfileID]->iIds[DesToInt( 
+                LastURISeg( aLUID ).Right( 10 ))].iProfileType = 0;
+            // If the profile id is not saved and the string to fetch it is only temporaly stored,
+            // the profile id will be fetched from previously-stored member value and set as well 
+            // when saveing the profiletype.
+            if( iTempProfileIdObject )
+                {
+                TUint32 profileId = SetSipRefL( *iTempProfileIdObject ); 
+                if ( profileId > 0 )
+                    {
+                    // Set profileId to settingsids.
+                    iProfileEntries[iProfileID]->
+                        iIds[DesToInt( LastURISeg( aLUID ).Right( 10 ))].
+                        iProfileId = profileId;
+                    retValue = CSmlDmAdapter::EOk;
+                    }
+                else
+                    {
+                    retValue = CSmlDmAdapter::EInvalidObject;
+                    }       
+                } 
+            iIsProfileTypeSet = ETrue;
+            delete iTempProfileIdObject;
+            iTempProfileIdObject = NULL;
+            }
+        else if ( KNSmlDMVoIPProfileTypeSCCP() == aObject )
+            {
+            iProfileEntries[iProfileID]->iIds[DesToInt( 
+                LastURISeg( aLUID ).Right( 10 ))].iProfileType = 1;
+            // If the profile id is not saved and the string to fetch it is only temporaly stored,
+            // the profile id will be fetched from previously-stored member value and set as well 
+            // when saveing the profiletype.
+            if( iTempProfileIdObject )
+                {
+                TUint32 profileId = SetSccpRefL( *iTempProfileIdObject ); 
+                // profileId can be zero
+                if ( profileId > 0 || 0 == profileId )
+                    {
+                    // set profileId to settingsids
+                    iProfileEntries[iProfileID]->iIds[DesToInt( 
+                        LastURISeg( aLUID ).Right( 10 ))].
+                        iProfileId = profileId;
+                    retValue = CSmlDmAdapter::EOk;
+                    }
+                else
+                    {
+                    retValue = CSmlDmAdapter::EInvalidObject;
+                    }
+                }
+            iIsProfileTypeSet = ETrue;
+            delete iTempProfileIdObject;
+            iTempProfileIdObject = NULL;       
+            }
+        else
+            {
+            retValue = CSmlDmAdapter::EInvalidObject;   
+            }
+        }
+    // ProfileId
+    if ( KNSmlDMVoIPProfileId() == aUriSeg )
+        {
+        // Handle SIP type.
+        if ( 0 == iProfileEntries[iProfileID]->iIds[DesToInt( 
+            LastURISeg( aLUID ).Right( 10 ))].iProfileType )
+            {
+            TUint32 profileId = SetSipRefL( aObject ); 
+            if ( profileId > 0 )
+                {
+                // Set profileId to settingsids.
+                iProfileEntries[iProfileID]->
+                    iIds[DesToInt( LastURISeg( aLUID ).Right( 10 ))].
+                    iProfileId = profileId;
+                retValue = CSmlDmAdapter::EOk;
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EInvalidObject;
+                }
+            }  
+        // Handle SCCP type
+        else if ( 1 == iProfileEntries[iProfileID]->iIds[DesToInt( 
+            LastURISeg( aLUID ).Right( 10 ))].iProfileType )
+            {
+            TUint32 profileId = SetSccpRefL( aObject ); 
+
+            // profileId can be zero
+            if ( profileId > 0 || 0 == profileId )
+                {
+                // set profileId to settingsids
+                iProfileEntries[iProfileID]->iIds[DesToInt( 
+                    LastURISeg( aLUID ).Right( 10 ))].
+                    iProfileId = profileId;
+                retValue = CSmlDmAdapter::EOk;
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EInvalidObject;
+                }
+            }
+        // If the ProfileType has not been set yet,
+        // the string used to fetch ProfileId temporarily is stored to a member value. 
+        else if ( !iIsProfileTypeSet )
+            {
+            if( iTempProfileIdObject )
+            	{
+            	delete iTempProfileIdObject;
+            	iTempProfileIdObject = NULL;
+            	}
+                iTempProfileIdObject = aObject.AllocL();
+            }
+        else
+            {
+            // no SCCP or SIP type found
+            retValue = CSmlDmAdapter::EError;
+            }
+        }
+    // ProfileSpecificId
+    if ( KNSmlDMVoIPProfileSpecificId() == aUriSeg )
+        {
+        // SIPSpecific settings have been removed so set
+        // SIPSpecific ID as not found.
+        iProfileEntries[iProfileID]->iIds[DesToInt( 
+            LastURISeg( aLUID ).Right( 10 ))].
+            iProfileSpecificSettingId = KErrNotFound;
+
+        // Set status to OK so we won't break backwards compatibility.
+        // Some DM servers may react to receiving other status than OK
+        // when sending settings they think are supported.
+        retValue = CSmlDmAdapter::EOk;
+        }
+
+    DBG_PRINT("CNSmlDmVoIPAdapter::UpdateSettingIdsSpecificObjectL(): end");
+
+    return retValue;
+    }
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::DeleteObjectL
+// This deletes VoIP profiles
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::DeleteObjectL( 
+    const TDesC8& aURI, 
+    const TDesC8& aLUID, 
+    const TInt aStatusRef )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::DeleteObjectL( ): begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    // Load VoIP profile information if not loaded yet
+    if ( !iProfileEntries.Count() )
+        {
+        LoadProfilesL();
+        }
+
+    CSmlDmAdapter::TError retValue = CSmlDmAdapter::EError;
+
+    // Get URI parameters.
+    TBuf8<KNSmlVoIPMaxUriLength> uri = aURI;
+    TPtrC8 uriSeg = LastURISeg( aURI );
+    TPtrC8 uriTmp = RemoveLastURISeg( aURI );
+    TPtrC8 secondLastUriSeg = LastURISeg( uriTmp );
+
+    // Copy LUID as last segment if exists.
+    if ( 0 < aLUID.Length() )
+        {
+        uri.Copy ( aLUID );
+        }
+    iProfileID = FindProfileLocation( uri );
+    if ( KErrNotFound == iProfileID )
+        {
+        iProfileID = FindProfileLocation( aURI );
+        if ( KErrNotFound == iProfileID )
+            {
+            retValue = CSmlDmAdapter::ENotFound;
+            iDmCallback->SetStatusL( aStatusRef, retValue );
+            DBG_PRINT("CNSmlDmVoIPAdapter::DeleteObjectL( ): ENotFound end");
+            return;
+            }
+        } 
+
+    // ==============================
+    // VoIP/x (delete)
+    // ==============================
+    //
+    if ( secondLastUriSeg == KNSmlDMVoIPNodeName
+        && aLUID.Find( KNSmlDMVoIPPrefix ) != KErrNotFound )
+        {
+        // Delete profile from RCSE.
+        iCRCSEProfile->DeleteL( iProfileEntries[iProfileID]->iId );
+
+        // Delete profile also from memory and compress array.
+        delete iProfileEntries[iProfileID];
+        iProfileEntries[iProfileID] = NULL;
+        iProfileEntries.Remove( iProfileID );
+        iProfileEntries.Compress();
+        iDmCallback->SetMappingL( aURI, KNullDesC8 ); 
+        retValue = CSmlDmAdapter::EOk;
+
+        // Fall back to CS preferred when no more VoIP profiles
+        TInt profileCount = iProfileEntries.Count();
+        if ( KErrNone == profileCount )
+            {
+            SetTelephonyPreferenceL( ECSPreferred );
+            }
+        }
+
+    // ==============================
+    // CodecSettings node ( delete ) 
+    // ==============================
+    //
+    else if ( KNSmlDMVoIPCodecSettingsNode() == secondLastUriSeg  
+        && KFourSegs == NumOfURISegs( aURI ) 
+        && aLUID.Find( KNSmlDMVoIPCodecSettingsId ) != KErrNotFound )
+        {
+        // Get codec ID used by this setting.
+        TUint32 codecId = DesToInt( aLUID.Right(10) );
+        TInt codecPos = FindCodecLocation( codecId );    
+        if ( KErrNotFound != codecPos )
+            {
+            // Delete codec settings from RCSE.
+            iCRCSEAudioCodec->DeleteL( codecId );
+            TInt preferredPos = iProfileEntries[iProfileID]->
+                iPreferredCodecs.Find( codecId );
+
+            // Remove codec settings ID from profiles iPreferredCodecs.
+            iProfileEntries[iProfileID]->iPreferredCodecs.Remove(
+                preferredPos );
+            iProfileEntries[iProfileID]->iPreferredCodecs.Compress();
+
+            // Remove codec settings from iCodecEntries and update
+            // Profile back to RCSE. 
+            delete iCodecEntries[codecPos];
+            iCodecEntries[codecPos] = NULL;
+            iCodecEntries.Remove( codecPos );
+            iCodecEntries.Compress();
+            iCRCSEProfile->UpdateL( iProfileEntries[iProfileID]->
+                iId, *iProfileEntries[iProfileID] );
+            retValue = CSmlDmAdapter::EOk;
+            }
+        else
+            {
+            retValue = CSmlDmAdapter::EError;    
+            }
+        }
+
+    // ==============================
+    // VoIP/x/SettingIds ( delete ) 
+    // ==============================,
+    //
+    else if ( KNSmlDMVoIPSettingIdsNode() == secondLastUriSeg  
+        && KFourSegs == NumOfURISegs( aURI ) 
+        && aLUID.Find( KNSmlDMVoIPSettingId ) != KErrNotFound )
+        {
+        iProfileEntries[iProfileID]->iIds.Remove( 
+            DesToInt( aLUID.Right( 10 ) ) );
+        iProfileEntries[iProfileID]->iIds.Compress();
+        iCRCSEProfile->UpdateL( iProfileEntries[iProfileID]->
+            iId, *iProfileEntries[iProfileID] );
+        retValue = CSmlDmAdapter::EOk;
+        }
+
+    // ==============================
+    // VoIP/x/CodecSettings/x/ModeSet Node ( delete ) 
+    // ==============================
+    //
+    else if ( KNSmlDMVoIPModeSetNode() == secondLastUriSeg 
+        && KSixSegs == NumOfURISegs( aURI )  
+        && aLUID.Find( KNSmlDMVoIPModeId ) != KErrNotFound )
+        {
+        // get codecid used by this setting
+        TUint32 codecId = DesToInt( RemoveLastURISeg( aLUID ).Right( 10 ) );
+        TInt codecPos = FindCodecLocation( codecId );
+        if ( KErrNotFound != codecPos )
+            {
+            // remove modeset from iCodecEntries    
+            iCodecEntries[codecPos]->
+                iModeSet.Remove( DesToInt( aLUID.Right( 10 ) ) );
+            iCodecEntries[codecPos]->
+                iModeSet.Compress();
+
+            // update changes also to rcse    
+            iCRCSEAudioCodec->UpdateL( codecId, *iCodecEntries[codecPos] );
+            iDmCallback->SetMappingL( aURI, KNullDesC8 );     
+            retValue = CSmlDmAdapter::EOk;
+            }
+        else
+            {
+            retValue = CSmlDmAdapter::EError;   
+            }
+        }
+    else
+        {
+        retValue = CSmlDmAdapter::EInvalidObject;
+        }
+    iDmCallback->SetStatusL( aStatusRef, retValue ); 
+    DBG_PRINT("CNSmlDmVoIPAdapter::DeleteObjectL( ): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::FetchLeafObjectL
+// Fetches the values of leaf objects.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::FetchLeafObjectL( 
+    const TDesC8& aURI, 
+    const TDesC8& aLUID, 
+    const TDesC8& aType, 
+    const TInt aResultsRef, 
+    const TInt aStatusRef )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::FetchLeafObjectL(): begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    // Load VoIP profile information if not loaded yet
+    if ( !iProfileEntries.Count() )
+        {
+        LoadProfilesL();
+        }  
+
+    CBufBase *result = CBufFlat::NewL( KDefaultResultSize );
+    CleanupStack::PushL( result );
+    CSmlDmAdapter::TError status = FetchObjectL( aURI, aLUID, *result );
+
+    if ( CSmlDmAdapter::EOk == status )
+        {
+        iDmCallback->SetResultsL( aResultsRef, *result, aType );
+        }
+    iDmCallback->SetStatusL( aStatusRef, status );
+
+    CleanupStack::PopAndDestroy( result ); //result
+    result = NULL;
+    DBG_PRINT("CNSmlDmVoIPAdapter::FetchLeafObjectL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::FetchObjectL()
+// Fetches the values of leaf objects.
+// ---------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CNSmlDmVoIPAdapter::FetchObjectL( 
+    const TDesC8& aURI, const TDesC8& aLUID,
+    CBufBase& result )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::FetchObjectL(): start");
+    CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+    typedef CRCSEProfileEntry Entry;
+
+    // Check that LUID mapping exists.
+    if ( !aLUID.Length() > 0 )
+        {
+        DBG_PRINT("CNSmlDmVoIPAdapter::FetchLeafObjectL(internal)()():ENotFound end");
+        return CSmlDmAdapter::ENotFound;
+        }
+
+    TBuf8<KNSmlVoIPMaxResultLength> segmentResult;
+    TPtrC8 uriSeg = LastURISeg( aURI );
+
+    TPtrC8 uriTmp = RemoveLastURISeg( aURI );
+    TPtrC8 secondLastUriSeg = LastURISeg( uriTmp );
+
+    // Find profile and get its settings.
+    iProfileID = FindProfileLocation( aLUID );
+
+    // If profile is not found return error.
+    if ( KErrNotFound == iProfileID )
+        {
+        DBG_PRINT( "CNSmlDmVoIPAdapter::FetchObjectL(): ENotFound end" );
+        return CSmlDmAdapter::ENotFound;
+        }
+
+    // Set SPS ready for getting values.
+    CSPSettings* spSettings = CSPSettings::NewLC(); // CS:1
+    TUint32 serviceId = iProfileEntries[iProfileID]->iServiceProviderId;
+
+    //VoIP/x/VoIPId
+    if ( KNSmlDMVoIPSetID() == uriSeg )
+        {
+        segmentResult.AppendNumFixedWidthUC( 
+            iProfileEntries[iProfileID]->iId, EDecimal, 10 );
+        }
+    //VoIP/x/ProviderName
+    else if ( KNSmlDMVoIPProvID() == uriSeg )
+        {
+        segmentResult.Copy( iProfileEntries[iProfileID]->
+            iProviderName );
+        }
+    //VoIP/x/SettingsName
+    else if ( KNSmlDMVoIPName() == uriSeg )
+        {
+        segmentResult.Copy( iProfileEntries[iProfileID]->
+            iSettingsName );
+        }
+    //VoIP/x/SMPort
+    else if ( KNSmlDMVoIPSMPort() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->
+            iStartMediaPort );
+        }
+    //VoIP/x/EMPort
+    else if ( KNSmlDMVoIPEMPort() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->
+            iEndMediaPort );
+        }
+    //VoIP/x/MediaQos
+    else if ( KNSmlDMVoIPMediaQos() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->
+            iMediaQOS );
+        }
+    //VoIP/x/DTMFIB
+    else if ( KNSmlDMVoIPDTMFIB() == uriSeg )
+        {
+        if ( Entry::EOONotSet == iProfileEntries[iProfileID]->
+            iInbandDTMF )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueNotSet );
+            }
+        if ( Entry::EOn == iProfileEntries[iProfileID]->iInbandDTMF )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueTrue );
+            }
+        if ( Entry::EOff == iProfileEntries[iProfileID]->iInbandDTMF )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueFalse );
+            }
+        }
+    //VoIP/x/DTMFOB
+    else if ( KNSmlDMVoIPDTMFOB() == uriSeg )
+        {
+        if ( Entry::EOONotSet == iProfileEntries[iProfileID]->
+            iOutbandDTMF )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueNotSet );
+            }
+        if ( Entry::EOff == iProfileEntries[iProfileID]->iOutbandDTMF )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueFalse );
+            }
+        if ( Entry::EOn == iProfileEntries[iProfileID]->iOutbandDTMF )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueTrue );
+            }
+        }
+    // VoIP/x/SecureCallPref
+    else if ( KNSmlDMVoIPSecureCallPref() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->
+            iSecureCallPreference );
+        }
+    // VoIP/x/RTCP
+    else if ( KNSmlDMVoIPRTCP() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->iRTCP );
+        }
+   // VoIP/x/UAHTerminalType
+    else if ( KNSmlDMVoIPUAHTerminalType() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->
+            iSIPVoIPUAHTerminalType );
+        }
+    // VoIP/x/UAHWLANMAC
+    else if ( KNSmlDMVoIPUAHWLANMAC() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->
+            iSIPVoIPUAHeaderWLANMAC );
+        }
+    // VoIP/x/UAHString
+    else if ( KNSmlDMVoIPUAHString() == uriSeg )
+        {
+        segmentResult.Copy( iProfileEntries[iProfileID]->
+            iSIPVoIPUAHeaderString );
+        }
+    // VoIP/x/ProfileLockedToIAP
+    else if ( KNSmlDMVoIPProfileLockedToIAP() == uriSeg )
+        {
+        if ( Entry::EOONotSet == iProfileEntries[iProfileID]->
+            iProfileLockedToIAP )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueNotSet );
+            }
+        if ( Entry::EOn == iProfileEntries[iProfileID]->
+            iProfileLockedToIAP )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueTrue );
+            }
+        if ( Entry::EOff == iProfileEntries[iProfileID]->
+            iProfileLockedToIAP )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueFalse );
+            }
+        }
+    // VoIP/x/VoIPPluginUID
+    else if ( KNSmlDMVoIPPluginUID() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->iVoIPPluginUID );
+        }
+    // VoIP/x/AllowVoIPOverWCDMA
+    else if ( KNSmlDMVoIPAllowVoIPOverWCDMA() == uriSeg )
+        {
+        TInt sipProfileId(0);
+        TUint32 bearerFilttering(0);
+        
+        for ( TInt index = 0; index < iProfileEntries[iProfileID]->
+                iIds.Count(); index++ )
+            {
+            if ( iProfileEntries[iProfileID]->iIds[index].iProfileType == 0 )
+                {
+                sipProfileId = iProfileEntries[iProfileID]->
+                    iIds[index].iProfileId;
+                break;
+                }
+            }
+        
+        CSIPProfile* sipProf = NULL;
+        CSIPProfileRegistryObserver* sipRegObs =
+            CSIPProfileRegistryObserver::NewLC(); // CS:1
+        CSIPManagedProfileRegistry* sipProfReg = 
+            CSIPManagedProfileRegistry::NewLC( *sipRegObs ); // CS:2
+        TRAPD( err, ( sipProf = sipProfReg->ProfileL( sipProfileId ) ) );
+        
+        if ( KErrNone == err )
+            {
+            User::LeaveIfError( sipProf->GetParameter( 
+                KBearerType, bearerFilttering ) );
+            }
+        
+        CleanupStack::PopAndDestroy( sipProfReg ); // CS:1
+        CleanupStack::PopAndDestroy( sipRegObs ); // CS:0
+        
+        if ( bearerFilttering == KBearerWlanOnly )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueFalse );
+            }
+        
+        else if ( bearerFilttering == KBearerNotSpecified )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueTrue );
+            }
+        }
+    // VoIP/x/VoIPDigits
+    else if ( KNSmlDMVoIPVoIPDigits() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->
+            iMeanCountOfVoIPDigits );
+        }
+    // VoIP/x/URIDomainIgnoreRule
+    else if ( KNSmlDMVoIPURIDomainIgnoreRule() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->
+            iIgnoreAddrDomainPart );
+        }
+    // VoIP/x/AutoAcceptBuddyRequest
+    else if ( KNSmlDMVoIPAutoAcceptBuddyRequest() == uriSeg )
+        {
+        CSPProperty* autoAcceptBuddy = CSPProperty::NewLC();
+        TInt err = spSettings->FindPropertyL( serviceId, 
+            ESubPropertyPresenceRequestPreference, *autoAcceptBuddy );
+        if ( KErrNone != err )
+            {
+            retValue = CSmlDmAdapter::EError;
+            }
+        else
+            {
+            TInt autoAccept;
+            err = autoAcceptBuddy->GetValue( autoAccept );
+            if ( KErrNone == err )
+                {
+                segmentResult.Num( autoAccept );
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            }
+        CleanupStack::PopAndDestroy( autoAcceptBuddy );
+        }
+    // VoIP/x/UsedVoIPRelease
+    else if ( KNSmlDMVoIPUsedVoIPRelease() == uriSeg )
+        {
+        TBuf16<KMaxUriLength> voipRelease( KNullDesC16 );
+        voipRelease.Copy( spSettings->GetSIPVoIPSWVersion() );
+        if ( !voipRelease.Length() )
+            {
+            retValue = CSmlDmAdapter::EError;
+            }
+        else
+            {
+            segmentResult.Copy( voipRelease );
+            }
+        }
+    // VoIP/x/AddUserPhone
+    else if ( KNSmlDMVoIPAddUserPhone() == uriSeg )
+        {
+        if ( Entry::EOONotSet == iProfileEntries[iProfileID]->
+            iUserPhoneUriParameter )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueNotSet );
+            }
+        else if ( Entry::EOn == iProfileEntries[iProfileID]->
+            iUserPhoneUriParameter )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueTrue );
+            }
+        else if ( Entry::EOff == iProfileEntries[iProfileID]->
+            iUserPhoneUriParameter )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueFalse );
+            }
+        }
+    // VoIP/x/ProviderBookmarkURI
+    else if ( KNSmlDMVoIPProviderBookmarkUri() == uriSeg )
+        {
+        CSPProperty* providerBkmark = CSPProperty::NewLC();
+        TInt err = spSettings->FindPropertyL( serviceId, 
+            EPropertyServiceBookmarkUri, *providerBkmark );
+        if ( KErrNone != err )
+            {
+            retValue = CSmlDmAdapter::EError;
+            }
+        else
+            {
+            TBuf16<KNSmlVoIPMaxUriLength> bkmark;
+            err = providerBkmark->GetValue( bkmark );
+            if ( KErrNone == err )
+                {
+                segmentResult.Copy( bkmark );
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            }
+        CleanupStack::PopAndDestroy( providerBkmark );
+        }
+    // VoIP/x/SIPConnectivityTestURI
+    else if ( KNSmlDMVoIPSIPConnTestUri() == uriSeg )
+        {
+        segmentResult.Copy( iProfileEntries[iProfileID]->
+            iSIPConnTestAddress );
+        }
+    // VoIP/x/NATFWProfileId
+    else if ( KNSmlDMVoIPNatFwProfileId() == uriSeg )
+        {
+        TBuf16<KMaxUriLength> natfwProfile;
+        retValue = GetNatFwUriL( natfwProfile, 
+            iProfileEntries[iProfileID]->iNATSettingsStorageId );
+        if ( CSmlDmAdapter::EOk == retValue )
+            {
+            segmentResult.Copy( natfwProfile );
+            }
+        }
+    // VoIP/x/MinSessionInterval
+    else if ( KNSmlDMVoIPMinSessionInterval() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->iSIPMinSE );
+        }
+    // VoIP/x/SessionExpires
+    else if ( KNSmlDMVoIPSessionExpires() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->
+            iSIPSessionExpires );
+        }
+    // VoIP/x/BradingDataURI
+    else if ( KNSmlDMVoIPBrandingDataUri() == uriSeg )
+        {
+        CSPProperty* brandingUri = CSPProperty::NewLC();
+        TInt err = spSettings->FindPropertyL( serviceId, 
+            ESubPropertyVoIPBrandDataUri, *brandingUri );
+        if ( KErrNone != err )
+            {
+            retValue = CSmlDmAdapter::EError;
+            }
+        else
+            {
+            TBuf16<KNSmlVoIPMaxUriLength> brandUri;
+            err = brandingUri->GetValue( brandUri );
+            if ( KErrNone == err )
+                {
+                segmentResult.Copy( brandUri );
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            }
+        CleanupStack::PopAndDestroy( brandingUri );
+        }
+    // VoIP/x/PresenceSettingsId
+    else if ( KNSmlDMVoIPPresenceSettingsId() == uriSeg )
+        {
+        CSPProperty* presenceId = CSPProperty::NewLC();
+        TInt err = spSettings->FindPropertyL( serviceId, 
+            ESubPropertyPresenceSettingsId, *presenceId );
+        if ( KErrNone != err )
+            {
+            retValue = CSmlDmAdapter::EError;
+            }
+        else
+            {
+            TInt presId;
+            err = presenceId->GetValue( presId );
+            if ( KErrNone == err )
+                {
+                TBuf16<KMaxUriLength> presenceUri;
+                retValue = GetPresenceUriL( presenceUri, (TUint32)presId );
+                if ( EOk == retValue )
+                    {
+                    segmentResult.Copy( presenceUri );
+                    }
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            }
+        CleanupStack::PopAndDestroy( presenceId );
+        }
+    // VoIP/x/UsedNATProtocol
+    else if ( KNSmlDMVoIPUsedNatProtocol() == uriSeg )
+        {
+        segmentResult.Num( iProfileEntries[iProfileID]->iNATProtocol );
+        }
+    // VoIP/x/AutoEnable
+    else if ( KNSmlDMVoIPAutoEnable() == uriSeg )
+        {
+        CSPProperty* autoEnableService = CSPProperty::NewLC();
+        TInt err = spSettings->FindPropertyL( serviceId, 
+            ESubPropertyVoIPEnabled, *autoEnableService );
+        if ( KErrNone != err )
+            {
+            retValue = CSmlDmAdapter::EError;
+            }
+        else
+            {
+            TInt autoEnable;
+            err = autoEnableService->GetValue( autoEnable );
+            if ( KErrNone == err )
+                {
+                segmentResult.Num( autoEnable );
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            }
+        CleanupStack::PopAndDestroy( autoEnableService );
+        }
+    // VoIP/x/SnapProfileId
+    else if ( KNSmlDMVoIPSnapProfileId() == uriSeg )
+        {
+        CSPProperty* snapProfileId = CSPProperty::NewLC();
+        TInt err = spSettings->FindPropertyL( serviceId, 
+            ESubPropertyVoIPPreferredSNAPId, *snapProfileId );
+        if ( KErrNone != err )
+            {
+            retValue = CSmlDmAdapter::EError;
+            }
+        else
+            {
+            TInt snapId;
+            err = snapProfileId->GetValue( snapId );
+            if ( KErrNone == err )
+                {
+                TBuf8<KMaxUriLength> snapUri;
+                retValue = GetSnapUriL( snapUri, (TUint32)snapId );
+                if ( EOk == retValue )
+                    {
+                    segmentResult.Copy( snapUri );
+                    }
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            }
+        CleanupStack::PopAndDestroy( snapProfileId );
+        }
+    // VoIP/x/EnableIM
+    else if ( KNSmlDMVoIPEnableIm() == uriSeg )
+        {
+        CSPProperty* enableIm = CSPProperty::NewLC();
+        TInt err = spSettings->FindPropertyL( serviceId, 
+            ESubPropertyIMEnabled, *enableIm );
+        if ( KErrNotFound == err )
+            {
+            segmentResult.Copy( KNSmlDMVoIPValueFalse );
+            }
+        else if ( KErrNone != err )
+            {
+            retValue = CSmlDmAdapter::EError;
+            }
+        else
+            {
+            TInt enableValue;
+            err = enableIm->GetValue( enableValue );
+            if ( KErrNone == err && 0 < enableValue )
+                {
+                segmentResult.Copy( KNSmlDMVoIPValueTrue );
+                }
+            else if ( KErrNone == err && !enableValue )
+                {
+                segmentResult.Copy( KNSmlDMVoIPValueFalse );
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            }
+        CleanupStack::PopAndDestroy( enableIm );
+        }
+
+    // ==============================
+    // CodecSettings node ( fetch )
+    // ==============================
+    //
+    // VoIP/x/PreferredCodecs node
+    if ( KNSmlDMVoIPPreferredCodecId() == uriSeg.Left(
+        KNSmlDMVoIPPreferredCodecId().Length() ) ) 
+        {
+        TInt preferredPos = DesToInt( LastURISeg( aLUID ).Right( 10 ) );
+        segmentResult.Num( iProfileEntries[iProfileID]->
+            iPreferredCodecs[preferredPos]);
+        }
+
+    // VoIP/x/CodecSettings node    
+    if ( KNSmlDMVoIPCodecSettingsId() == LastURISeg( aLUID ).
+        Left( KNSmlDMVoIPCodecSettingsId().Length() )
+        && KFiveSegs == NumOfURISegs( aURI ) )
+        {
+        retValue = FetchCodecObject( aLUID, uriSeg, segmentResult );
+        }
+
+    // ==============================
+    // SettingIds node ( fetch )
+    // ==============================
+    //
+    if ( KNSmlDMVoIPSettingId() == LastURISeg( aLUID ).
+        Left( KNSmlDMVoIPSettingId().Length() ) 
+        && KFiveSegs == NumOfURISegs( aURI ) )
+        {
+
+        //ProfileType
+        if ( KNSmlDMVoIPProfileType() == uriSeg )
+            {
+            if ( 0 == iProfileEntries[iProfileID]->iIds[DesToInt( 
+                LastURISeg( aLUID ).Right( 10 ))].iProfileType )
+                {
+                segmentResult.Copy( KNSmlDMVoIPProfileTypeSIP );
+                }
+            if ( 1 == iProfileEntries[iProfileID]->iIds[DesToInt( 
+                LastURISeg( aLUID ).Right( 10 ))].iProfileType )
+                {
+                segmentResult.Copy( KNSmlDMVoIPProfileTypeSCCP );
+                }
+            }
+
+        // ProfileId
+        if ( KNSmlDMVoIPProfileId() == uriSeg )
+            {
+            if ( 0 == iProfileEntries[iProfileID]->iIds[DesToInt( 
+                LastURISeg( aLUID ).Right( 10 ))].iProfileType )
+                {
+                retValue = GetSipIdL( result, iProfileEntries[iProfileID]->
+                    iIds[DesToInt( LastURISeg( aLUID ).Right( 10 ))].
+                    iProfileId );
+                }
+            if ( 1 == iProfileEntries[iProfileID]->iIds[DesToInt( 
+                LastURISeg( aLUID ).Right( 10 ))].iProfileType )
+                {
+                // Get SCCP ID from sccp adapter if exists
+                retValue = GetSccpIdL( result, iProfileEntries[iProfileID]->
+                    iIds[DesToInt( LastURISeg( aLUID ).Right( 10 ))].
+                    iProfileId );
+                }
+            }
+
+        // ProfileSpecificId
+        if ( KNSmlDMVoIPProfileSpecificId() == uriSeg )
+            {
+            segmentResult.Num( iProfileEntries[iProfileID]->iIds[
+                DesToInt( LastURISeg( aLUID ).Right( 10 ) ) ].
+                iProfileSpecificSettingId );
+            }
+        }
+
+    // ==============================
+    // VoiceMailBox node (fetch)
+    // ==============================
+    //
+    if ( KNSmlDMVoIPVmbxNode() == secondLastUriSeg &&
+        KFourSegs == NumOfURISegs( aURI ) )
+        {
+        // VoIP/x/VoiceMailBox/MWI-URI
+        if ( KNSmlDMVoIPMwiUri() == uriSeg )
+            {
+            CSPProperty* mwiUri = CSPProperty::NewLC();
+            TInt err = spSettings->FindPropertyL( serviceId, 
+                ESubPropertyVMBXMWIAddress, *mwiUri );
+            if ( KErrNone != err )
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            else
+                {
+                TBuf16<KNSmlVoIPMaxUriLength> mwiAddr;
+                err = mwiUri->GetValue( mwiAddr );
+                if ( KErrNone == err )
+                    {
+                    segmentResult.Copy( mwiAddr );
+                    }
+                else
+                    {
+                    retValue = CSmlDmAdapter::EError;
+                    }
+                }
+            CleanupStack::PopAndDestroy( mwiUri );
+            }
+
+        // VoIP/x/VoiceMailBox/ListeningURI
+        if ( KNSmlDMVoIPListeningUri() == uriSeg )
+            {
+            CSPProperty* listeningUri = CSPProperty::NewLC();
+            TInt err = spSettings->FindPropertyL( serviceId, 
+                ESubPropertyVMBXListenAddress, *listeningUri );
+            if ( KErrNone != err )
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            else
+                {
+                TBuf16<KNSmlVoIPMaxUriLength> listenUri;
+                err = listeningUri->GetValue( listenUri );
+                if ( KErrNone == err )
+                    {
+                    segmentResult.Copy( listenUri );
+                    }
+                else
+                    {
+                    retValue = CSmlDmAdapter::EError;
+                    }
+                }
+            CleanupStack::PopAndDestroy( listeningUri );
+            }
+
+        // VoIP/x/VoiceMailBox/UsedIAPId
+        if ( KNSmlDMVoIPUsedIAPId() == uriSeg )
+            {
+            CSPProperty* iapId = CSPProperty::NewLC();
+            TInt err = spSettings->FindPropertyL( serviceId, 
+                ESubPropertyVMBXPreferredIAPId, *iapId );
+            if ( KErrNone != err )
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            else
+                {
+                TInt iap;
+                err = iapId->GetValue( iap );
+                if ( KErrNone == err )
+                    {
+                    retValue = GetConRefL( result, iap );
+                    if ( CSmlDmAdapter::EOk != retValue )
+                        {
+                        result.Reset();
+                        }
+                    }
+                else
+                    {
+                    retValue = CSmlDmAdapter::EError;
+                    }
+                
+                }
+            CleanupStack::PopAndDestroy( iapId );
+            }
+
+        // VoIP/x/VoiceMailBox/ReSubscribeInterval
+        if ( KNSmlDMVoIPReSubscribeInterval() == uriSeg )
+            {
+            CSPProperty* reSubscrInterval = CSPProperty::NewLC();
+            TInt err = spSettings->FindPropertyL( serviceId, 
+                ESubPropertyVMBXMWISubscribeInterval, *reSubscrInterval );
+            if ( KErrNone != err )
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            else
+                {
+                TInt reSubscribe;
+                err = reSubscrInterval->GetValue( reSubscribe );
+                if ( KErrNone == err )
+                    {
+                    segmentResult.Num( reSubscribe );
+                    }
+                else
+                    {
+                    retValue = CSmlDmAdapter::EError;
+                    }
+                }
+            CleanupStack::PopAndDestroy( reSubscrInterval );
+            }
+
+        // VoIP/x/VoiceMailBox/UsedSIPProfileId
+        if ( KNSmlDMVoIPUsedSIPProfileId() == uriSeg )
+            {
+            CSPProperty* sipProfileId = CSPProperty::NewLC();
+            TInt err = spSettings->FindPropertyL( serviceId, 
+                ESubPropertyVMBXSettingsId, *sipProfileId );
+            if ( KErrNone != err )
+                {
+                retValue = CSmlDmAdapter::EError;
+                }
+            else
+                {
+                TInt sipId;
+                err = sipProfileId->GetValue( sipId );
+                if ( KErrNone == err )
+                    {
+                    retValue = GetSipIdL( result, sipId );
+                    if ( CSmlDmAdapter::EOk != retValue )
+                        {
+                        result.Reset();
+                        }
+                    }
+                else
+                    {
+                    retValue = CSmlDmAdapter::EError;
+                    }
+                }
+            CleanupStack::PopAndDestroy( sipProfileId );
+            }
+        }
+
+    result.InsertL( result.Size(), segmentResult );       
+    CleanupStack::PopAndDestroy( spSettings );
+
+    DBG_PRINT("CNSmlDmVoIPAdapter::FetchObjectL(): end");
+    return retValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::FetchCodecObject
+// Fetches the values of Codec specific leaf objects.
+// ---------------------------------------------------------------------------
+//
+CSmlDmAdapter::TError CNSmlDmVoIPAdapter::FetchCodecObject( 
+    const TDesC8& aLUID, const TDesC8& aUriSeg, TDes8& aSegmentResult )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::FetchCodecObject(): begin");
+    
+    CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+
+    TUint32 codecId = DesToInt( aLUID.Right( 10 ) );
+    TInt codecPos = FindCodecLocation( codecId );
+    if ( KErrNotFound != codecPos )
+        {
+        //CodecId
+        if ( KNSmlDMVoIPCodecId() == aUriSeg ) 
+            {
+            aSegmentResult.Num ( iCodecEntries[codecPos]->iCodecId );
+            }
+        //MediaTypeName
+        if ( KNSmlDMVoIPMediaTypeName() == aUriSeg ) 
+            {
+            aSegmentResult.Copy ( iCodecEntries[codecPos]->
+                iMediaTypeName );
+            }
+        //MediaSubTypeName
+        if ( KNSmlDMVoIPMediaSubTypeName() == aUriSeg ) 
+            {
+            aSegmentResult.Copy ( iCodecEntries[codecPos]->
+                iMediaSubTypeName );
+            }
+        //JitterBufferSize
+        if ( KNSmlDMVoIPJitterBufferSize() == aUriSeg ) 
+            {
+            if ( KNotSet < iCodecEntries[codecPos]->iJitterBufferSize )
+                {
+                aSegmentResult.Num ( iCodecEntries[codecPos]->
+                    iJitterBufferSize );
+                }
+            }
+        //OctetAlign            
+        if ( KNSmlDMVoIPOctetAlign() == aUriSeg ) 
+            {
+            if ( CRCSEAudioCodecEntry::EOn == 
+                iCodecEntries[codecPos]->iOctetAlign )
+                {
+                aSegmentResult.Copy( KNSmlDMVoIPValueTrue );
+                }
+            if ( CRCSEAudioCodecEntry::EOff == 
+                iCodecEntries[codecPos]->iOctetAlign )
+                {
+                aSegmentResult.Copy( KNSmlDMVoIPValueFalse );
+                }
+            }
+        //ModeChangePeriod
+        if ( KNSmlDMVoIPModeChangePeriod() == aUriSeg ) 
+            {
+            if ( KNotSet < iCodecEntries[codecPos]->
+                iModeChangePeriod )
+                {
+                aSegmentResult.Num( iCodecEntries[codecPos]->
+                    iModeChangePeriod );
+                }
+            }
+        //ModeChangeNeighbor          
+        if ( KNSmlDMVoIPModeChangeNeighbor() == aUriSeg ) 
+            {
+            if ( CRCSEAudioCodecEntry::EOn == 
+                iCodecEntries[codecPos]->iModeChangeNeighbor )
+                {
+                aSegmentResult.Copy( KNSmlDMVoIPValueTrue );
+                }
+            if ( CRCSEAudioCodecEntry::EOff == 
+                iCodecEntries[codecPos]->iModeChangeNeighbor )
+                {
+                aSegmentResult.Copy( KNSmlDMVoIPValueFalse );
+                }
+            }
+        //Ptime
+        if ( KNSmlDMVoIPPtime() == aUriSeg )  
+            {
+            if ( KNotSet < iCodecEntries[codecPos]->iPtime )
+                {
+                aSegmentResult.Num( iCodecEntries[codecPos]->iPtime );
+                }
+            }
+        //Maxptime
+        if ( KNSmlDMVoIPMaxPtime() == aUriSeg ) 
+            {
+            if ( KNotSet < iCodecEntries[codecPos]->iMaxptime )
+                {
+                aSegmentResult.Num( 
+                    iCodecEntries[codecPos]->iMaxptime );
+                }
+            }
+        //VAD                
+        if ( KNSmlDMVoIPVAD() == aUriSeg ) 
+            {
+            if ( CRCSEAudioCodecEntry::EOn ==
+                iCodecEntries[codecPos]->iVAD )
+                {
+                aSegmentResult.Copy( KNSmlDMVoIPValueTrue );
+                }
+            if ( CRCSEAudioCodecEntry::EOff == 
+                iCodecEntries[codecPos]->iVAD )
+                {
+                aSegmentResult.Copy( KNSmlDMVoIPValueFalse );
+                }
+            }
+        //AnnexB                
+        if ( KNSmlDMVoIPAnnexB() == aUriSeg ) 
+            {
+            if ( CRCSEAudioCodecEntry::EOn == 
+                iCodecEntries[codecPos]->iAnnexb )
+                {
+                aSegmentResult.Copy( KNSmlDMVoIPValueTrue );
+                }
+            if ( CRCSEAudioCodecEntry::EOff == 
+                iCodecEntries[codecPos]->iAnnexb )
+                {
+                aSegmentResult.Copy( KNSmlDMVoIPValueFalse );
+                }
+            }
+        // MaxRed
+        if ( KNSmlDMVoIPMaxRed() == aUriSeg )
+            {
+            if ( CRCSEAudioCodecEntry::EOONotSet < 
+                iCodecEntries[codecPos]->iMaxRed )                
+                {
+                aSegmentResult.Num( iCodecEntries[codecPos]->iMaxRed );
+                }
+            }
+
+        // ==============================
+        // ModeSet node ( fetch )
+        // ==============================
+        //
+        if ( KNSmlDMVoIPMode() == aUriSeg )  
+            {
+            aSegmentResult.Num ( iCodecEntries[codecPos]->
+                iModeSet[DesToInt( aLUID.Right( 10 ))] );
+            }
+        }
+    else
+        {
+        // Codec not found even if LUID exists.
+        retValue = CSmlDmAdapter::EError;    
+        }   
+
+    DBG_PRINT("CNSmlDmVoIPAdapter::FetchCodecObject(): begin");
+
+    return retValue;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::ChildURIListL
+// Inserts the list of children objects of the node to dm-module
+// ---------------------------------------------------------------------------
+//
+void  CNSmlDmVoIPAdapter::ChildURIListL( 
+    const TDesC8& aURI,
+    const TDesC8& aLUID, 
+    const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
+    const TInt aResultsRef, 
+    const TInt aStatusRef )
+    {
+    DBG_PRINT( "CNSmlDmVoIPAdapter::ChildURIListL(): start" );
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    // Load VoIP profile information if not loaded yet
+    if ( !iProfileEntries.Count() )
+        {
+        LoadProfilesL();
+        }
+
+    CSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk;
+
+    CBufBase *currentURISegmentList = CBufFlat::NewL( 1 );
+    CleanupStack::PushL( currentURISegmentList );
+
+    // get URI parameters
+    TBuf8<KNSmlVoIPMaxUriLength> uri( KNullDesC8 );
+    TBuf8<KNSmlVoIPMaxUriLength> mappingInfo( KNullDesC8 );
+    TPtrC8 uriTmp = RemoveLastURISeg( aURI );
+    TPtrC8 secondLastUriSeg = LastURISeg( uriTmp );
+    TBuf8<KSmlMaxURISegLen> segmentName;
+    TInt howManyObjects = iProfileEntries.Count();
+
+    iProfileID = FindProfileLocation( aLUID );
+
+    // VoIP
+    if ( KNSmlDMVoIPNodeName() == LastURISeg( aURI ) )   
+        {
+        for ( TInt counter = 0; counter < howManyObjects ; counter++ )
+            {
+            TBool notInList = ETrue;
+            TInt currentline = 0;
+            TUint ddId ( iProfileEntries[counter]->iId );
+            while ( notInList && currentline < aPreviousURISegmentList.Count() )
+                {
+                TInt profileLocation = FindProfileLocation(
+                    aPreviousURISegmentList.At( currentline ).iURISegLUID );
+                if ( profileLocation != KErrNotFound )
+                    {
+                    TUint32 profileID( 
+                        iProfileEntries[profileLocation]->iId );   
+                    if ( profileID == ddId ) 
+                        {
+                        notInList = EFalse;
+                        break;
+                        }
+                    }
+                currentline++;
+                }
+            if ( notInList )
+                {
+                // VoIP/x
+                segmentName.Copy( KNSmlDMVoIPPrefix );
+
+                // Add profileID number to identify profile
+                segmentName.AppendNumFixedWidthUC( 
+                    iProfileEntries[counter]->iId, EDecimal, 10 );
+                currentURISegmentList->InsertL( currentURISegmentList->
+                    Size(), segmentName );
+                currentURISegmentList->InsertL( currentURISegmentList->
+                    Size(), KNSmlDMVoIPSeparator );
+
+                // set luid mapping to dm-module
+                mappingInfo.Copy ( KNSmlDMVoIPPrefix );
+                TUint val ( iProfileEntries[counter]->iId );
+                mappingInfo.AppendNumFixedWidthUC( val, EDecimal, 10 );
+                uri.Copy( KNSmlDMVoIPNodeName );
+                uri.Append ( KNSmlDMVoIPSeparator );
+                uri.Append ( KNSmlDMVoIPPrefix );
+                uri.AppendNumFixedWidthUC( val, EDecimal, 10 );
+                iDmCallback->SetMappingL( uri, mappingInfo ); 
+                }
+            else
+                { // Add those in PreviousList which are on database
+                currentURISegmentList->InsertL( currentURISegmentList->Size(),
+                    aPreviousURISegmentList.At(currentline).iURISeg );
+                currentURISegmentList->InsertL( currentURISegmentList->Size(),
+                     KNSmlDMVoIPSeparator );
+                }
+            }
+        retValue = CSmlDmAdapter::EOk;
+        iDmCallback->SetStatusL( aStatusRef, retValue );
+        iDmCallback->SetResultsL( aResultsRef, *currentURISegmentList,
+            KNullDesC8 );
+        CleanupStack::PopAndDestroy( currentURISegmentList ); 
+        currentURISegmentList = NULL;
+        return;
+        }
+
+    if ( KErrNotFound == iProfileID )
+        {
+        retValue = CSmlDmAdapter::ENotFound;
+        iDmCallback->SetStatusL( aStatusRef, retValue );
+        CleanupStack::PopAndDestroy( currentURISegmentList ); 
+        currentURISegmentList = NULL;
+        return;
+        }
+
+    // VoIP/x/PreferredCodecs
+    if ( KNSmlDMVoIPPreferredCodecsNode() == LastURISeg( aURI ) )   
+        {
+        TInt preferredCount = iProfileEntries[iProfileID]->
+            iPreferredCodecs.Count();
+        for ( TInt counter = 0; counter < preferredCount ; counter++ )
+            { 
+            TBool inList = EFalse;
+            
+            // We need to rebuild LUID mapping if someone other has added or
+            // deleted codecs, because there is no usable link to each codec.
+            if ( aPreviousURISegmentList.Count() == preferredCount )
+                {
+                inList = ETrue;    
+                }
+            if ( !inList )
+                {
+                segmentName.Copy( KNSmlDMVoIPPreferredCodecId );
+                segmentName.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
+                currentURISegmentList->InsertL( currentURISegmentList->
+                    Size(), segmentName );
+                currentURISegmentList->InsertL( currentURISegmentList->
+                    Size(), KNSmlDMVoIPSeparator );
+
+                // Set LUID mapping to dm-module.
+                mappingInfo.Copy ( aLUID ); 
+                mappingInfo.Append ( KNSmlDMVoIPSeparator );
+                mappingInfo.Append ( KNSmlDMVoIPPreferredCodecId );
+                mappingInfo.AppendNumFixedWidthUC( counter, EDecimal, 10 );
+                uri.Copy( aURI );
+                uri.Append ( KNSmlDMVoIPSeparator );
+                uri.Append ( KNSmlDMVoIPPreferredCodecId );
+                uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
+                iDmCallback->SetMappingL( uri, mappingInfo ); 
+                }
+            else
+                { // Add those in PreviousList which are on database
+                currentURISegmentList->InsertL( currentURISegmentList->Size(),
+                    aPreviousURISegmentList.At( counter ).iURISeg );
+                currentURISegmentList->InsertL( currentURISegmentList->Size(),
+                     KNSmlDMVoIPSeparator );
+                }
+            }
+        }
+
+    // VoIP/x/PreferredCodecs/x/
+    else if ( KNSmlDMVoIPPreferredCodecsNode() == secondLastUriSeg
+        && KFourSegs == NumOfURISegs( aURI ) )
+        {
+        segmentName.Copy( KNSmlDMVoIPPreferredCodecId );
+        currentURISegmentList->InsertL( currentURISegmentList->
+                Size(), segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->
+                Size(), KNSmlDMVoIPSeparator );        
+        }
+
+    // VoIP/x/
+    else if ( KNSmlDMVoIPCodecSettingsNode() == LastURISeg( aURI ) )   
+        {
+        for ( TInt counter = 0; 
+            counter < iProfileEntries[iProfileID]->iPreferredCodecs.Count(); 
+            counter++ ) 
+            { 
+            TBool notInList = ETrue;
+            TInt currentline = 0;
+            TUint32 ddId = iProfileEntries[iProfileID]->
+                iPreferredCodecs[counter];
+            while ( notInList && currentline < 
+                aPreviousURISegmentList.Count() )
+                {
+                if ( DesToInt( aPreviousURISegmentList.At( currentline ).
+                    iURISegLUID.Right( 10 ) ) == ddId ) 
+                    {
+                    notInList = EFalse;
+                    break;
+                    }
+                currentline++;
+                }
+            if ( notInList )
+                {
+                segmentName.Copy( KNSmlDMVoIPCodecSettingsId );
+                segmentName.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
+                currentURISegmentList->InsertL( currentURISegmentList->
+                    Size(), segmentName );
+                currentURISegmentList->InsertL( currentURISegmentList->
+                    Size(), KNSmlDMVoIPSeparator );
+
+                // Set LUID mapping to dm-module.
+                mappingInfo.Copy ( aLUID ); 
+                mappingInfo.Append ( KNSmlDMVoIPSeparator );
+                mappingInfo.Append ( KNSmlDMVoIPCodecSettingsId );
+                mappingInfo.AppendNumFixedWidthUC( ddId, EDecimal, 10 );
+                uri.Copy( aURI );
+                uri.Append ( KNSmlDMVoIPSeparator );
+                uri.Append ( KNSmlDMVoIPCodecSettingsId );
+                uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
+                iDmCallback->SetMappingL( uri, mappingInfo ); 
+                }
+            else
+                { // Add those from PreviousList which are on database
+                currentURISegmentList->InsertL( currentURISegmentList->Size(),
+                    aPreviousURISegmentList.At(currentline).iURISeg );
+                currentURISegmentList->InsertL( currentURISegmentList->Size(),
+                     KNSmlDMVoIPSeparator );
+                }
+            }
+        }
+
+    // ==============================
+    // CodecSettings node
+    // ==============================
+    //
+    else if ( KNSmlDMVoIPCodecSettingsNode() == secondLastUriSeg 
+        && KFourSegs == NumOfURISegs( aURI ) )
+        {
+        CodecChildListL( currentURISegmentList );
+        }
+
+    // ==============================
+    // ModeSet node
+    // ==============================
+    //
+    else if ( KNSmlDMVoIPModeSetNode() == LastURISeg( aURI ) )   
+        {
+        TUint32 codecId;
+        codecId = DesToInt( aLUID.Right( 10 ) );
+        TInt codecPos = FindCodecLocation( codecId );    
+        if ( KErrNotFound != codecPos )
+            {
+            TInt modesetCount = iCodecEntries[codecPos]->iModeSet.Count();
+            for ( TInt counter = 0; counter < modesetCount; counter++ )
+                { 
+                TBool inList = EFalse;
+
+                // We need to rebuild LUID mapping if someone other has added
+                // or deleted, because there is no usable link to each ModeSet.
+                if ( aPreviousURISegmentList.Count() == modesetCount )
+                    {
+                    inList = ETrue;    
+                    }
+                if ( !inList )
+                    {
+                    segmentName.Copy( KNSmlDMVoIPModeId );
+                    segmentName.AppendNumFixedWidthUC( counter + 1, EDecimal,
+                        3 );
+                    currentURISegmentList->InsertL( currentURISegmentList->
+                        Size(), segmentName );
+                    currentURISegmentList->InsertL( currentURISegmentList->
+                        Size(), KNSmlDMVoIPSeparator );
+
+                    // Set LUID mapping to DM module.
+                    mappingInfo.Copy ( aLUID );
+                    mappingInfo.Append ( KNSmlDMVoIPSeparator );
+                    mappingInfo.Append ( KNSmlDMVoIPModeId );
+                    mappingInfo.AppendNumFixedWidthUC( counter, EDecimal, 10 );
+                    uri.Copy( aURI );
+                    uri.Append ( KNSmlDMVoIPSeparator );
+                    uri.Append ( KNSmlDMVoIPModeId );
+                    uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
+                    iDmCallback->SetMappingL( uri, mappingInfo ); 
+                    }
+                else
+                    { // Add those in PreviousList which are on database.
+                    currentURISegmentList->InsertL( currentURISegmentList->
+                        Size(), aPreviousURISegmentList.At( counter ).iURISeg );
+                    currentURISegmentList->InsertL( currentURISegmentList->
+                        Size(), KNSmlDMVoIPSeparator );
+                    }
+                }
+            }
+        else
+            {
+            retValue = CSmlDmAdapter::EError;    
+            }    
+        
+        }       
+
+    else if ( KNSmlDMVoIPModeSetNode() == secondLastUriSeg 
+        && KSixSegs == NumOfURISegs( aURI ) )
+        {
+        segmentName.Copy( KNSmlDMVoIPMode );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVoIPSeparator );
+        }       
+
+    // ==============================
+    // SettingIds node
+    // ==============================
+    //
+    // VoIP/x/SettingIds
+    else if ( KNSmlDMVoIPSettingIdsNode() == LastURISeg( aURI ) )    
+        {
+        for ( TInt counter = 0; counter < 
+            iProfileEntries[iProfileID]->iIds.Count(); counter++ )
+            { 
+            TBool inList = EFalse;
+
+            // We need to rebuild luid mapping if someone other has made
+            // some changes because there is no usable link to settingids.
+            if ( aPreviousURISegmentList.Count() == 
+                iProfileEntries[iProfileID]->iIds.Count() )
+                {
+                inList = ETrue;    
+                }
+            if ( !inList )
+                {
+                segmentName.Copy( KNSmlDMVoIPSettingId );
+                segmentName.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
+                currentURISegmentList->InsertL( currentURISegmentList->
+                    Size(), segmentName );
+                currentURISegmentList->InsertL( currentURISegmentList->
+                    Size(), KNSmlDMVoIPSeparator );
+
+                // set luid mapping to dm-module
+                mappingInfo.Copy ( aLUID );     
+                mappingInfo.Append ( KNSmlDMVoIPSeparator );
+                mappingInfo.Append ( KNSmlDMVoIPSettingId );
+                mappingInfo.AppendNumFixedWidthUC( counter, EDecimal, 10 );
+                uri.Copy( aURI );
+                uri.Append ( KNSmlDMVoIPSeparator );
+                uri.Append ( KNSmlDMVoIPSettingId );
+                uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
+                iDmCallback->SetMappingL( uri, mappingInfo ); 
+                }
+            else
+                { // Add those in PreviousList which are on database
+                currentURISegmentList->InsertL( currentURISegmentList->Size(),
+                    aPreviousURISegmentList.At( counter ).iURISeg );
+                currentURISegmentList->InsertL( currentURISegmentList->Size(),
+                     KNSmlDMVoIPSeparator );
+                }
+            }
+        }  
+
+    // ==============================
+    // SettingId leaf
+    // ==============================
+    //
+    else if ( KNSmlDMVoIPSettingIdsNode() == secondLastUriSeg
+        && KFourSegs == NumOfURISegs( aURI ) )
+        {
+        // ProfileType
+        segmentName.Copy( KNSmlDMVoIPProfileType );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVoIPSeparator );
+
+        // ProfileId
+        segmentName.Copy( KNSmlDMVoIPProfileId );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVoIPSeparator );
+
+        // ProfileSpecific
+        segmentName.Copy( KNSmlDMVoIPProfileSpecificId );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVoIPSeparator );
+        }  
+
+    // ==============================
+    // VoIP/x/VoiceMailBox node
+    // ==============================
+    //
+    else if ( KNSmlDMVoIPVmbxNode() == LastURISeg( aURI ) && 
+        KThreeSegs == NumOfURISegs( aURI ) )
+        {
+        // VoIP/x/VoiceMailBox/MWI-URI
+        segmentName.Copy( KNSmlDMVoIPMwiUri );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(),
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVoIPSeparator );
+        // VoIP/x/VoiceMailBox/ListeningURI
+        segmentName.Copy( KNSmlDMVoIPListeningUri );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(),
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVoIPSeparator );
+        // VoIP/x/VoiceMailBox/UsedIAPId
+        segmentName.Copy( KNSmlDMVoIPUsedIAPId );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(),
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVoIPSeparator );
+        // VoIP/x/VoiceMailBox/ReSubscribeInterval
+        segmentName.Copy( KNSmlDMVoIPReSubscribeInterval );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(),
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVoIPSeparator );
+        // VoIP/x/VoiceMailBox/UsedSIPProfileId
+        segmentName.Copy( KNSmlDMVoIPUsedSIPProfileId );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(),
+            segmentName );
+        currentURISegmentList->InsertL( currentURISegmentList->Size(), 
+            KNSmlDMVoIPSeparator );
+        }
+
+    // ==============================
+    // VoIP/x/ node
+    // ==============================
+    //
+    else if ( KNSmlDMVoIPNodeName() == secondLastUriSeg 
+        && KTwoSegs == NumOfURISegs( aURI ) )
+        {
+        VoipChildListL( currentURISegmentList );
+        }
+    else 
+        {
+        // if none of asked nodes found return error.
+        retValue = CSmlDmAdapter::ENotFound;
+        }
+    iDmCallback->SetStatusL( aStatusRef, retValue );
+    if ( CSmlDmAdapter::EOk == retValue )
+        {
+        iDmCallback->SetResultsL( aResultsRef, *currentURISegmentList, 
+            KNullDesC8 );
+        }
+    CleanupStack::PopAndDestroy( currentURISegmentList ); 
+    currentURISegmentList = NULL;
+    DBG_PRINT("CNSmlDmVoIPAdapter::ChildURIListL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::CodecChildListL
+// Inserts Codec specific leaf objects.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::CodecChildListL(
+    CBufBase* const aCurrentURISegmentList )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::CodecChildListL(): start");
+
+    TBuf8<KSmlMaxURISegLen> segmentName;
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/VoIPCodecId
+    segmentName.Copy( KNSmlDMVoIPCodecId );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/MediaTypeName
+    segmentName.Copy( KNSmlDMVoIPMediaTypeName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/MediaSubTypeName
+    segmentName.Copy( KNSmlDMVoIPMediaSubTypeName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/JitterBufferSize
+    segmentName.Copy( KNSmlDMVoIPJitterBufferSize );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/OctetAlign
+    segmentName.Copy( KNSmlDMVoIPOctetAlign );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/ModeSet
+    segmentName.Copy( KNSmlDMVoIPModeSetNode );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/ModeChangePeriod
+    segmentName.Copy( KNSmlDMVoIPModeChangePeriod );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/ModeChangeNeighbor
+    segmentName.Copy( KNSmlDMVoIPModeChangeNeighbor );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/Ptime
+    segmentName.Copy( KNSmlDMVoIPPtime );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/MaxPtime
+    segmentName.Copy( KNSmlDMVoIPMaxPtime );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/VAD
+    segmentName.Copy( KNSmlDMVoIPVAD );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/AnnexB
+    segmentName.Copy( KNSmlDMVoIPAnnexB );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/CodecSettings/CodecSettingsIdXXX/MaxRed
+    segmentName.Copy( KNSmlDMVoIPMaxRed );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    DBG_PRINT("CNSmlDmVoIPAdapter::CodecChildListL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::VoipChildListL
+// Inserts VoIP leaf objects.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::VoipChildListL(
+    CBufBase* const aCurrentURISegmentList )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::VoipChildListL(): start");
+
+    TBuf8<KSmlMaxURISegLen> segmentName;
+
+    // VoIP/x/VoIPID
+    segmentName.Copy( KNSmlDMVoIPSetID );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/ProviderName
+    segmentName.Copy( KNSmlDMVoIPProvID );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/SettingsName
+    segmentName.Copy( KNSmlDMVoIPName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/PreferredCodecs
+    segmentName.Copy( KNSmlDMVoIPPreferredCodecsNode );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName ); 
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator ); 
+
+    // VoIP/x/CodecSettings
+    segmentName.Copy( KNSmlDMVoIPCodecSettingsNode );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName ); 
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator ); 
+
+    // VoIP/x/SettingIds
+    segmentName.Copy( KNSmlDMVoIPSettingIdsNode );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName ); 
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/StartMediaPort
+    segmentName.Copy( KNSmlDMVoIPSMPort );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName ); 
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/EndMediaPort
+    segmentName.Copy( KNSmlDMVoIPEMPort );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName ); 
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/VoiceMailBox
+    segmentName.Copy( KNSmlDMVoIPVmbxNode );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName ); 
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/MegiaQos
+    segmentName.Copy( KNSmlDMVoIPMediaQos );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName ); 
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/InbandDTMF
+    segmentName.Copy( KNSmlDMVoIPDTMFIB );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName ); 
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/OutbandDTMF
+    segmentName.Copy( KNSmlDMVoIPDTMFOB );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName ); 
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/SecureCallPref
+    segmentName.Copy( KNSmlDMVoIPSecureCallPref );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/RTCP
+    segmentName.Copy( KNSmlDMVoIPRTCP );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/UAHTerminalType
+    segmentName.Copy( KNSmlDMVoIPUAHTerminalType );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/UAHWLANMAC
+    segmentName.Copy( KNSmlDMVoIPUAHWLANMAC );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/UAHString
+    segmentName.Copy( KNSmlDMVoIPUAHString );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/ProfileLockedToIAP
+    segmentName.Copy( KNSmlDMVoIPProfileLockedToIAP );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/VoIPPluginUID
+    segmentName.Copy( KNSmlDMVoIPPluginUID );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/AllowVoIPoverWCDMA
+    segmentName.Copy( KNSmlDMVoIPAllowVoIPOverWCDMA );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(), 
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/VoIPDigits
+    segmentName.Copy( KNSmlDMVoIPVoIPDigits );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/URIDomainIgnoreRule
+    segmentName.Copy( KNSmlDMVoIPURIDomainIgnoreRule );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/AutoAcceptBuddyRequest
+    segmentName.Copy( KNSmlDMVoIPAutoAcceptBuddyRequest );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/UsedVoIPRelease
+    segmentName.Copy( KNSmlDMVoIPUsedVoIPRelease );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/AddUserPhone
+    segmentName.Copy( KNSmlDMVoIPAddUserPhone );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/ProviderBookmarkURI
+    segmentName.Copy( KNSmlDMVoIPProviderBookmarkUri );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/SIPConnectivityTestURI
+    segmentName.Copy( KNSmlDMVoIPSIPConnTestUri );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/NATFWProfileId
+    segmentName.Copy( KNSmlDMVoIPNatFwProfileId );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/MinSessionInterval
+    segmentName.Copy( KNSmlDMVoIPMinSessionInterval );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/SessionExpires
+    segmentName.Copy( KNSmlDMVoIPSessionExpires );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/BradingDataURI
+    segmentName.Copy( KNSmlDMVoIPBrandingDataUri );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/PresenceSettingsId
+    segmentName.Copy( KNSmlDMVoIPPresenceSettingsId );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/UsedNATProtocol
+    segmentName.Copy( KNSmlDMVoIPUsedNatProtocol );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/AutoEnable
+    segmentName.Copy( KNSmlDMVoIPAutoEnable );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/SnapProfileId
+    segmentName.Copy( KNSmlDMVoIPSnapProfileId );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    // VoIP/x/EnableIM
+    segmentName.Copy( KNSmlDMVoIPEnableIm );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        segmentName );
+    aCurrentURISegmentList->InsertL( aCurrentURISegmentList->Size(),
+        KNSmlDMVoIPSeparator );
+
+    DBG_PRINT("CNSmlDmVoIPAdapter::VoipChildListL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::AddNodeObjectL
+// Adds a new node.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::AddNodeObjectL( 
+    const TDesC8& aURI, 
+    const TDesC8& aParentLUID, 
+    const TInt aStatusRef )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::AddNodeObjectL(): begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    CSmlDmAdapter::TError retValue = EOk;
+
+    // Load VoIP profile information if not loaded yet
+    if ( !iProfileEntries.Count() )
+        {
+        LoadProfilesL();
+        }
+    // Find profile from array, profile deleted from elsewhere if not found
+    if ( aParentLUID.Length() > 0 )
+        {
+        TInt profileID = FindProfileLocation ( aParentLUID );
+        if ( KErrNotFound == profileID )
+            {
+            retValue = CSmlDmAdapter::ENotFound;
+            }
+        else
+            {
+            retValue = CSmlDmAdapter::EAlreadyExists;
+            }
+        }
+
+    // Get last URI segment. 
+    TBuf8<KNSmlVoIPMaxUriLength> uri = aURI;
+    TBuf8<KNSmlVoIPMaxUriLength> mappingInfo ( KNullDesC8 );
+    TPtrC8 uriSeg = LastURISeg( aURI );
+    TPtrC8 uriTmp = RemoveLastURISeg( aURI );
+    TPtrC8 secondLastUriSeg = LastURISeg( uriTmp );
+
+     // Find profile
+    iProfileID = FindProfileLocation( aParentLUID );
+
+    // ==============================
+    // VoIP node ( add )
+    // ==============================
+    //
+    // VoIP/x/VoIP
+    if ( KNSmlDMVoIPNodeName() == secondLastUriSeg 
+        && ( EOk == retValue || ENotFound == retValue ) )
+        {
+        // Check OOD before saving new profile.
+        RFs fs;
+        User::LeaveIfError( fs.Connect() );
+        CleanupClosePushL( fs ); // CS:1
+
+        // VoIP settings are stored in three files.
+        if ( SysUtil::FFSSpaceBelowCriticalLevelL( 
+            &fs, KNSmlDMFatMinimumFileSize * 3 ) )
+            {
+            // Prevent writing in OOD.
+            CleanupStack::PopAndDestroy( &fs ); // CS:0
+            iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EDiskFull );
+            DBG_PRINT("CNSmlDmVoIPAdapter::AddNodeObjectL(): DISK FULL end");
+            return;
+            }
+        CleanupStack::PopAndDestroy( &fs ); // CS:0
+        CRCSEProfileEntry* newProfileEntry = CRCSEProfileEntry::NewLC();
+        iCRCSEProfile->GetDefaultProfile( *newProfileEntry );
+        if ( uriSeg.Length() < KMaxSettingsNameLength )
+            {
+            newProfileEntry->iSettingsName.Copy( uriSeg );
+            }
+        newProfileEntry->iProviderName.Copy( KDefaultSettingsName );
+        CheckDuplicateNameL( *newProfileEntry );
+        CheckDuplicateProviderL( *newProfileEntry );
+
+        CRCSEAudioCodecEntry* newAudioCodecEntry1 = 
+            CRCSEAudioCodecEntry::NewLC();
+        newAudioCodecEntry1->SetDefaultCodecValueSet( KAudioCodecAMRWB() );
+        newAudioCodecEntry1->iMediaSubTypeName = KAudioCodecAMRWB;
+        TUint32 codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry1 );
+        newProfileEntry->iPreferredCodecs.Append( codecId );
+        newAudioCodecEntry1->iCodecId = codecId;
+        iCodecEntries.AppendL( newAudioCodecEntry1 );
+        CleanupStack::Pop( newAudioCodecEntry1 );
+
+        CRCSEAudioCodecEntry* newAudioCodecEntry2 = 
+            CRCSEAudioCodecEntry::NewLC();
+        newAudioCodecEntry2->SetDefaultCodecValueSet( KAudioCodecAMR() );
+        newAudioCodecEntry2->iMediaSubTypeName = KAudioCodecAMR;        
+        codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry2 );
+        newProfileEntry->iPreferredCodecs.Append( codecId );
+        newAudioCodecEntry2->iCodecId = codecId; 
+        iCodecEntries.AppendL( newAudioCodecEntry2 );
+        CleanupStack::Pop( newAudioCodecEntry2 );
+
+        CRCSEAudioCodecEntry* newAudioCodecEntry3 = 
+            CRCSEAudioCodecEntry::NewLC();
+        newAudioCodecEntry3->SetDefaultCodecValueSet( KAudioCodecPCMU() );
+        newAudioCodecEntry3->iMediaSubTypeName = KAudioCodecPCMU;
+        codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry3 );
+        newProfileEntry->iPreferredCodecs.Append( codecId );
+        newAudioCodecEntry3->iCodecId = codecId;
+        iCodecEntries.AppendL( newAudioCodecEntry3 );
+        CleanupStack::Pop( newAudioCodecEntry3 );
+
+        CRCSEAudioCodecEntry* newAudioCodecEntry4 = 
+            CRCSEAudioCodecEntry::NewLC();
+        newAudioCodecEntry4->SetDefaultCodecValueSet( KAudioCodecPCMA() );
+        newAudioCodecEntry4->iMediaSubTypeName = KAudioCodecPCMA;
+        codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry4 );
+        newProfileEntry->iPreferredCodecs.Append( codecId );
+        newAudioCodecEntry4->iCodecId = codecId; 
+        iCodecEntries.AppendL( newAudioCodecEntry4 );
+        CleanupStack::Pop( newAudioCodecEntry4 );
+
+        CRCSEAudioCodecEntry* newAudioCodecEntry5 = 
+            CRCSEAudioCodecEntry::NewLC();
+        newAudioCodecEntry5->SetDefaultCodecValueSet( KAudioCodeciLBC() );
+        newAudioCodecEntry5->iMediaSubTypeName = KAudioCodeciLBC;
+        codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry5 );
+        newProfileEntry->iPreferredCodecs.Append( codecId );
+        newAudioCodecEntry5->iCodecId = codecId; 
+        iCodecEntries.AppendL( newAudioCodecEntry5 );
+        CleanupStack::Pop( newAudioCodecEntry5 );
+
+        CRCSEAudioCodecEntry* newAudioCodecEntry6 = 
+            CRCSEAudioCodecEntry::NewLC();
+        newAudioCodecEntry6->SetDefaultCodecValueSet( KAudioCodecG729() );
+        newAudioCodecEntry6->iMediaSubTypeName = KAudioCodecG729;
+        codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry6 );
+        newProfileEntry->iPreferredCodecs.Append( codecId );
+        newAudioCodecEntry6->iCodecId = codecId;
+        iCodecEntries.AppendL( newAudioCodecEntry6 );
+        CleanupStack::Pop( newAudioCodecEntry6 );
+
+        CRCSEAudioCodecEntry* newAudioCodecEntry7 = 
+            CRCSEAudioCodecEntry::NewLC();
+        newAudioCodecEntry7->SetDefaultCodecValueSet( KAudioCodecCN() );
+        newAudioCodecEntry7->iMediaSubTypeName = KAudioCodecCN;
+        codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry7 );
+        newProfileEntry->iPreferredCodecs.Append( codecId );
+        newAudioCodecEntry7->iCodecId = codecId;
+        iCodecEntries.AppendL( newAudioCodecEntry7 );
+        CleanupStack::Pop( newAudioCodecEntry7 );
+
+        // Add SettingIds entry.
+        TSettingIds idEntry;
+        idEntry.iProfileType = -1;
+        // SIPSpecific not supported => ID not found.
+        idEntry.iProfileSpecificSettingId = KErrNotFound;
+        idEntry.iProfileId = -1;
+        newProfileEntry->iIds.Append( idEntry ); 
+
+        // Add new VoIP profile.
+        TUint32 profileID = iCRCSEProfile->AddL( *newProfileEntry );
+        newProfileEntry->iId = profileID;
+        iProfileEntries.AppendL( newProfileEntry );
+
+        // Add LUID mapping to first SettingIds of profile.
+        uri.Copy( aURI );
+        uri.Append( KNSmlDMVoIPSeparator );
+        uri.Append( KNSmlDMVoIPSettingIdsNode );
+        uri.Append( KNSmlDMVoIPSeparator );
+        uri.Append( KNSmlDMVoIPSettingId );
+        uri.AppendNumFixedWidthUC( 1, EDecimal, 3 );
+        mappingInfo.Copy( KNSmlDMVoIPPrefix );
+        mappingInfo.AppendNumFixedWidthUC( profileID, EDecimal, 10 );
+        mappingInfo.Append( KNSmlDMVoIPSeparator );
+        mappingInfo.Append( KNSmlDMVoIPSettingId );
+        mappingInfo.AppendNumFixedWidthUC( 0, EDecimal, 10 );
+        iDmCallback->SetMappingL( uri, mappingInfo ); 
+
+        // Add LUID mapping for CodecSettings and preferredCodecs.
+        for ( TInt counter = 0; counter < newProfileEntry->
+            iPreferredCodecs.Count(); counter++ )
+            {
+            uri.Copy( aURI );
+            uri.Append( KNSmlDMVoIPSeparator );
+            uri.Append( KNSmlDMVoIPCodecSettingsNode );
+            uri.Append( KNSmlDMVoIPSeparator );
+            uri.Append( KNSmlDMVoIPCodecSettingsId );
+            uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
+            mappingInfo.Copy( KNSmlDMVoIPPrefix );
+            mappingInfo.AppendNumFixedWidthUC( profileID, EDecimal, 10 );
+            mappingInfo.Append( KNSmlDMVoIPSeparator );
+            mappingInfo.Append( KNSmlDMVoIPCodecSettingsId );
+            mappingInfo.AppendNumFixedWidthUC( newProfileEntry->
+                iPreferredCodecs[counter], EDecimal, 10 );
+            iDmCallback->SetMappingL( uri, mappingInfo ); 
+
+            uri.Copy( aURI );
+            uri.Append( KNSmlDMVoIPSeparator );
+            uri.Append( KNSmlDMVoIPPreferredCodecsNode );
+            uri.Append( KNSmlDMVoIPSeparator );
+            uri.Append( KNSmlDMVoIPPreferredCodecId );
+            uri.AppendNumFixedWidthUC( counter + 1, EDecimal, 3 );
+            mappingInfo.Copy( KNSmlDMVoIPPrefix );
+            mappingInfo.AppendNumFixedWidthUC( profileID, EDecimal, 10 );
+            mappingInfo.Append( KNSmlDMVoIPSeparator );
+            mappingInfo.Append( KNSmlDMVoIPPreferredCodecId );
+            mappingInfo.AppendNumFixedWidthUC( counter, EDecimal, 10 );
+            iDmCallback->SetMappingL( uri, mappingInfo ); 
+            }
+
+        // Set LUID mapping to DM module.
+        mappingInfo.Copy ( KNSmlDMVoIPPrefix );
+        mappingInfo.AppendNumFixedWidthUC( profileID, EDecimal, 10 );
+        iDmCallback->SetMappingL( aURI, mappingInfo ); 
+
+        CleanupStack::Pop( newProfileEntry );
+
+        retValue = CSmlDmAdapter::EOk;
+        }
+
+    if ( KErrNotFound != iProfileID )
+        {
+        // ==============================
+        // CodecSettings node (add)
+        // ==============================
+        //
+        if ( KNSmlDMVoIPCodecSettingsNode() == secondLastUriSeg &&
+            KErrNotFound == aParentLUID.Find( KNSmlDMVoIPCodecSettingsId ) )
+            {
+            CRCSEAudioCodecEntry *newAudioCodecEntry = 
+                CRCSEAudioCodecEntry::NewLC();
+            iCRCSEAudioCodec->GetDefaultCodec( *newAudioCodecEntry );
+            TUint32 codecId = iCRCSEAudioCodec->AddL( *newAudioCodecEntry );
+            newAudioCodecEntry->iCodecId = codecId;
+            iCodecEntries.AppendL( newAudioCodecEntry );
+
+            // Add new codec ID to iPreferredCodecs of current VoIP profile.
+            iProfileEntries[iProfileID]->
+                iPreferredCodecs.Append( codecId );
+
+            // Update VoIP profile back to permanent store.    
+            iCRCSEProfile->UpdateL( iProfileEntries[iProfileID]->
+                iId, *iProfileEntries[iProfileID] );
+            CleanupStack::Pop( newAudioCodecEntry );
+
+            // Add LUID mapping to new codecsettings entry.
+            mappingInfo.Copy( KNSmlDMVoIPPrefix );
+            TUint val( iProfileEntries[iProfileID]->iId );
+            mappingInfo.AppendNumFixedWidthUC( val, EDecimal, 10 );
+            mappingInfo.Append( KNSmlDMVoIPSeparator );
+            mappingInfo.Append( KNSmlDMVoIPCodecSettingsId );
+            mappingInfo.AppendNumFixedWidthUC( codecId, EDecimal, 10 );
+            iDmCallback->SetMappingL( aURI, mappingInfo );
+
+            // Add LUID mapping to new preferredcodecs entry.
+            uri.Copy( RemoveLastURISeg( RemoveLastURISeg( aURI ) ) );
+            uri.Append( KNSmlDMVoIPSeparator );
+            uri.Append( KNSmlDMVoIPPreferredCodecsNode );
+            uri.Append( KNSmlDMVoIPSeparator );
+            uri.Append( KNSmlDMVoIPPreferredCodecId );
+            uri.AppendNumFixedWidthUC( 
+                iProfileEntries[iProfileID]->iPreferredCodecs.Count(),
+                EDecimal, 3 );
+            mappingInfo.Copy( KNSmlDMVoIPPrefix );
+            mappingInfo.AppendNumFixedWidthUC( iProfileID, EDecimal, 10 );
+            mappingInfo.Append( KNSmlDMVoIPSeparator );
+            mappingInfo.Append( KNSmlDMVoIPPreferredCodecId );
+            mappingInfo.AppendNumFixedWidthUC( 
+                iProfileEntries[iProfileID]->iPreferredCodecs.Count() - 1,
+                EDecimal, 10 );
+            iDmCallback->SetMappingL( uri, mappingInfo );    
+            retValue = CSmlDmAdapter::EOk;
+            }
+
+        // ==============================
+        // ModeSet node (add)
+        // ==============================
+        //
+        if ( KNSmlDMVoIPModeSetNode() == secondLastUriSeg
+            && KErrNotFound == aParentLUID.Find( KNSmlDMVoIPModeId ) )
+            {
+            // Get codec ID used by these settings.
+            TUint32 codecId = DesToInt( aParentLUID.Right( 10 ) );
+            TInt codecPos = FindCodecLocation( codecId );
+            if ( KErrNotFound != codecPos )
+                {
+                iCodecEntries[codecPos]->iModeSet.Append( 1 );
+                iCRCSEAudioCodec->UpdateL( codecId,
+                    *iCodecEntries[codecPos] );
+
+                // All LUID mapping to new mode-set item.
+                mappingInfo.Copy( aParentLUID );
+                mappingInfo.Append( KNSmlDMVoIPSeparator );
+                mappingInfo.Append( KNSmlDMVoIPModeId );
+                mappingInfo.AppendNumFixedWidthUC( 
+                    iCodecEntries[codecPos]->iModeSet.Count() - 1,
+                    EDecimal, 10 );
+                iDmCallback->SetMappingL( aURI, mappingInfo ); 
+                retValue = CSmlDmAdapter::EOk;    
+                }
+            else
+                {
+                retValue = CSmlDmAdapter::EError;    
+                }
+            }
+
+        // ==============================
+        // SettingIds node (add)  
+        // ==============================
+        //
+        if ( KNSmlDMVoIPSettingIdsNode() == secondLastUriSeg &&
+            KErrNotFound == aParentLUID.Find( KNSmlDMVoIPSettingId ) )
+            {
+            TSettingIds idEntry;
+            idEntry.iProfileType = 0;
+            idEntry.iProfileSpecificSettingId = -1;
+            idEntry.iProfileId = 0;
+            iProfileEntries[iProfileID]->iIds.Append( idEntry ); 
+            iCRCSEProfile->UpdateL( iProfileEntries[iProfileID]->iId, 
+                *iProfileEntries[iProfileID] );
+            mappingInfo.Copy( KNSmlDMVoIPPrefix );
+            TUint val( iProfileEntries[iProfileID]->iId );
+            mappingInfo.AppendNumFixedWidthUC( val, EDecimal, 10 );
+            mappingInfo.Append( KNSmlDMVoIPSeparator );
+            mappingInfo.Append( KNSmlDMVoIPSettingId );
+            mappingInfo.AppendNumFixedWidthUC( 
+                iProfileEntries[iProfileID]->iIds.Count() - 1, EDecimal, 10 );
+            iDmCallback->SetMappingL( aURI, mappingInfo );       
+            retValue = CSmlDmAdapter::EOk;
+            }
+        }
+
+    // Return status ok for existing leaf nodes that do not need
+    // to be added separately.    
+    if ( aParentLUID.Length() > 0 && 
+        retValue != CSmlDmAdapter::ENotFound &&
+        ( KNSmlDMVoIPCodecSettingsNode() == uriSeg
+        || KNSmlDMVoIPModeSetNode() == uriSeg
+        || KNSmlDMVoIPSettingIdsNode() == uriSeg
+        || KNSmlDMVoIPSettingIdsNode() == uriSeg
+        || KNSmlDMVoIPVmbxNode() == uriSeg
+        ) )
+        {
+        retValue = CSmlDmAdapter::EOk;   
+        }
+    iDmCallback->SetStatusL( aStatusRef, retValue );
+
+    DBG_PRINT("CNSmlDmVoIPAdapter::AddNodeObjectL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::UpdateLeafObjectL 
+// For streaming large object data.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::UpdateLeafObjectL( 
+    const TDesC8& /*aURI*/, 
+    const TDesC8& /*aLUID*/, 
+    RWriteStream*& /*aStream*/, 
+    const TDesC8& /*aType*/, 
+    const TInt aStatusRef )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): stream: begin");
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+    iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    DBG_PRINT("CNSmlDmVoIPAdapter::UpdateLeafObjectL(): stream: end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::FetchLeafObjectSizeL
+// Fetches leaf object size of aURI.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::FetchLeafObjectSizeL( 
+    const TDesC8& aURI, 
+    const TDesC8& aLUID, 
+    const TDesC8& aType, 
+    const TInt aResultsRef, 
+    const TInt aStatusRef )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::FetchLeafObjectSizeL(): begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    CBufBase *object = CBufFlat::NewL( 1 );
+    CleanupStack::PushL( object );
+    CSmlDmAdapter::TError retValue = FetchObjectL( aURI, aLUID, *object );
+
+    TInt objSizeInBytes = object->Size();
+    TBuf8<16> stringObjSizeInBytes;
+    stringObjSizeInBytes.Num( objSizeInBytes );
+    object->Reset();
+    object->InsertL( 0, stringObjSizeInBytes );
+
+    iDmCallback->SetStatusL( aStatusRef, retValue );
+    iDmCallback->SetResultsL( aResultsRef, *object, aType );
+    CleanupStack::PopAndDestroy( object ); 
+    object = NULL;
+    DBG_PRINT("CNSmlDmVoIPAdapter::FetchLeafObjectSizeL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::ExecuteCommandL  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::ExecuteCommandL( 
+    const TDesC8& /*aURI*/, 
+    const TDesC8& /*aLUID*/, 
+    const TDesC8& /*aArgument*/, 
+    const TDesC8& /*aType*/, 
+    const TInt aStatusRef )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::ExecuteCommandL(): begin");
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+    iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    DBG_PRINT("CNSmlDmVoIPAdapter::ExecuteCommandL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::ExecuteCommandL  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::ExecuteCommandL( 
+    const TDesC8& /*aURI*/, 
+    const TDesC8& /*aParentLUID*/, 
+    RWriteStream*& /*aStream*/, 
+    const TDesC8& /*aType*/, 
+    const TInt aStatusRef )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::ExecuteCommandL(): stream: begin");
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+    iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    DBG_PRINT("CNSmlDmVoIPAdapter::ExecuteCommandL(): stream: end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::CopyCommandL  
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::CopyCommandL( 
+    const TDesC8& /*aTargetURI*/, 
+    const TDesC8& /*aTargetLUID*/, 
+    const TDesC8& /*aSourceURI*/, 
+    const TDesC8& /*aSourceLUID*/, 
+    const TDesC8& /*aType*/, 
+    TInt aStatusRef )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::CopyCommandL(): begin");
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+    iDmCallback->SetStatusL( aStatusRef, CSmlDmAdapter::EError );
+    DBG_PRINT("CNSmlDmVoIPAdapter::CopyCommandL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::StartAtomicL
+// For signaling adapter of beginning of the atomic section
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::StartAtomicL()
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::StartAtomicL(): begin");
+    DBG_PRINT("CNSmlDmVoIPAdapter::StartAtomicL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::CommitAtomicL
+// The CommitAtomicL call is issued only if all the commands in the Atomic were successful 
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::CommitAtomicL()
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::CommitAtomicL(): begin");
+    DBG_PRINT("CNSmlDmVoIPAdapter::CommitAtomicL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::RollbackAtomicL
+// For signaling adapter to roll back all atomic commands
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::RollbackAtomicL()
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::RollbackAtomicL(): begin");
+    DBG_PRINT("CNSmlDmVoIPAdapter::RollbackAtomicL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::StreamingSupport
+// For telling framework whether streaming large object data is supported
+// ---------------------------------------------------------------------------
+//
+TBool CNSmlDmVoIPAdapter::StreamingSupport( TInt& /*aItemSize*/ )
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::StreamingSupport(): begin");
+    DBG_PRINT("CNSmlDmVoIPAdapter::StreamingSupport(): end");
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::StreamCommittedL()
+// For telling adapter when streaming large object is finished.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::StreamCommittedL()
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::StreamCommittedL(): begin");
+    DBG_PRINT("CNSmlDmVoIPAdapter::StreamCommittedL(): end");
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::CompleteOutstandingCmdsL()
+// When all buffered dm commands are sent to adapter, set SIP User Agent 
+// Header into SIPManagedProfile, and save all changes.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::CompleteOutstandingCmdsL()
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::CompleteOutstandingCmdsL(): begin");
+
+    // Save only profiles that have changed. If there are such profiles,
+    // save changed profiles back to permanent store
+    if ( iProfileEntries.Count() )
+        {
+        for ( TInt counter = 0; counter < iProfileModifs.Count(); counter++ )
+            {
+            for ( TInt index = 0; index < iProfileEntries[counter]->
+                iIds.Count(); index++ )
+                {
+                if ( ( 0 == iProfileEntries[counter]->
+                    iIds[index].iProfileType ) 
+                    && iProfileEntries[counter]->
+                        iIds[index].iProfileId > 0
+                    && ( iProfileEntries[counter]->
+                        iSIPVoIPUAHTerminalType ||
+                        iProfileEntries[counter]->
+                        iSIPVoIPUAHeaderWLANMAC ||
+                        iProfileEntries[counter]->
+                        iSIPVoIPUAHeaderString.Length() > 0 ||
+                        iAllowVoIPOverWCDMAModified ) )
+                    {
+                    // Create objects that allow the creation of
+                    // CSIPManagedProfile object.
+                    CSIPProfile* sipProf = NULL;
+                    CSIPProfileRegistryObserver* sipRegObs =
+                        CSIPProfileRegistryObserver::NewLC(); // CS:1
+                    CSIPManagedProfileRegistry* sipProfReg = 
+                        CSIPManagedProfileRegistry::NewLC( 
+                            *sipRegObs ); // CS:2
+                    TRAPD( err, ( sipProf = sipProfReg->ProfileL( 
+                        iProfileEntries[counter]->
+                        iIds[index].iProfileId ) ) );
+                    if ( KErrNone == err )
+                        {
+                        CSIPManagedProfile* sipManProf = 
+                            static_cast<CSIPManagedProfile*>( sipProf );
+                        CleanupStack::PushL( sipManProf ); // CS:3
+                        // Compile the User Agent Header into a TBuf string.
+                        TBuf8<KTempStringlength> userAgentHeader;
+                        TBuf<KMaxTerminalTypeLength> tempTerminalType;
+                        TBuf<KWlanMacAddressLength> tempWlanMac;
+                        TBuf<KMaxSettingsLength32> tempFreeString;
+                        tempFreeString = iProfileEntries[counter]->
+                            iSIPVoIPUAHeaderString;
+
+                        userAgentHeader.Append( KUserAgent );
+                        userAgentHeader.Append( KColonMark );
+                        userAgentHeader.Append( KSpaceMark );
+
+                        if ( iProfileEntries[counter]->
+                            iSIPVoIPUAHTerminalType )
+                            {
+                            GetTerminalTypeL( tempTerminalType );
+                            userAgentHeader.Append( tempTerminalType );
+                            userAgentHeader.Append( KSpaceMark );
+                            }
+                        if ( iProfileEntries[counter]->
+                            iSIPVoIPUAHeaderWLANMAC )
+                            {
+                            GetWlanMacAddressL( tempWlanMac );
+                            userAgentHeader.Append( tempWlanMac );
+                            userAgentHeader.Append( KSpaceMark );
+                            }
+                        if ( tempFreeString.Length() > 0 )
+                            {
+                            userAgentHeader.Append( tempFreeString );
+                            }
+
+                        // Create an array for setting the user agent header.
+                        // Granularity is 1 since only one item is appended
+                        // into the array.
+                        CDesC8ArrayFlat* uahArray = new ( ELeave ) 
+                            CDesC8ArrayFlat( 1 );
+        	            CleanupStack::PushL( uahArray ); // CS:4
+        	            uahArray->AppendL( userAgentHeader );
+                        if ( userAgentHeader.Length() > 0 )
+                            {
+                            User::LeaveIfError( 
+                                sipManProf->SetParameter( 
+                                KSIPHeaders, *uahArray ) );
+                            }
+                        
+                        if ( iAllowVoIPOverWCDMAModified )
+                            {
+                            if ( iProfileEntries[iProfileID]->
+                                    iAllowVoIPoverWCDMA == 
+                                     CRCSEProfileEntry::EOn )
+                                {
+                                User::LeaveIfError( 
+                                    sipManProf->SetParameter( 
+                                    KBearerType, KBearerNotSpecified ) );
+                                }
+                            else if ( iProfileEntries[iProfileID]->
+                                         iAllowVoIPoverWCDMA ==
+                                         CRCSEProfileEntry::EOff )
+                                {
+                                User::LeaveIfError( 
+                                    sipManProf->SetParameter( 
+                                    KBearerType, KBearerWlanOnly ) );
+                                }
+                            iAllowVoIPOverWCDMAModified = EFalse;
+                            }
+
+                        sipProfReg->SaveL( *sipManProf );
+                        uahArray->Reset();
+                        // uahArray, sipManProf 
+                        CleanupStack::PopAndDestroy( uahArray );  // CS:3
+                        CleanupStack::PopAndDestroy( sipManProf );  // CS:2
+                        }// if
+                    // sipProfReg, sipRegObs
+                    CleanupStack::PopAndDestroy( sipProfReg ); // CS:1
+                    CleanupStack::PopAndDestroy( sipRegObs ); // CS:0
+                    sipProf = NULL;
+                    }// if
+                }// for
+            iCRCSEProfile->UpdateL( 
+                iProfileEntries[iProfileModifs[counter]]->iId,
+                *iProfileEntries[iProfileModifs[counter]] );
+            }
+        iProfileModifs.Reset();
+        }
+
+    if ( iCodecEntries.Count() )
+        {
+        for ( TInt counter = 0; counter < iCodecModifs.Count(); counter++ )
+            {
+            iCRCSEAudioCodec->UpdateL( iCodecEntries[iCodecModifs[counter]]->
+                iCodecId, *iCodecEntries[iCodecModifs[counter]] );
+            }
+        iCodecModifs.Reset();
+        }  
+
+    // Since CRCSEProfileRegistry::UpdateL takes CRCSEProfileEntry as const,
+    // the service ID'S in iProfileEntries array items have not changed.
+    // Hence load all profiles again from CRCSEProfileRegistry.
+    iCodecEntries.ResetAndDestroy();
+    iProfileEntries.ResetAndDestroy();
+    LoadProfilesL();
+
+
+    const TInt spSettingsCount = iSPSettings.Count();
+    if ( spSettingsCount )
+        {
+        // Set SPS ready for setting values.
+        CSPSettings* spSettings = CSPSettings::NewLC(); // CS:1
+
+        for ( TInt counter = 0; counter < spSettingsCount; counter++ )
+            {
+            TUint32 serviceId = 
+                iProfileEntries[iProfileID]->iServiceProviderId;
+
+            TInt err( KErrNone );
+            CSPEntry* spEntry = CSPEntry::NewLC(); // CS:2
+            err = spSettings->FindEntryL( serviceId, *spEntry );
+            User::LeaveIfError( err );
+
+            CSPProperty* property = CSPProperty::NewLC(); // CS:3
+
+            // VMBX MWI-URI.
+            if ( iSPSettings[counter]->iVmbxMwiUri->Des().Length() )
+                {
+                err = property->SetName( ESubPropertyVMBXMWIAddress );
+                property->SetValue( 
+                    iSPSettings[counter]->iVmbxMwiUri->Des() );
+                if ( KErrNone == err )
+                    {
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyVMBXMWIAddress, 
+                            iSPSettings[counter]->iVmbxMwiUri->Des() ) );
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+
+                // Let's check if listening URI has been or is about
+                // to be set. If not, set same as in MWI address.
+                CSPProperty* listeningUri = CSPProperty::NewLC();
+                err = spSettings->FindPropertyL( serviceId, 
+                    ESubPropertyVMBXListenAddress, *listeningUri );
+                if ( KErrNone != err && 
+                    !iSPSettings[counter]->iVmbxListenUri->Des().Length() )
+                    {
+                    delete iSPSettings[counter]->iVmbxListenUri;
+                    iSPSettings[counter]->iVmbxListenUri = NULL;
+                    iSPSettings[counter]->iVmbxListenUri = 
+                        iSPSettings[counter]->iVmbxMwiUri->Des().AllocL();
+                    }
+                CleanupStack::PopAndDestroy( listeningUri );
+
+                // Let's check if re-subscribe interval has been or is
+                // about to be set. If not, set default value.
+                CSPProperty* reSubscrInterval = CSPProperty::NewLC();
+                err = spSettings->FindPropertyL( serviceId, 
+                    ESubPropertyVMBXMWISubscribeInterval, *reSubscrInterval );
+                if ( KErrNone != err && 
+                    iSPSettings[counter]->iReSubscribeInterval == KErrNotFound )
+                    {
+                    iSPSettings[counter]->iReSubscribeInterval = 
+                        KDefaultReSubscribe;
+                    }
+                CleanupStack::PopAndDestroy( reSubscrInterval );
+                }
+
+            // VMBX ListeningURI.
+            if ( iSPSettings[counter]->iVmbxListenUri->Des().Length() )
+                {
+                err = property->SetName( ESubPropertyVMBXListenAddress );
+                property->SetValue( 
+                    iSPSettings[counter]->iVmbxListenUri->Des() );
+                if ( KErrNone == err )
+                    {
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyVMBXListenAddress, 
+                            iSPSettings[counter]->iVmbxListenUri->Des() ) );
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                }
+
+            // VMBX IAP ID.
+            if ( KErrNone != iSPSettings[counter]->iVmbxIapId )
+                {
+                err = property->SetName( ESubPropertyVMBXPreferredIAPId );
+                property->SetValue( iSPSettings[counter]->iVmbxIapId );
+                if ( KErrNone == err )
+                    {
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyVMBXPreferredIAPId, 
+                            iSPSettings[counter]->iVmbxIapId ) );
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                }
+
+            // VMBX re-SUBSCRIBE interval.
+            if ( KErrNotFound != iSPSettings[counter]->iReSubscribeInterval )
+                {
+                err = property->SetName( 
+                    ESubPropertyVMBXMWISubscribeInterval );
+                property->SetValue( 
+                    iSPSettings[counter]->iReSubscribeInterval );
+                if ( KErrNone == err )
+                    {
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyVMBXMWISubscribeInterval, 
+                            iSPSettings[counter]->iReSubscribeInterval ) );
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                }
+
+            // VMBX SIP ID.
+            if ( KErrNone != iSPSettings[counter]->iVmbxSipId )
+                {
+                err = property->SetName( ESubPropertyVMBXSettingsId );
+                property->SetValue( iSPSettings[counter]->iVmbxSipId );
+                if ( KErrNone == err )
+                    {
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyVMBXSettingsId, 
+                            iSPSettings[counter]->iVmbxSipId ) );
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                }
+
+            // Service provider bookmark URI.
+            if ( iSPSettings[counter]->iServiceProviderBookmark->
+                Des().Length() )
+                {
+                err = property->SetName( EPropertyServiceBookmarkUri );
+                property->SetValue( 
+                    iSPSettings[counter]->iServiceProviderBookmark->Des() );
+                if ( KErrNone == err )
+                    {
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            EPropertyServiceBookmarkUri, 
+                            iSPSettings[counter]->
+                            iServiceProviderBookmark->Des() ) );
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                }
+
+            // Branding data URI.
+            if ( iSPSettings[counter]->iBrandingDataUri->Des().Length() )
+                {
+                err = property->SetName( ESubPropertyVoIPBrandDataUri );
+                property->SetValue( 
+                    iSPSettings[counter]->iBrandingDataUri->Des() );
+                if ( KErrNone == err )
+                    {
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyVoIPBrandDataUri, 
+                            iSPSettings[counter]->iBrandingDataUri->Des() ) );
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                }
+
+            // Presence settings ID.
+            if ( KErrNone != iSPSettings[counter]->iPresenceId )
+                {
+                err = property->SetName( ESubPropertyPresenceSettingsId );
+                property->SetValue( 
+                    iSPSettings[counter]->iPresenceId );
+                if ( KErrNone == err )
+                    {
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyPresenceSettingsId, 
+                            iSPSettings[counter]->iPresenceId ) );
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                }
+
+            // Presence auto accept buddy request.
+            if ( KErrNotFound != iSPSettings[counter]->iAutoAcceptBuddy )
+                {
+                TOnOff value( static_cast<TOnOff>( 
+                    iSPSettings[counter]->iAutoAcceptBuddy ) );
+                err = property->SetName( 
+                    ESubPropertyPresenceRequestPreference );
+                property->SetValue( value );
+                if ( KErrNone == err )
+                    {
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyPresenceRequestPreference, value ) );
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                }
+
+            // Auto enable service.
+            if ( KErrNotFound != iSPSettings[counter]->iAutoEnableService )
+                {
+                TOnOff value( static_cast<TOnOff>( 
+                    iSPSettings[counter]->iAutoEnableService ) );
+                err = property->SetName( ESubPropertyVoIPEnabled );
+                err = property->SetValue( value );
+                if ( KErrNone == err )
+                    {
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyVoIPEnabled, value ) ) ;
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                // enable presence
+                if ( KErrNone != iSPSettings[counter]->iPresenceId )
+                    {
+                    err = property->SetName( ESubPropertyPresenceEnabled );
+                    property->SetValue( value );
+                    if ( KErrNone == err )
+                        {
+                        err = spEntry->AddPropertyL( *property );
+                        if ( KErrAlreadyExists == err )
+                            {
+                            User::LeaveIfError( spEntry->UpdateProperty( 
+                                ESubPropertyPresenceEnabled, value ) );
+                            }
+                        else
+                            {
+                            User::LeaveIfError( err );
+                            }
+                        }
+                    }
+                // enable voicemailbox
+                if ( KErrNone != iSPSettings[counter]->iVmbxIapId )
+                    {
+                    err = property->SetName( ESubPropertyVMBXEnabled );
+                    property->SetValue( value );
+                    if ( KErrNone == err )
+                        {
+                        err = spEntry->AddPropertyL( *property );
+                        if ( KErrAlreadyExists == err )
+                            {
+                            User::LeaveIfError( spEntry->UpdateProperty( 
+                                ESubPropertyVMBXEnabled, value ) );
+                            }
+                        else
+                            {
+                            User::LeaveIfError( err );
+                            }
+                        }
+                    }
+                }
+
+            // SNAP Profile ID.
+            if ( KErrNone != iSPSettings[counter]->iSnapId )
+                {
+                err = property->SetName( ESubPropertyVoIPPreferredSNAPId );
+                property->SetValue( iSPSettings[counter]->iSnapId );
+                if ( KErrNone == err )
+                    {
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyVoIPPreferredSNAPId, 
+                            iSPSettings[counter]->iSnapId ) );
+                        }
+                    else
+                        {
+                        User::LeaveIfError( err );
+                        }
+                    }
+                }
+
+            // Enable IM
+            if ( KErrNotFound != iSPSettings[counter]->iImEnabled )
+                {
+                // IM is enabled => add or set IM properties.
+                if ( iSPSettings[counter]->iImEnabled )
+                    {
+                    // IM enabled.
+                    property->SetName( ESubPropertyIMEnabled );
+                    property->SetValue( EOn );
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyIMEnabled, EOn ) );
+                        }
+
+                    // IM launch UID.
+                    property->SetName( ESubPropertyIMLaunchUid );
+                    property->SetValue( KIMLaunchUid );
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyIMLaunchUid, KIMLaunchUid ) );
+                        }
+
+                    // IM settings ID.
+                    property->SetName( ESubPropertyIMSettingsId );
+                    // The value only needs to be different from 0,
+                    // no-one actually uses it.
+                    property->SetValue( KIMSettingsId );
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            ESubPropertyIMSettingsId, KIMSettingsId ) );
+                        }
+
+                    // IM sub-service plugin UID.
+                    property->SetName( EPropertyIMSubServicePluginId );
+                    property->SetValue( KIMSubServicePluginId );
+                    err = spEntry->AddPropertyL( *property );
+                    if ( KErrAlreadyExists == err )
+                        {
+                        User::LeaveIfError( spEntry->UpdateProperty( 
+                            EPropertyIMSubServicePluginId, 
+                            KIMSubServicePluginId ) );
+                        }
+
+                    // IM preferred SNAP ID.
+                    const CSPProperty* snap;
+                    spEntry->GetProperty( snap, 
+                        ESubPropertyVoIPPreferredSNAPId );
+                    TInt snapId( KErrNone );
+                    err = snap->GetValue( snapId );
+                    if ( KErrNone == err )
+                        {
+                        property->SetName( ESubPropertyIMPreferredSNAPId );
+                        err = property->SetValue( snapId );
+                        if ( KErrNone == err )
+                            {
+                            err = spEntry->AddPropertyL( *property );
+                           if ( KErrAlreadyExists == err )
+                                {
+                                User::LeaveIfError( spEntry->UpdateProperty( 
+                                    ESubPropertyIMPreferredSNAPId, 
+                                    snapId ) );
+                                }
+                            }
+                        }
+
+                    // IM default tone.
+                    TFileName toneFile;
+                    toneFile.Copy( PathInfo::RomRootPath() );
+                    toneFile.Append( PathInfo::DigitalSoundsPath() );
+                    toneFile.Append( KDefaultTone );
+                    MVIMPSTSettingsStore* vimpStSettings =
+                        CVIMPSTSettingsStore::NewLC(); // CS:4
+                    User::LeaveIfError( vimpStSettings->SetL( serviceId,
+                        EServiceToneFileName, toneFile ) );
+                    // Pop vimpStSettings (can't use M object as argument).
+                    CleanupStack::PopAndDestroy(); // CS:3
+                    }
+                // IM enabled is set to false => delete IM properties.
+                else
+                    {
+                    spEntry->DeleteProperty( ESubPropertyIMEnabled );
+                    spEntry->DeleteProperty( ESubPropertyIMLaunchUid );
+                    spEntry->DeleteProperty( ESubPropertyIMSettingsId );
+                    spEntry->DeleteProperty( EPropertyIMSubServicePluginId );
+                    spEntry->DeleteProperty( ESubPropertyIMPreferredSNAPId );
+                    }
+                }
+
+            err = spSettings->UpdateEntryL( *spEntry );
+            // property, spEntry
+			CleanupStack::PopAndDestroy( property ); // CS:2
+            CleanupStack::PopAndDestroy( spEntry ); // CS:1
+            } // for
+        CleanupStack::PopAndDestroy( spSettings ); // CS:0
+        iSPSettings.ResetAndDestroy();
+        }
+
+    DBG_PRINT("CNSmlDmVoIPAdapter::CompleteOutstandingCmdsL(): end");   
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::FindProfileLocation
+// Finds profileID from aURI and returns profile location in array.
+// ---------------------------------------------------------------------------
+//
+TInt CNSmlDmVoIPAdapter::FindProfileLocation( const TDesC8& aURI ) const
+    {
+    TInt id( 0 );
+    id = aURI.Find( KNSmlDMVoIPPrefix );
+    if ( id != KErrNotFound )
+        {
+        id = DesToInt( aURI.Mid( id + KNSmlDMVoIPPrefix().Length(), 10 ) ); 
+        for ( TInt counter = 0; counter < iProfileEntries.Count(); counter++ )
+            {
+            if ( iProfileEntries[counter]->iId == id )
+                {
+                return counter;
+                }
+            }
+        }
+    return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::DesToInt
+// Converts a 8 bit descriptor to int.
+// ---------------------------------------------------------------------------
+//
+TInt CNSmlDmVoIPAdapter::DesToInt( const TDesC8& aDes ) const
+    {
+    TLex8 lex( aDes );
+    TInt value = 0;
+    lex.Val( value );
+    return value;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::DesToTUint
+// Converts a 8bit descriptor to TUint.
+// ---------------------------------------------------------------------------
+//
+TUint CNSmlDmVoIPAdapter::DesToTUint( const TDesC8& aDes ) const
+    {
+    TLex8 lex( aDes );
+    TUint value = 0;
+    lex.Val( value );
+    return value;
+    }
+
+// ---------------------------------------------------------------------------
+// TPtrC8 CNSmlDmVoIPAdapter::RemoveLastURISeg
+// returns parent uri, i.e. removes last uri segment
+// ---------------------------------------------------------------------------
+//
+const TPtrC8 CNSmlDmVoIPAdapter::RemoveLastURISeg( const TDesC8& aURI ) const
+    {
+    TInt i ( 0 );
+    if ( KErrNotFound != aURI.Find( KNSmlDMVoIPSeparator ) )
+        {
+        for ( i = aURI.Length() - 1; i >= 0; i-- )
+            {
+            if ( KDMVoIPSeparator == aURI[i]  )
+                {
+                break;
+                }
+            }
+        }
+    return aURI.Left( i );
+    }
+
+// ---------------------------------------------------------------------------
+// TInt CNSmlDmVoIPAdapter::NumOfURISegs
+// For getting the number of uri segs
+// ---------------------------------------------------------------------------
+//
+TInt CNSmlDmVoIPAdapter::NumOfURISegs( const TDesC8& aURI ) const
+    {
+    TInt numOfURISegs = 1;
+    for ( TInt i = 0; i < aURI.Length(); i++ )
+        {
+        if ( KDMVoIPSeparator == aURI[i]  )
+            {
+            numOfURISegs++;
+            }
+        }
+    return numOfURISegs;
+    }
+
+// ---------------------------------------------------------------------------
+// TPtrC8 CNSmlDmVoIPAdapter::LastURISeg
+// Returns only the last uri segment
+// ---------------------------------------------------------------------------
+//
+const TPtrC8 CNSmlDmVoIPAdapter::LastURISeg( const TDesC8& aURI ) const
+    {
+    TInt i( 0 );
+    if ( KErrNotFound != aURI.Find( KNSmlDMVoIPSeparator ) )
+        {
+        for ( i = aURI.Length() - 1; i >= 0; i-- )
+            {
+            if ( KDMVoIPSeparator == aURI[i] )
+                {
+                break;
+                }
+            }
+        }
+    if ( 0 == i )
+        {
+        return aURI;
+        }
+    else
+        {
+        return aURI.Mid( i + 1 );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// TPtrC8 CNSmlDmVoIPAdapter::RemoveDotSlash
+// return uri without dot and slash in start
+// ---------------------------------------------------------------------------
+//
+const TPtrC8 CNSmlDmVoIPAdapter::RemoveDotSlash( const TDesC8& aURI ) const
+    {
+    if ( 0 == aURI.Find( KNSmlVoIPUriDotSlash ) )
+        {
+        return aURI.Right( aURI.Length() - KNSmlVoIPUriDotSlash().Length() );
+        }
+    else
+        {
+        return aURI;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::SetSipRefL
+// Set sip reference value.
+// ---------------------------------------------------------------------------
+//
+TUint32 CNSmlDmVoIPAdapter::SetSipRefL( const TDesC8& aObject ) const
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::SetSipRef() : begin");
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    CBufBase* fetchResult = CBufFlat::NewL( 1 );
+    CleanupStack::PushL( fetchResult );
+
+    // Make all SIP profiles known
+    CSmlDmAdapter::TError errorStatus;
+    iDmCallback->FetchLinkL( KNSmlDefDMSIP, *fetchResult, errorStatus );
+
+    // Fetch SIP profile ID.
+    TBuf8<KNSmlVoIPMaxResultLength> object; 
+    object.Copy( aObject );
+    object.Append( KNSmlDMVoIPSeparator );
+    object.Append( KNSmlDMSIPSipID );
+    iDmCallback->FetchLinkL( object, *fetchResult, errorStatus );
+    TUint32 profileId = DesToInt( fetchResult->Ptr( 0 ) );    
+    CleanupStack::PopAndDestroy( fetchResult );
+    fetchResult = NULL;
+    DBG_PRINT("CNSmlDmVoIPAdapter::SetSipRef() : end");
+    return profileId;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::GetSipIdL
+// Get URI for given sip profile ID.
+// ---------------------------------------------------------------------------
+//
+MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetSipIdL( CBufBase& aObject,
+    TUint32 aID ) const
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::GetSipIdL() : begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    CBufBase* result = CBufFlat::NewL( 1 );
+    CleanupStack::PushL( result ); 
+    CSmlDmAdapter::TError errorStatus;
+    TBuf8<KNSmlVoIPMaxResultLength> object;
+    iDmCallback->FetchLinkL( KNSmlDefDMSIP, *result, errorStatus );
+    result->Compress();
+    HBufC8* childList = HBufC8::NewLC( result->Size() );
+    TInt uriSegCount( 0 );
+    if ( result->Size() > 0 )
+        {
+        childList->Des().Copy( result->Ptr(0) );
+
+        // Delete last / mark
+        childList->Des().Delete( childList->Length() - 1, 1 );    
+        uriSegCount = NumOfURISegs( childList->Des() );
+        }
+
+    for ( TInt counter = 0; counter < uriSegCount; counter++ )
+        {
+        result->Reset();
+        object.Copy( KNSmlDefDMSIP );
+        object.Append( KNSmlDMVoIPSeparator );
+        object.Append( LastURISeg( childList->Des() ) );
+
+        // Make SIP profile settings known
+        iDmCallback->FetchLinkL( object, *result, errorStatus );
+        result->Compress();
+        result->Reset();
+
+        // Get SIP id
+        object.Append( KNSmlDMVoIPSeparator );
+        object.Append( KNSmlDMSIPSipID );
+        iDmCallback->FetchLinkL( object, *result, errorStatus );
+        if ( aID == DesToInt( result->Ptr( 0 ) ) )
+            {
+            aObject.InsertL( aObject.Size(), RemoveLastURISeg( object ) );
+            break; 
+            }
+        childList->Des().Copy( RemoveLastURISeg ( childList->Des() ) );    
+        }
+    // childList, result 
+    CleanupStack::PopAndDestroy( childList ); // CS:1
+    CleanupStack::PopAndDestroy( result ); // CS:0
+    result = NULL;
+    childList = NULL;
+    DBG_PRINT("CNSmlDmVoIPAdapter::GetSipIdL() : end");
+    return errorStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::SetSccpRefL
+// Set SCCP reference value. 
+// ---------------------------------------------------------------------------
+//
+TUint CNSmlDmVoIPAdapter::SetSccpRefL( const TDesC8& aObject ) const
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::SetSccpRef() : begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    CBufBase* fetchResult = CBufFlat::NewL( 1 );
+    CleanupStack::PushL( fetchResult );
+
+    // Make all SCCP profiles known
+    CSmlDmAdapter::TError errorStatus;
+    iDmCallback->FetchLinkL( KNSmlDefDMSCCP, *fetchResult, errorStatus );
+
+    // Find profile asked
+    iDmCallback->FetchLinkL( aObject, *fetchResult, errorStatus );
+
+    // Fetch SCCP profile ID.
+    TBuf8<KNSmlVoIPMaxResultLength> object; 
+    object.Copy( aObject );
+    object.Append( KNSmlDMVoIPSeparator );
+    object.Append( KNSmlDMSCCPSccpID ); 
+    iDmCallback->FetchLinkL( object, *fetchResult, errorStatus );
+    TUint32 profileId = DesToInt( fetchResult->Ptr( 0 ) );    
+    CleanupStack::PopAndDestroy( fetchResult );
+    fetchResult = NULL;
+    DBG_PRINT("CNSmlDmVoIPAdapter::SetSccpRef() : end");
+    return profileId;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::GetSccpIdL
+// Get URI for given sccp profile ID.
+// ---------------------------------------------------------------------------
+//
+MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetSccpIdL( CBufBase& aObject,
+    TUint32 aID ) const
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::GetSccpIdL() : begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    CBufBase* result = CBufFlat::NewL( 1 );
+    CleanupStack::PushL( result ); 
+    CSmlDmAdapter::TError errorStatus;
+    TBuf8<KNSmlVoIPMaxResultLength> object;
+    iDmCallback->FetchLinkL( KNSmlDefDMSCCP, *result, errorStatus );
+    result->Compress();
+    HBufC8* childList = HBufC8::NewLC( result->Size() );
+    TInt uriSegCount ( 0 );
+    if ( result->Size() > 0 )
+        {
+        childList->Des().Copy( result->Ptr(0) );
+
+        // Delete last / mark
+        childList->Des().Delete( childList->Length() - 1, 1 );    
+        uriSegCount = NumOfURISegs( childList->Des() );
+        }
+
+    for ( TInt counter = 0; counter < uriSegCount; counter++ )
+        {
+        result->Reset();
+
+        // Make SCCP profile settings known
+        object.Copy( KNSmlDefDMSCCP );
+        object.Append( KNSmlDMVoIPSeparator );
+        object.Append( LastURISeg( childList->Des() ) );
+        iDmCallback->FetchLinkL( object, *result, errorStatus );
+        result->Compress();
+        result->Reset();
+
+        // Get SCCPId
+        object.Append( KNSmlDMVoIPSeparator );
+        object.Append( KNSmlDMSCCPSccpID );
+        iDmCallback->FetchLinkL( object, *result, errorStatus );
+        if ( aID == DesToInt ( result->Ptr( 0 ) ) )
+            {
+            aObject.InsertL( aObject.Size(), RemoveLastURISeg( object ) );
+            break; 
+            }
+        childList->Des().Copy( RemoveLastURISeg ( childList->Des() ) );    
+        }
+    // childList, result 
+    CleanupStack::PopAndDestroy( childList ); // CS:1
+    CleanupStack::PopAndDestroy( result ); // CS:0
+    result = NULL;
+    childList = NULL;
+    DBG_PRINT("CNSmlDmVoIPAdapter::GetSccpIdL() : end");
+    return errorStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::CheckDuplicateNameL
+// Checks if duplicate named sip profiles. Renames if same.
+// ---------------------------------------------------------------------------
+//
+TBool CNSmlDmVoIPAdapter::CheckDuplicateNameL( CRCSEProfileEntry& aEntry )
+    {
+    TBool isValid( EFalse );
+    HBufC* newName = HBufC::NewLC( KMaxSettingsNameLength * 2 );
+    newName->Des().Copy( aEntry.iSettingsName );
+
+    TInt count( iProfileEntries.Count() );
+
+    for ( TInt n = 0; n < count; n++ )
+        {
+        const TDesC& existingName = iProfileEntries[n]->iSettingsName;
+        if ( 0 == existingName.Compare( aEntry.iSettingsName )
+            && iProfileID != n ) // Skip the current profile.
+            {
+            TBool isUnique( EFalse );
+
+            for ( TInt i = 1; !isUnique; i++ )
+                {
+                TBool found( EFalse );
+
+                newName->Des().Copy( aEntry.iSettingsName );
+                newName->Des().Append( KOpenParenthesis() );
+                newName->Des().AppendNum( i );
+                newName->Des().Append( KClosedParenthesis() );
+                for ( TInt m = 0; m < count; m++ )
+                    {
+                    if ( 0 == iProfileEntries[m]->iSettingsName.Compare( 
+                        newName->Des() ) )
+                        {
+                        found = ETrue;
+                        }
+                    } // for
+                if ( !found )
+                    {
+                    isUnique = ETrue;
+                    }
+                } // for
+            } // if
+        } // for
+
+    // Change setting only if length is smaller than max length.
+    if ( newName->Length() < KMaxSettingsNameLength )
+        {
+        aEntry.iSettingsName.Copy( newName->Des() );
+        isValid = ETrue;
+        }
+    CleanupStack::PopAndDestroy( newName );  
+    return isValid;  
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::CheckDuplicateProviderL
+// Checks if duplicate provider name. Renames if same.
+// ---------------------------------------------------------------------------
+//
+TBool CNSmlDmVoIPAdapter::CheckDuplicateProviderL( CRCSEProfileEntry& aEntry )
+    {
+    TBool isValid( EFalse );
+    HBufC* newName = HBufC::NewLC( KMaxProviderNameLength * 2 );
+    newName->Des().Copy( aEntry.iProviderName );
+
+    TInt count( iProfileEntries.Count() );
+
+    for ( TInt n = 0; n < count; n++ )
+        {
+        const TDesC& existingName = iProfileEntries[n]->iProviderName;
+        if ( 0 == existingName.Compare( aEntry.iProviderName )
+            && iProfileID != n ) // Skip the current profile.
+            {
+            TBool isUnique( EFalse );
+
+            for ( TInt i = 1; !isUnique; i++ )
+                {
+                TBool found( EFalse );
+
+                newName->Des().Copy( aEntry.iProviderName );
+                newName->Des().Append( KOpenParenthesis() );
+                newName->Des().AppendNum( i );
+                newName->Des().Append( KClosedParenthesis() );
+                for ( TInt m = 0; m < count; m++ )
+                    {
+                    if ( 0 == iProfileEntries[m]->iProviderName.Compare( 
+                        newName->Des() ) )
+                        {
+                        found = ETrue;
+                        }
+                    }
+                if ( !found )
+                    {
+                    isUnique = ETrue;
+                    }
+                }
+            }
+        }
+
+    // Change setting only if length is smaller than max length.
+    if ( newName->Length() < KMaxProviderNameLength )
+        {
+        aEntry.iProviderName.Copy( newName->Des() );
+        isValid = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy( newName ); 
+    return isValid;  
+    }
+
+// ---------------------------------------------------------------------------
+// TInt CNSmlDmVoIPAdapter::FindCodecLocation
+// For getting codec position.
+// ---------------------------------------------------------------------------
+//
+TInt CNSmlDmVoIPAdapter::FindCodecLocation( TUint32 aID ) const
+    {
+    for ( TInt i = 0; i < iCodecEntries.Count(); i++ )
+        {
+        if ( iCodecEntries[i]->iCodecId == aID )
+            {
+            return i;   
+            }
+        }
+    return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// void CNSmlDmVoIPAdapter::SetTelephonyPreferenceL
+// For setting telephony preference.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::SetTelephonyPreferenceL ( const TTelephonyPreference& 
+    aTelephonyPreference )
+    {
+    // Central Repository for richcall settings
+    CRepository* rep = CRepository::NewLC( KCRUidRichCallSettings );
+    if ( EPSPreferred == aTelephonyPreference )
+        {
+        rep->Set( KRCSEPreferredTelephony, EPSPreferred );
+        }
+    else if ( ECSPreferred == aTelephonyPreference )
+        {
+        rep->Set( KRCSEPreferredTelephony, ECSPreferred );
+        }
+    CleanupStack::PopAndDestroy( rep );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::GetTerminalTypeL
+// Collect terminal type used in SIP User Agent Header.
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::GetTerminalTypeL(
+    TBuf<KMaxTerminalTypeLength>& aTerminalType ) const
+    {
+    aTerminalType.Zero(); // Reset before use
+
+    CIpAppPhoneUtils* phoneUtils = CIpAppPhoneUtils::NewLC();
+    phoneUtils->GetTerminalTypeL( aTerminalType ); // Gets phone model + type
+    CleanupStack::PopAndDestroy( phoneUtils );
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::GetWlanMacAddressL
+// Gets WLAN MAC address used in SIP User Agent Header (same as *#62209526#).
+// ---------------------------------------------------------------------------
+//
+void CNSmlDmVoIPAdapter::GetWlanMacAddressL( TBuf<KWlanMacAddressLength>& 
+    aMac ) const
+    {
+    aMac.Zero(); // Reset before use
+
+    CIPAppUtilsAddressResolver* resolver = CIPAppUtilsAddressResolver::NewLC();
+
+    TBuf8<KWlanMacAddressLength> wlanmac;
+    _LIT8( KFormat, "-");
+    resolver->GetWlanMACAddress( wlanmac, KFormat );
+    //wlanmac buffer contains now the wlan mac address like 00-15-a0-99-10-ec
+    CleanupStack::PopAndDestroy( resolver );
+    aMac.Copy( wlanmac );
+
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::GetNatFwUriL
+// Get NAT/FW profile URI.
+// ---------------------------------------------------------------------------
+//
+MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetNatFwUriL( 
+    TBuf16<KMaxUriLength>& aObject, TInt aProfileId ) const
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::GetNatFwUriL : begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    CBufBase* result = CBufFlat::NewL( 1 ); // CS:1
+    CleanupStack::PushL( result );
+    CSmlDmAdapter::TError errorStatus;
+
+    // Get URIs to all DomainSpecific NAT/FW settings.
+    iDmCallback->FetchLinkL( KNSmlDMNATFWDomain(), *result, errorStatus );
+
+    if ( CSmlDmAdapter::EOk != errorStatus )
+        {
+        CleanupStack::PopAndDestroy( result );
+        return errorStatus;
+        }
+
+    result->Compress();
+    HBufC8* childList = HBufC8::NewLC( result->Size() ); // CS:2
+    TInt uriSegCount( 0 );
+
+    if ( result->Size() )
+        {
+        childList->Des().Copy( result->Ptr(0) );
+        uriSegCount = NumOfURISegs( childList->Des() );
+        }
+
+    for ( TInt index = 0; index < uriSegCount; index++ )
+        {
+        HBufC8* uri = HBufC8::NewLC( ( KMaxUriLength * KTwoSegs ) );// CS:3
+        uri->Des().Copy( KNSmlDMNATFWDomain );
+        uri->Des().Append( KNSmlDMVoIPSeparator() );
+        uri->Des().Append( LastURISeg( childList->Des() ) );
+        HBufC8* luid = HBufC8::NewLC( KMaxUriLength ); // CS:4
+        luid->Des().Copy( iDmCallback->GetLuidAllocL( uri->Des() )->Des() );
+        if ( luid->Des().Length() && 
+            aProfileId == DesToTUint( LastURISeg( luid->Des() ) ) )
+            {
+            aObject.Copy( uri->Des() );
+            // luid, uri
+            CleanupStack::PopAndDestroy( luid ); // CS:3
+            CleanupStack::PopAndDestroy( uri ); // CS:2
+            break;
+            }
+        // luid, uri
+        CleanupStack::PopAndDestroy( luid ); // CS:3
+        CleanupStack::PopAndDestroy( uri ); // CS:2
+        childList->Des().Copy( RemoveLastURISeg( childList->Des() ) );
+        }
+
+    // childList, result
+    CleanupStack::PopAndDestroy( childList ); // CS:1
+    CleanupStack::PopAndDestroy( result ); // CS:0
+    DBG_PRINT("CNSmlDmVoIPAdapter::GetNatFwUriL : end");
+    return errorStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::NatFwIdL
+// Get NAT/FW profile ID.
+// ---------------------------------------------------------------------------
+//
+TUint32 CNSmlDmVoIPAdapter::NatFwIdL( const TDesC8& aObject ) const
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::NatFwIdL : begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    TUint32 profileId( KErrNone );
+    HBufC8* luid = HBufC8::NewLC( KMaxUriLength ); // CS:1
+    luid->Des().Copy( iDmCallback->GetLuidAllocL( aObject )->Des() );
+    if ( luid->Des().Length() )
+        {
+        profileId = DesToTUint( LastURISeg( luid->Des() ) );
+        }
+    CleanupStack::PopAndDestroy( luid ); // CS:0
+    DBG_PRINT("CNSmlDmVoIPAdapter::NatFwIdL : end");
+    return profileId;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::GetConRefL
+// Get DM URI for IAP.
+// ---------------------------------------------------------------------------
+//
+MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetConRefL( CBufBase& aObject, 
+    TInt aIapId ) const
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::GetConRefL() : begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    TBool found = EFalse;
+    CNSmlDMIAPMatcher* iapMatch = CNSmlDMIAPMatcher::NewL( iDmCallback );
+    CleanupStack::PushL( iapMatch ); // CS:1
+    HBufC8* uri8 = iapMatch->URIFromIAPIdL( aIapId );
+    CleanupStack::PushL( uri8 ); // CS:2
+    if ( uri8 )
+        {
+        aObject.InsertL( aObject.Size(), uri8->Des() );
+        found = ETrue;
+        }
+    // uri8, iapMatch
+    CleanupStack::PopAndDestroy( uri8 ); // CS:1
+    CleanupStack::PopAndDestroy( iapMatch ); // CS:0
+    DBG_PRINT("CNSmlDmVoIPAdapter::GetConRefL() : end");
+    if ( !found )
+        {
+        return CSmlDmAdapter::ENotFound;
+        }
+    return CSmlDmAdapter::EOk;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::ConRefL
+// Get IAP ID (connection reference value) from given URI.
+// ---------------------------------------------------------------------------
+//
+TInt CNSmlDmVoIPAdapter::ConRefL( const TDesC8& aObject ) const
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::ConRefL() : begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    CNSmlDMIAPMatcher* iapMatch = CNSmlDMIAPMatcher::NewL( iDmCallback );
+    CleanupStack::PushL( iapMatch );
+    TInt iapId = iapMatch->IAPIdFromURIL( aObject );
+    CleanupStack::PopAndDestroy( iapMatch ); 
+    DBG_PRINT("CNSmlDmVoIPAdapter::ConRefL() : end");
+    return iapId;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::GetPresenceUriL
+// Get Presence profile DM URI.
+// ---------------------------------------------------------------------------
+//
+MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetPresenceUriL( 
+    TBuf16<KMaxUriLength>& aObject, TUint32 aProfileId ) const
+    {
+    DBG_PRINT("CNSmlDmVoIPAdapter::GetPresenceUriL : begin");
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    CBufBase* result = CBufFlat::NewL( 1 );
+    CleanupStack::PushL( result ); // CS:1
+    CSmlDmAdapter::TError errorStatus;
+
+    // Get URIs to all Presence settings.
+    iDmCallback->FetchLinkL( KNSmlDMPresence(), *result, errorStatus );
+
+    if ( CSmlDmAdapter::EOk != errorStatus )
+        {
+        CleanupStack::PopAndDestroy( result );
+        return errorStatus;
+        }
+
+    result->Compress();
+    HBufC8* childList = HBufC8::NewLC( result->Size() ); // CS:2
+    TInt uriSegCount( 0 );
+
+    if ( result->Size() )
+        {
+        childList->Des().Copy( result->Ptr( 0 ) );
+        uriSegCount = NumOfURISegs( childList->Des() );
+        }
+
+    // Get LUIDs for URIs.
+    for ( TInt index = 0; index < uriSegCount; index++ )
+        {
+        HBufC8* uri = HBufC8::NewLC( KMaxUriLength ); // CS:3
+        HBufC8* luid = HBufC8::NewLC( KMaxUriLength ); // CS:4
+
+        uri->Des().Copy( KNSmlDMPresence() );
+        uri->Des().Append( KNSmlDMVoIPSeparator() );
+        uri->Des().Append( LastURISeg( childList->Des() ) );
+        luid->Des().Copy( iDmCallback->GetLuidAllocL( uri->Des() )->Des() );
+        if ( luid->Des().Length() && 
+            aProfileId == DesToTUint( LastURISeg( luid->Des() ) ) )
+            {
+            aObject.Copy( uri->Des() );
+            // luid, uri
+            CleanupStack::PopAndDestroy( luid );  // CS:3
+            CleanupStack::PopAndDestroy( uri );  // CS:2
+            break;
+            }
+        childList->Des().Copy( RemoveLastURISeg( childList->Des() ) );
+        // luid, uri
+        CleanupStack::PopAndDestroy( luid );  // CS:3
+        CleanupStack::PopAndDestroy( uri );  // CS:2
+        }
+    // childList, result
+    CleanupStack::PopAndDestroy( childList );     // CS:1
+    CleanupStack::PopAndDestroy( result );     // CS:0
+    DBG_PRINT("CNSmlDmVoIPAdapter::GetPresenceUriL : end");
+    return errorStatus;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::PresenceIdL
+// Get Presence profile ID.
+// ---------------------------------------------------------------------------
+//
+TUint32 CNSmlDmVoIPAdapter::PresenceIdL( const TDesC8& aObject ) const
+    {
+#ifdef _DEBUG
+    TBuf<KMaxDebugPrintLength> object;
+    object.Copy( aObject );
+    DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL : begin uri: %S", &object );
+#endif
+
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+    TPtrC8 uri = RemoveDotSlash( aObject );
+
+    HBufC8* luid = iDmCallback->GetLuidAllocL( uri );
+    CleanupStack::PushL( luid ); //CS:1
+    
+    // check whether above found id is valid or not
+    TUint32 profileId;
+    if ( luid->Length() == KErrNone )
+        {
+        //try to find it another way
+        if( NSmlDmURI::NumOfURISegs( uri ) > 1 )
+            {
+            TPtrC8 idSegment = NSmlDmURI::URISeg( uri, 2 );
+            TBuf<KMaxDebugPrintLength> tempSegment;
+            tempSegment.Copy( idSegment );
+            DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL - idSegment:%S", &tempSegment );
+            profileId = DesToTUint(idSegment);
+            if(!IsPresIDValidL(profileId))
+                {
+                CleanupStack::PopAndDestroy( luid ); // CS:0
+                DBG_PRINT("CNSmlDmVoIPAdapter::PresenceIdL : ID not valid - return KErrNone");
+                return KErrNone;
+                }
+            CleanupStack::PopAndDestroy( luid ); // CS:0
+            DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL - settingsId found local way:%d", profileId);
+            return profileId;
+            }
+        CleanupStack::PopAndDestroy( luid ); // CS:0
+        DBG_PRINT("CNSmlDmVoIPAdapter::PresenceIdL : ID not valid, too short uri");
+        return KErrNone;
+        }    
+    profileId = DesToTUint( *luid );
+    CleanupStack::PopAndDestroy( luid ); // CS:0
+    DBG_PRINT2("CNSmlDmVoIPAdapter::PresenceIdL : return profleId: %d", profileId );
+    return profileId;
+    }
+
+// -----------------------------------------------------------------------------
+// CPresenceDMAdapter::IsPresIDValidL
+// -----------------------------------------------------------------------------
+//
+TBool CNSmlDmVoIPAdapter::IsPresIDValidL( TUint32 aSetId ) const
+     {
+    TPresSettingsSet tempSet;
+    if ((PresSettingsApi::SettingsSetL( (TInt)aSetId,tempSet)) == KErrNone)
+        return ETrue;
+    DBG_PRINT2(" CNSmlDmVoIPAdapter::IsPresIDValidL - Invalid settings : %d", aSetId );
+    return EFalse;   
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::SnapIdL
+// Gets SNAP ID based on URI.
+// ---------------------------------------------------------------------------
+//
+TInt CNSmlDmVoIPAdapter::SnapIdL( const TDesC8& aUri )
+    {
+    DBG_PRINT( "CNSmlDmVoIPAdapter::SnapIdL - begin" );
+    TInt snapId( KErrNotFound );
+
+    HBufC8* luid = HBufC8::NewLC( KNSmlVoIPMaxUriLength ); // CS:1
+    luid->Des().Copy( iDmCallback->GetLuidAllocL( aUri )->Des() );
+
+    if ( luid->Des().Length() )
+        {
+        snapId = DesToInt( LastURISeg( luid->Des() ) );
+        }
+    CleanupStack::PopAndDestroy( luid ); // CS:0
+    DBG_PRINT( "CNSmlDmVoIPAdapter::SnapIdL - end" );
+    return snapId;
+    }
+
+// ---------------------------------------------------------------------------
+// CNSmlDmVoIPAdapter::GetSnapUriL
+// Set SNAP URI based on SNAP ID.
+// ---------------------------------------------------------------------------
+//
+MSmlDmAdapter::TError CNSmlDmVoIPAdapter::GetSnapUriL( TDes8& aObject, 
+    TInt aSnapId )
+    {
+    __ASSERT_ALWAYS( iDmCallback != NULL, User::Leave( KErrArgument ) );
+
+    DBG_PRINT( "CNSmlDmSIPAdapter::GetSnapUriL - begin" );
+
+    CBufBase* result = CBufFlat::NewL( 1 );
+    CleanupStack::PushL( result ); // CS:1
+    CSmlDmAdapter::TError status;
+
+    // Get URIs to all SNAP settings.
+    iDmCallback->FetchLinkL( KNSmlDMSnapUriPrefix(), *result, status );
+
+    if ( CSmlDmAdapter::EOk != status )
+        {
+        CleanupStack::PopAndDestroy( result );
+        DBG_PRINT( "CNSmlDmVoIPAdapter::GetSnapUriL - Fetch SNAP error end" );
+        return status;
+        }
+
+    result->Compress();
+    HBufC8* childList = HBufC8::NewLC( result->Size() ); // CS:2
+    TInt uriSegCount( 0 );
+
+    if ( result->Size() )
+        {
+        childList->Des().Copy( result->Ptr( 0 ) );
+        uriSegCount = NumOfURISegs( childList->Des() );
+        }
+
+    // Get LUIDs for URIs.
+    for ( TInt index = 0; index < uriSegCount; index++ )
+        {
+        HBufC8* uri = HBufC8::NewLC( KNSmlVoIPMaxUriLength ); // CS:3
+        HBufC8* luid = HBufC8::NewLC( KNSmlVoIPMaxUriLength ); // CS:4
+
+        uri->Des().Copy( KNSmlDMSnapUriPrefix() );
+        uri->Des().Append( KNSmlDMVoIPSeparator() );
+        uri->Des().Append( LastURISeg( childList->Des() ) );
+        luid->Des().Copy( iDmCallback->GetLuidAllocL( uri->Des() )->Des() );
+        if ( luid->Des().Length() && 
+            aSnapId == DesToInt( LastURISeg( luid->Des() ) ) )
+            {
+            aObject.Copy( uri->Des() );
+            // luid, uri
+            CleanupStack::PopAndDestroy( luid );  // CS:3
+            CleanupStack::PopAndDestroy( uri );  // CS:2
+            break;
+            }
+        childList->Des().Copy( RemoveLastURISeg( childList->Des() ) );
+        // luid, uri
+        CleanupStack::PopAndDestroy( luid );  // CS:3
+        CleanupStack::PopAndDestroy( uri );  // CS:2
+        }
+    // childList, result
+    CleanupStack::PopAndDestroy( childList );  // CS:1
+    CleanupStack::PopAndDestroy( result );  // CS:0
+    DBG_PRINT( "CNSmlDmVoIPAdapter::GetSnapUriL - end" );
+    return status;
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/src/nsmldmvoipadapter.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* 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:  Device Management VoIP adapter resource file
+*
+*/
+
+
+//  INCLUDES
+#include <registryinfo.rh>
+#include "nsmldmconstants.h"
+
+
+//  RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+//   
+// ?resource_name
+// ?description
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theRegistryInfo
+  {
+  dll_uid = 0x10201F9C; //The DLL's 3rd UID.
+  interfaces = 
+      {
+      INTERFACE_INFO
+          {
+          interface_uid = KNSmlDMInterfaceUid; // DM interface UID
+          implementations = 
+            {
+            IMPLEMENTATION_INFO
+                {
+                implementation_uid = 0x10201F9D; // DM VoIP implementation UID
+                version_no = 1; 
+                display_name = "";
+                default_data = "";
+                opaque_data = "";
+                }
+            };
+          }
+      };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/dmvoipadapter/src/nsmldmvoipadaptergroupproxy.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "nsmldmvoipadapter.h"
+
+const TUint  KNSmlDMVoIPAdapterImplUid = 0x10201F9D;
+
+// -----------------------------------------------------------------------------
+// TImplementationProxy ImplementationTable[]
+// Needed because of ECOM architecture
+// -----------------------------------------------------------------------------
+const TImplementationProxy ImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KNSmlDMVoIPAdapterImplUid,
+        CNSmlDmVoIPAdapter::NewL )
+    };
+
+// -----------------------------------------------------------------------------
+// ImplementationGroupProxy()
+// Needed because of ECOM architecture
+// -----------------------------------------------------------------------------
+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/voipplugins/voipadapters/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  VoipAdapters subsystem build file 
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+#include "../cpgenvoipsettings/group/bld.inf"
+#include "../dmgenvoipsettings/group/bld.inf"
+#include "../dmvoipadapter/group/bld.inf"
+#include "../cpvoipadapter/group/bld.inf"
+#include "../provisioningfile/group/bld.inf"
+#include "../voipxmlprovisioning/group/bld.inf"
+
+PRJ_TESTMMPFILES
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/BWINS/ProvisioningFileU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,6 @@
+EXPORTS
+	?NewL@CWPProvisioningFile@@SAPAV1@V?$TBuf@$0BAA@@@@Z @ 1 NONAME ; class CWPProvisioningFile * CWPProvisioningFile::NewL(class TBuf<256>)
+	?ProvFileContainsIapL@CWPProvisioningFile@@QAEHXZ @ 2 NONAME ; int CWPProvisioningFile::ProvFileContainsIapL(void)
+	?ProvFileL@CWPProvisioningFile@@QAEXAAK@Z @ 3 NONAME ; void CWPProvisioningFile::ProvFileL(unsigned long &)
+	?ProvFileL@CWPProvisioningFile@@QAEXXZ @ 4 NONAME ; void CWPProvisioningFile::ProvFileL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/EABI/ProvisioningFileU.DEF	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,6 @@
+EXPORTS
+	_ZN19CWPProvisioningFile20ProvFileContainsIapLEv @ 1 NONAME
+	_ZN19CWPProvisioningFile4NewLE4TBufILi256EE @ 2 NONAME
+	_ZN19CWPProvisioningFile9ProvFileLERm @ 3 NONAME
+	_ZN19CWPProvisioningFile9ProvFileLEv @ 4 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/group/ProvisioningFile.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  This is project specification file for the ProvisioningFile.
+*
+*/
+
+
+#include "defaultcaps.hrh"
+#include <platform_paths.hrh>
+
+TARGET              provisioningfile.dll
+TARGETTYPE          dll
+UID                 0x1000008d 0x10275409
+
+CAPABILITY          CAP_GENERAL_DLL
+VENDORID            VID_DEFAULT
+
+SOURCEPATH          ../src
+SOURCE              WPProvisioningFile.cpp
+SOURCE              WPOMAMsgHandler.cpp
+
+SOURCE              WPProtocolProfileHandlerSIP.cpp
+
+USERINCLUDE         ../inc
+USERINCLUDE         ../../inc
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH          ../data
+
+LANG                SC
+
+LIBRARY             euser.lib
+LIBRARY             provisioningengine.lib
+LIBRARY             efsrv.lib               // RFs
+LIBRARY             flogger.lib             // for logging purposes
+
+LIBRARY             sipclient.lib           // for connecting to SIP server.
+LIBRARY             sipprofilecli.lib       // for using SIP profiles
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ProvisioningFile build file. 
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/WPProvisioningFile.h          |../../../inc/wpprovisioningfile.h
+../inc/wpprovisioningfileconst.h     |../../../inc/wpprovisioningfileconst.h
+../rom/provisioningfile.iby CORE_APP_LAYER_IBY_EXPORT_PATH( provisioningfile.iby )
+
+PRJ_MMPFILES
+ProvisioningFile.mmp
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/inc/WPOMAMsgHandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,117 @@
+/*
+* 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:  Used by ProvisioningFile to read provisioning messages.
+*
+*/
+
+
+
+#ifndef CWPOMAMSGHANDLER_H
+#define CWPOMAMSGHANDLER_H
+
+// INCLUDES
+#include    "wpprovisioningfileconst.h"
+
+#include    <e32base.h>
+#include    <f32file.h>
+
+// CLASS DECLARATION
+
+/**
+*  CWPOMAMsgHandler used te read OMA messages.
+*
+*  @lib ProvisioningFile.lib
+*  @since Series 60 3.0
+*/    
+NONSHARABLE_CLASS(CWPOMAMsgHandler) : public CBase
+    {
+    
+#ifdef PROVISIONINGFILE_TEST
+    
+    friend class UT_OmaMsgHandler;
+    
+#endif
+    
+    public:  // Constructors and destructor
+       
+        /**
+        * Two-phased constructor.
+        */
+        static CWPOMAMsgHandler* NewL();
+
+        /**
+        * Two-phased constructor.
+        */
+        static CWPOMAMsgHandler* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CWPOMAMsgHandler();
+
+    public: 
+        
+        /**
+        * ReadProvFileL, Reads provisioning file.
+        * @since Series 60 3.0
+        * @param aConfig configuration path.
+        */
+        void ReadProvFileL( TFileName aConfig );
+
+        /**
+        * DocL, Fetches the read provisioning document.
+        * @since Series 60 3.0
+        * @return pointer to a copy of the prov doc
+        */
+        HBufC8* DocL();
+
+    private:
+    
+        /**
+        * GetFileSize, Gets the size of the provisioning document.
+        * @since Series 60 3.0
+        * @param aSize Messages size.
+        * @return TInt system-wide error code.
+        */
+        TInt GetFileSize( TInt& aSize );
+       
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CWPOMAMsgHandler();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        HBufC8*             iProvisioningDoc;
+
+        TPtr8               iProvData;
+    
+        RFs                 iFs;
+        
+        RFile               iFile;
+        
+        TFileName           iFileName;
+    
+    };
+
+#endif // CWPOMAMSGHANDLER_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/inc/WPProtocolProfileHandlerSIP.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,179 @@
+/*
+* 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 to SIP profiles.
+*
+*/
+
+
+#ifndef WPPROTOCOLPROFILEHANDLERSIP_H
+#define WPPROTOCOLPROFILEHANDLERSIP_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    <sipobserver.h>
+#include    <sipprofileregistryobserver.h>
+
+// FORWARD DECLARATIONS
+class CSIP;
+class CSIPProfile;
+class CSIPProfileRegistry;
+class CSIPManagedProfile;
+
+// CLASS DECLARATION
+
+/**
+*  Interface to SIP profiles.
+*
+*  @lib ProvisioningFile.lib
+*  @since Series 60 3.0
+*/
+NONSHARABLE_CLASS(CWPProtocolProfileHandlerSIP) : public CBase,
+                                                  public MSIPObserver,
+                                                  public MSIPProfileRegistryObserver
+    {
+    
+#ifdef PROVISIONINGFILE_TEST
+    
+    friend class UT_ProvisioningFile;
+    friend class UT_ProtocolProvider;
+    
+#endif
+    
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CWPProtocolProfileHandlerSIP* NewL();
+
+        /**
+        * Two-phased constructor.
+        */
+        static CWPProtocolProfileHandlerSIP* NewLC();
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CWPProtocolProfileHandlerSIP();
+
+    private: 
+                              
+        /**
+        * Find SIP profile from array by profile id.
+        * @since Series 60 3.0
+        * @param aProfileId Profile id to search for
+        * @param aIndex     On completion, contains index of profile.
+        * @return Pointer to SIP profile
+        */
+        CSIPProfile* FindSIPProfileByIdL( TUint32 aProfileId,
+                                          TInt& aIndex );                              
+                              
+    public:
+        
+        /**
+        * Set Protocol Profile use this IAP.
+        * @since Series 60 3.0
+        * @param aProfileId  Protocol Profiles array place.
+        * @param aProfileIapId  Profiles new IAP Id.
+        */                                     
+        void SetProfilesIapL( TInt aProfileId, 
+                              TUint32 aProfileIapId );
+                              
+        /**
+        * Set provisioning Protocol Profiles Id in array.
+        * @since Series 60 3.0
+        */                                     
+        void SetProvisioningIdL();
+        
+        /**
+        * Get provisioned Protocol Profiles count.
+        * @since Series 60 3.0
+        * @return TInt count of provisioned profiles.
+        */                                     
+        TInt ProvisionedCount();
+                              
+    public: // Functions from base classes
+        
+        /**
+        * From MSIPObserver
+        * A SIP request has been received from the network.        
+        * @pre aTransaction != 0
+        * @param aIapId The IapId from which the SIP request was received.
+        * @param aTransaction contains local address, remote address of a SIP
+        *        message, as well as optional SIP message method, headers and
+        *        body. The ownership is transferred.
+        */
+        void IncomingRequest( TUint32 aIapId,
+                              CSIPServerTransaction* aTransaction );
+
+        /**
+        * From MSIPObserver
+        * The received SIP request time-outed and it is invalid i.e. cannot be used
+        * anymore.
+        * This will be called if the user fails to create a SIP connection
+        * and does not send an appropriate SIP response.
+        * @param aTransaction The time-outed transaction.
+        */
+        void TimedOut( CSIPServerTransaction& aTransaction );
+        
+        /** 
+        * From MSIPProfileRegistryObserver
+        * An event related to SIP Profile has accorred
+        * @param aProfileId a profile Id
+        * @param aEvent an occurred event
+        **/
+        void ProfileRegistryEventOccurred( TUint32 aProfileId,
+                                           MSIPProfileRegistryObserver::TEvent aEvent );
+
+        /**
+        * From MSIPProfileRegistryObserver
+        * An asynchronous error has occurred related to SIP profile
+        * Event is send to those observers, who have the
+        * corresponding profile instantiated.
+        * @param aProfileId the id of failed profile 
+        * @param aError an occurred error
+        */
+        void ProfileRegistryErrorOccurred( TUint32 aProfileId,
+                                           TInt aError );
+                                           
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CWPProtocolProfileHandlerSIP();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // SIP objects.
+        CSIP*                       iSIP;
+        
+        CSIPProfileRegistry*        iSIPProfileRegistry;
+
+        // Array of SIP profile instances
+        RPointerArray<CSIPProfile>  iSIPProfiles;
+        
+        // Array of SIP profile ids
+        RArray<TInt32>              iSIPProfileIds;
+
+    };
+
+#endif // WPPROTOCOLPROFILEHANDLERSIP_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/inc/WPProvisioningFile.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,142 @@
+/*
+* 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:  Handles provisioning settings.
+*
+*/
+
+
+#ifndef WPPROVISIONINGFILE_H
+#define WPPROVISIONINGFILE_H
+
+//  INCLUDES
+#include    <e32base.h>
+#include    "wpprovisioningfileconst.h"
+
+// FORWARD DECLARATIONS
+class CWPEngine;
+class CWPOMAMsgHandler;
+class CWPProtocolProfileHandlerSIP;
+class CRepository;
+    
+// CLASS DECLARATION
+
+/**
+*  CWPProvisioningFile handles OMA provisioning document. 
+*
+*  @lib ProvisioningFile.lib
+*  @since Series 60 3.0
+*/
+NONSHARABLE_CLASS(CWPProvisioningFile) : public CBase
+    {
+    
+#ifdef PROVISIONINGFILE_TEST
+    
+    friend class UT_ProvisioningFile;
+    
+#endif
+    
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CWPProvisioningFile* NewL( TFileName aFileName = KDefaultFilePath() );
+
+        /**
+        * Second two-phased constructor.
+        */ 
+        static CWPProvisioningFile* NewLC( TFileName aFileName );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CWPProvisioningFile();
+
+    public: // New functions
+        
+        /**
+        * ProvFileContainsIapL, OMA provisioning message constains IAP.
+        * @since Series 60 3.0
+        * @return TBool ETrue if message contains IAP.
+        */
+        IMPORT_C TBool ProvFileContainsIapL();
+        
+        /**
+        * ProvFileL, Handles OMA provisioning messages handling without IAP.
+        * @since Series 60 3.0
+        */
+        IMPORT_C void ProvFileL();
+
+        /**
+        * ProvFileL, Handles OMA provisioning messages handling with IAP.
+        * @since Series 60 3.0
+        * @param aIapId Attach IAP to OMA message.
+        */
+        IMPORT_C void ProvFileL( TUint32& aIapId );
+
+    private:
+    
+        /**
+        * C++ default constructor.
+        */
+        CWPProvisioningFile( TFileName aFileName );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+        
+        /**
+        * InitMsgL, Read-Get-Import-Populate the provisioning document.
+        * @since Series 60 3.0
+        */
+        void InitMsgL();
+        
+        /**
+        * SaveDocL, Saves the provisioning document.
+        * @since Series 60 3.0
+        */
+        void SaveDocL();
+        
+        /**
+        * DoProvL, Do provisioning.
+        * @since Series 60 3.0
+        */
+        void DoProvL();
+        
+    private:
+    
+        HBufC8*                         iProvisioningDoc;
+        
+        CWPOMAMsgHandler*               iMsgHandler;
+        
+        CWPProtocolProfileHandlerSIP*   iSipHandler;
+        
+        CWPEngine*                      iProvEngine;
+        
+        CRepository*                    iCenRep;
+        
+        TBool                           iIapAllowed;
+        
+        TBool                           iInitDone;
+        
+        TUint32                         iIapId;
+        
+        TFileName                       iFileName;
+
+    };
+
+#endif // WPPROVISIONINGFILE_H   
+             
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/inc/wpprovisioningfileconst.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* 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:  ProvisioningFile common header.
+*
+*/
+
+
+#ifndef WPPROVISIONINGFILECONST_H
+#define WPPROVISIONINGFILECONST_H
+
+//  INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+const TUid KProvisioningFileUid = { 0x10275409 };
+
+_LIT( KProvFileIapSetting, "Access points:" );
+_LIT( KProvFileSipSetting, "SIP settings" );
+_LIT( KProvFileSccpSettings, "SCCP settings" );
+
+/** File path configuration. No real path used 
+    here because code scanner error */
+_LIT( KDefaultFilePath, "defaultpath" );
+
+enum TProtocolType
+    {
+    EProtocolNone    = -1,
+    EProtocolSIP     = 0,
+    EProtocolSCCP    = 1,
+    };
+
+#endif // WPPROVISIONINGFILECONST_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/inc/wpprovisioningfiledebug.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,134 @@
+/*
+* 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:  This file defines logging macros for provisioningfile
+*
+*/
+
+
+
+#ifndef WPPROVISIONINGFILEDEBUG_H
+#define WPPROVISIONINGFILEDEBUG_H
+
+#include <e32debug.h> 
+
+//Examples
+//FLOG( "[ComponentName] ClassName::MethodName:" );
+//FTRACE(RDebug::Print(_L("[ComponentName] ClassName::MethodName: err (%d)"), err));
+#ifdef _DEBUG
+
+const TInt KBTHexDumpWidth=16;
+const TInt KBTLogBufferSize=100;
+const TText KFullStopChar='.';
+
+_LIT(KBTFirstFormatString,"%04x: ");
+_LIT(KBTSecondFormatString,"%02x ");
+_LIT(KBTThirdFormatString,"%c");
+_LIT(KBTThreeSpaces,"   ");
+_LIT(KBTSeparator," ");
+
+inline void HexDump(const TUint8* aPtr, TInt aLen)
+    {
+	if( aPtr != NULL )
+	    {
+    	TBuf<KBTLogBufferSize> line;
+	    TInt i = 0;
+
+    	while (aLen>0)
+    		{
+    		TInt n = (aLen>KBTHexDumpWidth ? KBTHexDumpWidth : aLen);
+    		line.AppendFormat(KBTFirstFormatString,i);
+    		TInt j;
+    		for (j=0; j<n; j++)
+    			line.AppendFormat(KBTSecondFormatString,aPtr[i+j]);
+    		while (j++<KBTHexDumpWidth)
+    			line.Append(KBTThreeSpaces);
+    		line.Append(KBTSeparator);
+    		for (j=0; j<n; j++)
+    			line.AppendFormat(KBTThirdFormatString,(aPtr[i+j]<32 || aPtr[i+j]>126 || aPtr[i+j]==37) ? KFullStopChar : aPtr[i+j]);
+
+    		RDebug::Print(line);
+
+            line.Zero();
+    		aLen-=n;
+    		i+=n;
+    	    }
+        }
+    }
+
+
+// ------------------------------------------
+
+inline void FHex(const TUint8* aPtr, TInt aLen)
+    {
+    HexDump( aPtr, aLen );
+    }
+
+// ------------------------------------------
+
+inline void FHex(const TDesC8& aDes)
+    {
+    HexDump(aDes.Ptr(), aDes.Length());
+    }
+
+// ===========================================================================
+#ifdef __WINS__     // File logging for WINS
+// ===========================================================================
+#include <e32std.h>
+#include <f32file.h>
+#include <flogger.h>
+
+_LIT( KLogFile, "voipadapters.log" );
+_LIT( KLogDirFullName, "c:\\logs\\" );
+_LIT( KLogDir, "voipadapters" );
+
+#define FLOG( a )   { FPrint( _L( a ) ); }
+#define FLOG2( a,b )  { FPrint( _L( a ), b ); }
+#define FTRACE( a ) { a; }
+
+// Declare the FPrint function
+//
+inline void FPrint( const TRefByValue<const TDesC> aFmt, ... )
+    {
+    VA_LIST list;
+    VA_START( list, aFmt );
+    RFileLogger::WriteFormat( KLogDir,
+                              KLogFile,
+                              EFileLoggingModeAppend,
+                              aFmt,
+                              list );
+    }
+
+// ===========================================================================
+#else               // RDebug logging for target HW
+// ===========================================================================
+#include <e32svr.h>
+
+#define FLOG( a )   { RDebug::Print( _L( a ) ); }
+#define FLOG2(a,b)  { RDebug::Print( _L( a ), b ); }
+#define FTRACE( a ) { a; }
+
+#endif //__WINS__
+
+// ===========================================================================
+#else // // No loggings --> Reduced binary size
+// ===========================================================================
+#define FLOG( a )
+#define FLOG2( a, b )
+#define FTRACE( a )
+
+#endif // _DEBUG
+
+#endif      // WPPROVISIONINGFILEDEBUG_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/rom/provisioningfile.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -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:  Provisioning File ROM definition file.
+*
+*/
+
+
+#ifndef PROVISIONINGFILE_IBY
+#define PROVISIONINGFILE_IBY
+
+// File provisioning
+file=ABI_DIR/BUILD_DIR/ProvisioningFile.dll       SHARED_LIB_DIR/ProvisioningFile.dll
+
+#endif // PROVISIONINGFILE_IBY
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/src/WPOMAMsgHandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,156 @@
+/*
+* 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:  Used by ProvisioningFile to read provisioning messages.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "WPOMAMsgHandler.h"
+#include    "wpprovisioningfiledebug.h"
+
+#include    <e32std.h>
+#include    <f32file.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWPOMAMsgHandler::CWPOMAMsgHandler
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CWPOMAMsgHandler::CWPOMAMsgHandler()
+    : iProvData( NULL, 0 )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CWPOMAMsgHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CWPOMAMsgHandler::ConstructL()
+    {
+    FLOG( "[ProvisioningFile] CWPOMAMsgHandler::ConstructL" );
+    User::LeaveIfError( iFs.Connect() );
+    iProvisioningDoc = HBufC8::NewL( 0 );
+    }
+    
+// -----------------------------------------------------------------------------
+// CWPOMAMsgHandler::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CWPOMAMsgHandler* CWPOMAMsgHandler::NewL()
+    {
+    CWPOMAMsgHandler* self = CWPOMAMsgHandler::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPOMAMsgHandler::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CWPOMAMsgHandler* CWPOMAMsgHandler::NewLC()
+    {
+    CWPOMAMsgHandler* self = new( ELeave ) CWPOMAMsgHandler;    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPOMAMsgHandler::~CWPOMAMsgHandler
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CWPOMAMsgHandler::~CWPOMAMsgHandler()
+    {
+    if ( iProvisioningDoc )
+        {
+        delete iProvisioningDoc;
+        iProvisioningDoc = NULL;
+        }
+    
+    iFs.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CWPOMAMsgHandler::ReadProvFileL
+//
+// -----------------------------------------------------------------------------
+//
+void CWPOMAMsgHandler::ReadProvFileL( TFileName aConfig )
+    {
+    FLOG( "[ProvisioningFile] CWPOMAMsgHandler::ReadProvFileL" );
+
+    TInt fileSize( 0 );
+
+    iFileName = aConfig;
+    User::LeaveIfError( GetFileSize( fileSize ) );
+      
+    if ( fileSize )
+        {
+        delete iProvisioningDoc;
+        iProvisioningDoc = NULL;
+        iProvisioningDoc = HBufC8::NewL( fileSize );
+        iProvData.Set( iProvisioningDoc->Des() );
+        
+	    User::LeaveIfError( iFile.Open( iFs, iFileName, EFileShareReadersOnly ) );
+	    User::LeaveIfError( iFile.Read( iProvData ) );
+	    iFile.Close();
+        }
+	}
+
+// -----------------------------------------------------------------------------
+// CWPOMAMsgHandler::DocL
+//
+// -----------------------------------------------------------------------------
+//
+HBufC8* CWPOMAMsgHandler::DocL()
+    {
+    FLOG( "[ProvisioningFile] CWPOMAMsgHandler::DocL" );
+    
+    if( iProvisioningDoc )
+        {
+        return iProvisioningDoc->AllocL();
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CWPOMAMsgHandler::GetFileSize
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CWPOMAMsgHandler::GetFileSize( TInt& aSize )
+    {
+    FLOG( "[ProvisioningFile] CWPOMAMsgHandler::GetFileSize" );
+    
+    TInt err( iFile.Open( iFs, iFileName , EFileShareReadersOnly ) );
+    if ( KErrNone == err )
+        {
+        err = iFile.Size( aSize );
+        iFile.Close();
+        }
+    return err;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/src/WPProtocolProfileHandlerSIP.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,310 @@
+/*
+* 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:  Handling SIP profiles.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "WPProtocolProfileHandlerSIP.h"
+#include    "wpprovisioningfileconst.h"
+#include    "wpprovisioningfiledebug.h"
+
+#include    <sip.h>
+#include    <sipprofileregistry.h>
+#include    <sipprofile.h>
+
+#include    <sipmanagedprofile.h>
+#include    <sipmanagedprofileregistry.h>
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::CWPProtocolProfileHandlerSIP
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CWPProtocolProfileHandlerSIP::CWPProtocolProfileHandlerSIP()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CWPProtocolProfileHandlerSIP::ConstructL()
+    {
+    FLOG( "[ProvisioningFile] CWPProtocolProfileHandlerSIP::ConstructL" );
+    
+    iSIP = CSIP::NewL( KProvisioningFileUid, *this );
+    
+    iSIPProfileRegistry = CSIPProfileRegistry::NewL( *iSIP, *this );
+
+    // Get SIP profile pointers
+    iSIPProfileRegistry->ProfilesL( iSIPProfiles );
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CWPProtocolProfileHandlerSIP* CWPProtocolProfileHandlerSIP::NewL()
+    {
+    CWPProtocolProfileHandlerSIP* self = 
+        CWPProtocolProfileHandlerSIP::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CWPProtocolProfileHandlerSIP* CWPProtocolProfileHandlerSIP::NewLC()
+    {
+    CWPProtocolProfileHandlerSIP* self = 
+        new (ELeave) CWPProtocolProfileHandlerSIP();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+    
+// Destructor
+CWPProtocolProfileHandlerSIP::~CWPProtocolProfileHandlerSIP()
+    {
+    FLOG( "[ProvisioningFile] CWPProtocolProfileHandlerSIP::~CWPProtocolProfileHandlerSIP" );
+    
+    delete iSIPProfileRegistry;
+    iSIPProfileRegistry = NULL;
+
+    delete iSIP;
+    iSIP = NULL;
+    
+    // Close SIP Profile id array
+    iSIPProfileIds.Reset();
+    iSIPProfileIds.Close();
+
+    // Close SIP Profile array
+    for ( TInt i = iSIPProfiles.Count()-1; i >= 0; i-- )
+        {
+        delete iSIPProfiles[i];
+        }
+    iSIPProfiles.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::IncomingRequest
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CWPProtocolProfileHandlerSIP::IncomingRequest(
+    TUint32 /*aIapId*/,
+    CSIPServerTransaction* /*aTransaction*/ )
+    {
+    FLOG( "[ProvisioningFile] CWPProtocolProfileHandlerSIP::IncomingRequest 1" );
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::TimedOut
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CWPProtocolProfileHandlerSIP::TimedOut(
+    CSIPServerTransaction& /*aTransaction*/ )
+    {
+    FLOG( "[ProvisioningFile] CWPProtocolProfileHandlerSIP::TimedOut" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::ProfileRegistryEventOccurred
+// Handle profile events.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CWPProtocolProfileHandlerSIP::ProfileRegistryEventOccurred(
+    TUint32 /*aProfileId*/,
+    MSIPProfileRegistryObserver::TEvent /*aEvent*/ )
+    {
+    FLOG( "[ProvisioningFile] CWPProtocolProfileHandlerSIP::ProfileRegistryEventOccurred" );
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::ProfileRegistryErrorOccurred
+// Handle SIP profile error events
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CWPProtocolProfileHandlerSIP::ProfileRegistryErrorOccurred(
+    TUint32 /*aProfileId*/,
+    TInt /*aError*/ )
+    {
+    FLOG( "[ProvisioningFile] CWPProtocolProfileHandlerSIP::ProfileRegistryErrorOccurred" );
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::SetProfilesIapL
+// Set Protocol Profile use this IAP.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CWPProtocolProfileHandlerSIP::SetProfilesIapL(
+    TInt aProfileId, 
+    TUint32 aProfileIapId )
+    {
+    FLOG( "[ProvisioningFile] CWPProtocolProfileHandlerSIP::SetProfilesIapL" );
+    
+    // Set new IAP Id and Update SIP profile table
+    CSIPProfile* updatedProfile = NULL;
+    TInt index( 0 );
+    
+    // SIP engine for saving
+    CSIPManagedProfileRegistry* sipEngine = 
+        CSIPManagedProfileRegistry::NewLC( *this );
+        
+    // Take right SIP profile
+    updatedProfile = FindSIPProfileByIdL( iSIPProfileIds[aProfileId], index );
+    
+    // Take managed SIP Profile
+    CSIPManagedProfile* profile = 
+        static_cast<CSIPManagedProfile*> ( updatedProfile );
+    
+    // Add new Iap Id to SIP Profile
+    User::LeaveIfError( profile->SetParameter( KSIPAccessPointId, 
+                                               aProfileIapId ) );
+    
+    // Save changes
+    sipEngine->SaveL( *profile );
+    
+    // Update the SIP table
+    iSIPProfiles.Remove( index );
+    iSIPProfiles.Insert( updatedProfile, index );
+                
+    CleanupStack::PopAndDestroy( sipEngine );
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::FindSIPProfileByIdL
+// Find SIP Profile Id from local SIP Profile pointer array
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CSIPProfile* CWPProtocolProfileHandlerSIP::FindSIPProfileByIdL(
+    TUint32 aProfileId,
+    TInt& aIndex )
+    {
+    FLOG( "[ProvisioningFile] CWPProtocolProfileHandlerSIP::FindSIPProfileByIdL" );
+    
+    CSIPProfile* result = NULL;
+    TUint32 sipId = 0;
+    const TInt profilesCount = iSIPProfiles.Count();
+
+    for ( TInt i = 0; i < profilesCount; i++ )
+        {
+        sipId = 0;
+        iSIPProfiles[i]->GetParameter( KSIPProfileId, sipId );
+        if ( sipId == aProfileId )
+            {
+            result = iSIPProfiles[i];
+            aIndex = i;
+            break;
+            }
+        }
+
+    if ( !result )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::SetProvisioningIdL
+// Set provisioning Protocol Profiles Id in array.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CWPProtocolProfileHandlerSIP::SetProvisioningIdL()    
+    {
+    FLOG( "[ProvisioningFile] CWPProtocolProfileHandlerSIP::SetProvisioningIdL" );
+    
+    TUint32 sipId( 0 );
+    TBool idExist( EFalse );
+    
+    RArray<TUint32> oldIdArray;
+    CleanupClosePushL( oldIdArray );
+        
+    // delete old SIP Profile array
+    for ( TInt i = 0; i < iSIPProfiles.Count(); i++ )
+        {
+        iSIPProfiles[i]->GetParameter( KSIPProfileId, sipId );
+        User::LeaveIfError( oldIdArray.Append( sipId ) );
+        delete iSIPProfiles[i];
+        iSIPProfiles[i] = NULL;
+        }
+    iSIPProfiles.Close();
+            
+    // Get SIP profile pointers
+    iSIPProfileRegistry->ProfilesL( iSIPProfiles );
+    
+    if ( oldIdArray.Count() < iSIPProfiles.Count() )
+        {
+        for ( TInt j = 0; j < iSIPProfiles.Count(); j++ )
+            {
+            idExist = EFalse;
+            TUint32 newSipId( 0 );
+            User::LeaveIfError( iSIPProfiles[j]->GetParameter( KSIPProfileId, newSipId ) );
+            
+            for ( TInt k = 0; k < oldIdArray.Count(); k++ )
+                {
+                if ( oldIdArray[k] == newSipId )
+                    {
+                    idExist = ETrue;
+                    k = oldIdArray.Count();
+                    }
+                }
+                
+            if ( !idExist )
+                {
+                // Save Id to Profile Id array
+                User::LeaveIfError( iSIPProfileIds.Append( newSipId ) );
+                }
+            }
+        }
+        
+    CleanupStack::PopAndDestroy( &oldIdArray );        
+    FLOG( "[ProvisioningFile] *** CWPProtocolProfileHandlerSIP::SetProvisioningIdL out" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CWPProtocolProfileHandlerSIP::ProvisionedCount
+// Get provisioned Protocol Profiles count.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+TInt CWPProtocolProfileHandlerSIP::ProvisionedCount()    
+    {
+    FLOG( "[ProvisioningFile] CWPProtocolProfileHandlerSIP::GetProvisionedCount" );
+    
+    return iSIPProfileIds.Count();
+    }    
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/provisioningfile/src/WPProvisioningFile.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,297 @@
+/*
+* 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:  Handles provisioning document.
+*
+*/
+
+
+// INCLUDE FILES
+#include    "WPProvisioningFile.h"
+#include    "WPOMAMsgHandler.h"
+#include    "WPProtocolProfileHandlerSIP.h"
+#include    "wpprovisioningfileconst.h"
+#include    "wpprovisioningfiledebug.h"
+
+#include    <CWPEngine.h>
+#include    <centralrepository.h>
+#include    <settingsinternalcrkeys.h>
+// CONSTANTS
+_LIT( KPathLetter, "E:" );
+_LIT( KFilePath, "\\data\\settings.wbxml" );
+
+// ============================ LOCAL FUNCTIONS ================================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CWPProvisioningFile::CWPProvisioningFile
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CWPProvisioningFile::CWPProvisioningFile( TFileName aFileName )
+    : iIapAllowed( EFalse ),
+    iInitDone( EFalse ),
+    iFileName( aFileName )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProvisioningFile::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CWPProvisioningFile::ConstructL()
+    {
+    FLOG( "[ProvisioningFile] CWPProvisioningFile::ConstructL" );
+    
+    iProvEngine = CWPEngine::NewL();
+    
+    iMsgHandler = CWPOMAMsgHandler::NewL();
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProvisioningFile::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CWPProvisioningFile* CWPProvisioningFile::NewL( TFileName aFileName )
+    {
+    CWPProvisioningFile* self = CWPProvisioningFile::NewLC( aFileName );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProvisioningFile::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CWPProvisioningFile* CWPProvisioningFile::NewLC( TFileName aFileName )
+    {
+    CWPProvisioningFile* self = new( ELeave ) CWPProvisioningFile( aFileName );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProvisioningFile::Destructor
+// 
+// -----------------------------------------------------------------------------
+//
+CWPProvisioningFile::~CWPProvisioningFile()
+    {
+    delete iProvisioningDoc;
+    if ( iSipHandler )
+        {
+        delete iSipHandler;
+        iSipHandler = NULL;
+        }
+    delete iMsgHandler;
+    delete iProvEngine;
+    delete iCenRep;
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProvisioningFile::ProvFileContainsIapL
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CWPProvisioningFile::ProvFileContainsIapL()
+    {
+    FLOG( "[ProvisioningFile] CWPProvisioningFile::ProvFileContainsIapL" );
+    
+    const TDesC16* settingsName;
+    TBool iapExist( EFalse );
+    
+    if ( !iInitDone )
+        {
+        InitMsgL();
+        }
+    
+    // Check is there IAP
+    for ( TInt i = 0; i < iProvEngine->ItemCount(); i++ )
+        {
+        // Next settings
+        settingsName = &iProvEngine->SummaryTitle( i );
+        
+        // Is settings IAP
+        if ( !settingsName->Compare( KProvFileIapSetting ) )
+            {
+            // Message contains IAP settings
+            iapExist = ETrue;
+            }
+        }
+        
+    return iapExist;        
+    }
+    
+// -----------------------------------------------------------------------------
+// CWPProvisioningFile::ProvFileL
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CWPProvisioningFile::ProvFileL()
+    {
+    FLOG( "[ProvisioningFile] CWPProvisioningFile::ProvFileL" );
+    
+    if( iMsgHandler )
+        {
+        // Do the provisioning
+        DoProvL();
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CWPProvisioningFile::ProvFileL
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CWPProvisioningFile::ProvFileL( TUint32& aIapId )
+    {
+    FLOG( "[ProvisioningFile] CWPProvisioningFile::ProvFileL IAP" ); 
+    
+    if( iMsgHandler )
+        {
+        // Is offered IAP allowed
+        iIapAllowed = ETrue;
+        
+        iIapId = aIapId;
+                    
+        // Do the provisioning
+        DoProvL();
+        }
+    
+    iIapAllowed = EFalse;        
+    }    
+
+// -----------------------------------------------------------------------------
+// CWPProvisioningFile::DoProvL
+//
+// -----------------------------------------------------------------------------
+//
+void CWPProvisioningFile::DoProvL()
+    {
+    FLOG( "[ProvisioningFile] CWPProvisioningFile::DoProvL" ); 
+    
+    // Is init done
+    if ( !iInitDone )
+        {
+        InitMsgL();
+        }
+    
+    // Save OMA message
+    SaveDocL();
+    
+    // If new IAP is allowed
+    if( iIapAllowed )
+        {
+        for ( TInt i = 0; i < iSipHandler->ProvisionedCount(); i++ )
+            {
+            iSipHandler->SetProfilesIapL( i, iIapId );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CWPProvisioningFile::InitMsgL
+//
+// -----------------------------------------------------------------------------
+//
+void CWPProvisioningFile::InitMsgL()
+    {
+    FLOG( "[ProvisioningFile] CWPProvisioningFile::InitMsgL" );
+    
+    FLOG2( "[ProvisioningFile] *** CWPProvisioningFile::InitMsgL %S", &iFileName );
+    if ( KErrNone == iFileName.Compare( KDefaultFilePath ) )
+        {
+        iFileName.Zero();
+        iFileName.Append( KPathLetter );
+        iFileName.Append( KFilePath );
+        }
+    // Read OMA message
+    iMsgHandler->ReadProvFileL( iFileName );
+    
+    // Get OMA message
+    if ( iProvisioningDoc )
+        {
+        delete iProvisioningDoc;
+        iProvisioningDoc = NULL;
+        }
+    iProvisioningDoc = iMsgHandler->DocL();
+
+    // Import the OMA message
+    iProvEngine->ImportDocumentL( iProvisioningDoc->Des() );
+
+    // Populate OMA message to Adapters
+    iProvEngine->PopulateL();
+    
+    iInitDone = ETrue;
+    FLOG( "[ProvisioningFile] CWPProvisioningFile::InitMsgL out" );
+    }
+    
+// -----------------------------------------------------------------------------
+// CWPProvisioningFile::SaveDocL
+//
+// -----------------------------------------------------------------------------
+//
+void CWPProvisioningFile::SaveDocL()
+    {
+    FLOG( "[ProvisioningFile] CWPProvisioningFile::SaveDocL" );
+    
+    const TDesC16* settingsName( NULL );
+    
+    // SIP Profile handler
+    if ( iSipHandler )
+        {
+        delete iSipHandler;
+        iSipHandler = NULL;
+        }
+    iSipHandler = CWPProtocolProfileHandlerSIP::NewL();
+    
+    // Message contains SIP information
+    TBool sipEnable( EFalse );
+    
+    // Save OMA message
+    for ( TInt i = 0; i < iProvEngine->ItemCount(); i++ )
+        {
+        // Next settings
+        settingsName = &iProvEngine->SummaryTitle( i );
+        
+        // Ongoing setting
+        if ( !settingsName->Compare( KProvFileIapSetting ) )
+            {
+            // Message contains IAP settings, which priority is higher than given IAPs
+            iIapAllowed = EFalse;
+            }
+        else if ( !settingsName->Compare( KProvFileSipSetting ) )
+            {
+            // There is SIP setting
+            sipEnable = ETrue;
+            }
+        
+        iProvEngine->SaveL( i );
+        }
+    
+    // If there was new SIP Profiles and new IAP is allowed, save provisioned SIP Ids
+    if ( sipEnable && iIapAllowed )
+        {
+        // Lets save provisioned SIP Id
+        iSipHandler->SetProvisioningIdL();
+        }
+    
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common build definition file for S60 Skype
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/voipxmlprovisioning.iby CORE_APP_LAYER_IBY_EXPORT_PATH( voipxmlprovisioning.iby )
+../rom/voipxmlprovisioningresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH( voipxmlprovisioningresources.iby )
+
+PRJ_MMPFILES
+#include "../voipxmlprocessor/group/bld.inf"
+#include "../provisioningappui/group/bld.inf"
+#include "../provisioningrecognizer/group/bld.inf"
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/install/RD_RootCA/rd-key.pem	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXAIBAAKBgQDLRF+r1FGGkCwTrb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW4
+6Y+LWaA8HMlDdoHRB0FgASisYcFagwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh
+7W7Dt9F5FZij8F7/9Pi6+FhhxZFIf1DD+yry9D7+Sp+BgdNALe4XOpf25QIBAwKB
+gQCHgupyjYuvCsgNHn7PNtnvVxInrB5MQNoPli+O+uNJWUK/Q+57Rl+yO8AoEzDX
+pFaLWiuVVhsdloDnAgabT/FXzYncs6uOHyEUV+dSXb78vtLPJqAX+Fg2i3hOXreB
+yskcZ13/OsKVOu5wgrJkx2baZufkqMwOSytf5y9nwjEIKwJBAP+inobagVNrN62j
+KQva3cC+UN/6XnKdTc0CA6bHyLOaJoH1xiMwG/VS2PGjHI0tiSMNtLn/QPpHJ003
+iabGhdUCQQDLjp/9UjFT6K6CF66Chqf30pZXhx+GTSQZmv/gvZiMly7X9fX9BGX3
+2MbJohBC4yI21XKTbisWywkF73Hwh+TRAkEAqmxprzxWN5zPyRdwspHpKymLP/w+
+9xOJM1atGdqFzRFvAU6EF3Vn+OHl9my9s3OwwgkjJqorUYTE3iUGby8D4wJBAIe0
+aqjhdjfwdFa6dFcEb/qMZDpaFQQzbWZnVUB+ZbMPdI/5TqitmU/l2dvBYCyXbCSO
+TGJJcg8yBgP09qBamIsCQFL7j1tM0XPVQJQ89WpKCld7O9ORxRGVj1eG0tWijrH8
+mGbYh8SGCVoWV3vrKSS8GBrFVgQnqUaHuEdtM7tpCAQ=
+-----END RSA PRIVATE KEY-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/install/RD_RootCA/rd.cer	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICzDCCAjWgAwIBAgIBADANBgkqhkiG9w0BAQUFADArMRAwDgYDVQQKEwdSRCBD
+ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZTAeFw0wNDExMTUxMjQyMDZaFw0z
+NzA5MjMxMjQyMDZaMCsxEDAOBgNVBAoTB1JEIENlcnQxFzAVBgNVBAMTDlJEIENl
+cnRpZmljYXRlMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDLRF+r1FGGkCwT
+rb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW46Y+LWaA8HMlDdoHRB0FgASisYcFa
+gwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh7W7Dt9F5FZij8F7/9Pi6+FhhxZFI
+f1DD+yry9D7+Sp+BgdNALe4XOpf25QIBA6OCAQAwgf0wDAYDVR0TBAUwAwEB/zAL
+BgNVHQ8EBAMCAoQwHQYDVR0OBBYEFFi/kuGzxhVpjGxe9ZwlxC3fH9jFMFMGA1Ud
+IwRMMEqAFFi/kuGzxhVpjGxe9ZwlxC3fH9jFoS+kLTArMRAwDgYDVQQKEwdSRCBD
+ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZYIBADBsBgNVHSAEZTBjMGEGBFUd
+IAAwWTATBggrBgEFBQcCARYHaHR0cDovLzBCBggrBgEFBQcCAjA2GjRGb3IgUiZE
+IHVzYWdlIG9ubHkuIFRoaXMgY2VydGlmaWNhdGUgaXMgbm90IHRydXN0ZWQuMA0G
+CSqGSIb3DQEBBQUAA4GBAHGB4RQMAgBdeT2hxfOr6f2nA/dZm+M5yX5daUtZnET9
+Ed0A9sazLawfN2G1KFQT9kxEParAyoAkpbMAsRrnRz/9cM3OHgFm/NiKRnf50DpT
+7oCx0I/65mVD2kt+xXE62/Ii5KPnTufIkPi2uLvURCia1tTS8JmJ8dtxDGyQt8BR
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/install/create_sis_udeb.bat	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,17 @@
+rem
+rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+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:
+rem
+
+call createsis create -key .\RD_RootCA\rd-key.pem -cert .\RD_RootCA\rd.cer settings.pkg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/install/settings.pkg	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,47 @@
+;
+; Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: 
+;
+
+;Languages 
+&EN
+
+;Header 
+#{"S60 settings provision"},(0x20021999),1,0,0, TYPE=SA
+
+
+;Series 60 v5.0
+[0x1028315F], 0, 0, 0, {"Series60ProductID"}
+
+;Localised Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+;Files to install 
+
+
+
+;PROVISIONRECONIZER
+"\epoc32\release\armv5\udeb\VoIPProvRec.dll"-"!:\sys\bin\VoIPProvRec.dll"
+"\epoc32\data\Z\Resource\Plugins\VoIPProvRec.rsc" -"!:\resource\plugins\VoIPProvRec.rsc"
+
+;PROVISIONINGAPPUI
+"\epoc32\release\armv5\udeb\VoIPProvisioningApp.exe"-"!:\sys\bin\VoIPProvisioningApp.exe"
+"\epoc32\data\z\resource\apps\VoIPProvisioningApp.rsc"-"!:\resource\apps\VoIPProvisioningApp.rsc"
+"\epoc32\data\z\private\10003a3f\apps\VoIPProvisioningApp_reg.rsc"-"!:\private\10003a3f\import\apps\VoIPProvisioningApp_reg.rsc"
+
+;VOIPXMLPROCESSOR
+"\epoc32\release\armv5\udeb\voipxmlprocessor.dll"-"!:\sys\bin\voipxmlprocessor.dll"
Binary file voipplugins/voipadapters/voipxmlprovisioning/install/settings_for_MCL.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Aif/VoIPProvisioningAppAif.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+#include <aiftool.rh>
+
+RESOURCE AIF_DATA
+    {
+    app_uid = 0x10281F1A; 
+    hidden = KAppIsHidden;
+    num_icons = 0;
+    embeddability = KAppNotEmbeddable;
+    newfile = KAppDoesNotSupportNewFile;
+    datatype_list=
+    	{
+        DATATYPE { priority=EDataTypePriorityHigh; type="vnd.nokia.iptv.config+xml"; },
+        DATATYPE { priority=EDataTypePriorityHigh; type="application/vnd.nokia.iptv.config+xml"; }
+    	};
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Aif/VoIPProvisioningApp_caption.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+#include <apcaptionfile.rh>
+
+RESOURCE CAPTION_DATA
+    {
+    caption      = " ";
+    shortcaption = " ";
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/VoIPProvisioningApp.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UI resource file.
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+NAME    VPRA
+
+//  INCLUDES
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <eikon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <csc.loc>
+#include <cscsettingsui.loc>
+
+//  RESOURCE DEFINITIONS 
+
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf=""; }
+
+RESOURCE EIK_APP_INFO
+    {
+    status_pane=R_AVKON_STATUS_PANE_LAYOUT_EMPTY;
+    }
+
+//----------------------------------------------------
+// r_voip_provisioning_query_install_service
+// Query dialog for VoIP service installation.
+// 
+//----------------------------------------------------
+//
+RESOURCE DIALOG r_voip_provisioning_query_install_service
+    {
+    flags   = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL__OK;
+    items   =
+        {
+        DLG_LINE
+            {
+            type    = EAknCtQuery;
+            id      = EGeneralQuery;
+            control = AVKON_CONFIRMATION_QUERY
+                {
+                label = qtn_voip_settings_title;
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_voip_default_save_query
+// Text to be shown in installation query if no text is retreived from XML.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_voip_default_save_query
+    {
+    buf = qtn_form_litxt_save;
+    }
+
+// ---------------------------------------------------------------------------
+// r_voip_invalid_data
+// Text to be shown after failed installation.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_voip_invalid_data
+    {
+    buf = qtn_voip_csc_error_note_unable_to_configure;
+    }
+
+// ---------------------------------------------------------------------------
+// r_voip_installed
+// Text to show after successful installation.
+//
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_voip_installed
+    {
+    buf = qtn_form_conf_saved;
+    }
+
+// ---------------------------------------------------------------------------
+// r_waitnote_configure
+// Wait note to be shown
+// ---------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_waitnote_configure
+    {
+    flags = EAknWaitNoteFlags|EEikDialogFlagNotifyEsc;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralNote;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                singular_label = qtn_gen_note_saving;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/VoIPProvisioningApp_reg.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Application registration resource file.
+*
+*/
+
+
+#include <appinfo.rh>
+#include <data_caging_paths_strings.hrh>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0x20026FE3 // application UID
+
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file = "VoIPProvisioningApp";
+    hidden = KAppIsHidden;
+
+    datatype_list =
+        {
+        DATATYPE
+            {
+            priority = EDataTypePriorityHigh;
+            type = "vnd.nokia.voip.config+xml";
+            },
+        DATATYPE
+            {
+            priority = EDataTypePriorityHigh;
+            type="application/vnd.nokia.voip.config+xml";
+            }
+        };
+    }
Binary file voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Data/tempbranddatapackage.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningApp.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Application definition.
+*
+*/
+
+
+#ifndef CVOIPPROVISIONINGAPP_H
+#define CVOIPPROVISIONINGAPP_H
+
+#ifdef _DEBUG
+#define EUNIT_FRIEND_CLASS( x ) friend class x;
+#else
+#define EUNIT_FRIEND_CLASS( x )
+#endif
+
+// INCLUDES
+#include <aknapp.h>
+
+// CONSTANTS
+const TUid KUidVoIPProvisioningAppUid = { 0x20026FE3 };
+
+// CLASS DECLARATION
+/**
+*	Application class definition
+*/
+class CVoIPProvisioningApp : public CAknApplication
+    {
+    private: // from CApaApplication
+        /**
+        * Create CVoIPProvisioningDocument document object.
+        */
+        CApaDocument* CreateDocumentL();
+
+        /**
+        * Return CVoIPProvisioningApp uid.
+        */
+        TUid AppDllUid() const;
+        
+        EUNIT_FRIEND_CLASS( UT_CVoIPProvisioningApp )
+    };
+
+#endif // CVOIPPROVISIONINGAPP_H
+            
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningAppUi.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Application UI definition.
+*
+*/
+
+
+#ifndef VOIPPROVISIONINGAPPUI_H
+#define VOIPPROVISIONINGAPPUI_H
+
+#ifdef _DEBUG
+#define EUNIT_FRIEND_CLASS( x ) friend class x;
+#else
+#define EUNIT_FRIEND_CLASS( x )
+#endif
+
+// INCLUDES
+#include <aknappui.h>
+#include <downloadmgrclient.h>
+
+class CAknWaitDialog;
+
+/**
+*  CVoIPProvisioningAppUi class.
+*  This class handles the operation betweed provisioning processor,
+*  notifier framework (asks if user want to install parsed service)
+*  and service api (used to add service to the database if user has
+*  decided so)
+*/
+class CVoIPProvisioningAppUi : public CAknAppUi,
+                               public MHttpDownloadMgrObserver
+    {
+public:
+
+    CVoIPProvisioningAppUi();
+    virtual ~CVoIPProvisioningAppUi();
+
+    /**
+     * Method to be called for CVoIPProvisioningDocument when
+     * that classes OpenFileL method has been called and file
+     * containing the data to be parsed is received.
+     *
+     * @since S60 v5.0
+     * @param aFile File handle to XML file.
+     */
+    void HandleFileL( RFile& aFile );
+
+    /**
+     * Overwritten method from CEikAppUi. This method gets called
+     * when application is started by framework when file, which has
+     * mime type this applicaion knows, has been selected to be
+     * opened.
+     * 
+     * @since S60 v5.0
+     * @param aCommand Type of the command
+     * @param aDocumentName Name of the document to be opened
+     *                      When starting up application this value
+     *                      is empty
+     * @param aTail Command line's tail. Not used in this implementation.
+     * @return ETrue if aDocument represents an existing file, otherwise
+     *         EFalse.
+     */
+    TBool ProcessCommandParametersL( TApaCommand aCommand,
+     TFileName& aDocumentName, const TDesC8& aTail );
+
+protected:
+
+    /**
+     * Indicates an event.
+     *
+     * @since S60 v5.0
+     * @param aDownload The download with which the event occured.
+     * @param aEvent Event type.
+     */
+    void HandleDMgrEventL( RHttpDownload& aDownload,
+        THttpDownloadEvent aEvent );
+
+private:
+
+    /**
+     * Show invalid data note.
+     * 
+     * @since S60 v5.0
+     */
+    void ShowFailNoteL() const;
+
+    /**
+     * Show done note.
+     * 
+     * @since S60 v5.0
+     */
+   void ShowDoneNoteL() const;
+
+   /**
+    * Fetches, i.e. downloads branding data from given URL.
+    * 
+    * @since S60 v5.0
+    * @param aUrl URL from which branding data is downloaded.
+    */
+   TInt FetchBrandingDataL( const TDesC8& aUrl );
+
+   /**
+    * Uncompresses (unzips) files from GZip file.
+    * 
+    * @since S60 v5.0
+    */
+   void UncompressFilesL();
+
+private:
+    void ConstructL();
+private:
+    /**
+     * Download manager.
+     */
+    RHttpDownloadMgr iDownloadMgr;
+
+    /**
+     * File name of branding zip.
+     */
+    TFileName iBrandPackageName;
+
+    /**
+     * Wait dialog.
+     * Own.
+     */
+    CAknWaitDialog* iWaitDialog;
+    
+    EUNIT_FRIEND_CLASS( UT_CVoIPProvisioningAppUi )
+    };
+
+#endif // VOIPPROVISIONINGAPPUI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/VoIPProvisioningDocument.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Document definition.
+*
+*/
+
+
+#ifndef VoIPPROVISIONINGDOCUMENT_H
+#define VoIPPROVISIONINGDOCUMENT_H
+
+#ifdef _DEBUG
+#define EUNIT_FRIEND_CLASS( x ) friend class x;
+#else
+#define EUNIT_FRIEND_CLASS( x )
+#endif
+
+// INCLUDES
+#include <AknDoc.h>
+
+// FORWARD DECLARATIONS
+class  CEikAppUi;
+class CVoIPProvisioningAppUi;
+
+// CLASS DECLARATION
+/**
+*  CVoIPProvisioningDocument application class.
+*/
+class CVoIPProvisioningDocument : public CAknDocument
+    {
+    public:
+        /**
+        * C++ constructor.
+        * @param CEikApplication& aApp
+        * @return void
+        */
+        CVoIPProvisioningDocument( CEikApplication& aApp ) :
+        							CAknDocument(aApp) { }
+
+        /**
+        * Destructor.
+        * @param None
+        * @return void
+        */
+        virtual ~CVoIPProvisioningDocument();
+
+
+	// From CEikDocument.
+    CFileStore* OpenFileL( TBool aDoOpen, const TDesC& aFilename, RFs& aFs );
+	void OpenFileL( CFileStore*& aFileStore, RFile& aFile );
+
+    private:
+        /**
+        * C++ default constructor.
+        * @param None
+        * @return void
+        */
+        CVoIPProvisioningDocument();
+
+        /**
+        * This method makes an application hidden so that it is not visible
+        * for example in Applications list and FastSwap window.
+        * @param CApaWindowGroupName* aWgName
+        * @return void        
+        */
+        void UpdateTaskNameL( CApaWindowGroupName* aWgName );
+        
+    private:// from CAknDocument
+        /**
+        * Create CVoIPProvisioningDocument "App UI" object.
+        * @param None
+        * @return CEikAppUi*        
+        */
+        CEikAppUi* CreateAppUiL();
+        
+        EUNIT_FRIEND_CLASS( UT_CVoIPProvisioningDocument )
+    };
+
+#endif      // VoIPPROVISIONINGDOCUMENT_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Inc/voipprovisioningapp.loc	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localisation file.
+*
+*/
+
+
+//  LOCALISATION STRINGS
+
+// Installation query string.
+#define qtn_voip_prov_installation_query_string "Install VoIP service?"
+
+// Note for successful installation.
+#define qtn_voip_prov_installation_success "VoIP service installed"
+
+// Note for failed installation.
+#define qtn_voip_prov_installation_failed "Installation failed"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningApp.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Application implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include <eikstart.h>
+#include "VoIPProvisioningApp.h"
+#include "VoIPProvisioningDocument.h"
+
+// ========================= MEMBER FUNCTIONS ================================
+
+// ---------------------------------------------------------------------------
+// CVoIPProvisioningApp::AppDllUid()
+// Returns application UID
+// ---------------------------------------------------------------------------
+
+TUid CVoIPProvisioningApp::AppDllUid() const
+    {
+    return KUidVoIPProvisioningAppUid;
+    }
+
+// ---------------------------------------------------------------------------
+// CVoIPProvisioningApp::CreateDocumentL()
+// Creates CVoIPProvisioningDocument object
+// ---------------------------------------------------------------------------
+
+CApaDocument* CVoIPProvisioningApp::CreateDocumentL()
+    {
+    return new (ELeave) CVoIPProvisioningDocument( *this );
+    }
+
+// ===================== OTHER EXPORTED FUNCTIONS ============================
+
+LOCAL_C CApaApplication* NewApplication()
+    {
+    return new CVoIPProvisioningApp;
+    }
+
+GLDEF_C TInt E32Main()
+    {
+    return EikStart::RunApplication( NewApplication );
+    }
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningAppUi.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,375 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Application UI implementation.
+*
+*/
+
+
+// INCLUDES
+#include <eikdoc.h>
+#include <StringLoader.h>
+#include <AknQueryDialog.h>
+#include <voipprovisioningapp.rsg>
+#include <aknnotewrappers.h>
+#include <apgcli.h> // RApaLsSession
+#include <bautils.h>
+#include <xSPViewServices.h>
+#include <browseruisdkcrkeys.h>
+#include <pathinfo.h>
+#include <driveinfo.h>
+#include <zipfile.h>
+#include <zipfilememberinputstream.h>
+#include <AknWaitDialog.h>
+
+#include "voipxmlparser.h"
+#include "VoIPProvisioningAppUi.h"
+#include "VoIPProvisioningApp.h"
+#include "VoIPProvisioningDocument.h"
+
+const TInt KOneSecond( 1000000 );
+const TUid KMecoServiceTabUid = {0x20012423};
+const TInt KFiveTimes( 5 );
+_LIT( KDownloadFileName, "tempbranddatapackage.zip" );
+_LIT( KBrandMifPath,     ":\\private\\102828DD\\import\\" );
+_LIT( KBrandInstallPath, ":\\private\\102828DD\\import\\install\\" );
+_LIT( KBrandXmlPath,     ":\\private\\102828E1\\import\\" );
+_LIT( KXmlExtension,     ".xml" );
+_LIT( KMifExtension,     ".mif" );
+_LIT( KInstallExtension, ".install" );
+_LIT8( KZipExtension,    ".zip" );
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningAppUi::CVoIPProvisioningAppUi
+// ----------------------------------------------------------------------------
+//
+CVoIPProvisioningAppUi::CVoIPProvisioningAppUi()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningAppUi::ConstructL
+// ----------------------------------------------------------------------------
+
+void CVoIPProvisioningAppUi::ConstructL()
+    {
+    // Call base classes ConstructL method.
+    BaseConstructL( ENoScreenFurniture | EAknEnableMSK );
+
+    StatusPane()->MakeVisible( EFalse );
+    HideApplicationFromFSW( ETrue );
+
+    iBrandPackageName.Copy( PathInfo::PhoneMemoryRootPath() );
+    iBrandPackageName.Append( PathInfo::OthersPath() );
+    iBrandPackageName.Append( KDownloadFileName );
+    }
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningAppUi::~CVoIPProvisioningAppUi
+// ----------------------------------------------------------------------------
+//
+CVoIPProvisioningAppUi::~CVoIPProvisioningAppUi()
+    {
+    iDownloadMgr.Close();
+    if ( iWaitDialog )
+        {
+        TRAP_IGNORE( iWaitDialog->ProcessFinishedL() );
+        iWaitDialog = NULL;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningAppUi::ProcessCommandParametersL
+// ----------------------------------------------------------------------------
+//
+TBool CVoIPProvisioningAppUi::ProcessCommandParametersL(
+    TApaCommand /*aCommand*/, TFileName& /*aDocumentName*/,
+    const TDesC8& /*aTail*/ )
+    {
+    // Always return ETrue to make CVoIPProvisioningDocument's
+    // OpenFileL to be called.
+    return ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningAppUi::HandleFileL
+// ----------------------------------------------------------------------------
+//
+void CVoIPProvisioningAppUi::HandleFileL( RFile& aFile )
+    {
+    RFile file;
+    User::LeaveIfError( file.Duplicate( aFile ) );
+    CVoipXmlParser* parser = CVoipXmlParser::NewLC(); // CS:1
+    TBuf8<KMaxFileName> brandUrl( KNullDesC8 );
+    HBufC* queryText = parser->ReadDescriptionLC( aFile, brandUrl ); // CS:2
+    if ( !queryText->Des().Length() )
+        {
+        CleanupStack::PopAndDestroy( queryText );
+        queryText = NULL;
+        queryText = StringLoader::LoadLC( R_VOIP_DEFAULT_SAVE_QUERY );
+        }
+    CAknQueryDialog* query = CAknQueryDialog::NewL();
+    CleanupStack::PushL( query ); // CS:3
+    query->SetPromptL( queryText->Des() );
+    TBool launchTab( EFalse );
+    TUint32 serviceTabId;
+    if ( query->ExecuteLD( R_VOIP_PROVISIONING_QUERY_INSTALL_SERVICE ) )
+        {
+        iWaitDialog = new( ELeave ) CAknWaitDialog( 
+            REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) );
+        iWaitDialog->SetTone( CAknNoteDialog::ENoTone );
+        iWaitDialog->ExecuteLD( R_WAITNOTE_CONFIGURE );
+
+        FetchBrandingDataL( brandUrl );
+
+        // Start phonebook into backgound.
+        RxSPViewServices viewServices;
+        CleanupClosePushL( viewServices ); // CS:4
+        TInt viewSrvErr = viewServices.Open();
+        if ( KErrServerTerminated == viewSrvErr || KErrNotFound == viewSrvErr )
+            {
+            viewServices.Close();
+            viewSrvErr = viewServices.Open();
+            }
+        if ( KErrNone == viewSrvErr )
+            {
+            viewServices.Close();
+            }
+
+        // Ownership of file is trasferred.
+        TInt error = parser->ImportDocument( file, serviceTabId );
+        if ( KErrNone == error )
+            {
+            iWaitDialog->ProcessFinishedL();
+            iWaitDialog = NULL;
+            ShowDoneNoteL();
+            launchTab = ETrue;
+            }
+        else
+            {
+            iWaitDialog->ProcessFinishedL();
+            iWaitDialog = NULL;
+            ShowFailNoteL();
+            }
+        CleanupStack::PopAndDestroy( &viewServices ); // CS:3
+        }
+    CleanupStack::Pop( query ); // CS:2
+    // queryText, parser
+    CleanupStack::PopAndDestroy( 2, parser ); // CS:0
+
+    // Launch service tab.
+    if ( launchTab )
+        {
+        TInt err = KErrNotFound;
+        TInt counter( 0 );
+        RxSPViewServices viewServices;
+        CleanupClosePushL( viewServices ); // CS:1
+        while ( KErrNone != err && KFiveTimes > counter )
+            {
+            err = viewServices.Activate( 
+                KMecoServiceTabUid.iUid, (TInt32)serviceTabId );
+            if ( KErrServerTerminated == err || KErrNotFound == err )
+                {
+                err = viewServices.Activate( 
+                    KMecoServiceTabUid.iUid, (TInt32)serviceTabId );
+                }
+            // Wait...
+            User::After( KOneSecond );
+            counter++;
+            }
+
+        CleanupStack::PopAndDestroy( &viewServices ); // CS:0
+        TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
+        TApaTask browserTask = taskList.FindApp( KCRUidBrowser );
+        if ( browserTask.Exists() )
+            {
+            browserTask.EndTask();
+            }
+        }
+
+    if ( iWaitDialog )
+        {
+        iWaitDialog->ProcessFinishedL();
+        iWaitDialog = NULL;
+        }
+
+    iDownloadMgr.Close();
+#ifndef __EUNIT_TESTING
+    User::Exit( KErrNone );
+#endif
+    }
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningAppUi::ShowFailNoteL
+// ----------------------------------------------------------------------------
+//
+void CVoIPProvisioningAppUi::ShowFailNoteL() const
+    {
+    HBufC* text = StringLoader::LoadLC( R_VOIP_INVALID_DATA );
+    CAknErrorNote* note = new (ELeave) CAknErrorNote( R_AKN_ERROR_NOTE );
+    note->ExecuteLD( *text );
+    CleanupStack::PopAndDestroy( text );
+    }
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningAppUi::ShowDoneNoteL
+// ----------------------------------------------------------------------------
+//
+void CVoIPProvisioningAppUi::ShowDoneNoteL() const
+    {
+    HBufC* text = StringLoader::LoadLC( R_VOIP_INSTALLED );
+    CAknInformationNote* note =
+        new (ELeave) CAknInformationNote( R_AKN_INFORMATION_NOTE );
+    note->ExecuteLD( *text );
+    CleanupStack::PopAndDestroy( text );
+    }
+
+// ---------------------------------------------------------------------------
+// From base class MHttpDownloadMgrObserver.
+// Handles download manager events.
+// ---------------------------------------------------------------------------
+//
+void CVoIPProvisioningAppUi::HandleDMgrEventL( RHttpDownload& aDownload,
+    THttpDownloadEvent aEvent )
+    {
+    if ( EHttpDlPaused == aEvent.iDownloadState && 
+        EHttpContentTypeReceived == aEvent.iProgressState )
+        {
+        TInt32 length;
+        TInt err = aDownload.GetIntAttribute( EDlAttrLength, length );
+        if ( KDefaultContentLength != length && 0 < length )
+            {
+            // Continue.
+            aDownload.Start();
+            }
+        else
+            {
+            CActiveScheduler::Stop();
+            aDownload.Delete();
+            }
+        }
+    else if ( EHttpDlCompleted == aEvent.iDownloadState )
+        {
+        CActiveScheduler::Stop();
+        // We don't need the leave code; un-branded service is OK.
+        TRAP_IGNORE( UncompressFilesL() );
+        aDownload.Delete();
+        }
+    else if ( EHttpDlFailed == aEvent.iDownloadState )
+        {
+        CActiveScheduler::Stop();
+        aDownload.Delete();
+        }
+    else if ( EHttpDlInprogress == aEvent.iDownloadState && 
+        EHttpProgDisconnected == aEvent.iProgressState )
+        {
+        CActiveScheduler::Stop();
+        aDownload.Delete();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Starts branding data download.
+// ---------------------------------------------------------------------------
+//
+TInt CVoIPProvisioningAppUi::FetchBrandingDataL( const TDesC8& aUrl )
+    {
+    if ( !aUrl.Length() || KErrNotFound == aUrl.Find( KZipExtension ) )
+        {
+        return KErrNotFound;
+        }
+    iDownloadMgr.ConnectL( KUidVoIPProvisioningAppUid, *this, EFalse );
+    RHttpDownload& download = iDownloadMgr.CreateDownloadL( aUrl );
+    download.SetStringAttribute( EDlAttrDestFilename, iBrandPackageName );
+    TInt err = download.Start();
+    CActiveScheduler::Start();
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Uncompresses files from a zip file.
+// ---------------------------------------------------------------------------
+//
+void CVoIPProvisioningAppUi::UncompressFilesL()
+    {
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs ); // CS:1
+    CZipFile* zipfile = CZipFile::NewL( fs, iBrandPackageName );
+    CleanupStack::PushL( zipfile ); // CS:2
+    CZipFileMemberIterator* iterator = zipfile->GetMembersL();
+    CleanupStack::PushL( iterator ); // CS:3
+    CZipFileMember* fileMember = iterator->NextL();
+    TChar drive;
+    DriveInfo::GetDefaultDrive( DriveInfo::EDefaultPhoneMemory, drive );
+
+    RFile output;
+    CleanupClosePushL( output ); // CS:4
+
+    while ( fileMember )
+        {
+        TFileName memberFileName = *fileMember->Name();
+        TFileName outputPath;
+        outputPath.Append( drive );
+        if ( KErrNotFound != memberFileName.Find( KXmlExtension ) )
+            {
+            outputPath.Append( KBrandXmlPath );
+            outputPath.Append( memberFileName );
+            }
+        else if ( KErrNotFound != memberFileName.Find( KInstallExtension ))
+            {
+            outputPath.Append( KBrandInstallPath );
+            outputPath.Append( memberFileName );
+            }
+        else if ( KErrNotFound != memberFileName.Find( KMifExtension ))
+            {
+            outputPath.Append( KBrandMifPath );
+            outputPath.Append( memberFileName );
+            }
+        else
+            {
+            // Ignore this file and get next file from zip.
+            fileMember = iterator->NextL();
+            break;
+            }
+
+        TInt err = fs.MkDirAll( outputPath );
+        err = output.Replace( fs, outputPath, EFileShareAny|EFileWrite );
+
+        TUint32 size = fileMember->UncompressedSize();
+        RBuf8 outputData;
+        outputData.CreateL( size );
+        CleanupClosePushL( outputData ); // CS:5
+        RZipFileMemberReaderStream* stream;
+        zipfile->GetInputStreamL( fileMember, stream );
+        CleanupStack::PushL( stream ); // CS:6
+
+        err = stream->Read( outputData, size );
+        err = output.Write( outputData );
+
+        output.Flush();
+
+        // stream, &outputData
+        CleanupStack::PopAndDestroy( 2, &outputData ); // CS:4
+
+        fileMember = iterator->NextL();
+        }
+    // &output, iterator, zipfile, &fs
+    CleanupStack::PopAndDestroy( 3, zipfile ); // CS:1
+
+    // Finally, delete temp zip file.
+    fs.Delete( iBrandPackageName );    
+    CleanupStack::PopAndDestroy( &fs ); // CS:0
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/Src/VoIPProvisioningDocument.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Document implementation.
+*
+*/
+
+
+// INCLUDE FILES
+#include <apgwgnam.h>
+#include "VoIPProvisioningDocument.h"
+#include "VoIPProvisioningAppUi.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningDocument::~CVoIPProvisioningDocument()
+// ----------------------------------------------------------------------------
+
+CVoIPProvisioningDocument::~CVoIPProvisioningDocument()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningDocument::CreateAppUiL()
+// Creates CVoIPProvisioningAppUi
+// ----------------------------------------------------------------------------
+CEikAppUi* CVoIPProvisioningDocument::CreateAppUiL()
+    {
+    // Create new instance of appui class
+    return new (ELeave) CVoIPProvisioningAppUi();
+    }
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningDocument::UpdateTaskNameL( CApaWindowGroupName* aWgName )
+// ----------------------------------------------------------------------------
+void CVoIPProvisioningDocument::UpdateTaskNameL( CApaWindowGroupName* aWgName )
+	{
+	// Set task name to be hidden from the tasklist
+	CAknDocument::UpdateTaskNameL( aWgName );
+	aWgName->SetHidden( ETrue );
+	}
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningDocument::OpenFileL
+// ----------------------------------------------------------------------------
+CFileStore* CVoIPProvisioningDocument::OpenFileL( TBool aDoOpen,
+    const TDesC& aFilename, RFs& aFs )
+	{
+	if ( aDoOpen )
+	    {
+        RFile file;
+        TInt error( file.Open( aFs, aFilename, EFileShareAny | EFileRead ) );
+        if ( error == KErrNone )
+            {
+            static_cast<CVoIPProvisioningAppUi*>(iAppUi)->HandleFileL( file );
+            }
+	    }
+	
+	return NULL;
+	}
+
+// ----------------------------------------------------------------------------
+// CVoIPProvisioningDocument::OpenFileL
+// ----------------------------------------------------------------------------
+void CVoIPProvisioningDocument::OpenFileL( CFileStore*& /*aFileStore*/,
+    RFile& aFile )
+	{
+	// Request appui to handle this file
+	static_cast<CVoIPProvisioningAppUi*>( iAppUi )->HandleFileL( aFile );
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/group/VoIPProvisioningApp.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project description file.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+
+ALWAYS_BUILD_AS_ARM
+
+TARGET         voipprovisioningapp.exe
+TARGETTYPE     exe
+UID            0x0 0x20026FE3
+TARGETPATH     PROGRAMS_DIR
+
+VENDORID       VID_DEFAULT
+CAPABILITY     CAP_APPLICATION PowerMgmt AllFiles -DRM
+
+SOURCEPATH     ../Src
+SOURCE         VoIPProvisioningApp.cpp 
+SOURCE         VoIPProvisioningAppUi.cpp
+SOURCE         VoIPProvisioningDocument.cpp
+
+START RESOURCE ../Data/VoIPProvisioningApp.rss
+HEADER
+TARGETPATH APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+START RESOURCE ../Data/VoIPProvisioningApp_reg.rss
+HEADER
+TARGETPATH     /private/10003a3f/apps
+END
+
+USERINCLUDE    . 
+USERINCLUDE    ../Inc
+USERINCLUDE    ../../voipxmlprocessor/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY        euser.lib 
+LIBRARY        apparc.lib 
+LIBRARY        cone.lib 
+LIBRARY        eikcore.lib 
+LIBRARY        avkon.lib
+LIBRARY        eiksrv.lib
+LIBRARY	       ws32.lib
+LIBRARY        apgrfx.lib
+LIBRARY        efsrv.lib 
+LIBRARY        bafl.lib
+LIBRARY	       voipxmlprocessor.lib
+LIBRARY        CommonEngine.lib // For StringLoader.
+LIBRARY        ecom.lib // For REComSession.
+LIBRARY        flogger.lib
+LIBRARY        xspviewservices.lib // For launching service tab.
+LIBRARY        DownloadMgr.lib
+LIBRARY        PlatformEnv.lib
+LIBRARY        ezip.lib
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningappui/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build description file.
+*
+*/
+
+
+PRJ_PLATFORMS
+WINSCW ARMV5
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+VoIPProvisioningApp.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/data/20026FE1.rss	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECom resource file.
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO r_registry
+    {
+    dll_uid = 0x20026FE1;     // dll uid
+                    
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = 0x101F7D87; // Const for all data recognizers
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x20026FE2; // implementation uid
+                    version_no = 1;
+                    display_name = "VoIP provisioning recognizer";
+                    default_data = "";  
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/group/VoIPProvisioningRecognizer.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project description file.
+*
+*/
+
+
+
+
+#include <platform_paths.hrh>
+
+//OPTION ARMCC --asm --interleave
+ALWAYS_BUILD_AS_ARM
+
+TARGET          voipprovrec.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x20026FE1
+
+CAPABILITY      CAP_ECOM_PLUGIN
+
+SOURCEPATH      ../data
+
+START RESOURCE  20026FE1.rss
+#ifdef SYMBIAN_SECURE_ECOM
+TARGET          voipprovrec.rsc
+#endif
+END
+
+VENDORID        VID_DEFAULT
+
+SOURCEPATH      ../src
+SOURCE          VoIPProvisioningRecognizer.cpp
+
+USERINCLUDE     ../inc
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         EUSER.LIB
+LIBRARY         APMIME.LIB
+
+// END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build description file.
+*
+*/
+
+
+PRJ_PLATFORMS
+WINSCW ARMV5
+
+PRJ_MMPFILES
+VoIPProvisioningRecognizer.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/inc/VoIPProvisioningRecognizer.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CVoIPProvisioningRecognizer definition.
+*
+*/
+
+
+#ifndef VOIPPROVISIONINGRECOGNIZER_H
+#define VOIPPROVISIONINGRECOGNIZER_H
+
+// INCLUDES
+#include <apmrec.h>
+
+// DEFINITIONS
+
+// Uid of this dll (defined in .mmp file)
+const TUid KUidMimeVoIPProvisioningRecognizer = { 0x20026FE1 };
+
+// Implementation uid for this recognizer
+const TInt KVoIPProvRecImplUIDValue = 0x20026FE2;
+const TUid KUidVoIPProvRecImpl = { KVoIPProvRecImplUIDValue };
+
+// Amount of mime types this recognizer can handle
+const TInt KVoIPSupportedMimeTypes( 2 );
+
+// Exported mime types
+_LIT8( KVoIPConfMimetypeSimple, "vnd.nokia.voip.config+xml" );
+_LIT8( KVoIPConfMimetypeApplication, "application/vnd.nokia.voip.config+xml" );
+
+// Strings to be searched to recognize content
+_LIT8( KVoIPXMLTag, "nokia-confdoc" );
+
+#ifdef _DEBUG
+#define EUNIT_TEST_FRIEND( x ) friend class x;
+#else
+#define EUNIT_TEST_FRIEND( x ) 
+#endif
+
+/**
+ *  Class to make recognisation for VoIP configuration XML file.
+ *  
+ *  @since S60 v5.0
+ *  @lib voipprovrec.lib
+ */
+class CVoIPProvisioningRecognizer : public CApaDataRecognizerType
+    {
+public:
+
+    /**
+     * Default constructor. Calls CApaDataRecognizerType in it's
+     * initializer list to complete construction.
+     */
+    CVoIPProvisioningRecognizer();
+
+    /**
+     * Static method to create instance of this recognizer.
+     * This method is called by the framework.
+     * Method pointer is delivered to the framework by ImplementationTable
+     * table returned by ImplementationGroupProxy.
+     *
+     * @since S60 v5.0
+     * @return Pointer to newly created instance of the recognizer.
+     */
+    static CApaDataRecognizerType* CreateRecognizerL();
+
+    /**
+     * Method called by the framework.
+     * This method returns the desired amount of data for recognition.
+     *
+     * @since S60 v5.0
+     * @return Preferred buffer size for recognition.
+     */
+    virtual TUint PreferredBufSize();
+
+    /**
+     * Method to deliver supported data types by this recognizer.
+     *
+     * @since S60 v5.0
+     * @param aIndex Index pointing out which data type of the supported
+     *               ones is returned.
+     * @return Corresponding data type of the requested index.
+     */
+    virtual TDataType SupportedDataTypeL( TInt aIndex ) const;
+
+private: // From CApaDataRecognizerType
+
+    /**
+     * Overwritten method to handle recognisation.
+     *
+     * @since S60 v5.0
+     * @param aName The name of the data; typically this is a file name
+     *              containing the data to be recognized.
+     * @param aBuffer Buffer containing PreferredBufSize() from 
+     *                the beginning of the file to be recognized.
+     */
+    virtual void DoRecognizeL( const TDesC& /*aName*/, const TDesC8& aBuffer );
+    
+    EUNIT_TEST_FRIEND( UT_CVoIPProvisioningRecognizer )
+    };
+
+#endif // VOIPPROVISIONINGRECOGNIZER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/provisioningrecognizer/src/VoIPProvisioningRecognizer.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CVoIPProvisioningRecognizer implementation.
+*
+*/
+
+
+#include "VoIPProvisioningRecognizer.h"
+#include "ecom/implementationproxy.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------
+// CVoIPProvisioningRecognizer::CVoIPProvisioningRecognizer
+// Default constructor
+// ---------------------------------------------------------
+//
+CVoIPProvisioningRecognizer::CVoIPProvisioningRecognizer() :
+    CApaDataRecognizerType( KUidMimeVoIPProvisioningRecognizer,
+    CApaDataRecognizerType::EHigh )
+    {
+    iCountDataTypes = KVoIPSupportedMimeTypes;
+    }
+
+// ---------------------------------------------------------
+// CVoIPProvisioningRecognizer::PreferredBufSize
+// Overwritten method from CApaDataRecognizerType
+// ---------------------------------------------------------
+//
+TUint CVoIPProvisioningRecognizer::PreferredBufSize()
+    {
+    return 0x200;
+    }
+
+// ---------------------------------------------------------
+// CVoIPProvisioningRecognizer::SupportedDataTypeL
+// Overwritten method from CApaDataRecognizerType
+// ---------------------------------------------------------
+//
+TDataType CVoIPProvisioningRecognizer::SupportedDataTypeL( TInt aIndex ) const
+    {
+    __ASSERT_DEBUG( aIndex >= 0 &&
+        aIndex < KVoIPSupportedMimeTypes, User::Leave( KErrArgument ) );
+
+    switch( aIndex )
+        {
+        case 0:
+            {
+            TDataType type( KVoIPConfMimetypeSimple );
+            return type;
+            }
+        case 1:
+            {
+            TDataType type( KVoIPConfMimetypeApplication );
+            return type;
+            }            
+        default:
+            break;
+        }
+
+    return TDataType();
+    }
+
+// ---------------------------------------------------------------------------
+// CVoIPProvisioningRecognizer::DoRecognizeL
+// Overwritten method from CApaDataRecognizerType
+// ---------------------------------------------------------------------------
+//
+void CVoIPProvisioningRecognizer::DoRecognizeL( const TDesC& /*aName*/,
+    const TDesC8& aBuffer )
+    {
+    iConfidence = ENotRecognized;
+    iDataType = TDataType();
+    if ( aBuffer.FindF( KVoIPXMLTag ) != KErrNotFound )
+        {
+        iConfidence = ECertain;
+        iDataType = TDataType( KVoIPConfMimetypeApplication );
+        }
+    }
+
+// ---------------------------------------------------------
+// CVoIPProvisioningRecognizer::CreateRecognizerL
+// Static method to create instance of CVoIPProvisioningRecognizer
+// ---------------------------------------------------------
+//
+CApaDataRecognizerType* CVoIPProvisioningRecognizer::CreateRecognizerL()
+    {
+    return new (ELeave) CVoIPProvisioningRecognizer();
+    }
+
+// ---------------------------------------------------------
+// ImplementationTable
+// Table containing the data concerning CVoIPProvisioningRecognizer 
+// ---------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KVoIPProvRecImplUIDValue,
+        CVoIPProvisioningRecognizer::CreateRecognizerL )
+    };
+
+// ---------------------------------------------------------
+// ImplementationGroupProxy
+// Function called by framework to return data about this recognizer
+// ---------------------------------------------------------
+//
+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/voipplugins/voipadapters/voipxmlprovisioning/rom/voipxmlprovisioning.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*       IBY file for voipxmlprovisioning
+*
+*
+*/
+
+#ifndef VOIPXMLPROVISIONING_IBY
+#define VOIPXMLPROVISIONING_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+    file=ABI_DIR/BUILD_DIR/voipxmlprocessor.dll SHARED_LIB_DIR/voipxmlprocessor.dll
+
+    ECOM_PLUGIN( voipprovrec.dll, 20026FE1.rsc )
+
+    S60_APP_EXE(voipprovisioningapp)
+    S60_UPGRADABLE_APP_REG_RSC(voipprovisioningapp)
+
+#endif // VOIPXMLPROVISIONING_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/rom/voipxmlprovisioningresources.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*       IBY file for voipxmlprovisioning
+*
+*
+*/
+
+#ifndef VOIPXMLPROVISIONINGRESOURCES_IBY
+#define VOIPXMLPROVISIONINGRESOURCES_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+    S60_APP_RESOURCE(VoIPProvisioningApp)
+//    S60_APP_CAPTION(VoIPProvisioningApp)
+
+#endif // VOIPXMLPROVISIONINGRESOURCES_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/EABI/voipxmlprocessoru.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,18 @@
+EXPORTS
+	_ZN14CVoipXmlParser14ImportDocumentER5RFileRm @ 1 NONAME
+	_ZN14CVoipXmlParser17ReadDescriptionLCER5RFileR5TDes8 @ 2 NONAME
+	_ZN14CVoipXmlParser4NewLEv @ 3 NONAME
+	_ZN14CVoipXmlParser5NewLCEv @ 4 NONAME
+	_ZTI18CVoipXmlIapHandler @ 5 NONAME ; #<TI>#
+	_ZTI18CVoipXmlSipHandler @ 6 NONAME ; #<TI>#
+	_ZTI18CVoipXmlXdmHandler @ 7 NONAME ; #<TI>#
+	_ZTI19CVoipXmlVoipHandler @ 8 NONAME ; #<TI>#
+	_ZTI20CVoipXmlNatFwHandler @ 9 NONAME ; #<TI>#
+	_ZTI23CVoipXmlPresenceHandler @ 10 NONAME ; #<TI>#
+	_ZTV18CVoipXmlIapHandler @ 11 NONAME ; #<VT>#
+	_ZTV18CVoipXmlSipHandler @ 12 NONAME ; #<VT>#
+	_ZTV18CVoipXmlXdmHandler @ 13 NONAME ; #<VT>#
+	_ZTV19CVoipXmlVoipHandler @ 14 NONAME ; #<VT>#
+	_ZTV20CVoipXmlNatFwHandler @ 15 NONAME ; #<VT>#
+	_ZTV23CVoipXmlPresenceHandler @ 16 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/bwins/voipxmlprocessoru.def	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,8 @@
+EXPORTS
+	?GetBrandingData@CVoipXmlParser@@QAEXAAVTDes8@@0@Z @ 1 NONAME ABSENT ; void CVoipXmlParser::GetBrandingData(class TDes8 &, class TDes8 &)
+	?ImportDocument@CVoipXmlParser@@QAEHAAVRFile@@AAK@Z @ 2 NONAME ; int CVoipXmlParser::ImportDocument(class RFile &, unsigned long &)
+	?NewL@CVoipXmlParser@@SAPAV1@XZ @ 3 NONAME ; class CVoipXmlParser * CVoipXmlParser::NewL(void)
+	?NewLC@CVoipXmlParser@@SAPAV1@XZ @ 4 NONAME ; class CVoipXmlParser * CVoipXmlParser::NewLC(void)
+	?ReadDescriptionLC@CVoipXmlParser@@QAEPAVHBufC16@@AAVRFile@@@Z @ 5 NONAME ABSENT ; class HBufC16 * CVoipXmlParser::ReadDescriptionLC(class RFile &)
+	?ReadDescriptionLC@CVoipXmlParser@@QAEPAVHBufC16@@AAVRFile@@AAVTDes8@@@Z @ 6 NONAME ; class HBufC16 * CVoipXmlParser::ReadDescriptionLC(class RFile &, class TDes8 &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/group/bld.inf	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build info file for VoIP XML processor
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+    ./voipxmlprocessor.mmp
+
+PRJ_TESTMMPFILES
+//    ../internal/test/group/UT_voipxmlprocessor.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/group/voipxmlprocessor.mmp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project VoIP XML processor.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+ALWAYS_BUILD_AS_ARM
+
+TARGET        voipxmlprocessor.dll
+TARGETTYPE    dll
+UID           0x1000008d 0x20026FE4
+
+CAPABILITY    CAP_GENERAL_DLL
+VENDORID      VID_DEFAULT
+
+LANGUAGE_IDS
+
+SOURCEPATH    ../src
+SOURCE        voipxmlutils.cpp
+SOURCE        voipxmlparser.cpp
+SOURCE        voipxmlparamhandler.cpp
+SOURCE        voipxmlsiphandler.cpp
+SOURCE        voipxmlvoiphandler.cpp
+SOURCE        voipxmlxdmhandler.cpp
+SOURCE        voipxmlpresencehandler.cpp
+SOURCE        voipxmlnatfwhandler.cpp
+SOURCE        voipxmliaphandler.cpp
+
+USERINCLUDE   ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE /sf/app/iptelephony/inc
+
+
+LIBRARY       euser.lib
+LIBRARY       efsrv.lib
+LIBRARY       xmlparser.lib
+LIBRARY       xmldom.lib
+LIBRARY       sipprofilecli.lib
+LIBRARY       inetprotutil.lib
+LIBRARY       rcse.lib
+LIBRARY       serviceprovidersettings.lib
+LIBRARY       ipapputils.lib
+LIBRARY       bafl.lib
+LIBRARY       vimpstsettings.lib // For setting IM tone.
+LIBRARY       PlatformEnv.lib // For getting rom digital tone path.
+LIBRARY       XdmSettingsApi.lib
+LIBRARY       presencesettingsapi.lib
+LIBRARY       centralrepository.lib
+LIBRARY       cmmanager.lib
+LIBRARY       WEPSecuritySettingsUi.lib
+LIBRARY       WPASecuritySettingsUi.lib
+LIBRARY       commsdat.lib
+LIBRARY       ecom.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmliaphandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,237 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IAP handler for VoIP XML processor
+*
+*/
+
+
+#ifndef  VOIPXMLIAPHANDLER_H
+#define  VOIPXMLIAPHANDLER_H
+
+#include "voipxmlprocessordefaults.h"
+
+class RCmManagerExt;
+
+const TUint8 KEapLeapId[] = { 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11 };
+const TInt KEapChars = 8;
+
+class TWepKey
+    {
+public:
+    /**
+     * ETrue if hexadecimal, EFalse if ASCII.
+     */
+    TBool iHex;
+    /**
+     * WEP key length.
+     */
+    TInt iLength;
+    /**
+     * WEP key data.
+     */
+    TBuf<KMaxWepKeyDataLength> iData;
+    };
+
+struct TTemporaryIap
+    {
+    /**
+     * Name of the IAP.
+     */
+    HBufC* iName;
+    /**
+     * SSID of the IAP.
+     */
+    HBufC* iSsid;
+    /**
+     * Tells if the SSID is hidden or not.
+     */
+    TBool iHidden;
+    /**
+     * Network mode.
+     */
+    TInt iNetworkMode;
+    /**
+     * Network type.
+     */
+    TInt iSecurityType;
+    /**
+     * Pre-shared key.
+     */
+    HBufC* iPreSharedKey;
+    /**
+     * WEP authentication mode.
+     */
+    TInt iWepAuthMode;
+    /**
+     * Current WEP key.
+     */
+    TWepKey iCurrentWepKey;
+    /**
+     * Array of WEP keys.
+     */
+    RArray<TWepKey> iWepKeys;
+    /**
+     * EAP type.
+     */
+    TInt iEapType;
+    /**
+     * EAP username.
+     */
+    HBufC* iEapUsername;
+    /**
+     * EAP password.
+     */
+    HBufC* iEapPassword;
+    };
+
+/**
+*  VoipXmlIapHandler
+*  IAP handler class.
+* 
+*  @lib voipxmlprocessor.lib
+*  @since S60 v5.0
+*/
+class CVoipXmlIapHandler : public CBase
+    {
+#ifdef _DEBUG
+    friend class UT_CVoipXmlIapHandler;
+    friend class UT_CVoipXmlParamHandler;
+#endif
+
+public:
+
+    static CVoipXmlIapHandler* NewL();
+    ~CVoipXmlIapHandler();
+
+public:
+
+    /**
+     * Sets IAP setting.
+     *
+     * @since S60 v5.0
+     * @param aType Type of settings.
+     * @param aParam Parameter to be set.
+     * @param aValue Value of the setting.
+     */
+    void SetSetting( TInt aType, TInt aParam, const TDesC& aValue );
+
+    /**
+     * Stores settings to 'XDM registry', i.e. creates an XDM collection.
+     *
+     * @since S60 v5.0
+     * @return KErrNone if successful,
+     *         KErrNotSupported if no settings to be stored,
+     *         KErrCompletion if settings could not be stored.
+     */
+    TInt StoreSettings();
+
+    /**
+     * Returns destination ID.
+     *
+     * @since S60 v5.0
+     * @return Destination ID.
+     */
+    TUint32 SettingsId();
+
+    /**
+     * Method to inform the handler that currently deployed settings
+     * have ended. This way we will know when an IAP is ready to be
+     * appended to iIaps array, or when a WEP key is ready to appended
+     * to iWepKeys array.
+     *
+     * @since S60 v5.0
+     * @param aType Type of settings.
+     */
+    void SettingsEnd( TInt aType );
+
+private:
+
+    /**
+     * Resets iCurrentIap settings, i.e. deletes its member data.
+     *
+     * @since S60 v5.0
+     * @param aCloseArray Tells if array inside iCurrentIap is to be closed.
+     */
+    void ResetCurrentIap( TBool aCloseArray = EFalse );
+
+    /**
+     * Resets iIaps array, i.e. deletes its items member data.
+     *
+     * @since S60 v5.0
+     * @param aCloseArray Tells if arrays inside iIaps' 
+     *                    members are to be closed.
+     */
+    void ResetTempIapArray( TBool aCloseArray = EFalse );
+
+    /**
+     * Adds current IAP settings to iIaps array.
+     *
+     * @since S60 v5.0
+     */
+    void AddCurrentIapL();
+
+    /**
+     * Stores settings.
+     *
+     * @since S60 v5.0
+     */
+    void StoreSettingsL();
+
+    /**
+     * Creates an access point.
+     * 
+     * @since S60 v5.0
+     * @param aCmManager CMManager reference.
+     * @param aTempIap TTemporaryIap from which actual IAP will be created.
+     * @return IAP ID.
+     */
+    TUint32 CreateIapL( RCmManagerExt& aCmManager, TTemporaryIap aTempIap );
+private:
+
+    CVoipXmlIapHandler();
+    void ConstructL();
+
+private:
+
+    /**
+     * Tells if any settings have been set to temporary profile.
+     */
+    TBool iSettingsSet;
+
+    /**
+     * Name of destination. If this is empty when saving settings,
+     * destination will not be created.
+     * Own.
+     */
+    HBufC* iDestinationName;
+
+    /**
+     * ID of destination.
+     */
+    TUint32 iDestinationId;
+
+    /**
+     * Access point that is being currently handled.
+     */
+    TTemporaryIap iCurrentIap;
+
+    /**
+     * Array for temporary IAP's.
+     */
+    RPointerArray<TTemporaryIap> iIaps;
+    };
+
+#endif // VOIPXMLIAPHANDLER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlnatfwhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  NAT/Firewall handler for VoIP XML processor
+*
+*/
+
+
+#ifndef  VOIPXMLNATFWHANDLER_H
+#define  VOIPXMLNATFWHANDLER_H
+
+#include "voipxmlprocessordefaults.h"
+
+struct TAdditionalStun
+    {
+//public:
+
+    /**
+     * STUN server address.
+     */
+    TBuf8<KMaxNodeValueLength> iStunSrvAddr;
+
+    /**
+     * STUN server port.
+     */
+    TInt iStunSrvPort;
+
+    /**
+     * STUN server username.
+     */
+    TBuf8<KMaxNodeValueLength> iStunSrvUsername;
+
+    /**
+     * STUN server password.
+     */
+    TBuf8<KMaxNodeValueLength> iStunSrvPassword;
+    };
+
+/**
+*  VoipXmlNatFwHandler
+*  NAT/Framwrork handler class.
+* 
+*  @lib voipxmlprocessor.lib
+*  @since S60 v5.0
+*/
+class CVoipXmlNatFwHandler : public CBase
+    {
+#ifdef _DEBUG
+    friend class UT_CVoipXmlNatFwHandler;
+    friend class UT_CVoipXmlParamHandler;
+#endif
+
+public:
+
+    static CVoipXmlNatFwHandler* NewL();
+    ~CVoipXmlNatFwHandler();
+
+public:
+
+    /**
+     * Sets NAT/Firewall setting.
+     *
+     * @since S60 v5.0
+     * @param aParam Parameter to be set.
+     * @param aValue Value of the setting.
+     */
+    void SetSetting( TInt aType, TInt aParam, const TDesC8& aValue );
+
+    /**
+     * Stores settings to Central Repository (actually calls StoreSettingsL).
+     *
+     * @since S60 v5.0
+     * @return KErrNone if successful,
+     *         KErrNotSupported if no settings to be stored,
+     *         KErrCompletion if settings could not be stored.
+     */
+    TInt StoreSettings();
+
+    /**
+     * Method to inform the handler that currently deployed settings
+     * have ended. This way we will know when iCurrentAdditionalStunServer
+     * server should be appended to iAdditionalStunServers array.
+     *
+     * @since S60 v5.0
+     * @param aType Type of settings.
+     */
+    void SettingsEnd( TInt aType );
+
+private:
+
+    /**
+     * Commits actual Central Repository storage.
+     *
+     * @since S60 v5.0
+     */
+    void StoreSettingsL();
+
+private:
+
+    CVoipXmlNatFwHandler();
+    void ConstructL();
+
+private:
+
+    /**
+     * Tells if any settings have been set to internal members.
+     */
+    TBool iSettingsSet;
+
+    /**
+     * Domain name.
+     * Own.
+     */
+    HBufC8* iDomain;
+
+    /**
+     * STUN server address.
+     * Own.
+     */
+    HBufC8* iStunSrvAddr;
+
+    /**
+     * STUN server port.
+     */
+    TInt iStunSrvPort;
+
+    /**
+     * TCP refresh interval.
+     */
+    TInt iTcpRefreshInterval;
+
+    /**
+     * UDP refresh interval.
+     */
+    TInt iUdpRefreshInterval;
+
+    /**
+     * CRLF refresh.
+     */
+    TInt iCrlfRefresh;
+
+    /**
+     * STUN server username.
+     * Own.
+     */
+    HBufC8* iStunSrvUsername;
+
+    /**
+     * STUN server password.
+     * Own.
+     */
+    HBufC8* iStunSrvPassword;
+
+    /**
+     * STUN shared secret.
+     */
+    TInt iStunSharedSecret;
+
+    /**
+     * Start port of STUN port range.
+     */
+    TInt iStartPortRange;
+
+    /**
+     * End port of STUN port range.
+     */
+    TInt iEndPortRange;
+
+    /**
+     * NAT protocol
+     * Own.
+     */
+    HBufC8* iNatProtocol;
+
+    /**
+     * Additional STUN server data that is being currently modified.
+     * After modifications are done, it is appended to iAdditionalStunServers.
+     */
+    TAdditionalStun iCurrentAdditionalStunServer;
+
+    /**
+     * Array for holding additional STUN server data.
+     */
+    RPointerArray<TAdditionalStun> iAdditionalStunServers;
+    };
+
+#endif // VOIPXMLNATFWHANDLER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlparamhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class definition of VoIP XML parameter handler.
+*
+*/
+
+
+#ifndef VOIPXMLPARAMHANDLER_H
+#define VOIPXMLPARAMHANDLER_H
+
+#include <e32base.h>
+
+class CVoipXmlSipHandler;
+class CVoipXmlVoipHandler;
+class CVoipXmlXdmHandler;
+class CVoipXmlPresenceHandler;
+class CVoipXmlNatFwHandler;
+class CVoipXmlIapHandler;
+
+/**
+*  CVoipXmlParamHandler 
+*  Handles parameters and passes them to settings handlers.
+* 
+*  @lib voipxmlprocessor.lib
+*  @since S60 v5.0
+*/
+NONSHARABLE_CLASS( CVoipXmlParamHandler ) : public CBase
+    {
+#ifdef _DEBUG
+    friend class UT_CVoipXmlParamHandler;
+    friend class UT_CVoipXmlParser;
+#endif
+
+public:
+
+    static CVoipXmlParamHandler* NewL();
+    
+    static CVoipXmlParamHandler* NewLC(); 
+
+    virtual ~CVoipXmlParamHandler();
+
+    /**
+     * Marks what type of settings are to be deployed.
+     * 
+     * @since S60 v5.0
+     * @param aType Type of settings that are to be deployed.
+     */
+    void SettingsStart( const TDesC& aType );
+
+    /**
+     * Tells that settings are deployed and previous type should be used. 
+     */
+    void SettingsEnd();
+
+    /**
+     * Handles XML parameters and passes the handled
+     * ones to settings handlers.
+     * 
+     * @since S60 v5.0
+     * @param aParam Parameter name.
+     * @param avalue Parameter value.
+     */
+    void HandleParameter( const TDesC& aParam, const TDesC& aValue );
+
+    /**
+     * Stores transiently saved settings.
+     *
+     * @since S60 v5.0
+     * @return KErrNone if successful,
+     *         KErrNotSupported if no SIP or VoIP settings to be stored,
+     *         KErrCompletion if error occurred in storing settings.
+     */
+    TInt StoreSettings();
+
+    /**
+     * Returns the service tab ID.
+     * 
+     * @since S60 v5.0
+     * @return Service tab ID.
+     */
+    TUint32 ServiceTabId();
+
+private:
+
+    /**
+     * Converts parameter name to enumerated one.
+     *
+     * @since S60 v5.0
+     * @param aParam Parameter name.
+     * @return Enumerated parameter value.
+     */
+    TInt ConvertParameter( const TDesC& aParam );
+
+private:
+
+    CVoipXmlParamHandler();
+
+    void ConstructL();
+
+    
+private: // data
+
+    /**
+     * Type of settings that are currently being deployed.
+     */
+    TInt iSettingsType;
+
+    /**
+     * Type of previously deployed settings.
+     */
+    TInt iPreviousSettingsType;
+
+    /**
+     * SIP settings handler.
+     * Own.
+     */
+    CVoipXmlSipHandler* iSipHandler;
+
+    /**
+     * VoIP settings handler.
+     * Own.
+     */
+    CVoipXmlVoipHandler* iVoipHandler;
+
+    /**
+     * XDM settings handler.
+     * Own.
+     */
+    CVoipXmlXdmHandler* iXdmHandler;
+
+    /**
+     * Presence settings handler.
+     * Own.
+     */
+    CVoipXmlPresenceHandler* iPresenceHandler;
+
+    /**
+     * NAT/Firewall settings handler.
+     * Own.
+     */
+    CVoipXmlNatFwHandler* iNatFwHandler;
+
+    /**
+     * Internet Access Point settings handler.
+     * Own.
+     */
+    CVoipXmlIapHandler* iIapHandler;
+    };
+
+#endif // VOIPXMLPARAMHANDLER_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlparser.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  VoIP settings XML parser
+*
+*/
+
+
+#ifndef VOIPXMLPARSER_H
+#define VOIPXMLPARSER_H
+
+#include <gmxmlparser.h>
+#include <gmxmlelement.h>
+#include <gmxmlnode.h>
+
+#include "voipxmlparamhandler.h"
+
+class CVoipXmlParamHandler;
+
+/**
+ *  VoIP settings XML parser.
+ *  Parses an XML file and passes the parameters to XML parameter handler.
+ *
+ *  @code
+ *    CVoIPXmlParser* parser = CVoIPXmlParser::NewLC();
+ *    TFileName myfile( PathInfo::PhoneMemoryRootPath() );
+ *    _LIT( KXmlFilePath, "testsettings.xml" );
+ *    myfile.Append( KXmlFilePath );
+ *    TUint32 serviceTabId;
+ *    TInt err = parser->ImportDocument( myfile, serviceTabId );
+ *    CleanupStack::PopAndDestroy( parser );
+ *  @endcode
+ *
+ *  @lib voipxmlprocessor.lib
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CVoipXmlParser ) : public CBase, 
+                                      public MMDXMLParserObserver
+    {
+#ifdef _DEBUG
+    friend class UT_CVoipXmlParser;
+#endif
+
+public:
+
+    IMPORT_C static CVoipXmlParser* NewL();
+    IMPORT_C static CVoipXmlParser* NewLC();
+    virtual ~CVoipXmlParser();
+
+    /**
+     * Method for importing XML and saving settings.
+     *
+     * @since S60 v5.0
+     * @param aFile File handle to XML file. Ownsership is taken and moved
+     *              to CMDXMLParser object.
+     * @param aServiceTabId Service tab ID of the created service.
+     * @return KErrEof if no <nokia-provdoc> found in XML file,
+     *         KErrCorrupt if XML file is corrupted,
+     *         KErrAbort if no <settings type=""> found in XML file,
+     *         KErrBadHandle if unrecognized node types found in XML file,
+     *         KErrNotSupported if no SIP or VoIP settings found,
+     *         KErrCompletion if error in storing the settings.
+     */
+    IMPORT_C TInt ImportDocument( RFile& aFile, TUint32& aServiceTabId );
+
+    /**
+     * Reads description from inside <nokia-provdescription> tags
+     * and returns it in HBufC object which has been pushed into cleanup
+     * stack. Also reads branding URL from XML file and sets it into argument.
+     *
+     * @since S60 v5.0
+     * @param aFile File handle to XML file. Ownsership is taken and moved
+     *              to CMDXMLParser object.
+     * @param aBrandUrl Branding URL.
+     * @return Descriptor object containing the description.
+     */
+    IMPORT_C HBufC* ReadDescriptionLC( RFile& aFile, TDes8& aBrandUrl );
+
+private:
+
+    /**
+     * For parsing nokia-provdescription node.
+     *
+     * @since S60 v5.0
+     * @param aXmlElement XML element to be parsed.
+     */
+    void ParseDescription( CMDXMLElement& aXmlElement );
+
+    /**
+     * For parsing root node.
+     *
+     * @since S60 v5.0
+     * @param aXmlElement XML element to be parsed.
+     */
+    void ParseRoot( CMDXMLElement& aXmlElement );
+
+    /**
+     * For parsing settings node.
+     *
+     * @since S60 v5.0
+     * @param aXmlElement XML element to be parsed.
+     */
+    void ParseSettings( CMDXMLNode* aXmlNode );
+
+protected:
+
+// From base class MMDXMLParserObserver.
+
+    /**
+     * From base class MMDXMLParserObserver.
+     * Call back function used to inform a client of the Parser when a
+     * parsing operation completes.
+     * @since S60 v5.0
+     */
+    void ParseFileCompleteL();
+
+private:
+
+    CVoipXmlParser();
+
+    void ConstructL();
+
+private: // data
+
+    /**
+     * XML parser object.
+     * Own.
+     */
+    CMDXMLParser* iParser;
+
+    /**
+     * XML document.
+     * Own.
+     */
+    CMDXMLDocument* iXmlDoc;
+
+    /**
+     * XML parameter handler.
+     * Own.
+     */
+    CVoipXmlParamHandler* iParamHandler;
+
+    /**
+     * Error code to be returned in ImportDocument.
+     */
+    TInt iError;
+
+    /**
+     * Flag for telling if we are to only read
+     * <nokia-provdescription> contents from the XML document.
+     */
+    TBool iParseDescription;
+
+    /**
+     * Object for holding description read from <nokia-provdescription>.
+     * Own.
+     */
+    HBufC* iDescription;
+
+    /**
+     * Object for holding branding URL read from <nokia-provbrandurl>.
+     * Own.
+     */
+    HBufC* iBrandUrl;
+    };
+
+#endif // VOIPXMLPARSER_H
+
+// End of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlpresencehandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Presence handler for VoIP XML processor
+*
+*/
+
+
+#ifndef  VOIPXMLPRESENCEHANDLER_H
+#define  VOIPXMLPRESENCEHANDLER_H
+
+#include <pressettingsset.h>
+
+class TPresSettingsSet;
+
+/**
+*  VoipXmlPresenceHandler
+*  Presence handler class.
+* 
+*  @lib voipxmlprocessor.lib
+*  @since S60 v5.0
+*/
+class CVoipXmlPresenceHandler : public CBase
+    {
+#ifdef _DEBUG
+    friend class UT_CVoipXmlPresenceHandler;
+    friend class UT_CVoipXmlParamHandler;
+#endif
+
+public:
+
+    static CVoipXmlPresenceHandler* NewL();
+    ~CVoipXmlPresenceHandler();
+
+public:
+
+    /**
+     * Sets XDM setting.
+     *
+     * @since S60 v5.0
+     * @param aParam Parameter to be set.
+     * @param aValue Value of the setting.
+     */
+    void SetSetting( TInt aParam, const TDesC& aValue );
+
+    /**
+     * Stores settings to 'XDM registry', i.e. creates an XDM collection.
+     *
+     * @since S60 v5.0
+     * @return KErrNone if successful,
+     *         KErrNotSupported if no settings to be stored,
+     *         KErrCompletion if settings could not be stored.
+     */
+    TInt StoreSettings();
+
+    /**
+     * Returns the settings ID.
+     *
+     * @since S60 v5.0
+     * @return XDM settings ID.
+     */
+    TUint32 SettingsId();
+
+    /**
+     * Gives linkage information.
+     *
+     * @since S60 v5.0
+     * @param aType Type of settings.
+     * @param aSettingsId Settings ID.
+     */
+    void LinkSettings( TInt aType, TUint32 aSettingsId );
+
+    /**
+     * Finalizes settings, i.e. stores the profile with linkage information.
+     *
+     * @since S60 v5.0
+     * @return KErrNone if successful,
+     *         KErrGeneral if settings could not be finalized.
+     */
+    TInt FinalizeSettings();
+
+private:
+
+    /**
+     * Creates a provider name for Presence profile. aName is used
+     * and replaced with a parenthised ordered number if the name is
+     * already found in Presence storage. 
+     *
+     * @since S60 v5.0
+     * @param aName Provider name to be set.
+     */
+    void CreateProviderNameL( TDes& aName );
+
+private:
+
+    CVoipXmlPresenceHandler();
+    void ConstructL();
+
+private:
+
+    /**
+     * XDM settings collection object.
+     * Own.
+     */
+    TPresSettingsSet iProfile;
+
+    /**
+     * Tells if any settings have been set to temporary profile.
+     */
+    TBool iSettingsSet;
+
+    /**
+     * XDM collection ID.
+     */
+    TUint32 iProfileId;
+    };
+
+#endif // VOIPXMLPRESENCEHANDLER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlprocessordefaults.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,332 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Holds default values for VoIP XML Processor.
+*
+*/
+
+
+#ifndef VOIPXMLPROCESSORDEFAULTS_H
+#define VOIPXMLPROCESSORDEFAULTS_H
+
+#include <e32base.h>
+
+// ==============================
+// XML constants
+// ==============================
+//
+// Node names.
+_LIT( KNodeNokiaConfDoc,                  "nokia-confdoc" );
+_LIT( KNodeConfDescription,               "confdescription" );
+_LIT( KNodeConfBrandUrl,                  "confbrandurl" );
+_LIT( KNodeSettings,                      "settings" );
+_LIT( KNodeParam,                         "param" );
+// Node attributes.
+_LIT( KAttributeType,                     "type" );
+_LIT( KAttributeName,                     "name" );
+_LIT( KAttributeValue,                    "value" );
+// Setting types (i.e. supported values for 'type' attribute).
+_LIT( KSettingsTypeVoip,                  "voip" );
+_LIT( KSettingsTypeSip,                   "sip" );
+_LIT( KSettingsTypePresence,              "presence" );
+_LIT( KSettingsTypeXdm,                   "xdm" );
+_LIT( KSettingsTypeNatFw,                 "natfw" );
+_LIT( KSettingsTypeWlan,                  "wlan" );
+_LIT( KSettingsTypeCodec,                 "codec" );
+_LIT( KSettingsTypeVmbx,                  "voicemailbox" );
+_LIT( KSettingsTypeProxy,                 "proxy" );
+_LIT( KSettingsTypeRegistrar,             "registrar" );
+_LIT( KSettingsTypeAdditionalStun,        "additionalstun" );
+_LIT( KSettingsTypeWepKey,                "wepkey" );
+_LIT( KSettingsTypeDestination,           "destination" );
+_LIT( KSettingsTypeEap,                   "eap" );
+// Parameter names (i.e. supported values for 'value' attribute).
+// Generic.
+_LIT( KParamValueName,                    "name" );
+_LIT( KParamValueUri,                     "uri" );
+_LIT( KParamValueTransport,               "transport" );
+_LIT( KParamValuePort,                    "port" );
+_LIT( KParamValueUsername,                "username" );
+_LIT( KParamValuePassword,                "password" );
+_LIT( KParamValueType,                    "type" );
+_LIT( KParamValueDomain,                  "domain" );
+_LIT( KParamValueStartPort,               "startport" );
+_LIT( KParamValueEndPort,                 "endport" );
+// VoIP specific.
+_LIT( KParamValueMediaQos,                "mediaqos" );
+_LIT( KParamValueDtmfInband,              "dtmfinband" );
+_LIT( KParamValueDtmfOutband,             "dtmfoutband" );
+_LIT( KParamValueSecureCallPref,          "securecallpreference" );
+_LIT( KParamValueVoipOverWcdma,           "allowvoipoverwcdma" );
+_LIT( KParamValueRtcp,                    "rtcp" );
+_LIT( KParamValueUserAgentTerminalType,   "useragentterminaltype" );
+_LIT( KParamValueUserAgentWlanMac,        "useragentwlanmac" );
+_LIT( KParamValueUserAgentFreeString,     "useragentfreestring" );
+_LIT( KParamValueCallerIdDigits,          "calleriddigits" );
+_LIT( KParamValueIgnoreDomainPart,        "ignoredomainpart" );
+_LIT( KParamValueAutoAcceptBuddyRequests, "autoacceptbuddyrequests" );
+_LIT( KParamValueAddUserPhone,            "adduserphone" );
+_LIT( KParamValueProviderUrl,             "providerurl" );
+_LIT( KParamValueMinSessionInterval,      "minsessioninterval" );
+_LIT( KParamValueSessionInterval,         "sessioninterval" );
+_LIT( KParamValueBrandingUri,             "brandinguri" );
+_LIT( KParamValueAutoEnable,              "autoenable" );
+_LIT( KParamValueEnableSipIm,             "enablesipim" );
+_LIT( KParamValueBrandId,                 "brandid" );
+_LIT( KParamValueDefault,                 "default" );
+// Voice mailbox specific.
+_LIT( KParamValueMwiUri,                  "mwiuri" );
+_LIT( KParamValueListeningUri,            "listeninguri" );
+_LIT( KParamValueReSubscribeInterval,     "resubscribeinterval" );
+// Codec specific
+_LIT( KParamValueJitterBuffer,            "jitterbuffer" );
+_LIT( KParamValueOctetAlign,              "octetalign" );
+_LIT( KParamValuePTime,                   "ptime" );
+_LIT( KParamValueMaxPTime,                "maxptime" );
+_LIT( KParamValueModeSet,                 "modeset" );
+_LIT( KParamValueModeChangePeriod,        "modechangeperiod" );
+_LIT( KParamValueModeChangeNeighbor,      "modechangeneighbor" );
+_LIT( KParamValueMaxRed,                  "maxred" );
+_LIT( KParamValueVad,                     "vad" );
+_LIT( KParamValueAnnexB,                  "annexb" );
+// SIP specific
+_LIT( KParamValueSignalingQos,            "signalingqos" );
+_LIT( KParamValuePublicUserId,            "publicuserid" );
+_LIT( KParamValueSignalCompression,       "signalcompression" );
+_LIT( KParamValueSecurityNegotiation,     "securitynegotiation" );
+_LIT( KParamValueProfileLock,             "profilelock" );
+_LIT( KParamValueAutoRegistration,        "autoregistration" );
+// Proxy
+_LIT( KParamValueLooseRouting,            "looserouting" );
+// Presence specific
+_LIT( KParamValueMaxObjectSize,           "maxobjectsize" );
+_LIT( KParamValuePublishInterval,         "publishinterval" );
+_LIT( KParamValueMaxSubscriptions,        "maxsubscriptions" );
+_LIT( KParamValueMaxContacts,             "maxcontacts" );
+_LIT( KParamValueDomainSyntax,            "domainsyntax" );
+// NAT/FW sepcific
+_LIT( KParamValueTcpRefreshInterval,      "tcprefreshinterval" );
+_LIT( KParamValueUdpRefreshInterval,      "udprefreshinterval" );
+_LIT( KParamValueCrlfRefresh,             "crlfrefresh" );
+_LIT( KParamValueStunSharedSecret,        "stunsharedsecret" );
+// Access point specific
+_LIT( KParamSsid,                         "ssid" );
+_LIT( KParamHidden,                       "hidden" );
+_LIT( KParamNetworkMode,                  "networkmode" );
+_LIT( KParamPreSharedKey,                 "presharedkey" );
+_LIT( KParamWepAuthMode,                  "wepauthmode" );
+// WEP
+_LIT( KParamLength,                       "length" );
+_LIT( KParamData,                         "data" );
+
+// Other.
+const TInt KMaxNodeNameLength          = 32;
+const TInt KMaxDestinationNameLength   = 32;
+const TInt KSpaceForParenthesis        = 4;
+const TInt KMaxNodeValueLength         = 256;
+const TInt KMaxProfileNameAppendLength = 4; // e.g. (10) as in Provider(10)
+const TInt KMaxProfileNames            = 99;
+_LIT( KOpenParenthesis,   "(" );
+_LIT( KClosedParenthesis, ")" );
+const TUint KComma = ',';
+
+// ==============================
+// VoIP constants
+// ==============================
+//
+_LIT( KILbc, "ILBC" );
+const TInt KDefaultResubscribe = 600;
+
+// ==============================
+// SIP constants
+// ==============================
+//
+_LIT8( KIetf,               "IETF" );
+_LIT8( KIms,                "IMS" );
+_LIT8( KOpenParenthesis8,   "(" );
+_LIT8( KClosedParenthesis8, ")" );
+_LIT8( KSip,                "sip:" );
+_LIT8( KSips,               "sips:" );
+_LIT8( KTransport,          ";transport=" );
+_LIT8( KLr,                 ";lr" );
+_LIT8( KEscaped,            "%" );
+_LIT8( KColon,              ":" );
+_LIT8( KTcp,                "TCP" );
+_LIT8( KUdp,                "UDP" );
+_LIT8( KTls,                "TLS" );
+_LIT8( KUserAgent,          "User-Agent" );
+_LIT8( KSpace,              " " );
+const TInt KMaxTerminalTypeLength            = 64;
+const TInt KMaxWlanMacAddressLength          = 20;
+const TInt KMaxUserAgentHeaderLength         = 200;
+const TInt KUserAgentHeaderDataArrayInitSize = 4;
+const TInt KDefaultSigQos                    = 40;
+
+// ==============================
+// XDM and Presence constants
+// ==============================
+//
+const TInt KMaxObjectSize     = 5120;
+const TInt KPublishInterval   = 60;
+_LIT( KDefaultXdmUri,          "http://localhost" );
+_LIT( KDefaultXdmAuthType,     "HTTP-DIGEST" );
+
+// ==============================
+// NAT/Firewall constants
+// ==============================
+//
+const TInt KDefaultStunServerPort     = 3478;
+const TInt KDefaultTcpRefreshInterval = 1200;
+const TInt KDefaultUdpRefreshInterval = 28;
+const TInt KDefaultStartPortRange     = 49152;
+const TInt KDefaultEndPortRange       = 49200;
+_LIT( KDefaultNatProtocol,             "nokia.stun" );
+
+// ==============================
+// WLAN access point constants.
+// ==============================
+//
+const TInt KMaxWepKeyDataLength = 26;
+const TInt KMaxWepKeyCount      = 4;
+// Enumeration for WEP key lengths.
+enum TWepKeyLengths
+    {
+    // Length of WEP encryption
+    EWepEncryption64  = 64,
+    EWepEncryption128 = 128,
+    // Length of WEP key data
+    EWepKey64Hex      = 10,
+    EWepKey64Ascii    = 5,
+    EWepKey128Hex     = KMaxWepKeyDataLength,
+    EWepKey128Ascii   = 13
+    };
+_LIT( KNetworkModeInfra,     "infra" );
+_LIT( KNetworkModeAdhoc,     "adhoc" );
+_LIT( KSecurityTypeWep,      "WEP" );
+_LIT( KSecurityTypeWpa,      "WPA" );
+_LIT( KSecurityTypeWpa2,     "WPA2" );
+_LIT( KSecurityType8021x,    "8021X" );
+_LIT( KEapTypeLeap,          "LEAP" );
+_LIT( KWepAuthModeOpen,      "open" );
+_LIT( KWepAuthModeShared,    "shared" );
+
+// ==============================
+// General constants
+// ==============================
+//
+// Enumeration for type of settings being deployed.
+enum TSettingsType
+    {
+    EUnknown = KErrNotSupported,
+    EVoip = 0,
+    ESip,
+    EPresence,
+    EXdm,
+    ENatFw,
+    EDestination,
+    EWlan,
+    ECodec,
+    EVmbx,
+    EProxy,
+    ERegistrar,
+    EAdditionalStun,
+    EWepKey,
+    EEap
+    };
+
+// Enumeration for parameters.
+enum TParameters
+    {
+    EUnSupported = KErrNotSupported,
+    // Generic parameters
+    EName = 0,
+    EUri,
+    ETransport,
+    EPort,
+    EUsername,
+    EPassword,
+    EType,
+    EDomain,
+    EStartPort,
+    EEndPort,
+    // VoIP parameters
+    EMediaQos,
+    EDtmfInband,
+    EDtmfOutband,
+    ESecureCallPreference,
+    EAllowVoipOverWcdma,
+    ERtcp,
+    EUserAgentHeaderTerminalType,
+    EUserAgentHeaderWlanMac,
+    EUserAgentHeaderFreeString,
+    ECallerIdDigits,
+    EIgnoreDomainPart,
+    EAutoAcceptBuddyRequests,
+    EAddUserPhone,
+    EProviderUrl,
+    EMinSessionInterval,
+    ESessionInterval,
+    EBrandingUri,
+    EAutoEnable,
+    EEnableSipIm,
+    EBrandId,
+    EDefault,
+    // Voice mailbox parameters
+    EMwiUri,
+    EListeningUri,
+    EReSubscribeInterval,
+    // Codec parameters
+    EJitterBuffer,
+    EOctetAlign,
+    EPTime,
+    EMaxPTime,
+    EModeSet,
+    EModeChangePeriod,
+    EModeChangeNeighbor,
+    EMaxRed,
+    EVad,
+    EAnnexb,
+    // SIP parameters
+    ESignalingQos,
+    EPublicUserId,
+    ESignalCompression,
+    ESecurityNegotiation,
+    EProfileLock,
+    EAutoRegistration,
+    // Proxy parameters
+    ELooseRouting,
+    // Presence parameters
+    EMaxObjectSize,
+    EPublishInterval,
+    EMaxSubscriptions,
+    EMaxContacts,
+    EDomainSyntax,
+    // NAT/Firewall parameters
+    ETcpRefreshInterval,
+    EUdpRefreshInterval,
+    ECrlfRefresh,
+    EStunSharedSecret,
+    // WLAN access point parameters
+    ESsid,
+    EHidden,
+    ENetworkMode,
+    EPreSharedKey,
+    EWepAuthMode,
+    // WEP key parameters
+    ELength,
+    EData
+    };
+
+#endif // VOIPXMLPROCESSORDEFAULTS_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlprocessorlogger.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  VoIP XML processor logger
+*
+*/
+
+
+
+#ifndef VOIPXMLPROCESSORLOGGER_H
+#define VOIPXMLPROCESSORLOGGER_H
+
+//  INCLUDES
+#include <e32def.h>
+#include <e32debug.h>
+
+//----------------------------------------------------------------------------
+//  USER LOGGING SETTINGS
+//----------------------------------------------------------------------------
+
+#ifndef _DEBUG
+
+/***************************
+* Logging method variants:
+*   0 = No logging
+*   1 = RDebug
+***************************/ 
+
+#define VOIPXMLPROCESSOR_DEBUG     0   // UREL BUILD
+
+#else
+
+#define VOIPXMLPROCESSOR_DEBUG     1   // UDEB BUILD
+
+#endif // _DEBUG
+
+//----------------------------------------------------------------------------
+//  LOGGING MACROs (DO NOT EDIT)
+//
+//  USE THESE MACROS IN YOUR CODE
+//----------------------------------------------------------------------------
+
+#if VOIPXMLPROCESSOR_DEBUG == 1    // RDebug
+
+#define DBG_PRINT( AA )           { RDebug::Print( _L( AA ) ); }
+#define DBG_PRINT2( AA, BB )      { RDebug::Print( _L( AA ), BB ); }
+#define DBG_PRINT3( AA, BB, CC )  { RDebug::Print( _L( AA ), BB, CC ); }
+
+#else   // VOIPXMLPROCESSOR_DEBUG == 0 or invalid -> Disable loggings
+
+#define DBG_PRINT( AA )          
+#define DBG_PRINT2( AA, BB )     
+#define DBG_PRINT3( AA, BB, CC )    
+
+#endif  // IAS_DEBUG
+
+#endif  // VOIPXMLPROCESSORLOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlsiphandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,237 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  SIP handler for VoIP XML processor
+*
+*/
+
+
+#ifndef  VOIPXMLSIPHANDLER_H
+#define  VOIPXMLSIPHANDLER_H
+
+#include <sipprofileregistryobserver.h>
+#include <sipprofiletypeinfo.h>
+
+class CSIPManagedProfile;
+class CSIPManagedProfileRegistry;
+class CSIPProfile;
+class TSIPProfileTypeInfo;
+
+/**
+*  VoipXmlSipHandler
+*  SIP handler class.
+* 
+*  @lib voipxmlprocessor.lib
+*  @since S60 v5.0
+*/
+class CVoipXmlSipHandler : public CBase,
+                           public MSIPProfileRegistryObserver
+    {
+#ifdef _DEBUG
+    friend class UT_CVoipXmlSipHandler;
+    friend class UT_CVoipXmlParser;
+    friend class UT_CVoipXmlParamHandler;
+#endif
+
+public:
+    enum TTransportType
+        {
+        EAutomatic = 0,
+        EUdp,
+        ETcp,
+        ETls
+        };
+public:
+
+    static CVoipXmlSipHandler* NewL();
+    ~CVoipXmlSipHandler();
+
+public:
+
+    /**
+     * Sets SIP setting.
+     *
+     * @since S60 v5.0
+     * @param aType Type of setting (SIP 'core', proxy or registrar)
+     * @param aParam Parameter to be set.
+     * @param aValue Value of the setting.
+     */
+    void SetSetting( TInt aType, TInt aParam, const TDesC8& aValue );
+
+    /**
+     * Stores settings to SIP managed profile registry.
+     *
+     * @since S60 v5.0
+     * @return KErrNone if successful,
+     *         KErrNotSupported if no settings to be stored,
+     *         KErrCompletion if settings could not be stored.
+     */
+    TInt StoreSettings();
+
+    /**
+     * Returns the profile ID.
+     *
+     * @since S60 v5.0
+     * @return SIP profile ID.
+     */
+    TUint32 SettingsId();
+
+    /**
+     * Gives linkage information.
+     *
+     * @since S60 v5.0
+     * @param aType Type of settings.
+     * @param aSettingsId Settings ID.
+     */
+    void LinkSettings( TInt aType, TUint32 aSettingsId );
+
+    /**
+     * Finalizes settings, i.e. sets Destination ID to SIP profile.
+     *
+     * @since S60 v5.0
+     * @return KErrNone if successful,
+     *         KErrCompletion if settings could not be finalized.
+     */
+    TInt FinalizeSettings();
+
+protected:
+
+// from base class MSIPProfileRegistryObserver
+
+    /** 
+     * From MSIPProfileRegistryObserver 
+     * SIP profile information event.
+     *
+     * @since S60 v5.0
+     * @param aSIPProfileId SIP profile ID.
+     * @param aEvent Type of SIP event
+     */
+    void ProfileRegistryEventOccurred( TUint32 /*aSIPProfileId*/, 
+        TEvent /*aEvent*/ );
+
+    /**
+     * From MSIPProfileRegistryObserver
+     * An asynchronous error has occurred related to SIP profile.
+     *
+     * @since S60 v5.0
+     * @param aSIPProfileId SIP profile ID.
+     * @param aError Error code.
+     */
+    void ProfileRegistryErrorOccurred( TUint32 /*aSIPProfileId*/,
+        TInt /*aError*/ );
+
+private:
+
+    /**
+     * Creates a provider name for SIP profile. aName is used
+     * and replaced with a parenthised ordered number if the name is
+     * already found in SIP stack. 
+     *
+     * @since S60 v5.0
+     * @param aName Provider name to be set.
+     */
+    void CreateProviderNameL( const TDesC8& aName );
+
+    /**
+     * Handles public User ID modification if needed.
+     * Possible modifications are escaping and adding sip: prefix.
+     *
+     * @since S60 v5.0
+     * @param aValue Value to be checked and modified if needed.
+     */
+    void ModifyPuidL( TDes8& aValue );
+
+    /**
+     * Validates transport type.
+     *
+     * @since S60 v5.0
+     * @param aValue Value to be validated.
+     * @return Validated transport type.
+     */
+    TTransportType ValidateTransport( const TDesC8& aValue );
+
+private:
+
+    CVoipXmlSipHandler();
+    void ConstructL();
+
+private:
+
+    /**
+     * SIP profile object.
+     * Own.
+     */
+    CSIPManagedProfile* iProfile;
+
+    /**
+     * SIP managed profile registry object.
+     * Own.
+     */
+    CSIPManagedProfileRegistry* iRegistry;
+
+    /**
+     * Profile type.
+     */
+    TSIPProfileTypeInfo iProfileType;
+
+    /**
+     * Proxy URI.
+     * Own.
+     */
+    HBufC8* iProxyUri;
+
+    /**
+     * Proxy transport type.
+     */
+    TTransportType iProxyTransport;
+
+    /**
+     * Proxy port number.
+     */
+    TInt iProxyPort;
+
+    /**
+     * Loose routing.
+     */
+    TBool iLr;
+
+    /**
+     * Registrar URI.
+     * Own.
+     */
+    HBufC8* iRegistrarUri;
+
+    /**
+     * Registrar transport type.
+     */
+    TTransportType iRegistrarTransport;
+
+    /**
+     * Registrar server port number.
+     */
+    TInt iRegistrarPort;
+
+    /**
+     * Tells if any settings have been set to temporary profile.
+     */
+    TBool iSettingsSet;
+
+    /**
+     * SIP profile ID.
+     */
+    TUint32 iProfileId;
+    };
+
+#endif // VOIPXMLSIPHANDLER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlutils.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utilities class for VoIP XML processor
+*
+*/
+
+
+#ifndef VOIPXMLUTILS_H
+#define VOIPXMLUTILS_H
+
+#include <e32base.h>
+
+/**
+ *  Cleanup item for deleting contents of RPointerArray.
+ *
+ *  @lib voipxmlprocessor.lib
+ *  @since S60 v5.0
+ */
+template <class T>
+class CleanupResetAndDestroy
+    {
+public:
+
+    /**
+     * Pushes aRef to cleanup stack using TCleanupItem (and ResetAndDestroy). 
+     *
+     * @since S60 v5.0
+     * @param aRef Reference to object to be pushed to cleanup stack.
+     */
+    inline static void PushL( T& aRef );
+
+private:
+
+    /**
+     * Method for TCleanupItem used in PushL.
+     * 
+     * @since S60 v5.0
+     * @param aPtr Pointer to be cleaned up.
+     */
+    inline static void ResetAndDestroy( TAny *aPtr );
+    };
+
+template <class T>
+inline void CleanupResetAndDestroyL( T& aRef );
+
+
+/**
+ *  Utilities class for VoIP XML processor.
+ *  Provides common methods for VoIP XML processor classes.
+ *
+ *  @lib voipxmlprocessor.lib
+ *  @since S60 v5.0
+ */
+class VoipXmlUtils
+    {
+#ifdef _DEBUG
+    friend class UT_VoipXmlUtils; 
+#endif
+
+public:
+
+    /**
+     * Converts a descriptor to integer.
+     *
+     * @since S60 v5.0
+     * @param aDesValue Descriptor value.
+     * @param aIntValue Interger value (this will hold the converted value).
+     * @return Error code.
+     */
+    static TInt DesToInt( const TDesC& aDesValue, TInt& aIntValue );
+
+    /**
+     * Converts an 8 bit descriptor to integer.
+     *
+     * @since S60 v5.0
+     * @param aDesValue Descriptor value.
+     * @param aIntValue Interger value (this will hold the converted value).
+     * @return Error code.
+     */
+    static TInt Des8ToInt( const TDesC8& aDesValue, TInt& aIntValue );
+    };
+
+#include "voipxmlutils.inl"
+
+#endif // VOIPXMLUTILS_H
+
+// End of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlutils.inl	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utilities methods for VoIP XML processor
+*
+*/
+
+
+
+// ---------------------------------------------------------------------------
+// Pushes an item to CleanupStack.
+// ---------------------------------------------------------------------------
+//
+template <class T>
+inline void CleanupResetAndDestroy<T>::PushL( T& aRef )
+    {
+    CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Cleans up an item.
+// ---------------------------------------------------------------------------
+//
+template <class T>
+inline void CleanupResetAndDestroy<T>::ResetAndDestroy( TAny *aPtr )
+    {
+    ( STATIC_CAST( T*, aPtr ) )->ResetAndDestroy();
+    ( STATIC_CAST( T*, aPtr ) )->Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Calls CleanupResetAndDestroy<T>::PushL
+// ---------------------------------------------------------------------------
+//
+template <class T>
+inline void CleanupResetAndDestroyL( T& aRef )
+    {
+    CleanupResetAndDestroy<T>::PushL( aRef );
+    }
+
+// End of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlvoiphandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,397 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  VoIP handler for VoIP XML processor
+*
+*/
+
+
+#ifndef VOIPXMLVOIPHANDLER_H
+#define VOIPXMLVOIPHANDLER_H
+
+#include <e32base.h>
+#include <sipprofileregistryobserver.h>
+#include <crcseprofileentry.h>
+#include <crcseaudiocodecentry.h>
+
+class CSPSettings;
+class CRCSEProfileRegistry;
+class CRCSEAudioCodecRegistry;
+class CRCSEProfileEntry;
+class CSPProperty;
+
+typedef CRCSEAudioCodecEntry::TOnOff TCodecOnOff;
+typedef CRCSEProfileEntry::TOnOff TEntryOnOff;
+
+struct TTemporaryCodec
+    {
+    /**
+     * Codec name.
+     */
+    HBufC* iName;
+    /**
+     * Jitter buffer size.
+     */
+    TInt iJitterBuffer;
+    /**
+     * Octet-align.
+     */
+    TCodecOnOff iOctetAlign;
+    /**
+     * PTime value.
+     */
+    TInt iPtime;
+    /**
+     * MaxPtime value.
+     */
+    TInt iMaxPtime;
+    /**
+     * Mode-set values.
+     */
+    RArray<TUint32> iModeSet;
+    /**
+     * Mode-change-period value.
+     */
+    TInt iModeChangePeriod;
+    /**
+     * Mode-change-neighbor value.
+     */
+    TCodecOnOff iModeChangeNeighbor;
+    /**
+     * Max-red value.
+     */
+    TInt iMaxRed;
+    /**
+     * VAD value.
+     */
+    TCodecOnOff iVad;
+    /**
+     * Annexb value.
+     */
+    TCodecOnOff iAnnexb;
+    };
+
+struct TSpSettings
+    {
+    /**
+     * Tells if buddy requests are automatically accepted.
+     */
+    TBool iAutoAcceptBuddies;
+    /**
+     * Provider bookmark URL.
+     */
+    HBufC* iProviderUrl;
+    /**
+     * Branding URI.
+     */
+    HBufC* iBrandingUri;
+    /**
+     * Tells if the service will be automatically enabled.
+     */
+    TBool iAutoEnable;
+    /**
+     * Message Waiting Indicator URI for voice mailbox.
+     */
+    HBufC* iMwiUri;
+    /**
+     * Listening URI for voice mailbox.
+     */
+    HBufC* iListeningUri;
+    /**
+     * Re-subscribe interval for voice mailbox.
+     */
+    TInt iResubrcribe;
+    /**
+     * Tells if SIP IM is enabled. IM will be set as enabled only if 
+     * a presence ID is received via LinkSettings() method.
+     */
+    TBool iEnableSipIm;
+    /**
+     * Brand ID.
+     */
+    HBufC* iBrandId;
+    };
+
+/**
+*  VoIP handler class.
+*  Handles VoIP related settings.
+*
+*  @lib voipxmlprocessor.lib
+*  @since S60 v5.0
+*/
+class CVoipXmlVoipHandler : public CBase, public MSIPProfileRegistryObserver
+    {
+#ifdef _DEBUG
+    friend class UT_CVoipXmlVoipHandler;
+    friend class UT_CVoipXmlParser;
+    friend class UT_CVoipXmlParamHandler;
+#endif
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CVoipXmlVoipHandler* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CVoipXmlVoipHandler();
+
+    /**
+     * Sets VoIP setting.
+     *
+     * @since S60 v5.0
+     * @param aType Type of setting (VoIP 'core', vmbx or codec)
+     * @param aParam Parameter to be set.
+     * @param aValue Value of the setting.
+     */
+    void SetSetting( TInt aType, TInt aParam, const TDesC& aValue );
+
+    /**
+     * Stores settings to RCSE.
+     *
+     * @since S60 v5.0
+     * @return KErrNone if successful,
+     *         KErrNotSupported if no settings to be stored,
+     *         KErrCompletion if settings could not be stored.
+     */
+    TInt StoreSettings();
+
+    /**
+     * Returns the service ID.
+     *
+     * @since S60 v5.0
+     * @return VoIP service ID.
+     */
+    TUint32 SettingsId();
+
+    /**
+     * Method to inform the handler that currently deployed settings
+     * have ended. This way we will know when a codec is ready to be
+     * put to RCSE.
+     *
+     * @since S60 v5.0
+     * @param aType Type of settings.
+     */
+    void SettingsEnd( TInt aType );
+
+    /**
+     * Gives linkage information.
+     *
+     * @since S60 v5.0
+     * @param aType Type of settings.
+     * @param aSettingsId Settings ID.
+     */
+    void LinkSettings( TInt aType, TUint32 aSettingsId );
+
+    /**
+     * Finalizes settings, i.e. sets all the settings that are bound to
+     * settings linkage (e.g. SIP User-Agent header and 
+     * settings stored in SPSettings).
+     *
+     * @since S60 v5.0
+     * @return KErrNone if successful,
+     *         KErrCompletion if settings could not be finalized.
+     */
+    TInt FinalizeSettings();
+
+    /**
+     * Returns the service tab ID.
+     *
+     * @since S60 v5.0
+     * @return Service tab ID.
+     */
+    TUint32 ServiceTabIdL();
+
+protected:
+
+// from base class MSIPProfileRegistryObserver
+
+    /** 
+     * From MSIPProfileRegistryObserver 
+     * SIP profile information event.
+     *
+     * @since S60 v5.0
+     * @param aSIPProfileId SIP profile ID.
+     * @param aEvent Type of SIP event
+     */
+    void ProfileRegistryEventOccurred( TUint32 /*aSIPProfileId*/, 
+        TEvent /*aEvent*/ );
+
+    /**
+     * From MSIPProfileRegistryObserver
+     * An asynchronous error has occurred related to SIP profile.
+     *
+     * @since S60 v5.0
+     * @param aSIPProfileId SIP profile ID.
+     * @param aError Error code.
+     */
+    void ProfileRegistryErrorOccurred( TUint32 /*aSIPProfileId*/,
+        TInt /*aError*/ );
+
+private:
+
+    /**
+     * Sets VoIP core setting to temporary storage.
+     *
+     * @param aParam Parameter to be set.
+     * @param aValue Value of the setting.
+     * @since S60 v5.0
+     */
+    void SetCoreSettingL( TInt aParam, const TDesC& aValue );
+
+    /**
+     * Sets codec setting to temporary storage.
+     *
+     * @param aParam Parameter to be set.
+     * @param aValue Value of the setting.
+     * @since S60 v5.0
+     */
+    void SetCodecSettingL( TInt aParam, const TDesC& aValue );
+
+    /**
+     * Sets voice mailbox setting to temporary storage.
+     *
+     * @param aParam Parameter to be set.
+     * @param aValue Value of the setting.
+     * @since S60 v5.0
+     */
+    void SetVmbxSettingL( TInt aParam, const TDesC& aValue );
+
+    /**
+     * Validates profile name and modifies it if necessary.
+     *
+     * @since S60 v5.0
+     * @param aName Name to be validated.
+     */
+    void ValidateProfileNameL( TDes& aName );
+
+    /**
+     * Sets temporary codec to RCSE.
+     *
+     * @since S60 v5.0
+     */
+    void SetCodecToRcseL();
+
+    /**
+     * Reset temporary codec settings (iCurrentCodec)
+     *
+     * @since S60 v5.0
+     */
+    void ResetTempCodec( TBool aCloseArray = EFalse );
+
+    /**
+     * Resets temporary service provider settings (iSpSettings)
+     * 
+     * @since S60 v5.0
+     */
+    void ResetTempSpSettings();
+
+    /**
+     * Sets SIP related VoIP settings (links VoIP profile to SIP and sets
+     * SIP User-Agent header).
+     * 
+     * @since S60 v5.0
+     * @param aSipId SIP settings ID.
+     */
+    void SetSipInfoL( TUint32 aSipId );
+
+    /**
+     * Sets SPSettings to service table.
+     *
+     * @since S60 v5.0
+     */
+    void SetSpSettingsL();
+
+    /**
+     * Adds default codec set to iEntry.
+     *
+     * @since S60 v5.0
+     */
+    void AddDefaultCodecsL();
+
+    /**
+     * Sets the service as default service and preferred telephony as PS.
+     *
+     * @since S60 v5.1
+     */
+    void SetAsDefaultL();
+
+private:
+
+    CVoipXmlVoipHandler();
+    void ConstructL();
+
+private:
+
+    /**
+     * RCSE profile registry.
+     * Own.
+     */
+    CRCSEProfileRegistry* iRegistry;
+
+    /**
+     * RCSE audio codec registry
+     * Own.
+     */
+    CRCSEAudioCodecRegistry* iCodecRegistry;
+
+    /**
+     * RCSE profile entry.
+     * Own.
+     */
+    CRCSEProfileEntry* iEntry;
+
+    /**
+     * Tells if any settings have been set to temporary profile.
+     */
+    TBool iSettingsSet;
+
+    /**
+     * VoIP service ID.
+     */
+    TUint32 iServiceId;
+
+    /**
+     * Current codec that is being modified.
+     */
+    TTemporaryCodec iCurrentCodec;
+
+    /**
+     * SPSettings that are temporarily stored and .
+     */
+    TSpSettings iSpSettings;
+
+    /**
+     * Presence settings ID. This is received in LinkSettings method and
+     * will be stored to SPSettings in FinalizeSettings method.
+     */
+    TUint32 iPresenceId;
+
+    /**
+     * Destination (SNAP) ID. This is received in LinkSettings method and
+     * will be stored to SPSettings in FinalizedSettings method.
+     */
+    TUint32 iDestinationId;
+
+    /**
+     * Tells if the service is to be set as default service.
+     */
+    TBool iDefault;
+    };
+
+#endif // VOIPXMLVOIPHANDLER_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/inc/voipxmlxdmhandler.h	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  XDM handler for VoIP XML processor
+*
+*/
+
+
+#ifndef  VOIPXMLXDMHANDLER_H
+#define  VOIPXMLXDMHANDLER_H
+
+
+class CXdmSettingsCollection;
+
+/**
+*  VoipXmlXdmHandler
+*  XDM handler class.
+* 
+*  @lib voipxmlprocessor.lib
+*  @since S60 v5.0
+*/
+class CVoipXmlXdmHandler : public CBase
+    {
+#ifdef _DEBUG
+    friend class UT_CVoipXmlXdmHandler;
+    friend class UT_CVoipXmlParamHandler;
+#endif
+
+public:
+
+    static CVoipXmlXdmHandler* NewL();
+    ~CVoipXmlXdmHandler();
+
+public:
+
+    /**
+     * Sets XDM setting.
+     *
+     * @since S60 v5.0
+     * @param aParam Parameter to be set.
+     * @param aValue Value of the setting.
+     */
+    void SetSetting( TInt aParam, const TDesC& aValue );
+
+    /**
+     * Stores settings to 'XDM registry', i.e. creates an XDM collection.
+     *
+     * @since S60 v5.0
+     * @return KErrNone if successful,
+     *         KErrNotSupported if no settings to be stored,
+     *         KErrCompletion if settings could not be stored.
+     */
+    TInt StoreSettings();
+
+    /**
+     * Returns the settings ID.
+     *
+     * @since S60 v5.0
+     * @return XDM settings ID.
+     */
+    TUint32 SettingsId();
+
+private:
+
+    /**
+     * Sets XDM setting.
+     *
+     * @since S60 v5.0
+     * @param aParam Parameter to be set.
+     * @param aValue Value of the setting.
+     */
+    void SetSettingL( TInt aParam, const TDesC& aValue );
+
+    /**
+     * Creates a provider name for XDM profile. aName is used
+     * and replaced with a parenthised ordered number if the name is
+     * already found in XDM storage.
+     *
+     * @since S60 v5.0
+     * @param aName Provider name to be set.
+     */
+    void CreateProviderNameL( TDes& aName );
+
+private:
+
+    CVoipXmlXdmHandler();
+    void ConstructL();
+
+private:
+
+    /**
+     * XDM settings collection object.
+     * Own.
+     */
+    CXdmSettingsCollection* iProfile;
+
+    /**
+     * Tells if any settings have been set to temporary profile.
+     */
+    TBool iSettingsSet;
+
+    /**
+     * XDM collection ID.
+     */
+    TUint32 iProfileId;
+    };
+
+#endif // VOIPXMLXDMHANDLER_H
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/rom/provisioningapi.iby	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  provisioningapi iby file
+*
+*/
+
+#ifndef PROVISIONINGAPI_IBY
+#define PROVISIONINGAPI_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+#ifdef __VOIP
+    file=ABI_DIR/BUILD_DIR/provisioningapi.dll SHARED_LIB_DIR/provisioningapi.dll
+#endif // __VOIP
+
+#endif // PROVISIONINGAPI_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmliaphandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,750 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IAP handler for VoIP XML processor
+*
+*/
+
+
+#include <e32cmn.h>
+#include <coecntrl.h>
+#include <cmmanagerext.h>
+#include <cmdestinationext.h>
+#include <cmconnectionmethodext.h>
+#include <cmconnectionmethoddef.h>
+#include <cmpluginwlandef.h>
+#include <WPASecuritySettingsUI.h>
+#include <WEPSecuritySettingsUI.h>
+#include <EapSettings.h>
+#include <EapType.h>
+
+#include "voipxmlutils.h"
+#include "voipxmliaphandler.h"
+#include "voipxmlprocessorlogger.h"
+
+// ---------------------------------------------------------------------------
+// CVoipXmlIapHandler::CVoipXmlIapHandler
+// ---------------------------------------------------------------------------
+//
+CVoipXmlIapHandler::CVoipXmlIapHandler()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlIapHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CVoipXmlIapHandler* CVoipXmlIapHandler::NewL()
+    {
+    CVoipXmlIapHandler* self = new ( ELeave ) CVoipXmlIapHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlIapHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlIapHandler::ConstructL()
+    {
+    iDestinationName          = HBufC::NewL( 0 );
+    iDestinationId            = 0;
+    iCurrentIap.iSsid         = NULL;
+    iCurrentIap.iName         = NULL;
+    iCurrentIap.iPreSharedKey = NULL;
+    iCurrentIap.iSecurityType = CMManager::EWlanSecModeOpen;
+    iCurrentIap.iNetworkMode  = CMManager::EInfra;
+    iCurrentIap.iWepAuthMode  = CWEPSecuritySettings::EAuthOpen;
+    iCurrentIap.iEapType      = EAPSettings::EEapNone;
+    iCurrentIap.iEapUsername  = NULL;
+    iCurrentIap.iEapPassword  = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlIapHandler::~CVoipXmlIapHandler
+// ---------------------------------------------------------------------------
+//
+CVoipXmlIapHandler::~CVoipXmlIapHandler()
+    {
+    if ( iDestinationName )
+        {
+        delete iDestinationName;
+        }
+    ResetCurrentIap( ETrue );
+    ResetTempIapArray( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets SIP setting.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlIapHandler::SetSetting( TInt aType, TInt aParam, 
+    const TDesC& aValue )
+    {
+    // Ignore too long descriptors.
+    if ( KMaxNodeValueLength < aValue.Length() )
+        {
+        return;
+        }
+    TInt intValue;
+
+    switch ( aParam )
+        {
+        case EName:
+            {
+            TInt err( KErrNotFound );
+            //lint -e{960} No need for else statement here
+            if ( EDestination == aType )
+                {
+                delete iDestinationName;
+                iDestinationName = NULL;
+                TRAP( err, iDestinationName = aValue.AllocL() );
+                }
+            else if ( EWlan == aType && !iCurrentIap.iName )
+                {
+                TRAP( err, iCurrentIap.iName = aValue.AllocL() );
+                }
+            if ( KErrNone == err )
+                {
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EType:
+            {
+            TBuf<KMaxNodeValueLength> value;
+            value.Copy( aValue );
+            value.UpperCase();
+
+            if ( EEap == aType )
+                {
+                if ( 0 == value.Compare( KEapTypeLeap ) )
+                    {
+                    iCurrentIap.iEapType = EAPSettings::EEapLeap;
+                    }
+                }
+
+            if ( EWlan != aType )
+                {
+                break;
+                }
+            //lint -e{960} No need for else statement here
+            if ( 0 == value.Compare( KSecurityTypeWep ) )
+                {
+                iCurrentIap.iSecurityType = CMManager::EWlanSecModeWep;
+                }
+            else if ( 0 == value.Compare( KSecurityTypeWpa ) )
+                {
+                iCurrentIap.iSecurityType = CMManager::EWlanSecModeWpa;
+                }
+            else if ( 0 == value.Compare( KSecurityTypeWpa2 ) )
+                {
+                iCurrentIap.iSecurityType = CMManager::EWlanSecModeWpa2;
+                }
+            else if ( 0 == value.Compare( KSecurityType8021x ) )
+                {
+                iCurrentIap.iSecurityType = CMManager::EWlanSecMode802_1x;
+                }
+            break;
+            }
+        case ESsid:
+            {
+            if ( EWlan == aType && !iCurrentIap.iSsid )
+                {
+                iCurrentIap.iSsid = aValue.Alloc();
+                if ( iCurrentIap.iSsid )
+                    {
+                    iSettingsSet = ETrue;
+                    }
+                }
+            break;
+            }
+        case EHidden:
+            {
+            if ( EWlan == aType &&
+                KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iCurrentIap.iHidden = intValue;
+                }
+            break;
+            }
+        case ENetworkMode:
+            {
+            if ( EWlan != aType )
+                {
+                break;
+                }
+            TBuf<KMaxNodeValueLength> value;
+            value.Copy( aValue );
+            value.LowerCase();
+            //lint -e{960} No need for else statement here
+            if ( 0 == value.Compare( KNetworkModeInfra ) )
+                {
+                iCurrentIap.iNetworkMode = CMManager::EInfra;
+                }
+            else if ( 0 == value.Compare( KNetworkModeAdhoc ) )
+                {
+                iCurrentIap.iNetworkMode = CMManager::EAdhoc;
+                }
+            break;
+            }
+        case EPreSharedKey:
+            {
+            if ( EWlan == aType && !iCurrentIap.iPreSharedKey )
+                {
+                iCurrentIap.iPreSharedKey = aValue.Alloc();
+                }
+            break;
+            }
+        case EWepAuthMode:
+            {
+            if ( EWlan != aType )
+                {
+                break;
+                }
+            TBuf<KMaxNodeValueLength> value;
+            value.Copy( aValue );
+            value.LowerCase();
+            //lint -e{960} No need for else statement here
+            if ( 0 == value.Compare( KWepAuthModeOpen ) )
+                {
+                iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthOpen;
+                }
+            else if ( 0 == value.Compare( KWepAuthModeShared ) )
+                {
+                iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthShared;
+                }
+            break;
+            }
+        case ELength:
+            {
+            if ( EWepKey == aType && 
+                KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ))
+                {
+                iCurrentIap.iCurrentWepKey.iLength = intValue;
+                }
+            break;
+            }
+        case EData:
+            {
+            if ( EWepKey == aType && KMaxWepKeyDataLength >= aValue.Length() )
+                {
+                iCurrentIap.iCurrentWepKey.iData.Copy( aValue );
+                }
+            break;
+            }
+        case EUsername:
+            {
+            if ( EEap == aType )
+                {
+                iCurrentIap.iEapUsername = aValue.Alloc();
+                }
+            break;
+            }
+        case EPassword:
+            {
+            if ( EEap == aType )
+                {
+                iCurrentIap.iEapPassword = aValue.Alloc();
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Stores settings.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipXmlIapHandler::StoreSettings()
+    {
+    if ( !iSettingsSet )
+        {
+        // No settings to be stored => method not supported.
+        return KErrNotSupported;
+        }
+    TRAPD( err, StoreSettingsL() );
+    if ( KErrNone != err )
+        {
+        err = KErrCompletion;
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns Destination ID.
+// ---------------------------------------------------------------------------
+//
+TUint32 CVoipXmlIapHandler::SettingsId()
+    {
+    return iDestinationId;
+    }
+
+// ---------------------------------------------------------------------------
+// Informs that currently deployed settings have ended.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlIapHandler::SettingsEnd( TInt aType )
+    {
+    //lint -e{960} No need for else statement here
+    if ( EWepKey == aType && iCurrentIap.iWepKeys.Count() < KMaxWepKeyCount )
+        {
+        TInt keyDataLength = iCurrentIap.iCurrentWepKey.iData.Length();
+        TBool okToAdd( EFalse );
+        switch ( keyDataLength )
+            {
+            case EWepKey64Hex:
+                {
+                iCurrentIap.iCurrentWepKey.iHex = ETrue;
+                okToAdd = ETrue;
+                break;
+                }
+            case EWepKey64Ascii:
+                {
+                iCurrentIap.iCurrentWepKey.iHex = EFalse;
+                okToAdd = ETrue;
+                break;
+                }
+            case EWepKey128Hex:
+                {
+                iCurrentIap.iCurrentWepKey.iHex = ETrue;
+                okToAdd = ETrue;
+                break;
+                }
+            case EWepKey128Ascii:
+                {
+                iCurrentIap.iCurrentWepKey.iHex = EFalse;
+                okToAdd = ETrue;
+                break;
+                }
+            default:
+                break;
+            }
+        if ( okToAdd )
+            {
+            iCurrentIap.iWepKeys.Append( iCurrentIap.iCurrentWepKey );
+            }
+        iCurrentIap.iCurrentWepKey.iLength = 0;
+        iCurrentIap.iCurrentWepKey.iData.Zero();
+        }
+    else if ( EWlan == aType )
+        {
+        TRAP_IGNORE( AddCurrentIapL() );
+        ResetCurrentIap();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Resets iCurrentIap members.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlIapHandler::ResetCurrentIap( TBool aCloseArray )
+    {
+    if ( iCurrentIap.iName )
+        {
+        delete iCurrentIap.iName;
+        iCurrentIap.iName = NULL;
+        }
+    if ( iCurrentIap.iPreSharedKey )
+        {
+        delete iCurrentIap.iPreSharedKey;
+        iCurrentIap.iPreSharedKey = NULL;
+        }
+    if ( iCurrentIap.iSsid )
+        {
+        delete iCurrentIap.iSsid;
+        iCurrentIap.iSsid = NULL;
+        }
+    iCurrentIap.iWepKeys.Reset();
+    if ( aCloseArray )
+        {
+        iCurrentIap.iWepKeys.Close();
+        }
+    iCurrentIap.iHidden = EFalse;
+    iCurrentIap.iSecurityType = CMManager::EWlanSecModeOpen;
+    iCurrentIap.iNetworkMode = CMManager::EInfra;
+    iCurrentIap.iWepAuthMode = CWEPSecuritySettings::EAuthOpen;
+
+    iCurrentIap.iEapType = EAPSettings::EEapNone;
+    if ( iCurrentIap.iEapUsername )
+        {
+        delete iCurrentIap.iEapUsername;
+        iCurrentIap.iEapUsername = NULL;
+        }
+    if ( iCurrentIap.iEapPassword )
+        {
+        delete iCurrentIap.iEapPassword;
+        iCurrentIap.iEapPassword = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Resets iIaps members.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlIapHandler::ResetTempIapArray( TBool aCloseArray )
+    {
+    const TInt count = iIaps.Count();
+    for ( TInt counter = 0; counter < count; counter++ )
+        {
+        if ( iIaps[counter]->iName )
+            {
+            delete iIaps[counter]->iName;
+            iIaps[counter]->iName = NULL;
+            }
+        if ( iIaps[counter]->iPreSharedKey )
+            {
+            delete iIaps[counter]->iPreSharedKey;
+            iIaps[counter]->iPreSharedKey = NULL;
+            }
+        if ( iIaps[counter]->iSsid )
+            {
+            delete iIaps[counter]->iSsid;
+            iIaps[counter]->iSsid = NULL;
+            }
+        iIaps[counter]->iWepKeys.Reset();
+        if ( aCloseArray )
+            {
+            iIaps[counter]->iWepKeys.Close();
+            }
+        if ( iIaps[counter]->iEapUsername )
+            {
+            delete iIaps[counter]->iEapUsername;
+            iIaps[counter]->iEapUsername = NULL;
+            }
+        if ( iIaps[counter]->iEapPassword )
+            {
+            delete iIaps[counter]->iEapPassword;
+            iIaps[counter]->iEapPassword = NULL;
+            }
+        }
+    iIaps.ResetAndDestroy();
+    if ( aCloseArray )
+        {
+        iIaps.Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Adds iCurrentIap into iIaps array, i.e. copies its values to a pointer
+// and appends that one into the array.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlIapHandler::AddCurrentIapL()
+    {
+    if ( !iCurrentIap.iSsid )
+        {
+        // If there is no SSID, we won't add the IAP to array.
+        return;
+        }
+    TTemporaryIap* iap = new TTemporaryIap;
+    iap->iSsid = HBufC::NewLC( KMaxNodeValueLength ); // CS:1
+    iap->iName = HBufC::NewLC( KMaxNodeValueLength ); // CS:2
+    iap->iPreSharedKey = HBufC::NewLC( KMaxNodeValueLength ); // CS:3
+    iap->iEapUsername = HBufC::NewLC( KMaxNodeValueLength ); // CS:4
+    iap->iEapPassword = HBufC::NewLC( KMaxNodeValueLength ); // CS:5
+
+    iap->iSsid->Des().Copy( iCurrentIap.iSsid->Des() );
+    if ( iCurrentIap.iName )
+        {
+        iap->iName->Des().Copy( iCurrentIap.iName->Des() );
+        }
+    else
+        {
+        iap->iName->Des().Copy( iCurrentIap.iSsid->Des() );
+        }
+
+    if ( iCurrentIap.iPreSharedKey )
+        {
+        iap->iPreSharedKey->Des().Copy( iCurrentIap.iPreSharedKey->Des() );
+        }
+
+    iap->iEapType = iCurrentIap.iEapType;
+    if ( iCurrentIap.iEapUsername )
+        {
+        iap->iEapUsername->Des().Copy( iCurrentIap.iEapUsername->Des() );
+        }
+    if ( iCurrentIap.iEapPassword )
+        {
+        iap->iEapPassword->Des().Copy( iCurrentIap.iEapPassword->Des() );
+        }
+
+    iap->iHidden = iCurrentIap.iHidden;
+    iap->iNetworkMode = iCurrentIap.iNetworkMode;
+    iap->iSecurityType = iCurrentIap.iSecurityType;
+    iap->iWepAuthMode = iCurrentIap.iWepAuthMode;
+    const TInt count = iCurrentIap.iWepKeys.Count();
+    for ( TInt counter = 0; counter < count; counter++ )
+        {
+        iap->iWepKeys.Append( iCurrentIap.iWepKeys[counter] );
+        }
+    iIaps.AppendL( iap );
+    CleanupStack::Pop( 5, iap->iSsid );
+    }
+
+// ---------------------------------------------------------------------------
+// Stores settings.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlIapHandler::StoreSettingsL()
+    {
+    RCmManagerExt cmm;
+    cmm.OpenLC(); // CS:1
+
+    // First create all access points and store their ID's.
+    const TInt iapCount = iIaps.Count();
+    RArray<TUint32> iapIds;
+    CleanupClosePushL( iapIds ); // CS:2
+    for ( TInt counter = 0; counter < iapCount; counter++ )
+        {
+        TUint32 id = CreateIapL( cmm, *iIaps[counter] );
+        iapIds.AppendL( id );
+        }
+
+    // Create a destination if one was configured.
+    if ( iDestinationName->Des().Length() )
+        {
+        RArray<TUint32> destinationIds;
+        // Get destination ID's for checking if name to be set is reserved.
+        CleanupClosePushL( destinationIds ); // CS:3
+        cmm.AllDestinationsL( destinationIds );
+        HBufC* newName = HBufC::NewLC( KMaxDestinationNameLength + KSpaceForParenthesis ); // CS:4
+        if( iDestinationName->Des().Length() >= KMaxDestinationNameLength )
+            {
+            newName->Des().Copy( iDestinationName->Left( KMaxDestinationNameLength ) );
+            }
+        else
+            {
+            newName->Des().Copy( iDestinationName->Des() );
+            }
+        
+        // Check that name is unique.
+        const TInt destinationCount = destinationIds.Count();
+        for ( TInt counter = 0; counter < destinationCount; counter++ )
+            {
+            RCmDestinationExt destination = cmm.DestinationL( 
+                destinationIds[counter] );
+            CleanupClosePushL( destination ); // CS:5
+            HBufC* settingsName = destination.NameLC(); // CS:6
+            TUint i( 1 ); // Add number to the name if name already in use.
+            if ( 0 == newName->Des().Compare( settingsName->Des() ) )
+                {
+                // If the name is changed we need to begin the comparison
+                // again from the first profile.
+                if ( iDestinationName->Des().Length() >= KMaxDestinationNameLength )
+                    {
+                    newName->Des().Copy( iDestinationName->Left( KMaxDestinationNameLength ) );
+                    }
+                else
+                    {
+                    newName->Des().Copy( iDestinationName->Des() );
+                    }
+                newName->Des().Append( KOpenParenthesis() );
+                newName->Des().AppendNum( i );
+                newName->Des().Append( KClosedParenthesis() );  
+                counter = 0;
+                i++;
+                if ( KMaxProfileNames < i )
+                    {
+                    User::Leave( KErrBadName );
+                    }
+                }
+            // settingsName, &destination
+            CleanupStack::PopAndDestroy( 2, &destination ); // CS:4
+            }
+        RCmDestinationExt newDestination = cmm.CreateDestinationL( *newName );
+        CleanupClosePushL( newDestination ); // CS:5
+        // We need to run UpdateL in order to get destination ID.
+        newDestination.UpdateL();
+        iDestinationId = newDestination.Id();
+        const TInt cmCount = iapIds.Count();
+        for ( TInt counter = 0; counter < cmCount; counter++ )
+            {
+            RCmConnectionMethodExt connection = cmm.ConnectionMethodL( 
+                iapIds[counter] );
+            CleanupClosePushL( connection );
+            newDestination.AddConnectionMethodL( connection );
+            CleanupStack::PopAndDestroy( &connection );
+            }
+        newDestination.UpdateL();
+
+        // &newDestination, newName, &destinationIds
+        CleanupStack::PopAndDestroy( 3, &destinationIds ); // CS:2
+        }
+    
+    // no destination name is defined.
+    else 
+        {
+        RArray<TUint32> destinationIds;
+        CleanupClosePushL( destinationIds ); // CS:3
+        cmm.AllDestinationsL( destinationIds );
+        const TInt count = destinationIds.Count();
+        for (TInt counter = 0; counter < count ; counter ++)     
+            {
+            RCmDestinationExt destination = cmm.DestinationL( destinationIds[counter] );
+            CleanupClosePushL( destination ); // CS:4
+            if ( destination.MetadataL(
+                    CMManager::ESnapMetadataPurpose) == CMManager::ESnapPurposeInternet )
+               {
+               const TInt cmCount = iapIds.Count();
+               for ( TInt i = 0; i < cmCount; i++ ) 
+                   {
+                   RCmConnectionMethodExt connection = cmm.ConnectionMethodL(iapIds[i] );
+                   CleanupClosePushL( connection );
+                   destination.AddConnectionMethodL(connection );
+                   CleanupStack::PopAndDestroy( &connection );
+               }
+           } 
+           destination.UpdateL();
+           CleanupStack::PopAndDestroy( &destination ); // CS:3
+           CleanupStack::PopAndDestroy( &destinationIds ); // CS:2
+           break;
+           }
+        }
+    
+    // &iapIds, &cmm
+    CleanupStack::PopAndDestroy( 2, &cmm ); // CS:0
+    }
+
+// ---------------------------------------------------------------------------
+// Creates an actual IAP.
+// ---------------------------------------------------------------------------
+//
+TUint32 CVoipXmlIapHandler::CreateIapL( RCmManagerExt& aCmManager, 
+    TTemporaryIap aTempIap )
+    {
+    DBG_PRINT( "CVoipXmlIapHandler::CreateIapL - begin" );
+    RCmConnectionMethodExt newConnMethod = 
+        aCmManager.CreateConnectionMethodL( KUidWlanBearerType );
+    CleanupClosePushL( newConnMethod ); // CS:1
+    newConnMethod.SetStringAttributeL( CMManager::ECmName, 
+        aTempIap.iName->Des() );
+    newConnMethod.SetStringAttributeL( CMManager::EWlanSSID, 
+        aTempIap.iSsid->Des() );
+    newConnMethod.SetIntAttributeL( CMManager::EWlanConnectionMode, 
+        aTempIap.iNetworkMode );
+    if ( aTempIap.iHidden )
+        {
+        newConnMethod.SetBoolAttributeL( CMManager::EWlanScanSSID, ETrue );
+        }
+    newConnMethod.SetIntAttributeL( CMManager::EWlanSecurityMode, 
+        aTempIap.iSecurityType );
+    newConnMethod.UpdateL();
+    TUint32 wlanId = newConnMethod.GetIntAttributeL( 
+        CMManager::EWlanServiceId );
+    TUint32 iapId = newConnMethod.GetIntAttributeL( CMManager::ECmIapId );
+    TUint32 iapServiceId = newConnMethod.GetIntAttributeL( 
+        CMManager::ECmIapServiceId );
+    
+    if ( aTempIap.iSecurityType == CMManager::EWlanSecModeWep )
+        {
+        DBG_PRINT( "   secMode WEP" );
+        CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() );
+        // CS:1
+        CWEPSecuritySettings* wepSecSettings = 
+            CWEPSecuritySettings::NewL();
+        CleanupStack::PushL( wepSecSettings ); // CS:3
+        const TInt wepKeyCount = aTempIap.iWepKeys.Count();
+        for ( TInt counter = 0; counter < wepKeyCount; counter++ )
+            {
+            User::LeaveIfError( wepSecSettings->SetKeyDataL( 
+                counter, aTempIap.iWepKeys[counter].iData, 
+                aTempIap.iWepKeys[counter].iHex ) );
+            }
+        wepSecSettings->SaveL( wlanId, *db );
+        // wepSecSettings, db
+        CleanupStack::PopAndDestroy( 2, db ); // CS:1
+        }
+    else if ( CMManager::EWlanSecModeWpa == aTempIap.iSecurityType ||
+        CMManager::EWlanSecModeWpa2 == aTempIap.iSecurityType )
+        {
+        DBG_PRINT( "   secMode WPA/WPA2" );
+        CMDBSession* db = CMDBSession::NewLC( 
+            CMDBSession::LatestVersion() ); // CS:2
+        CWPASecuritySettings* wpaSecSettings = 
+            CWPASecuritySettings::NewL( ESecurityModeWpa );
+        CleanupStack::PushL( wpaSecSettings ); // CS:3
+
+        if ( EAPSettings::EEapNone == aTempIap.iEapType )
+            {
+            DBG_PRINT( "   EapType none" );
+            //If error happens then delete newConnMethod and leave
+            TInt error = wpaSecSettings->SetWPAPreSharedKey( 
+                aTempIap.iPreSharedKey->Des() );
+            if ( error )
+                {
+                newConnMethod.DeleteL();
+                User::Leave( error );
+                }
+            wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
+            }
+        else if ( EAPSettings::EEapLeap == aTempIap.iEapType )
+            {
+            DBG_PRINT( "   eapType Leap" );
+
+            TBuf8<KMaxNodeValueLength> eapId;
+            eapId.Copy( KEapLeapId, KEapChars );
+            
+            TInt error = wpaSecSettings->SetWPAEnabledEAPPlugin( eapId );
+            if ( error )
+                {
+                newConnMethod.DeleteL();
+                User::Leave( error );
+                }
+            wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
+
+            CEapType* eapType = CEapType::NewL( eapId, ELan, wlanId );
+            CleanupStack::PushL( eapType ); // CS:4
+            EAPSettings* eapSettings = new (ELeave) EAPSettings();
+            CleanupStack::PushL( eapSettings ); // CS:5
+            eapSettings->iEAPType = EAPSettings::EEapLeap;
+            eapSettings->iUsername.Copy( aTempIap.iEapUsername->Des() );
+            eapSettings->iUsernamePresent = ETrue;
+            eapSettings->iPassword.Copy( aTempIap.iEapPassword->Des() );
+            eapSettings->iPasswordPresent = ETrue;
+            eapType->SetConfigurationL( *eapSettings );
+            CleanupStack::PopAndDestroy( 2, eapType ); // CS:3
+            }
+        // wpaSecSettings, db
+        CleanupStack::PopAndDestroy( 2, db ); // CS:1
+        }
+    else if ( CMManager::EWlanSecMode802_1x == aTempIap.iSecurityType )
+        {
+        DBG_PRINT( "   secMode 802.1X" );
+        CMDBSession* db = CMDBSession::NewLC( 
+            CMDBSession::LatestVersion() ); // CS:1
+        CWPASecuritySettings* wpaSecSettings = 
+            CWPASecuritySettings::NewL( ESecurityMode8021x );
+        CleanupStack::PushL( wpaSecSettings ); // CS:2
+        TInt error = wpaSecSettings->SetWPAPreSharedKey( 
+            aTempIap.iPreSharedKey->Des() );
+        if ( error )
+            {
+            newConnMethod.DeleteL();
+            User::Leave( error );
+            }
+        wpaSecSettings->SaveL( wlanId, *db, ESavingBrandNewAP, 0 );
+        // wpaSecSettings, db
+        CleanupStack::PopAndDestroy( 2, db ); // CS:1
+        }
+    CleanupStack::PopAndDestroy( &newConnMethod ); // CS:0
+    
+    DBG_PRINT( "CVoipXmlIapHandler::CreateIapL - end" );
+    return iapId;
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlnatfwhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,440 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  NAT/Firewall handler for VoIP XML processor
+*
+*/
+
+
+#include <centralrepository.h>
+#include <unsafprotocolsinternalcrkeys.h>
+
+#include "voipxmlutils.h"
+#include "voipxmlnatfwhandler.h"
+#include "voipxmlprocessorlogger.h"
+//#include "voipxmlprocessordefaults.h"
+
+// ---------------------------------------------------------------------------
+// CVoipXmlNatFwHandler::CVoipXmlNatFwHandler
+// ---------------------------------------------------------------------------
+//
+CVoipXmlNatFwHandler::CVoipXmlNatFwHandler()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlNatFwHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CVoipXmlNatFwHandler* CVoipXmlNatFwHandler::NewL()
+    {
+    CVoipXmlNatFwHandler* self = new ( ELeave ) CVoipXmlNatFwHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlNatFwHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlNatFwHandler::ConstructL()
+    {
+    iDomain             = HBufC8::NewL( KMaxNodeValueLength );
+    iStunSrvAddr        = HBufC8::NewL( KMaxNodeValueLength );
+    iStunSrvUsername    = HBufC8::NewL( KMaxNodeValueLength );
+    iStunSrvPassword    = HBufC8::NewL( KMaxNodeValueLength );
+    iNatProtocol        = HBufC8::NewL( KMaxNodeValueLength );
+    iNatProtocol->Des().Copy( KDefaultNatProtocol );
+    iStunSrvPort        = KDefaultStunServerPort;
+    iTcpRefreshInterval = KDefaultTcpRefreshInterval;
+    iUdpRefreshInterval = KDefaultUdpRefreshInterval;
+    iStartPortRange     = KDefaultStartPortRange;
+    iEndPortRange       = KDefaultEndPortRange;
+    iCurrentAdditionalStunServer.iStunSrvPort = KDefaultStunServerPort;
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlNatFwHandler::~CVoipXmlNatFwHandler
+// ---------------------------------------------------------------------------
+//
+CVoipXmlNatFwHandler::~CVoipXmlNatFwHandler()
+    {
+    delete iDomain;
+    delete iStunSrvAddr;
+    delete iStunSrvUsername;
+    delete iStunSrvPassword;
+    delete iNatProtocol;
+    iAdditionalStunServers.ResetAndDestroy();
+    iAdditionalStunServers.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Sets a NAT/Firewall setting.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlNatFwHandler::SetSetting( TInt aType, TInt aParam,
+    const TDesC8& aValue )
+    {
+    // Ignore too long descriptors.
+    if ( KMaxNodeValueLength < aValue.Length() )
+        {
+        return;
+        }
+
+    TInt intVal( KErrNotFound );
+    switch ( aParam )
+        {
+        case EDomain:
+            {
+            iDomain->Des().Copy( aValue );
+            iSettingsSet = ETrue;
+            break;
+            }
+        case EUri:
+            {
+            //lint -e{960} No need for else statement here
+            if ( ENatFw == aType )
+                {
+                iStunSrvAddr->Des().Copy( aValue );
+                iSettingsSet = ETrue;
+                }
+            else if ( EAdditionalStun == aType )
+                {
+                iCurrentAdditionalStunServer.iStunSrvAddr.Copy( aValue );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EPort:
+            {
+            //lint -e{960} No need for else statement here
+            if ( ENatFw == aType && KErrNone == VoipXmlUtils::Des8ToInt( 
+                aValue, intVal ) )
+                {
+                iStunSrvPort = intVal;
+                iSettingsSet = ETrue;
+                }
+            else if ( EAdditionalStun == aType && 
+                KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) )
+                {
+                iCurrentAdditionalStunServer.iStunSrvPort = intVal;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case ETcpRefreshInterval:
+            {
+            if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) )
+                {
+                iTcpRefreshInterval = intVal;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EUdpRefreshInterval:
+            {
+            if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) )
+                {
+                iUdpRefreshInterval = intVal;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case ECrlfRefresh:
+            {
+            if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) )
+                {
+                iCrlfRefresh = intVal;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EUsername:
+            {
+            //lint -e{960} No need for else statement here
+            if ( ENatFw == aType )
+                {
+                iStunSrvUsername->Des().Copy( aValue );
+                iSettingsSet = ETrue;
+                }
+            else if ( EAdditionalStun == aType )
+                {
+                iCurrentAdditionalStunServer.iStunSrvUsername.Copy( aValue );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EPassword:
+            {
+            //lint -e{960} No need for else statement here
+            if ( ENatFw == aType )
+                {
+                iStunSrvPassword->Des().Copy( aValue );
+                iSettingsSet = ETrue;
+                }
+            else if ( EAdditionalStun == aType )
+                {
+                iCurrentAdditionalStunServer.iStunSrvPassword.Copy( aValue );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EStunSharedSecret:
+            {
+            if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) )
+                {
+                iStunSharedSecret = intVal;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EStartPort:
+            {
+            if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) )
+                {
+                iStartPortRange = intVal;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EEndPort:
+            {
+            if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, intVal ) )
+                {
+                iEndPortRange = intVal;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EType:
+            {
+            iNatProtocol->Des().Copy( aValue );
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Stores settings to Central Repository.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipXmlNatFwHandler::StoreSettings()
+    {
+    if ( !iSettingsSet )
+        {
+        // No settings to be stored => method not supported.
+        return KErrNotSupported;
+        }
+    TRAPD( err, StoreSettingsL() );
+    if ( KErrNone != err )
+        {
+        err = KErrCompletion;
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Appends currently modified additional STUN server to internal array.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlNatFwHandler::SettingsEnd( TInt aType )
+    {
+    if ( EAdditionalStun == aType )
+        {
+        TAdditionalStun* temp = new TAdditionalStun;
+        temp->iStunSrvAddr.Copy( iCurrentAdditionalStunServer.iStunSrvAddr );
+        temp->iStunSrvPort = iCurrentAdditionalStunServer.iStunSrvPort;
+        temp->iStunSrvUsername.Copy( 
+            iCurrentAdditionalStunServer.iStunSrvUsername );
+        temp->iStunSrvPassword.Copy( 
+            iCurrentAdditionalStunServer.iStunSrvPassword );
+        iAdditionalStunServers.Append( temp );
+        iCurrentAdditionalStunServer.iStunSrvAddr.Copy( KNullDesC8 );
+        iCurrentAdditionalStunServer.iStunSrvPort = KDefaultStunServerPort;
+        iCurrentAdditionalStunServer.iStunSrvUsername.Copy( KNullDesC8 );
+        iCurrentAdditionalStunServer.iStunSrvPassword.Copy( KNullDesC8 );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Commits Central Repository storage.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlNatFwHandler::StoreSettingsL()
+    {
+    CRepository* rep = CRepository::NewLC( KCRUidUNSAFProtocols ); // CS:1
+
+    RArray<TUint32> keys;
+    CleanupClosePushL( keys ); // CS:2
+
+    // Get next free Domain key.
+    rep->FindL( KUNSAFProtocolsDomainMask, 
+        KUNSAFProtocolsFieldTypeMask, keys );
+    TInt keyCount = keys.Count();
+    TInt tmp = 0;
+    if ( !keyCount )
+        {
+        tmp = KUNSAFProtocolsDomainTableMask;
+        }
+    else
+        {
+        tmp = keys[keyCount - 1] + 1;
+        }
+
+    rep->FindEqL( KUNSAFProtocolsDomainMask, KUNSAFProtocolsFieldTypeMask,
+        iDomain->Des(), keys );
+    if ( keys.Count() )
+        {
+        tmp = keys[0];
+        }
+
+    TUint32 currentKey = tmp|KUNSAFProtocolsDomainMask;
+    currentKey &= KUNSAFProtocolsKeyMask;
+
+    TUint32 currentDomainKey = tmp|KUNSAFProtocolsFieldTypeMask;
+    currentDomainKey ^= KUNSAFProtocolsFieldTypeMask;
+
+    TUint32 stunKey = KUNSAFProtocolsSubTableFieldTypeMask;
+    stunKey ^= KUNSAFProtocolsSubTableFieldTypeMask;
+    stunKey |= currentDomainKey;
+
+    // Delete all existing additional STUN servers if there are any.
+    RArray<TUint32> stunKeys;
+    CleanupClosePushL( stunKeys ); // CS:3
+    TInt err = rep->FindL( 
+        currentDomainKey|KUNSAFProtocolsSTUNAddressMask, 
+        KUNSAFProtocolsSubTableFieldTypeMask, stunKeys );
+    const TInt stunKeyCount = stunKeys.Count();
+    for ( TInt counter = 0 ; counter < stunKeyCount; counter++ )
+        {
+        TUint32 key = KUNSAFProtocolsSTUNAddressMask^
+            stunKeys[counter];
+        rep->Delete( key|KUNSAFProtocolsSTUNAddressMask );
+        rep->Delete( key|KUNSAFProtocolsSTUNPortMask );
+        rep->Delete( key|KUNSAFProtocolsSTUNUsernameMask );
+        rep->Delete( key|KUNSAFProtocolsSTUNPasswordMask );
+        }
+    CleanupStack::PopAndDestroy( &stunKeys ); // CS:2
+
+    // Set new keys.
+
+    // Domain
+    User::LeaveIfError( rep->Set( currentKey|KUNSAFProtocolsDomainMask,
+        iDomain->Des() ));
+
+    // STUN server address.
+    User::LeaveIfError( rep->Set( 
+        KUNSAFProtocolsSTUNServerMask|currentDomainKey, 
+        iStunSrvAddr->Des() ) );
+    // Set the same value into STUN server table.
+    User::LeaveIfError( rep->Set( 
+        KUNSAFProtocolsSTUNAddressMask|stunKey,
+        iStunSrvAddr->Des() ) );
+
+    // STUN server port.
+    User::LeaveIfError( rep->Set( 
+        KUNSAFProtocolsSTUNServerPortMask|currentDomainKey, 
+        iStunSrvPort ) );
+    // Set the same value into STUN server table.
+    User::LeaveIfError( rep->Set( 
+        KUNSAFProtocolsSTUNPortMask|stunKey,
+        iStunSrvPort ) );
+
+    // TCP refresh interval.
+    User::LeaveIfError( rep->Set( 
+        KUNSAFProtocolsDomainIntervalTCPMask|currentDomainKey, 
+        iTcpRefreshInterval ) );
+
+    // UDP refresh interval.
+    User::LeaveIfError( rep->Set( 
+        KUNSAFProtocolsDomainIntervalUDPMask|currentDomainKey, 
+        iUdpRefreshInterval ) );
+
+    // CRLF refresh.
+    User::LeaveIfError( rep->Set( 
+        KUNSAFProtocolsDomainEnableCRLFRefresh|currentDomainKey,
+        iCrlfRefresh ) );
+
+    // STUN server username
+    User::LeaveIfError( rep->Set( 
+        KUNSAFProtocolsSTUNUsernameMask|stunKey, 
+        iStunSrvUsername->Des() ) );
+
+    // STUN server password
+    User::LeaveIfError( rep->Set( 
+        KUNSAFProtocolsSTUNPasswordMask|stunKey, 
+        iStunSrvPassword->Des() ) );
+
+    // STUN shared secret
+    User::LeaveIfError( rep->Set( currentDomainKey|
+        KUNSAFProtocolsDomainSharedSecretNotSupported,
+        !iStunSharedSecret ) );
+
+    // Start port range
+    User::LeaveIfError( rep->Set( 
+        currentDomainKey|KUNSAFProtocolsPortPoolStartPortMask,
+        iStartPortRange ) );
+
+    // End port range.
+    User::LeaveIfError( rep->Set( 
+        currentDomainKey|KUNSAFProtocolsPortPoolEndPortMask,
+        iEndPortRange ) );
+
+    // Used NAT protocol.
+    User::LeaveIfError( rep->Set(
+        currentDomainKey|KUNSAFProtocolsUsedNATProtocolMask,
+        iNatProtocol->Des() ) );
+
+    // ==============================
+    // Additional STUN servers
+    // ==============================
+    //
+    const TInt count = iAdditionalStunServers.Count();
+    for ( TInt counter = 0; counter < count; counter++ )
+        {
+        stunKey |= KUNSAFProtocolsSubTableFieldTypeMask;
+        stunKey++;
+        stunKey |= KUNSAFProtocolsSubTableFieldTypeMask;
+        stunKey ^= KUNSAFProtocolsSubTableFieldTypeMask;
+        stunKey |= currentDomainKey;
+
+        // STUNServerAddress
+        User::LeaveIfError( rep->Create( 
+            KUNSAFProtocolsSTUNAddressMask|stunKey,
+            iAdditionalStunServers[counter]->iStunSrvAddr ) );
+
+        // STUNServerPort
+        User::LeaveIfError( rep->Create( 
+            KUNSAFProtocolsSTUNPortMask|stunKey,
+            iAdditionalStunServers[counter]->iStunSrvPort ) );
+
+        // STUNServerUsername
+        User::LeaveIfError( rep->Create( 
+            KUNSAFProtocolsSTUNUsernameMask|stunKey,
+            iAdditionalStunServers[counter]->iStunSrvUsername ) );
+
+        // STUNServerPassword
+        User::LeaveIfError( rep->Create( 
+            KUNSAFProtocolsSTUNPasswordMask|stunKey,
+            iAdditionalStunServers[counter]->iStunSrvPassword ) );
+        }
+
+    // &keys, rep
+    CleanupStack::PopAndDestroy( 2, rep ); // CS:0
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlparamhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,628 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  VoIP settings XML parameter handler.
+*
+*/
+
+
+#include "voipxmlparamhandler.h"
+#include "voipxmlsiphandler.h"
+#include "voipxmlvoiphandler.h"
+#include "voipxmlxdmhandler.h"
+#include "voipxmlpresencehandler.h"
+#include "voipxmlnatfwhandler.h"
+#include "voipxmliaphandler.h"
+#include "voipxmlprocessordefaults.h"
+
+// ---------------------------------------------------------------------------
+// Default constructor.
+// ---------------------------------------------------------------------------
+//
+CVoipXmlParamHandler::CVoipXmlParamHandler()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlParamHandler::ConstructL()
+    {
+    iSettingsType         = EUnknown;
+    iPreviousSettingsType = EUnknown;
+    iSipHandler      = CVoipXmlSipHandler::NewL();
+    iVoipHandler     = CVoipXmlVoipHandler::NewL();
+    iXdmHandler      = CVoipXmlXdmHandler::NewL();
+    iPresenceHandler = CVoipXmlPresenceHandler::NewL();
+    iNatFwHandler    = CVoipXmlNatFwHandler::NewL();
+    iIapHandler      = CVoipXmlIapHandler::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CVoipXmlParamHandler* CVoipXmlParamHandler::NewL()
+    {
+    CVoipXmlParamHandler* self = CVoipXmlParamHandler::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// NewLC
+// ---------------------------------------------------------------------------
+//
+CVoipXmlParamHandler* CVoipXmlParamHandler::NewLC()
+    {
+    CVoipXmlParamHandler* self = new( ELeave ) CVoipXmlParamHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CVoipXmlParamHandler::~CVoipXmlParamHandler()
+    {
+    delete iSipHandler;
+    delete iVoipHandler;
+    delete iXdmHandler;
+    delete iPresenceHandler;
+    delete iNatFwHandler;
+    delete iIapHandler;
+    }
+
+// ---------------------------------------------------------------------------
+// Marks the currently deployed settings.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlParamHandler::SettingsStart( const TDesC& aType )
+    {
+    TBuf<KMaxNodeNameLength> type( KNullDesC );
+    type.Copy( aType );
+    type.LowerCase();
+    iPreviousSettingsType = iSettingsType;
+    if ( KSettingsTypeVoip() == type )
+        {
+        iSettingsType = EVoip;
+        }
+    else if ( KSettingsTypeSip() == type )
+        {
+        iSettingsType = ESip;
+        }
+    else if ( KSettingsTypePresence() == type )
+        {
+        iSettingsType = EPresence;
+        }
+    else if ( KSettingsTypeXdm() == type )
+        {
+        iSettingsType = EXdm;
+        }
+    else if ( KSettingsTypeNatFw() == type )
+        {
+        iSettingsType = ENatFw;
+        }
+    else if ( KSettingsTypeCodec() == type )
+        {
+        iSettingsType = ECodec;
+        }
+    else if ( KSettingsTypeVmbx() == type )
+        {
+        iSettingsType = EVmbx;
+        }
+    else if ( KSettingsTypeProxy() == type )
+        {
+        iSettingsType = EProxy;
+        }
+    else if ( KSettingsTypeRegistrar() == type )
+        {
+        iSettingsType = ERegistrar;
+        }
+    else if ( KSettingsTypeAdditionalStun() == type )
+        {
+        iSettingsType = EAdditionalStun;
+        }
+    else if ( KSettingsTypeWlan() == type )
+        {
+        iSettingsType = EWlan;
+        }
+    else if ( KSettingsTypeWepKey() == type )
+        {
+        iSettingsType = EWepKey;
+        }
+    else if ( KSettingsTypeDestination() == type )
+        {
+        iSettingsType = EDestination;
+        }
+    else if ( KSettingsTypeEap() == type )
+        {
+        iSettingsType = EEap;
+        }
+    else
+        {
+        iSettingsType = EUnknown;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Marks the currently deployed settings as 'ready', i.e. sets current
+// settings type to previous one and informs settings handlers.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlParamHandler::SettingsEnd()
+    {
+    iVoipHandler->SettingsEnd( iSettingsType );
+    iNatFwHandler->SettingsEnd( iSettingsType );
+    iIapHandler->SettingsEnd( iSettingsType );
+    iSettingsType = iPreviousSettingsType;
+    iPreviousSettingsType = EUnknown;
+    }
+
+// ---------------------------------------------------------------------------
+// Handles XML parameters, i.e. converts parameter names to enum and sets
+// the values to setting handlers.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlParamHandler::HandleParameter( const TDesC& aParam, 
+    const TDesC& aValue )
+    {
+    switch ( iSettingsType )
+        {
+        case EVoip:
+        case EVmbx:
+        case ECodec:
+            {
+            TInt param = ConvertParameter( aParam );
+            iVoipHandler->SetSetting( iSettingsType, param, aValue );
+            }
+            break;
+        case ESip:
+        case EProxy:
+        case ERegistrar:
+            {
+            TInt param = ConvertParameter( aParam );
+            TBuf8<KMaxNodeValueLength> value;
+            value.Copy( aValue );
+            iSipHandler->SetSetting( iSettingsType, param, value );
+            }
+            break;
+        case EPresence:
+            {
+            TInt param = ConvertParameter( aParam );
+            iPresenceHandler->SetSetting( param, aValue );
+            }
+            break;
+        case EXdm:
+            {
+            TInt param = ConvertParameter( aParam );
+            iXdmHandler->SetSetting( param, aValue );
+            }
+            break;
+        case ENatFw:
+        case EAdditionalStun:
+            {
+            TInt param = ConvertParameter( aParam );
+            TBuf8<KMaxNodeValueLength> value;
+            value.Copy( aValue );
+            iNatFwHandler->SetSetting( iSettingsType, param, value );
+            }
+            break;
+        case EWlan:
+        case EWepKey:
+        case EDestination:
+        case EEap:
+            {
+            TInt param = ConvertParameter( aParam );
+            iIapHandler->SetSetting( iSettingsType, param, aValue );
+            }
+            break;
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Stores settings, i.e. sends store commands to settings handlers.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipXmlParamHandler::StoreSettings()
+    {
+    // First send 'basic' store commands.
+    TInt err( KErrNone );
+    err = iSipHandler->StoreSettings();
+    if ( KErrNone != err )
+        {
+        return err;
+        }
+    err = iVoipHandler->StoreSettings();
+    if ( KErrNone != err )
+        {
+        return err;
+        }
+    err = iXdmHandler->StoreSettings();
+    // If there were no settings, ignore error code.
+    if ( KErrNotSupported == err )
+        {
+        err = KErrNone;
+        }
+    err = iPresenceHandler->StoreSettings();
+    // If there were no settings, ignore error code.
+    if ( KErrNotSupported == err )
+        {
+        err = KErrNone;
+        }
+
+    err = iNatFwHandler->StoreSettings();
+    // If there were no settings, ignore error code.
+    if ( KErrNotSupported == err )
+        {
+        err = KErrNone;
+        }
+
+    err = iIapHandler->StoreSettings();
+    // If there were no settings, ignore error code.
+    if ( KErrNotSupported == err )
+        {
+        err = KErrNone;
+        }
+
+    // Send linkage information.
+    iSipHandler->LinkSettings( EDestination, iIapHandler->SettingsId() );
+    iVoipHandler->LinkSettings( ESip, iSipHandler->SettingsId() );
+    iVoipHandler->LinkSettings( EPresence, iPresenceHandler->SettingsId() );
+    iVoipHandler->LinkSettings( EDestination, iIapHandler->SettingsId() );
+    iPresenceHandler->LinkSettings( ESip, iSipHandler->SettingsId() );
+    iPresenceHandler->LinkSettings( EXdm, iXdmHandler->SettingsId() );
+
+    // Send finalizing commands.
+    iSipHandler->FinalizeSettings(); // Ignore error code.
+    err = iVoipHandler->FinalizeSettings();
+    iPresenceHandler->FinalizeSettings(); // Ignore error code.
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the VoIP service ID.
+// ---------------------------------------------------------------------------
+//
+TUint32 CVoipXmlParamHandler::ServiceTabId()
+    {
+    TUint32 tabId( KErrNone );
+    TRAP_IGNORE( tabId = iVoipHandler->ServiceTabIdL() );
+    return tabId;
+    }
+
+// ---------------------------------------------------------------------------
+// Converts parameter name to enumerated parameter.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipXmlParamHandler::ConvertParameter( const TDesC& aParam )
+    {
+    TBuf<KMaxNodeNameLength> name( KNullDesC );
+    name.Copy( aParam );
+    name.LowerCase();
+    // ==============================
+    // Generic parameters.
+    // ==============================
+    //
+    if ( KParamValueName() == name )
+        {
+        return EName;
+        }
+    else if ( KParamValueUri() == name )
+        {
+        return EUri;
+        }
+    else if ( KParamValueTransport() == name )
+        {
+        return ETransport;
+        }
+    else if ( KParamValuePort() == name )
+        {
+        return EPort;
+        }
+    else if ( KParamValueUsername() == name )
+        {
+        return EUsername;
+        }
+    else if ( KParamValuePassword() == name )
+        {
+        return EPassword;
+        }
+    else if ( KParamValueType() == name )
+        {
+        return EType;
+        }
+    else if ( KParamValueDomain() == name )
+        {
+        return EDomain;
+        }
+    else if ( KParamValueStartPort() == name )
+        {
+        return EStartPort;
+        }
+    else if ( KParamValueEndPort() == name )
+        {
+        return EEndPort;
+        }
+    // ==============================
+    // VoIP 'core' parametes.
+    // ==============================
+    //
+    else if ( KParamValueMediaQos() == name )
+        {
+        return EMediaQos;
+        }
+    else if ( KParamValueDtmfInband() == name )
+        {
+        return EDtmfInband;
+        }
+    else if ( KParamValueDtmfOutband() == name )
+        {
+        return EDtmfOutband;
+        }
+    else if ( KParamValueSecureCallPref() == name )
+        {
+        return ESecureCallPreference;
+        }
+    else if ( KParamValueVoipOverWcdma() == name )
+        {
+        return EAllowVoipOverWcdma;
+        }
+    else if ( KParamValueRtcp() == name )
+        {
+        return ERtcp;
+        }
+    else if ( KParamValueUserAgentTerminalType() == name )
+        {
+        return EUserAgentHeaderTerminalType;
+        }
+    else if ( KParamValueUserAgentWlanMac() == name )
+        {
+        return EUserAgentHeaderWlanMac;
+        }
+    else if ( KParamValueUserAgentFreeString() == name )
+        {
+        return EUserAgentHeaderFreeString;
+        }
+    else if ( KParamValueCallerIdDigits() == name )
+        {
+        return ECallerIdDigits;
+        }
+    else if ( KParamValueIgnoreDomainPart() == name )
+        {
+        return EIgnoreDomainPart;
+        }
+    else if ( KParamValueAutoAcceptBuddyRequests() == name )
+        {
+        return EAutoAcceptBuddyRequests;
+        }
+    else if ( KParamValueAddUserPhone() == name )
+        {
+        return EAddUserPhone;
+        }
+    else if ( KParamValueProviderUrl() == name )
+        {
+        return EProviderUrl;
+        }
+    else if ( KParamValueMinSessionInterval() == name )
+        {
+        return EMinSessionInterval;
+        }
+    else if ( KParamValueSessionInterval() == name )
+        {
+        return ESessionInterval;
+        }
+    else if ( KParamValueBrandingUri() == name )
+        {
+        return EBrandingUri;
+        }
+    else if ( KParamValueAutoEnable() == name )
+        {
+        return EAutoEnable;
+        }
+    else if ( KParamValueEnableSipIm() == name )
+        {
+        return EEnableSipIm;
+        }
+    else if ( KParamValueBrandId() == name )
+        {
+        return EBrandId;
+        }
+    else if ( KParamValueDefault() == name )
+        {
+        return EDefault;
+        }
+    // ==============================
+    // VoIP voicemailbox parameters.
+    // ==============================
+    //
+    else if ( KParamValueMwiUri() == name )
+        {
+        return EMwiUri;
+        }
+    else if ( KParamValueListeningUri() == name )
+        {
+        return EListeningUri;
+        }
+    else if ( KParamValueReSubscribeInterval() == name )
+        {
+        return EReSubscribeInterval;
+        }
+    // ==============================
+    // VoIP codec parameters.
+    // ==============================
+    //
+    else if ( KParamValueJitterBuffer() == name )
+        {
+        return EJitterBuffer;
+        }
+    else if ( KParamValueOctetAlign() == name )
+        {
+        return EOctetAlign;
+        }
+    else if ( KParamValuePTime() == name )
+        {
+        return EPTime;
+        }
+    else if ( KParamValueMaxPTime() == name )
+        {
+        return EMaxPTime;
+        }
+    else if ( KParamValueModeSet() == name )
+        {
+        return EModeSet;
+        }
+    else if ( KParamValueModeChangePeriod() == name )
+        {
+        return EModeChangePeriod;
+        }
+    else if ( KParamValueModeChangeNeighbor() == name )
+        {
+        return EModeChangeNeighbor;
+        }
+    else if ( KParamValueMaxRed() == name )
+        {
+        return EMaxRed;
+        }
+    else if ( KParamValueVad() == name )
+        {
+        return EVad;
+        }
+    else if ( KParamValueAnnexB() == name )
+        {
+        return EAnnexb;
+        }
+    // ==============================
+    // SIP parameters.
+    // ==============================
+    //
+    else if ( KParamValueSignalingQos() == name )
+        {
+        return ESignalingQos;
+        }
+    else if ( KParamValuePublicUserId() == name )
+        {
+        return EPublicUserId;
+        }
+    else if ( KParamValueSignalCompression() == name )
+        {
+        return ESignalCompression;
+        }
+    else if ( KParamValueSecurityNegotiation() == name )
+        {
+        return ESecurityNegotiation;
+        }
+    else if ( KParamValueProfileLock() == name )
+        {
+        return EProfileLock;
+        }
+    else if ( KParamValueAutoRegistration() == name )
+        {
+        return EAutoRegistration;
+        }
+    else if ( KParamValueLooseRouting() == name )
+        {
+        return ELooseRouting;
+        }
+    // ==============================
+    // Presence parameters.
+    // ==============================
+    //
+    else if ( KParamValueMaxObjectSize() == name )
+        {
+        return EMaxObjectSize;
+        }
+    else if ( KParamValuePublishInterval() == name )
+        {
+        return EPublishInterval;
+        }
+    else if ( KParamValueMaxSubscriptions() == name )
+        {
+        return EMaxSubscriptions;
+        }
+    else if ( KParamValueMaxContacts() == name )
+        {
+        return EMaxContacts;
+        }
+    else if ( KParamValueDomainSyntax() == name )
+        {
+        return EDomainSyntax;
+        }
+    // ==============================
+    // NAT/Firewall parameters.
+    // ==============================
+    //
+    else if ( KParamValueTcpRefreshInterval() == name )
+        {
+        return ETcpRefreshInterval;
+        }
+    else if ( KParamValueUdpRefreshInterval() == name )
+        {
+        return EUdpRefreshInterval;
+        }
+    else if ( KParamValueCrlfRefresh() == name )
+        {
+        return ECrlfRefresh;
+        }
+    else if ( KParamValueStunSharedSecret() == name )
+        {
+        return EStunSharedSecret;
+        }
+    // ==============================
+    // WLAN IAP parameters.
+    // ==============================
+    //
+    else if ( KParamSsid() == name )
+        {
+        return ESsid;
+        }
+    else if ( KParamHidden() == name )
+        {
+        return EHidden;
+        }
+    else if ( KParamNetworkMode() == name )
+        {
+        return ENetworkMode;
+        }
+    else if ( KParamPreSharedKey() == name )
+        {
+        return EPreSharedKey;
+        }
+    else if ( KParamWepAuthMode() == name )
+        {
+        return EWepAuthMode;
+        }
+    else if ( KParamLength() == name )
+        {
+        return ELength;
+        }
+    else if ( KParamData() == name )
+        {
+        return EData;
+        }
+    // ==============================
+    // Not supported.
+    // ==============================
+    //
+    else
+        {
+        return EUnSupported;
+        }
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlparser.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,388 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  VoIP settings XML handler
+*
+*/
+
+
+#include <e32base.h>
+#include <gmxmldocument.h>
+#include <gmxmltext.h>
+#include <e32cmn.h>
+#include <e32def.h>
+
+#include "voipxmlparser.h"
+#include "voipxmlparamhandler.h"
+#include "voipxmlprocessordefaults.h"
+#include "voipxmlprocessorlogger.h"
+
+
+// ---------------------------------------------------------------------------
+// CVoipXmlParser::NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVoipXmlParser* CVoipXmlParser::NewL()
+    {
+    CVoipXmlParser* self = NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlParser::NewLC
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CVoipXmlParser* CVoipXmlParser::NewLC()
+    {
+    CVoipXmlParser* self = new ( ELeave ) CVoipXmlParser();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlParser::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlParser::ConstructL()
+    {
+    DBG_PRINT( "CVoipXmlParser::ConstructL begin" );
+
+    iParser = CMDXMLParser::NewL( this );
+    iParamHandler = CVoipXmlParamHandler::NewL();
+    iDescription = HBufC::NewL( 0 );
+    iBrandUrl = HBufC::NewL( 0 );
+
+    DBG_PRINT( "CVoipXmlParser::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CVoIPXmlHandler::~CVoIPXmlHandler()
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CVoipXmlParser::~CVoipXmlParser()
+    {
+    delete iParser;
+    delete iParamHandler;
+    if ( iXmlDoc )
+        {
+        delete iXmlDoc;
+        }
+    if ( iDescription )
+        {
+        delete iDescription;
+        }
+    if( iBrandUrl )
+        {
+        delete iBrandUrl;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlParser::CVoipXmlParser
+// ---------------------------------------------------------------------------
+//
+CVoipXmlParser::CVoipXmlParser()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlParser::ImportDocumentL
+// Reads document.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CVoipXmlParser::ImportDocument( RFile& aFile, 
+    TUint32& aServiceTabId )
+    {
+    DBG_PRINT( "CVoipXmlParser::ImportDocumentL - begin" );
+    iParseDescription = EFalse;
+    iParser->ParseFile( aFile );
+    CActiveScheduler::Start();
+    if ( KErrNone == iError )
+        {
+        iError = iParamHandler->StoreSettings();
+        }
+    if ( KErrNone == iError )
+        {
+        // Give other applications 2 seconds to react
+        // to the newly created service.
+        const TInt KTwoSeconds( 2000000 );
+        User::After( KTwoSeconds );
+        aServiceTabId = iParamHandler->ServiceTabId();
+        }
+    DBG_PRINT2( "CVoipXmlParser::ImportDocumentL - end (%d)", iError );
+    return iError;
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlParser::ReadDescription
+// Reads document description.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CVoipXmlParser::ReadDescriptionLC( RFile& aFile, 
+    TDes8& aBrandUrl )
+    {
+    DBG_PRINT( "CVoipXmlParser::ReadDescriptionLC begin" );
+    iParseDescription = ETrue;
+    iParser->ParseFile( aFile );
+    CActiveScheduler::Start();
+    if ( !iDescription )
+        {
+        iDescription = HBufC::NewL( 0 );
+        }
+    HBufC* buf = HBufC::NewLC( iDescription->Des().Length() );
+    buf->Des().Copy( iDescription->Des() );
+    if ( !iBrandUrl )
+        {
+        iBrandUrl = HBufC::NewL( 0 );
+        }
+    aBrandUrl.Copy( iBrandUrl->Des() );
+    DBG_PRINT( "CVoipXmlParser::ReadDescriptionLC end" );
+    return buf;
+    }
+
+// ---------------------------------------------------------------------------
+// From base class MMDXMLParserObserver.
+// CVoipXmlParser::ParseFileCompleteL
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlParser::ParseFileCompleteL()
+    {
+    DBG_PRINT( "CVoipXmlParser::ParseFileCompleteL - begin" );
+    // We may have already received XML document from iParser since we
+    // commit two parsing operations (first the description and then the
+    // settings). Thus we need to delete iXmlDoc because iParser has given
+    // its responsibility here.
+    if ( iXmlDoc )
+        {
+        delete iXmlDoc;
+        iXmlDoc = NULL;
+        }
+    iXmlDoc = iParser->DetachXMLDoc();
+    CActiveScheduler::Stop();
+    if ( !iXmlDoc )
+        {
+        iError = KErrCorrupt;
+        return;
+        }
+    CMDXMLElement* xmlElement = iXmlDoc->DocumentElement();
+    if ( !xmlElement )
+        {
+        iError = KErrCorrupt;
+        DBG_PRINT( "CVoipXmlParser::ParseFileCompleteL - end KErrCorrupt" );
+        return;
+        }
+
+    if ( iParseDescription )
+        {
+        ParseDescription( *xmlElement );
+        }
+    else
+        {
+        ParseRoot( *xmlElement );
+        }
+    DBG_PRINT( "CVoipXmlParser::ParseFileCompleteL - end" );
+    }
+
+// ---------------------------------------------------------------------------
+// Parses description node.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlParser::ParseDescription( CMDXMLElement& aXmlElement )
+    {
+    CMDXMLNode* node = aXmlElement.FirstChild();
+    if ( !node )
+        {
+        iError = KErrCorrupt;
+        return;
+        }
+    TBuf<KMaxNodeNameLength> nodeName;
+    nodeName.Copy( node->NodeName() );
+    nodeName.LowerCase();
+
+    // <nokia-confdoc> is the root node; thus parse it first.
+    while ( nodeName != KNodeNokiaConfDoc && node )
+        {
+        node = node->NextSibling();
+        if ( !node )
+            {
+            DBG_PRINT( "CVoipXmlParser::ParseRoot - end KErrEof" );
+            iError = KErrEof;
+            return;
+            }
+        nodeName.Copy( node->NodeName() );
+        nodeName.LowerCase();
+        }
+    // After <nokia-confdoc> has been found, search for <confdescription>
+    // and <confbrandurl> from its children.
+    node = node->FirstChild();
+    while ( node )
+        {
+        nodeName.Copy( node->NodeName() );
+        nodeName.LowerCase();
+        CMDXMLNode* child = node->FirstChild();
+        //lint -e{960} No need for else statement here
+        if ( KNodeConfDescription() == nodeName && child && 
+            CMDXMLNode::ETextNode == child->NodeType() )
+            {
+            CMDXMLText* text = NULL;
+            text = static_cast<CMDXMLText*>( child );
+            delete iDescription;
+            iDescription = NULL;
+            TRAP_IGNORE( iDescription = text->Data().AllocL() );
+            }
+        else if ( KNodeConfBrandUrl() == nodeName && child && 
+            CMDXMLNode::ETextNode == child->NodeType() )
+            {
+            CMDXMLText* text = NULL;
+            text = static_cast<CMDXMLText*>( child );
+            delete iBrandUrl;
+            iBrandUrl = NULL;
+            TRAP_IGNORE( iBrandUrl = text->Data().AllocL() );
+            }
+        node = node->NextSibling();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlParser::ParseRoot
+// Parses root node.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlParser::ParseRoot( CMDXMLElement& aXmlElement )
+    {
+    DBG_PRINT( "CVoipXmlParser::ParseRoot - begin" );
+
+    CMDXMLNode* node = aXmlElement.FirstChild();
+    if ( !node )
+        {
+        iError = KErrCorrupt;
+        return;
+        }
+    TBuf<KMaxNodeNameLength> nodeName;
+    nodeName.Copy( node->NodeName() );
+    nodeName.LowerCase();
+
+    while ( nodeName != KNodeNokiaConfDoc )
+        {
+        node = node->NextSibling();
+        if ( !node )
+            {
+            DBG_PRINT( "CVoipXmlParser::ParseRoot - end KErrEof" );
+            iError = KErrEof;
+            return;
+            }
+        nodeName.Copy( node->NodeName() );
+        nodeName.LowerCase();
+        }
+
+    node = node->FirstChild();
+
+    TInt settingsCount( 0 );
+    while ( node )
+        {
+        nodeName.Copy( node->NodeName() );
+        nodeName.LowerCase();
+        // At this level in XML tree only 'settings' nodes are allowed.
+        if ( nodeName == KNodeSettings )
+            {
+            ParseSettings( node );
+            settingsCount++;
+            }
+        node = node->NextSibling();
+        }
+    if ( !settingsCount )
+        {
+        iError = KErrAbort;
+        }
+    DBG_PRINT( "CVoipXmlParser::ParseRoot - end" );
+
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlParser::ParseSettingsL
+// Parses 'settings' nodes.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlParser::ParseSettings( CMDXMLNode* aXmlNode )
+    {
+    DBG_PRINT( "CVoipXmlParser::ParseSettings - begin" );
+    if ( CMDXMLNode::EElementNode != aXmlNode->NodeType() )
+        {
+        DBG_PRINT( 
+            "CVoipXmlParser::ParseSettings - node type not element, end" );
+        iError = KErrBadHandle;
+        return;
+        }
+
+    CMDXMLElement* element = NULL;
+    element = static_cast<CMDXMLElement*>( aXmlNode );
+    TPtrC attributeValue;
+    element->GetAttribute( KAttributeType(), attributeValue );
+    if ( !attributeValue.Length() )
+        {
+        DBG_PRINT( 
+            "CVoipXmlParser::ParseSettings - attribute type not ok, end" );
+        iError = KErrBadName;
+        }
+
+    iParamHandler->SettingsStart( attributeValue );
+
+
+    CMDXMLNode* node = element->FirstChild();
+
+    while ( node )
+        {
+        if ( node->NodeType() == CMDXMLNode::EElementNode )
+            {
+
+            TBuf<KMaxNodeNameLength> nodeName;
+            nodeName.Copy( node->NodeName() );
+            nodeName.LowerCase();
+            element = NULL;
+            element = static_cast<CMDXMLElement*>( node );
+
+            //lint -e{960} No need for else statement here
+            if ( KNodeParam() == nodeName )
+                {
+                TPtrC nameVal;
+                element->GetAttribute( KAttributeName(), nameVal );
+                if ( nameVal.Length() )
+                    {
+                    TPtrC attVal;
+                    element->GetAttribute( KAttributeValue(), attVal );
+                        {
+                        if ( attVal.Length() )
+                            {
+                            iParamHandler->HandleParameter( 
+                                nameVal, attVal );
+                            }
+                        }
+                    }
+                }
+            else if ( KNodeSettings() == nodeName )
+                {
+                ParseSettings( element );
+                }
+            }
+        node = node->NextSibling();
+        }
+
+    iParamHandler->SettingsEnd();
+
+    DBG_PRINT( "CVoipXmlParser::ParseSettings - end" );
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlpresencehandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,259 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Presence handler for VoIP XML processor
+*
+*/
+
+
+#include <e32cmn.h>
+#include <coecntrl.h>
+#include <pressettingsapi.h>
+#include <pressettingsset.h>
+#include <sysutil.h>
+#include <pathinfo.h>
+#include <authority16.h>
+#include <StringLoader.h>
+#include <escapeutils.h>
+
+#include "voipxmlutils.h"
+#include "voipxmlpresencehandler.h"
+#include "voipxmlprocessorlogger.h"
+#include "voipxmlprocessordefaults.h"
+
+// ---------------------------------------------------------------------------
+// Default constructor.
+// ---------------------------------------------------------------------------
+//
+CVoipXmlPresenceHandler::CVoipXmlPresenceHandler()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor.
+// ---------------------------------------------------------------------------
+//
+CVoipXmlPresenceHandler* CVoipXmlPresenceHandler::NewL()
+    {
+    CVoipXmlPresenceHandler* self = new ( ELeave ) CVoipXmlPresenceHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlPresenceHandler::ConstructL()
+    {
+    iProfile.iObjectSize        = KMaxObjectSize;
+    iProfile.iPublicationInt    = KPublishInterval;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor.
+// ---------------------------------------------------------------------------
+//
+CVoipXmlPresenceHandler::~CVoipXmlPresenceHandler()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Sets Presence setting.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlPresenceHandler::SetSetting( TInt aParam, const TDesC& aValue )
+    {
+    // Ignore too long descriptors.
+    if ( KMaxNodeValueLength < aValue.Length() )
+        {
+        return;
+        }
+
+    TInt intVal( KErrNotFound );
+    switch ( aParam )
+        {
+        case EName:
+            {
+            TBuf<KMaxNodeValueLength> name( KNullDesC );
+            name.Copy( aValue );
+            TRAPD( err, CreateProviderNameL( name ) );
+            if ( KErrNone == err )
+                {
+                iProfile.iSetName.Copy( name );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EMaxObjectSize:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intVal ))
+                {
+                iProfile.iObjectSize = intVal;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EPublishInterval:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intVal ))
+                {
+                iProfile.iPublicationInt = intVal;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EMaxSubscriptions:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intVal ))
+                {
+                iProfile.iMaxSubscriptions = intVal;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EMaxContacts:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intVal ))
+                {
+                iProfile.iMaxContactsInList = intVal;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EDomainSyntax:
+            {
+            iProfile.iDomainSyntax.Copy( aValue );
+            iSettingsSet = ETrue;
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Stores settings to 'Presence registry', i.e. creates a new Presence set.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipXmlPresenceHandler::StoreSettings()
+    {
+    if ( !iSettingsSet )
+        {
+        // No settings to be stored => method not supported.
+        return KErrNotSupported;
+        }
+    iProfile.iStatusOfProps = EPresSettingOpened;
+    TRAPD( err, iProfileId = PresSettingsApi::CreateSetL( iProfile ));
+    if ( KErrNone != err )
+        {
+        err = KErrCompletion;
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the profile ID if the profile saved in StoreSettings.
+// ---------------------------------------------------------------------------
+//
+TUint32 CVoipXmlPresenceHandler::SettingsId()
+    {
+    return iProfileId;
+    }
+
+// ---------------------------------------------------------------------------
+// Links other settings to presence profile.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlPresenceHandler::LinkSettings( TInt aType, TUint32 aSettingsId )
+    {
+    switch ( aType )
+        {
+        case ESip:
+            iProfile.iSipProfile = aSettingsId;
+            break;
+        case EXdm:
+            iProfile.iXDMSetting = aSettingsId;
+            break;
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Finalizes profile, i.e. stores the profile with linkage information.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipXmlPresenceHandler::FinalizeSettings()
+    {
+    TInt err1( KErrNone );
+    TRAPD( err2, err1 = PresSettingsApi::UpdateSetL( iProfile, iProfileId ));
+    if ( KErrNone != err1 || KErrNone != err2 )
+        {
+        err1 = KErrGeneral;
+        }
+    return err1;
+    }
+
+// ---------------------------------------------------------------------------
+// Checks for duplicate named Presence profiles. Renames if same.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlPresenceHandler::CreateProviderNameL( TDes& aName )
+    {
+    DBG_PRINT( "CVoipXmlPresenceHandler::CreateProviderNameL begin" );
+    
+    const TInt maxModifyLength = 
+        KMaxNodeNameLength - KMaxProfileNameAppendLength;
+    RArray<TInt> settingIds;
+    CleanupClosePushL( settingIds ); // CS:1
+    // CS:2
+    CDesCArray* names = PresSettingsApi::GetAllSetsNamesLC( settingIds );
+
+    HBufC* newName = HBufC::NewLC( KMaxNodeNameLength ); // CS:3
+    newName->Des().Copy( aName.Left( maxModifyLength ) );
+    const TInt count( names->MdcaCount() );
+    TUint i( 1 ); // Add number to the name if name already in use.
+
+    // Go through each profile and see if the name of the new profile    
+    // matches one of the existing names. If it does change it and
+    // check the new name again.
+    for ( TInt counter = 0; counter < count; counter++ )
+        {
+        TBuf<KMaxNodeValueLength> loadedName;
+        loadedName.Copy( names->MdcaPoint( counter ));
+        if ( 0 == newName->Des().Compare( loadedName ) )
+            {
+            // If the name is changed we need to begin the comparison
+            // again from the first profile.
+            newName->Des().Copy( aName.Left( maxModifyLength ) );
+            newName->Des().Append( KOpenParenthesis() );
+            newName->Des().AppendNum( i );
+            newName->Des().Append( KClosedParenthesis() );  
+            counter = 0;
+            i++;
+            if ( KMaxProfileNames < i )
+                {
+                User::Leave( KErrBadName );
+                }
+            }
+        }
+    aName.Copy( newName->Des() );
+    // newName, names, &settingIds
+    CleanupStack::PopAndDestroy( 3, &settingIds );
+    DBG_PRINT( "CVoipXmlPresenceHandler::CreateProviderNameL end" );
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlsiphandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,610 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  SIP handler for VoIP XML processor
+*
+*/
+
+
+#include <e32cmn.h>
+#include <coecntrl.h>
+#include <sipmanagedprofile.h>
+#include <sipmanagedprofileregistry.h>
+#include <sysutil.h>
+#include <wlaninternalpskeys.h>
+#include <pathinfo.h>
+#include <authority16.h>
+#include <StringLoader.h>
+#include <escapeutils.h>
+
+#include "voipxmlutils.h"
+#include "voipxmlsiphandler.h"
+#include "voipxmlprocessorlogger.h"
+#include "voipxmlprocessordefaults.h"
+
+// ---------------------------------------------------------------------------
+// CVoipXmlSipHandler::CVoipXmlSipHandler
+// ---------------------------------------------------------------------------
+//
+CVoipXmlSipHandler::CVoipXmlSipHandler()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlSipHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CVoipXmlSipHandler* CVoipXmlSipHandler::NewL()
+    {
+    CVoipXmlSipHandler* self = new ( ELeave ) CVoipXmlSipHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlSipHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlSipHandler::ConstructL()
+    {
+    DBG_PRINT( "CVoipXmlSipHandler::ConstructL begin" );
+
+    // SIP Managed Profile Registry.
+    iRegistry = CSIPManagedProfileRegistry::NewL( *this );
+
+    // Create an empty SIP profile in which all settings will be set.
+    iProfileType.iSIPProfileClass = TSIPProfileTypeInfo::EInternet;
+    iProfileType.iSIPProfileName.Copy( KIetf() );
+    iProfile = iRegistry->CreateL( iProfileType );
+
+    iProxyUri           = HBufC8::NewL( KMaxNodeValueLength );
+    iProxyTransport     = EAutomatic;
+    iProxyPort          = KErrNotFound;
+    iLr                 = EFalse;
+    iRegistrarUri       = HBufC8::NewL( KMaxNodeValueLength );
+    iRegistrarTransport = EAutomatic;
+    iRegistrarPort      = KErrNotFound;
+
+    const TInt ipTosShift( 2 );
+    const TUint32 tosBits( KDefaultSigQos << ipTosShift );
+    iProfile->SetParameter( KSIPSoIpTOS, tosBits );
+
+    DBG_PRINT( "CVoipXmlSipHandler::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlSipHandler::~CVoipXmlSipHandler
+// ---------------------------------------------------------------------------
+//
+CVoipXmlSipHandler::~CVoipXmlSipHandler()
+    {
+    delete iProfile;
+    delete iRegistry;
+    delete iProxyUri;
+    delete iRegistrarUri;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets SIP setting.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlSipHandler::SetSetting( TInt aType, TInt aParam, 
+    const TDesC8& aValue )
+    {
+    // Ignore too long descriptors.
+    if ( KMaxNodeValueLength < aValue.Length() )
+        {
+        return;
+        }
+
+    switch ( aParam )
+        {
+        case EName:
+            {
+            TRAPD( err, CreateProviderNameL( aValue ) );
+            if ( KErrNone == err )
+                {
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case ESignalingQos:
+            {
+            // We need to do bitshifting on the IP TOS, because it's the 
+            // upper 6 bits that are set and settings provide us the IP TOS
+            // as the lower 6 bits.
+            // The lower 2 bits are reserver for explicit congestion
+            // notification. 
+            // See also more from:
+            // Symbian Developer Library 
+            //    => in_sock.h Global variables
+            //       => KSoIpTOS
+            const TInt ipTosShift( 2 );
+            TInt value( KErrNotFound );
+            // don't need to check return value because 'TInt value' is checked
+            // coverity[check_return] coverity[unchecked_value]
+            VoipXmlUtils::Des8ToInt( aValue, value );
+            if ( 0 <= value )
+                {
+                const TUint32 tosBits( value << ipTosShift );
+                iProfile->SetParameter( KSIPSoIpTOS, tosBits );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EType:
+            {
+            TBuf8<KMaxNodeValueLength> value;
+            value.Copy( aValue );
+            value.UpperCase();
+            if ( 0 == value.Compare( KIms() ) )
+                {
+                iProfileType.iSIPProfileClass = TSIPProfileTypeInfo::EIms;
+                value.LowerCase();
+                iProfileType.iSIPProfileName.Copy( value );
+                iProfile->SetType( iProfileType );
+                iSettingsSet = ETrue;
+                }
+            else if ( 0 == value.Compare( KIetf() ) )
+                {
+                iProfileType.iSIPProfileClass = 
+                    TSIPProfileTypeInfo::EInternet;
+                iProfileType.iSIPProfileName.Copy( value );
+                iProfile->SetType( iProfileType );
+                iSettingsSet = ETrue;
+                }
+            else
+                {
+                iProfileType.iSIPProfileClass = TSIPProfileTypeInfo::EOther;
+                iProfileType.iSIPProfileName.Copy( aValue );
+                iProfile->SetType( iProfileType );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EPublicUserId:
+            {
+            TBuf8<KMaxNodeValueLength> value;
+            value.Copy( aValue );
+            TRAPD( err, ModifyPuidL( value ) );
+            if ( KErrNone == err )
+                {
+                iProfile->SetParameter( KSIPUserAor, value );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case ESignalCompression:
+            {
+            TInt value;
+            if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) )
+                {
+                iProfile->SetParameter( KSIPSigComp, (TBool)value );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case ESecurityNegotiation:
+            {
+            TInt value;
+            if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) )
+                {
+                iProfile->SetParameter( 
+                    KSIPSecurityNegotiation, (TBool)value );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EProfileLock:
+            {
+            TInt value;
+            if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) )
+                {
+                iProfile->SetParameter( KSIPProfileLocked, (TBool)value );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EAutoRegistration:
+            {
+            TInt value;
+            if ( KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) )
+                {
+                iProfile->SetParameter( KSIPAutoRegistration, (TBool)value );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EUri:
+            {
+            TBuf8<KMaxNodeValueLength> tempBuf( KNullDesC8 );
+            if ( 0 != aValue.Find( KSip() ) &&
+                0 != aValue.Find( KSips() ) )
+                {
+                tempBuf.Copy( KSip() );
+                }
+            tempBuf.Append( aValue );
+            //lint -e{960} No need for else statement here
+            if ( EProxy == aType )
+                {
+                iProxyUri->Des().Copy( tempBuf );
+                iSettingsSet = ETrue;
+                }
+            else if ( ERegistrar == aType )
+                {
+                iRegistrarUri->Des().Copy( tempBuf );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case ETransport:
+            {
+            //lint -e{960} No need for else statement here
+            if ( EProxy == aType )
+                {
+                iProxyTransport = ValidateTransport( aValue );
+                iSettingsSet = ETrue;
+                }
+            else if ( ERegistrar == aType )
+                {
+                iRegistrarTransport = ValidateTransport( aValue );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EPort:
+            {
+            TInt value;
+            TInt err = VoipXmlUtils::Des8ToInt( aValue, value );
+            //lint -e{960} No need for else statement here
+            if ( EProxy == aType && KErrNone == err )
+                {
+                iProxyPort = value;
+                iSettingsSet = ETrue;
+                }
+            else if ( ERegistrar == aType && KErrNone == err )
+                {
+                iRegistrarPort = value;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case ELooseRouting:
+            {
+            TInt value;
+            if ( EProxy == aType && 
+                KErrNone == VoipXmlUtils::Des8ToInt( aValue, value ) )
+                {
+                iLr = (TBool)value;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EUsername:
+            {
+            //lint -e{960} No need for else statement here
+            if ( EProxy == aType )
+                {
+                if ( TSIPProfileTypeInfo::EInternet == 
+                    iProfileType.iSIPProfileClass )
+                    {
+                    iProfile->SetParameter( KSIPOutboundProxy, 
+                        KSIPDigestUserName, aValue );
+                    iSettingsSet = ETrue;
+                    }
+                else
+                    {
+                    iProfile->SetParameter( KSIPPrivateIdentity, aValue );
+                    iSettingsSet = ETrue;
+                    }
+                }
+            else if ( ERegistrar == aType )
+                {
+                if ( TSIPProfileTypeInfo::EInternet == 
+                    iProfileType.iSIPProfileClass )
+                    {
+                    iProfile->SetParameter( KSIPRegistrar, KSIPDigestUserName,
+                        aValue );
+                    iSettingsSet = ETrue;
+                    }
+                else
+                    {
+                    iProfile->SetParameter( KSIPPrivateIdentity, aValue );
+                    iSettingsSet = ETrue;
+                    }
+                }
+            break;
+            }
+        case EPassword:
+            {
+            //lint -e{960} No need for else statement here
+            if ( EProxy == aType )
+                {
+                iProfile->SetParameter( KSIPOutboundProxy, KSIPDigestPassword,
+                    aValue );
+                iSettingsSet = ETrue;
+                }
+            else if ( ERegistrar == aType )
+                {
+                iProfile->SetParameter( KSIPRegistrar, KSIPDigestPassword,
+                    aValue );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Stores settings to SIP managed profile registry.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipXmlSipHandler::StoreSettings()
+    {
+    if ( !iSettingsSet )
+        {
+        // No settings to be stored => method not supported.
+        return KErrNotSupported;
+        }
+
+    TBuf8<KMaxNodeValueLength> tempBuf( KNullDesC8 );
+
+    // ==============================
+    // Set components to proxy URI.
+    // ==============================
+    //
+    if ( KErrNotFound != iProxyPort )
+        {
+        tempBuf.Copy( KColon() );
+        tempBuf.AppendNum( iProxyPort );
+        }
+    //lint -e{960} No need for else statement here
+    if ( EUdp == iProxyTransport )
+        {
+        tempBuf.Append( KTransport() );
+        tempBuf.Append( KUdp() );
+        }
+    else if ( ETcp == iProxyTransport )
+        {
+        tempBuf.Append( KTransport() );
+        tempBuf.Append( KTcp() );
+        }
+    else if ( ETls == iProxyTransport )
+        {
+        tempBuf.Append( KTransport() );
+        tempBuf.Append( KTls() );
+        }
+    if ( iLr )
+        {
+        tempBuf.Append( KLr() );
+        }
+
+    if ( iProxyUri->Des().MaxLength() >= 
+        ( iProxyUri->Des().Length() + tempBuf.Length() ) )
+        {
+        iProxyUri->Des().Append( tempBuf );
+        }
+    iProfile->SetParameter( KSIPOutboundProxy, KSIPServerAddress, 
+        iProxyUri->Des() );
+
+    // ==============================
+    // Set components to registrar URI.
+    // ==============================
+    //
+    tempBuf.Zero();
+    if ( KErrNotFound != iRegistrarPort )
+        {
+        tempBuf.Copy( KColon() );
+        tempBuf.AppendNum( iRegistrarPort );
+        }
+    //lint -e{960} No need for else statement here
+    if ( EUdp == iRegistrarTransport )
+        {
+        tempBuf.Append( KTransport() );
+        tempBuf.Append( KUdp() );
+        }
+    else if ( ETcp == iRegistrarTransport )
+        {
+        tempBuf.Append( KTransport() );
+        tempBuf.Append( KTcp() );
+        }
+    else if ( ETls == iProxyTransport )
+        {
+        tempBuf.Append( KTransport() );
+        tempBuf.Append( KTls() );
+        }
+    if ( iRegistrarUri->Des().MaxLength() >= 
+        ( iRegistrarUri->Des().Length() + tempBuf.Length() ) )
+        {
+        iRegistrarUri->Des().Append( tempBuf );
+        }
+    iProfile->SetParameter( KSIPRegistrar, KSIPServerAddress, 
+        iRegistrarUri->Des() );
+
+    TRAPD( err, iRegistry->SaveL( *iProfile ) );
+    if ( KErrNone != err )
+        {
+        // No need for specifying what went wrong because paramhandler
+        // is only intrested in KErrNotSupported, KErrCompletion and KErrNone.
+        err = KErrCompletion;
+        }
+    // Store SIP settings ID for later use.
+    iProfile->GetParameter( KSIPProfileId, iProfileId );
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the profile ID if the profile saved in StoreSettings.
+// ---------------------------------------------------------------------------
+//
+TUint32 CVoipXmlSipHandler::SettingsId()
+    {
+    return iProfileId;
+    }
+
+// ---------------------------------------------------------------------------
+// Saves linkage information.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlSipHandler::LinkSettings( TInt aType, TUint32 aSettingsId )
+    {
+    if ( EDestination == aType && aSettingsId )
+        {
+        iProfile->SetParameter( KSIPSnapId, aSettingsId );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Finalizes settings saving.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipXmlSipHandler::FinalizeSettings()
+    {
+    TRAPD( err, iRegistry->SaveL( *iProfile ) );
+    if ( KErrNone != err )
+        {
+        // ParamHandler is only intrested in KErrNone and KErrCompletion.
+        err = KErrCompletion;
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlSipHandler::ProfileRegistryEventOccurred( 
+    TUint32 /*aSIPProfileId*/, TEvent /*aEvent*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver. 
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlSipHandler::ProfileRegistryErrorOccurred( 
+    TUint32 /*aSIPProfileId*/, TInt /*aError*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlSipHandler::CreateProviderNameL
+// Checks if duplicate named SIP profiles. Renames if same.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlSipHandler::CreateProviderNameL( const TDesC8& aName )
+    {
+    DBG_PRINT( "CVoipXmlSipHandler::CreateProviderNameL begin" );
+    
+    const TInt maxModifyLength = 
+        KMaxNodeNameLength - KMaxProfileNameAppendLength;
+    
+    RPointerArray<CSIPProfile> profiles;
+    CleanupResetAndDestroyL( profiles ); // CS:1
+    
+    // Get all profiles based on profile types.
+    iRegistry->ProfilesL( profiles );
+    const TInt profileCount = profiles.Count();
+    
+    // Go through loaded profiles and check for name duplicates.
+    HBufC8* name = HBufC8::NewLC( KMaxNodeNameLength ); // CS:2
+    name->Des().Copy( aName.Left( maxModifyLength ) );
+    TUint i( 1 ); // Add number to the name if name already in use.
+    const TInt count( profiles.Count() );
+    for ( TInt counter = 0; counter < count; counter++ )
+        {
+        CSIPManagedProfile* profile = 
+            static_cast<CSIPManagedProfile*>( profiles[counter] );
+        const TDesC8* existingName;
+        profile->GetParameter( KSIPProviderName, existingName );
+        if ( 0 == existingName->Compare( *name ) )
+            {
+            name->Des().Copy( aName.Left( maxModifyLength ) );
+            name->Des().Append( KOpenParenthesis8() );
+            name->Des().AppendNum( i );
+            name->Des().Append( KClosedParenthesis8() );  
+            counter = 0;
+            i++;
+            if ( KMaxProfileNames < i )
+                {
+                User::Leave( KErrBadName );
+                }
+            }
+        }
+    iProfile->SetParameter( KSIPProviderName, name->Des() );
+
+    // name, &profiles
+    CleanupStack::PopAndDestroy( 2, &profiles ); // CS:0
+    DBG_PRINT( "CVoipXmlSipHandler::CreateProviderNameL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// Modifies public user ID, i.e. escapes and adds sip: prefix if necessary.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlSipHandler::ModifyPuidL( TDes8& aValue )
+    {
+    if ( KErrNotFound == aValue.Find( KEscaped() ) )
+        {
+        HBufC8* tempPuid = EscapeUtils::EscapeEncodeL( aValue,
+            EscapeUtils::EEscapeNormal );
+        aValue.Copy( tempPuid->Des() );
+        delete tempPuid;
+        tempPuid = NULL;
+        }
+    if ( 0 != aValue.Find( KSip() ) && 0 != aValue.Find( KSips() ) )
+        {
+        if ( aValue.MaxLength() >= ( aValue.Length() + KSip().Length() ) )
+            {
+            aValue.Insert( 0, KSip() );
+            }
+        else
+            {
+            User::Leave( KErrTooBig );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Validates transport type.
+// ---------------------------------------------------------------------------
+//
+CVoipXmlSipHandler::TTransportType CVoipXmlSipHandler::ValidateTransport( 
+    const TDesC8& aValue )
+    {
+    TBuf8<KMaxNodeValueLength> value;
+    value.Copy( aValue );
+    value.UpperCase();
+    if ( 0 == value.Compare( KUdp() ) )
+        {
+        return EUdp;
+        }
+    else if ( 0 == value.Compare( KTcp() ) )
+        {
+        return ETcp;
+        }
+    else if ( 0 == value.Compare( KTls() ) )
+        {
+        return ETls;
+        }
+    else
+        {
+        return EAutomatic;
+        }
+    }
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlutils.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utilities class for VoIP XML processor
+*
+*/
+
+
+//#include <e32base.h>
+#include "voipxmlutils.h"
+
+
+// ---------------------------------------------------------------------------
+// VoipXmlUtils::DesToInt()
+// ---------------------------------------------------------------------------
+//
+TInt VoipXmlUtils::DesToInt( const TDesC& aDesValue, TInt& aIntValue )
+    {
+    TLex lex( aDesValue );
+    return lex.Val( aIntValue );
+    }
+
+// ---------------------------------------------------------------------------
+// VoipXmlUtils::DesToInt()
+// ---------------------------------------------------------------------------
+//
+TInt VoipXmlUtils::Des8ToInt( const TDesC8& aDesValue, TInt& aIntValue )
+    {
+    TLex8 lex( aDesValue );
+    return lex.Val( aIntValue );
+    }
+
+// End of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlvoiphandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,1311 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  VoIP settings handler
+*
+*/
+
+
+#include <crcseaudiocodecregistry.h>
+#include <crcseprofileregistry.h>
+#include <spsettings.h>
+#include <spproperty.h>
+#include <spdefinitions.h>
+#include <sipmanagedprofile.h>
+#include <sipmanagedprofileregistry.h>
+#include <cipappphoneutils.h>           // SIP User-Agent header info.
+#include <cipapputilsaddressresolver.h> // SIP User-Agent header info.
+#include <pathinfo.h>                   // For getting phone rom root path.
+#include <cvimpstsettingsstore.h>       // For IM tone path
+#include <settingsinternalcrkeys.h>     // For default service.
+#include <centralrepository.h>          // For default service.
+
+#include "voipxmlvoiphandler.h"
+#include "voipxmlprocessorlogger.h"
+#include "voipxmlprocessordefaults.h"
+#include "voipxmlutils.h"
+
+const TInt32 KCCHPresenceSubServicePlugId = 0x1027545A;
+// IM related constants.
+const TUint32 KIMSubServicePluginId = 0x1027545A;
+const TUint32 KIMLaunchUid          = 0x200255D0;
+const TInt    KIMSettingsId         = 1;
+// Default IM message tone
+_LIT( KDefaultTone,       "Message 2.aac" );
+// Brand related constants.
+const TInt KBrandVersion = 1;
+
+// ---------------------------------------------------------------------------
+// Default constructor.
+// ---------------------------------------------------------------------------
+//
+CVoipXmlVoipHandler::CVoipXmlVoipHandler()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::ConstructL()
+    {
+    DBG_PRINT( "CVoipXmlVoipHandler::ConstructL begin" );
+    iRegistry      = CRCSEProfileRegistry::NewL();
+    iCodecRegistry = CRCSEAudioCodecRegistry::NewL();
+    iEntry         = CRCSEProfileEntry::NewL();
+    ResetTempCodec();
+    ResetTempSpSettings();
+    iSettingsSet = EFalse;
+    DBG_PRINT( "CVoipXmlVoipHandler::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CVoipXmlVoipHandler* CVoipXmlVoipHandler::NewL()
+    {
+    DBG_PRINT( "CVoipXmlVoipHandler::NewL begin" );
+    CVoipXmlVoipHandler* self = new ( ELeave ) CVoipXmlVoipHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    DBG_PRINT( "CVoipXmlVoipHandler::NewL end" );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CVoipXmlVoipHandler::~CVoipXmlVoipHandler()
+    {
+    DBG_PRINT( "CVoipXmlVoipHandler::~CVoipXmlVoipHandler begin" );
+    delete iRegistry;
+    delete iCodecRegistry;
+    delete iEntry;
+    ResetTempCodec( ETrue );
+    ResetTempSpSettings();
+    DBG_PRINT( "CVoipXmlVoipHandler::~CVoipXmlVoipHandler end" );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets VoIP setting.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::SetSetting( TInt aType, TInt aParam, 
+    const TDesC& aValue )
+    {
+    // Ignore too long descriptors.
+    if ( KMaxNodeValueLength < aValue.Length() )
+        {
+        return;
+        }
+
+    switch ( aType )
+        {
+        case EVoip:
+            TRAP_IGNORE( SetCoreSettingL( aParam, aValue ) );
+            break;
+        case ECodec:
+            TRAP_IGNORE( SetCodecSettingL( aParam, aValue ) );
+            break;
+        case EVmbx:
+            TRAP_IGNORE( SetVmbxSettingL( aParam, aValue ) );
+            break;
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Stores settings to RCSE.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipXmlVoipHandler::StoreSettings()
+    {
+    TInt err( KErrNone );
+    TBool ok( ETrue );
+
+    if ( !iSettingsSet )
+        {
+        // No settings to be stored => method not supported.
+        err = KErrNotSupported;
+        ok = EFalse;
+        }
+    else
+        {
+        TUint32 profileId( KErrNone );
+        // Add default codec set if no codecs defined.
+        if ( 0 == iEntry->iPreferredCodecs.Count() )
+            {
+            TRAP_IGNORE( AddDefaultCodecsL() );
+            }
+        TRAP( err, profileId = iRegistry->AddL( *iEntry ) );
+        if ( KErrNone == err )
+            {
+            // Adding profile entry to registry OK. Let's load the profile
+            // from registry so that we'll get all the values registry has
+            // added to the entry (AddL takes entry as const reference).
+            TRAP_IGNORE( iRegistry->FindL( profileId, *iEntry ) );
+            iServiceId = iEntry->iServiceProviderId;
+            }
+        else
+            {
+            err = KErrCompletion;
+            ok = EFalse;
+            }
+        }
+    if ( !ok )
+        {
+        const TInt count = iEntry->iPreferredCodecs.Count();
+        for ( TInt counter = 0; counter < count; counter++ )
+            {
+            TRAP_IGNORE( iCodecRegistry->DeleteL( 
+                iEntry->iPreferredCodecs[counter] ) );
+            }
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the service ID.
+// ---------------------------------------------------------------------------
+//
+TUint32 CVoipXmlVoipHandler::SettingsId()
+    {
+    return iServiceId;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets a codec to RCSE and resets the temp codec.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::SettingsEnd( TInt aType )
+    {
+    if ( ECodec == aType )
+        {
+        TRAP_IGNORE( SetCodecToRcseL() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Saves linkage information.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::LinkSettings( TInt aType, TUint32 aSettingsId )
+    {
+    switch ( aType )
+        {
+        case ESip:
+            {
+            TRAP_IGNORE( SetSipInfoL( aSettingsId ) );
+            break;
+            }
+        case EPresence:
+            {
+            iPresenceId = aSettingsId;
+            break;
+            }
+        case EDestination:
+            {
+            iDestinationId = aSettingsId;
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Finalizes settings saving.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipXmlVoipHandler::FinalizeSettings()
+    {
+    TInt err( KErrNone );
+    TRAP( err, SetSpSettingsL() );
+    if ( KErrNone != err )
+        {
+        // ParamHandler is only intrested in KErrNone and KErrCompletion.
+        err = KErrCompletion;
+        }
+    if ( iDefault )
+        {
+        TRAP_IGNORE( SetAsDefaultL() );
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the service tab ID of this VoIP service.
+// ---------------------------------------------------------------------------
+//
+TUint32 CVoipXmlVoipHandler::ServiceTabIdL()
+    {
+    DBG_PRINT( "CVoipXmlVoipHandler::ServiceTabIdL begin" );
+    TInt tabId( KErrNone );
+    CSPSettings* spSettings = CSPSettings::NewLC(); // CS:1
+    CSPProperty* property = CSPProperty::NewLC(); // CS:2
+    TInt err = spSettings->FindPropertyL( 
+        iServiceId, EPropertyContactViewId, *property );
+    User::LeaveIfError( property->GetValue( tabId ) );
+    CleanupStack::PopAndDestroy( 2, spSettings ); // CS:0
+    DBG_PRINT2( "CVoipXmlVoipHandler::ServiceTabIdL end (return %d)", tabId );
+    return (TUint32)tabId;
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::ProfileRegistryEventOccurred( 
+    TUint32 /*aSIPProfileId*/, TEvent /*aEvent*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From class MSIPProfileRegistryObserver. 
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::ProfileRegistryErrorOccurred( 
+    TUint32 /*aSIPProfileId*/, TInt /*aError*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Sets VoIP core setting to temporary storage.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::SetCoreSettingL( TInt aParam, const TDesC& aValue )
+    {
+    TInt intValue( KErrNotFound );
+    switch ( aParam )
+        {
+        case EName:
+            {
+            TBuf<KMaxNodeValueLength> name( KNullDesC );
+            name.Copy( aValue );
+            TRAP_IGNORE( ValidateProfileNameL( name ) );
+            iEntry->iProviderName.Copy( name );
+            iEntry->iSettingsName.Copy( name );
+            iSettingsSet = ETrue;
+            break;
+            }
+        case EStartPort:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iEntry->iStartMediaPort = intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EEndPort:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iEntry->iEndMediaPort = intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EMediaQos:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iEntry->iMediaQOS = intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EDtmfInband:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                TEntryOnOff value;
+                if ( !intValue )
+                    {
+                    value = CRCSEProfileEntry::EOff;
+                    }
+                else if ( KNotSet == intValue )
+                    {
+                    value = CRCSEProfileEntry::EOONotSet;
+                    }
+                else
+                    {
+                    value = CRCSEProfileEntry::EOn;
+                    }
+                iEntry->iInbandDTMF = value;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EDtmfOutband:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                TEntryOnOff value;
+                if ( !intValue )
+                    {
+                    value = CRCSEProfileEntry::EOff;
+                    }
+                else if ( KErrNotFound == intValue )
+                    {
+                    value = CRCSEProfileEntry::EOONotSet;
+                    }
+                else
+                    {
+                    value = CRCSEProfileEntry::EOn;
+                    }
+                iEntry->iOutbandDTMF = value;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case ESecureCallPreference:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iEntry->iSecureCallPreference = intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EAllowVoipOverWcdma:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                TEntryOnOff value;
+                if ( !intValue )
+                    {
+                    value = CRCSEProfileEntry::EOff;
+                    }
+                else if ( KErrNotFound == intValue )
+                    {
+                    value = CRCSEProfileEntry::EOONotSet;
+                    }
+                else
+                    {
+                    value = CRCSEProfileEntry::EOn;
+                    }
+                iEntry->iAllowVoIPoverWCDMA = value;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case ERtcp:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iEntry->iRTCP = intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EUserAgentHeaderTerminalType:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iEntry->iSIPVoIPUAHTerminalType = intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EUserAgentHeaderWlanMac:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iEntry->iSIPVoIPUAHeaderWLANMAC = intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EUserAgentHeaderFreeString:
+            {
+            if ( KMaxSettingsLength32 >= aValue.Length() )
+                {
+                iEntry->iSIPVoIPUAHeaderString.Copy( aValue );
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case ECallerIdDigits:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iEntry->iMeanCountOfVoIPDigits = intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EIgnoreDomainPart:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iEntry->iIgnoreAddrDomainPart = intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EAutoAcceptBuddyRequests:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iSpSettings.iAutoAcceptBuddies = (TBool)intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EAddUserPhone:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                TEntryOnOff value;
+                if ( !intValue )
+                    {
+                    value = CRCSEProfileEntry::EOff;
+                    }
+                else if ( KErrNotFound == intValue )
+                    {
+                    value = CRCSEProfileEntry::EOONotSet;
+                    }
+                else
+                    {
+                    value = CRCSEProfileEntry::EOn;
+                    }
+                iEntry->iUserPhoneUriParameter = value;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EProviderUrl:
+            {
+            if ( !iSpSettings.iProviderUrl )
+                {
+                iSpSettings.iProviderUrl = aValue.AllocL();
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EMinSessionInterval:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iEntry->iSIPMinSE = intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case ESessionInterval:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iEntry->iSIPSessionExpires = intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EBrandingUri:
+            {
+            if ( !iSpSettings.iBrandingUri )
+                {
+                iSpSettings.iBrandingUri = aValue.AllocL();
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EAutoEnable:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iSpSettings.iAutoEnable = (TBool)intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EEnableSipIm:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iSpSettings.iEnableSipIm = (TBool)intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EBrandId:
+            {
+            if ( !iSpSettings.iBrandId )
+                {
+                iSpSettings.iBrandId = aValue.AllocL();
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        case EDefault:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iDefault = (TBool)intValue;
+                iSettingsSet = ETrue;
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets codec setting to temporary storage.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::SetCodecSettingL( TInt aParam, const TDesC& aValue )
+    {
+    TInt intValue;
+    switch ( aParam )
+        {
+        // Codec parameters
+        case EName:
+            {
+            if ( iCurrentCodec.iName )
+                {
+                break;
+                }
+            TBuf<KMaxNodeValueLength> value;
+            value.Copy( aValue );
+            value.UpperCase();
+            if ( 0 == value.Compare( KILbc ) )
+                {
+                value.Copy( KAudioCodeciLBC );
+                }
+            iCurrentCodec.iName = value.AllocL();
+            break;
+            }
+        case EJitterBuffer:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iCurrentCodec.iJitterBuffer = intValue;
+                }
+            break;
+            }
+        case EOctetAlign:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                if ( !intValue )
+                    {
+                    iCurrentCodec.iOctetAlign = CRCSEAudioCodecEntry::EOff;
+                    }
+                else if ( KErrNotFound == intValue )
+                    {
+                    iCurrentCodec.iOctetAlign = 
+                        CRCSEAudioCodecEntry::EOONotSet;
+                    }
+                else
+                    {
+                    iCurrentCodec.iOctetAlign = CRCSEAudioCodecEntry::EOn;
+                    }
+                }
+            break;
+            }
+        case EPTime:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iCurrentCodec.iPtime = intValue;
+                }
+            break;
+            }
+        case EMaxPTime:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iCurrentCodec.iMaxPtime = intValue;
+                }
+            break;
+            }
+        case EModeSet:
+            {
+            TBuf<KMaxNodeNameLength> string;
+            string.Copy( aValue );
+            while ( string.Length() )
+                {
+                TInt offset = string.Locate( KComma );
+                TBuf<KMaxNodeNameLength> helpString( KNullDesC );
+                if ( KErrNotFound == offset )
+                    {
+                    if ( KErrNone == VoipXmlUtils::DesToInt( 
+                        string, intValue ) )
+                        {
+                        iCurrentCodec.iModeSet.AppendL( intValue );
+                        }
+                    string.Zero();
+                    }
+                else if ( !offset )
+                    {
+                    string.Delete( 0, 1 );
+                    }
+                else
+                    {
+                    helpString.Copy( string.Left( offset ) );
+                    if ( KErrNone == VoipXmlUtils::DesToInt( helpString,
+                        intValue ) )
+                        {
+                        iCurrentCodec.iModeSet.AppendL( intValue );
+                        }
+                    offset++;
+                    string.Delete( 0, offset );
+                    }
+                }
+            break;
+            }
+        case EModeChangePeriod:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iCurrentCodec.iModeChangePeriod = intValue;
+                }
+            break;
+            }
+        case EModeChangeNeighbor:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                if ( !intValue )
+                    {
+                    iCurrentCodec.iModeChangeNeighbor = 
+                        CRCSEAudioCodecEntry::EOff;
+                    }
+                else if ( KErrNotFound == intValue )
+                    {
+                    iCurrentCodec.iModeChangeNeighbor = 
+                        CRCSEAudioCodecEntry::EOONotSet;
+                    }
+                else
+                    {
+                    iCurrentCodec.iModeChangeNeighbor = 
+                        CRCSEAudioCodecEntry::EOn;
+                    }
+                }
+            break;
+            }
+        case EMaxRed:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iCurrentCodec.iMaxRed = intValue;
+                }
+            break;
+            }
+        case EVad:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                if ( !intValue )
+                    {
+                    iCurrentCodec.iVad = CRCSEAudioCodecEntry::EOff;
+                    }
+                else if ( KErrNotFound == intValue )
+                    {
+                    iCurrentCodec.iVad = CRCSEAudioCodecEntry::EOONotSet;
+                    }
+                else
+                    {
+                    iCurrentCodec.iVad = CRCSEAudioCodecEntry::EOn;
+                    }
+                }
+            break;
+            }
+        case EAnnexb:
+            {
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                if ( !intValue )
+                    {
+                    iCurrentCodec.iAnnexb = CRCSEAudioCodecEntry::EOff;
+                    }
+                else if ( KErrNotFound == intValue )
+                    {
+                    iCurrentCodec.iAnnexb = CRCSEAudioCodecEntry::EOONotSet;
+                    }
+                else
+                    {
+                    iCurrentCodec.iAnnexb = CRCSEAudioCodecEntry::EOn;
+                    }
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets voice mailbox setting to temporary storage.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::SetVmbxSettingL( TInt aParam, const TDesC& aValue )
+    {
+    switch ( aParam )
+        {
+        case EMwiUri:
+            {
+            if ( !iSpSettings.iMwiUri )
+                {
+                iSpSettings.iMwiUri = aValue.AllocL();
+                }
+            break;
+            }
+        case EListeningUri:
+            {
+            if ( !iSpSettings.iListeningUri )
+                {
+                iSpSettings.iListeningUri = aValue.AllocL();
+                }
+            break;
+            }
+        case EReSubscribeInterval:
+            {
+            TInt intValue;
+            if ( KErrNone == VoipXmlUtils::DesToInt( aValue, intValue ) )
+                {
+                iSpSettings.iResubrcribe = intValue;
+                }
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Checks if name is unique and modifies if needed.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::ValidateProfileNameL( TDes& aName )
+    {
+    const TInt maxModifyLength = 
+        KMaxSettingsNameLength - KMaxProfileNameAppendLength;
+
+    RArray<TUint32> voipIds;
+    CleanupClosePushL( voipIds ); // CS:1
+    iRegistry->GetAllIdsL( voipIds );
+
+    const TInt count( voipIds.Count() );
+
+    HBufC* newName = HBufC::NewLC( KMaxSettingsNameLength ); // CS:2
+    newName->Des().Copy( aName.Left( maxModifyLength ) );
+
+    TUint i( 1 ); // Add number to the name if name already in use.
+
+    // Go through each profile and see if the name of the new profile    
+    // matches one of the existing names. If it does change it and
+    // check the new name again.
+    for ( TInt index = 0; index < count; index++ )
+        {
+        CRCSEProfileEntry* profile = CRCSEProfileEntry::NewLC(); // CS:3
+        TBuf<KMaxSettingsNameLength> loadedName;
+        iRegistry->FindL( voipIds[index], *profile );
+        loadedName.Copy( profile->iSettingsName );
+        if ( 0 == newName->Des().Compare( loadedName ) )
+            {
+            // If the name is changed we need to begin the comparison
+            // again from the first profile.
+            newName->Des().Copy( aName.Left( maxModifyLength ) );
+            newName->Des().Append( KOpenParenthesis() );
+            newName->Des().AppendNum( i );
+            newName->Des().Append( KClosedParenthesis() );  
+            index = 0;
+            i++;
+            if ( KMaxProfileNames < i )
+                {
+                User::Leave( KErrBadName );
+                }
+            }
+        CleanupStack::PopAndDestroy( profile ); // CS:2
+        }
+    
+    aName.Copy( *newName );
+
+    // newName, &voipIds
+    CleanupStack::PopAndDestroy( 2, &voipIds ); // CS:0
+    }
+
+// ---------------------------------------------------------------------------
+// Sets temporary codec to RCSE.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::SetCodecToRcseL()
+    {
+    // Nameless codecs are not supported.
+    if ( !iCurrentCodec.iName )
+        {
+        ResetTempCodec();
+        return;
+        }
+
+    CRCSEAudioCodecEntry* entry = CRCSEAudioCodecEntry::NewLC();
+    // First set default values...
+    entry->SetDefaultCodecValueSet( iCurrentCodec.iName->Des() );
+    // ...and then replace them with the ones defined in settings XML.
+    if ( KErrNotFound != iCurrentCodec.iJitterBuffer )
+        {
+        entry->iJitterBufferSize = iCurrentCodec.iJitterBuffer;
+        }
+    if ( KErrNotFound != iCurrentCodec.iPtime )
+        {
+        entry->iPtime = iCurrentCodec.iPtime;
+        }
+    if ( KErrNotFound != iCurrentCodec.iMaxPtime )
+        {
+        entry->iMaxptime = iCurrentCodec.iMaxPtime;
+        }
+    if ( CRCSEAudioCodecEntry::EOONotSet != iCurrentCodec.iOctetAlign )
+        {
+        entry->iOctetAlign = iCurrentCodec.iOctetAlign;
+        }
+    if ( CRCSEAudioCodecEntry::EOONotSet != 
+        iCurrentCodec.iModeChangeNeighbor )
+        {
+        entry->iModeChangeNeighbor = iCurrentCodec.iModeChangeNeighbor;
+        }
+    if ( KErrNotFound != iCurrentCodec.iModeChangePeriod )
+        {
+        entry->iModeChangePeriod = iCurrentCodec.iModeChangePeriod;
+        }
+    if ( KErrNotFound != iCurrentCodec.iMaxRed )
+        {
+        entry->iMaxRed = iCurrentCodec.iMaxRed;
+        }
+    if ( CRCSEAudioCodecEntry::EOONotSet != iCurrentCodec.iVad )
+        {
+        entry->iVAD = iCurrentCodec.iVad;
+        }
+    if ( CRCSEAudioCodecEntry::EOONotSet != iCurrentCodec.iAnnexb )
+        {
+        entry->iAnnexb = iCurrentCodec.iAnnexb;
+        }
+    if ( iCurrentCodec.iModeSet.Count() )
+        {
+        entry->iModeSet.Reset();
+        const TInt count = iCurrentCodec.iModeSet.Count();
+        for ( TInt counter = 0; counter < count; counter++ )
+            {
+            entry->iModeSet.AppendL( iCurrentCodec.iModeSet[counter] );
+            }
+        }
+
+    TUint32 codecId = iCodecRegistry->AddL( *entry );
+    CleanupStack::PopAndDestroy( entry );
+    iEntry->iPreferredCodecs.AppendL( codecId );
+    ResetTempCodec();
+    }
+
+// ---------------------------------------------------------------------------
+// Resets temporary codec settings.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::ResetTempCodec( TBool aCloseArray )
+    {
+    if ( iCurrentCodec.iName )
+        {
+        delete iCurrentCodec.iName;
+        iCurrentCodec.iName = NULL;
+        }
+    iCurrentCodec.iJitterBuffer       = KErrNotFound;
+    iCurrentCodec.iOctetAlign         = CRCSEAudioCodecEntry::EOONotSet;
+    iCurrentCodec.iPtime              = KErrNotFound;
+    iCurrentCodec.iMaxPtime           = KErrNotFound;
+    iCurrentCodec.iModeChangePeriod   = KErrNotFound;
+    iCurrentCodec.iModeChangeNeighbor = CRCSEAudioCodecEntry::EOONotSet;
+    iCurrentCodec.iMaxRed             = KErrNotFound;
+    iCurrentCodec.iVad                = CRCSEAudioCodecEntry::EOONotSet;
+    iCurrentCodec.iAnnexb             = CRCSEAudioCodecEntry::EOONotSet;
+    iCurrentCodec.iModeSet.Reset();
+    if ( aCloseArray )
+        {
+        iCurrentCodec.iModeSet.Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Resets temporary service provider settings.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::ResetTempSpSettings()
+    {
+    iSpSettings.iAutoAcceptBuddies = EFalse;
+    iSpSettings.iAutoEnable        = EFalse;
+    iSpSettings.iResubrcribe = KDefaultResubscribe;
+    if ( iSpSettings.iBrandingUri )
+        {
+        delete iSpSettings.iBrandingUri;
+        iSpSettings.iBrandingUri = NULL;
+        }
+    if ( iSpSettings.iListeningUri )
+        {
+        delete iSpSettings.iListeningUri;
+        iSpSettings.iListeningUri = NULL;
+        }
+    if ( iSpSettings.iMwiUri )
+        {
+        delete iSpSettings.iMwiUri;
+        iSpSettings.iMwiUri = NULL;
+        }
+    if ( iSpSettings.iProviderUrl )
+        {
+        delete iSpSettings.iProviderUrl;
+        iSpSettings.iProviderUrl = NULL;
+        }
+    if ( iSpSettings.iBrandId )
+        {
+        delete iSpSettings.iBrandId;
+        iSpSettings.iBrandId = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets SIP related VoIP settings.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::SetSipInfoL( TUint32 aSipId )
+    {
+    // First set SIP information to RCSE so that
+    // an entry in service table will be created.
+    TSettingIds settingIds;
+    settingIds.iProfileType = CRCSEProfileEntry::EProtocolSIP; // SIP.
+    settingIds.iProfileId = aSipId;
+    // Never reference to profile specific settings.
+    settingIds.iProfileSpecificSettingId = KNotSet;
+    iEntry->iIds.AppendL( settingIds );
+    iRegistry->UpdateL( iEntry->iId, *iEntry );
+
+    // After update, we'll need to load the profile again from registry
+    // so that we'll get all the values registry has added to the entry
+    // (UpdateL takes entry as const reference).
+    TUint32 profileId = iEntry->iId;
+    iRegistry->FindL( profileId, *iEntry );
+    iServiceId = iEntry->iServiceProviderId;
+
+    // Compile and set User-Agent header.
+    CSIPManagedProfileRegistry* sipReg = CSIPManagedProfileRegistry::NewLC( 
+        *this ); // CS:1
+    CSIPManagedProfile* sipProf = static_cast<CSIPManagedProfile*>( 
+        sipReg->ProfileL( aSipId ) );
+
+    if ( sipProf )
+        {
+        CleanupStack::PushL( sipProf ); // CS:2
+
+        TBuf8<KMaxUserAgentHeaderLength> userAgentString( KNullDesC8 );
+
+        if ( iEntry->iSIPVoIPUAHTerminalType || 
+            iEntry->iSIPVoIPUAHeaderWLANMAC || 
+            iEntry->iSIPVoIPUAHeaderString.Length() != 0 )
+            {
+            // Set this to be an user-agent param.
+            userAgentString.Append( KUserAgent );
+            userAgentString.Append( KColon );
+            userAgentString.Append( KSpace );
+
+            // Set terminal type if eanbled.
+            if ( iEntry->iSIPVoIPUAHTerminalType )
+                {
+                CIpAppPhoneUtils* util = CIpAppPhoneUtils::NewLC(); // CS:3
+                TBuf<KMaxTerminalTypeLength> terminalType( KNullDesC );
+                util->GetTerminalTypeL( terminalType );
+                userAgentString.Append( terminalType );
+                userAgentString.Append( KSpace );
+                CleanupStack::PopAndDestroy( util ); // CS:2
+                }
+
+            // Set WLAN MAC address if enabled.
+            if ( iEntry->iSIPVoIPUAHeaderWLANMAC )
+                {
+                CIPAppUtilsAddressResolver* resolver = 
+                    CIPAppUtilsAddressResolver::NewLC(); // CS:3
+                _LIT8( KFormatType, "-" );
+                TBuf8<KMaxWlanMacAddressLength> wlanMACAddress( KNullDesC8 );
+                resolver->GetWlanMACAddress( wlanMACAddress, KFormatType );
+                userAgentString.Append( wlanMACAddress );
+                userAgentString.Append( KSpace );
+                CleanupStack::PopAndDestroy( resolver ); // CS:2
+                }
+
+            // Set free string if enabled.
+            if ( iEntry->iSIPVoIPUAHeaderString.Length() )
+                {
+                userAgentString.Append( iEntry->iSIPVoIPUAHeaderString );
+                }
+            }
+
+        // Set new user agent header data to profile.
+        CDesC8ArrayFlat* array = new ( ELeave ) 
+            CDesC8ArrayFlat( KUserAgentHeaderDataArrayInitSize );
+        CleanupStack::PushL( array ); // CS:3
+        array->AppendL( userAgentString );
+        sipProf->SetParameter( KSIPHeaders, *array );
+        sipReg->SaveL( *sipProf );
+        // array, profile
+        CleanupStack::PopAndDestroy( 2, sipProf ); // CS:1
+        }
+    CleanupStack::PopAndDestroy( sipReg ); // CS:0
+    }
+
+// ---------------------------------------------------------------------------
+// Sets SPSettings to service table.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::SetSpSettingsL()
+    {
+    TInt serviceId = iEntry->iServiceProviderId;
+    if ( 0 == serviceId || !iEntry->iIds.Count() )
+        {
+        return;
+        }
+    CSPSettings* spSettings = CSPSettings::NewLC(); // CS:1
+    CSPProperty* property = CSPProperty::NewLC(); // CS:2
+
+    // ==============================
+    // Voice mailbox settings.
+    // ==============================
+    //
+
+    TBool vmbx( EFalse );
+
+    // Set MWI URI if present.
+    //lint -e{960} No need for else statement here
+    if ( iSpSettings.iMwiUri )
+        {
+        property->SetName( ESubPropertyVMBXMWIAddress );
+        property->SetValue( iSpSettings.iMwiUri->Des() );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        // Set the same value to Listening URI if it has no value.
+        if ( !iSpSettings.iListeningUri )
+            {
+            iSpSettings.iListeningUri = iSpSettings.iMwiUri->Des().AllocL();
+            }
+        vmbx = ETrue;
+        }
+    // If there is no MWI URI but listening URI is present, set it as MWI URI.
+    else if ( iSpSettings.iListeningUri )
+        {
+        property->SetName( ESubPropertyVMBXMWIAddress );
+        property->SetValue( iSpSettings.iListeningUri->Des() );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        vmbx = ETrue;
+        }
+
+    // Set Listening URI if present. This is a separate statement since 
+    // the Listening URI may have been configured when setting MWI URI.
+    if ( iSpSettings.iListeningUri )
+        {
+        property->SetName( ESubPropertyVMBXListenAddress );
+        property->SetValue( iSpSettings.iListeningUri->Des() );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        vmbx = ETrue;
+        }
+
+    if ( vmbx )
+        {
+        property->SetName( ESubPropertyVMBXMWISubscribeInterval );
+        property->SetValue( iSpSettings.iResubrcribe );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+
+        property->SetName( ESubPropertyVMBXSettingsId );
+        property->SetValue( iEntry->iIds[0].iProfileId );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        }
+
+    // ==============================
+    // "Core" Service Provider Settings.
+    // ==============================
+    //
+
+    if ( iSpSettings.iProviderUrl )
+        {
+        property->SetName( EPropertyServiceBookmarkUri );
+        property->SetValue( iSpSettings.iProviderUrl->Des() );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        }
+
+    if ( iSpSettings.iBrandingUri )
+        {
+        property->SetName( ESubPropertyVoIPBrandDataUri );
+        property->SetValue( iSpSettings.iBrandingUri->Des() );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        }
+
+    if ( iPresenceId )
+        {
+        property->SetName( ESubPropertyPresenceSettingsId );
+        property->SetValue( iPresenceId );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+
+        // Converged Connection Handler (CCH) Presence Subservice plug-in UID
+        property->SetName( EPropertyPresenceSubServicePluginId );
+        property->SetValue( KCCHPresenceSubServicePlugId );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+
+        // SIP IM enabled
+        if ( iSpSettings.iEnableSipIm )
+            {
+            // Set IM as enabled.
+            property->SetName( ESubPropertyIMEnabled );
+            property->SetValue( EOn );
+            spSettings->AddOrUpdatePropertyL( serviceId, *property );
+            // Set IM launch UID.
+            property->SetName( ESubPropertyIMLaunchUid );
+            property->SetValue( KIMLaunchUid );
+            spSettings->AddOrUpdatePropertyL( serviceId, *property );
+            // The value only needs to be different from 0,
+            // no-one actually uses it.
+            property->SetName( ESubPropertyIMSettingsId );
+            property->SetValue( KIMSettingsId );
+            spSettings->AddOrUpdatePropertyL( serviceId, *property );
+            // Set IM plugin UID.
+            property->SetName( EPropertyIMSubServicePluginId );
+            property->SetValue( KIMSubServicePluginId );
+            spSettings->AddOrUpdatePropertyL( serviceId, *property );
+            // Set default IM tone.
+            TFileName toneFile;
+            toneFile.Copy( PathInfo::RomRootPath() );
+            toneFile.Append( PathInfo::DigitalSoundsPath() );
+            toneFile.Append( KDefaultTone );
+            MVIMPSTSettingsStore* vimpStSettings =
+                CVIMPSTSettingsStore::NewLC(); // CS:3
+            vimpStSettings->SetL( serviceId,
+                EServiceToneFileName, toneFile );
+            // Pop vimpStSettings (can't use M object as argument).
+            CleanupStack::PopAndDestroy(); // CS:2
+            }
+        }
+
+    if ( iSpSettings.iAutoAcceptBuddies )
+        {
+        property->SetName( ESubPropertyPresenceRequestPreference );
+        property->SetValue( EOn );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        }
+
+    if ( iDestinationId )
+        {
+        property->SetName( ESubPropertyVoIPPreferredSNAPId );
+        property->SetValue( iDestinationId );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        if ( iSpSettings.iEnableSipIm )
+            {
+            property->SetName( ESubPropertyIMPreferredSNAPId );
+            property->SetValue( iDestinationId );
+            spSettings->AddOrUpdatePropertyL( serviceId, *property );
+            }
+        }
+
+    if ( iSpSettings.iBrandId )
+        {
+        // Brand version.
+        property->SetName( EPropertyBrandVersion );
+        property->SetValue( KBrandVersion );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        // Brand language.
+        property->SetName( EPropertyBrandLanguage );
+        property->SetValue( ELangInternationalEnglish );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        // Brand ID.
+        property->SetName( EPropertyBrandId );
+        property->SetValue( iSpSettings.iBrandId->Des() );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        }
+
+    if ( iSpSettings.iAutoEnable )
+        {
+        property->SetName( ESubPropertyVoIPEnabled );
+        property->SetValue( EOn );
+        spSettings->AddOrUpdatePropertyL( serviceId, *property );
+        // Also set voicemailbox on if it's defined.
+        if ( vmbx )
+            {
+            property->SetName( ESubPropertyVMBXEnabled );
+            property->SetValue( EOn );
+            spSettings->AddOrUpdatePropertyL( serviceId, *property );
+            }
+        // Also set presence on if there is a presence link.
+        if ( iPresenceId )
+            {
+            property->SetName( ESubPropertyPresenceEnabled );
+            property->SetValue( EOn );
+            spSettings->AddOrUpdatePropertyL( serviceId, *property );
+            }
+        }
+
+    // property, spSettings
+    CleanupStack::PopAndDestroy( 2, spSettings ); // CS:0
+    }
+
+// ---------------------------------------------------------------------------
+// Creates default codecs.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::AddDefaultCodecsL()
+    {
+    CRCSEAudioCodecEntry* codec = CRCSEAudioCodecEntry::NewLC();
+
+    TUint32 codecId( KErrNone );
+
+    codec->SetDefaultCodecValueSet( KAudioCodecAMRWB() );
+    codecId = iCodecRegistry->AddL( *codec );
+    iEntry->iPreferredCodecs.AppendL( codecId );
+
+    codec->SetDefaultCodecValueSet( KAudioCodecAMR() );
+    codecId = iCodecRegistry->AddL( *codec );
+    iEntry->iPreferredCodecs.AppendL( codecId );
+
+    codec->SetDefaultCodecValueSet( KAudioCodecPCMU() );
+    codecId = iCodecRegistry->AddL( *codec );
+    iEntry->iPreferredCodecs.AppendL( codecId );
+
+    codec->SetDefaultCodecValueSet( KAudioCodecPCMA() );
+    codecId = iCodecRegistry->AddL( *codec );
+    iEntry->iPreferredCodecs.AppendL( codecId );
+
+    codec->SetDefaultCodecValueSet( KAudioCodeciLBC() );
+    codecId = iCodecRegistry->AddL( *codec );
+    iEntry->iPreferredCodecs.AppendL( codecId );
+
+    codec->SetDefaultCodecValueSet( KAudioCodecG729() );
+    codecId = iCodecRegistry->AddL( *codec );
+    iEntry->iPreferredCodecs.AppendL( codecId );
+
+    codec->SetDefaultCodecValueSet( KAudioCodecCN() );
+    codecId = iCodecRegistry->AddL( *codec );
+    iEntry->iPreferredCodecs.AppendL( codecId );
+
+    CleanupStack::PopAndDestroy( codec );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the service as default service and preferred telephony as PS.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlVoipHandler::SetAsDefaultL()
+    {
+    // Set the preferred service ID and preferred telephony as PS.
+    CRepository* repository = CRepository::NewL( KCRUidRichCallSettings );
+    repository->Set( KRCSPSPreferredService, (TInt)iServiceId );
+    repository->Set( KRCSEPreferredTelephony, 1 );
+    delete repository;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmlxdmhandler.cpp	Wed Sep 01 12:29:57 2010 +0100
@@ -0,0 +1,220 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  XDM handler for VoIP XML processor
+*
+*/
+
+
+#include <e32cmn.h>
+#include <coecntrl.h>
+#include <XdmSettingsApi.h>
+#include <XdmSettingsCollection.h>
+#include <sysutil.h>
+#include <pathinfo.h>
+#include <authority16.h>
+#include <StringLoader.h>
+#include <escapeutils.h>
+
+#include "voipxmlutils.h"
+#include "voipxmlxdmhandler.h"
+#include "voipxmlprocessorlogger.h"
+#include "voipxmlprocessordefaults.h"
+
+// ---------------------------------------------------------------------------
+// CVoipXmlXdmHandler::CVoipXmlXdmHandler
+// ---------------------------------------------------------------------------
+//
+CVoipXmlXdmHandler::CVoipXmlXdmHandler()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlXdmHandler::NewL
+// ---------------------------------------------------------------------------
+//
+CVoipXmlXdmHandler* CVoipXmlXdmHandler::NewL()
+    {
+    CVoipXmlXdmHandler* self = new ( ELeave ) CVoipXmlXdmHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlXdmHandler::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlXdmHandler::ConstructL()
+    {
+    DBG_PRINT( "CVoipXmlXdmHandler::ConstructL begin" );
+    iProfile = new (ELeave) CXdmSettingsCollection();
+    iProfile->AppendL( KDefaultXdmAuthType, EXdmPropAuthType );
+    iProfile->AppendL( KDefaultXdmUri, EXdmPropUri );
+    DBG_PRINT( "CVoipXmlXdmHandler::ConstructL end" );
+    }
+
+// ---------------------------------------------------------------------------
+// CVoipXmlXdmHandler::~CVoipXmlXdmHandler
+// ---------------------------------------------------------------------------
+//
+CVoipXmlXdmHandler::~CVoipXmlXdmHandler()
+    {
+    delete iProfile;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets XDM setting.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlXdmHandler::SetSetting( TInt aParam, const TDesC& aValue )
+    {
+    // Ignore too long descriptors.
+    if ( KMaxNodeValueLength < aValue.Length() )
+        {
+        return;
+        }
+
+    TRAP_IGNORE( SetSettingL( aParam, aValue ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Stores settings through XDM settings API.
+// ---------------------------------------------------------------------------
+//
+TInt CVoipXmlXdmHandler::StoreSettings()
+    {
+    if ( !iSettingsSet )
+        {
+        // No settings to be stored => method not supported.
+        return KErrNotSupported;
+        }
+    TRAPD( err, iProfileId = TXdmSettingsApi::CreateCollectionL( *iProfile ));
+    if ( KErrNone != err )
+        {
+        err = KErrCompletion;
+        }
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the profile ID if the profile saved in StoreSettings.
+// ---------------------------------------------------------------------------
+//
+TUint32 CVoipXmlXdmHandler::SettingsId()
+    {
+    return iProfileId;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets XDM setting.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlXdmHandler::SetSettingL( TInt aParam, const TDesC& aValue )
+    {
+    switch ( aParam )
+        {
+        case EName:
+            {
+            TBuf<KMaxNodeValueLength> name( KNullDesC );
+            name.Copy( aValue );
+            CreateProviderNameL( name );
+            iProfile->AppendL( name, EXdmPropName );
+            iSettingsSet = ETrue;
+            break;
+            }
+        case EType:
+            {
+            // First remove default value.
+            iProfile->RemoveL( EXdmPropAuthType );
+            iProfile->AppendL( aValue, EXdmPropAuthType );
+            iSettingsSet = ETrue;
+            break;
+            }
+        case EUri:
+            {
+            // First remove default value.
+            iProfile->RemoveL( EXdmPropUri );
+            iProfile->AppendL( aValue, EXdmPropUri );
+            iSettingsSet = ETrue;
+            break;
+            }
+        case EUsername:
+            {
+            iProfile->AppendL( aValue, EXdmPropAuthName );
+            iSettingsSet = ETrue;
+            break;
+            }
+        case EPassword:
+            {
+            iProfile->AppendL( aValue, EXdmPropAuthSecret );
+            iSettingsSet = ETrue;
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Checks for duplicate named XDM sets. Renames if same.
+// ---------------------------------------------------------------------------
+//
+void CVoipXmlXdmHandler::CreateProviderNameL( TDes& aName )
+    {
+    DBG_PRINT( "CVoipXmlXdmHandler::CreateProviderNameL begin" );
+	
+    const TInt maxModifyLength = 
+        KMaxNodeNameLength - KMaxProfileNameAppendLength;
+    RArray<TInt> settingIds;
+    CleanupClosePushL( settingIds ); // CS:1
+    // CS:2
+    CDesCArray* names = TXdmSettingsApi::CollectionNamesLC( settingIds );
+
+    HBufC* newName = HBufC::NewLC( KMaxNodeNameLength ); // CS:3
+    newName->Des().Copy( aName.Left( maxModifyLength ) );
+    const TInt count( names->MdcaCount() );
+    TUint i( 1 ); // Add number to the name if name already in use.
+
+    // Go through each profile and see if the name of the new profile    
+    // matches one of the existing names. If it does change it and
+    // check the new name again.
+    for ( TInt counter = 0; counter < count; counter++ )
+        {
+        TBuf<KMaxNodeValueLength> loadedName;
+        loadedName.Copy( names->MdcaPoint( counter ));
+        if ( 0 == newName->Des().Compare( loadedName ) )
+            {
+            // If the name is changed we need to begin the comparison
+            // again from the first profile.
+            newName->Des().Copy( aName.Left( maxModifyLength ) );
+            newName->Des().Append( KOpenParenthesis() );
+            newName->Des().AppendNum( i );
+            newName->Des().Append( KClosedParenthesis() );  
+            counter = 0;
+            i++;
+            if ( KMaxProfileNames < i )
+                {
+                User::Leave( KErrBadName );
+                }
+            }
+        }
+    aName.Copy( newName->Des() );
+
+    // newName, names, &settingIds
+    CleanupStack::PopAndDestroy( 3, &settingIds );
+    DBG_PRINT( "CVoipXmlXdmHandler::CreateProviderNameL end" );
+    }
+
+// End of file.